Theory of Computation
Theory of Computation
Computation
Construct Transition table for PDA that
accepts the language a2nbn|n≥1.
Trace PDA for n=3.
L=a2nbn
Finite
controls
Accept / Reject
i/p tape
Stack
Logic: Z0
The Language is as that no.of as’
is twice the no.of bs’.
We push any stack symbol (say Z)
for a pair of as’ and for each b
we pop the symbol (Z) from the
stack
• State = q0 aab
• Stack = Z
Z0
• State = q1
• Stack =
Z
Z0
3’ 3
When the pointer
reads a and is in q1 state and
aab
top symbol of stack is Z it
neither pushes nor pops but
When the
bounces back to q 0 pointer reads b and is in q1
• State = q0 and top symbol of stack is Z it
pops Z on to the stack and
• Stack = moves to q2
Z0
• State = q2
• Stack =
When the pointer
reads b and is in q2 state and
4’ top symbol of stack is Z it
neither pushes nor pops but
4 aabε
stays at q2
• State = q2
• Stack = When the
Z0 pointer reads ε and is in q2
and top symbol of stack is Z0 it
neither pops nor pushes but
moves on to q3 (Final State)
• State = q3
Reaching the final
state implies that the string • Stack =
is valid and is a part of this Z0
Language
L=a2nbn
Transition Fn (δ)
(q0,a,Z0) = (q0,ZZ0)
(q0,a,Z) = (q1,Z)
(q1,a,Z) = (q0,Z)
(q1,b,Z) = (q2,ε)
(q2,b,Z) = (q2,ε)
(q3,Z0)
acceptance through
Final state
(q2,ε,Z0) =
(q2,ε)
acceptance through
emptying Stack
Tracing PDA translations for n = 3
(q0,a,Z0) = (q0,ZZ0)
(q0,aaaaaa,Z) = (q1,ZZZZ0)