You are on page 1of 42
Fonestos BE. Degree Examination, cp with Automata Theory g Com CS - Dee 20177 Jan 2018 Patibility rs. any FIVE full questions, select ie ony Max. Marks; 80 HS ONE full question from euch module, Module - 1 ae the following terms with examples: 1m msiphabet (ii) Power of an alphabet OGoncatenation (iv) Languages a abet : A language consists of v. sa be obtained. These symbols oe ofalphabets of a language. aes ic} iPower of an alphabet an alphabet, we can epress the set of all strings of a certain length from that alphabet by using the exponential notation, Ex: . = {0,1} the D'= {0,1}. 2° = (00.01,1011} ii, Concatenation : The concatenation of two strings wand v is the string obtained by writing the letters of string u followed by the letters of string v. U=,0.8,....41, V= bby (04 Marks) Is, statements E denotes the ‘arious symbol from which the word: are called Alphabets, The symbol. iv, Language : A language can be defined as a set of strings obtained from £* where Zisset of alphabets of a particular language. . Ex: {¢,01,10,0011,1010,0101,0011......} Draw a DFA to accept strings of a’s and b’s ending with ‘bab’. (03 Marks) Ans, V Sew (CSE/ISE) ‘Ans. Consider the state A = When input is a: 3(A,a) = ECLOSE(5, (A,a)) : =ECLOSE (5, (0,a)) ={}>(B) Consider thestate B: When inputisa: 8(B,a) = ECLOSE (5, (B.a)) = ECLOSE(8; (liz) =o Consider the state C : When input is a: 8(c,a) = ECLOSE(5, (c.a)) = ECLOSE (3; {2.3,4.6,9} .€) =ECLOSE(5) ={5,8.9,3.4,6} ={3.4.5,6.8,9)-—> (D) Consider thestateD: When inputis a: 8(D,a) = ECLOSE(8, (D,a)) = ECLOSE (5, {3,4,5,6,8,9},a) = ECLOSE({7}) ={7,8,9,3,4,6} = {3.4.6,5,8,9} > (D) Consider thestate E : When inputis az 8(E,a)= ECLOSE(8, (E,a)) = ECLOSE(6, {3,4,5,6.7,8,9}.a = ECLOSE({s}) ={5,8,9,3.4,6} I {3.4,5,6.8.9} >(D) When input is b : 3(A,b) = ECLOSE(s, (A =ECLOSe(5, “9 When inputisb ‘oe =ECLOSE(6, (1 = ECLOsE;{2)) ={2,3:4,6,9} 5 (6) When inputis b : 8(A,b)= ECLOSE (8E(4,b)) =ECLOS(8, {2,3.4,6,9}4 = ECLOSE({7}) ={7,8,9,3,4,6} = {3,4,6,7,8,9} >(E) When input isb 8(B,b) = ECLOSE(§, (B,b)) = ECLOSE (8E {3.46.85}! = ECLOSE(7,8,9,346) = {3,4,6,7,8.9} > (EB) Wheni ole isb 3(E,b) = ECLOSE (6; (B ») Fr ) oe ecunseleet A678) = ECLOSE({S}) =(7,8.9,3.4,9) jw states will stop ay stats will stop plo 4s daw DESM © accept the language, j= foe fab} VHYE e fa, b}* ((@ = Xaubbaay) ¥ (@ 2x babay))} a b a 2+) aie” © 2% a,b b ; + © and indistinguishable states. Minimize the following (03 Marks) bs ‘Define distinguishable DFSM, alol>lo 3 alalololol>|alo Ql|a|m | ol>|=|->|=[>l>|- = a V Sem (CSE/ISE) When k=2 a 2 pty OPRwy ROR ERY RY] RY : Ray = Ray *Ru[RY] Ro " veateo(etio)*tl =O41(E+ 110) 4 = = * * yesreoqii*o)eile =1(11*0)*1 1+ r, 0 RI =RY ERY RO=RO+RY RY ]ery 2 8 * = 1041 *O(E+11F0)*(E+1"0) = LHe +11 OYA, =1*0+1#0(11*0)*(e411*0) maUMOM CATE RO =RY+RYRYT RY RORY +ROPRET RY B=RY +I RY] RE =$+1*0(e+11*0)*0 =!*0(11*0)*9 =(0+e)+1(11*0)*0 . 0 RG = + RYLRY Jory =11*+(e+11*0)(6411*0)*11* =11*+(c+11*0)(11 #0) RY +RL ERY] RY =(€+11*0)+(c1*0)(e411%0)*(c+11*0) =(€411*0) #(€ +11*0)(I1*0)(c+1140) Final RE can be calculated as RPERAERE ROR S1°0(11*0)# 041 0(1 1#0)*0[(0+e)+1( Give Regutar ex 11*0)*0]*(0-+e) +1(11*0)¢0 Dressions for the following | ntaining exactly one a ning no more than 3 a's, ‘contain at least one occurance of each symbol in Wi ( Ans, (Re=(b+c)¥a(bxe)s (ii)R e=(b +0) 4( (iii)(a+b +0) r languages on /_= {a,b,c} © Fa)(b+)*(e4a)(b+e)e Fig. Q3 (¢; for each of the following regular expressions, whether it correctly pointe L . pee mou a) we peur” ss ab*a eu Uba) (bb*a)* OR a Prove that the following language in not regular : L=(' [n> 0} (05 Marks) us Step 1: Let L i.e, regular and 1 be the number of states } x= 0" Step? : Since [x| = 2x) > We can split X into uvw such that Juv| <7 and [V|> 1 as b a x=faaaaa & bbbbbbbb Amis eee rots j Step3: According to pumping lemma uvlo € L for i= 0,1,2....... | + Mleni=0°V" doesn’t exist so L= {0" 1°] n> 0 } is not regular uM | UNL and L, are regular languages then prove that LUL,, L,. L, and L,* are "gular languages, (05 Mark . ark) ™ Reet Q.0.3(b) of MOP - 2, ‘ : “hth js 5 1, Ollowing grammar is ambiguous? (06 Marks) Cg let sesja (06 Marks) a “Q.0.5(6) of MOP -2, Vase CONt/ANE) ANCOMCE Theory Sone (OSE Cony, 4 at Madittest iy & ws Dotlie Grammy Derlvation, Sententi Aenec nl give ong Se | : US uy M Any. Ver CF ype on gadigte Cs VE EESD Woy yey wl a tounvinnaly, Ps prvdtivetiow and 98" by sant vino, ble 1 VS ond eas Ams ec fhe the press of obtaliligy stele of torminad y " Aro the start vba by apply tags sonic OF ATE prada Beste b esd ened t id Vol (VARS) bo a prams Phe stele oy abtained (rom the Sw iy watlod sentenee of weammar Gi, Hero, Ww by WML / Ap 4 Mh Wo be onto thigh hn, Hr Gy the string af (oun inal b. Whatis ONE Obtain dhe following gramme in ONE SorASH]y (My Amn Bs Shs A] bb Ans, LetG = (VERS) be w ORG, ae of the form, A=BC or Aon liotinate = production hy he pramme G iy satel 0 bolin ONE ial roy iN Production {A.B} are nullable Natinbles [_Proxtuction | com production (p) [SSasn | SAB [ASaas | [BS sis | AS Ala = Sbs] bS|Sb] blAbb Given Production | : Action SA — Already in CONE S> AB Replace a by Ay AAA AA Bo SB, 5B, 988" isstartsymbol A,B,By:Bi-Ao) ve — fpoee ,1B,$|SB, [a fe AAA Bob Asa B,>B,s Aza i y j i | the grammar, 1 rt G be Hes! © +aB [DA j-alas [DAA p> bibSjaBB . for the string qaabbabbba find a ) Left most derivation. (i) Right most derivation. ' (i) Parse tree. (04 Marks) | gs, i. Let most derivation | S=aB eS > aaBB A S > a2aBBB yi > aaaabbSB wh BK => aaaabbaBB J/\ ne S$ = aaaabbabB a ' PS ‘ = azaabbabbS Vy » i = aaaabbabbbA /™ = aadabbabbba ii Right most derwation S=aB >.aaBB ¢ > aaaBbS. : Van > aaaBbbA OO > ataBbba Soon JI, b A > aaaaBbSbba “8 } > aaBbaBbba iis | > %2aBbabbba /™ > aaaabbabbba ; : V Semv (CSE/ISE) 6. a & Ans, 10 - Constructa PDA toaccept thelanguage I= {ww )wefa,b}*).D a,}*}. Dray Explain the following terms: (j) Pushdown automata (PDA). (i) Languages of a PDA. Instantancous description ofa PDA. Pushdown Automata (PDA) : A PDA is a seven tuple (03 Mag Qis set of finite states Dis set of input alphabets [is set of stack alphabets Bis transition Qx (EUs) x|-Qx/* qe Qisstart state Z, ¢| is initial symbol on stack F< Qis set of final state ii, Language of PDA : The language LCM accepted guag : The languag accepted by ’ LOM)= fw] (g,wZ,)| "(Pec Pred by-a final state is defined» iii, Instantaneous description : Let M = (Q.3 es : Let M = (34.5, : (instantaneous description) is defined as 3-tuple % eae tn * |W, 01) @ PDA. Anp eel of this PDA. Show the moves made by this PDA foe sah. és for the sti L(M) = fww*}wefa,b)*} (10 Ma M=(Q.E\,5,q, .2, 5 F} Q= f4.4,.4,5 == {ab} I= {ayb,Z, art x (4%,2,25)=(4,,2,) 8(4.,a.2,)=(q,,22,) . ee) (Gobe) fy Gorbva) = {(qy.aa), (que 8(qu8,6)=(q,,ba) : : 8(4..2,b)=(4,,2b) Beet Ca osb,b) = Baraat 5(4:.6) = (4,6) 5(482,)=(q,,2,) Sunctav. is stat G state é stack symbol * 06 pisinitial , nel js final state F749 abba %) (ay A002 29) (ay aabbaa, 7.) —> ( an ° (q,, aabbaa, z gti) > (4 Bn 2) > fs 7%) " (qy bbaa, 7 “baa, baitz,) — J» bbaa, z,) (do i eq) (ayaa, bbaaz) —> (4 (qs4 aaZ,) ly, ty abbaaz,) Y (q, ¢, bbaaz,)" (qe 8%) ad a (qy, &, abbaa: © 48%) Ge %) . 0) «camer the following CFG to PDA ga ABB)AAA AcaBBh p> bBB|A ca (03 Marks) T={S,A.B.C,.Zo} bt 8(qy-85Z9) = (SZ) 8(aysa,8) =(4,, ABB) 8(q,.a,8)=(4.AA) 3(q,,,A)=(q,;BB) 5(a,2,A)=(4.,8) Hat.) = (4088) ‘ies 8) (01.8) | arsem() pia mC) (41,82,)=(4;,2.) 4 lv Qisstartstate STi : a rtnmbol *Slahistinalstate EC Scanner da Ans,- = 12 v senv (CSE/ISE) i. Observe that this i Autonet TROry & Cony Dat. Module-4 context free languages then prove that LUL, L, Lag . IL, and L, are con’ context free languages. (04 wit "y ()G,=(T-P-S\) | G,=(V2 G, =(V, UV, US,,T, UT; astart state G, an > UP, U{S, +S, /S.} UL, (ii)G, =(V, UV,US,,T, UT.P,,S,) S, isastartsymbolforthe grammarG, andS, ¢(V, UV.) P, =P, UP, US, >5,S,} 2b, =L,.L, }G, =(V.US..T,,P..S,) S, isa thestartsymbolof Grammar G, P,=P, U{S, 5,5, |e} “Theat, ! Give a decision procedure to answer each of the following questions: © Given a regular expression a and a PDA M, the language accepted by Nt subset of the language generated by a? i) Given a context-free Grammar G and two strings Si and S2, does G generat SS? Given a context free 4 Grammar G, does G generate any even length string. (W) Given a Regular Graramar G, is L(G) context-free? (2 Marl Struc if L(M)M L(a) = >. So the following procedure ave the question : 3 ot bla a PDA M* so that Low) = L(a) 2 iron Mand M®, build a PDA M** that accepts L(M) 9 L(M*) : is empty, return true else return false. th up <0 chomsky normal forms2. Try all derivations in G of lenatt¥™™ fs "erates SS, return True, else return false iil. I. Use CFG to Ppa ‘epolown (G) to build a PDA P hta taccepts L(G): 2. Build an FSM Of r 5 Use insert be At acepis all even length strings over the alphabet 2 " ©). 4, Return decioleCF Lenn?) © build a PDA P* that accepts L(G) Hé nF ipty(P*" iv. i, Return Trie (Since ae a L ii. 1. Convert G lar language is context free) Sunstar Exe 9017 / Jarv 2018 #6 OR ith neat diagram, the working ofa Turing Mach; 9a) of MQP - 2 8 Machine model. (05 Marks) in gxpla § pefer Qa . a Turing machine to accept the Langu: ig ign Show the move ; age L= {a" b* et [>= 1}, Draw the »Mston ding made by this turing machine for the string ea (11 Marks) | aabbec Xabbec xabbee xaybec xaybec Kaybee xxybze xxyyze XxXyyZ2Z Module-5 Write short notes on: 4 Multi-tape turning machine. b Non-deterministic tu ng machine. ly opie Bounded automata. byt Qo: 9(b) of MQP - 1. Scie rf “on - deterministic tu g machine : [In a non - deterministic turning machine, Or very state and symbol, there are a group of actions the TM can have. So here the tions are not deterministic. The computation of a non - deterministic turning Aithine is a tree of conf gurations that can be reached from the start configuration. iP is accepted if there is at least one node of the tree which is an accept ©) '8ttation, otherwise it is not accepted. If all branches of the computational tree (16 Marks) V Semv (CSE/ISE) Automata Th "Y & ¢, hact on all inputs, the non - deterministi for some input, all branch turning Maching j Fi is 8 are rejected, the input is algo a ‘llled ¢. Linear bounded automata Refer Q.no. 10(b) of Mop “ Map. 10. Write short notes on: a. Undecidable languages, b, Halting problem of turning machi ¢. The post correspondence problem, Ans, a. Refer Q.n0,9(b) of MQP - 2 b. Refer Q.no.10(a) of MQP = | ¢. Refer Q.no, 10b(i) of MQP - 2, ester BE. Degree Examination CBcs » CBCS - June Somat . ae same July 2018 ity ee Max. Marks: 80 clin ONE full question from cach module, ‘eh Sem E full questions, sel Module - 1 ana neat diagram, explain a hierarchy of tangy with * fe ‘ge classes in automata theory, (04 Marks) w Regular language FSMS, Turing machines, Grammar Language Automaton Type- 04 “| Recursivelyenumerable | Turing machine | Type-7 | Context sensitive Linear bounded Non - deterministic Turing machine Type-2 | Context free Non determinstic pushdown automata f>———} —______| pushdown automata _| Type - 3 Regular. finite state automaton ‘Defne deterministic FSM. Draw a DFSM to accept decimal strings which are divisible by 3, : (06 Marks) M% Siep |. = {0, 1, 2,3, 4,5, 6,7, 8,9} K=3 After dividing by 3, possible reminder are 0, 1, 2 Compute transition 8(q,a)=q, where j =(r* i +d) mod K wih r= 10 and K =3 {0,3, 6, 9} leaves 0 as reminder) (1,4, 7} leaves 1 as reminder) » 5, 8} leaves 2 as reminder) ean Scanner ‘ : oo 16 (10 #0 +0) Mod (10 #0 + 1) Mod 3 (10 #0 +2) Mod 3 = 5, (0,3, pe 5G, {1,4 7}) 0 5 (Ge (2, 5, 8)) = (10 * | +0) Mod (10 * | +1) Mod (10 | +2) Mod 3= (10 *2 +0) Mod (10 "2+ 1) Mod (10 *2+2) Mod 3 = 4, (a; £0, 3, 6, 5) Bq, {1,427}. 2° 5G, (2, 5,8) <8 5» (0, 3, 6,9 Sy (1, 4,7) N= Bay 2.5, 8)) = OQ Start (%) Also write transition table for DFSM. . Step 1: - Identify start state Q, ={q,} Step 2 :- Identify alphabet = {0, 1} Step 3 :- Transitions Input symbol =0 8 (gy) = Fy (Lah O)= £4.94} For state t4,. 4} 8 = Chay. g,3, 0) =8, (44. 4,3, 0) = By (qq 0F U8,(q, 0) = Ade Wi AG = {Oy dy yh For state {q,} Input Symbol = 0 85= (ta,), 0)=8, (44,3, 0) For state {q,, q, Input Symb 85 (4 Gy Gy}, 0) =3y (ay 4, 4,}5 0) 8, (44,03 U8y(q,, 0) U8\(g,, 0) =e FV 195} 10) = fq. Ww 4} For state {4,,4,} 7 y= (14s G3)5 0) 1 Gah 0 (4, 45}, 0) 8, {,, 0} V5(q, 0) = ta) b= ta) Forstae fq} Input Symbol = 0 8 = (tag}, 0) = 8 (4,3, = 19} 8 = Cagis = 8y (laghs D> tah (06 Marts) Input symbol B= (ayhs IF (Ido), D= tad 8p = (hy) = By Udy Qs BD yy, 1) Y Gp = 1g) Ya eG} Input Symbol i BL= (dy dy Qh. = 8, (Ly. dy he = By dy I UBM gy 1 YG» ) = tah U tag) Utd) = (40 B= Cdn a}, = Sy (hay ah D b= (tas ay} eee te 5a! = {g,} U tq) = ad Input Symbol = 1 Sunstar Exam following finite automata (Refer Fig 2a,) pis . (06 Marks) ss Sip Li a | 4% 4s ga, | X |X |x| x Step 2: 4 1% | 4, | 4, 8 a b_] (p,q) | Gs) | Gs) (o> 4) | (ys 43) J C45 4) (qo. 2) | (44) | 5» 44) |» (Go 4s) | Qi 4) | (Is Ie) (Gy 4) | a» 4) | Gy 4) (43) | Gy» 4) | Gy 44) (a. a,) | 4) | Gs 4) a | x a, | X qa, | x a | X |X |X] Xx 17 ‘ V Sem (CSE/ISE) oo | Gs) | Gs) (a4) | Gy 4) | Gy a) (a9) | Gy) | Gn) (aya) | 4,4) | @y a) None of the unmarked pairs (r, s) are marked in table. Step 4 :- (q,) (4, 4: 4) (Q,) State a b ds (a, 4,9) | (4, 4)) | (4,459) | (4. 4; 45) () @ (a) @o, Construct a mealy machine for the following i) Design a mealy machine for a binary input sequence. Sueh that if; 101, the machine outputs A. if input has substring 110, the mach otherwise it outputs C. ii) Design a mealy machine that takes binary number as input complement of that number as input. Assume the string is read from LSB to MSB and end earry Ans. i) Ca = it has subst hine outpus.5 and produces24 is discarded. (06 Marky Start il) ol vl ; 7) i & Convert the following meaty machine to moore machine (Refer ig 2.¢) (04M) : wz, Qoz, 4 Z, 18 OZ, Sanstar Exar Module - 2 regular expression. Obtain a regular expression for the followiaig language: ar b® [m+n is even} arb" [m2 1 n> lnm > 3} u where W € {a, b}*} (08 Marks) peinition = Refer Q.No. 3.2, of MQP - | 6 atb) (a+b) * or Re =(a a) * (bb) * + aaa) * b(b bye j) Re=aaaa*b + abbbb* + aaa* bbb* ii)Re=((a+ b) (ab) (a+ b))* 1 Design an NDFSM that accept the language L(aa*(a + b)) (04 Marks) ys Deine if | | | ic Convert the regular expression (0 + 1) *'1(0 + 1) to NDFSM (04 Marks) . au Qy “OS T OR ty Teh dag grammars define exactly the regular language, then prove that the meuage eUt8es that can be defined with regular grammars is exaetly the regular 1 Wee (04 Marks) first eed that any languages that can be defined with a regular grammar can be fea be eee 20M" FSM and so is regular. Then we must show that every regular language Rear oret with a. regular grammar. Both proofs are by construction. Pinar gee FSM : The following algorithm construct an FSM M from a regular Bag gv RS) and assures that LCM) = LCG ): 19 ik ‘After 5 Ans. V Sew (CSE/ISE) + Refer Q.No. 3b.0fMOP- 1. for regular language. - Define a context free gramma grammar) = G : regular gramn / ore ate for each non terminal in V, onding to $ the start state, the form x w, for some w é ¥, then ce: in Rol hence mg grammar to FSM 1, Create in Ma separate 2. Make the state corres} 3. If there are any rules i It ate labeled #. _ / i For each rule of the form x — wy, add a transition from 2.0 y labeled wy, S Por each rule ofthe form x Wadd a transition from x to labeled, 6. For each rule of the form x > &, add a transition from x as accepting, 7. Mark state # as accepting. § If M is in complete, M requires a dead state, Add a new state D, For for which no transition has already been defined, create a transition fro i for every i in Z, create a transition from D to D labeled i. me ig m4 to Dia Prove that the regular language are closed under complement, inj differenee, reverse and letter substitution, ie i) Under complement :- Let MI = (Q, ©, 8, dy. F) bea DFA which accepts they i 1. Since the language is accepted by a DFA, the language is regular, Noe ley the machine M, = (Q, 5. 5, q,, QF) which accepts I. Note that there in no df between M, and M, except the final states. 7 The non - final states of M, = are th final state of M, and final stat of M, are the "on ig states of M, so the language which is rejected by M, is accepted by M, and vce ay Thus we have a machine M, which accepts all those strings denoted by | that are je by machine M,. So regular language is closed under complement. ii) Intersection :- (Q.E,5,.q,. F,) which accepts'b, QE, By. dus Fy). which aecepts L, Q=Q xy a (4.9,) where q, and q, are the start states of machine M, and M, respective. (4,0) EP, and 8,(q,.w) ef, . and only ifw € L, 9 L,, So the regular language is closed under intersection iii) Difference M,=@Q2.5,.q,F) OL M,=(Q.2,8,.q,,F.) > L, SQq.qQw)isinF 7 ie, cua eh and B,a,W)eF, iv) Reversal ae is close under difference. ind letter substitution LEE) = (Lie) Refer Q.No, 3b. of MQP- 2, State and prove pumping lemm ou Module - 3 vot {W} 0,07) = 1,0} Obtain the grammar to generate (ogy Se , S—asb Sunstar Exe ag /july 2018 oo tsymbol regular expression (OL + 1)* (01)* obtain the context free grammar, por the ak (04 Marks) j sO LAJOIS ActS|e s i start symbol. ¢ What is ambiguity? Show that de following gram — §aB] DA Acris [DAA [a B—bs|aBB |b. : 4 (08 Marks) us Agammar G is ambiguous if and Only if thefe exists atleast one string w eT * gop ‘hich two or more different patse trees exist by applying either LMD or RMD. $=aB s $= mBB aN | SsaibsB a S=aabbAB Lh B. | S=abbaB \ $= aabbab at is ambigugous, Ssap . 1 iS BB a 5 2abB : SS aabps i“ » S aabbaB, é oad ®abbab io - & se tree for same string, " mmar is ambiguous, Few Sekinay 21 V Sem (CSE/ISE) Automata Theory & 7 OR Comba 6. a, Define PDA. Obtain to accept the language 1(M) = fw C wi) | y ¢ i wig reverse of w by a final stat yy, Ans. Refer Q.No. 6.. of MQP- | (ine b. For the grammar S— aABB | aAA A—aBBla B— DBBIA Coa Obtain the corresponding PDA. Ans. Refer Q.No. 6.c. of Dec 2017 / Jan 2018 (04 May ¢. Obtain a CFG for the FDA shown below: (qu a, Z) = (Qu AZ) Mays 8) A) = (Gy A) A(qgy b, A) =(Q, £) Ng, & Z) = (qy, 8). Ans. * (04 Mans For 5 of the form Resulting production bq, a D} (a Zq)—a 5(q,. aA) =(q,, 8) (q,A4,)—> a 8(q,. B.A) =(q,, 6) (Aq) >b 54, & = (4,08) (4,2 4,) > 8 For 8 of the form Resulting production 5.2 2) (Gye) (4Zq)—a Flap @AY= (45, ee] (Gy Z 4,) = a(4,4 9,) (4, Z 4.) Lala, AG) (a, Za) | a(q, A q,) (q, Z ag) | a(q, A 4) (45 Z 4) (4,2 4,) — a(a A 4) (q, Z 4,) | Ca, A 4,) (4, 24) a(q,A.4,) (q, Z q,) | a, A 45) (4,2 4) (4,249) > a(a. A 4,) (4 Z 44) | a(4, A 4) (4, 24) Aq, A q,) (q, Z 4.) | aC, A 43) (452.99) (4, Z 4,) > a(q, A q,) (4, Z q,) | a(q, A 4,) (4,24)! — qs g,) (GZ d,) La(qyA 45) (4,249 (4; 2.4)) > (4,4 04) (4, Z 4) (GA 4) (4, 20)! (4A 4,) (Q, Z 44) | (Gp A 99) (452% (432.4) > (q,A a9) (dy Z4,) | (G4 4,) (4 240! (QA 4.) (4, Z 4) | (4g A.4) 209 952-4.) > GG, Aa) (q, Z 4.) | (QA 4) (12%) ()A.a,) (4, Z4,)| A 9) 2 ® (24) + (qA.q.) (a, Z4,) | (G44) 2% aaa (aA 4) (G,Z. 43) 1 GA 9) 2 8(q & 2) = (qu. Az) 22 Sunstar Cea igor the 8 B “onal arama in CNF, on obtain acl B50 5°" [Given production Action Resulting production $— 0A| 1B Replace 0 by B, S—B,A|B,B B,>0 B,>0 Replace IbyB, |B,>1 Bl A 0AA| IS Replace Oby B, |A—B,AA|B\S BO B,—>0 Replace | by B, |B, 1 BI B— IBB| 0S Replace 0 by B, ” B= BETBS B,—0 ae Replace | by B, % str, Bol | CosiderA> B,AA and B > BBB A+BAA= A— B,D, D, AA 3~B,BB => B B,D, D,—BB | G'=(V',,P4 S) is in CNF where | \\= (SA, B, BeB.. D,, D. T= {0,1} a! S—B,A|B.B | AWB, S| 1 Bi D, BoB, 8 | BI D. B90 BI DAA 0, BB Sis the stant symbol Ne Pega us shot Ine oi is not context free. (08 Marks) of Fete Seana ae V Sew (CSE/ISE) OR um, explain the working of of MQP- 2 8. a. With a neat di Ans. Refer QNo, a basic Ty ig Mching b. Obtain a Turing machine to aeeept the language t= Or yey My Ans, Refer Q.No. 9.2. of MQP- 1 (Hy, «. Briefly explain the techniqu Ans, Refer Q.No. 9.6.) of MQP = | or TM construction, (ty Module-5 9. a. Obtain a Turing machine to recognize the EVEL (O15 Ans. States 0 1 2 z ML asxR Ge YR a [q.0R[qvR aR + 4 RT 4, Z, Lge a | at Pq WoL TOL 4 GZ [o.¥R % GZR cn b. Prove that HALT), A@LW)| the Turing machine M halts on input Wi undecidables Ans. ReferQ.No. 10.a° of MQP- 1 © With exam Ans Refer Q.No, (O4 Ma les explain the quantum computation, Cae 10.b4i) of MQp.2 OR 10 Writea short note on: 4%. Multiple Turing machine >. Non deterministic Turing machine © The model of linear bounded automaton tt he post correspondence problen Ans. a) Refer QNo. Sibi) of MOD. >) Refer QNNo. 9. of Dee 2017 / Jan 2018 © Refer QNNo, 10.6. of MOP - 1 4) Refer QNo. 106 of MQp..2 24 er B.E. Degree Examination, CBCS - Dee 2018 / Jan 2019 Automata Theory and Compatibility Max. Marks: 80 selecting ONE full question from each module. ay EVE fe gestions, Module - 1 owing with example : ge iii) Alphabet iv) DFSM, (08 Marks) mbols obtained from the alphabets of a language is calle a string. is defined as a finite sequence of symbols from the alphabet £. bols from the alphabet 5. fol peeing ii) Lange He Tence Of SY jyme seers 96 Flys a SHINE fem’ ence of SYM seater can be defined as a set of strings obtained from 5* where & is set of ticular language. In others words, a language is subset of 2* which ofa pal by LE. 0.1, 01, 10, 1100, OOH ....} F gage consist of various symbols from which the words, statements ete. can ved, These symbols are called alphabets. A,B,C yovesZatts bya Oe Joon 5 ecb} Finite Automata (DFSM) is 5 - tuple or quintuple indicating five be obtain px:5= {a,b ix) Determinis components M = (Q, 5, 8.4. F) Where M is thename of machine Qis non - empty finite set of states Sis non - empty finite set of input alphabets 8 is transition function QxZ—> Q q, € Qis start state Fc Qis accepting or final states 4, Design a DESM to aecept each of the following languages : i) L= (We (0, 1} 2 W has 001 as a substring} iL= QV € fa, b}* : W has even number of a's and even number of b’s). (08 Marks) (_) I 1 (a) 0 0,1 a iy 28. Theory V Senv (CSE/ISE) Automata y 2d Compa 2. a, Define NDFSM. Convert the following NDFSM to its equivalent DFS (08 May 0 ' Ans. Refer Q.no.!(c) of JuneiJuly 2018, b. Minimize the following DFSMs wud Ans, lo] >A B F B G Cc reps DaINCalecay E H : F Cc 5 G G z H G To 26 . ‘Sunstav Exam 9002018 / Jowv 2019 | step !* 28 V Sem (CSE/ISE) Automate Theory ande oO (BAH) | (RF) (BY) (DF) [CO [GG (E.G) [@.G) [BEY Indistinguishable pairs : (A,E). GH) & (DF) Distinguishable pairs : C & G Minimize DFA: Step 1: (AF). (BH) & (D,F) Indistinguishable pair €,G distinguishable pair, Step 2: States in minimized DEA’ (AE), (BAH), C: (DB), G Step 3: 5 0 | (AE) | (BYH) ] (D.F) (B.H) G Cc ¢c (A,E) ( (D,F) c G G G (AE) Step 4: (A.E) is start state & C is final state OT r 2018 /Jow2019 é Module - 2 n and write R ge Regul expression for the following 3% yngtteee jew fn 20, 20) poe mz tne 1ynm 23}. 3 orca of Jae uly 2018 Fr deintion an i eee yp Riga aad” (00)" £. bh os the . « pine Rela expression oF he ling FSM (08 Marks) , 0.1 eis vs OES 0+ D* OR a Dene a Regular’ grammar, Design regular grammars for the following languages. ) Strings ofa’s and b’s with at least one a, i) Strings of as and b's having strings without ending with ab. i Strings of 0’s and 1 ‘s with three consecutive 0's. (08 Marks) i)A grammer G is 4 - tople G = (V,T,P,S) where Visset of variables or non - terminals Tisset of terminals Pis set of production, Sisstant symbol & iV= {SA} T= (Q Pt S48) Set } Sisstart symbol US aAlbs AM aAl bB {2 aA] bs |e PES A000 ASOAJIAle % SSthe start symbol : Fran Scanner 29° V Sem (CSE/ISE) b, State and prove pumping theorem for regular |; Ans, Refer Q.no. 4(¢) of June / July 2018, Module-3 languages, 5. a. Define context free grammar. Di ign a context L=(0" 1" 2*|m20,n>0) ii) L L= {a b™ | n> 3), rQ.no. (a) of June/July 2018 > AB A> O01/)AL SoB A>aAla B= bBIb ' ; Sis start symbol iii, V= {5,Ay T= {a,b} Bat Saaad Amable } S is start symbol b. Consider the grammar G with production, SAbB ASadle B—aB|bB] < he si Obtain leftmost derivation » rightmost derivation and parse tree for if 4s) aaabab, : oF Ans. S = ABB E=> ABB => AbaB => aAbB = AbabB => aaAbB .. => Abab = aaaAbB = aAbab = atabB = aaAbab => aaabaB = anaAbab > aaababB => aaabab = anabab 30 9002038 FJOWsLULS & jaca PDA, Obtain a PDA to accept fine 3 oD Draw th evar bY |W € {@, b}*}. Draw the transition diagram, ' oo Gta) of June /July 2018 gram (08 Marks) {4,091 92 marks r= {aZ,) ‘ : 8(q, +8 + 2) =, aZ,) | &(q, 54) =(4, » 2a) &(q,.b.a)=(q, &) | &(q,- ba) 5q,.6.2,)=,.Z,) qe Qis the start state of machine Z,€Tis the initial symbol on the:stack F= {q,} is the final state CO: ale a, Z/aZ, yd a, vaa bale 22/2, § Convert the following grammar into equivalent PDA. SsaABC AS Bla bap ly SO (08 Marks) * Sep Zi san symbol wpe (q.8Z,) Ean Scanner 31 Ans. - 32 Module-4 State and prove pumping lemma for contextfree languages. Show that L= [a" b" c" | n> 0} is not context free. (10 Mar a Benen A)= (4B) ) Bq, AD (Gy wot (a,b. B= (4 -A) aa ita, «0 B) = (4, -®) Bae Sq, ae) = (8 ZV My 2) 8 is transition in step 2 4, € Qis the start symbol Zc Vis initial stack symbol {q,} is final state fatement : Let L be the content free language and. is infinite. Let Z be sufficiently long string and z L so that | z| m where n is some Positive integer. If the string 2 cay be decomposed into combination of strings z = uvwx: Such that |ywa] n.|vs) 1 then uv'W'V' for i=0 Proof of Pumping Lemma: . By pumping demma, ibis assumed that string z L is finite and is context fe language, We know that 2.48 string of terminal which is derived by applying sens of productions, Case 1: To generate a’ sufficient | fecursive. Let us assume that the long string z, one or more variables must be language is finite, the grammar has a finite numb of wariables and cach has finite length, The only way to derive sufficiently s string using such productions is that the grammar should have one or more recuse \arlables. Assume that no variable is recursive, ' je ton terminal is recursive, each variable must be defined, Since ables are also non recursive, they to be defined in terms of terminal atd ORE Variables and so on, ft From this we cone a limit length of the string that is generated the stant symbol § Our assumption that the language is fini Therefor the OF More variable are non. recursive Is a This means that Ne OF more variable are non rectsive aM the proof, Case 2: The stn Sine lude that there i this contradicts ‘sumption that one this means that on #2 L implies that after We get finally String of te i e Applying some / all production some © Tminal and the derivation stops. ‘Sunstar p eo 2038 / jaw 2019 jently long string and so the derivation must have involved recursive terminal Aand the derivation must have the form: som "vain should start from the start symbol S, at ay ple or quintuple M=(Q, &. q,. F) ‘nis > finite set of states, 10 finite state set of input alphabet. OFF on which is mapping fom Q.X E10 Q. fr thistransitin fanetion {rte passed are state and input synbos, Based onthe current state the pao abl the machine may enter into ariother state, qo Q is the star. state. and io recepting oF final state. Note: for each input symbol a, from a given FOS ‘ » jg exactly One transition and we are sure to which state the machine enters. gate Tipe i called Deterministic Machine gothe mae far bt et | n> 0} isnot a CFL tanbnen = proof Suppose La"b'c" is context-free. Let p be the pumping lengths Prpnsider2= a Oo? Lave" since [2] > Ps there are Us. vw, x, y-stich that 2 = uvwxy. [yw] $ p. [vx] 2Oand L for all i >0. x| Sp. vwx cannot either does not hav log) vwx does have any as. arian either bs or ¢8. Hence uwy ¢ Ly wiwsy € + Since] contain ali three of the symbolsa,b. ¢, because there e any as or does not have any bs or does not have Then uv°wx’y = uwy contains more b.tiphin Turing machine model. (06 Marks) | se. Refer uno, 8(6) of Dec 2017/ Jan 2018. | OR 1 to accept the language L= {0" 1" 2*| n> 1}.(08 Marks) 4a, Design a Turing mac 4 os, Step-l: Replace 0 by X and move right, Go to state Q.1. Step-2: Replace 0 by 0 and move right, Remain on same state Replace ¥ by Y and move right, Remain on same state- Replace | by Y and move right, go to state Q2. Step-3: yi sae I and shove right, Remain on same state Relae ; Y Zand move right, Remain on same state Sepa; Zand move right, go to state Q3. a ae {and move lef, Remain on same sal Renae 2 2, td move let, Remain on same state ine 4% atdamove left, Remain on same sate -y Y and move left, Remain on same state lag Sep, bY X and move right, goto state QO. Fen Sean 33 V Sewv (CSE/ISE) Fsymbot is Y replace it by ¥ and move right and Go to state gy fe yo to step | Step-6: : Replace 7 by Zand move right, Remain on same state Replace ¥ by Vand move right, Remain on same Automata Theory and Co b. Design aT A and b’s ending with aborka (08 Maris) Ans, 34 Module-5 ¢ following ? ps Horministic Turing machine i) Muli Turi ur prone (a) of ae ly 2018 i - tape Turing machine.(06 Marks) e following : ively enumerable Ql \" efit thi si " nerve Enumerable ble language, pe-D Language (ae Mars) janguages are generated by ty ‘ OE ae erated by type-0. grammars. at pe accepted oF recognized by Turing machine which i wil jal state for the strings f language and may or may not enter into ree reforthe strings Which are not part of the language. It means TM can loop forever : «4s which are not a part of the languag e jrthe stein which are not a pi ¢ language. RE languages a c fet snuniable UEEES guages are also called as pestle mguge A rngange is called Decidable or Recursive if there is a Turing machine which apis and halts on every input string w. Every decidable language is/Turing- accuptable. agi ie into fins Non-Turing acceptable languages Turing acu languages Naa Decidable languages Adcion problem P is decidable if the language L of all yes instances to Pis decidable. 3 Fora decidable language, for each input string, the TM halts either at the accept or the reject : a ie reject state as depicted in the following diagram - Decision on Halt _ JI Rejected a © Me Or Accepted Turing Machine Automata Theory and ¢, V Sem (CSE/ISE) lence problem? e/ July 2018. OR 10.9, What is Halting problem of Turing machine? Ans, Refer Q.ne, 10(b) of Dee 2017 / Jan 2018. cc. What is Post correspon Ans. Refer Q.no. 10d) of Jun antum computer b. Define the following i) Q NP. Ans. J) Quantum Computer : Refer Q.n0 9 6 of June/July 2018 OMe iiy Class ND i Th clays NP consists of those problems that an © Vetta polynomial time, NP is the class of decision problems for whieh itis easy to gl the comestnss of acaimed asset. withthe ad ofa Fle extra noma we aren't asking for a way to find a solution, but only to verify tha a * + tan Every problem in this class Ain all ° exponen solution really is correct. be solved in time using exhaustive search. c. Explain Church Turing Thesis, (04a Ans, * The Chureh-Turing thesis coneems an effective oF mechanical method in ye and mathematic: © Amethod, M, is ca led ‘effective’ or ‘mechanical’just in case: © Mis set out in terms of a finite number of exact instructions (each instructigg being expressed by means ofa finite number of symbols) © M will, if carried out without errorsalWays produce the desired result in a finite number of steps © M can (in practicevor in principle) be carried out by a human being unaidedy any machinery, cept for paper and pencil © M demands no insight or ingenuity on the part of the human being carrying tose «They gave an hypothesis which means proposing certain facts. * The Church’s hypothesis or Church’s turing thesis can be stated as: } © Theassumption that the intuitive notion of computable fumetions can be identi ‘with partial recursive functions, © this statement was first formulated by Alonzo Church in the 1930s andis usa referred to as Church’s thesis, or the Church-Turing thesis. 36 sonst mester B.E. Degree Examination, CBCS - June / July 2019 Set Automata Theory and Compatibility . “a Max. Marks: 80 Ul question from each module. selecting ONE fu FIVE full questions, is: , “nswer Module - 1 following : i) string ii) alphabet iii) language. (06 Maris) pine the“ g. of Dec 2018/ Jan 2019 bb a afer QNO- a wt adeterministic finite State machine for the following language over 2 = peste! b tab av 3¥| mod 3,> [W] mod 2} 9 vey W ends either with ab or ba. p> (10 Marks). i) OR et note on finite state transducers. (07 Marks) i. State transducer essentially is a finite state automaton that works on two a) pes, The most common way to think about transducer i as a king of is rine, machine”. They read from One of the tapes and write-on to the other. nstance. is a transducer that translates aS into bS. fon Seamer » V Sem (CSE/ISE) Automata Theory and ¢ a: but the are means that in this transition the and writes b onto the second. Transducers can howe be sein other modes that the translation | in the generation mode Transducers write on both tapes and in a ] tapes and in the rego anit, vy they read from both ta Further more, the direction of tran around ie.. a: d Nslation ca on an not only be read as read a from the first tape and Write * tthe second tape, but also “Read b from the second tape and write a ON to the a M0 the So, the above transducer behaves as follows in the diferent mods, "fst lapg, © Generation mode : it write a string of aS on one tape anda String bg onth tape. Both strings how the same length. the they © Recognition mode : it accepts when the word on the first lape consists of, as many aS as the word on the second tape consist of bS Xaethy © Translation mode (left to right) : it reads aS from the first tapé and Writes every a that it reads onto the second tape, nb fy | © Translation mode (right to left): it reads bS from the Second tape and yi for every Fthat ir reads onto the first tape, Me ong b. Define DFSM? Minimize the following FSM, [Refer Fig,Q2(b)] (09 May a | b Ans, 38 k a A deterministic finite automata (DFA) is described by (Q,.2.8.q,,F) Qis afinite set of states isa now empty input alphabet 5 isa series Of transition function five element tuple: 4 is starting state Fis final state sep? [ [= |. (B, D) | (C.E) | (E.A) (BE) | (GF | 8B) BF) LG) [LEO (D,£) | FP) | (A,B) (D,F) | (6, £) | (AO) (EF) | (hE) | B.C) ] B[X c | x[x p[x[x]x fe |x| x[x|x FL X[xX[x[x]x (platete[ole Distinguish pairs A,B,C, D, Bok. Sine there is no in distinguishable pairs Given DFA cannot be minimized its already in minimized state. , Module-2 2 Wii . Write the equivalent Regular Expression for the given Finite sta [Refer Fig.Q3(a)] te machine. (08 Marks) Q? 39% x. Ans. = Ans, 4. a. Ans, Ans, V Sem (CSE/ISE) . Show that the language L= fa"b* | 1 + Define grammar, . A grammar G the problem given doesn’t have any transition for “rt” for the inpu > Since the be solved. oo. input 0" goes 0 “4° We get fll. ae *r for the input “0” g lovin Salo} roel" (11 #0)* 0 +8) + 1(11* O)*0}* (O45) mk Write the Regular Expression for the following language. rit i) fw fa, b}* with atmost one a} ii) (w € fa, b}* does not end with ba} fw € {0, 1}* has substring 001} / iv) fw € (0, 1}* [WI is even}. aw ay i) (b+a)b*(e+a) ii) (a + b) * (aa| ab] bb) lalb| e iii) (0+ 1) * 001 0+ )* iv) ((a +b) (a+ b))* OR State and prove the pumping theorem for regul; jar language, Refer Q.No. de. of June / July 2018 (08 Marg) n> 0} iS not regular, Step 1 :- Let L is regular and n be the number of sta (08 Mary Consider the string x = a* b* n Qn a Xsaaaaan a bbbbbbb SO SO bb w v w Step 2: Since tx | = 29 2. We can split x into uvw such that Juv] 0} U fa" b" c* | n, m2 0} (08 Marks) L any cases. when confronted with an ambiguous grammar ‘G’ it is possible to i amet new grmmar and that generates L(G) and that fas less (or no) ambiguity ca t always possible to do this. There exist context free language fortunately it is not 3 : fa which no unambiguous grammar exits. We call sue languages inherently Lefebesijk2 0,i=jorj=k}. Analternative way to describe it is L= {a" b"c™ | n. m2 0} Yu {a"b™ c" | n, m> 0} Every string in L has either (or both) the same number of a’s and b's or the same number of b’s and c’s. L is inherently ambiguous one grammar that describes itis G=5,5,.S,A, B,a. b. c}, (a, b, ¢},R, S} where R={S>5,|S, $,78,c]A AvaAble 8,a8,| B B+ bBels} _ Now consider the strings invA" B" C* = {a" b'c" : n 2 0} They have two distinct derivations one through S, and the other through S, it is possible to move that L is inherently ambiguous : Given any grammar G that generates L there is at least one Sting with two derivation in G. OR Define PDA? Design PDA for the language L= {a" b a* | n, m2 0}. (06 Marks) | i Down Automata is a seven tuple . | -Q20 3, Gs 2y F) where Q is set of finite states Z is set of input alphabets | 'S set of stack alphabets 8- transition form Q (EU e) x! to finite Suv set of Q x P* {© Qis the start state 2, € Pis the initial symbol on the stack FS Qs set of final states & 4a V Sewv (CSE/ISE) Automate Theory and Comp, HAL bape A SAL az) © (ALB) BALE A) (Q4) BALE A) (Qs (a.a/na) (a.7,/ 9%) (b,a/e) —>+(s /+——__ . Convert the followin mguage from CFG to PDA L= (ww |W © 0, 1y9), (06 Maria) a 0,00 b, 0 xe vga Convert the following CEG (0 CNFE—E+E|E*B|(E) |i. (04 Marg ‘Ans. = E> EE'|(B) +E [*E ES io] { . E— BE! [(B) BI +E *E Eid 1 } Module-4 7. a. Prove that the language L= (a b* et n> 0} is mot context free. (08 Mark) Ans. Suppose this language is contact free; then it has a context free grammar. Let a the constant associated with this grammar by the pumping Lemma. Consider # string abc, which is in L and has length greater than K. re. By the pumping Lemma this must be representable as uvxyz, such that all wv'Xy" also in L. This is impossible, since ‘ © cither v and y cannot contain a mixture of letters from {a, b, c}; otherwise Hf Would be in the wrong order for uvxy2z balance © if v ory contain just ‘a's, ‘b's or ‘c's, then uvéxy*z cannot maintain the between the three letters (it can, of course maintain the balance between tWO 42 Surstar Beant ig << or difference? x QNO- 7. of Dec 2017 / Jan 2018 (08 Marks) = OR ys son a'Turing machine 0 aecept L= fa" hee | ys 1s besgaine 8.b, of Dee 2017 / Jan 2018 [n20}. (08 Marks) vo Merl aps ea turning machine. Explain the working of F a turni chine. arke b. oH (QNo. 8. of Dee 2017 / Jan 2018 ‘uring machine (05 Marks) fer Q. js ‘tone machi © write a note on mu ultitape machine, a «Mer Qo. 9.2 of Dee 2017 /Jan 2018 (03 Marks) Ee Module-5 Writea short notes on : Growth rate of function (05 Marks) b.Church-turning thesis (06 Marks) «Linear bounded automata, . 4 (05 Marks) - ys. a. Growth rate of function : One of the most important problems in computer + seience is to get the best measure of the growth rates of. algorithms, best being those algorithms whose run times grow the slowest as a function of the size of their input. Eficiency can mean survival of a company. For example, a sort of measure 0(2 n) ona database of millions of customers may take'several days to run, whereas one of measure O(n - log n) may take only.a few minutes! However, the big O estimate, does not necessarily give the best measure of the growth rate of a function. One can say that the growth rate of a sequential search is O (n°). but one knows the number of comparisons is approximately proportional to n,n the umber of input items. We would like to say that sequential search is O(n) (it is), but the notion of big O is not precise enough. Therefore. in this section we define theta ® notation tolmore precisely measure the growth rate of functions and big omega Q | ae ‘The most important of these is O . We also define o and @ notation. | Ctre-turning thesis : Refer Q.No. 10.c. of Dec 2018 /Jan 2019 | “Mtear bounded automata : Refer Q.No. 10.c. of June / July 2019 OR WL Wes Mrite a short notes on : et £rrespondence prob is problem ra "Ng Problem in turning machine c sar apes types of turning machine. ue st correspondenee problem : Refer Q.No. 10.c. of Dec 2017 1 dant 2018 tng prev turning machine : Refer Q.No. 10.b. of Dec 2017/ Jan 20 (05 Marks) V Sem (CSE/ISE) ¢. Various types of turning machine : 1) Multiple track 2) Shift over Turing Machine 3) Nondeterministic 4) Two way Turing Machine 5) Multitape Turing Machine 6) Multidimensional Turing Machine ] 7) Composite Turing Machine 8) Universal Turing Machine | Refer Q. no 9.a, of Dec 2018/Jan 2019 ! 44 " i F Sunstar Exam 4

You might also like