4.6.20 · D2Theory of Computation

Visual walkthrough — Rice's theorem

1,916 words9 min readBack to topic

Before any symbol appears, let's fix vocabulary with a picture.


Step 1 — What is a machine's language?

WHAT. A Turing machine is a program. Feed it a string . Three things can happen: it says yes (accept), it says no (reject), or it loops forever (never answers). The language of , written , is the set of all strings it says yes to.

  • — the program (a fixed pile of instructions).
  • — one input string we try.
  • — the collection of all winning strings, the machine's "behaviour".

WHY. Rice's theorem is entirely about what the machine accepts, never how it is wired inside. So we must nail down "language" first: it is the machine's output behaviour, a set, not a picture of its gears.

PICTURE. Strings pour into the machine; only the "yes" strings survive into the bucket .

Figure — Rice's theorem

Step 2 — What is a property, and when is it non-trivial?

WHAT. A property is a yes/no question about a language. We picture it as a box: some languages fall inside (they have the property), others fall outside.

  • — the set of languages that qualify (the box).
  • — "the language of sits inside the box".
  • — the code of (its instruction sheet written as a string we can feed to other machines).
  • — the set of codes whose language has the property. This is what we ask a decider to recognize.

WHY. We need a precise target. "Decide property " really means "decide membership in " — given a code, output yes/no. Turning behaviour-questions into set membership is what lets us reduce.

PICTURE. The universe of all recognizable languages, split by the property-box .

Figure — Rice's theorem
Non-trivial
There is a YES language AND a NO language — the box has a real boundary.

Step 3 — Why the two trivial cases are decidable (the edge cases up front)

WHAT. Two boxes are trivial: the empty box (, nothing qualifies) and the everything box ( all r.e. languages, everyone qualifies).

WHY / PICTURE. If the box is empty, the answer is always "no" — a machine that ignores its input and prints "no" decides it. If the box is everything, the answer is always "yes". No boundary to cross means no hard question to answer. Rice deliberately excludes these, because they are the only decidable ones.

Figure — Rice's theorem

Step 4 — The two anchor worlds we will flip between

WHAT. Pick a baseline. Without loss of generality assume — the empty language is a NO world.

  • — the language accepting nothing (our guaranteed NO world).
  • — a specific machine whose language is in the box (our guaranteed YES world), which exists because is non-trivial.

WHY. A reduction needs a switch with two positions. We are about to build a gadget whose language snaps to either the YES world or the NO world . Non-triviality is what hands us both anchors.

What if instead? Then flip: prove undecidability of the complement property (which has ). Deciding would decide , so the two are equally hard. No case is lost — see Mapping reductions for why symmetric hardness works.

PICTURE. Two poles: the NO pole and the YES pole .

Figure — Rice's theorem

Step 5 — Build the gadget

WHAT. We borrow the undecidable language $A_{TM}$: Given any pair , we construct a new machine . On input it runs:

  1. Ignore . First simulate on .
  2. If that simulation accepts, then simulate on and accept iff accepts .
  • — the machine from the halting-style question.
  • — the string we ask about.
  • — the input to the new gadget (deliberately delayed).
  • — our YES-world witness from Step 4.

WHY. Step 1 acts as a gate. Whether the gate ever opens depends on whether accepts . Step 2 makes the gadget impersonate once the gate is open. So the gadget's behaviour — its language — is remote-controlled by a halting question.

PICTURE. A gate wired in front of a copy of : nothing passes until accepts .

Figure — Rice's theorem

Step 6 — Trace both worlds (the flip)

WHAT. Follow the gadget in each scenario.

Case A — accepts . The gate opens (step 1 finishes). Now runs on each and accepts exactly when does. So

Case B — does not accept (it rejects or loops). The gate never opens; step 2 is unreachable; the gadget accepts no string. So

Combine both lines into the switch:

  • Left side — a property question about the gadget's language.
  • Right side — a halting/acceptance question about .
  • — they are the same question in disguise. That equivalence is the whole reduction.

WHY. This is the payoff of Step 5's design: the gadget's language has only two possible values, and which one is precisely the acceptance fact we cannot decide.

PICTURE. The switch: accept- throws the gadget's language into the YES box; not-accept throws it into the NO box.

Figure — Rice's theorem

Step 7 — The contradiction

WHAT. Suppose, for contradiction, a decider for existed — a machine that always halts and correctly answers "is ?" for any code .

Then build this decider for : on input , construct , run on it, and copy its answer.

  • — the assumed all-knowing property decider.
  • The first — because decides correctly.
  • The second — the switch from Step 6.

Chaining them, decides — but $A_{TM}$ is undecidable. Contradiction. Therefore no such exists: is undecidable.

WHY. Everything funnels here. If a magic property-checker existed, we'd feed it the gadget and secretly extract halting answers — which are provably impossible.

PICTURE. The impossible pipeline: build gadget halting answer.

Figure — Rice's theorem

Step 8 — Why non-triviality was load-bearing (degenerate case revisited)

WHAT. Re-examine what breaks if is trivial.

WHY / PICTURE. The reduction needs both poles: a YES world and a NO world .

  • If = everything, there is no NO world — the gadget can't land outside the box, the switch is stuck at "yes".
  • If = empty, there is no YES world — the switch is stuck at "no". Either way the gadget cannot flip, the collapses, and (correctly) the trivial property is just decidable by a constant answer. Non-triviality is exactly the guarantee that both anchors exist.
Figure — Rice's theorem

The one-picture summary

Everything above compresses into a single machine of implications: non-triviality gives two anchor worlds; the gadget wires a halting question to a property question; a property-decider would therefore decide halting — impossible.

Figure — Rice's theorem

P is non-trivial

YES world L of M_P and NO world empty

Gadget G runs M on w then acts like M_P

L of G in P iff M accepts w

Decider R for property

Would decide A_TM

Contradiction so property undecidable

Recall Feynman: the whole walkthrough in plain words

Picture a magic inspector that reads any robot's instruction sheet and tells you what the robot will eventually accept. To prove no such inspector can exist, we build a sneaky robot with a gate in front of it. The gate only opens if some other robot eventually accepts its input . Behind the gate sits a copy of a known "good" robot . So: if accepts , the gate opens and our sneaky robot behaves like the good robot — its language has the property. If never accepts , the gate stays shut forever and our robot accepts nothing — its language lacks the property. Now the punchline: "does the sneaky robot's language have the property?" is exactly the same question as "does accept ?". If the magic inspector existed, we could ask it about the sneaky robot and instantly learn whether halts-and-accepts — which we already proved nobody can ever do. So the inspector is a fantasy. The only questions any inspector can answer are the boring ones whose answer is the same for every robot ("always yes" / "always no").


Connections

  • Rice's theorem — parent topic
  • Halting Problem — the original impossibility this generalizes.
  • A_TM and undecidability — the language we reduced from in Steps 5–7.
  • Mapping reductions — the gadget-building technique behind the whole proof.
  • Recursive vs Recursively Enumerable languages — undecidable ≠ non-recognizable.
  • Rice-Shapiro theorem — the finer follow-up about recognizability.
  • Turing Machines — the model underlying every box and gadget above.