Formal definition of PDAs

advertisement
Announcements
Formal definition of PDAs
Turn in your H/W #5
Pick up a copy of H/W #6
Atri Rudra
May 12
A. Rudra, CSE322
A request
Puzzle for the day
If you do not understand something in class,
ASK a question
Even if it is a doubt in the slides
Where I am thinking of going a bit fast
A. Rudra, CSE322
3
Last Lecture
Design a PDA for the following language
{ xy | x,y∈ {0,1}* and |x|=|y| but x≠ y }
A. Rudra, CSE322
PDA = DFA + stack
4
1101 # 1011
How does 1101 look when it is pushed onto a
stack ?
It looks the same as the
stuff after the #
Just “match” off the rest
Let’s recap by another example
{ w # wR | w∈ {0,1}* }
A. Rudra, CSE322
Let’s look at a string in the language
Designed a few Push Down Automatons
2
5
A. Rudra, CSE322
1
0
1
1
6
1
Questions ?
{ w # wR | w∈ {0,1}* }
ε,ε → $
A
B
0,ε → 0
1,ε → 1
C
1,1 → ε
0,0 → ε
#,ε → ε
D
ε,$ →ε
A. Rudra, CSE322
7
Formal definition of a PDA
ε,ε → $
Symbols that can be pushed and popped
δ : Q×Σ U{ε}×Γ U {ε}→ 2Q× Γ U {ε}
Transition function
s∈ Q : start state
F⊆ Q : final states
A. Rudra, CSE322
Use non-determinism more critically
{ wwR | w∈ {0,1}* }
A. Rudra, CSE322
A
B
Q = {A,B,C,D}
Σ= {0,1,#}
#,ε → ε
Γ= {0,1,$,#}
D
C
ε,$ →ε
s=A
F={D}
The transition from C to D
9
Up next…
8
Using the previous example
PDA M = Q,Σ,Γ,δ,s,F
Q : set of states
Σ : input alphabet
Γ : stack alphabet
A. Rudra, CSE322
0,ε → 0
1,ε → 1
1,1 → ε
0,0 → ε
(D,ε) ∈ δ(C,ε,$)
A. Rudra, CSE322
10
In other words…
11
A. Rudra, CSE322
12
2
Download