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 more→→Recursively 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 Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Introduction to Propositional Logic → Introduction to Predicate Logic (First-Order Logic) → First-Order Logic Syntax → ZFC Axioms Overview → Axiom Schema of Separation → Axiom Schema of Replacement → Von Neumann Ordinals → Hereditarily Finite Sets → Recursive Definitions on Finite Sets → Well-Founded Relations and Transfinite Recursion → The Axiom of Choice and Equivalent Formulations → Axiom of Choice → Well-Ordering Theorem → Infinite Cardinal Numbers → Cantor's Theorem → Uncountability and the Diagonal Argument → The Cantor Set: An Uncountable Nowhere Dense Example → Uncountable Sets and Cantor Diagonalization → The Halting Problem → Computability Reductions → Post Correspondence Problem → Rice's Theorem

Longest path: 91 steps · 520 total prerequisite topics

Prerequisites (4)

Leads To (3)