Title: Pushdown Automata
1Pushdown Automata
CSC 4170 Theory of Computation
Section 2.2
2Components of a pushdown automaton (PDA)
2.2.a
a a b a c
Stack
Input
x y x z . . .
Push write a symbol on the top of the stack Pop
delete a symbol from the top of the stack
a,x?y
(Q,?,?,?,s,F)
q1
q2
If the input symbol is a and the top stack symbol
is x, go from q1 to q2, pop x and push y
Q is the set of states ? is the input alphabet ?
is the stack alphabet ? is the transition
function s is the start state F?Q is the set of
accept states
If a?, the read head is not advanced If x?,
nothing is popped If y?, nothing is pushed
3How a PDA works
2.2.b1
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0 0 1 1 1
Stack
Input
4How a PDA works
2.2.b2
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0 0 1 1 1
Stack
Input
5How a PDA works
2.2.b3
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0
0 0 0 1 1 1
Stack
Input
6How a PDA works
2.2.b4
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0
0 0 0 1 1 1
Stack
Input
7How a PDA works
2.2.b5
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0 0
0 0 0 1 1 1
Stack
Input
8How a PDA works
2.2.b6
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0
0 0 0 1 1 1
Stack
Input
9How a PDA works
2.2.b7
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0
0 0 0 1 1 1
Stack
Input
10How a PDA works
2.2.b8
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0 0 1 1 1
Stack
Input
11How a PDA works
2.2.b9
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Accept
0 0 0 1 1 1
Stack
Input
12How a PDA works
2.2.b10
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
What language does this automaton recognize?
13How a PDA works
2.2.b11
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0 1
Stack
Input
14How a PDA works
2.2.b12
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0 1
Stack
Input
15How a PDA works
2.2.b13
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0
0 0 1
Stack
Input
16How a PDA works
2.2.b14
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0
0 0 1
Stack
Input
17How a PDA works
2.2.b15
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Reject
0
0 0 1
Stack
Input
18How a PDA works
2.2.b16
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 1 1
Stack
Input
19How a PDA works
2.2.b17
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 1 1
Stack
Input
20How a PDA works
2.2.b18
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0
0 1 1
Stack
Input
21How a PDA works
2.2.b19
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 1 1
Stack
Input
22How a PDA works
2.2.b20
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Reject
0 1 1
Stack
Input
23How a PDA works
2.2.b21
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 1 0
Stack
Input
24How a PDA works
2.2.b22
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 1 0
Stack
Input
25How a PDA works
2.2.b23
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0
0 1 0
Stack
Input
26How a PDA works
2.2.b24
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 1 0
Stack
Input
27How a PDA works
2.2.b25
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Reject
0 1 0
Stack
Input
28Designing pushdown automata
2.2.c
Design a pushdown automaton that recognizes the
language w w has an equal
number of 0s and 1s
0
s
1
29Converting NFA into PDA
2.2.d
Every NFA can be understood as a PDA that never
pushes or pops.
Just replace every label a of the NFA by a,???
1
1
b
b,???
?
a
a,???
?,???
a
a,???
a b
a,??? b,???
2
3
2
3
30Main theorems
2.2.e
Theorem 2.20 A language is context-free iff
some pushdown automaton recognizes it.
Theorem Not every nondeterministic PDA has
an equivalent deterministic PDA.
Example 2.18 There is a nondeterministic PDA
recognizing wwR
w?0,1 (wR means w reversed), but no
deterministic PDA can recognize this language.
Proofs omitted.