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

ai assignment 2

Artificial intelligence study material

Uploaded by

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

ai assignment 2

Artificial intelligence study material

Uploaded by

Bejjanki Vardhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
comenenly now as process, Explain A hex ‘Ip are athe structure of a Lex Program fs used to genererte scanners 0% tokeni tS * program - lexical analyzers These program text to produce sequences of Loken’ -for “further Processing in compileys + stuclure of a Let programm consists of three rain sections , sepmated ba o Specifies * Ss * & apeele roavkens 5 declarotions & macros centants +o viet fo-a} LETTER [az a-z] 2 Rules section: patterns @ conespending actions 4o take potter: ave roatehed » Potterns in © code Formot ee fsettery + dC prints (" Word + awe Yegulay Loiait} + { print{(” surdoes expressions, @ actions potters fection} 5 oPAO" yy tert) Xo 1% ignore retatines™ / April eo yylect ts a predefiord voriable “that $C okra sp s\o") tet) 3 rnotered sting Uses code ser! Comtains toaic* a code, seh helper -functions +P sX0" yytexet)3 Y contains the St define reguler expretion steoplify the programs - when are written, sh or additienal g FTypteatty placed arflen the terond ele’ Cyt fe fat main Of ler © 5 [cats othe leeeer yeluyn 05 } Prove thal statement “af the Grarnman Gy, is conchucteel We Graromer G by -the algortlbn then -for eliminating wort productions -three 1(G,) = Hq)’ To prove “that 1 Cq,) © £04), where G, is -the qa Cblaired Jr G by eliminating unit productions, let's analy ‘the process & ensuve hal -the -transfermalios presewes “the larguq Def t4G=(V,4,7, 5) whee vis sel of varriabl set of Aewminals, P ois the set of productions, s is the tlovt xgrotol + Poreay include unit preductions, te, wiles Of -the -forrn AO 6, ube NB Eve Bs fet frareroay obAdined : a-G, he g mar otstained fromm G yg applying an oleorittro 40 eNroinate unit pwctuctions - fter clinsinertions, cthee Fe nm preductions ef the fam nm 3 in Gq - S- Objectives + Prove that, languages of § & 4 avecthe tome ire, LCG = L0G): Proof + We proceed by verifying tat 1Cq) eb CQ): La) £04) + cd f LlQereg): Y Algoriths -for elfininert it 4 unit productions + » renlecent “the vule * For every unit production A> 8, replace it ay ales os, excluding sfurrthey unl prcctuctions » "Ad Ae py an BOC (where x fe -teminal ching): « Reasoning : + Sf Moe fo G then Boe then now tn 6, Tat, every devivation {9 G fevolving untt productions cas Be performed fo Gi, tthout usit praductions - * Therese, ery string derivable to G ensuring to Gy, is alo derivable : 4Cq) < 20G,)- CQ) c “Cq): - Reasoning : * TPE algorithm for sHieoinerting Yer product veplaes A> hi ASK fr BOK ect) fons oly St does not any rew strings +0 the. (OPGUQE, AS A © mere aNeady be ctevivable 95 @ via As eRe * Therefose any string WW devivotle fr Gi, was olvescdy dervivalle ts Gg sawing 2g). 2 1¢q). a Replalo the statement f ree: SE Caesingy Lemon doy eeggakay ‘furping terma t a fundamental concept ty Me heey of formal languages automata: dt ts csect “bo PvE whether @ given languoge fe not regulon ‘the tea is based on -the fect that an reguiey lan quages, auc to +thelr fine nature | exhibtt vepetttive Patterns eshen stings fp the language are supfiefently tong. x There -for ae wo urping Lemmas (PL), utoich ax a ; defined Regular languages t Contest ~ Free languages « Pomping lemma -fox Keguica languages ASL gives you method! for purnping Cgeomating) mony subsivings spore a given hing - Sin ; z Sther words, we soy provides preans to bacak o Gem 100Q_ Ip string Fete several substrings + “A gives ecessaty — conclifions 4p prove a tet of ching pot xegules a : jenvern 8 FE any xegulay language 1, there exists an integes ©, such that Yor all win be Iwl>=p- We con break 42 ielo tbxee shfngs, us saya such “that ) leyle P Dtgh ot #) for at keeot the string xytz fs alto in 4. | Steps to puove that | longuoge iS sot regular by using At | 7. We hove to assume that Lois yequiay: ti- So, -the puroping, lererma should hold the L St has to hove @ pumping lengtb iv cA skiing longer that P can be pumped wep: cea -trat = ve Now find a sting ‘9! fp b seh the lwirep li vie Otide ws foto *Yye can be divided foto : sor sore T+ vie show thet oad GE wid het \ fh. Then consides, a wot? vint gt” can Satisfy am -the 3 "a hee x ore of + rp ro Q: eonttttor te or ws Q. Explain ys al game cHene cammol be pumped & CONTRA RIC rion! atiye Glalerment Ff “te eureptog Lerrroa ? Rumying, Lerma fe a Matement fo formal language rtheovy that tates thee at) carp tefertly long slats in a regular tanga mofddle se ooo es to produce a 96 sing iret op Ae The & mot os can be There fndexed can be pumped? Pureping rear’ thet sion of a tying can be repeated an nrbion, alto port language + pumping lerema is used cto prove -that a language egulas purnped - stipgs i -the language ore also Fumpicg lerereas -fow corslext —frec torguage languages, @ vequioy “Ineo languages» The Pumping lemma for comtext -free fonguges states thot alt sudh dently pair of long stings fo a content —free Lar Quays have @ substring > that can be vepecrted arbitra tihy many ‘tiroes went ene various variation® ‘ a corn plete usteg 7 Vastations of Turing iachives m+ . oe 7 Tui inochine & ctneovetical COroP ever A Tein e _ : been icrhoauced ever time pave Pee several era TES capabi Ihe + “fo en of 7m 2 How te exchieve versiati ons oe ceifie purposes SOE yersiathors iy i. Multiple Tusing machine : * using multiple -tlapes, each with Ts oun tread [write bead: -Atiows parallel processing ef dota Equivalent fo computational power to a Single tape 719 wel con be more efficient - Nondelerministic Turing machine (nit) # At cach step, -lhe machine can branch into reuttiple computationat paths: Stirmnulates all possible paths sfroultaneously + Usivental Tuxing Mochioe (orm) ~ ATH capable of simulating ary other Tra given tts desesiption as i/p- Fosrms che basis ef modevo carppubeg ce progrereming languages ius Munidimensional Tugiog Machine : * The tape ts extended -to multiple dimensions . Usejul “bY probleros with Tehesenity spatial croroctesistfes: Ye Probabilistic Tuying Machine: x fecovporates rancloroness isto He corpputections « —Tarxisfon: ore determined prokabilistically, often used to stucty Probabilistic al gowitnrns - vi. Ovecle usin Machine + 4 Enhanced with an “ovacle” that a0 answer specifi querfes instantly: Useful -fow stectying ateciston proberns op complexity classes + Achieving Coroples tasks Wits Turing Machines? 4. Design Modular Subwoutines + eco mnpese -the Hack foto Srmalles | mranagable ssubsoutines * Qe Munitape tras for Effeferey + * Girmulate multiple subtasks fo penciitel fog reunitape TAS + Intermediate colculetions EET Ove tape for ip» one “for arcthe: for op: Ati. Stimulate Higheszlevel conshucts + we Ure the 7M Ao Stirrulate prograrreing conshucts Mike corditionals g “jun® cots ex: Encode decision —tree olgositnrns iv. Apply Nondetesminisne + a Few tasks fnvolving scorch aetign e0 NTT +o explore all possibilities efroultancously « Ex: olvieg puzzles ov fincling Hamiltoetan paths Explaio Chomsky Hierarchy cH ier ave! re orasky Hievaveby represents the class of languages Arol ave accepted by “the different machines The ante; oN of language in chornstey’s Hierarchy & given belao: 1. Type 0 brows 95 Unrestricted Grammay ! a. Tyret ferown as Conlext Seastlive — Gnarmrear: 3. Typ2a Epowo oS comteel Tree Greroran GQ. Type eguien Guaroreas ry 4 , : | Type_O Granornay + Unrestaictel Graroreas = a Type 0 grove ¥ & known a5 Unrestricted grararecre+ “here fs oO sestriction 97 athe grarnrnas tiles Of these types of languages * these languages can be etficler modeled by “Tring erachires ex pha 320 S38 Tyre! Grangmer+ Context ~ sensitive gvorereas Type) Gyarernare is erown as Context Ser groremas: The context sentitive grarorat ie used to wepresert — comtect sensitive languoge* Tee context 2 grommer follows wiles + FOw grammar, to be context sensitive, Ho noust be umestricteds Graromcer production br Types ts given Py xP € ensuring court symbol fn LHS oust be Jess 4res 07 equal to FHS) © sy BA BA > bea Bb Type 2+ contest free qrommey * Longuages Tecogrized by puthdaos — -nuternota oe bra os Tyr 2 Grornrar: Contest free gqrarerray yepresents contest Free languege for o gvarorear to be coctert —fyee, Tt roust be comtest —sent Grarnrrean production for Tyre 2 ts guen 4° noe fo single po — tenia! Cx: A oe at I = YPEL St Regutoy Grommet Languages yecognized by Fiotte -nutomeata are enown Wyre 3 Grammars Regular grammar sepreserts For gramroar to be regulor, ft rust be context —free - Grammar pioductios -pr Types is given by - vo sta a ficr ©

You might also like