Rice's Theorem
Rice's theorem is a sweeping generalization of the undecidability of the halting problem: any nontrivial semantic property of Turing machines is undecidable. This result has profound implications for program verification.
Statement
Let be a property of computably enumerable sets (i.e., ). If is nontrivial (neither empty nor the set of all c.e. sets), then the index set is undecidable.
Without loss of generality, assume (otherwise consider ). Let for some . We reduce the halting problem to .
Given , construct a Turing machine that on input : first simulates machine on input ; if it halts, then simulates machine on input .
If (machine halts on ), then . If , then . Thus , so . Since is undecidable, so is .
Applications
The following are undecidable by Rice's theorem:
- "Does Turing machine accept the empty string?"
- "Is the language of regular? Context-free? Finite? Infinite?"
- "Does compute the identity function?"
- "Is ?"
Each is a nontrivial property of the c.e. set , hence undecidable.
Rice's theorem applies only to extensional (semantic) properties of programs β properties that depend only on the function computed, not on the program's syntax. Intensional (syntactic) properties, such as "does the program have fewer than 100 instructions" or "does the program contain a specific subroutine," may or may not be decidable and are not covered by Rice's theorem.