lecture 11uofh - cosc 3340 - dr. verma 1 cosc 3340: introduction to theory of computation university...
TRANSCRIPT
![Page 1: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/1.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma1
COSC 3340: Introduction to Theory of Computation
University of Houston
Dr. Verma
Lecture 11
![Page 2: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/2.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma2
Push Down Automaton (PDA)
Language Acceptor Model for CFLs It is an NFA with a stack.
Finite State
controlInput
Stack
Accept/Reject
![Page 3: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/3.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma3
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.
![Page 4: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/4.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma4
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
q0
u, x w
q1
u, x ; w In JFLAP
![Page 5: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/5.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma5
Example of a PDA
PDA L = {anbn |n 0}
Push S to the stack in the beginning and then pop it at the end before accepting.
![Page 6: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/6.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma6
JFLAP Simulation
![Page 7: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/7.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma7
JFLAP Simulation
![Page 8: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/8.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma8
JFLAP Simulation
![Page 9: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/9.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma9
JFLAP Simulation
![Page 10: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/10.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma10
JFLAP Simulation
![Page 11: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/11.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma11
JFLAP Simulation
![Page 12: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/12.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma12
JFLAP Simulation
![Page 13: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/13.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma13
JFLAP Simulation
![Page 14: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/14.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma14
JFLAP Simulation
![Page 15: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/15.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma15
JFLAP Simulation
![Page 16: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/16.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma16
JFLAP Simulation
![Page 17: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/17.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma17
JFLAP Simulation
![Page 18: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/18.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma18
JFLAP Simulation
![Page 19: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/19.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma19
JFLAP Simulation
![Page 20: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/20.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma20
JFLAP Simulation
![Page 21: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/21.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma21
JFLAP Simulation
![Page 22: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/22.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma22
JFLAP Simulation
![Page 23: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/23.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma23
JFLAP Simulation
![Page 24: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/24.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma24
JFLAP Simulation
![Page 25: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/25.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma25
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 )
![Page 26: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/26.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma26
Definition of L(M)
Define * as:(1) *(q, , ) = {(q, , )} {(p, , ) |((q, , ), (p, )) }
(2) *(q, uv, xy) = U {*(p, v, wy) | ((q, u, x), (p, w)) }
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}
![Page 27: Lecture 11UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d765503460f94a56fa2/html5/thumbnails/27.jpg)
Lecture 11 UofH - COSC 3340 - Dr. Verma27
Example
What is L(M)?
Push S to the stack in the beginning and then pop it at the end before accepting.