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

Undecidable Problems and the Halting Problem

Graduate Depth 98 in the knowledge graph I know this Set as goal
3topics build on this
448prerequisites beneath it
See this on the map →
Diagonalization and UncomputabilityRecognizability vs. DecidabilityReduction Techniques for Proving Undecidability
undecidability halting-problem limits

Core Idea

The halting problem—determining whether a Turing machine halts on a given input—is undecidable. This is proved by contradiction: if a halting decider existed, a diagonalization argument would construct a machine that produces a contradiction. The halting problem represents a fundamental limit on computation.

How It's Best Learned

Follow the diagonal construction proof carefully. Understand why the self-reference ('a machine that halts iff it loops') creates a logical contradiction. Work through small examples of the argument.

Explainer

From your study of recognizable languages, you know that Turing machines can accept languages — saying "yes" for strings in the language, though possibly looping forever on strings outside it. A decidable problem is one where a Turing machine always halts with a correct yes or no answer. The halting problem asks the seemingly reasonable question: given a Turing machine M and an input w, does M halt on w? The shocking answer is that no algorithm can solve this problem in general.

The proof uses diagonalization, a technique of self-reference that forces a contradiction. Suppose a decider H exists that correctly answers "yes" or "no" for every (M, w) pair. Now construct a new machine D that takes a Turing machine description M as input and does the following: D runs H on the pair (M, M) — asking whether M halts when given its own description as input. If H says "yes, M halts on M," then D deliberately loops forever. If H says "no, M does not halt on M," then D halts. Now ask: what happens when D is run on its own description? If D halts on D, then by construction H said "no" — meaning D does not halt on D. Contradiction. If D does not halt on D, then H said "yes" — meaning D does halt on D. Contradiction again. Either way, H gave the wrong answer, so H cannot exist.

This result reveals a fundamental limit of computation, not a limitation of current technology or programming skill. No faster computer, cleverer algorithm, or future programming language can solve the halting problem. The argument works for any computational model equivalent to Turing machines, which by the Church-Turing thesis includes everything we consider "computable." The undecidability of the halting problem is not an engineering obstacle — it is a mathematical theorem about the structure of computation itself.

The halting problem is the first and most important undecidable problem, but it is far from the only one. Once you have one undecidable problem, you can prove others undecidable through reductions — showing that if you could solve the new problem, you could use it to solve the halting problem, which you know is impossible. This technique reveals that virtually every non-trivial semantic property of programs is undecidable: Does this program ever print "hello"? Does it compute the same function as that program? Is it free of infinite loops? Rice's theorem formalizes this, establishing that any non-trivial property of the language recognized by a Turing machine is undecidable. The halting problem is thus not an isolated curiosity but the gateway to a vast landscape of unsolvable problems.

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 ProblemRecognizability vs. DecidabilityUndecidable Problems and the Halting Problem

Longest path: 99 steps · 448 total prerequisite topics

Prerequisites (2)

Leads To (1)