A Turing machine uses a tape for input, memory, and output which can be extended as much as required to the left and to the right. The tape is divided into cells and each cell contains a symbol from a finite alphabet. One of the symbols in the alphabet is b standing for blank. At any time, only a finite number of tape cells contain nonblank symbols.
A Turing machine also has a unit with a finite number of states: 1, 2, ..., k, that can read the symbol in one of the tape cells. Depending on its current state and the symbol it is reading, the unit can:
| if you are in state i | |
| and | |
| you are reading symbol j | |
| then | |
| write symbol k on the tape | |
| go into state s | |
| move in direction d |
If this program is given a tape with a single nonblank cell containing a 1 then the program will immediately halt. If, on the other hand, the tape has a single nonblank cell containing a 0 then the program will keep moving to the right and never halt. This program will only halt in a finite amount time provided the tape contains at least one nonblank cell containing some symbol other than 0.
| (1, 1, 1, 2, R) | Even parity state reading 1, change state |
|---|---|
| (1, 0, 0, 1, R) | Even parity state reading 0, don't change state |
| (2, 1, 1, 1, R) | Odd parity state reading 1, change state |
| (2, 0, 0, 2, R) | Odd parity state reading 0, don't change state |
| (1, b, 1, 3, R) | End of string in even parity state, write 1 and go to state 3 |
| (2, b, 0, 3, R) | End of string in odd parity state, write 0 and go to state 3 |
where T* is the collection of instructions of T encoded as a sequence of 0 symbols and 1 symbols. We must insist that P always halts and gives the correct answer, say:
If the T/t combination does halt then P halts in some state s reading a 1-symbol on its tape so P has no instruction of the form (s,1,-,-,-).
Pick some state number, s', that P never enters and construct another Turing machine, Q, that contains all the instructions of P plus these two instructions:
Note that if Q is given the input tape, ... b b T* b t b b ..., then Q halts if the T/t combination never halts or Q never halts if the T/t combination does halt.
Now we construct another Turing machine, S, that first makes a copy of what appears on its input tape, and then uses the same instructions as Q. What happens if S is given an input tape containing S*, the encoded version of its instruction set? Does the S/S* combination halt or not?
The assumption is false: it's impossible to build a Turing machine, P, that solves the halting problem for any Turing machine and input tape combination.
The halting problem is unsolvable. A number of other problems are also unsolvable.