Decidability
Maheshwari & Smid · Ch. 7 · Introduction to Theory of Computation
A language is decidable if a Turing machine always halts with the correct answer. It is recognizable if the machine halts on "yes" inputs but may loop forever on "no" inputs. The halting problem is recognizable but not decidable: no algorithm can determine whether an arbitrary program halts.
The halting problem
Can we write a program that takes any program P and input I and decides whether P(I) halts? No. The proof is by diagonalization: assume such a decider H exists, then build a program D that calls H on itself and does the opposite. D halts if and only if D does not halt. Contradiction.
Rice's theorem
The halting problem is just one instance of a general result. Rice's theorem: every nontrivial semantic property of programs is undecidable. "Does this program output 42?" Undecidable. "Does this program ever print anything?" Undecidable. "Is this program equivalent to that one?" Undecidable. The only decidable properties are trivial ones (true for all programs or false for all programs).
Reductions
To prove a new problem is undecidable, reduce a known undecidable problem to it. If the halting problem can be transformed into your problem, then your problem is at least as hard. Reductions are the main proof technique in decidability and complexity theory.
Neighbors
- ๐ Logic Ch.7 โ Gรถdel's incompleteness theorem and undecidability are deeply related: the halting problem is a logical statement
- ๐ Proofs Ch.7 โ diagonalization: Cantor's diagonal argument proves the same impossibility result as the halting problem proof
- ๐งฎ Lean โ proof assistants can only check decidable properties; undecidable questions cannot be automated