Neural Sync Active
Reductions โ Proving Undecidability
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โคmโB means: There exists a computable function f such that wโAโบf(w)โB.
(Diagram)
Properties:
- If B is decidable and AโคmโB, then A is decidable
- If A is undecidable and AโคmโB, then B is undecidable
- If AโคmโB and BโคmโC, then AโคmโC (transitive)
2. The Halting Problem
2.1 Definition
ATMโ={โจM,wโฉโฃMย isย aย TMย andย Mย acceptsย w}
Theorem: ATMโ is undecidable.
Proof (diagonalization): Assume H decides ATMโ. Construct D:
- D = "On input โจMโฉ:
- Run H on โจM,โจMโฉโฉ
- If H accepts, reject; if H rejects, accept" Then D(โจDโฉ) accepts iff D does not accept โจDโฉ โ contradiction.
3. Reduction Examples
3.1 Halting Problem HALTTMโ
HALTTMโ={โจM,wโฉโฃMย haltsย onย w}
Reduction from ATMโ: f(โจM,wโฉ)=โจMโฒ,wโฉ where:
- Mโฒ runs M on w
- If M accepts, Mโฒ accepts
- If M rejects, Mโฒ loops forever Check: โจM,wโฉโATMโโบM accepts wโบMโฒ halts on wโบโจMโฒ,wโฉโHALTTMโ
3.2 Empty Language ETMโ
ETMโ={โจMโฉโฃL(M)=โ
}
Reduction from ATMโ: f(โจM,wโฉ)=โจMโฒโฉ where:
- Mโฒ = "On input x:
- If x๎ =w, reject
- Run M on w and accept if M accepts" Check: โจM,wโฉโATMโโบM accepts wโบL(Mโฒ)={w}๎ =โ โบโจMโฒโฉโ/ETMโ Wait โ we need f such that wโATMโโบf(w)โETMโ. Let me fix. f(โจM,wโฉ)=โจMโฒโฉ where:
- Mโฒ ignores input and runs M on w
- If M accepts, Mโฒ accepts Then:
- If M accepts w: Mโฒ accepts all inputs โ L(Mโฒ)=ฮฃโ๎ =โ โ โจMโฒโฉโ/ETMโ
- If M does not accept w: Mโฒ hangs or rejects โ L(Mโฒ)=โ โ โจMโฒโฉโETMโ So ATMโโคmโETMโโ, which means ETMโ is undecidable.
3.3 Regular Language REGTMโ
REGTMโ={โจMโฉโฃL(M)ย isย regular}
Reduction from ATMโ: Transform โจM,wโฉ into โจMโฒโฉ where:
- Mโฒ = "On input x:
- If x is of form 0n1n, accept
- Run M on w; if M accepts, accept" Then:
- If M accepts w: L(Mโฒ)=ฮฃโ (regular)
- If M does not accept w: L(Mโฒ)={0n1n} (not regular) Thus ATMโโคmโREGTMโ, so REGTMโ is undecidable.
4. Rice's Theorem
4.1 Statement
Theorem: Any non-trivial property of Turing machine languages is undecidable.
A property P of languages is:
- Non-trivial: Some recognizable languages have it, some don't
- Semantic: Only depends on L(M), not on M's implementation Examples of undecidable properties:
- Is L(M) empty?
- Is L(M) regular?
- Is L(M) finite?
- Does L(M) contain the string ฮต?
- Is L(M)=ฮฃโ?
4.2 Proof Sketch
- Let P be a non-trivial property
- Assume WLOG that โ does NOT have property P (otherwise use P)
- Let B be a language with property P (exists because P is non-trivial)
- Reduce ATMโ to P: Transform โจM,wโฉ to โจMโฒโฉ where Mโฒ:
- On input x, run M on w; if M accepts, run a TM that recognizes B on x
- If M accepts w: L(Mโฒ)=B (has property P)
- If M doesn't accept w: L(Mโฒ)=โ (does NOT have property P)
- Deciding P would decide ATMโ โ impossible
5. Common Pitfalls
Pitfall 1: Reversing the Reduction Direction
The mistake: Reducing B to ATMโ to prove B is undecidable.
Why students make it: The logic "this problem is hard" suggests it must reduce to something.
How to catch it: To prove B undecidable, reduce a KNOWN undecidable problem (ATMโ) TO B. If B were decidable, ATMโ would be decidable.
Correct approach: ATMโโคmโB to prove B 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), not of the machine M itself.
Correct approach: Does the property depend only on L(M)? If it depends on how M 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)โB. Both directions must hold for the reduction to be valid.
Correct approach: Prove both directions: If wโA then f(w)โB, AND if f(w)โB then wโA.
6. Key Concepts Reference
| Concept | Definition | Application |
|---|---|---|
| Mapping reduction | f computable, wโAโบf(w)โB | Proving undecidability |
| ** ATMโ ** | {โจM,wโฉโฃM accepts w} | Prototypical undecidable problem |
| ** HALTTMโ ** | {โจM,wโฉโฃM halts on w} | Undecidable via ATMโ reduction |
| Rice's theorem | Non-trivial semantic properties undecidable | Quick undecidability proofs |
| ** โคmโ ** | Reduction direction | AโคmโB means A reduces to B |
| TM-recognizable | Some TM halts-accepts on strings in L | Also called semi-decidable |
| Co-TM-recognizable | Complement is TM-recognizable | L is recognizable |
7. ๐ Practice Questions
Q1: Prove that HALTTMโ is undecidable by reduction from ATMโ.Answer:Define reduction f(โจM,wโฉ)=โจMโฒ,wโฉ where:
- Mโฒ runs M on w
- If M accepts, Mโฒ halts (accepts)
- If M rejects, Mโฒ enters infinite loop
- If M loops (doesn't halt), Mโฒ also loops
Then: โจM,wโฉโATMโ (M accepts w) โ M halts on w โ M' halts on w โ โจMโฒ,wโฉโHALTTMโ. And โจM,wโฉโ/ATMโ (M doesn't accept w) โ M either rejects or loops โ M' loops โ โจMโฒ,wโฉโ/HALTTMโ.Thus ATMโโคmโHALTTMโ, so HALTTMโ is undecidable. Q2: Use Rice's theorem to prove that ETMโ (empty language) is undecidable.Answer:ETMโ={โจMโฉโฃL(M)=โ }. This is a semantic property of TM languages:
- It's non-trivial: some TMs accept โ (e.g., TM that immediately rejects), some don't (e.g., TM that accepts everything).
- It's semantic: it depends only on L(M), not on M's implementation.
By Rice's theorem, any non-trivial semantic property is undecidable. Therefore ETMโ is undecidable. Q3: Show that the complement of ATMโ (the set of โจM,wโฉ where M does NOT accept w) is not Turing-recognizable.Answer:If ATMโโ were Turing-recognizable, then both ATMโ and ATMโโ would be recognizable, making ATMโ decidable. But ATMโ is undecidable. Therefore ATMโโ is not Turing-recognizable.More formally: A language is decidable iff both it and its complement are Turing-recognizable. Since ATMโ is not decidable (it's undecidable), and ATMโ IS Turing-recognizable (the universal TM recognizes it), its complement ATMโโ must NOT be Turing-recognizable. Q4: Construct a reduction from ATMโ to ETMโ.Answer:f(โจM,wโฉ)=โจMโฒโฉ where Mโฒ:
- On input x:
- If x๎ =w, reject
- Run M on w; if M accepts, accept
Then:
- If M accepts w: L(Mโฒ)={w}๎ =โ โ โจMโฒโฉโ/ETMโ
- If M doesn't accept w: L(Mโฒ)=โ โ โจMโฒโฉโETMโ
This shows ATMโโคmโETMโโ. So ETMโ is undecidable (if it were decidable, so would ETMโโ and thus ATMโ). 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). 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โฉ, not of L(M). Q6: Prove Rice's theorem: Any non-trivial property of TM languages is undecidable.Answer: (Sketch)
- Let P be non-trivial property of TM languages
- Assume โ does NOT satisfy P (if it does, work with P)
- Let B be a language that DOES satisfy P (exists because P is non-trivial)
- Define reduction f(โจM,wโฉ)=โจMโฒโฉ:
- Mโฒ on input x: runs M on w; if M accepts, runs a recognizer for B on x
- If M accepts w: L(Mโฒ)=B โ โจMโฒโฉ has property P
- If M doesn't accept w: L(Mโฒ)=โ โ โจMโฒโฉ doesn't have property P
- Thus ATMโโคmโP, so P is undecidable. Q7: Show that ATMโ is Turing-recognizable but not co-Turing-recognizable.
Answer:ATMโ is Turing-recognizable: The universal TM U recognizes ATMโ. On input โจM,wโฉ, U simulates M on w and accepts if M accepts. If M loops, U loops. So U recognizes ATMโ.ATMโ is NOT co-Turing-recognizable: If ATMโโ were also recognizable, then ATMโ would be decidable (since both ATMโ and its complement are recognizable). But ATMโ is undecidable. Therefore ATMโโ is not recognizable. Q8: Define the language EQTMโ={โจM1โ,M2โโฉโฃL(M1โ)=L(M2โ)}. Show it's undecidable.Answer:Reduce ETMโ to EQTMโ. Let Mrejectโ be a TM that rejects all inputs (L(Mrejectโ) = โ ). Define f(โจMโฉ)=โจM,Mrejectโโฉ.Then: โจMโฉโETMโโบL(M)=โ โบL(M)=L(Mrejectโ)โบโจM,MrejectโโฉโEQTMโ.Since ETMโ is undecidable, EQTMโ is undecidable. (Also follows from Rice's theorem: "does Mโ equal Mโ?" is a non-trivial semantic property.)
8. ๐ Cross-References
- Week 8 - Decidability: Undecidable problems
- Week 10 - Complexity: From undecidability to intractability
- BSCS4021 (Advanced Algorithms): NP-completeness reductions Join Discord PreviousDecidabilityNextComplexity