Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Infinite recursion detection criteria (Please correct me if I am

11 views
Skip to first unread message

olcott

unread,
Apr 17, 2021, 10:22:34 AM4/17/21
to
If a function X() is called by function Y() twice in sequence from the
same machine address of Y() with the same parameters to X() and the
execution trace shows no conditional branch instructions in Y() or
function call returns in X() then the function call from Y() to X() is
infinitely recursive unless X() stops it.

The referenced excution trace is on x86 machine language, disassembled
for human consumption.

--
Copyright 2021 Pete Olcott

"Great spirits have always encountered violent opposition from mediocre
minds." Einstein

olcott

unread,
Apr 17, 2021, 12:07:52 PM4/17/21
to
On 4/17/2021 9:15 AM, olcott wrote:
> If a function X() is called by function Y() twice in sequence from the
> same machine address of Y() with the same parameters to X() and the
> execution trace shows no conditional branch instructions in Y() or
> function call returns in X() then the function call from Y() to X() is
> infinitely recursive unless X() stops it.
>
> The referenced execution trace is on x86 machine language, disassembled
> for human consumption.
>

When Halts() uses an x86 emulator to simulate its input and maintains an
execution trace of this emulation then it can examine this execution
trace according to the above criteria and correctly decide that Y() is
invoking X() in infinite recursion. On this basis it can stop simulating
Y() and report that Y() would not halt unless its execution was aborted
by Halts().

void Y(u32 P)
Halts(P, P);
}


int main()
{
Halts((u32)Y, (u32)Y);
}


_Y()
[000009ac](01) 55 push ebp
[000009ad](02) 8bec mov ebp,esp
[000009af](03) 8b4508 mov eax,[ebp+08]
[000009b2](01) 50 push eax
[000009b3](03) 8b4d08 mov ecx,[ebp+08]
[000009b6](01) 51 push ecx
[000009b7](05) e840feffff call 000007fc
[000009bc](03) 83c408 add esp,+08
[000009bf](01) 5d pop ebp
[000009c0](01) c3 ret
Size in bytes:(0021) [000009c0]

_main()
[000009cc](01) 55 push ebp
[000009cd](02) 8bec mov ebp,esp
[000009cf](05) 68ac090000 push 000009ac
[000009d4](05) 68ac090000 push 000009ac
[000009d9](05) e81efeffff call 000007fc
[000009de](03) 83c408 add esp,+08
[000009e1](02) 33c0 xor eax,eax
[000009e3](01) 5d pop ebp
[000009e4](01) c3 ret
Size in bytes:(0025) [000009e4]

===============================
....[000009cc][00011278][00000000](01) 55 push ebp
....[000009cd][00011278][00000000](02) 8bec mov ebp,esp
....[000009cf][00011274][000009ac](05) 68ac090000 push 000009ac
....[000009d4][00011270][000009ac](05) 68ac090000 push 000009ac
....[000009d9][0001126c][000009de](05) e81efeffff call 000007fc
Begin Local Halt Decider Simulation at Machine Address:9ac
....[000009ac][00031318][0003131c](01) 55 push ebp
....[000009ad][00031318][0003131c](02) 8bec mov ebp,esp
....[000009af][00031318][0003131c](03) 8b4508 mov
eax,[ebp+08]
....[000009b2][00031314][000009ac](01) 50 push eax
....[000009b3][00031314][000009ac](03) 8b4d08 mov
ecx,[ebp+08]
....[000009b6][00031310][000009ac](01) 51 push ecx
....[000009b7][0003130c][000009bc](05) e840feffff call 000007fc
....[000009ac][0007bd40][0007bd44](01) 55 push ebp
....[000009ad][0007bd40][0007bd44](02) 8bec mov ebp,esp
....[000009af][0007bd40][0007bd44](03) 8b4508 mov
eax,[ebp+08]
....[000009b2][0007bd3c][000009ac](01) 50 push eax
....[000009b3][0007bd3c][000009ac](03) 8b4d08 mov
ecx,[ebp+08]
....[000009b6][0007bd38][000009ac](01) 51 push ecx
....[000009b7][0007bd34][000009bc](05) e840feffff call 000007fc
Local Halt Decider: Infinite Recursion Detected Simulation Stopped
....[000009de][00011278][00000000](03) 83c408 add esp,+08
....[000009e1][00011278][00000000](02) 33c0 xor eax,eax
....[000009e3][0001127c][00010000](01) 5d pop ebp
....[000009e4][00011280][00000058](01) c3 ret
Number_of_User_Instructions(23)
Number of Instructions Executed(16920)
sizeof(Decoded_Line_Of_Code)(24)

Kaz Kylheku

unread,
Apr 17, 2021, 5:37:05 PM4/17/21
to
On 2021-04-17, olcott <No...@nospicedham.NoWhere.com> wrote:
> If a function X() is called by function Y() twice in sequence from the
> same machine address of Y() with the same parameters to X() and the
> execution trace shows no conditional branch instructions in Y() or

The problem is, the execution trace only shows no such instructions
because you have concealed them. You have declared that X is part
of the "operating system" and not part of the test case.
So in your trace there is an illegal discontinuity. There is a JSR Halts
instruction executed, but then the next instruction which is traced
is not inside Halts, but inside H_Hat. The address does not match.

> function call returns in X() then the function call from Y() to X() is
> infinitely recursive unless X() stops it.

Problem is, the above decision about the traces is being made by X
itself. It is accessing these global tracers, which make X not a
function, but an imperative procedure.

Below is a quote from the following idiotic document:

http://www.liarparadox.org/Eliminating_pathological_self_reference_error_from_the_halting_problem.pdf

Note how after every "call 00000833", the next instruction being traced is
not 00000833, but 00000A63. A63 is _H_Hat.

The document does not reveal the disassembly of code at 833, so we have no
idea what instructions are there. However, those instructions have to do
with the decision that leads to "Infinite Recursion Detected", which is not
possible without conditionals.

(01)[00000a93][000114f7][00000000] (01) 55 push ebp
(02)[00000a94][000114f7][00000000] (02) 8bec mov ebp,esp
(03)[00000a96][000114f3][00000000] (01) 51 push ecx
(04)[00000a97][000114ef][00000a63] (05) 68630a0000 push 00000a63
(05)[00000a9c][000114eb][00000a63] (05) 68630a0000 push 00000a63
(06)[00000aa1][000114e7][00000aa6] (05) e8ddfdffff call 00000883
(07)[00000a63][00031577][0003157b] (01) 55 push ebp
(08)[00000a64][00031577][0003157b] (02) 8bec mov ebp,esp
(09)[00000a66][00031573][00021547] (01) 51 push ecx
(10)[00000a67][00031573][00021547] (03) 8b4508 mov eax,[ebp+08]
(11)[00000a6a][0003156f][00000a63] (01) 50 push eax
(12)[00000a6b][0003156f][00000a63] (03) 8b4d08 mov ecx,[ebp+08]
(13)[00000a6e][0003156b][00000a63] (01) 51 push ecx
(14)[00000a6f][00031567][00000a74] (05) e80ffeffff call 00000883
(15)[00000a63][0004271f][00042723] (01) 55 push ebp
(16)[00000a64][0004271f][00042723] (02) 8bec mov ebp,esp
(17)[00000a66][0004271b][000326ef] (01) 51 push ecx
(18)[00000a67][0004271b][000326ef] (03) 8b4508 mov eax,[ebp+08]
(19)[00000a6a][00042717][00000a63] (01) 50 push eax
(20)[00000a6b][00042717][00000a63] (03) 8b4d08 mov ecx,[ebp+08]
(21)[00000a6e][00042713][00000a63] (01) 51 push ecx
(22)[00000a6f][0004270f][00000a74] (05) e80ffeffff call 00000883
Infinite Recursion Detected Simulation Stopped

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

0 new messages