Halting Problem
- Imagine there is a function
bool doesItHalt({function f, input i})that returns if the parameter functionf(i)halts or not. - Now consider the following functions:
- Essentially, if
f(i)halts, theinvertHaltwill hang (i.e., wouldn't halt), and iff(i)hangs, theinvertHaltwill halt. - Let us consider the composition of the two functions:
- Will
unknown(unknown)halt? What shoulddoesItHalt({unknown, unknown})return? - Let us suppose it will return
true. Then, it means thatdoesItHalt({unknown, unknown})returnedfalsebecauseinvertHalt(b)would've hung otherwise. Therefore, this contradicts our supposition thatdoesItHalt({unknown, unknown})returnstrue. - Let us suppose it will return
false. Then, it means thatdoesItHalt({unknown, unknown})would returntruebecauseinvertHaltwouldn't hang otherwise. Therefore, this contradicts our supposition thatdoesItHalt({unknown, unknown})returnsfalse. - Therefore,
unknowncannot hang nor halt; therefore, no suchdoesItHaltcan exist.
Backlinks (1)
Comments (0)