This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS5371 Theory of Computation Homework 3 (Suggested Solution) 1. Ans. The language { n 1 n 2 n  n ≥ 1 } is not contextfree, so that it cannot be recognized by a 1PDA. However, we can easily design a 2PDA to recognize this language as follows (Let S 1 and S 2 be the two stacks in the 2PDA): 1. For each 0 it reads, push a 0 in S 1 and push a 0 in S 2 2. For each 1 it reads, pop a 0 from S 1 3. For each 2 it reads, pop a 0 from S 2 4. If at any step, we discover the input string is not in correct order (e.g., a 0 is read after 1 is read), we reject the input string 5. If S 1 and S 2 become just empty at the end, we accept the input string Thus, we have found a language that can be recognized by some 2PDA but not by any 1 PDA. On the other hand, if a language can be recognized by a 1PDA, it must be recognized by some 2PDA. Therefore, 2PDAs are more powerful than 1PDAs. 2. Ans. If a language L is decidable, there exists a decider D that decides L . Then, we can construct an enumerator E that enumerates the strings of L in the desired ordering (shorter string first, then lexicographical order) as follows: E = “On any input, 1. Ignore the input 2. For k = 1 , 2 ,......
View
Full
Document
This note was uploaded on 02/22/2010 for the course CS 881 taught by Professor H.f. during the Spring '10 term at Shahid Beheshti University.
 Spring '10
 H.F.

Click to edit the document details