assign3ans_2

# assign3ans_2 - CS5371 Theory of Computation Homework 3...

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
This is the end of the preview. Sign up to access the rest of the 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 context-free, so that it cannot be recognized by a 1-PDA. However, we can easily design a 2-PDA to recognize this language as follows (Let S 1 and S 2 be the two stacks in the 2-PDA): 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 2-PDA but not by any 1- PDA. On the other hand, if a language can be recognized by a 1-PDA, it must be recognized by some 2-PDA. Therefore, 2-PDAs are more powerful than 1-PDAs. 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.

### Page1 / 3

assign3ans_2 - CS5371 Theory of Computation Homework 3...

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

View Full Document
Ask a homework question - tutors are online