Pushdown Automata - PowerPoint PPT Presentation

About This Presentation
Title:

Pushdown Automata

Description:

Push: write a symbol on the top of the stack. Pop: delete a symbol from the top of the stack ... Every NFA can be understood as a PDA that never pushes or pops. ... – PowerPoint PPT presentation

Number of Views:113
Avg rating:3.0/5.0
Slides: 31
Provided by: giorgija
Category:
Tags: automata | of | pops | pushdown | the | top

less

Transcript and Presenter's Notes

Title: Pushdown Automata


1
Pushdown Automata
CSC 4170 Theory of Computation
Section 2.2
2
Components 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



3
How a PDA works
2.2.b1
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?

0 0 0 1 1 1
Stack
Input


4
How a PDA works
2.2.b2
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?

0 0 0 1 1 1

Stack
Input


5
How 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


6
How 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


7
How 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


8
How 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


9
How 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


10
How a PDA works
2.2.b8
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?

0 0 0 1 1 1

Stack
Input


11
How 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


12
How a PDA works
2.2.b10
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
What language does this automaton recognize?


13
How a PDA works
2.2.b11
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?

0 0 1
Stack
Input


14
How a PDA works
2.2.b12
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?

0 0 1

Stack
Input


15
How a PDA works
2.2.b13
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?

0
0 0 1
Stack
Input


16
How a PDA works
2.2.b14
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0 0

0 0 1
Stack
Input


17
How a PDA works
2.2.b15
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Reject
0

0 0 1
Stack
Input


18
How a PDA works
2.2.b16
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?


0 1 1
Stack
Input


19
How a PDA works
2.2.b17
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?


0 1 1
Stack
Input


20
How a PDA works
2.2.b18
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0

0 1 1
Stack
Input


21
How a PDA works
2.2.b19
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?


0 1 1
Stack
Input


22
How a PDA works
2.2.b20
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Reject


0 1 1
Stack
Input


23
How a PDA works
2.2.b21
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?


0 1 0
Stack
Input


24
How a PDA works
2.2.b22
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?


0 1 0
Stack
Input


25
How a PDA works
2.2.b23
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
0

0 1 0
Stack
Input


26
How a PDA works
2.2.b24
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?


0 1 0
Stack
Input


27
How a PDA works
2.2.b25
?,? ?
0,? ?0
q1
q2
1,0 ? ?
1,0 ? ?
q3
q4
?, ? ?
Reject


0 1 0
Stack
Input


28
Designing 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


29
Converting 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



30
Main 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.

Write a Comment
User Comments (0)
About PowerShow.com