Reduction via Computation Histories Recall Reduction from A to B A language A is reducible to language B iff a decider for B can be used to algorithmically construct a decider for problem A. Computability and Complexity If A is reducible to B and A is undecidable, then B is undecidable. Definition (Accepting/Rejecting Computation History) Lecture 6 Let M be a TM. A computation history of M on input w is a sequence of configurations C1 , C2 , . . . , C` such that: Reductions via Computation Histories Undecidability of Emptiness of Linear Bounded Automata Undecidability of Post Correspondence Problem C1 = q0 w is the initial configuration, Ci yields Ci+1 for all 1 ≤ i < `, and given by Jiri Srba C` is a halting configuration (in either accept or reject state). If C` is accepting, then the history is called accepting. If C` is rejecting, then the history is called rejecting. M accepts w iff M on w has an accepting computation history. Lecture 6 Computability and Complexity 1/15 Linear Bounded Automaton and the Emptiness Problem Lecture 6 Computability and Complexity 2/15 Proof (Reduction for ATM to ELBA ) Definition Linear bounded automaton (LBA) is a restricted Turing machine M such that when M runs on any input string w , its head always stays within the first |w | cells. 1 Assume that we have a decider R for ELBA . 2 Using R, we construct a decider S for ATM : S = ” On input hM, w i: 1. From M and w build an LBA B such that L(B) 6= ∅ if and only if M accepts w 2. Run R (decider for ELBA ) on hBi. 3. If R accepted then S rejects. If R rejected then S accepts. ” Theorem The language ALBA is decidable. Emptiness Problem: ”Given an LBA B, is L(B) = ∅?” def ELBA = {hBi | B is an LBA such that L(B) = ∅ } 3 We know that S cannot exist, and hence R cannot exist either. 4 Conclusion: ELBA is undecidable. TO DO (The Tricky Part) Theorem The language ELBA is undecidable. From M and w construct an LBA B s.t. L(B) 6= ∅ iff M accepts w . Proof: By reduction from ATM to ELBA via computation histories. Lecture 6 Computability and Complexity 3/15 Proof (Construction of LBA B from M and w ) Lecture 6 Computability and Complexity 4/15 Proof (Construction of LBA B from M and w ) B = ” On input x: 1. If x is not of the form #C1 #C2 # . . . #C` # for some strings C1 , . . . , C` then B rejects. Idea: 2. Verify whether #C1 #C2 # . . . #C` # satisfies the following three conditions: a) C1 = q0 w b) C` is an accept configuration c) Ci yields Ci+1 for all i (zigzag between them) We construct B such that it accepts exactly all strings of the form #C1 #C2 #C3 # . . . #C` # where C1 , C2 , C3 , . . . , C` is an accepting computation history of M on w . 3. If all three conditions are true, then S accepts, else S rejects. ” Now clearly L(B) 6= ∅ if and only if M accepts w . Notice The constructed machine B is LBA. We actually never run B, it is merely the input for R (the decider for ELBA ) in order to achieve a contradiction. Lecture 6 Computability and Complexity 5/15 Lecture 6 Computability and Complexity 6/15 More Undecidable Problem from Language Theory Post Correspondence Problem (Emil Post, 1946) Problem: ”Given a CFG G , is L(G ) = Σ∗ ?” def ALLCFG = {hG i | G is a CFG such that L(G ) = Instance of the Post Correspondence Problem (PCP): Σ∗ A PCP instance over Σ is a finite collection P of dominos } P={ Theorem The language ALLCFG is undecidable. t1 t2 tk } , ,··· , b1 b2 bk where for all i, 1 ≤ i ≤ k, ti , bi ∈ Σ∗ . Proof: very interesting technique based on computation histories (optional reading in the book). Match: Assume a given PCP instance P. A match is a nonempty sequence def EQCFG = {hG1 , G2 i | G1 and G2 are CFGs s.t. L(G1 ) = L(G2 ) } i1 , i2 , . . . , i` of numbers from {1, 2, . . . , k} (repeating is allowed) such that Theorem The language EQCFG is undecidable. ti1 ti2 . . . ti` = bi1 bi2 . . . bi` . Proof: By reduction from ALLCFG . Next tutorial. Lecture 6 Computability and Complexity Lecture 6 7/15 Post Correspondence Problem (PCP) Computability and Complexity 8/15 Proof Structure (Undecidability of PCP) The reduction will work in two steps: Question: Does a given PCP instance P have a match? 1 We reduce ATM to MPCP. 2 We reduce MPCP to PCP. Language formulation: MPCP (Modified PCP): def PCP = {hPi | P is a PCP instance and it has a match } def MPCP = {hPi | P is a PCP instance and it has a match which starts with index 1 } Theorem The language PCP is undecidable. In reduction from ATM we will without loss of generality assume that on input hM, w i of ATM the machine M never attempts to move its head off the left-hand end of the tape. Proof: By reduction via computation histories from ATM . Lecture 6 Computability and Complexity 9/15 Proof (Reduction from ATM to MPCP) 2 3 4 5 6 7 # #q0 w # . qa If δ(q, a) = (r , b, R) add the domino br . cqa If δ(q, a) = (r , b, L) add the domino rcb for all c ∈ Γ. a Add the domino for all a ∈ Γ. a# # Add the dominos and t# . # aqaccept qaccept a Add the dominos and for all a ∈ Γ. qaccept q qaccept ## accept Finally add the domino . # Lecture 6 Computability and Complexity 10/15 Conclusion MPCP is undecidable. M accepts w iff P has a match starting with domino 1. Add a start (first) domino Computability and Complexity Proof (Reduction from MPCP to PCP) For input hM, w i of ATM construct a MPCP instance P such that 1 Lecture 6 Now we want to reduce MPCP to PCP: Given an instance P of MPCP we build an instance P 0 of PCP s.t. P has a match starting with domino 1 iff P 0 has a match. Let w = a1 a2 . . . an be a string. We use the notation def ∗w = ∗a1 ∗ a2 ∗ . . . ∗ an , def w ∗ = a1 ∗ a2 ∗ . . . ∗ an ∗, and def ∗w ∗ = ∗a1 ∗ a2 ∗ . . . ∗ an ∗. 11/15 Lecture 6 Computability and Complexity 12/15 Proof (Reduction from MPCP to PCP) Conclusion Given an instance P of MPCP we build an instance P 0 of PCP s.t. P has a match starting with domino 1 iff P 0 has a match. Conclusion PCP is undecidable. Construction of P 0 from P (here ∗ and are fresh symbols): For the first domino For all dominos t t i bi We add the domino 1 b1 in P we add ∗t 1 ∗b1 ∗ in P we add the dominos ∗ to P 0 . ∗t i bi ∗ to Facts: Undecidability of PCP can be further used to show that e.g. the following problems are undecidable too: P 0. ”Is a given CGF ambiguous?” to P 0 . ”Given CFGs G1 and G2 is L(G1 ) ∩ L(G2 ) = ∅?” It is easy to see that if in P (where i1 = 1) ti1 ti2 . . . ti` = bi1 bi2 . . . bt` then in P 0 ∗ti1 ∗ ti2 ∗ . . . ∗ ti` ∗ = ∗bi1 ∗ bi2 ∗ . . . ∗ bt` ∗ and vice verse. Lecture 6 Computability and Complexity And many more ... 13/15 Exam Questions Undecidability of emptiness for LBA. PCP and MPCP definitions and examples. Undecidability proofs of MPCP and PCP (two reductions). Lecture 6 Computability and Complexity 15/15 Lecture 6 Computability and Complexity 14/15