Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11.

Similar presentations


Presentation on theme: "Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11."— Presentation transcript:

1 Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11

2 UofH - COSC 3340 - Dr. Verma 2 Push Down Automaton (PDA) Language Acceptor Model for CFLs It is an NFA with a stack. Finite State control Input Stack Accept/Reject

3 Lecture 11UofH - COSC 3340 - Dr. Verma 3 PDA (contd.) In one move the PDA can : – change state, – consume a symbol from the input tape or ignore it – pop a symbol from the stack or ignore it – push a symbol onto the stack or not A string is accepted provided the machine when started in the start state consumes the string and reaches a final state.

4 Lecture 11UofH - COSC 3340 - Dr. Verma 4 PDA (contd.) If PDA in state q can consume u, pop x from stack, change state to p, and push w on stack we show it as q0q0 u, x  w q1q1 u, x ; w In JFLAP

5 Lecture 11UofH - COSC 3340 - Dr. Verma 5 Example of a PDA PDA L = {a n b n |n  0} Push S to the stack in the beginning and then pop it at the end before accepting.

6 Lecture 11UofH - COSC 3340 - Dr. Verma 6 JFLAP Simulation

7 Lecture 11UofH - COSC 3340 - Dr. Verma 7 JFLAP Simulation

8 Lecture 11UofH - COSC 3340 - Dr. Verma 8 JFLAP Simulation

9 Lecture 11UofH - COSC 3340 - Dr. Verma 9 JFLAP Simulation

10 Lecture 11UofH - COSC 3340 - Dr. Verma 10 JFLAP Simulation

11 Lecture 11UofH - COSC 3340 - Dr. Verma 11 JFLAP Simulation

12 Lecture 11UofH - COSC 3340 - Dr. Verma 12 JFLAP Simulation

13 Lecture 11UofH - COSC 3340 - Dr. Verma 13 JFLAP Simulation

14 Lecture 11UofH - COSC 3340 - Dr. Verma 14 JFLAP Simulation

15 Lecture 11UofH - COSC 3340 - Dr. Verma 15 JFLAP Simulation

16 Lecture 11UofH - COSC 3340 - Dr. Verma 16 JFLAP Simulation

17 Lecture 11UofH - COSC 3340 - Dr. Verma 17 JFLAP Simulation

18 Lecture 11UofH - COSC 3340 - Dr. Verma 18 JFLAP Simulation

19 Lecture 11UofH - COSC 3340 - Dr. Verma 19 JFLAP Simulation

20 Lecture 11UofH - COSC 3340 - Dr. Verma 20 JFLAP Simulation

21 Lecture 11UofH - COSC 3340 - Dr. Verma 21 JFLAP Simulation

22 Lecture 11UofH - COSC 3340 - Dr. Verma 22 JFLAP Simulation

23 Lecture 11UofH - COSC 3340 - Dr. Verma 23 JFLAP Simulation

24 Lecture 11UofH - COSC 3340 - Dr. Verma 24 JFLAP Simulation

25 Lecture 11UofH - COSC 3340 - Dr. Verma 25 Definition of PDA Formally, a PDA M = (K, , , , s, F), where – K -- finite set of states –  -- is the input alphabet –  -- is the tape alphabet – s  K -- is the start state – F  K -- is the set of final states –   (K X   X   ) X (K X   )

26 Lecture 11UofH - COSC 3340 - Dr. Verma 26 Definition of L(M) Define  * as: (1)  *(q, w, x) = {(q, w, x)}  {(p, w, x) | ((q, ,  ), (p,  ))   } (2)  *(q, uv, xy) = U {  *(p, v, wy) | ((q, u, x), (p, w))   } [at least one of u, x, w is not equal to  ] – i.e., first compute  * for all successor configurations and then take the union of all those sets M accepts w if (f, , x) in  *(s, w,  ) Alternative: if (f, ,  ) in  *(s, w,  ) [we use] L(M) = {w   * | M accepts w}

27 Lecture 11UofH - COSC 3340 - Dr. Verma 27 Example What is L(M)? Push S to the stack in the beginning and then pop it at the end before accepting.


Download ppt "Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11."

Similar presentations


Ads by Google