Why This Question Matters
We ask for a single algorithm that takes two inputs, a machine encoding \(\langle M \rangle\) and an input string \(w\), and answers: does \(M\) ever halt on \(w\)?
Core Decision Problem
\(\mathrm{HALT}_{TM} = \{\langle M,w\rangle \mid M \text{ halts on } w\}\).
If this language were decidable, we could algorithmically detect non-termination for every program.
Computational Perspective
- Universal Turing machines let one TM simulate any other TM from an encoding.
- So deciding \(\mathrm{HALT}_{TM}\) is equivalent to deciding whether universal simulation will eventually stop.
- The proof below shows that no decider can solve this for all encoded machines and inputs.
Formal Statement and Assumptions
Theorem (Halting Problem)
\(\mathrm{HALT}_{TM}\) is undecidable.
Assumption for Contradiction
Assume there exists a total Turing machine \(H\) deciding \(\mathrm{HALT}_{TM}\). Then for all \(\langle M,w\rangle\):
Encoding Preconditions
- Every TM has an effective encoding \(\langle M \rangle\).
- Pairs are effectively encoded as \(\langle M,w \rangle\).
- A universal TM \(U\) exists such that \(U(\langle M,w\rangle)\) simulates \(M\) on \(w\).
Complete Formal Proof (By Contradiction)
- If \(H(\langle D,D\rangle)=\text{YES}\), then \(H\) predicts that \(D\) halts on \(\langle D\rangle\). But by definition of \(D\), it loops forever. Contradiction.
- If \(H(\langle D,D\rangle)=\text{NO}\), then \(H\) predicts that \(D\) does not halt on \(\langle D\rangle\). But by definition of \(D\), it halts immediately. Contradiction.
Conclusion
No Turing machine decides \(\mathrm{HALT}_{TM}\). Hence \(\mathrm{HALT}_{TM}\) is undecidable. \(\square\)
Connection to Universal Turing Machines
The proof critically depends on universal computation. A UTM \(U\) can interpret encoded machines as data.
How \(D\) Uses Universality
- \(H\) must analyze arbitrary encoded computations, i.e., it is reasoning over what \(U\) would simulate.
- Self-reference \(\langle D,D\rangle\) is possible only because machines are encodable strings.
- The contradiction shows no universal "halts-or-not" predictor can exist for all encoded computations.
Important Distinction
A UTM can simulate every TM, but cannot in general decide in advance whether simulation halts. Universality gives expressive power, and the halting theorem gives a hard limit on prediction.
Proof Flow (Inputs, Outputs, and Contradiction)
1) Hypothetical Decider and Diagonal Machine Construction
2) Contradiction on Self-Reference Input \(\langle D,D\rangle\)
Final takeaway: Any claimed total halting decider can be diagonalized into failure on a self-referential encoded input.