Title: Pushdown Automata PDAs
1Pushdown AutomataPDAs
2Pushdown Automaton -- PDA
Input String
Stack
States
3Initial Stack Symbol
Stack
Stack
stack head
top
bottom
special symbol
4The States
Pop symbol
Input symbol
Push symbol
5input
stack
top
Replace
6input
stack
top
Push
7input
stack
top
Pop
8input
stack
top
No Change
9A Possible Transition
input
stack
empty
Pop
top
10A Bad Transition
input
Empty stack
HALT
The automaton Halts in state and Rejects the
input string
11A Bad Transition
input
Empty stack
HALT
The automaton Halts in state and Rejects the
input string
12No transition is allowed to be followed when the
stack is empty
Empty stack
13A Good Transition
input
stack
Pop
top
14Non-Determinism
These are allowed transitions in a
Non-deterministic PDA (NPDA)
15NPDA Non-Deterministic PDA
Example
16Execution Example
Time 0
Input
Stack
current state
17Time 1
Input
Stack
18Time 2
Input
Stack
19Time 3
Input
Stack
20Time 4
Input
Stack
21Time 5
Input
Stack
22Time 6
Input
Stack
23Time 7
Input
Stack
24Time 8
Input
Stack
accept
25A string is accepted if there is a computation
such that
All the input is consumed
AND The last state is a final state
At the end of the computation, we do not care
about the stack contents
26The input string is accepted by the NPDA
27In general,
is the language accepted by the NPDA
28NPDA -- Another example
NPDA
29Execution Example
Time 0
Input
Stack
30Time 1
Input
Stack
31Time 2
Input
Stack
32Time 3
Input
Guess the middle of string
Stack
33Time 4
Input
Stack
34Time 5
Input
Stack
35Time 6
Input
Stack
accept
36Rejection Example
Time 0
Input
Stack
37Time 1
Input
Stack
38Time 2
Input
Stack
39Time 3
Input
Guess the middle of string
Stack
40Time 4
Input
Stack
41Time 5
There is no possible transition.
Input
Input is not consumed
Stack
42Another computation on the same string
Input
Time 0
Stack
43Time 1
Input
Stack
44Time 2
Input
Stack
45Time 3
Input
Stack
46Time 4
Input
Stack
47Time 5
Input
No final state is reached
Stack
48There is no computation that accepts string
49A string is rejected if there is no computation
such that
All the input is consumed
AND The last state is a final state
At the end of the computation, we do not care
about the stack contents
50In other words, a string is rejected if in every
computation with this string
The input cannot be consumed OR The input is
consumed and the last state is not a final
state OR The stack head moves below the bottom of
the stack
51NPDA Another Example
52Pushing Strings
Pop symbol
Input symbol
Push string
53Example
input
pushed string
stack
top
Push
54Another NPDA example
NPDA
55Execution Example
Time 0
Input
Stack
current state
56Time 1
Input
Stack
57Time 3
Input
Stack
58Time 4
Input
Stack
59Time 5
Input
Stack
60Time 6
Input
Stack
61Time 7
Input
Stack
62Time 8
Input
Stack
accept
63Formalities for NPDAs
64Transition function
65Transition function
66Formal Definition
Non-Deterministic Pushdown Automaton
NPDA
Final states
States
Input alphabet
Stack end symbol
Transition function
Initial state
Stack alphabet
67Instantaneous Description (ID)
Current state
Current stack contents
Remaining unread input
68Example
Instantaneous Description (ID)
Input
Time 4
Stack
69Example
Instantaneous Description (ID)
Input
Time 5
Stack
70We write
Time 4
Time 5
71A computation
72For convenience we write
73Formal Definition
Language of NPDA
Initial ID
Final ID
74Example
NPDA
75NPDA
76Therefore
NPDA