On 7/16/2022 10:54 AM, Mike Terry wrote:
> On 16/07/2022 12:23, Paul N wrote:
> PO's simulation is correct at the individual instruction level.
> His H steps the simulation forward a number of steps, and each
> of those steps exactly matches the P(P) calculation steps.
We can see from the x86 execution trace of the simulated P that the
behavior of this simulated P exactly matches its x86 source-code,
line-by-line.
What we can also see from this same execution trace is that when H calls
H(P,P) the simulated P remains stuck calling H(P,P) to simulate itself
again thus forever preventing this simulated P from ever terminating
normally by reaching its C:"return" or x86:"ret" instruction.
*H(P,P) correctly determines that its input never halts*
typedef void (*ptr)();
int H(ptr p, ptr i); // simulating halt decider
void P(ptr x)
{
int Halt_Status = H(x, x);
if (Halt_Status)
HERE: goto HERE;
return;
}
int main()
{
Output("Input_Halts = ", H(P, P));
}
_P()
[000013c6](01) 55 push ebp // Save Base Pointer
register onto the stack
[000013c7](02) 8bec mov ebp,esp // Load Base Pointer
with Stack Pointer
[000013c9](01) 51 push ecx // Save the value of
ecx on the stack
[000013ca](03) 8b4508 mov eax,[ebp+08] // Load eax with
argument to P
[000013cd](01) 50 push eax // push 2nd argument
to H onto the stack
[000013ce](03) 8b4d08 mov ecx,[ebp+08] // Load ecx with with
argument to P
[000013d1](01) 51 push ecx // push 1st argument
to H onto the stack
[000013d2](05) e82ffdffff call 00001106 // push return address
on the stack; call simulated H
[000013d7](03) 83c408 add esp,+08 // remove call
arguments from stack
[000013da](03) 8945fc mov [ebp-04],eax // load Halt_Status
with return value from H
[000013dd](04) 837dfc00 cmp dword [ebp-04],+00 // compare Halt_Status
to 0
[000013e1](02) 7402 jz 000013e5 // if Halt_Status == 0
goto 000013e5
[000013e3](02) ebfe jmp 000013e3 // goto 13e3
[000013e5](02) 8be5 mov esp,ebp // Load Stack Pointer
with Base Pointer
[000013e7](01) 5d pop ebp // Restore Base
Pointer value from stack
[000013e8](01) c3 ret // return to caller
Size in bytes:(0035) [000013e8]
_main()
[000013f6](01) 55 push ebp // Save Base Pointer register
onto the stack
[000013f7](02) 8bec mov ebp,esp // Load Base Pointer with Stack
Pointer
[000013f9](05) 68c6130000 push 000013c6 // Push P (2nd argument to H)
onto the stack
[000013fe](05) 68c6130000 push 000013c6 // Push P (1nd argument to H)
onto the stack
[00001403](05) e8fefcffff call 00001106 // push return address onto the
stack and call executed H
[00001408](03) 83c408 add esp,+08 // remove call arguments from
stack frame
[0000140b](01) 50 push eax // Push return value from H
onto the stack
[0000140c](05)
6837050000 push 00000537 // Push address of "Input_Halts
= " onto the stack
[00001411](05) e870f1ffff call 00000586 // call Output with its pushed
arguments.
[00001416](03) 83c408 add esp,+08 // remove call arguments from
stack frame
[00001419](02) 33c0 xor eax,eax // set eax to 0
[0000141b](01) 5d pop ebp // Restore Base Pointer
register from stack
[0000141c](01) c3 ret // return to 0 operating system
Size in bytes:(0039) [0000141c]
machine stack stack machine assembly
address address data code language
======== ======== ======== ========= =============
[000013f6][0010235f][00000000] 55 push ebp
[000013f7][0010235f][00000000] 8bec mov ebp,esp
[000013f9][0010235b][000013c6] 68c6130000 push 000013c6 // Push P (2nd
argument to H) onto the stack
[000013fe][00102357][000013c6] 68c6130000 push 000013c6 // Push P (1nd
argument to H) onto the stack
[00001403][00102353][00001408] e8fefcffff call 00001106 // push return
address; call executed H
H: Begin Simulation Execution Trace Stored at:11240b
Address_of_H:1106
[000013c6][001123f7][001123fb] 55 push ebp
[000013c7][001123f7][001123fb] 8bec mov ebp,esp
[000013c9][001123f3][001023c7] 51 push ecx // Save the
value of ecx on the stack
[000013ca][001123f3][001023c7] 8b4508 mov eax,[ebp+08] // Load eax
with argument to P
[000013cd][001123ef][000013c6] 50 push eax // push 2nd
argument to H onto the stack
[000013ce][001123ef][000013c6] 8b4d08 mov ecx,[ebp+08] // Load ecx
with with argument to P
[000013d1][001123eb][000013c6] 51 push ecx // push 1st
argument to H onto the stack
[000013d2][001123e7][000013d7] e82ffdffff call 00001106 // push
return address; call simulated H
H: Infinitely Recursive Simulation Detected Simulation Stopped
[00001408][0010235f][00000000] 83c408 add esp,+08
[0000140b][0010235b][00000000] 50 push eax // Push return
value from H onto the stack
[0000140c][00102357][00000537]
6837050000 push 00000537 // Push address
of "Input_Halts = " onto stack
[00001411][00102357][00000537] e870f1ffff call 00000586 // call Output
with its pushed arguments
Input_Halts = 0
[00001416][0010235f][00000000] 83c408 add esp,+08
[00001419][0010235f][00000000] 33c0 xor eax,eax // set eax to 0
[0000141b][00102363][00000018] 5d pop ebp
[0000141c][00102367][00000000] c3 ret // return to 0
operating system
Number of Instructions Executed(987) == 15 Pages
--
Copyright 2022 Pete Olcott
"Talent hits a target no one else can hit;
Genius hits a target no one else can see."
Arthur Schopenhauer