Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.

Similar presentations


Presentation on theme: "Pushdown Automata Section 2.2 CSC 4170 Theory of Computation."— Presentation transcript:

1

2 Pushdown Automata Section 2.2 CSC 4170 Theory of Computation

3 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

4 How a PDA works 2.2.b1 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput

5 How a PDA works 2.2.b2 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput $

6 How a PDA works 2.2.b3 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput 0$0$

7 How a PDA works 2.2.b4 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput 00$00$

8 How a PDA works 2.2.b5 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput 000$000$

9 How a PDA works 2.2.b6 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput 00$00$

10 How a PDA works 2.2.b7 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput 0$0$

11 How a PDA works 2.2.b8 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput $

12 How a PDA works 2.2.b9 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 0 1 1 1 StackInput Accept

13 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?

14 How a PDA works 2.2.b11 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 1 StackInput

15 How a PDA works 2.2.b12 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 1 StackInput $

16 How a PDA works 2.2.b13 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 1 StackInput 0$0$

17 How a PDA works 2.2.b14 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 1 StackInput 00$00$

18 How a PDA works 2.2.b15 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 0 1 StackInput 0$0$ Reject

19 How a PDA works 2.2.b16 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 1 StackInput

20 How a PDA works 2.2.b17 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 1 StackInput $

21 How a PDA works 2.2.b18 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 1 StackInput 0$0$

22 How a PDA works 2.2.b19 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 1 StackInput $

23 How a PDA works 2.2.b20 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 1 StackInput Reject

24 How a PDA works 2.2.b21 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 0 StackInput

25 How a PDA works 2.2.b22 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 0 StackInput $

26 How a PDA works 2.2.b23 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 0 StackInput 0$0$

27 How a PDA works 2.2.b24 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 0 StackInput $

28 How a PDA works 2.2.b25 , $, $ q1q2 q4 q3 ,$  ,$   1,0   0, 00, 0 1,0  1,0   0 1 0 StackInput Reject

29 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 =

30 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,  3 2 1 a,  b,  a,  b,  , 

31 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.


Download ppt "Pushdown Automata Section 2.2 CSC 4170 Theory of Computation."

Similar presentations


Ads by Google