2. DEFINATION
PDA is used to accept CFG language. PDA is an FA together with Stack. Stack have access to unlimited amount of memory.
3. Thetapeis divided into finitely many cells.
Each cell contains a symbol in an alphabet Σ.
δwhich definednext stateortransition.
A is the initial top symbol of stack which is
Finite.
Input Tape
Stack
Finite
Control
δ
P
State
a
l
p
h
b
t
e
A
Top symbol
Of Stack
a
4. PDA consisting of 7 tuples
1.Qis a finite set of state
2.Σ(Sigma)is a finite set of input alphabet
3.Γ(Gamma)is a finite set of stack alphabet
4.δ(Delta)is a transitionfunction
5.qₒis the start state
6.Ais the initial stack symbol
7.Fis the set of accepting states
5. TRANSITION AND OPERATION IN PDA
a , bc
Meaning that if we see an “a” in the input string and the stack contains the symbol “b” on top then we remove the “b” and add “c”.
q0
q1
a,bc
6. •1stOperation:
When we will on q0 state and read
“a” and “b” is the top symbol in
Stack then “b” will replace with “c”.
When “b” will be replaced with “c” then we will on state q1.
q0
q1
a,bc
a
b
h
e
&
input
top
Replace
h
e
&
c
stack
8. •3rdOperation:
When we will on q0 state and read
“a” and “b” is the top symbol in
stack then we will drop “b”.
When “b” will be dropped then we will on state q1.
q0
q1
a,bε
a
input
b
top
h
e
&
Pop
h
e
&
9. •4thOperation:
•When we will on q0 state and read
“a” and there is “ε(empty)” than
there will be no change in stack.
q0
q1
a,ε ε
a
input
b
top
h
e
&
b
h
e
&
No Change
10. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
• When PDA Accept:
• The computation path ends in the accept state.
• All the inputs is consumed.
Σ*=aaabbb
PDA for {a b : n 0} n n
11. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
&
Push Operation
12. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
&
a
Push Operation
13. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
&
a
a
Push Operation
14. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
Push Operation &
a
a
a
15. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
&
a
a
Pop Operation
16. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
&
a
Pop Operation
17. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
Pop Operation &
18. a a a b b b
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
Replace Operation
19. q2
q2
• 2nd Example:
a b
q0 q1 q2 q3
a a a a b b b b
a , Z aZ
Z
4 4
a , a aa
b , a ε
b , a ε
ε , Z Z
q1 aaaabbb
aZ aaaaZ
q1 aaaabbbb q2 aaaabbbb
aaaZ
q3 aaaabbbb
Z
20. • When PDA Reject:
• Either end in a non-accepting state.
• If there is no possible transition under the
current input and stack symbols.
q0 q1 q2 q3
ε, ε &
a, ε a
b, a ε
b, a ε
ε, & ε
a a b
PDA for{ a b : n 0} n n
Σ*=aab
21. q0
q1
q2
q3
ε,ε&
a,εa
b,aε
b,aε
ε,& ε
&
Push Operation
a
a
b
22. q0
q1
q2
q3
ε,ε&
a,εa
b,aε
b,aε
ε,& ε
&
Push Operation
a
a
b
a
23. q0
q1
q2
q3
ε,ε&
a,εa
b,aε
b,aε
ε,& ε
&
Push Operation
a
a
b
a
a
24. q0
q1
q2
q3
ε,ε&
a,εa
b,aε
b,aε
ε,& ε
&
a
a
b
a
Σ*=aab is rejected because there is no more possible transition. (no more input alphabet)