Rice’s Theorem (Undecidability of All Nontrivial Semantic Properties)

Rice’s Theorem (Undecidability of All Nontrivial Semantic Properties)

Verified Sources
Sep 12, 2026

Rice’s theorem is a foundational result in computability theory: it proves that you cannot decide, for an arbitrary program (Turing machine), most meaningful questions about the language (the set of inputs it accepts). The key idea is that any decision problem depending only on the semantics of a machine’s accepted language—and not on superficial syntax—must be undecidable as long as the property is nontrivial.

In standard form, we consider languages over Σ\Sigma^* that are accepted by Turing machines, and a property PP of such languages. Rice’s theorem says that if PP is nontrivial (true for at least one accepted language, false for at least one accepted language) then the set of machines whose accepted language has property PP is undecidable. (Equivalently: there is no total computable decider for the property.)

Nontriviality and semantic dependence are essential:

  • Semantic: only L(M)L(M) matters, not the description of MM.
  • Nontrivial: both outcomes occur among accepted languages.

Rice’s theorem provides a unifying framework for proving undecidability results that look different at first glance—such as deciding whether a program’s accepted language is empty, finite, infinite, includes a particular string, etc.—by showing they fit the template “nontrivial property of L(M)L(M).”

Rice's Theorem (Computability) - Proof and Examples

Core terminology (what Rice’s theorem quantifies over)

Let MM be a Turing machine and L(M)L(M) be the language it recognizes/accepts.

We define a property PP on languages:

  • PP is semantic if for any two Turing machines M1,M2M_1, M_2,
    L(M1)=L(M2)    (P(L(M1))P(L(M2))).L(M_1)=L(M_2)\implies (P(L(M_1))\Leftrightarrow P(L(M_2))).
  • PP is nontrivial if there exists at least one machine MyesM_{\text{yes}} with
    P(L(Myes))=trueP(L(M_{\text{yes}}))=\text{true}
    and at least one machine MnoM_{\text{no}} with
    P(L(Mno))=false.P(L(M_{\text{no}}))=\text{false}.

Then define the decision problem:

  • Input: a description of a Turing machine MM
  • Question: does P(L(M))P(L(M)) hold?

Rice’s theorem states that if PP is nontrivial and semantic, then this decision problem is undecidable.

Why “short note” still needs the quantifiers

Rice’s theorem is powerful because it is universal over properties: it doesn’t matter which property you pick (emptiness, infiniteness, universality, etc.) as long as it’s a nontrivial semantic property. The proof works by reducing from a known undecidable problem (commonly via a many-one reduction from the halting problem or from Rice-style self-reference constructions).

Key learning terms:

  • Turing machine
  • Language of a machine
  • Semantic property
  • Nontrivial property

Standard proof idea for Rice’s theorem (reduction via a fixed language)

  1. 1
    Step 1

    Assume PP is semantic and nontrivial. So there exist machines MyesM_{yes} and MnoM_{no} such that P(L(Myes))P(L(M_{yes})) is true and P(L(Mno))P(L(M_{no})) is false.

  2. 2
    Step 2

    Let HH be the halting problem instance encoded by a machine TT and input ww. The reduction must force the constructed machine’s language to reflect whether TT halts on ww.

  3. 3
    Step 3

    Build NN so that: on input xx, it simulates T(w)T(w). If T(w)T(w) halts, NN behaves like MyesM_{yes} on xx; otherwise it behaves like MnoM_{no} on xx. Then L(N)L(N) equals L(Myes)L(M_{yes}) or L(Mno)L(M_{no}) depending on halting.

  4. 4
    Step 4

    Because PP is semantic: if T(w)T(w) halts then P(L(N))=P(L(Myes))=trueP(L(N))=P(L(M_{yes}))=\text{true}; if it doesn’t halt then P(L(N))=P(L(Mno))=falseP(L(N))=P(L(M_{no}))=\text{false}.

  5. 5
    Step 5

    "If we had a decider for PP, we could decide whether T(w)T(w) halts—contradiction. Therefore no decider for P(L(M))P(L(M)) exists."

    This is the conceptual spine of many textbook proofs: use MyesM_{yes} and MnoM_{no} as “templates,” and use the unknown halting behavior to decide which template the constructed machine realizes.

Typical applications (what Rice’s theorem instantly rules out)

Rice’s theorem is often used in the form: “Given any nontrivial semantic property, the corresponding index set is undecidable.”

Common examples of properties that fit the theorem:

  • Emptiness of the language (property P(L)=(L=)P(L)= (L=\emptyset)) is nontrivial.
  • Finiteness (for many models, finiteness is nontrivial).
  • Infiniteness is nontrivial.
  • Whether a given string is accepted (e.g., P(L)=(sL)P(L)=(s\in L)) is semantic and nontrivial.

In each case, you show there exist machines that make the property true and machines that make it false; then Rice’s theorem gives undecidability immediately.

How to recognize a Rice’s theorem problem

Check: (1) does the question depend only on L(M)L(M)? (2) can you exhibit one machine where the property holds and one where it fails? If yes to both, Rice’s theorem is the likely hammer.

Not every problem is a direct Rice’s theorem instance

If the property depends on syntax (the code of MM) rather than the accepted language, Rice’s theorem may not apply. Also, trivial properties (always true/always false) are decidable.

Where Rice’s theorem sits in computability

Turing machines and languages

Model of computation

Programs induce languages L(M)L(M); questions about programs become questions about languages."

Halting problem

Undecidability baseline

Known undecidable problem used for reductions."

Rice’s theorem

Semantic undecidability

Every nontrivial semantic property of L(M)L(M) is undecidable."

Uniform undecidability proofs

Many corollaries

Emptiness/infiniteness/containment-type properties follow as special cases."

FAQ: Common confusions

Classifying properties for Rice-style undecidability (informal)

Decidability vs. applicability hinges on semantic dependence and nontriviality.

Rice’s theorem quick deck

1 / 4
Question · Term

What is a semantic property (for Rice’s theorem)?

Click to reveal
Answer · Definition

A property depending only on L(M)L(M): if L(M1)=L(M2)L(M_1)=L(M_2) then the property’s truth matches.

Knowledge Check

Question 1 of 4
Q1Single choice

Rice’s theorem applies to properties of what kind of object?

Explore Related Topics

1

Resolution in First-Order Logic (FOL): Resolution Refutation from a Simple Knowledge Base

2

Short Notes on Cook's Theorem, Randomized Algorithms, and Bin Packing

The notes cover Cook’s theorem establishing SAT as NP‑complete, the design and analysis of randomized (Las Vegas and Monte Carlo) algorithms, and the NP‑hard bin‑packing problem with its common heuristics and approximation guarantees.

  • Cook’s theorem shows every language LNPL\in\mathrm{NP} reduces to SAT via a polynomial‑time function ff such that xL    f(x)SATx\in L\iff f(x)\in\mathrm{SAT}, making SAT the first NP‑complete problem.
  • Randomized algorithms: Las Vegas algorithms are always correct with expected runtime (e.g., E[T(n)]=O(nlogn)\mathbb{E}[T(n)]=O(n\log n) for randomized quicksort); Monte Carlo algorithms run in fixed time with error ≤½, which can be reduced by amplification to (12)k(\tfrac12)^k after kk repetitions.
  • Bin packing: the decision version is NP‑complete and the optimization version NP‑hard; heuristics like First Fit Decreasing guarantee FFD(I)119OPT(I)+69\mathrm{FFD}(I)\le\frac{11}{9}\mathrm{OPT}(I)+\frac{6}{9}.
  • Together they illustrate three core CS themes: proving hardness via reductions, leveraging randomness for efficient algorithm design, and using heuristics/approximation to tackle intractable optimization problems.
3

When Can a Language Be Accepted by a Turing Machine?