1 · Why this matters · the BIG picture
"Is this program's language empty?" is one of the most basic questions you can ask about a TM — and it is undecidable.
This means: there is no algorithm that, given an arbitrary program, can tell you whether it ever produces any output
on any input. Practical examples: "does this regex with backreferences match any string?" "does this program have
any reachable accepting path?" — undecidable in general.
What we prove
ETM = {⟨M⟩ : L(M) = ∅} is not decidable. We give a mapping reduction ATM ≤m ¬ETM, showing ETM is at least as hard as ATM.
2 · Setup · the construction
We turn a question about M accepting one specific input w into a question about a new machine M' accepting anything at all. The trick: hard-code w inside M', and have M' ignore its input.
Construction of M' (from ⟨M, w⟩)
M' = "on input x:
1. ignore x;
2. simulate M on w;
3. if M accepts: accept x."
Note ⟨M, w⟩ is finite, so writing M' down is computable. The map ⟨M, w⟩ ↦ ⟨M'⟩ is the reduction.
3 · The proof · L(M') is all-or-nothing
Two cases:
- If M accepts w · Every x triggers the accept branch ⇒ L(M') = Σ* ⇒ ⟨M'⟩ ∉ ETM.
- If M does NOT accept w (rejects or loops) · Every x makes M' reject or loop ⇒ L(M') = ∅ ⇒ ⟨M'⟩ ∈ ETM.
So ⟨M, w⟩ ∈ ATM ⇔ ⟨M'⟩ ∉ ETM. If we had a decider for ETM, we could build a decider for ATM (run the ETM-decider, flip the answer). Impossible ⇒ ETM is undecidable. ∎
4 · Animated demo · auto-plays · loops
5 · Worked example · concrete M and w
Take M = "accept iff input length is a multiple of 3", w = "aaaaaa" (length 6).
- M(w) = accept (6 ≡ 0 mod 3).
- So M' on any x: runs M on "aaaaaa", which accepts, then M' accepts x.
- L(M') = Σ*. ⟨M'⟩ ∉ ETM.
Now change w to "aaaaa" (length 5).
- M(w) = reject.
- M' on any x: runs M on "aaaaa", which rejects, M' never accepts.
- L(M') = ∅. ⟨M'⟩ ∈ ETM.
The "membership in ATM" question (does M accept w?) became "is L(M') empty?" — a question about ETM.
6 · Connections · related undecidable language properties
- REGULARTM (Problem 7) · "Is L(M) regular?" Same construction trick: make L(M') simple iff M accepts w.
- EQTM (Problem 8) · "Do M1, M2 recognize the same language?" Even stronger — not even recognizable.
- Rice's theorem (Problem 14) · The grand generalization: any non-trivial property of L(M) is undecidable.
- Halting · ATM ≤m HALTTM ≤m ETM — a chain of reductions all going through the same trick.
7 · Common pitfalls · what students miss
- "M' runs M on x, not on w." No! M' runs M on the fixed w that's hard-coded inside M'. Otherwise the trick fails.
- Reducing the wrong direction. We need ATM ≤ ETM, not the other way. The known-undecidable problem must be the source.
- Confusing ¬ETM with ETM. The reduction gives M accepts w ⇔ L(M') = Σ*, which is ⟨M'⟩ ∉ ETM. So we reduce to the complement; that still shows ETM undecidable.
- "M' must halt to be a valid TM." No — a TM is valid even if it loops on every input. L(M') = ∅ is perfectly legal.
- Trying to make L(M') = {w}. Tempting but wrong. The trick is L(M') = Σ* vs ∅, because that's the question ETM asks about.
8 · Q&A defence notes
Q1. Why does M' "ignore" its input?
Because we want L(M') to be either everything or nothing — a binary signal mirroring M's acceptance of the fixed w. Ignoring x kills any dependence on x.
Q2. Does this construction halt?
M' halts (and accepts) iff M halts (and accepts) on w. If M loops on w, M' loops on every x. That's fine — we only need ⟨M'⟩ to encode the membership question.
Q3. Is this a mapping reduction or Turing reduction?
Mapping reduction. The function ⟨M, w⟩ ↦ ⟨M'⟩ is computable and preserves the membership question.
Q4. Is ETM co-recognizable?
Yes. ¬ETM is recognizable: enumerate strings w1, w2, …; run M on each in parallel; accept as soon as any one accepts.
Q5 (bonus). Place ETM in the Venn diagram (Problem 4).
co-Rec \\ Dec. Because ¬ETM is recognizable (Q4) and ETM is undecidable (proven here).
9 · How to present this in class
Total time: 10 minutes.
- (1 min) State the question: "is L(M) empty?" Hook: connect to "does this program ever produce output?"
- (2 min) Write the construction of M' on the board. Stress: x ignored, w hard-coded.
- (2 min) Run the visualization. Pause when M' is constructed and L(M') is computed.
- (2 min) Work out the two cases explicitly: L(M') = Σ* vs L(M') = ∅.
- (2 min) Worked example with concrete M and w.
- (1 min) Forward link to Rice's theorem.