theory of computation notes
theory of computation notes
o, kyle ny
w= a" bi"
~Corser Ixyl Sn Cental ondy @
M i>0o xy! @b
ES
xyz = xyz
Pome
w=a'b 5 panel
Dra Ae Reguty Sxprewtens:
0 Suan M= (8,2, 5, %, F)
whee = (444 » 40> 9, oe
OL ©
Solu: RE
a my = OD Cre il) © Cu De "
x, K tee | Ro
‘
"Py Wwe KOH my?
ietaiey | GE
| Geame*are HS)
,
| Ge) (CHE) Corey FH E EAR RE gM
3 Ss = ere
-
| oS Ries: g*
= oe / (Rrey ast
_ Ree
Ga lard | WOW) #2) uA 4
fet ge @tb yet
|
Fag | Mr? Cu MU BD
ae | gE) P(E TG=F FY PRERG= g
a | © | yan *@id) UGS
to. \z2) - , =
gee) * Cath) +E ed; ri me Ty}
Find ‘state qa & Kar
Go the Sem Re |
Me = Via! CPs)! U Ga)
= C¥ GB) = py phone
aedy ya ae Se
jue i dpi £8
Wt 1% 1TUN IE~ Cola Free Cranmer G
)
= Islay
Defiteion: Gpam
A contert fre oo ;
@qy= Cust PS? Valea
tat of Alprabet- / set of Alon Tearirae
johwte) Vis
symbols Coney Capita? Rebbe)
Ta» Tern Symbols Comma alphabets y
p> Production or Rule
s> stat Syrbae. a
Ltay rs -ime Lonquage Gyenerdtal by 120 ot
Gi {we 2, er
Valence
StS definet os. stormy: Rat x zane
forward and backward -
The language
| Gr @sbe pat
Sépae SaS/ bsb | are tame
2. for any
Sy Ne clher: aie Fe
bet Ge Cf54 aby 5) pate production “pz Csasa.
1 S>bsb
Oo
find te laruage genentteed by panera 9 ©?
_Sw;, = SS ase ,
s—> bsb
3g
S—> asa
iS asa
> ACasada
> aG@eaa:sse
—aond» ° 06Sasa
-> altsb)a = Ss bsb
—> a(bCbs bas > bsb
deaf ype Bae sre
a y : '
( \
rhe language | Generated | iby, “ven Gi vamaner
s ww eT
th gd dey
® s+ ose iis 222
Ss) . gate
i ft: pri! hes
S> Sos! ' |
Es aU
‘
Sot soso
> oCoso)o : S050
care OC0e0)0 ps sree. Py fh
| > 0000 ( SbMlbasd = Attrs, = Abe
3 peur ny
Sis! i
>1sii: Sst re
> LC) bid Set segs ez pU
> im eof Sty Bersted A ah
SE 18) i Lik pepe a
; > 101 “ S>O
v
S—> 0so en { po if
> Oo ; 8-1 :
S060
> 060 :SSE
=> @
mal3) find LCG) definel by Grammer Gr= CVT 55, p)
Obtain
Solus
who p= Cosofisi |r
A> 1lole
Gounver L&@)= [a%b"/menj
S— astsa
Awe ah fal
8> ash
> aCash)a 2 sash
— aGAbya a SSA
> aa Abb
ao aoa 372
SA,
As aAb :
> alaAb)b : A> aAb
> aCaab)b: A >a
> OD 4 32
> aCabb)b: A>b
> ab 7 273 jhUY Dovictrorag “Te [Parse “he pa
> Tw preted 14 action of derivation
Th othr words , tha steP ave desivation
Can be wepresnted by he Atbrucle ©
Knows aS parse -pee
Can be Constouctal, a8 ‘otuby > Ulee
Ke
) : 7
Lah» voladn B vale!
Wes
1) Every vesler has
ermina® Syntee
ny
2) The ool Gk TS aways shat est
Mito
3) The Herel: Inleior Vester 15,,, fandled by
Variabls - ey 7
D Consider a Grammer o =f 984 Jha bY Psy
Dee isk of, i digits at
Ss an /b8
A> ab
B-> aBb/a&
Rosse Free :a Gi= Cis AB» {a5b4, Ps)
hw PB S> AAS /q
Parse tree A> sbA/ss /bq
o ef ~©
O4 @ =
2 \ &
6 &
o's
Relahership between Reza,
on Te aud
a eet Deviation
“Theovem »
het-cie CviT a PaS) rp, sé xe
& .
TA -thow ts devivttrone?, tre qu Grammer 6
hohrch yields &.
Prof: rastead of Proving there ext deyradroral Tree
br ae shang & . That 6 devted from's’s Wwe
Sha® prove fer any 4, Ae.
We can prove thas ky matiiemactra® tnducton
on number of itlevior ‘vertex
Bass step: fo one rehor verter
HY thee 13 onty one rnkrior verter the
Sree ill be as -FohAwS- + tone production 1
eh AX Xe: kn 2Yidld
OOTY ~~ Sienna < WeiXe iceae >
Hypothests :
Te pwre tra the rewa w fous for a re
with no. of rntevior vertces i
leh us assume “tat Ck>0
X ws The yield | OF an, Ai—TRee wrth i tte
Vertes whee KSI, “Hon $84 wot coud be sers of.”
a
le laek of son be %%o"- XM on oda ©
ton Ads xy xy B peoducton ti’ P”
SPT on we noble leah then x5, Bill be varie
and jt wsill be oot of autbtvee-
CEP nth Ae 4s fax, Hen Ba stng.
AT =0G
means Xf => Kis Nim
Ate Hos = whe - -
Ths As xual -
a we | on! LS . ey
> Moe - > Xn Hi Gils. -. din 1
r@ sely) BEIT AIEEE AB py fata
det AR Sx, we “ust "show! that “Hees
. a
a A ree pith | “yea & ; ,
yo ShaoSuppre Hat A devs
ten a may be ecther
epi Viggo nen 8G" ip
B Mao then yj ws variable
I
x with Sewer no of types
ita ~~ on
“IP xp vonithte, deviation! oF: ar) take Fewerksteps 1
Sip, i worite deivation KStEPS thus ft ead,
a with’ n Keanes xuch' as Xr- -
> Rabe 7 mhoe nD
bi
a Po
bs yield the tree of x
wn each
vevtey
| pot demirnee< + eae ny Mgrs ES 1
A Grater = and, to be’ |, ambrgans,,F 4 hes
More tran ene, deviation? shee fora: Zenkne ,,
mM stows Wott ha mre than one
RFt mest or sight most ee
lest. desivation: Aidatkreh ‘olhoas 45
Kebiomit ‘desvathond HP ab each Alepyin
dematon tte Keflmnat variable 6 creploced by tts
Ppreduon:
vt
B: S-> ahs/a
fr -sab
Sh,
S—aAs
I> Qabs '.° A-sab
G>dqabA ~~ ssa
Right Deaualton: A desivahon sad t be
Raghhmost devivation 7 af each sept
deyuaion , the viglttmest \aviake ty replaced ty
Production .
Ex: S$ > ahs/a
A> ob
Set SR OAs
so eke °! fevab
aaba™ « - sm
SSSolr) Spas
goOkA ~ Soa
apaaba, 34 edb
Be: tet Gletfe cre
S+> aB/bsA
A -> a/as / bAa
Bs b/ bs/ape
Fer the shing daabbabba Find
gy leFmest+ deviate
Bi fegi eg carah on
° pane Tree
din
a) S> a8
> aas 8 JB ae
-> dadR8B °-- Babs
-B> bs
> aaadbsbB
daa bbABB -. s =bA
Ara
ae 1
> AdabbasBB \.
‘ 3
> aanbbabhBs .. pbs
‘SaaabbabbbA _. s-sba
se aaabbatbba, Psa”b Ss aybe
S>aB
SS daBB
> Ss» AaB bs a
Seda bbw
+> aoBbba
> 0aaBB bba
> AaaBbs boa
> aaaBbagbba \!
> aabbabbba
uv Nukable — Lactate
A ruetabee ama be teh ya
G= Cv 2, cE Be
| Any varrange,
A ><
J. Be bs gan 9
“py Arma 4
I
ee
'
~. Babe
- S>bA
yan \@ Ae
- Bbs
» Sak’ Doge ae
wtoBeubsh drscildes (p
I Fat fecal
Pure
dts GF
tpi =
Boi. pratuctor,
ig ee ital Ebay
Sed pnp keProcedure / Algosttnm to Ftd nulabe Laviake,
ao: A Cparmmer G@= Cv 2.S.P.7)
OP: 4 fst A variables IM Vv Which are
corsideral +0 be nut&ibe
method
(otratrze No= (Ae W/\p contains
A>e
a Ts &
do
3 Jat
i
’
+. Nte Nid u face : A> e§) johow NTS Niny-
© —fard -the = Nutlable Lapibe-
G:
S> Cabas
A--> bA8/E
B= BAa/A/E 5 CSAB
Ne £483 = Asc, gse
Ne [Nouleyy cr AKR
= £18.04 Ase Boe
. CS
No= {Nhu gye oN! Fast
= {AB CY
QO sas
A> aAle
bobs bB /e
Re eS pre
Ni= £nlou 0%
=NorfA,8y ysls log
Ennmating & peedueHort : ° i
method:
‘ “Tritralree a production tn P
2 Find aw Nuffable’ ~ Varrable ia
3: For every praluetren Of bn AL» € inpaddtep
+ Telele ag € productron from PF -
iF ; a Me
FOwaride (¢ predulettor Ra the —feadeuiing &
SSAAD Sars! pin 39M i
A => Ahb/é
C+. ava
D> aDa/ bDb/e
Sin: ela nating € produttrou
No =A, Dj
N= Gawy Udy Ra
= Asdps- 8 9 eh
S> AAD! AO) ALY ACL OTC
A> ahb/ab
- Upset o
(oacla
D> WDaA/aa/ bdb/th vryse h)“tual: Production of from Ag
A an BS b ASB
Th Graxtminety at Gyeevatert
tL. patting WR Now Wipaoduction of pinp!
Aad Bp Wf A+B
and A> Mee OM
Bo me: Kn “Whee X7 15 et not
ugh — vaviable
2. Torx a®
Ex: S—>Aav/e
A > ao be/B
c>a
B= Ad
Soln,
S>c
AB - uy producto
BoA
pal on hon unit production Th P
S> Aab
A> a/be
B> & bb
Cs a F
New wuks*.
Sea (C58)
A->bb CA->8 > BS bb)
Bs Ae: CBSA) A> arc)
New grammer um sel of ules
S—> AadWa
A--r a/b /bb !
Bafbc/ bb
thbss syrbob 2
Fremove Rr quen, qrarnmnar
a .€ production Gee eo
Ase
SaA/agg > A>
B> bebe
3)
‘i
ay BH!
fir
Sol. Rermve & pecudion fi
Anyone
N= fA3 :
S> ahaBB/a L
A> aah/aa ee
B+ BB /bb ce 8 GE be
C>B
remove On Preset LEG; Cam ft
G8
1° TRE rel) "Proce 80%
S-> aA /ayjags
“AS aah Jaa as ey S i
Ba be 7 bee. rn <
C-> dB / bbe
(eS IN seParmcrng lemma for Conleal- —Free Language.
Ur Le Ube any conlet! free language thew ears}
n depending onty on W guch “thal fez 5iIny
and fefzn then we may unile z= awry s+
b Mel =)
iy) wwx14n and
W) va te o UVWx Ig EL
_— pumpng tema th used +o prove ~+fPab
tre given . language net — Cowtect Free languag
Shew “that
D jlefalple 7219 BNE CFL
Solu: Given: Legit
Le faib’e! fiz 19
Gonder 20" BMC" EL
By applying Lemnra, :
Z= UWA > nO
tusat, wwx=b*, y=Ct who Juwxt 20) Nal>i
ndlues TH uw 'y
Substhutng ctrese
=Uuvwxtviayh |
2am phon 4
on Loe et
i -n-mitm )
io np pel n ae r
“Te ‘ilushale » a 7 i |
Teo :
zeae OMe
2. Given Lis mtb Gentex Free language.ww } ‘
2) ied go” /7214 6 rf EF be ns
BD. be {b" anz13 rOb Fe |
1G \2|
Pustelown Autonata: ey A
yi]
FA ce Net capabe of cakepriznng gevbaay type
of larguage
MINED) dil
“Therefore, Pa vested an har remy uth
Fanrte no-of- states. 3 ip da a Spey M5)
Trerensing memory by tnerease!) hoof stabs
Ba cannct hardée waft ro-eP slate f,
Feomat Defirtion of pp, (a o 1p upely
‘B
A PDA m ih VN eS
seit wesvi B a fugem 7 2 AG 8440 do 12)
=, Pith sel oPotefes
=_ ae sek 1 “NE yifledy
J Abnabet, called wala
bee 8 aid
26S e call,,
S: 0x20 feh> axyr j OstenD Csgn a mathe mole ef PDA fp larguage
Le fo / needy
shh
a . ‘b
ld Az {stat > U4 deh, foh, Foveeg 5 stags
toheve «8 define Pitvatreation ef stack’ ymbol |
me $ Ceo,"84 2.) - 44 0% ky
e S(4 40%) = [4003 .
RB. SCs. 00% $405 El
Re: S§Cb, 10 Ch
Re: Cais.@220) = Gz, e)
Note: “To Rerve Zo From ie stacks © cante
\praesel :
ake adi
2) Dsigh a pa fer sel of ashing: of balanced paverthess
iB
lee Am (009% 44 (0,91, £0, 26515 > 2 8,3)
Ri: SCt2£62,20)= Cay s(Ze) Se 3
Pe Sy Gs Ged = Cyr
& Slay a) = G0 . eo
Pa: SCH. = (B/G %)
Pr, 4s. .%)- Cee»——
“Os ls Carcb’Yns15
Sig as C £05295 4H), arb ich 2s,
Wp Zo, I)
SB define as
R: 5 Ce saacbb;h) — Gaz,
Ri: § Gyyachy a) = Gud”
SCH ,chbsaa) = C200) pars |e
* $C4Chbs aa ass hg
Ret S Cty by AD = €s30)-
ee ie will tage
FEES (4s .bral= Cis3€) '
Re: & (4ss6s 20) = C4e€)
A) Le Fpw® Ave Capi we Reere oF104
-* veprédents any ro. of stings
S= abba. 5
A= (£09142 1134 (arb) 122, WSs a
‘ PeaPcoth . ehh e483
dln: iifeit
Ri: 5 €%wabbasz)= (Aiaze) <°
R: S@s bbasa)= Gran)
Re: 6 (4abasm)= C454) :
Ra §C42 2034) = Gay
fe: §C% 26> Gre)
Er
ae 52Pishdeown _Autenata:
Comtruce a DA Hak Wn acepled tps Rarquage
Gererstted ly te Granves Ge C{ssa4, {a)6%,3,p)
S> AAG
A> SAY
Soh»
Defire pr a follows
A= (444 -farby {54,463 4,5)
where Sw dGind by
R265) = £80) , Cqyayy SS AN
Fo: 5GoA 2A) = {C4254) > Cab)4 AS sA/b
B: §(ara)= Ll)
Fe: 84, bob) =LIWE}
TWa+ Whetfer abbabb s WM N&)
» SC4zabbabbs 9) H— Casabbabb » A) by Rugs
+—G rabbabb 5 S44) by MER
+-@» bbabby A) «ssa
+ 49 bbabb > AA)
+ C1a bbabb> SPA) -> pssg
+— (4) bbabb KAA) «Sona
\ ‘ *— C4y bbatb bAAA) Ash
i by
CH babbs AAA) by Ra
+ Gpbabb » brs) by HB
+= Ca, abb SAA) - ASA
Gabo, aaa)
1-04 bby AA) is
Ca bbb A) A>
1b» AD
(a, b5b) CHE) br Re |Hw ; an t '
Constoutt a POA tat accepe “tre Karquage
= geneuctad by Epa mptart- eee)
a s—>asbb/aab
b S>ahbs/ aha nb
p> aBya a
G>bBe/b-
Luit— 4) {
Propevts oF Cran’
x Chenskiy — Mowrat ‘fom! CNE)
Brexy CFG B genvated by CFG TR Which ag
prduttion are The
‘Ae Be oo (Noni Teenie thet nust
} Az-ai ae ' -twe variable on Rib
| a> ph MoE tewnmal AE te
is rusk Ye orty ovesyrai)
Show A,B,C are Lathe ond aK is
“Femina sym ths fom © caffecl en -
© Reduce | Cre, Tinto Cnr
t Le |) Ehren ee
b 2D Eliewsting writ production
3 Elena tn, wiied
y 4D Coriouct CNE Gramnax = for The Following
Ss>aAc
A> anes
C—> ac/a
Solu: To convert wo cNF
Stepls CEhminating © preductou)
v= Cay VASE
After ehmimating & preduction,
S> AACSAC/C
A-=> aAb /ab Ase
C+>aC/a ,
sepa: Ebon nating untt — preduthon
Sse ts only om wyat preductren
eliminating SC we ge Rew Ret ef production
S-> AAC LAC /aC/a
A x» aAb/ab
ce sala
Steps: Thee % no _ Useless SYmboG ,
Te convert inte cnr form CA> BOY) Asa)
“RB: SAAC
s—>ADi
D> AC
Pus SSAC +e IM CONE ~formt
Pa: S—4e
so Xa €
Xan | wePa-sya (im Cnr)
Rs AS aAb Kaa
—> XaAb Do Ab
> Rare = Kp : ’
Xp >b j
R: Arab .. vipa fl
—> Xaky “tarot
Xp>b i
} yh
Per Cac instr at yt
eC OHNE) 8
Xa>a
4 !
BRB: Gsa Cm ene) gs
}e #
R "9 G deg 7 Mil prone ul
4 ! i @ 7
acy ' ‘4 3’ 1 5
Die AC 544 De pants
S—>kac bs 5
no NONI
Kara nae
ssa wows mw
: Kane Is\30, Sy
Da SAM , co
Ko>b a
7 Koha M stat ie
Cc > Kae
B A
(4 i Va
5 “ia) S—> .bA/aB
Alan Sas/a
B= ane Abs 7b
Bin: Te Cenex! inne
Slept) ehonarhieg ¢ prduction
The ws no & preducion m gien 6
Shp Thee B no urtt predicdron
ste The NE Useles — smboe
Ae cement to NF form (4+ BCA Sa)
R: s>ba
SS Xpa
Mb
Po. S->aB
S~> XaB
Kara
Pa A> bAA
> rh
A> XbDi
Di AA
Pa Azas
A- > KaS
Ke: Aza
Po. BS aBB
> JaBB
Bo XaD2
Do> BERB Bol : ,
Pe a a
BS Xs
B: Bob i fet 1
Reuttont one Grammar
S—XA alhy § I
Xb—> b
S— %e8 Penta
Xa->a
As X»Dd1
D> AA i a
A> Xas \
A> i Sl a a 1
oor Xa Da | D> BB» | po es; Bob
Z ‘i b fi
Oi 3 iz ‘
Hw
1. ae
22a) HATS WM 1 tes.
Given ; Geammr @ Tre CNF |,
S-> aaAB '
Ap-> b&b JE Or a
B> BAaLNe
>- Sse AWA/B A 2atn [ar/ar ss ieebuh
aab/e 18 —>bbr- b= ey.
3. AS iGREBA CH Noma€ form Ginry
—Theovem:
Bley cra language without € can be gensuted
Grammar —fer which every production of “the
form AS aK
Whee ATS Layakle
QO 5 Teéervinag 1!
a ® Shang oF tartan Cposibly every)
Prof le-@= (vst. Pg)
Assume that (
Ve LA ae Ang
So thal
aF Ap SAP yw a Preductten, Then J si -
Starting with A, and -preteecl ing ter ir
At -fellews :
for 14 toe DAF Sap 1S & Peductien, onfy
pu | y war |
4E hy SAG Bo preduckion , with for
We gerade a new’ Ack’ of — preduttions — by
Aubstibeh eg fer Aj oom nvight aide of excl Aj:
1
According As Kemmal,,
depeating: the, preees ) K—1—1ms almost
We oblaTh | preductron of--feomt Ani agr 3 BKWap tre pacduchon of form wth P
) ane than replace ater eer
do Cemma ® - We’ amrbruduce!) 1 NUT
He Lartabl Bk-
i
Algovitfin : Ip fl
bein
—fortiz1 tom do :
begin Ce NN GD ee
fos get to k-! de ea
J
Caset=> for each producton efor Ap? FH de
begit
fer! ot qrredudion AG e
Add procluctiow Ay pe”
rremove producer) reAgx ,
end
Be ear al 1 ae
Coe a: ee
ara sy lets
Soe each a le, of fe “olen
Ats-> Axa de
4 ion pbegt uy ois } Sew
add production By—see and
riealyetidity dost th Bas Big 5 |
chr nen@rmpve Predghion poh,
oy HP Wak WA ok i OR
yh Sasol a Melee A ‘ yh pit
Case: Rr cach production Ales w hoe lip!
| deds shot bagini eee ye
‘ » ada Praductont Ve -opea
alBe.
Convert bre "CCAshna had > ft0b9s PAD
Whee P
At Ax Ag
Pas fs i/b,
Ass AiA2 /a
Soln: as
Sine the svght hand sce 6? 'prcdichen 4, 2m
Stast With -teoninags ex uth lagher pumber
La rtakes - ee
and: Suptele for ALS airy
Steph: Ags AiAa
Ai—> Ards
Aa> Asif b
As—> ArAsta /a
Sie he ayght ards: of rocluction.
fos fe tata begins with Lower ro. of vairalfe
ye Kubstrhte AR uot” ee ‘ oe
4 (Ata, Aads
fa AsAt/b
Py -> Ay AAs Ao 1 Bie hel a, 4
: VT GNTITT eS
At pt
ae 4 aoe AAs A mea f
Aa MsAr/b a
As—>bhgie, By (a B3_/ bas hale
Ba-> A Ag 4a Si Asda BsStep:
New a@ —the _ preduction with, As hue
aw —the ewinee Hak let wilt:
Jina, BEE
Aame AA at at
Arche |
the yesuthing preduchon
: As—> bpsP2Bs . ling eb As Aa
As > 283 $e Ageia i
Sab “Hen 1n Fe
Ala —> bAa He Ba Ay \ Bhiedr
Avsb a ‘i
ait « :
Sub-rhen in At Bh ch eX
Ar ArAs a\ihady