You are on page 1of 2

Automata Theory and Computability Assignment 3 (Context-Free Grammars) (Due on Fri 28 Oct 2011) 1.

Give context-free grammars for the following languages. You need not give a proof of correctness. (a) L1 = {ai bj ck | i = k } (b) L2 = a b c {an bn cn | n 0}. 2. Give an equivalent grammar in Chomsky Normal Form for the following CFG: S aSbb | T, T bT aa | S | . 3. Consider the grammar G below: S SS | aSb | bSa | . Prove that it generates the language {x {a, b} | #a (x) = #b (x)}. Hint: Consider the graph of a word x where you plot the value #a (y ) #b (y ) against prexes y of x. Use induction as usual.

#a #b

a b

b a a a a a b

4. For the CFG G in Question 3 above answer the following questions. (a) Give a regular language that is letter-equivalent to L(G). Such a language is guaranteed to exist from Parikhs theorem. (b) Use the construction in Parikhs theorem to construct a semi-linear expression for (L(G)). That is, rst identify the basic pumps for G, and the -minimal parse trees. Use these to obtain an expression for (L). 5. A regular grammar (or a strongly right-linear grammar) is a grammar in which all rules are of the form X aY or X where a is a terminal and X and Y are non-terminals. Prove that the class of languages denable by regular grammars is precisely the class of regular languages.

6. Is the following language context-free? Justify your answer. {al bm cn | l m n}. 7. For A, B , dene A/B AB = {x | y B : xy A} = {x | y B : xy A}.

Exactly one of the following statements is true. Which one is? Justify your answer. (a) If L is context-free, so is L/ . (b) If L is context-free, so is L .

You might also like