Undecidability of the halting problem
Statement
There is no algorithm that, given an arbitrary program (Turing machine) and input , always correctly decides in finite time whether halts when run on .
Why is it true?
Suppose such a halting-decider existed. Build a program that, on input a program , runs to check whether halts when run on itself, then does the opposite (loops forever if halts, halts if loops). Running on itself as input leads to a contradiction either way, so cannot exist.
Proof sketch
Diagonal argument: assume a decider exists that outputs whether halts on ; define 'loop forever' if says 'halts', else 'halt'; then ask whether halts. If it halts, by definition said 'loop forever', a contradiction; if it loops forever, said 'halts', also a contradiction. So cannot exist.
Proved by
Topics that use this theorem
Related theorems
Step-by-step proofs
No step-by-step proof yet for this theorem.
References
- Alan M. Turing (1936). On Computable Numbers, with an Application to the Entscheidungsproblem · DOI:10.1112/plms/s2-42.1.230
- Michael Sipser (2012). Introduction to the Theory of Computation