#include <stdint.h>
typedef void (*ptr)();
void P(ptr x)
{
if (H(x, x))
HERE: goto HERE;
return;
}
int main()
{
Output("Input_Halts = ", H(P, P));
}
_P()
[00001352](01) 55 push ebp
[00001353](02) 8bec mov ebp,esp
[00001355](03) 8b4508 mov eax,[ebp+08]
[00001358](01) 50 push eax // push P
[00001359](03) 8b4d08 mov ecx,[ebp+08]
[0000135c](01) 51 push ecx // push P
[0000135d](05) e840feffff call 000011a2 // call H
[00001362](03) 83c408 add esp,+08
[00001365](02) 85c0 test eax,eax
[00001367](02) 7402 jz 0000136b
[00001369](02) ebfe jmp 00001369
[0000136b](01) 5d pop ebp
[0000136c](01) c3 ret
Size in bytes:(0027) [0000136c]
Every sufficiently competent software engineer can easily verify that
the complete and correct x86 emulation of the input to H(P,P) by H would
never reach the "ret" instruction of P.
#define JMP 0xEB // Simplifed OpCode for all forms of JMP
#define CALL 0xE8 // Simplifed OpCode for all forms of CALL
#define JCC 0x7F // Simplifed OpCode for all forms of Jump on Condition
#define RET 0xC3 // Simplifed OpCode for all forms of Return
#define PUSH 0x68 // Simplifed OpCode for all forms of PUSH
typedef struct Decoded
{
u32 Address;
u32 ESP; // Current value of ESP
u32 TOS; // Current value of Top of Stack
u32 NumBytes;
u32 Simplified_Opcode;
u32 Decode_Target;
} Decoded_Line_Of_Code;
Software engineers with extremely high technical competence will be able
to verify that H correctly determines (in a finite number of steps) that
its complete and correct x86 emulation of its input would never reach
the "ret" instruction of P on this criterion measure basis:
H knows its own machine address and on this basis:
(a) H recognizes that P is calling H with the same arguments that H was
called with at its machine address [0000135d]. The immecdiately
precdding pait of PUSH instructions
(b) There are no instructions in P that could possibly escape this
otherwise infinitely recursive emulation.
(c) H aborts its emulation of P before its call to H is invoked.
machine stack stack machine assembly
address address data code language
======== ======== ======== ========= =============
Begin Simulation Execution Trace Stored at:211e9e
...[000010d2][00211e8a][00211e8e] 55 push ebp
...[000010d3][00211e8a][00211e8e] 8bec mov ebp,esp
...[000010d5][00211e8a][00211e8e] 8b4508 mov eax,[ebp+08]
...[000010d8][00211e86][000010d2] 50 push eax // Push P
...[000010d9][00211e86][000010d2] 8b4d08 mov ecx,[ebp+08]
...[000010dc][00211e82][000010d2] 51 push ecx // Push P
...[000010dd][00211e7e][000010e2] e820feffff call 00000f02 // Call H
Infinitely Recursive Simulation Detected Simulation Stopped
Software engineers with extremely high technical competence could
translate the above criterion measure into working code on the basis of
an the execution_trace list of Decoded_Line_Of_Code of the x86 emulated
first seven instructions of P shown above. It is assumed that P has been
translated into x86 by the Microsoft C compiler, thus having the C
calling conventions.
https://docs.microsoft.com/en-us/cpp/cpp/cdecl?view=msvc-170
--
Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
Genius hits a target no one else can see." Arthur Schopenhauer