Pushdown Automata Section 2.2 CSC 4170 Theory of Computation
Components of a pushdown automaton (PDA) 2.2.a (Q, , , ,s,F) xyxz...xyxz... a a b a c … StackInput Q is the set of states is the input alphabet is the stack alphabet is the transition function s is the start state F Q is the set of accept states a,x y q1q2 If the input symbol is a and the top stack symbol is x, go from q1 to q2, pop x and push y If a= , the read head is not advanced If x= , nothing is popped If y= , nothing is pushed Push: write a symbol on the top of the stack Pop: delete a symbol from the top of the stack
How a PDA works 2.2.b1 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput
How a PDA works 2.2.b2 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b3 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 0$0$
How a PDA works 2.2.b4 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 00$00$
How a PDA works 2.2.b5 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 000$000$
How a PDA works 2.2.b6 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 00$00$
How a PDA works 2.2.b7 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 0$0$
How a PDA works 2.2.b8 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b9 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput Accept
How a PDA works 2.2.b10 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 What language does this automaton recognize?
How a PDA works 2.2.b11 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput
How a PDA works 2.2.b12 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b13 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 0$0$
How a PDA works 2.2.b14 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 00$00$
How a PDA works 2.2.b15 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 0$0$ Reject
How a PDA works 2.2.b16 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput
How a PDA works 2.2.b17 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b18 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 0$0$
How a PDA works 2.2.b19 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b20 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput Reject
How a PDA works 2.2.b21 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput
How a PDA works 2.2.b22 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b23 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput 0$0$
How a PDA works 2.2.b24 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput $
How a PDA works 2.2.b25 , $, $ q1q2 q4 q3 ,$ ,$ 1,0 0, 00, 0 1,0 1,0 StackInput Reject
Designing pushdown automata 2.2.c s 0 Design a pushdown automaton that recognizes the language {w | w has an equal number of 0s and 1s} 1 =
Converting NFA into PDA 2.2.d 32 1 a a b abab Every NFA can be understood as a PDA that never pushes or pops. Just replace every label a of the NFA by a, a, b, a, b, ,
Main theorems 2.2.e Theorem 2.20: A language is context-free iff some pushdown automaton recognizes it. Theorem: Not every nondeterministic PDA has an equivalent deterministic PDA. Example 2.18: There is a nondeterministic PDA recognizing {ww R | w {0,1}* } (w R means w reversed), but no deterministic PDA can recognize this language. Proofs omitted.