The question: Is it possible to create a problem that determines, for any given program and its input, whether that program will halt or loop?
- Let’s say there is machine
Hthat correctly predicts if it will get stuck for any given program.H(p1, 5) -> loopH(p2, 10) -> halt
- Let’s say there is a machine
Nthat does the opposite of the given input ofhalt/loopN(halt) -> loopN(loop) -> halt
- Now, let’s combine these programs and call it
X- A machine
Pthat duplicates whatever is inputted Hthat will receive 2 arguments (program, input)Nthat will negatehalt/loop
- A machine
- Let’s try inputting
XintoXP→ duplicatesXH→H(X,X)- This will give us an output, let’s say
halt
- This will give us an output, let’s say
N(halt) -> loop- Now
haltis negated, resulting inXin aloop
- Now
- This is a contradiction because
HsaidXwillhalt, but it’s in aloop
- Therefore,
Hcannot exist