902 435 43500 00 HOMEW HOMEWORK ORK 6
due Tuesday, January 5, 2010 All problems problems are in the book: Michae Michaell Sipser Sipser,, Intro Introduction duction to the Theory Theory of Computation , 2nd Edition, PAWS Publishing Company, 2005. Solution by Cheng-Chung Li
Problem 1 Show that EQ CF G is undecidable. Ans. Suppose for a contradiction that EQ CF G was decidable. We construct a decider M for ALLCF G = {G|G is a CFG and L(G) = Σ } as follows: M =“On M =“On input G: ∗
1. Construct a CFG H such that L(H ) = Σ . ∗
2. Run the decider for EQ CF G on G, H 3. If it accepts, accept . If it rejects, reject .” .” M decides ALLCF G assuming a decider for EQ CF G exists exists.. Since Since we know know ALLCF G is undecidable, we have a contradiction. 2 R Problem 2 Let S = {M |M is a TM that accepts w whenever it accepts w}. Show that S is undecidable. Ans. We show that AT M ≤m S by mapping M, w to M where M is the following TM: M =“On input x:
1. If x=01 then accept . 2. If x = 10 then reject . 3. If x If x=10 simulate M on w. If M If M accepts w then accept ; if M if M halts and rejects w then reject .” .” If M, w ∈ AT M then M accepts w and L(M ) = {01 01,, 10}, so M ∈ S . Conversely Conversely,, if M, w ∈ / AT M then L(M ) = {01}, so M ∈ / S . Theref Therefore ore,, M, w ∈ AT M ⇔ M ∈ S . 2 Problem 3 Show that A is Turing-recognizable iff A ≤m AT M . Ans. (⇐): Since AT M is Turing-recognizable, A is Turing-recognizable by the Theorem 5.28. (⇒): Assume Assume A is Turing-re Turing-recogni cognizable zable.. Then there exists a Turing machine machine N that recognize recognizess A, i.e. i.e.,, A = {w|N accepts w}. Cons Consid ider er the func functi tion on f ( f (w) = N, w. Clearl Clearly y, if w is in A, then N accepts w so N, w is in AT M . Also, if w is not in A, then N does not accept w so N, w is not in AT M . 2 Therefore, f is a mapping reduction from A to AT M , i.e., A ≤m AT M . Problem 4 Use Rice’s Theorem, which appears in Problem 5.28, to prove the undecidability of each of the following languages.
a. {M |M is a TM and 1011 ∈ L(M )}. b. ALLT M = {M |M is a TM and L(M ) = Σ }. ∗
Ans. Note that we have to demonstrate two properties before using Rice’s Theorem to prove a set S is undecidable. Call the property in Problem 5.28, respectively, be P 1 and P 2: a. (P 1) If two TMs M 1 and M 2 both recognize the same language, then either 1011 ∈ L(M 1 ) and 1011 ∈ L(M 2 ) or 1011 ∈ / L(M 1 ) and 1011 ∈ / L(M 2 ). (P 2) Let L(M 1 ) = Σ and L(M 2 ) = ∅. M 1 satisfies the property 1011 ∈ L(M 1 ) but M 2 doesn’t. ∗
b. (P 1) If two TMs M 1 and M 2 recognize the same language, then either L(M 1 ) = L(M 2 ) = Σ or L(M 1 ) = Σ and L(M 2 ) =Σ . (P 2) Let L(M 1 ) = Σ and L(M 2 ) = ∅. M 1 satisfies the property L(M ) = Σ but M 2 doesn’t. ∗
∗
∗
∗
∗
2
Problem 5 Let S = {M |M is a TM and L(M ) = {M }}. Show that neither S nor S is Turing-recognizable. Ans. (first part) We now show that AT M ≤m S . f : “On input M, w: 1. Construct machine M 1 : 2. M 1 : “On input x: 2.1 Run M on w. 2.2 If M accepts, reject . Otherwise, if x = M 1 , accept ”. 3. Output M 1 .” If M accepts w, L(M 1 ) = ∅. Hence M 1 ∈ S . If M doesn’t accept w, L(M 1 ) = {M 1 }, M 1 ∈ S . Thus S is not Turing-recognizable. (second part) We then reduce AT M to S : g: “On input M, w: 1. Construct machine M 2 : 2. M 2 : “On input x: 2.1 Run M on w. 2.2 If M accepts w, check if x = M 2 , if the answer is “yes”, accept . Otherwise, reject .” 3. Output M 2 .” If M accepts w, L(M 2 ) = M 2 and then M 2 ∈ S . Otherwise L(M 2 ) = ∅ and M 2 ∈ S . Hence S is not Turing-recognizable. 2