Exercises — Rice's theorem
Before we start, two symbols the parent used that you must have crisp:
The decision procedure you will run on nearly every problem is this flowchart:

Level 1 — Recognition
Goal: can you tell semantic from syntactic, trivial from non-trivial, at a glance?
Recall Solution
Test each: if I rewrite the machine into a totally different-looking machine that accepts the exact same strings, does the answer change?
- (a) Semantic. "Accepts
hello" depends only on the set of accepted strings. - (b) Syntactic. Two machines accepting the same language can have 5 vs 500 states — the answer changes though did not.
- (c) Semantic. Finiteness is a fact about the set .
- (d) Syntactic. "Start state is accepting" is about the wiring diagram. (Note: it does imply accepts the empty string — but you can also accept the empty string without the start state being accepting, so the two are not the same property.)
Answers: (a) semantic, (b) syntactic, (c) semantic, (d) syntactic.
Recall Solution
is non-trivial iff there is a YES-language and a NO-language among r.e. languages. But every language that a Turing machine recognizes is r.e. by definition. So every language in our universe has — there is no NO-language. is trivial (always "yes"), hence decidable — a decider just prints YES. Rice does not apply.
Recall Solution
False. State-count is syntactic. You literally read the description and count states → decidable. Rice only speaks about non-trivial semantic properties.
Level 2 — Application
Goal: run the full Rice checklist and name the two witnesses.
Recall Solution
Property — the single language of all strings.
- Semantic? Yes — it only mentions . ✅
- Non-trivial? Need a YES and a NO language.
- YES witness: = "accept every input immediately", so .
- NO witness: = "reject every input", so . Both r.e. → non-trivial. ✅
By Rice: undecidable.
Recall Solution
.
- Semantic? Yes — about which strings are in . ✅
- YES witness: (the empty string has length , which is even) — this is r.e. and lies in .
- NO witness: contains no strings at all, so no even-length string → . r.e. ✅ Non-trivial → undecidable by Rice.
Recall Solution
.
- Semantic ✅.
- YES witness: is finite ( elements) → in .
- NO witness: is infinite → not in . Non-trivial → undecidable.
Level 3 — Analysis
Goal: spot the traps — properties that only look like Rice targets, and the -baseline subtlety.
Recall Solution
Careful — halting is a property of 's running, not purely of . Two machines can accept the same language yet differ in halting: one loops forever on rejected inputs, another cleanly rejects them. So "halts on every input" is not determined by alone → it is not a semantic property in Rice's sense, and Rice's theorem as stated does not apply.
(It happens to be undecidable anyway, but you must prove that by a direct reduction from the Halting Problem — see Halting Problem — not by citing Rice.) Verdict: Rice does NOT directly apply; property is not semantic.
Recall Solution
.
- Semantic ✅.
- NO witness: itself is not in (it equals the empty set). So here — the baseline the parent's Step 1 assumes.
- YES witness: → in . Non-trivial → undecidable.
Baseline note: because , the gadget from the parent proof works directly: when loops on , accepts nothing → language ; when accepts , mimics a YES-witness → language in . No complement swap needed.
Recall Solution
Does have the property "contains "? The empty language contains nothing, so → . Good — baseline holds, no complement trick.
- YES witness: (or ) contains → in .
- NO witness: → not in . Non-trivial → undecidable.
Level 4 — Synthesis
Goal: build the gadget yourself and combine ideas.
Recall Solution
First fix the baseline. Is regular? Yes ( is a regular language). So here — we must work with the complement property , for which . Deciding ⇔ deciding , so it suffices to show undecidable.
Pick a YES-witness for : the non-regular r.e. language , recognized by some machine .
Gadget. On input , machine does:
- Run on (ignore for now).
- If accepts , run on ; accept iff accepts .
Two worlds:
- accepts ⇒ step 1 finishes ⇒ behaves as ⇒ , which is not regular ⇒ .
- does not accept ⇒ step 1 never finishes ⇒ accepts nothing ⇒ , which is regular ⇒ .
Hence accepts . A decider for would decide — impossible. So , and therefore , is undecidable.
Recall Solution
- Semantic ✅.
- YES witness: (any three fixed distinct strings) — finite, r.e., in .
- NO witness: (size ) — in fact , giving a clean baseline. Non-trivial → undecidable by Rice.
(Note so no complement trick needed; the gadget mimics a machine for when accepts , and accepts otherwise.)
Recall Solution
- Semantic ✅ (both conjuncts are about ).
- YES witness: — regular and non-empty → in .
- NO witness: — regular but empty, fails the "non-empty" clause → . Both r.e., non-trivial → undecidable. (Baseline: , clean.)
Level 5 — Mastery
Goal: know exactly where Rice's borders are — where it does NOT apply, and how it interacts with r.e.-ness.
Recall Solution
- Undecidable but r.e.: , i.e. . It's undecidable (L3.2). It is r.e.: dovetail-simulate on all strings in parallel; the moment any run accepts, halt and accept. If you eventually see an acceptance; if empty, you loop — exactly an r.e. recognizer.
- Not even r.e.: the complementary property , i.e. . If it were r.e., then together with being r.e. we'd have both and its complement r.e. ⇒ decidable — contradicting Rice. So is not r.e.
Punchline: Rice guarantees undecidable, but says nothing about r.e.-ness — that is a finer, separate question, sometimes settled by Rice-Shapiro theorem.
Recall Solution
- " is r.e." — as we saw in L1.2 this is the trivial property (all our languages are r.e.). Trivial ⇒ decidable (print YES). Rice explicitly excludes trivial properties, consistent.
- " is co-r.e." — the class of languages that are r.e. and co-r.e. is exactly the recursive (decidable) languages. " is recursive" is a non-trivial semantic property (e.g. recursive ∈ P; r.e.-but-not-recursive ∉ P), so by Rice it's undecidable. Rice hands you undecidability; determining whether is itself r.e. needs Rice–Shapiro or a direct argument. Answers: "is r.e." → trivial, decidable. "is recursive" → non-trivial, undecidable.
Recall Solution
The property references the number of states, a fact about that two same-language machines can disagree on. Therefore it is not a function of → not semantic → Rice does not apply. The single deciding test (top of the page's flowchart): "Do all machines with the same language give the same answer?" Here the answer is no, so the property is syntactic. It is in fact decidable by counting states.
Connections
- Rice's theorem — the parent statement and proof these exercises drill.
- Halting Problem — used directly in L3.1 for non-semantic "totality".
- A_TM and undecidability — the language every gadget reduces from.
- Mapping reductions — the gadget-building technique in L4.
- Recursive vs Recursively Enumerable languages — the L5 r.e. / non-r.e. distinctions.
- Rice-Shapiro theorem — extends Rice to recognizability questions (L5.1, L5.2).
- Turing Machines — the model underneath everything.
Recall Self-test summary
Semantic + non-trivial ⇒ undecidable ::: This is the whole Rice checklist — verify both before invoking it. What makes a property trivial? ::: It holds for every r.e. language or for none — no YES/NO pair of witnesses. Does Rice say anything about r.e.-ness of ? ::: No — only undecidability; use Rice–Shapiro or reductions for that.