TAFL
TAFL
2 2 = Qi Qivta,, whee gis BR ee eo Tey ta tay = Mo al 8 forall in Asa, For M.=0 and n 20) 8 also regula Fotersection :1fL1 and if L2 are two regular languages, thet intersection Lin L2will also be regular For example erin: 0 and m0) and £2 = larbrw Bre" |n20.and m 20) ja" "| n=O and m: Oli also regu Gomlement 110) i regular language it complement L(G) wee certian Complement of a language can be found by subtracting stings ‘which are in L(G) from al posible strings. For example: L(G) = la"|n> 3) L@= 31 Pigeonhole Principle, Pumping Lemma, ranean eidanty : Dcivion Properties, Finite Automata and “Regular Language, Regular Language und Compsters “Simulation of Transition Graph and Regular Language Application of PumpingPigeonhole principl Pigeon MratTfn pigeons ae assigned tom pigeonboles then eg tate onote contains two or mare pigeonsTan Pinhole principle sometime wel in counting method Proof Proot x pgeonholes be numbered with the numbers 1 through Feasts withthe pigean 1, each pigeon is assigned in orderto hy pigeonhole withthe same number. a. meonbele Ye, the number of pigeonhole isles than the nuber Finwone, 2m pigeons are left without having assigned a pigeouole hole willbe assigned to @ more than one pigeon 44 Thus a least one pige £ Weebte thatthe pigeonhole principe tells us nothing about sow Treat the pigeonhole that eantains two or more pigeons. {6 Teonly asserts the existence of a pigeon hole containing two or ma pigeons. 1. Toapply the prineple ne bas to decide which objects will lay thera otpigeon and which object wil pay the role of pigeonholes Geek] State and prove the pumping lemma for rest language. ‘Anewer 1 Pumping Lemma is a powerful tool for provir yuage noe Poi powerful to for proving certain langue? 2 Fee te ulin the developmen of grt to answer et ions concerning, rite automata, suchas whether the Scceptedby agiven FAs faite or infinite ether te oes ane a. * L be a regular language. Then there exist. a constant * [thet depends ob) such that for every string w in suck [olen Winto thee substrings, w = xyz, such that 2 laylen Tha oe 20 the string sal in Tete aay ida onempty stringy not oi ice pe ee too far from the bed resulting stingintha Tepeating y any number of times Kee? 4 Formal Languages DABACCHTT-Sem-) Proof: Prot an Lis regula. Then L~ Lib fr some DPA, M. Suppose Mb alate sider any string w of length n or more, Let ‘gq, where > and eatho,isaniaput jm, for i= 0, ).where ithe transition isthe rate, Ms 2 12am define state p tobe a. taneigm ot i, and oie Ue start state of M. That is fonthar reading the Best i symbols of inthe Pgeonbole principle, tient possible for them +1 ierest aa agent be dist, since there are only n diferent rates. 1 Bee tan nd to ferent integers adh O.-<) such hate New we can bres =x 08 follows 2 Bo Fae Pare eC reee 3 nal ia ple: takes stomp backtop sine tee povant sx balance 1 Fem conep mong the strings and stats are dicosed in Fir 2251 rene sa. 7 =@ Fig 2253. -emay bo empty, inthe cse that =O As, zmay bert == Sine istrict ss ha However y eannot be empty, 6 Now consider what happens ifthe automaton M receives y's for any 220. Tei» 0 then automaton M goes from the start state gy t0 P90 int x Since p, is lao p, it must be that AC goes from p, tothe scvepting state in Fig, 220.2 on input Thus, in accepts «2 Iti, then M goes from py 27,08 input string, cireles fom, *0P ‘mes om input y, and then goes to the accepting state on input = ‘Thum for any! 0, sy!2 is alo accepted by Mf that is x! 8}. ue 2.26.| Explain the application of pumping lemma. “Answer Application ofthe pumping lemma are ‘Tee pumping lemma is extremely uefa in proving that certain sts Fe non-regular The general sepsia ts application are Renee ete is areguar. etn the umber fats incon FA Step 2: Choose a string w such that [102 tw sayz, with [ye|snand |y1 >” Step 3s Find seule inkger ssh att b Thiscontadct ot assumption, Hene, Lis aot regula ‘Use pumping lemma to writeNW ESS sanaccstT sem) _ Besoin GEeTHT] state romping lemme for regular Langage, hat the language L defined aefolgy ‘tow, aswer ‘Pumping lemma for Unit Proof: ey Proot ny[m en} bea language. Asume that Lis regula angus consider fllowing case 8. seqular language : Refer Q. 225, Page 2, Case 1: Assume = 0001 eZ ‘By bnping lemma if2 = ww then if we pomp some string ta pang em cach langage ical eguae. opoinay ieee ite = wl endif =2then 2 = wom Doorn wor yy 4 re oO 0 CO EL, Case2: Assume Le such that seo goguiiiiy at T By pumping emma,2 = ur e Lfr a regular language. fi =2:hen, From these cases, we Sah aaa. = es, we getz¢Z, Thus cur assumption of Z being :eeua* lence given language (= 0*1*|m #n isnot regular Quen: Prove thatthe language = 0" n is prime) is notresl ‘State Pampi oR imping Lemma for regu sets. Show that the setL = 17! is aprime! isnot regular coy ofAutonnin&Formallanguges a1 ACGSIT-Sem) ‘anewer ‘Pumping lemma : Refer Q.2:25, Page Numerical ‘Beep 1: We suppose Sotamaton acepting ti bea prime number greater than pet w =a By pumping et be written sew =sy2, with [xy | Sqand|y|>0.2.9,2 96 1 ae ofa. So.) = 0 forsomo m2 1 (and <9) sme a rept Thon[a'l= ayel + "ape — tin = p+ pm By Searing lea, se Bat [ap +pm-=pll mantel +m) snot pumping mre b Thisisn contradiction. Ths, isnot er GueEBi| Prove that fllowing are not regular languages (0"|n isperfect square). sere ee Pe atrings of form 0! 1 such that the greatest common, divisor of andj is 1. ‘Using Pumping lemma for regular Tanguages prove that language Leo" ,n>=1 isnot regular newer (o"|n is perfect square). sere Re suppose L be a regula, let p be a constant provided by ‘pumping lemma. Let w be te string of a, staring i in Lan it length i atleast p. So we can write Tv] ep andy +e and each 2» also ind. a. BRS PITED, yeonsisteofno more than p sandy ¢£,s0 there is atleast one 0 iny. 4. Now choose to be 2 and the f Melkateto prove thatthe length fy isnt perfect stars 18 srepeae have to show that it Les most strictly in between two rar Mrutive perfect squares, namely p> and (p= 1 6 Re MSS oe ng fy Mhonehe lengthen ier 4S piepirge (sh 1. "he first inequality olds since > apieap + 1>p +4: 184, Unit Lie regular Lat gb the number ofstatein the Gite resulting string 8-092. 0. For second inequality. we ‘ince q a, where Aist variable and wis string of symbols (VU). 4. The example of CO is (4 (i V, 7, P,S) where V=1E), ‘5 = (B) and production Pis given as P:B +E +B,E +E & BBB), Eid) ‘Que 32. ] Give an example of CFG for arithmetic expressions. ‘me ] 1 Anexample, = ple grammar that generates strings representing arithmelt _2presion withthe fou operators, nd numbers as opera 4 ‘expresson> -+ number Sezmeion> > number. cexpression> -» (cexpresson>) Spmenlon-» cexpresin> +
f supesion» cexpresion>—cexpremion> + fasion cexpresions + cexpresion> Theonl m wor of Automat & Fos “hit ral (or poduton atestht an exes canbe rewen ced by) number. In eter werd s monies brs vad SIA (CRITSem) - eno in pretest ‘The eons eessioa> Thin rle dies an ecprenten i eras of can un nap of ho in ofrecursion nthe dtatonsf CFO. ‘remain hay edt Gueas | How derivation is defined in CFG? Taswer wT ervation ea sequence of tokens that sued to find out whether a setae o ering is generating valid statement or ac Viecen define the notations to represent a derivation 1 Fintwedefine twonottions = and 3 ray pis a production of Pin CPG and and b are srngs in Wu hen a = 08d 4 Westy thatthe production «+s appli th string ab obtain fbr ay thet ab ety dives a3b 6. Noweuppme yy oe, ae ing in, m2 Landy 2 Oy 0, 2 yt 2 Me: 1. Thenwesaythat a, “> a, 2, wesay a, tives ingrammar Ge rivesby exactly steps, we say «20. QaedA | Construct a CFG for the language Le Cu | we (a,b) “answer 1. wisa string of any combination os and EH suttauo tringonycomtoatinofa ad, tea tng which he reves of 41. Cis terminal symbol ikea 1 Cina termin ara mrror, we wlbesle tose the rection ft inthe! part Like C, abCba, abbaCabbe ike hi 5. Ttmmeans thee is some generating symbol the mi anette same terminal symbol before ander. Eee oul ambol ae alo accepledin the FEE OTS: 1 ‘That moans only Cis acepted by this anguae st: From the above prints the production rules wile le by replacingpaacstTsemt) ‘5-010 pe grammar will ves hl, b.C ps aS S119. GuodR | Construct # CFE for (ort 4" on" ig 2, where 0861 “Answer pe reelarexrsin conn oftwogaris O11 #17 and Tere iets wear aking nom erie, Hen ee prt + can bein ae OLY 2 tend erinasonofOsand xwhichisrepresented YS. eine sat ineladed inthe languages 1 TREES forse proetin rue) of eer Prom ea aBle A» OLLI, CDCI, D 01 52 Aenmar willbe @ = P. Sh where TB ALB, CDI, (0,1, 5:1Sh Gueds | Find the CPG for the language Le lat" [n+miseven!. on Design CFG forthe language consisting of al strings of even lengs over [a,b]. TARTU 2015-16, Marks 0] ‘Answer Let @ be CFG for language lb" + m is even} oe V,T,P,8) i (8, Al, P= (a,b) and production Pare defined es: $->AaBb|AB, A->aaA|e, B-»dOBle Derivation Trees and Ambiguity. Questions-Answers Long Answer ’ ‘Type and Medium Answer Type Questions SSA(CMTSem-4) Dotine parse tree. What are the conditions for nga parse trvo from aC? Why parse tree con sible for CEG? bee 1 ropretntation of dervation, so itnalo known eer tre representation evn a Caton Fee von Content Free Grammar (CPG). aa Ce te a odeed te ihe hand ie odin ‘re spent oan children nde re ropreteie by the ‘roction’s right-hand conn for constructing a parse tree from 4 CFG Conditions fox ofthe re must hav label: The sie po terminal or terminal or nal i Therootofthe toe isthe start sym 5. Team othe internal vertices non-terninaleybalteV Bea production A> KX. Xy. Then for verte, abel A the hildren of that node wil be 23% ile sealed efoto parce tee iis label ina terminal sito! ‘eZornull (©) Pare ics constr only possible fo CPO. Thsisheaut te eoeee Ufa tee match with the properties of CPG. GueSH | What do you mean by lft mort derivation and ht most derivation with example ? tower | 41, Left most derivation : The derivation $ — « etvation, if the production is applied only to the {non-terminal at every stp. {mr tun considera graniar that consist reduon rules b> E+E |B * Bid. is called a eR most eft most variable Firetl take the production E>E+E>E* E+B eplace E> B +B id + E+E (Replace Bid) Sid + id +E (Replace Bid) id + id-id (Replace Bid) called a right most 2 ight most derivation : A derivation > is Right mows er ini appedonlyteiet termina avery se z He a grammar G having production. For example: Let us Bo E+E\E* Bie ost variable (nen-