0% found this document useful (0 votes)
78 views

TOC M2 Handwritten

The document discusses pushdown automata, which extend finite automata with a stack. A pushdown automaton has finite states like a finite automaton but can also access a stack to store information. It can push symbols onto the stack, pop symbols from the top of the stack, or replace the symbol at the top of the stack, allowing it to recognize context-free languages. An example pushdown automaton is given that recognizes the language of palindromic strings over {0,1}.

Uploaded by

Fullmetal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

TOC M2 Handwritten

The document discusses pushdown automata, which extend finite automata with a stack. A pushdown automaton has finite states like a finite automaton but can also access a stack to store information. It can push symbols onto the stack, pop symbols from the top of the stack, or replace the symbol at the top of the stack, allowing it to recognize context-free languages. An example pushdown automaton is given that recognizes the language of palindromic strings over {0,1}.

Uploaded by

Fullmetal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Scanned with ACE Scanner

Scanned with ACE Scanner


Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
Scanned with ACE Scanner
UNIT-5
PuSHDowN AUTOMATA

Automata is an extension e the nondateministie


L Pushdown
tanuitions, whiih s
E-
the
finitt auto maton oith
to defe the sugular lanquaqusan ¬-NEA
nith the
Pashdovon automaton ü
i mnlialy uad, pushud and
be
stack. Thu Stack can
addition
top.
poppud onhy at the allous pushdownautomata
to emumboe

pruene o stack can only ae


acces
The
amount of injotmalion. Pushdownautom ata
,last onywoy
Atack in a tiut -in-fost-out
inkotmal'on on ike thu Contixt fee
the gucogniy
all and only
* Pesh doon automala
Janguag
Finte
state
Injput Control

Stack fig: Pachdonon Automala


tim.
Symbol at a
Finita- state Control uade inputs ik cu¯ånt state,
A band en
PDA the Stack.
The at th
and the symbo sansition,uing
the input Symba
also mah Spontanou
instead ok
the
inpaksymlol.
pehdown automaton?
an

as ih inpul
tantion s in h
In ene
synmbol that it
thu inpat
) Consume
nd tot the input, t
input
¬
taniilon.
Sifmbol is Consu med.
Gocs to a state shich may cë moy notb bame
,oich sar shue
9

psuviou Aali
9 Replacs the
Symbol at he top c the stack
by ng sting
The Staing Could
Cou b0 .¬, which
which Cotrusponds to a pop the
Stack.
Pt Could bu the Aame ymbol that apþaad at dhe Zop
made.
stack paovioul change to the stack is

Could also eplace the dop stack bymbol by one othu


bym bol, otith in 4teet changs the dop ot the stack but
push o pop it
dees not push
Top Atack Symbol Coutd be uplaced by Juoo
ohich hat the eect o changing the tot stack
Symbols , onto
Symbol, and thun puting symbole
the stoack
The Foe mal Pushconon Automata i
Pushdoon Automaten (P iNolves
Formal notation tet
Seven Components Spuciged
X,6 S, Vo, Zo, F
P= (@, ~,
nohee, bbales
: bet
inbut symbols.
X :A finit sat
alphabet
r: Ainit stack
3)
6: The tuansiion functon.
amqumente a tiple sq, a, x)
State en
noh, I.
Q a is ithe an
anput Symbol ot a- ¬, te

3. X ig stack Syrmbol, i.e,


i.e, a menbea os F.
The output o S ie a tinile st a pais (p,?)
whuu, P is the nen SBale, and is the

Atock Symb that uploaes X at the tof o the stack.


: Staxt State The PDA is in thia Atate dyoe mabing
ant branßitiny
the Stack.
Z : The stat symbol.
F: The set & accepling states ok final States
Notation yot PDA';.
A
PDA' Consist: o ttte
PDas
tot
The tansition diagtam
folleningnede cothspond to th staes o the PDA.
a) The the staat state,
onsabled Staat indcales
5) An at accepting stalis
cçded statu
and donbty ko tanations e PDA:
c) Thu ancs Coospond to Stale P neans
An asc dabeled. as Xa ttom
tontaina the pain (p, ~).
that SCa,, a, x)
Stast
a, x«
Example.
PDA lo acept te Langungt
wis in (0+ ie String s

Solution;
The Gonsists o paltndromus even
lanqug
ovee the albhabe o,t
An inpot mo! pushdown automaa acepling
hove mol
deatgnad pruuns a qum
a that e

a , we
lal ,
) Stat stala upnenls hile in state Vo
-the AEing .
en the end G!
stote then
On the Atack , by puching
Btack

uad symbels and On lo tha Stack,


in tuan.

Rach nput Symbal onto that e have


the
cofy Aues hat
sepaunts a Stack, asitt te
) State 9, the
u
en
sloed the bottom.
middle and 'w' at
and lyt end
Compae inbut Aymlbolsmatch,We
in tala' g. e dhy
3)) Once the Stack. thy
bymbol at the top and paocud.
pgf
P the Atack
inputAybot'Aave
have quend wtong
eonsume
mateh, se dies, attkongh
do not
woe. Thie baanch automalon mays
kmintste
not felloned by th nonduteinistc

othea
Jotanches
Luad to aceptance
and eventualit has w. folloned
btack then nput
enfly the translion to Stal c
aept
the inþut by making
by w So
Let o mark the botom o the stack .
PbA LR Can be dectbed a:
Ihe

P-(1%.,3,.%, i. los3o.,ze3, 5,,,o4$,)


the

y thu Trþ
I. S(9,,0, z.) (%,0z)} 9 Staut State 4, and
the stack is Zos push input
on to the Stack.

S(%,0,o) \%,00) In state . push all The neade


inpui en dhe lop the Stack

an go hom stale 4,
oto 4,G,
One
Lan
3. S(3%,,6, 2,) - {(9,,z)} ópontanonsly on e input
S(3,.6,0) ={,,)} input" Jaauing tap
sc4,,e, i) = {c4,,0} J &rack
nput matches
S(%,,0, o)= (9,,¬)} In stat ,, pop
nseth top the stack, then
s(%,,1, ) 2fc,e)t te o the btackConsumed in stati
.

ic
Ko)t injut
altthun
5. S(9,, 6, Ko) {(g, make tanston

'o,tl
the
inpuat
ofoo

Skast
(o
E,olo
taom
the
The
Fis

Înstantanu ow Desuiptions a PDA i* an

The PDA is uunnled by


3-tuple (a, w, 1)
whuu:
is the stat
) w is the aumaining ionut
is the Stack Contents

Such 3- tuple u caled an Lastantanuou Desctptons


TD the PDA .

anstyle
Zo'A that many movs of a PDA
upent one ot many
G PDA.
Not - ii wd to upnent uo ot
Erample ;
PDA
LoNe
loncider the
hown blow
The ID'% PDA on input

II, Iz,) ( , ,Z,) ’ (a, u1, z¢)


Ca,,1,I)’(.,0,2o)
(%, l, lIZ.)

(9,,1,12z)

(9%, ¬, 0llz,) (4,,1, 1Zo) Cis, 1Zo)

(9,e, tik) (%,¬,2.)


Faom te ina ID, thue are oo choius ot move.
The Finst hat thu middl hay no bun en
bun
and deads o ID (9 l, 1Zo). In efec,to Itu
ha
(0 the Stack.
sumoved tom the input and pushud
on

inttal ID geses that


* The Second choiu torn the the
kot thout Gonsurñing
thu middu has bun uachd.. to D (,,l1, Zo)
the PDA 6 stale ., leading stat 9, and
may acept
Sinee the PDA may
it å is
stack, the PDA goes om tihe
ih
That D a not exac tly
eracty the 'tu aceftng
CVa, ul,zo)
fo C%
to Consumed .
nput has mot bun compatey the middle
She thu that it has en
alo gus that it
The PDA may
ohn it iu in ID
yt hading I, that iu
deade to ailere, Stne the
guus aho
C%, l,I,X). That
Connot be Consumed.
enlu inbut the middl iu Aeached ate
The Cosact quet, that ID

FG,,,I) -C,e, L) ,, e, zo
y)
Problems .
) Subpote the POA P=9,4.to,i, ,z}. 8.9:,z, P)
has the tranitlon funelions
1. S(9.0,)= {4,xx)}
e &(%,0, x)= (9,xx)
9) S(9,1, r) -{(4,0
4) s(9,¬, x) (p,e}
s) S(P,6, x)= (p.e}
) S(p, 1, x)= (p, x*)
) S(p.1,)=¢,e)}
dtasling tom inital ID (.w, z) Shous all the suachale
TD' When the
a) o
intut c) Dl0

Sol.

: (4,o1,z) 4,l, xz)


E (o,¬, z)

5) 0011

(9, 001l, z) F(9, ol, Xz)

F (4, e, XX
xx*)
- (P, e, XZ)
- (P, ¬,z)

) old
(9,o10,) H(, io, xz)
+ (9,0, Xz)
)

E(4, 6, XX*)
E (P, ¬, xx)
F (p6,Z)
) has

=%,,¬)}
S(%,,o,y)
Jlo,¬, ) = (4,,xz}
S(9,,0,*) ={(9,,v*)} , )}
S(,,¬,z)=
S(%,,0,Y) ={(%,Y)} S95,¬, z)-{,
)
S(9,,4, )-{4,)Y

an evulon a c
iS un LP).
hat string
(Bo.o110, z)H4,,olo, xz)
- (a..O , YXz)
yrz)
(a Yrz)
¬ , XZ)

)
Eo,.¬, z)
OO thL au tomalon
Concuntng iput stsing
which is the Atat fot
tuaches
state q. wh
PDA. Hence ,
is in L().
) 001 00

(o, 00100, z) -(4., 00100, Xz)


E(4.0100, YXZ)
F(4,, l00, YYXz)
F(9,,00, YYx*)
F4,,0, YXZ)
¬,Xz)

3) 0btain a PDA o acept the


a fonal tati
Solution ?.
) olo. a, Zo)= (%.aKo)
S(o, b, zo)=(.bz) Len) flw Cu
ww
) S(,,a, a) =(,aa)
Vo
.6(%,. 6, a) = (%,ba)
S(%, a, b) = (9%,ab)
6(9..6,6) =(%,b 6)
3) S(%%,e, xo) (, Zo)
&
(R.c, a) =(9,, a)
S(9, c, b) = (4,,b)
4) S(,,a, 4)= (4,,e)
S(9,,6, 6)=(91,e)
S(4,,¬, z)= (%4,z)
4,b/ak
4.afaa
b,alba
bzelbze a,a<e
a,z<aFo

c, ala

4) btain a to acept
PDA
Atat.
by a fenal (, aaabbb,z ,
Voy
aaki,az)
Sel: abbb, aaz
D 6%, a, z) =(%, a)
F(4%,b56, aaaz
S(40.a, d) =(o, iaa)
F4,,bb, aaZ)
9 S(, b, a) = (9,,e) ,,b,a z.)
S(9,, 6,a) = ,,e)
F{9,,¬,3)
) s(,,¬, K) =4,zo) F(4,¬,Zo)
y4,a<e
Sast

b,a<e

an nondetemintste PDA fet the langng ag bbbb

Sol

) S(9, a,z)= (%,, aaz)


S(%,a, a) =(4%, aaa)
aolazo Staut
biz\bzo
aible
b,ale
a,a<aa
b,6[b8
(4,¬) =a)S(4.,b,
(.,6) 49) =S(%,
(Y,bb) b)= b,(a, S
ao) (o, S(%,
=a) Q, )
bo) =(%o, SC%;b,
Zo)
enbaf eaual haing Atrings aept Should PDA
Sol":
abb. Sistng the duaipion
to tnsantaruos th 9stt
nalw)=alw)B and (a+by* wlwe
Jangog fol onang DestgnL=
he
acup's that PDA a
b,a<e
Start
,alaca
b,ale a,zelaazo a,a
(n,¬) =a)S(4,b,, 3)
(9,,¬) b,a=) S(%, )
(3)
mctantanous duuiplion lor the string aababb
(4. aobabb, z) (9, ababb, az,)
(, babb, aaz,)
F (4., abb, az)
bb, aa zo)
- (o, b, a z)
(%,¬,Ko)

) Deign
PDA e the glloning longg
*, nalw) nslw)}
Lwe(a+b)
)
Sol. in ohich numb of
PDA Shoutd
than nwmbu o
a's shoutd he

) ol4t, a, Ko) = (4%, ax)


S 9,.a, a) = (%,aa)
8(9,,b, zo)= (%, bz)
6(9o,b, b) =(%, b6)
bale
S(o,a, b) - (%,¬) ab
, le
b,blbb
S9%, b, a) =(%, ¬) a,
a laa
b,o|bzo
2) S(%,,¬, a) = (,a) a,zo<ako

Stast
Vo,
¬,a fa
in which mumbet
PDA Should acept th lsings
Ihoudd be qaualbe than numbu t
) S.a, zo) =(o, azo)
S(Ao, a, a) =(o, aa)
s(%%, b, zo)==(%,bzo)
S(9%, b, b) =(%, bb)
&(4,, a, 6) =(%4,¬)
S(4., b, a) = (V%,¬)
,e, =(4,,a)
b,ale
a ble
,
bblbb
a,alaa
b,Zo<bzo
)aizoazo
Stut

) Design a PDA to acept te arnguage


te movey mad
ad by
L=o o
00100.
the PDA yo Stuing
Sol o'A at the
The PDA has to acept staing hoing
Lett end o m num e '

s(%%,0, o) =(o,00)
by
Stack. enbly Aeeptane i.e
input thelonsume *
stack zkempt imhame hu atand Aece_tance ie
inal
ate At by
enlaing the
and inut consuming By*
hut.. aueptig
accepliág an
by
vooyt au Thwe
aepls PDA which
a Language
aq he
poA:
PDA:;
zo) 94,¬,
F(9%,0,0%4)
(4,00
Zo 00,
00z) 100, (9o,
Zo)(o,
0100, oo100,
I,olo
Qole G,ojo Staut
o,olo0
zo) (%, z)= S(4,¬, 5)
(9,,¬) S(4,0,
=o)
(e.¬) =0)8(,,0, )
0)
(4, S(%,¬,
=o) )
o)
(9,, =o)
S(4,1,
(9,,0) 4,D=) S(.,
(5)
Aeuptoue by Firal stole
Let P-( a, z, r, 6, t,. , F) bz a PoA Tun
sa Janage aapled by P by tinad Atal iu
Aomu stati 9 in F
ard ary Atack stsirg a.
That is, Stasling in the nitial ID sik w
ta inþut, P onums w asd estes am
Stat.

knovs that 9, ¬ F
Hene, Le is acepted by PDA
Aeugfance by Enpiy Stack-t
be), the
=(a,E, , S, 4, Z, F) i a PDA, Ihen
P by empty Atach ia,
{wlc,9, zo) 9,6, e)} or any q.
w that P Can

Consume and at the bame time emply ii Btach.

Heve

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy