COSC 3340: Introduction to Theory of Computation - PowerPoint PPT Presentation

About This Presentation
Title:

COSC 3340: Introduction to Theory of Computation

Description:

COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 11 Push Down Automaton (PDA) Language Acceptor Model for CFLs It is an NFA ... – PowerPoint PPT presentation

Number of Views:135
Avg rating:3.0/5.0
Slides: 28
Provided by: Duk77
Learn more at: https://www2.cs.uh.edu
Category:

less

Transcript and Presenter's Notes

Title: COSC 3340: Introduction to Theory of Computation


1
COSC 3340 Introduction to Theory of Computation
  • University of Houston
  • Dr. Verma
  • Lecture 11

2
Push Down Automaton (PDA)
  • Language Acceptor Model for CFLs
  • It is an NFA with a stack.

Finite State control
Input
Accept/Reject
Stack
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
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

u, x ? w
q0
q1
u, x w In JFLAP
5
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.
6
JFLAP Simulation
7
JFLAP Simulation
8
JFLAP Simulation
9
JFLAP Simulation
10
JFLAP Simulation
11
JFLAP Simulation
12
JFLAP Simulation
13
JFLAP Simulation
14
JFLAP Simulation
15
JFLAP Simulation
16
JFLAP Simulation
17
JFLAP Simulation
18
JFLAP Simulation
19
JFLAP Simulation
20
JFLAP Simulation
21
JFLAP Simulation
22
JFLAP Simulation
23
JFLAP Simulation
24
JFLAP Simulation
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
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

27
Example
  • What is L(M)?

Push S to the stack in the beginning and then
pop it at the end before accepting.
Write a Comment
User Comments (0)
About PowerShow.com