13.07.2015 Views

Exercise 11 (the last one )

Exercise 11 (the last one )

Exercise 11 (the last one )

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Automata and Formal Languages, Semester A 2010<strong>Exercise</strong> <strong>11</strong> (<strong>the</strong> <strong>last</strong> <strong>one</strong> )Submit by Wednesday 05/01 before your lecture!Question 1The language L is defined as follows:L={w{a,b}* | # a (u) |u| , for any u, a prefix of w}i.e. every word w in L includes at least a third a’s in any of its prefix.a. Construct a context-free grammar recognizing L.b. Construct a PDA recognizing L, by converting <strong>the</strong> grammar youdefined in a into a PDA.c. The language L’ is defined as follows: L’={w | # a (u) |u| for any u,a suffix of w} . Construct a grammer for L’.Question 2Translate <strong>the</strong> following PDA into a context-free grammar using <strong>the</strong> proceduretaught in class. For <strong>the</strong> second types of derivations (slide 26 in unit 9) giveonly a partial selection of <strong>the</strong> rules.


Automata and Formal Languages, Semester A 2010Question 3For every language prove if <strong>the</strong> language is CFL or not (write a grammar/PDAor use <strong>the</strong> pumping lemma / prove by contradiction)a. L={ww R 2ww R | w{0,1}* }b. L = {a i b j c k | j=min(i,k)}c. L = {a n b m c n d m | m,n > 0}d. L = {a n b n c k | n > k}e. L = {a i b j a 2i | j is odd and i>0}f. L= {a i b i a j | (i+j) is odd}g. L = {a n b n $c 2n |n≥0}h. L={a i b j c i+j | i>j>0}i. L={a i b j c k | not(i=j=k)}.Question 4Prove that <strong>the</strong> languages L={wtw R | w,t{a,b} + and |w|=|t| } is not context free.Hint: for a given p show that <strong>the</strong> word w=a 2p a p b p a 2p does not satisfy <strong>the</strong>pumping lemma for CFL (Note, <strong>the</strong>re are 5 different cases!).Question 5The languages L is defined as follows: L={a F(n) | n0} where F(n) is afibonacci function:F(0)=0F(1)=1F(n)=F(n-2)+F(n-1)a. Prove that L is not CFLb. Define L 1 ={a F(n-2) b F(n-1) c F(n) | n>2} . If L 1 is a CFL, build a PDArecognizing L 1 . O<strong>the</strong>wise, prove that L 1 is not a CFL.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!