Next: Creative mathematics Up: Mathematical structure Previous: Gödel's Incompleteness Theorem   Contents

# The Halting Problem

Following is some needed notation.

1. A computer program with no inputs is represented by where is the Gödel number of the program.
2. A computer program with a single integer parameter is represented by . is the Gödel number of the program. is the parameter. If a program halts it may generate an output value. This is written as and .
3. If or halts, write or respectively.

Following is a sketch of the proof of the unsolvability of the Halting Problem.

The Halting Problem asks does there exist a computer program such that if and otherwise.

Assume exists. The following shows that this leads to a contradiction.

From one can construct (for the Self Halting Problem). if halts. otherwise it equals 0. In other words decides whether any computer program that accepts a single integer parameter as input will halt when presented with its own Gödel number as input.

For any program it is straightforward to compute such that behaves exactly as . To construct from expand the program memory to include the value and read that data instead of reading an input parameter. Thus from a solution to the Halting Problem one can construct a solution to the Self Halting Problem.

Now , which solves the Self Halting Problem, is a computer program that accepts an integer input, Thus it has a Gödel number and is identical to . From one can construct a program with Gödel number such that halts if , otherwise it runs forever.

What does do? If halts then and thus will run forever. This is a contradiction and thus the original assumption that , a solution to the Halting Problem, exists is false.

This sketch of a proof is far simpler than Gödel's result. The program modifications described are straight forward for an experience programmer, but the details at the level of computer code are tedious. It is even more tedious to prove the modifications do what is intended. Gödel's proof in 1931 never mentioned computers. He went through the long and difficult exercise of showing that a formal system could be modeled as an arithmetic function definable within the formal system. He then proved the consistency of the formal system was equivalent to a question about this function. Using an argument similar to the above he showed one could not prove that property from within the system unless the system itself was inconsistent. One can prove anything in an inconsistent system.