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

Rice's Theorem

Graduate Depth 90 in the knowledge graph I know this Set as goal
25topics build on this
520prerequisites beneath it
See this on the map →
Computability ReductionsThe Halting Problem+2 moreRecursively Enumerable and Co-RE LanguagesRice's Theorem: Deciding Properties of Programs+1 more
undecidability semantic-properties computability

Core Idea

Rice's theorem states that every non-trivial semantic property of Turing machines is undecidable. A semantic property is one that depends on the function a TM computes — not its syntactic description — and non-trivial means it is true of some TMs and false of others. Consequently, questions like 'Does this program output 42 on input 5?', 'Does this program halt on all inputs?', or 'Do these two programs compute the same function?' are all undecidable. The proof reduces from the halting problem by showing any non-trivial semantic property could be used to detect halting.

How It's Best Learned

First internalize the syntactic/semantic distinction — properties of program descriptions versus properties of the functions they compute. Then work through the formal proof by contradiction, understanding how any non-trivial semantic property can be co-opted to solve the halting problem.

Common Misconceptions

Explainer

The halting problem showed that one specific question about programs — "does this program halt on this input?" — is undecidable. Rice's theorem is a sweeping generalization: *every* interesting question about what a program computes is undecidable. The key distinction that makes this precise is between syntactic and semantic properties. A syntactic property depends on the description of the Turing machine — its states, transitions, tape alphabet. A semantic property depends only on the function the machine computes, regardless of how it is encoded. "This TM has fewer than 100 states" is syntactic. "This TM outputs 42 on input 5" is semantic.

To see why semantic properties are harder, notice that two machines with wildly different descriptions might compute the same function, and two nearly-identical machines might compute completely different functions. You cannot read off what a program computes from its description without, in effect, running it. Rice's theorem makes this precise: if P is a semantic property that is non-trivial (some TMs have it, some don't), then there is no algorithm that takes a TM description and correctly decides whether that TM has property P.

The proof uses the halting problem reduction you already know. Suppose you had an algorithm A deciding property P. Pick a TM M₀ that has P (exists by non-triviality) and a TM M₁ that lacks P. Given any TM T and input w, build a new TM T_{w} that: (1) first runs T on w, and (2) if T halts, runs as M₀, otherwise diverges forever. The machine T_{w} computes M₀'s function if T halts on w, and computes nothing (or M₁'s function) if T doesn't halt. Now run A on T_{w}: A answers "yes" iff T halts on w. This solves the halting problem — a contradiction. Every part of this construction generalizes to any non-trivial semantic property.

The practical implication is profound: no static analysis tool can be both sound and complete for any semantic property. Tools like type checkers and linters are always either incomplete (they miss some bugs) or unsound (they report false positives) — not from engineering failure, but from fundamental mathematical necessity. Rice's theorem explains why program verification is hard in principle, and why all practical static analysis tools approximate semantic properties through syntactic overapproximations.

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 AlgebraIntroduction to Propositional LogicIntroduction to Predicate Logic (First-Order Logic)First-Order Logic SyntaxZFC Axioms OverviewAxiom Schema of SeparationAxiom Schema of ReplacementVon Neumann OrdinalsHereditarily Finite SetsRecursive Definitions on Finite SetsWell-Founded Relations and Transfinite RecursionThe Axiom of Choice and Equivalent FormulationsAxiom of ChoiceWell-Ordering TheoremInfinite Cardinal NumbersCantor's TheoremUncountability and the Diagonal ArgumentThe Cantor Set: An Uncountable Nowhere Dense ExampleUncountable Sets and Cantor DiagonalizationThe Halting ProblemComputability ReductionsPost Correspondence ProblemRice's Theorem

Longest path: 91 steps · 520 total prerequisite topics

Prerequisites (4)

Leads To (3)