Lecture 23 Automata Theory - 2
Lecture 23 Automata Theory - 2
Pushdown Automata
(Introduction)
Pushdown Automata (Introduction)
• A pushdown automata (PDA) is a way to
implement a context free grammar in a
similar way we design finite automata for
regular grammar
– It is more powerful than FSM
– FSM has a very limited memry but PDA has
more memory
– PDA= Finite state machine + A stack
Stack
• A stack is a way we arrange elements one
on top of another
• A stack does two basic opertaions:
– PUSH: A new element is added at the top of
the stack
– POP: the top element of the stack is read or
removed
Stack (Example)
Top Top
Stack Stack
PUSH POP
Stack (Example)
Top
Top
d
c Stack
c
Stack
b Push d in this stack b
a
a
Stack (Example)
Top
c
Top
d Stack
b d is removed/
Stack popped
c a
pop this stack
b
Top
a Stack b
c is removed/
a popped
Pushdown Automata (Basic Components)
• A pushdown automata has 3 basic components:
– An input tape/string
– A Finite Control Unit
– A stack with infinite size
Pushdown Automata (Formal Definition)
• A pushdown automaton (PDA) is a seven-tuple:
P = (Q, Σ, Г, δ, q0, z0, F)
where
Q A finite set of states
Σ A finite input alphabet
Г A finite stack alphabet
q0 The initial/starting state, q0 is in Q
z0 A starting stack symbol, is in Г
F A set of final/accepting states, which is a subset of Q
δ A transition function
Pushdown Automata(Transition Function)
• δ is transition function of PDA that takes as argument a
triple (three inputs) δ(q, a, X) where:
1) q is a state in Q
2) a is either an input symbol from Σ or Λ
3) X is a stack symbol, that is a member of Г
Pushdown Automata(Transition Function)
Pushdown Automata(Graphical Notation)
• Finite State Machine
a
A B
• Pushdown Automata
a, bc
A B
Pushdown Automata(Graphical Notation)
• Pushdown Automata
A B
a, bc
0, Λ0 1, 0Λ
a,b