Machines that never stop

Put these two rules in a table and run it on AB. State 1 reading A writes A, moves right and goes to state 2. State 2 reading B writes B, moves left and goes to state 1. The head steps right, back, right, back, and never reaches ✓.

These two rules pass the head back and forth forever on AB.

Turing Daily stops a run like this after 1,000 steps and marks the example wrong. That limit is a practical one. Some other machine might need 1,001 steps and then stop. It would be better to tell, for any table and any input, whether the machine will ever stop. No program can do that, and Turing proved it in 1936.1

Some loops are easy to see

If a machine comes back to exactly the same situation, with the same state, the same head position and the same tape, it will repeat itself forever. A program can watch for that, and the loop above would be caught at once.

But a machine can also run forever without repeating anything. Give state 1 a third rule, reading the blank: write B, move right and stay in state 1. On any input it walks off the end and keeps writing B on fresh cells. The tape grows with every step, so no situation ever comes back. A program can catch this pattern too, and the next one, and the one after, but no single method that always answers can catch every pattern.

Reading the blank, state 1 writes B and moves right into another blank. This goes on forever.

The argument

Suppose someone hands you a program, call it Check, that reads the description of any machine together with an input, and always answers, after some finite time, either "stops" or "runs forever". It is never wrong.

Machines can read descriptions of machines; that is what Turing's universal machine does. So you can build a new machine, call it Contrary, that takes a description D and runs Check on D with D itself as the input. If Check answers "stops", Contrary runs forever on purpose. If Check answers "runs forever", Contrary stops.

Now give Contrary its own description. If Check says Contrary stops, then Contrary runs forever. If Check says Contrary runs forever, then it stops. Every answer Check can give is wrong, so Check cannot exist.

This is the trick Georg Cantor used to show that there are more real numbers than whole numbers: build something that differs from every item on a list in at least one place, then ask where it sits on the list.2 Turing named section 8 of his paper "Application of the diagonal process".

His own version was about a slightly different question.3 His machines were supposed to print digits forever, so he asked whether a machine will keep printing them, and showed that no machine can decide it. He knew the most direct proof might leave the reader with "a feeling that 'there must be something wrong'", and gave a second one built to avoid that. The phrase "halting problem" came later. It is usually credited to Martin Davis, in the 1950s.4

What it does not say

It does not say that you can never tell whether a particular machine stops. For most small tables you can, by running them or by reading them. It says that no single method works for every machine: any method that always answers is wrong about some machine, and any method that is never wrong fails to answer for some.

In Turing Daily, the machines used to make the puzzles finish every example in at most 14 steps, so a limit of 1,000 leaves plenty of room. A player's table could in principle stop correctly after more than 1,000 steps and still be marked wrong. Small tables can run for a very long time before they stop, as the page on the busy beaver shows, but a table that solves a Turing Daily puzzle does not need to.

Sources

  1. A. M. Turing, On Computable Numbers, with an Application to the Entscheidungsproblem, Proceedings of the London Mathematical Society s2-42 (1936), 230–265.
  2. Georg Cantor, Über eine elementare Frage der Mannigfaltigkeitslehre, Jahresbericht der Deutschen Mathematiker-Vereinigung 1 (1891), 75–78.
  3. Joel David Hamkins and Theodor Nenu, Did Turing prove the undecidability of the halting problem?, arXiv:2407.00680, 2024.
  4. Martin Davis, Computability and Unsolvability, McGraw-Hill, 1958.