A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

The Halting Problem

Graduate Depth 96 in the knowledge graph I know this Set as goal
5topics build on this
445prerequisites beneath it
See this on the map →
Decidable LanguagesCantor's Diagonalization Argument+2 moreRecognizability vs. Decidability
halting-problem undecidability diagonalization HALT_TM

Core Idea

The halting problem asks: given a Turing machine M and input w, does M halt on w? Turing proved in 1936 that no TM can decide this — HALT_TM is undecidable. The proof uses diagonalization: assume a decider H exists, construct a machine D that does the opposite of what H predicts for D itself, yielding a contradiction. The halting problem is the canonical undecidable problem; hundreds of other undecidable problems are proved undecidable by reducing the halting problem to them.

How It's Best Learned

Follow the diagonalization argument carefully, constructing the contradiction step-by-step. Then read Turing's original 1936 paper for historical context. Finally, practice the reduction technique by showing ε_TM (does M accept ε?) is undecidable via a reduction from HALT_TM.

Common Misconceptions

Explainer

You've established that decidable languages are those with Turing machines that always halt with a correct answer. The natural next question is: are *all* languages decidable? The halting problem provides the definitive answer — no — and it does so through one of the most elegant arguments in all of mathematics. The question is deceptively simple: given a description of a Turing machine M and an input w, does M eventually halt when run on w, or does it loop forever?

At first, this seems like it should be solvable. After all, you can examine the code of a program and often tell whether it will terminate. But the halting problem asks for a *universal* solution — an algorithm that works for *every* possible program and *every* possible input. Turing proved in 1936 that no such algorithm exists. The proof is a masterpiece of self-reference and contradiction, closely related to the diagonalization technique you know from Cantor's work on countability.

Here's how the argument works. Assume, for contradiction, that a Turing machine H exists that decides the halting problem: H(⟨M, w⟩) accepts if M halts on w, and rejects if M loops. Now construct a new machine D that takes a Turing machine description ⟨M⟩ as input, runs H(⟨M, ⟨M⟩⟩) to ask "does M halt when given its own description?", and then *does the opposite* — if H says M halts, D loops forever; if H says M loops, D halts and accepts. Now ask: what happens when D is given its own description? D(⟨D⟩) runs H(⟨D, ⟨D⟩⟩). If H says D halts on ⟨D⟩, then D loops — contradicting H's answer. If H says D loops on ⟨D⟩, then D halts — again contradicting H. Either way, H gives the wrong answer. Since we derived a contradiction from the assumption that H exists, no such H can exist.

The halting problem's significance extends far beyond this single result. It is the canonical undecidable problem — the starting point for proving that hundreds of other problems are also undecidable. The technique is reduction: to show that some new problem X is undecidable, you show that if you *could* decide X, you could use that ability to decide the halting problem — which you've already proved impossible. For example, the question "does Turing machine M accept the empty string?" is undecidable because you can transform any halting-problem instance into this form. Note the critical distinction: the halting problem is recognizable (you can run M on w and accept if it halts — you just can't detect the looping case), but it is not decidable. This gap between recognizability and decidability becomes a central theme in computability theory.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesFinite State Machines (FSMs)Deterministic Finite Automata (DFA)Nondeterministic Finite Automata (NFA)Two-Way Finite AutomataNFA to DFA Conversion (Subset Construction)DFA Properties and Minimization AlgorithmsRegular Languages: Definition and CharacterizationContext-Free Grammars (CFGs)Pushdown Automata (PDA)Equivalence of CFGs and Pushdown AutomataClosure Properties of Context-Free LanguagesLimitations of Context-Free LanguagesPumping Lemma for Context-Free LanguagesTuring MachinesVariants of Turing Machines and EquivalenceUniversal Turing Machine and Self-SimulationChurch-Turing Thesis and ComputabilityDecidable LanguagesThe Halting Problem

Longest path: 97 steps · 445 total prerequisite topics

Prerequisites (4)

Leads To (1)