Title: Pushdown Automata PDAs
1Pushdown AutomataPDAs
2Pushdown Automaton -- PDA
Input String
Stack
States
3Initial Stack Symbol
Stack
Stack
stack head
top
bottom
special symbol
Appears at time 0
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
9Empty Stack
input
stack
empty
Pop
top
The automaton HALTS No possible
transition after
10A Possible Transition
input
stack
Pop
top
11Non-Determinism
PDAs are non-deterministic
Allowed non-deterministic transitions
12Example PDA
PDA
13Basic Idea
2. Match the bs on input with as on stack
3. Match found
14Execution Example
Time 0
Input
Stack
current state
15Time 1
Input
Stack
16Time 2
Input
Stack
17Time 3
Input
Stack
18Time 4
Input
Stack
19Time 5
Input
Stack
20Time 6
Input
Stack
21Time 7
Input
Stack
22Time 8
Input
Stack
accept
23A string is accepted if there is a computation
such that
All the input is consumed
AND The last state is an accepting state
At the end of the computation, we do not care
about the stack contents (the stack can be empty
at the last state)
24The input string is accepted by the PDA
25In general,
is the language accepted by the PDA
26Rejection Example
Time 0
Input
Stack
current state
27Rejection Example
Time 1
Input
Stack
current state
28Rejection Example
Time 2
Input
Stack
current state
29Rejection Example
Time 3
Input
Stack
current state
30Rejection Example
Time 4
Input
Stack
current state
31Rejection Example
Time 4
Input
Stack
reject
current state
32The input string is rejected by the PDA
33A string is rejected if there is no computation
such that
All the input is consumed
AND The last state is an accept state
At the end of the computation, we do not care
about the stack contents
34Another PDA example
PDA
35Basic Idea
3. Match on input with v on stack
2. Guess middle of input
4. Match found
36Execution 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
Input
Stack
42Time 6
Input
Stack
accept
43Rejection Example
Time 0
Input
Stack
44Time 1
Input
Stack
45Time 2
Input
Stack
46Time 3
Input
Guess the middle of string
Stack
47Time 4
Input
Stack
48Time 5
There is no possible transition.
Input
Input is not consumed
Stack
49Another computation on same string
Input
Time 0
Stack
50Time 1
Input
Stack
51Time 2
Input
Stack
52Time 3
Input
Stack
53Time 4
Input
Stack
54Time 5
Input
No final state is reached
Stack
55There is no computation that accepts string
56Another PDA example
PDA
57Execution Example
Time 0
Input
Stack
58Time 1
Input
Stack
59Time 2
Input
Stack
60Time 3
Input
Stack
accept
61Rejection example
Time 0
Input
Stack
62Time 1
Input
Stack
63Time 2
Input
Stack
64Time 3
Input
Stack
65Time 4
Input
Stack
Halt and Reject
66Pushing Strings
Pop symbol
Input symbol
Push string
67Example
input
pushed string
stack
top
Push
68Another PDA example
PDA
69Execution Example
Time 0
Input
Stack
current state
70Time 1
Input
Stack
71Time 3
Input
Stack
72Time 4
Input
Stack
73Time 5
Input
Stack
74Time 6
Input
Stack
75Time 7
Input
Stack
76Time 8
Input
Stack
accept
77Formalities for PDAs
78Transition function
79Transition function
80Formal Definition
Pushdown Automaton (PDA)
Final states
States
Input alphabet
Stack start symbol
Transition function
Initial state
Stack alphabet
81Instantaneous Description
Current state
Current stack contents
Remaining input
82Example
Instantaneous Description
Input
Time 4
Stack
83Example
Instantaneous Description
Input
Time 5
Stack
84We write
Time 4
Time 5
85A computation
86For convenience we write
87Formal Definition
Language of PDA
Initial state
Final state
88Example
PDA
89PDA
90Therefore
PDA