Undecidability and the Halting Problem
Context: FIT2014_MOC Ā· names the ring left open by Decidability and Decision Problems ā the first explicitly undecidable language, and the seed every later undecidability proof reduces from (Proving Undecidability by Reduction)
Quick Revision
- šÆ Objective: is undecidable ā assume a decider , build that does the opposite of what predicts about , read off the contradiction.
- š¦ Core Components: counting ā some language is undecidable | diagonalisation ā this language is undecidable | ā the one-argument version the proof actually kills.
- ā ļø Key Constraint: undecidable ā unanswerable. Every individual has a Yes/No answer; what cannot exist is one machine that halts with the right answer on every instance.
š How It Works
1. Undecidable languages exist (the counting argument)
- Deciders are countable ā (Encoding Turing Machines (Code Words)), and is countable ā¹ at most countably many decidable languages.
- Languages are uncountable ā Cantor diagonalisation on (Countability and Cantor Diagonalisation).
- Conclusion ā forces undecidable languages to exist ā but this is a pure existence proof: it exhibits none, which is exactly why the Halting Problem is needed.
2. The problem itself
Halting Problem. Input: a Turing machine and an input . Question: if is run on , does it eventually halt?
- As a language ā , via the problem ā· language bridge of Decidability and Decision Problems.
- Halting, not accepting ā the question is whether stops in any state; Accept and Reject both count as halting, only is the No-answer.
- Historical name ā Hilbertās Entscheidungsproblem; killed independently by Church (1936, -calculus) and Turing (1936ā37, Turing machines).
- Diagonal Halting Problem ā Input: a TM . Question: does halt on input ? The one-argument restriction ā and the version the proof below actually refutes, hence the version every reduction starts from.
3. Why self-application is legal
- Programs are strings ā is a word over (Encoding Turing Machines (Code Words)), so it is a perfectly legal input to a machine ā the stored-program idea is what makes ārun on ā meaningful rather than a category error.
- Proof ingredients ā contradiction diagonalisation a machine version of the Liar Paradox (āthis sentence is falseā).
š§® Proof Blueprint ā the Halting Problem is undecidable
Theorem. The Halting Problem is undecidable. Equivalently, no decider settles .
Strategy ā assume the decider, use it to build a machine whose behaviour must contradict the deciderās own verdict on that machine.
Derivation
Both branches are self-contradictory, and every step after 1 is a legitimate construction, so the fault lies in 1. Therefore no such exists.
- Key move: ās row of the behaviour table is the flipped diagonal, so differs from every machine in the list at its own index ā including itself, which is the impossibility.
- What is actually refuted: step 2 only ever uses on , so the proof kills the DIAGONAL HALTING PROBLEM first; the general Halting Problem is undecidable a fortiori (a decider for it would restrict to one for the diagonal version).
š Manual Execution Trace ā the diagonalisation table
Rows are TMs (by code word), columns are inputs; ā halts, ā loops forever. is defined to flip the shaded diagonal.
| TM / input | |||||
|---|---|---|---|---|---|
| ā | ā | ā | ā | ||
| ā | ā | ā | ā | ||
| ā | ā | ā | ā | ||
| ā | ā | ā | ā | ||
| ā | ā | ā | ā |
- Reading the flip ā ās entry in column is the negation of the diagonal entry ā¹ disagrees with machine on input , for every .
- The kill ā is itself a machine, so it owns a row; at its own column it must disagree with itself. The table therefore cannot exist, and ā which is what made constructible ā cannot either.
ā ļø Common Mistakes
- š” āUndecidable means we donāt know the answerā ā wrong on both counts. Each instance has a definite answer, and infinitely many are easy; undecidability denies a uniform total algorithm, nothing more.
- š” Confusing halting with accepting ā a machine that halts in Reject is a Yes-instance of the Halting Problem. Only contributes No-instances.
- š” āJust simulate on ā ā simulation (Universal Turing Machine) recognises halting but never certifies looping ā it gives with , i.e. r.e. but not decidable (Recursively Enumerable Languages). Timeouts do not fix it: no computable bound on running time exists.
- š” Objecting that ā run on ā is nonsense ā it is not; is just a string, and compilers compiling themselves is the everyday instance.
- š” Claiming the counting argument proves the theorem ā counting yields existence only. Without diagonalisation you cannot name a single undecidable language, and reductions need a named one to start from.
š§ Active Recall
The counting argument already shows undecidable languages exist. Why spend a whole lecture constructing the Halting Problem?
Answer
- Short answer: counting is non-constructive ā it proves the set of undecidable languages is non-empty without producing an inhabitant, and reductions need a named, concrete source language to transport undecidability from.
- Why: Cardinality vs. exhibition ā while settles existence; the Halting Problem is additionally natural and universal, so every later result (, , Hilbertās tenth problem) is one reduction away.
Exactly which assumption does the contradiction refute ā why can't be the faulty step?
Answer
- Short answer: ās construction is unconditionally legal given ā it is a finite program that calls a total subroutine and then branches ā so the only defeasible hypothesis in the chain is the existence of .
- Why: was assumed to be a decider, hence total ā every call returns, so is well defined on all inputs and has a code word like any other machine. If instead were merely a recogniser, the branch ā says LOOPSā might never fire, would simply loop, and no contradiction arises ā which is precisely why is r.e. yet undecidable.