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: Solutions for Problem Set 9 CS 373: Theory of Computation Assigned: November 9, 2010 Due on: November 16, 2010 at 10am Homework Problems Problem 1 . [Category: Comprehension] Consider the following grammar over the terminals { , # } and start symbol S . S → TT  U T → T  T  # U → U 00  # 1. For each of the following strings, answer whether or not they belong to the language defined by the grammar: 00#0#00, 0#0, 000#000000. If they do, give a derivation and parse tree for the string. If not, provide a short, informal justification for why the string cannot be generated. [6 points] 2. What is the language of the grammar? You need not prove your answer, but you should provide a short informal justification for your answer. [2 points] 3. Is the language of the grammar regular? Prove your answer. [2 points] Solution: 1. 00#0#00 is in the language as can be seen by the following derivation. S ⇒ TT ⇒ TT ⇒ 00 TT ⇒ 00# T ⇒ 00#0 T ⇒ 00#0 T ⇒ 00#0 T 00 ⇒ 00#0#00 0#0 is not derivable in the grammar because the only strings that can be generated with a single #symbol are those from U . But then the strings obtained from U have at least two 0s after the # (if there are any 0s after the #). String 000#000000 is derivable as follows. S ⇒ U ⇒ U 00 ⇒ 00 U 0000 ⇒ 000 U 000000 ⇒ 000#000000 2. The strings derivable from T are L 1 = { i #0 j  i,j ≥ } , and from U are L 2 = { i #0 2 i  i ≥ } . Thus, L ( G ) = L 1 L 1 ∪ L 2 3. L ( G ) is not regular. We will prove this using closure properties. Consider the following sequence of languages....
View
Full
Document
This note was uploaded on 10/04/2011 for the course CS 373 taught by Professor Viswanathan,m during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Viswanathan,M

Click to edit the document details