001 int h(x, y); // suppose the detail of h(x, y) is in a library.
002
003 int c(x) {
004 int halt_status = h(x, x)
005 if (h(halt_status != 0) {
006 while(TRUE) {
007 ;
008 }
009 }
010 return halt_status;
011 }
012
013 main() {
014 Output("Input_Halts = ", h(c, c));
015 Output("Input_Halts = ", c(c));
016 }
*Simulating halt deciders applied to the halting theorem*
Because c simulated by h would continue to call h(c,c) never reaching
its own "if" statement h aborts it simulation of c and returns 0 to main
on line 014.
Because c simulated by h would continue to call h(c,c) never reaching
its own "if" statement h aborts it simulation of c and returns 0 to the executed c on line 004.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 67:15:32 |
Calls: | 8,084 |
Calls today: | 2 |
Files: | 13,068 |
Messages: | 5,849,427 |