Registry Synced

Reductions โ€” Proving Undecidability

1939 words
10 min read

Reading compass

Now ยท ๐ŸŽฏ Learning Objectives

Reductions โ€” Proving Undecidability

๐ŸŽฏ Learning Objectives

  • Define mapping reductions and their properties
  • Reduce the Halting problem to other problems
  • Apply Rice's theorem to prove undecidability
  • Distinguish between Turing-recognizable and co-recognizable
  • Construct reduction functions

1. Introduction to Reductions

1.1 Intuition

A reduction is like converting a problem you want to solve into one you already know how to solve. If you know how to decide whether a number is even, you can decide whether a number is odd by checking if (n+1) is even. Similarly, if we know the Halting problem is undecidable, we can prove other problems are undecidable by showing: "If I could decide problem X, I could decide the Halting problem โ€” which is impossible."

1.2 Mapping Reduction

Aโ‰คmBA \leq_m B means: There exists a computable function ff such that wโˆˆAโ€…โ€ŠโŸบโ€…โ€Šf(w)โˆˆBw \in A \iff f(w) \in B. (Diagram) Properties:
  • If BB is decidable and Aโ‰คmBA \leq_m B, then AA is decidable
  • If AA is undecidable and Aโ‰คmBA \leq_m B, then BB is undecidable
  • If Aโ‰คmBA \leq_m B and Bโ‰คmCB \leq_m C, then Aโ‰คmCA \leq_m C (transitive)

2. The Halting Problem

2.1 Definition

ATM={โŸจM,wโŸฉโˆฃMย isย aย TMย andย Mย acceptsย w}A_{TM} = \{\langle M, w \rangle \mid M \text{ is a TM and } M \text{ accepts } w\} Theorem: ATMA_{TM} is undecidable. Proof (diagonalization): Assume HH decides ATMA_{TM}. Construct DD:
  • DD = "On input โŸจMโŸฉ\langle M \rangle:
    1. Run HH on โŸจM,โŸจMโŸฉโŸฉ\langle M, \langle M \rangle \rangle
    2. If HH accepts, reject; if HH rejects, accept" Then D(โŸจDโŸฉ)D(\langle D \rangle) accepts iff DD does not accept โŸจDโŸฉ\langle D \rangle โ€” contradiction.

3. Reduction Examples

3.1 Halting Problem HALTTMHALT_{TM}

HALTTM={โŸจM,wโŸฉโˆฃMย haltsย onย w}HALT_{TM} = \{\langle M, w \rangle \mid M \text{ halts on } w\} Reduction from ATMA_{TM}: f(โŸจM,wโŸฉ)=โŸจMโ€ฒ,wโŸฉf(\langle M, w \rangle) = \langle M', w \rangle where:
  • Mโ€ฒM' runs MM on ww
  • If MM accepts, Mโ€ฒM' accepts
  • If MM rejects, Mโ€ฒM' loops forever Check: โŸจM,wโŸฉโˆˆATMโ€…โ€ŠโŸบโ€…โ€ŠM\langle M, w \rangle \in A_{TM} \iff M accepts wโ€…โ€ŠโŸบโ€…โ€ŠMโ€ฒw \iff M' halts on wโ€…โ€ŠโŸบโ€…โ€ŠโŸจMโ€ฒ,wโŸฉโˆˆHALTTMw \iff \langle M', w \rangle \in HALT_{TM}

3.2 Empty Language ETME_{TM}

ETM={โŸจMโŸฉโˆฃL(M)=โˆ…}E_{TM} = \{\langle M \rangle \mid L(M) = \emptyset\} Reduction from ATMA_{TM}: f(โŸจM,wโŸฉ)=โŸจMโ€ฒโŸฉf(\langle M, w \rangle) = \langle M'\rangle where:
  • Mโ€ฒM' = "On input xx:
    1. If xโ‰ wx \neq w, reject
    2. Run MM on ww and accept if MM accepts" Check: โŸจM,wโŸฉโˆˆATMโ€…โ€ŠโŸบโ€…โ€ŠM\langle M, w \rangle \in A_{TM} \iff M accepts wโ€…โ€ŠโŸบโ€…โ€ŠL(Mโ€ฒ)={w}โ‰ โˆ…โ€…โ€ŠโŸบโ€…โ€ŠโŸจMโ€ฒโŸฉโˆ‰ETMw \iff L(M') = \{w\} \neq \emptyset \iff \langle M' \rangle \notin E_{TM} Wait โ€” we need ff such that wโˆˆATMโ€…โ€ŠโŸบโ€…โ€Šf(w)โˆˆETMw \in A_{TM} \iff f(w) \in E_{TM}. Let me fix. f(โŸจM,wโŸฉ)=โŸจMโ€ฒโŸฉf(\langle M, w \rangle) = \langle M'\rangle where:
  • Mโ€ฒM' ignores input and runs MM on ww
  • If MM accepts, Mโ€ฒM' accepts Then:
  • If MM accepts ww: Mโ€ฒM' accepts all inputs โ†’ L(Mโ€ฒ)=ฮฃโˆ—โ‰ โˆ…L(M') = \Sigma^* \neq \emptyset โ†’ โŸจMโ€ฒโŸฉโˆ‰ETM\langle M' \rangle \notin E_{TM}
  • If MM does not accept ww: Mโ€ฒM' hangs or rejects โ†’ L(Mโ€ฒ)=โˆ…L(M') = \emptyset โ†’ โŸจMโ€ฒโŸฉโˆˆETM\langle M' \rangle \in E_{TM} So ATMโ‰คmETMโ€พA_{TM} \leq_m \overline{E_{TM}}, which means ETME_{TM} is undecidable.

3.3 Regular Language REGTMREG_{TM}

REGTM={โŸจMโŸฉโˆฃL(M)ย isย regular}REG_{TM} = \{\langle M \rangle \mid L(M) \text{ is regular}\} Reduction from ATMA_{TM}: Transform โŸจM,wโŸฉ\langle M, w \rangle into โŸจMโ€ฒโŸฉ\langle M' \rangle where:
  • Mโ€ฒM' = "On input xx:
    1. If xx is of form 0n1n0^n1^n, accept
    2. Run MM on ww; if MM accepts, accept" Then:
  • If MM accepts ww: L(Mโ€ฒ)=ฮฃโˆ—L(M') = \Sigma^* (regular)
  • If MM does not accept ww: L(Mโ€ฒ)={0n1n}L(M') = \{0^n1^n\} (not regular) Thus ATMโ‰คmREGTMA_{TM} \leq_m REG_{TM}, so REGTMREG_{TM} is undecidable.

4. Rice's Theorem

4.1 Statement

Theorem: Any non-trivial property of Turing machine languages is undecidable. A property PP of languages is:
  • Non-trivial: Some recognizable languages have it, some don't
  • Semantic: Only depends on L(M)L(M), not on MM's implementation Examples of undecidable properties:
  • Is L(M)L(M) empty?
  • Is L(M)L(M) regular?
  • Is L(M)L(M) finite?
  • Does L(M)L(M) contain the string ฮต\varepsilon?
  • Is L(M)=ฮฃโˆ—L(M) = \Sigma^*?

4.2 Proof Sketch

  1. Let PP be a non-trivial property
  2. Assume WLOG that โˆ…\emptyset does NOT have property PP (otherwise use Pโ€พ\overline{P})
  3. Let BB be a language with property PP (exists because PP is non-trivial)
  4. Reduce ATMA_{TM} to PP: Transform โŸจM,wโŸฉ\langle M, w \rangle to โŸจMโ€ฒโŸฉ\langle M' \rangle where Mโ€ฒM':
    • On input xx, run MM on ww; if MM accepts, run a TM that recognizes BB on xx
  5. If MM accepts ww: L(Mโ€ฒ)=BL(M') = B (has property PP)
  6. If MM doesn't accept ww: L(Mโ€ฒ)=โˆ…L(M') = \emptyset (does NOT have property PP)
  7. Deciding PP would decide ATMA_{TM} โ†’ impossible

5. Common Pitfalls

Pitfall 1: Reversing the Reduction Direction

The mistake: Reducing BB to ATMA_{TM} to prove BB is undecidable. Why students make it: The logic "this problem is hard" suggests it must reduce to something. How to catch it: To prove BB undecidable, reduce a KNOWN undecidable problem (ATMA_{TM}) TO BB. If BB were decidable, ATMA_{TM} would be decidable. Correct approach: ATMโ‰คmBA_{TM} \leq_m B to prove BB undecidable.

Pitfall 2: Assuming Rice's Theorem Applies to Syntactic Properties

The mistake: Using Rice's theorem to prove properties about the machine itself (number of states, running time) are undecidable. Why students make it: Rice's theorem sounds like "everything about TMs is undecidable." How to catch it: Rice's theorem applies only to SEMANTIC properties โ€” properties of the language L(M)L(M), not of the machine MM itself. Correct approach: Does the property depend only on L(M)L(M)? If it depends on how MM works (state count, time complexity), Rice's theorem doesn't apply.

Pitfall 3: Forgetting to Show Both Directions

The mistake: Only showing one direction of the reduction. Why students make it: It's easier to reason about one direction. How to catch it: A reduction requires wโˆˆAโ€…โ€ŠโŸบโ€…โ€Šf(w)โˆˆBw \in A \iff f(w) \in B. Both directions must hold for the reduction to be valid. Correct approach: Prove both directions: If wโˆˆAw \in A then f(w)โˆˆBf(w) \in B, AND if f(w)โˆˆBf(w) \in B then wโˆˆAw \in A.

6. Key Concepts Reference

ConceptDefinitionApplication
Mapping reductionff computable, wโˆˆAโ€…โ€ŠโŸบโ€…โ€Šf(w)โˆˆBw \in A \iff f(w) \in BProving undecidability
** ATMA_{TM} **{โŸจM,wโŸฉโˆฃM\{ \langle M, w \rangle \mid M accepts w}w \}Prototypical undecidable problem
** HALTTMHALT_{TM} **{โŸจM,wโŸฉโˆฃM\{ \langle M, w \rangle \mid M halts on w}w \}Undecidable via ATMA_{TM} reduction
Rice's theoremNon-trivial semantic properties undecidableQuick undecidability proofs
** โ‰คm\leq_m **Reduction directionAโ‰คmBA \leq_m B means AA reduces to BB
TM-recognizableSome TM halts-accepts on strings in LLAlso called semi-decidable
Co-TM-recognizableComplement is TM-recognizableLโ€พ\overline{L} is recognizable

7. ๐Ÿ“ Practice Questions

Q1: Prove that HALTTMHALT_{TM} is undecidable by reduction from ATMA_{TM}.
Answer:
Define reduction f(โŸจM,wโŸฉ)=โŸจMโ€ฒ,wโŸฉf(\langle M, w \rangle) = \langle M', w \rangle where:
  • Mโ€ฒM' runs MM on ww
  • If MM accepts, Mโ€ฒM' halts (accepts)
  • If MM rejects, Mโ€ฒM' enters infinite loop
  • If MM loops (doesn't halt), Mโ€ฒM' also loops
Then: โŸจM,wโŸฉโˆˆATM\langle M, w \rangle \in A_{TM} (M accepts w) โ‡’ M halts on w โ‡’ M' halts on w โ‡’ โŸจMโ€ฒ,wโŸฉโˆˆHALTTM\langle M', w \rangle \in HALT_{TM}. And โŸจM,wโŸฉโˆ‰ATM\langle M, w \rangle \notin A_{TM} (M doesn't accept w) โ‡’ M either rejects or loops โ‡’ M' loops โ‡’ โŸจMโ€ฒ,wโŸฉโˆ‰HALTTM\langle M', w \rangle \notin HALT_{TM}.
Thus ATMโ‰คmHALTTMA_{TM} \leq_m HALT_{TM}, so HALTTMHALT_{TM} is undecidable. Q2: Use Rice's theorem to prove that ETME_{TM} (empty language) is undecidable.
Answer:
ETM={โŸจMโŸฉโˆฃL(M)=โˆ…}E_{TM} = \{\langle M \rangle \mid L(M) = \emptyset\}. This is a semantic property of TM languages:
  • It's non-trivial: some TMs accept โˆ…\emptyset (e.g., TM that immediately rejects), some don't (e.g., TM that accepts everything).
  • It's semantic: it depends only on L(M)L(M), not on MM's implementation.
By Rice's theorem, any non-trivial semantic property is undecidable. Therefore ETME_{TM} is undecidable. Q3: Show that the complement of ATMA_{TM} (the set of โŸจM,wโŸฉ\langle M,w \rangle where MM does NOT accept ww) is not Turing-recognizable.
Answer:
If ATMโ€พ\overline{A_{TM}} were Turing-recognizable, then both ATMA_{TM} and ATMโ€พ\overline{A_{TM}} would be recognizable, making ATMA_{TM} decidable. But ATMA_{TM} is undecidable. Therefore ATMโ€พ\overline{A_{TM}} is not Turing-recognizable.
More formally: A language is decidable iff both it and its complement are Turing-recognizable. Since ATMA_{TM} is not decidable (it's undecidable), and ATMA_{TM} IS Turing-recognizable (the universal TM recognizes it), its complement ATMโ€พ\overline{A_{TM}} must NOT be Turing-recognizable. Q4: Construct a reduction from ATMA_{TM} to ETME_{TM}.
Answer:
f(โŸจM,wโŸฉ)=โŸจMโ€ฒโŸฉf(\langle M, w \rangle) = \langle M' \rangle where Mโ€ฒM':
  • On input xx:
    1. If xโ‰ wx \neq w, reject
    2. Run MM on ww; if MM accepts, accept
Then:
  • If MM accepts ww: L(Mโ€ฒ)={w}โ‰ โˆ…L(M') = \{w\} \neq \emptyset โ†’ โŸจMโ€ฒโŸฉโˆ‰ETM\langle M' \rangle \notin E_{TM}
  • If MM doesn't accept ww: L(Mโ€ฒ)=โˆ…L(M') = \emptyset โ†’ โŸจMโ€ฒโŸฉโˆˆETM\langle M' \rangle \in E_{TM}
This shows ATMโ‰คmETMโ€พA_{TM} \leq_m \overline{E_{TM}}. So ETME_{TM} is undecidable (if it were decidable, so would ETMโ€พ\overline{E_{TM}} and thus ATMA_{TM}). Q5: Why doesn't Rice's theorem apply to the property "M has exactly 25 states"?
Answer: Because this is a syntactic property of the TM description, not a semantic property of the language L(M)L(M). It depends on how the machine is constructed, not on which strings it accepts. Rice's theorem only applies to semantic properties of the LANGUAGE. The number of states is a property of the machine representation โŸจMโŸฉ\langle M \rangle, not of L(M)L(M). Q6: Prove Rice's theorem: Any non-trivial property of TM languages is undecidable.
Answer: (Sketch)
  1. Let PP be non-trivial property of TM languages
  2. Assume โˆ…\emptyset does NOT satisfy PP (if it does, work with Pโ€พ\overline{P})
  3. Let BB be a language that DOES satisfy PP (exists because P is non-trivial)
  4. Define reduction f(โŸจM,wโŸฉ)=โŸจMโ€ฒโŸฉf(\langle M, w \rangle) = \langle M' \rangle:
    • Mโ€ฒM' on input xx: runs MM on ww; if MM accepts, runs a recognizer for BB on xx
  5. If MM accepts ww: L(Mโ€ฒ)=BL(M') = B โ†’ โŸจMโ€ฒโŸฉ\langle M' \rangle has property PP
  6. If MM doesn't accept ww: L(Mโ€ฒ)=โˆ…L(M') = \emptyset โ†’ โŸจMโ€ฒโŸฉ\langle M' \rangle doesn't have property PP
  7. Thus ATMโ‰คmPA_{TM} \leq_m P, so PP is undecidable. Q7: Show that ATMA_{TM} is Turing-recognizable but not co-Turing-recognizable.
Answer:
ATMA_{TM} is Turing-recognizable: The universal TM UU recognizes ATMA_{TM}. On input โŸจM,wโŸฉ\langle M, w \rangle, UU simulates MM on ww and accepts if MM accepts. If MM loops, UU loops. So UU recognizes ATMA_{TM}.
ATMA_{TM} is NOT co-Turing-recognizable: If ATMโ€พ\overline{A_{TM}} were also recognizable, then ATMA_{TM} would be decidable (since both ATMA_{TM} and its complement are recognizable). But ATMA_{TM} is undecidable. Therefore ATMโ€พ\overline{A_{TM}} is not recognizable. Q8: Define the language EQTM={โŸจM1,M2โŸฉโˆฃL(M1)=L(M2)}EQ_{TM} = \{\langle M_1, M_2 \rangle \mid L(M_1) = L(M_2)\}. Show it's undecidable.
Answer:
Reduce ETME_{TM} to EQTMEQ_{TM}. Let MrejectM_{reject} be a TM that rejects all inputs (L(MrejectM_{reject}) = โˆ…). Define f(โŸจMโŸฉ)=โŸจM,MrejectโŸฉf(\langle M \rangle) = \langle M, M_{reject} \rangle.
Then: โŸจMโŸฉโˆˆETMโ€…โ€ŠโŸบโ€…โ€ŠL(M)=โˆ…โ€…โ€ŠโŸบโ€…โ€ŠL(M)=L(Mreject)โ€…โ€ŠโŸบโ€…โ€ŠโŸจM,MrejectโŸฉโˆˆEQTM\langle M \rangle \in E_{TM} \iff L(M) = \emptyset \iff L(M) = L(M_{reject}) \iff \langle M, M_{reject} \rangle \in EQ_{TM}.
Since ETME_{TM} is undecidable, EQTMEQ_{TM} is undecidable. (Also follows from Rice's theorem: "does Mโ‚ equal Mโ‚‚?" is a non-trivial semantic property.)

8. ๐Ÿ”— Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.