a-2 - CpSc 421 Homework 10 Solutions Attempt any three of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CpSc 421 Homework 10 Solutions Attempt any three of the six problems below. The homework is graded on a scale of 100 points, even though you can attempt fewer or more points than that. Your recorded grade will be the total score on the problems that you attempt. 1. ( 20 points , Sipser problems 5.17 and 5.18) (a) ( 10 points ) Prove that the Post Correspondence Problem is decidable if the alphabet is unary, i.e., = { 1 } . Solution (sketch): if the PCP instance has a tile of the form h 1 i 1 i i , then that tile solves the problem. Other- wise, if there is at least one tile of the form h 1 i 1 j i with i > j and one with i < j , then it is straightforward to solve the problem. Finally, if all tiles have more 1 s on the top than on the bottom (or all have more on the bottom than on the top), then the problem is not solvable. (b) ( 10 points ) Prove that the Post Correspondence Problem is undecidable if the alphabet is binary, i.e., = { , 1 } . Solution (sketch): Consider any instance of PCP with some alphabet, 1 . Let k = d log 2 | 1 |e . We can encode each symbol of 1 with k symbols of { , 1 } . With this encoding, every tile will a top string whose length is a multple of k and likewise for the bottom string. This ensures that the strings of { , 1 } that encode symbols of 1 will stay properly aligned, and the new, binary, problem is solvable iff the original problem is solvable. 2. ( 30 points , Sipser problem 5.21) Let AMBIG CFG = { G | G describes an ambiguous CFG } . Show that AMBIG CFG is undecidable. (Hint: Use a reduction from PCP . Given a PCP instance P = n h t 1 b 1 i , h t 2 b 2 i , . . . , h t k b k i o , construct a CFG G with the rules S T | B T t 1 T a 1 | . . . | t k T a k | t 1 a 1 | . . . | t k a k B b 1 B a 1 | . . . | b k B a k | b 1 a 1 | . . . | b k a k , where a 1 . . . a k are new terminal symbols. Prove that this reduction works.) Solution (sketch): If the PCP problem has a solution, i 1 , i 2 , ... i m such that t i 1 t i 2 . . . t i m = b i 1 b i 2 . . . b i m , then S T * t i 1 t i 2 . . . t i k a i k . . . a i 2 a i 1 and S B * b i 1 b i 2 . . . b i k a i k . . . a i 2 a i 1 . Because t i 1 t i 2 . . . t i m = b i 1 b i 2 . . . b i m , these two derivations produce the same string. Thus, G is ambiguous. Now, Ill show that if G is ambiguous, then the PCP problem has a solution. The critical observation is that a grammar with starts symbol T and has the rules given above is unambiguous, as there is only one way to get any suffix of a i symbols. Likewise, a grammar that starts with B is unambiguous. So, if G is ambiguous, there must be a string, x L ( G ) such that S T * x and S...
View Full Document

This note was uploaded on 11/06/2009 for the course CS 421 taught by Professor Li during the Spring '09 term at A.T. Still University.

Page1 / 4

a-2 - CpSc 421 Homework 10 Solutions Attempt any three of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online