Pushdown Automata
Pushdown Automata – p.1/25
Pushdown Automata Pushdown Automata p.1/25 Rationale CFG - - PowerPoint PPT Presentation
Pushdown Automata Pushdown Automata p.1/25 Rationale CFG are specification mechanisms, i.e., a CFG generates a context-free language. Pushdown-automata are recognizing mechanisms, i.e., a PDA recognizes a context-free
Pushdown Automata – p.1/25
Pushdown Automata – p.2/25
Pushdown Automata – p.3/25
Pushdown Automata – p.4/25
Pushdown Automata – p.5/25
Finite Control
Input a a b b Schematic of a NFA Finite Control
Input a a b b
✁y z
✂ ✂ ✂Stack Schematic of a PDA
Note: in Figure 1 r stands for read and w stands for write.
Pushdown Automata – p.6/25
Pushdown Automata – p.7/25
In other words: a stack is a “last-in fi rst-out" storage device
Pushdown Automata – p.8/25
Pushdown Automata – p.9/25
stack
becomes empty while there is still input or input fi nishes while stack is not empty reject
Pushdown Automata – p.10/25
Pushdown Automata – p.11/25
them by
Hence we will use
✄✂ ☎and
✁ ✂ ☎ ✁ ✆where
✟is the set of states
nondeterministic transitions the range of the PDA transition function is
✡ ☛ ✟ ✠ ✁ ✂ ☞In conclusion:
✌✎✍ ✟ ✠ ✄✂ ✠ ✁ ✂ ✏ ✡ ☛ ✟ ✠ ✁ ✂ ☞Pushdown Automata – p.12/25
1.
✟is a set of states 2.
3.
✁is the stack alphabet 4.
✌✎✍ ✟ ✠is the transition function 5.
✝✟✞ ✄ ✟is the start state 6.
✠ ✡ ✟is the set of accept states
Pushdown Automata – p.13/25
inputs
, where each
✟✞ ✄and a sequence
that satisfy the conditions: 1.
✠ ✞ ☎ ✝ ✞,
✡ ✞ ☎ ✝, i.e.,
✁starts in the start state with empty stack
we have
☛ ✠ ✞ ✎ ✂ ☎ ✏ ☞ ✄ ✌ ☛ ✠ ✞ ☎where
✡ ✞ ☎ ✑ ✒and
✡ ✞ ✎ ✂ ☎ ✏ ✒for some
✑ ☎ ✏ ✄ ✁ ✂and
✒ ✄ ✁ ✝, i.e.,
✁moves properly according to the state, stack, and input symbol 3.
✠ ✝ ✄ ✠, i.e., an accept state occurs at the input end
Pushdown Automata – p.14/25
,
,
✁ ☎,
✠ ☎is defi ned by the table:
✆✞✝1
✟ ✠ ✡ ☛ ✝ ☞$
✟ ☞$
✟ ☞$
✟ ✌ ✍ ✎✏ ✌ ✑✓✒ ✔✕ ✖ ✌ ✑ ✎ ✏ ✌ ✑✓✒ ☞ ✕ ✖ ✎✏ ✌ ✗✓✒ ✟ ✕ ✖ ✌ ✗ ✎✏ ✌ ✗✓✒ ✟ ✕ ✖ ✎ ✏ ✌ ✘ ✒ ✟ ✕ ✖ ✌ ✘Notation:
✏ ✌ ✙ ✠ ✒ ✚ ✙ ✆ ✝ ✒ ✛ ✙ ☛ ✝ ✕ ✜ ✎✏ ✢ ✙ ✠ ✒ ✣ ✙ ☛ ✝ ✕ ✖means
✌ ✤✦✥ ✧ ★ ✩ ✪ ✫ ✏ ✢ ✒ ✣ ✕.
Pushdown Automata – p.15/25
from input
where any of
✑ ☎ ✏ ☎ ✄may be
✝Pushdown Automata – p.16/25
Pushdown Automata – p.17/25
Pushdown Automata – p.18/25
Pushdown Automata – p.19/25
Pushdown Automata – p.20/25
’s on the stack
s with
✏s or
✄s
s are matched with
✏s or
✄s, nondeterminism helps
two branches, one for each possible guess
entire machine accepts
Pushdown Automata – p.21/25
The transition diagram is in Figure 3
✁ ✌ ✍ ✁ ✟ ✒ ✟ ✫ ✔ ✌ ✑ ✁ ✛ ✒ ✟ ✫ ✛ ✁ ✟ ✒ ✟ ✫ ✟ ✌ ✂ ✁ ✣ ✒ ✟ ✫ ✟ ✁ ✟ ✒ ✟ ✫ ✟ ✌ ✄ ✁ ☎ ✒ ✛ ✫ ✟ ✁ ✟ ✒ ✔ ✫ ✟ ✌ ✆ ✝ ✝ ✝ ✝ ✞ ✟ ✒ ✟ ✫ ✟ ✌ ✗ ✂ ✣ ✒ ✛ ✫ ✟ ✁ ✟ ✒ ✔ ✫ ✟ ✌ ✘ ✂ ☎ ✒ ✟ ✫ ✟Pushdown Automata – p.22/25
Pushdown Automata – p.23/25
1.
✁the input has been reached
read and what is popped off is the same symbol
the same and the stack empties as the same time as input is fi nished, accept; otherwise reject
Pushdown Automata – p.24/25