SE307 - Computation and Complexity Theory
Department of Computer Science
National University of Ireland, Maynooth
T Naughton, NUIM
Back to SE307 home
Lab 7 - Pushdown automata
Note: if you don't finish a laboratory assignment within the scheduled laboratory hours, it is expected that you finish it in your own time. This, of course, goes for problem 6.1 from last week.
As explained in lectures, a language is a CFL (context-free language) iff it is accepted (recognised) by a PDA (pushdown automaton). Therefore the existence of a PDA to accept a particular language L serves as a proof that that language is a CFL. An example follows. Note the phrases and logical statements that is used in formal proofs. Practise using these logical statements in this lab to become familiar with them. You do not need your PC for this lab.
Problem 7.A Let LA={anbn : n>=0}. Prove that LA is a CFL.
Proof 7.A I choose to prove LA is a CFL by proving the existence of a PDA that accepts LA. Let M be the following PDA:
M accepts LA, and M is a PDA, and there is a theorem that says that if a PDA accepts a language then that language is a CFL, therefore this proves that LA is a CFL.
Problem 7.1 Let L1={wwR : wÎ{a, b}*}. Prove that L1 is a CFL.
Problem 7.2 Let L2={wcwR : wÎ{a, b}*}. Prove that L2 is a CFL.
Problem 7.3 Let L3={w : wÎ{a, b}*, w=wR}. Prove that L3 is a CFL.
Problem 7.4 Let L4={ambn : m,n>=0, m=2n}. Prove that L4 is a CFL.
Problem 7.5 Let L5={w : wÎ{a, b}*, w has twice as many as as bs}. Prove that L5 is a CFL.
Problem 7.6 Let L6={w : wÎ{a, b}*, w contains the substring aab}. Prove that L6 is a CFL.
Problem 7.7 Prove that all regular languages are context-free. You should use a "constructive proof" that consists of an unambiguous sequence of steps to turn any FA into a PDA that accepts the same language. (Use the same kind of reasoning you used to embed a FA into a TM.)
Problem 7.8 For each Li defined in this lab sheet, specify a CFG (context-free grammar) that generates Li.