Download as pdf
Download as pdf
You are on page 1of 168
FORMAL LANGUAGE & AUTOMATA THEORY “\ntroduction — Regular Languages & Finite Automata Context Free Languages Pushdown Automation Context Sensitive Languages Turing Machine & Undecidability Thank You For Purchasing VKS... ig_bihari_ NOTE: . 15 86 112 125 129 WBUT course structure and syllabus of 4 semester has been changed from 2020. The syllabus of FORMAL LANGUAGE & AUTOMATA THEORY has been Completely redesigned and restructured in present curriculum. Taking special care Of this matter we are providing the relevant MAKAUT university solutions and some Model questions & answers for newly introduced topics, so that students can get an idea about university questions patterns. INTRODUCTION Chapter at a Glance Alphabets: An alphabet 5 is a finite set of symbols. Example: LE, = (adierdse foBslots jokolomm 0, Dr Jas Sats Ua Vo Ws Xo Yo z} Recursive Languages, recursive sets: The recursive languages and recursive sets are those languages and sets accepted by Turing machines and unrestricted grammars. ; Recursively enumerable set: The sets, languages, that can be generated (enumerated) where al strings in the set, language, of a given length can be generated. If both a‘set and its complement are recursively enumerable, then the set is recursive. Chomsky hierarchy of grammars /languages Type 0, Grammar is any phrase structure grammar without any restrictions. Example: In abAbcd->abABbcd, ab is the left context, bed is the right context, cr=ab, Type 1, Grammars is a production of the form gAy->$c. iy is called type 1 production ifa 2%, In type 1 production erasing of A is not permitted. ‘A grammar is called Type 1 or context sensitive or context dependent if all the productions are ‘Type 1 production. The production S->4 is also-allowed in a Type 1 grammar, but in this case S does not appear on the R.H.S of any production, Example: In aAbcD->abcDbcD is the type | production. a, beD are the left context, and right context. Type 2, Grammars is a production of the form A->c._ where A,BeVy and a €(VxU 5)" other words, the L-H.S has no left context or right context, A grammar is called Type 2 or context free grammar if all the i 2 productions. aoe if all the productions are Type 2 p >a, B >abe, A >, are type 2 productions. Type 3, Grammars is a production $ > \.is i i ” r >is allowed in this case $ not appear on the right-hand side of any production a if 1 ; Faamiar called Type 3 or regular grammar if all the productions are Type 3 production ‘xample: (d) § ->aS, A ->a, A->aB, are type 3 productions. (ae iver A language over an alphabet A i a collection of words on A, A” denote thes nA. Thus a language L is simply a siibset of A’ : FAT-2 | AL LANGUAGE AND nar A grammar Gs defined esa quadratuple G=(V, 7, ie rep finite set of object called variables, Tis aii nef objects called terminal a «¢ Vis a special symbol called the start: Pisa finite set of productions. eg,6= ((Sh DW SP) with P given bY s > aSb sok men S=.aSD= aaSbb = aabb so we can write S = aabb. ibis a sentence in the lan; The string oabl Multiple Choice e Questions ion of Finite State Machine of that ember arbitrary large amount of information ze grammars that are regular nize grammars that are not regular guage generated by G, while aaSbb is a sentential form. 4, The basic limitati [WBUT 2007, 2010] a) it cannot rem: b) it cannot recogni: c) it sometimes recog) d) all of these Answer: (a) 2. Ashift register is a [WBUT 2010] a) Mealy Mic b) Moore Mic ¢) Turing Mc d) All of these Answer: (d) : 3. FSM can recognize [WBUT 2011] 2) a grammar dependent on characteristic of FSM b) on CFG ¢) any unambiguous grammar d) only regular grammar ‘Answer: (d) 4, Which is true of the following? [WBUT 2013, 2018] a) Merger graph is directed graph b) Compatible graph is directed graph c) Both are directed d) None of these : Answer: (b) 5. Compatible pairs are obtained from [WBUT 2014, 2016, 2017] a) Merger Graph b) Compatible Graph ©) Testing Table d) Testing Graph Answer: (a) 8A finite automata recognizes [WBUT 2018] a) Any Language b) Context Sensitive Language An) Context Free Language d) Regular Language nswer: (d) _ FAT3 IBLICATIO! 7. Maximum number of states of a DFA converted from a NFA with 7 states is MWBUT 2019) a)n b) n° c) 2" d) None of these Answer: (c) d by IWBUT 201; a Fea ens saa pect b) Push Down Automata % c) Turing Machine d) All of these Answer: (d) 9. The production grammar {S—> aSbb, S— abb} is [BUT 2019) a) Type-3 grammar b) Type-2 grammar c) Type-1 grammar d) Type-0 grammar Answer: (b) 40. The reduced grammar of S—> AB|a, Aa is IWBUT 2019) a) Sa, Ava b) Sal4A, Ava ‘ ¢) Soa d) S-aa Answer: (c) 11. What is the highest type number to the grammar given by the following production rules [MODEL QUESTION] S—Aa, A>c|Ba, Babe : a) zero b) one ¢) two d) three Answer: (d) 12.f G=({S},{a},{S S5,}5), the languages generated by G is MODEL QUESTION a)L(G)=¢ b)L(G)=a" f 9 : e)L(G)=ag d)L(G)=a"ba" Answer: (a) ; 13. Which of the following grammars generates strings with any number of 1’s? a) S>1A,AS+e b)'S315,S5¢ [MODEL QUESTION] ) SS, Se a Answer: (d) ) (b) & (c) 14. Gi : side sae ce Production of G with’ a dot at some position of the right 8) LR (1) item of G i : MODEL QUESTION] ©) Both (a) and (b) above ay ie (0) tem of G ese FAT-4 FORMAL LANGUAGE AND AUTOMATA THEORY answer? (P) which of the choice in.an operator grammar equivalent for S -» SAS/a, 15. b Assume S Is the start symb bsb| ymbol [MODEL QUESTION] A? 2S? SbAbS| a, A->b b) S+Sbsbs c) $+ SAS| a, A->bsb|b geoeeen Answer: (b) 46.Grammar S -> @Ab.A > aAb| as in MODEL a) LR (1) not in LR (0) b) LR (0) but not " LR ‘wee ¢) Both LR (0) and LR(1) d) Neither in LR (0) and LR (1) Answer: (8) 47. What is the language of the grammar with the following production rules? S— ASble [MODEL QUESTION] Aza ‘ a) {a'ch"|ne IN} b) {xcb|x< {a} *} ©) {acy|ye{b}*} : d) None of these Answer: (2) 48, A grammar has the following production: S— aSSba|bSa Which of the following sentences are in the language that is generated by this grammar? [MODEL QUESTION] a) aaaaabb b) aabbaabb ‘ -¢) bbbaabbaa d) All of these Answer: (a) 19. Take a look at the following grammar: S— AaC|Bd A> BC B-bBIC C-aces| For which non-terminals N is symbol a part st answer, 4) {4} b) {4,C} °) {4, B,C} d) {4,B,C,5} Answer: (a) of the collection follow N? Give the : (MODEL QUESTION] FAT-5 : ULAR PUBLICATIO! tions output Ssynchron, two-input, two-outpu ig legs: entered! ‘output pulse Z= 1 whenever! 1. A long sequence of Poquired to produce an a put ee forimenm th sequential circuit, which See ike eal ences are ae sequence 1111 9°CUr. ove eg tei input is raw a state diagram. i) Select the assignment and sho\ : ind output tables, e excitation ai [WBUT 2004, 2009] Answer: * 0, ge Next State, Z Present State __| Inputx=0 | Inputx=1 A AO BO B AO Co C. AO DO D AO Gl Yi, Z : Lyiy2 x0) [xet [x0 [= A>00_ [00 [or 0 0 [B>01_ [00 [11 0 0 cou foo fio fo 0 D>10 foo [ir 0 I 09] 2, What are the limitations of sequential circuit? [WBUT 2008] Answer: A sequential circuit can only represent a finite-state ma arbitrarily long sequence of input symbols is bou period not more than the number of state: needs to remember an arbitrary number of a’b",n>0, cannot be i sequential machine can chine. In such a machine, nd to create a periodic output wi id sin the machine, Thus, computations wie» past input symbols, for example in recogniat implemented by sequential machines. By the same reasoning ‘ot multiply two arbitrary length binary strings. 3. Define: (i) Alphabet . [MODEL Question) (ii) Recursive languages g (iii) Languages FAT-6 FORMAL LANGUAGE AND AUTOMAT/ cy Example: The set of lexical elements of a programming language (keywords, syntax, identifiers etc.). (i Recursive Languages: ‘The recursive languages and recursive sets are those languages and sets accepted by Turing machines and unrestricted grammars. ’ Recursively enumerable sets, r.e. languages The sets, languages, that can be generated (enumerated), where all strings in the set, language, of a given length can be generated. If both a set and its complement are recursively enumerable, then the set is recursive. (ii) Languages: A language L ove ‘words on A. Thus a language L is simp eg, 2= {a, b} then 5" = {2 a, b, aa, ab, ba, bb, aab, bbb ...} an alphabet A is a collection ‘of words on A, A” denotes the set of all ly a subset of A’. The set {a, aa, ab} is a language on 5. language. The set L= {a"b”: 20} is also a language on E. The string aabb and aaabbb are in the language L, but the string abb is not in L. This language is infinite. Because it has a finite number Gf sentences, we call it a finite (iv) Regular Languages: Let L be a language over regular expression r over A. then L is called a regular language over A. if there exists a Asuch that L = L@). perations of languages. [MODEL QUESTION] 4. a) Write down the o} fications of Grammars. b) Write down the app! FAT-7 POPULAR PUBLICATIONS Answer: : a) The operations of Languages are: (i Union: Z, UL, Gi) Intersection: L, 0L,_ Gil) Complementation: Z (iv) Concatenation: L,, = {uv|ue L,,veL,} b) The applications of Grammar are: © Specifying syntax of programming language © Representing syntactic structures in natural languages * Models of computation i : Context-free grammars are the most commonly used kind of grammar in computer science, 5. What do you mean by Distinguishable and Indistinguishable states? ” [MODEL QUESTION Answer: : fad Two distinct states, Si, and S;, of a machine M are distinguishable if and only if there exists at least one finite input sequence which, when applied to M, causes different output sequences, depending on whether S, or S ', is the initial state. ‘The sequence which distinguishes these states is called a distinguishing sequence of the pair (s,8,). If no distinguishing sequence exists for the pait (5,.5,), then the states are said to be indistinguishable. , The principle of state minimization of a finite state machine is based on the principle of identifying equivalent classes for States which are indistinguishable in the original machine and then assigning one state per class in the reduced machine, &.IFG = (S), {0, 1}, {S->081, 8+}, 5, find L(G), [MODEL QUESTION] Answer: As S- “is a production, S=> *. So is in L(G). Also, for all n 2h S830S1>0°Sl’ >... 0's I" =o Therefore, 0°" e L(G) for n>0 Hence, {0"l" |n20}c L(G) ” To show that L(G) c {0"l" |n>0}, we start with w in L(G). The derivation of w starts with S. If S- “is applied first, we get. In this case w =, Otherwise the firs production to be applied is S>0S1. At any stage if we apply S 4, we get a term FAT-8 * = FORMAL LANGUAGE AND AUTOMATA THEORY «ring. Also, the terminal string is obtained only by applying S-> *. Thus the derivation of wis of the formS>0°SI' S0°I", ie. LG) < {Ol |n 20}. serefore, L(G)={0°T" [n20} 7. For a grammar G the set of productions P is S->aA, A->bbA, A—>c. Describe the language L(G). [MODEL QUESTION] ‘Answer: $= ad= abbA => abbbbA =ab‘A>.... = ab™A= ab™e 2L(G)={ab™c/n 20}. 4. Draw the Merger graph, Merger Table, Compatibility graph and then minimize the following: [WBUT 2011, 2016] Present Next State, o/p State ip=0 lp ip=2 ip=3 A = C4 E14 Bt B EO = = = c F,0 Ff = = D = = Bi 7 E = F,0 AO D4 F C,0 = BO C4 Answer: Step 1: Draw the arc of compatible pair. Compatible pair means that two present state entries of the next state should not conflict. Here AB, BC, EF, etc are non-conflicting pair. On other hands DE is a conflicting pair, because output of I; is conflicting i.e. B consist the next State output of |; is 1 whereas E contain 0. Similarly CE, DF are also conflicting so these are non- compatible pair. Note: now the merger graph displays all possible Pair of state and their implied pair, and since a pair $1.22 is compatible only if its implied pair is. lp 2: Check and determine whether the implied “aad are indeed compatibles. A pair (SpS;) is compatible if no arc is drawn between vertices Sp anit sPace of an interrupted arc, the entry (S,S,)'s crossed off, 'Signored, and S, In such a case, if (S,S,) is and the, corresponding FAT-9 at (CE) be compatible, but sing th be compatible is th F) to pati atible and the arc between p Tis the condition for (Bi ti Ligets drawn between C and £, (CE) is incompatible es B and F are incompatible. Next, it is necessary to check Wheth Py ther implied pair, that is if apy" Is ignored. Thus stat incompatibility of written in the spact remain in graph, a regarded as solid ones. The merger graph of M ! (AB) (ACK(AD), (BC), (BD), (BE) (CD), (CE) (EF) a which covers original machine and cap In order to find a minimal set ‘of compatibles, Cae used as a basis for the construction of the minimal machine, it is often useful to fing set of maximal compatibles Recall that a compatible is maximal if it is not containes; any other compatible. In terms of the merger graph, we are looking for cma polygons which are not contained within any higher-order polygons. [A comeg peibgor is one in which all possible (-3) n/2 diagonals exist, where n isthe fee sides in the polygon.] Since the states covered by a complete polygon are all pair is compatible they constitute a compatible; and if the polygon is not contained; higher. bd complete polygon, they constitute a maximal compatible. order In the merger graph the set of highest-order polygons are the (ABCD) and the arcs (BE), and (EF). Generally, after a complete polygon of order 1 has been fo oe polygons of order n -1 contained in it can be ignored. Consequently, the fae aie etc., are not considered. Thus the following set of maximal compatibles for machine if {(ABCD), (BE), (CF), (EF)} : (BE) does not invalidate any of e of another interrupted arc, fier all the implied pairs have and so on. The interrupted ar; Not been verified to be compatipytish le ate achine M reveals the existence of compatible pairs: requited 6s pci of pees cee a synchronous sequential circuit, which is an outpu = Overlapping sequences ae ee z=1 whenever the sequence 1001 occurs. i) ane a state diagram ii) Select an assignment and show the excitation and output tables. [WBUT 2015] Answer: a) i) FAT-10 TeLva Is10z nam “seouen Jo Buddeyeno sopisuog “souenbes 4040 Alene Jeye andyno se | & seyeiousg ie 1010 esuenbe§ 043 40} ]no4}9 pue dewi-y ‘e1qe9 ‘WeABEIp 10}09}0p eouENbes mej, Homsuy i oe : Istoz nam) “eujyoeus esooyy Oy seUsyoeUL Ajeo\y Bu}Mo}Io} ey} HEAUCD “E L 0 i 00 | oled 0 0 00 ol W€0 0 0 i 00, 10€d 0 0 10 00, 00€V Txp ox} exp ox ZAI] Z TAIX ro ov. a. ov. od 2 (ie) ov |. a Oo" 2 Vv ye T=ximduy | 9 =ximduy Z OWIS IXON pe ee «@ ui WIN IV ONV (Or POPULAR PUBLICATIONS Answer: Sequence detector: Vp: 01010101: op: 00010101 0 Diagram St Next State Present State TP=0 P= a BO AO B BO co c D,0 C0 D AO Gl Table <. Kemap: Let A00,B>01,C>10,D>11 Present State Next State ip=0 ip=1 YN | WW 4 | Un 2 A 00 01, 00, 0) B 0 1 ol, 0 10, 0 Cc 10 : 1 0. 10, 0 TI 01, 0, TO, T FAT-12 ae ayy EV Ye Circuit: a wl Ye ee eer eed rere Kot 1 (in) + Gn) 5. Draw the merger graph, merger table, compatibility graph’ and then find the minimal closed covering with justification of the following machine: PS NS, ofp NS, o/p, ip =0 ip=1 ip =2 2 = C1 El B E,0 = = c F,0 F4 = 2 = = Bt = 7 = FO AO i , E C= 7 B,0 C1 \ Answer: Similar to Long Answer Type Questions No. 1 of ‘Chapter 1. j Dafne: Chomsky hierarchy of Languages. [MODEL QUESTION] jer: ‘Bpe 0, Grammar is any phrase structure grammar without ny restrictions. In define the other types we need a definition. : : é ® production ofthe form @Ay->Ga. v, where A is a variable, @is called the le context *eright context and a. y the replacement string. FAT-13 PUBLI iS Example: (a) i) In abAbed->abABbe' : =A . : in AC->A, A is the left context, “ is the right ary, a=* The production simply i) In if : : erases C when the left context ie A ite See ne production simply erases C When, iii) a) In C-> 4, the left and right conte: . in any context. é Type 1, Grammars is a production of the form pAy->$a. y is called type 1 production jp i in is ermitted. gas Ee eT contest seulve or context dependent if all the fal pun are Type 1 production. The production S->” is also allowed in a Type | pani but in this case S does not appear on the R.H.S of any production. Example: (5) i) In aAbeD->abeDbeD is the type 1 production, a, beD are the Jef a ‘ight context. : ip “BS eo apes 1 production, The left context is A and right context is % iij) A-> abA is a type 1 production. The both left and right context is . Type 2, Grammars is a production of the form A>a. where A,Be Vw and & €(VyU5)! In other words, the‘L.H.S has no left context or right context. A grammar is called Type 2 or context free grammar if all the productions are Type 2 productions. : Example: (6) S >Aa, A >a, B abc, A >, are type 2 productions. 4, ab isthe left context, bed is the right cont, Type 3, Grammars is a production § -> 4 is allowed in type 3 grammar, but in this.case $ does not appear on the right-hand side of any production. A grammar is called Zype 3 or regular grammar if all the Productions are Type 3 productions. Example: (d) S ->aS, A >a, A ->aB, are type 3 productions. Language: A language L over an alphabet A is a collection of words on A, A* denotes the set of all words on A. Thus a language L is simply a subset of A’. eg, L= {a,b} then : x = {A, a, b, aa, ab, ba, bb, aab, bbb ...} The set : {a, aa, ab} is a language on ¥. Because it has a fi language. The set : L= {a°b" : 20} is also a language on 5. The strin - e On At ig aabb and abb is not in L. This language is infinite, ta inite number of sentences, we call it a finite bbb are in the language L, but the string FAT-14 FORMAL LANGUAGE AND Ai TA THE REGULAR LANGUAGES & FINITE AUTOMATA @ Chapter at a Glance Deterministic Finite State Automata: (DFA) An automaton, a language recognition device, can also be defined rigorously. A determiriistic finite state automaton is a quintuple M = ; Where: © Qisa finite set of states; * Lisa finite set of input symbols; Sis the next-state function § : Qx17%.Q; © qo €Qis the initial state; « F CQ is the set of final states (or accepting states). The function 6: Q x I —>Q can be extended to the domain Q:x I*, defining the function 6* as follows: 5*(q,4)=q for each q €Q 8*(q.xa)=8(6(q,x),a) for each x €I* , a EI, The language L(A) accepted or recognized by the automaton A is defined as the set of words accepted by A. Non-deterministic Finite Automata (NFA):.A nondeterministic finite automata isaquintuple M= ; where: : * . Qisa finite set of states; * Lisa finite set of input-symbols; © is the, possibly partial, transition function © 8: Qx(lU{a}) 32% © qo €Qis called the initial state; ¢ F €Qis called the set of final states ‘ Myhill-Nerode theorem and minimization to eliminate useless states. ‘The Myhill-Nerode Theorem says the following three statements are equivalent: The set L, a subset of Sigma star, is accepted by a DFA. (We know this means L is a regular language.) Lis the union of some of the equivalence classes of a right invariant (with respect to Concatenation) equivalence relation of finite index. Let equivalence relation RL be defined by: x RL y if when yz EL. Then RL is of finite index. and only if for all z €2" star, xz €L exactly FAT-15 POPULAR PUBLICATIONS Regular Expressions/Grammars: e : ‘A regular expression E over 1 denotes a language L(t) over I. The syntax of regular expressions ig regul defined inductively together with the languages they denote: 1. The constants ¢ and @ are regular expressions, with L(e) = {e} and L(®) =, i is i ith L(a) = {a}. ‘hain I, a is a regular expression, wit ) , : : Tew Pare regular expressions, thert (E + F) is a regular expression, with L¢p 3. = L(E)UL(F). : : : 4 ite and F are regular expressions, then (EF) is a regular expression, with L((ER)) = E)L(F). : | 5. ie is a regular expression, then (E*) is a regular expression, with L((E)) = (e))*. : Precedence rules for saving parentheses: * has highest precedence, then concatenation, then +, Pumping Lemma for Regular Language: The Pumping Lemma is generally used to prove a language is not regular. 1. Choose the correct statements: [WBUT 2006, 2012] 2) moore and mealy machine are FSM with output capability b) any given Moore machine has an equivalent Mealy machine ¢) any given Mealy machine has an equivalent Moore machine d) moore machine is not an FSM Answer: (a), (b) and (c) ; * 2. Pumping Lemma is generally used for proving whether [WBUT 2006, 2016] 2) a given grammar is regular b) a given grammar is not regular ¢) two given grammars are equivalent or not 4d) none of these Answer: (b) 3. A solution to the equation R= (+ RP is [WBUT 2007, 2013, 2017, 2019] a) R=QP* b) O= RP* ce) P=RO* =PQ* Answer: (a) alee ae 4. Which of the following sets is regular? 01; a) {@:i=n?,n>=1} [WBUT 2007, 2012] md b) {a":p isa prime} °) {vars isin {0,6} } @) {a"" sn >= 1} Answer: (d) FAT-16 - FORMAL LANGUAGE AND AUTOMATA THEORY The value of L(9*) is [WBUT 2007, 2019] at ) {6} 2) {} d) none of these “Answer! () ¢. The regular expression representing the set of all strings over’{x, y} ending with xx beginning with y is [WBUT 2007, 2012] a) x(x y)*Y b) yy(x+y)*x c) y(x+y)*2xx d) y(xy) #20 ‘Answer: (d) 7. Regular expression (a| b)(a| b) denotes the set [WBUT 2007, 2012] a) {a,b, ab, aa} b) {a, b, ba, bb} o){a,5} d) {aa, ab, ba, bb} ‘Answer: (4) : 8, Palindromes cannot be recognized by any FSM because’ __ [WBUT 2007, 2012] a) an FSM cannot remember arbitrary, large amount of information b) an FSM cannot deterministically fix the mid-point c) even or the mid-point is known, an FSM cannot find whether the second half of the string matches the first half d) -all of these ‘ Answer: (c) 9. IfS is the number of states in NDFA then equivalent DFA can have maximum of : [WBUT 2008, 2019] a) Sstates b) $-1 state c) 28states d) 28-1 states Answer: (c) 10. DFA has [WBUT 2008] a) single final state b) more than one initial states c) unique path (for a set of inputs) to the final state d) all of these Answer: (c) 11. What is the highest type number to the grammar given by the following Production rules S—Aa, A—c|Ba, Babe [WBUT 2008] a) zero b) one c) two d) three Answer: (d) 12, Given an arbitra jth n states, the maximum number of states in an : ry NDFA with 1 states, equivalent minimi: i [WBUT 2008] ut minimized os is at least AT d) Nene of these Answer: (4) 13, Whi i th t of all Which of the following regular expressions over {0, 1} denotes INBUT 2008} Strings not containi i taining 100 as a sub-string? rate i ” a) 0*(1*0)* b) 01010" cc) 0*4*01 d) 0*(10+1) FAT-17 POPULAR PUBLICA’ Answer: (d) 44. Which of the following is regular? a) Strings of 0’s, whose b) Strings of all palindrome: length is a perfect square Stmade up of 0's & 1's [WBUT 2008, 2019) ¢) Strings of 0's, whose length is a prime number d) Strings of odd number of zeroes Answer: (4) 15. a’ (a+b) is equivalent to a) a +o" b) (ab) Answer: (d) 46. Which is true of the following? a) Merger graph is a directed graph b) Compatible graph is a directed graph Answer: (b) 17. Merger table is a substitute of a) Merger graph ¢) Minimized machine Answer: (2) 18, The loop-free testing graph indicates that a) the machine has finite memory ) the machine has finite states. Answer: (a) IWBUT 2008, 2013) cab. 4) None of these IWBUT 2003 ¢) both are directed d) None of these [WBUT 2009, * b) Compatible graph d) Finite state machine [WBUT 2010] b) the machine has non-finite memory d) the machine has non-finite states 19, Input sequence of an information lossless machine can be determined from the knowledge of a) only output sequence b) output sequence and initial state ¢) output sequence, initial state and final state 4) initial state Answer: (a) 20. Consider the following regular ex Which of the following is not in the s a) ababab b) ababbabbbab Answer: (a) 21. Which of the following is correct? a) Language can be derived fro b) Regular expressions ¢) FA can be derived f Answer: (d) can be derived f rom the language et denoted by R? m the FA [WBUT 2010] pression: R=(ab-+abb)* bbab pweuT 2010 ) abbbab a) abbabbba qwaur 2010, 20481 rom the FA -d) Both (a) & (b) FAT-18 i: FORMAL LANGUAGE AND AUTOMATA THEORY pFA converted from an NFA with states can have maximum (WBUT 2008] a) n states b) nt states c) 2” states d) "C, states ‘Answer: (¢) 93. The following production rules of a regular grammar generates a language L “ g-raS/bS/alb The regular expression for Lis [WBUT 2011] ay aed b) (a+b) c) (a+b)(a+b)* — d) (aa+bb)a*b* ‘Answer: (b) 24; Moore machine output depends on [WBUT 2011] a) input b) input and present state c) present state d) none of these Answer: (C) 25. DFA has a transition function : [WBUT 2011] a) Oxd toO b) Ox>d to 2° c) both (a)and (b)_d) none of these Answer: (2) 26. If Qis the number of states in the NFA, the equivalent DFA can have maximum number of states [WBUT 2011] aQ b) Q-1 c) 20-1 d) 2° Answer: (d) i 27. What is the RE for the language set strings with at least one 4, one 2 and one 2 [WBUT 2012] a) 14243 b) 11* 22" 33° ¢)1*2*3* dd) both (a) and (b) Answer: (b) 28. The basic limitation of FSM is that [WBUT 2012, 2016] a) it can’t remember arbitrary large amount of information b) it sometimes recognize grammar that is not regular ¢) it sometimes fails to recognize grammar that is regular 4) all of these Answer: (a) 28. Can a DFA simulate NFA? [WBUT 2012] a) no b) yes c) sometimes d) depends on DFA Answer: (b) 30. The logic of pumping lemma is a good example of [WBUT 2013, 2019] a) The pigeon-hole principle b) the divide and conquer technique ©) Recursion . d) Iteration Answer: (a) ‘POPULAR PUBLICATION: an be obtained by the language. L={a'b"li2) 31. Which of the following strings Cc [WBUT 2043, 201 a) aaabbbbbb b) aabbb ¢) abbabbba d) adaabbbabp Answer: (a) 32, Which string is iot accepted by the following FSA? [WBUT 2013) Q 1 Ze 0 1 a a) 00114 b) 00110 ¢) 01010 4) 11010 Answer: (a) ; ; i 33. Regular sets are closed under: [WBUT 2014, 2015] a) Union b) Concatenation ° ¢) Kleene Closure d) All of the above Answer: (d) ’ 34. Let N be an NFA with n states and let M be the minimized DFA with m states recognizing the same language. Which of the following is NECESSARILY true? [WBUT 2014, 2015] a)ms2" b)nsm c) M has one accept state d)m=2" Answer: (a) : 35. The string 1101 does not belong to the set represented by ; [WBUT 2014, 2015, 2017] a) 110*(0+1) b) 1(0#1)*104 ©) (10)*(01)*(00+14)* d) (00#(11)*01)* Answer: (c) 36. A=(a+b)*a and B=b(a+b)* then A intersection B willbe [WBUT 2016] a) (a+b)*ab ——_b) ab(a +b) * ©) a(a+b)* d) b(a+b)*a Answer: (4) : i : 37. The string 1101 does not belong to the set represented by [WBUT 2016] a) 110*(0+1) ©) (10)*(01)*(00-+11)* Answer: (4) b) 1(0+1)*101 4) [00+(11)*0]* 38. An automata is a/an .... a) acceptor only .+ device, [WBUT 2016] b) acceptor / rejector FAT+20 fi i [AL LANGUAGE AND AUTOMATA THEORY ¢) rejector only 4) generating answer: (0) ga, k-level equivalence is possible between two finite automata. (BUT 2046] 2) if all equivalence above k -level exist between them p) ifall level equivalence up to k~I level already exist ¢) if both contain at least k number of states 4) if both contain exactly k number of states ‘Answer: (b) 49,In Moore machine, output is associated with /BUT 201 a) present state only b) next state only us i ¢) present state and input d) rione of these Answer: (a) 44, Regular grammar is [WBUT 2017] a) context free grammar . b) context sensitive grammar ¢) non-context grammar d) none of these Answer: (a) 42. Regular expression is accepted by [WBUT 2017] a) Finite automata b) Mealy machine c) Pushdown automata d) all of these Answer: (d) [WBUT 2018] 43. Pumping Lemma fof Regular Expression is used to prove that a) Certain sets are Regular * b) Certain sets are not Regular c) Certain Regular Grammar produce d) Certain Regular Grammar does not Answer: (b) Regular Expression produce Regular Expression 44, Number of vertices of a Merger graph is __[WBUT 2018] a) The number of state of the machine —b) Number of compatible pairs c) Number of states combinations d) None of the above Answer: (a) is [WBUT 2018] 45. Number of vertices of a compatible graph B a) the number of states of the machine b) number of compatible pairs c) number of states combinations d) None of the above Answer: (b) plete procedure to convert a regular that procedure convert [WBUT 2003] 1. ; What is a regular expression? Give ae Mina ®xpression into its . equivalent 91(((10)'+114)'+071 into its equivalent NFA. FAT-21 POPULAR PUBLICATIONS What is regular expression? Answer: Let : i) 5 =(10) fi) a(n tN) iii) 5 =(4 +0) iv), =51 v) 5 =0ly, Corresponding nnfa of regular expression 7; is OR, MBUT 2043 Corresponding nfa of regular expression 7; is In this way the final nfa is z FAT-22 FORMAL LANGUAGE AND At JTOMATA THEORY Table-1 pletely specified machine shown in table-1, find a minimum state incom| it for the Machine containing the original one. [WBUT 2004, 2008, 2012] reduced machin Answer? ae E E, DE Final merger graph 1 c B Compatibility Graph ~ D+—ABBE) ——*C Merger table ot ae B |v ic x | dé > [de [de | 2e "EB x v x i FAT-23 id D Next step merger table. B v Cl p|«.| « | BE E x v x x A ee cD Final merger table 3. State Myhill-Nerode theorem. es IWBUT 2008, 2007, 2008, 2010, 2013) State Myhill-Nerode theorem with the definition of equivalent relation and Invariance. [WBUT 2013] Answer: Statement of the Theorem ‘The Myhill-Nerode Theorem says the following three statements are equivalent: 1. The set L, a subset of Sigma star, is accepted by a DFA. (We know this means L is a regular language.) 2. Lis the union of some of the equivalence classes of a right invariant (with respect to concatenation) equivalence relation of finite index. i. 3. Let equivalence relation RL be defined by: x RL y if and only if for all 2 € star, x2 €L exactly when yz €L, Then RL is of finite index. 4. Prove that the language L={o" |" Answer: cee Lis regular. There exists a finite state automation m which accepts L. Suppo an pa ome Let w = alb!, Then jw{ > k. By the Pumping Lemma w = xyz where ® eal set dae ie =xy’z is also accepted by M. If y consists of only a’s or only b's the a ed bre pumber of a's as b's. Ify contains both a°s and b’s, then Wl have a’s followed b’. ‘ sation. Thus L is not regular. In cither case wz does not belong to L, which is contradict n> O}is not regular. [WBUT 2006, 2007, 2012] FAT-24 : [ATA THE 5, Minimize the following machine to-standard form: [WBUT 2006, 2008] : PS nz : X=0 Kat a EO C0 B C0 AO c BO G,0 D G0 AO E F,1 Bo FE Eo D0 G D0 Go Answer? Let’s do the partitioning process, Partitions |__ Reason “ R=(ABCDEFG) : daa (E) Ehas of p=1 on i/p=0 P,=(BCDG)(AF)(E) (AF) goes to Eon i/p = P,=(BD)(CG)(4F)(£) (BD) goes to.4 on i/p=1 a (BD) (CG) (A) (F)(£) A goes to C but F goes'to Don i/p=1 P,=(BD)(CG)(4)(£)(F) Final partition. Let (A)>a 5 nz Ss" [x20 [xsl (BD)=>B, az 30 70 (co)=>7 B }7,0 |a,0 (F)=5 y |B0 |r0 (F)>0 5 |4a1 | po o 6,0 7,0 Reduced machine 6. Prove that following identity: r(s+1)=rs+rt. [WBUT 2007] Answer: Suppose R, S and T denote the languages for r, s, and t, respectively. Now, Lis +t)=SUT. Hence Lir(s +t) =R(SUT)=RS U RT [from Set thon = Ls +t) Hence L(r(s + t)) = L(rs + rt). QED. 7. Construct a regular grammar G generating the regular set represented by P=a*b(a+b)* [WBUT 2007, 2010, 2016] Answer: Construct a regular” grammar G generally the regular set represented by Psa+b(a+b)* FAT-25 a POPULAR PUBLIGATIONS snng 0 Pe the construction is given the followin We construct the DFA corres} figure. DFA with * moves we get the DFA straight away, 3 : — DFA without * moves Afier eliminating moves, Let G={(4,,4), (,6), P, A} where P is given by A, ay 4 > ad, Arb odd Awd Aa A>b Gis required regular grammar. 8. Let R be an equivalence relation in {0} * []={0" (o], = (0}' [00], = {0} Ufo} u {0}... tk pele Ris a right invariant. IWBUT 2007, 2014, 2015] IfRisa right-invariant the for all x, y, Clearly,.[ ]p has the null-string, [0], with the following equivalence classes: zxRy => xzRyz, 0000, ete, has only the string 0 and [00]q has strings 00, 00, Suppose x’and y are j ee i trivially true, “Ude Then, x= y = null, Hence xz = zand yz = z and 2Rz is Suppose x and y are j ae 9. Hence wale We fa (Oh Yh 2s from (Je then 2 = null, ie, x2=% and Ye implying that xzRyz, Finally, ig te" 2= 0. Thus, xz — 99 and yz = 00, Hence x2= Well as yz have at le > ifs from [00] ast th iy Z has at least two O-s. Therefore XZ 35 "ee zeroes and hence both belong to [00]p, ie., xz R yz. FAT-26: FORMAL LANGUAGE AND AUTOMATA THEORY xand y are in {00}k. Then both x and y have at least two 0-s. Hence irrespective ce ; st zis, xz a5 well as yz will have atleast two 0-5 and thus bath belong te [00}. ‘hus xeRyt- Il Ry => is right invari Ts oex tha for al cases XRy > xaRy, Thus Ris right invariant, a, consider the set L={a'b/c! | where i, j,k are integers and i, j, k21. Is L regular? Justify your answer, wi pba Answer? suppose Lis regular Let n be given by pumping lemma. ais Hise kk kk .abb.. Ib... bbb... bee. ...0 Rain ienaed Be broken up as shown|y|>0 Hence ay'z € L,r20 by pumping lemma. Let aaaa.. p ZEEE 0 gO gd Begs Let r=0 has less 1’s than 2’s, thus leading to a contradiction. 10. What do you mean by Inverse machine? Write the definition of a lossless machine. [WBUT 2008] Answer: An inverse M' is a machine which, when excited by the output sequence of a machine M, produces (as its output) the input sequence to M, after at most a finite delay. Evidently, a deterministic inverse can be constructed only if Mis lossless, and it can be constructed so that it produces M’s input sequence after just a finite delay if and only if M is lossless of finite order. : A machine is to be (information) lossless if the knowledge of the initial state, the output sequence, and the final state is sufficient to determine uniquely the input sequence. 11. Convert the Mealy Machine (given below) to a Moore Machine. [WBUT 2008] Present | Next State | i/p=0 | Next State _| i/p=1 State [State Output | State ‘Output Q Q, 4 Qs 0 Q [Qs 0 a 1 Qs a 0 a 0 Qa Qs 4 Q 1 FAT-27 POPULAR PUBLICATIONS tructed form transition diagram is wi Answer: The Mealy machine const Mealy circuit iven by The equivalent Moore circuit is g 42. Construct a Mealy machine which is equivalent to the Moore machine given below: we PS Be ears % a i % % Zz 7 % @ a 7 Answer: % % % i NS, = x=0|[x=1 fo_| %1+0. | dot HL Gel |g fo | dt | a0 % [at [at FAT-28 FORMAL LANGUAGE AND Al THEO! 49, stato the aifference between DFA and NFA. os [WBUT 2009, 2010] DFA, these can be no &- transitions. Also, for a given state q and a symbol ae, Ina ye at most one entry. An NFA does not have any of the above restrictions. there can 44, Design an NFA which accepts set of all binary strings containing 1100 or 1010 as ‘substrings. [WBUT 2009, 2010, 2016] ‘Answer? 45. What is the basic difference between Mealy machine and Moore machine? [WBUT 2009] OR, Define and compare Moore and Mealy machines. [WBUT 2015] Answer: Moore Machine The limitation of FA is that its output is limited to a binary signal “accept/don’t accept”. Models in which the output is chosen from some other alphabet and in which the output is associated with the state is called Moore machine. ‘A Moore machine is a six-tuple (Q,5),4,8.440). where Q 5,8 and qo are as in a DFA. A is the output alphabet and 2 is a mapping from Q to A giving the output associated with each state. Any Moore machine gives output 2(qo) in response to input «. The DFA may. be viewed as a special case of a Moore machine, where the output alphabet is {0, 1} and state q is “accepting” if and only if 2(q)=1- _ Input Comb ckt — Present fi Outpt State Output Is Only a Function ‘of Present State! Block diagram of Moore Machine FAT-29 ow POPULAR PUBLICATIO! Mealy Machine A Mealy machine is a sequential machine in which output is associated with each State transition.‘ The. output of the vending machine example, machine. : : ‘A Mealy machine is a six-tuple M = (Q.®, A,Aydo), Where Q is 2 finite non-empty set of states, Z is the input alphabet, A is the output alphabet, A : QXE > Q is the state transition function, and A: Q xZ — A is the output function. . The 2 function gives the output symbol associated with the transition from state q on input symbol a, i.e., Mq,a)=zEA Notice the six-tuple does n machines do not have final states. ' : The length of the output string is equal to the length of the input string. The state transition diagram for a Mealy machine M is almost identical to the diagram for finite automata; the output symbol is denoted on the edge by appending to the input symbol, a Slash (°7*) followed by the output symbol. Sequential machines are used to design sequential circuits. presented in class, is that of a Mealy ot have a set of final states. That is because sequential Input | Present State [ Output | comb "| OO" cH |, Memory Hl || Output ts Function of Present State AND Present Input Block diagram of Mealy Machine OR Part also: ‘Moore vs, Mealy Machine Moore Machine: Output only depends on present state Mealy Machine: Output depends on both the present state and the present input. 46, In response to an unknown input sequence, the machine given below produces i thine if it is the output sequence 1110000010. Find the input sequence to the mac! known that its initial state is A and final state is F. [WBUT 2009) NS, z PS x=0 x=1 A 54 A) B 0.4 B41 £ E,1 B, 0 D A,0 E,0 E F,0 D4 if E D,O At FAT-30 FORMAL LANGUAGE AND AUTOMATA THEORY Answers (i This problem is best solved by tracing backwards from state F, We see that the only F, 0 entry is for E andx = 0. Hence the second-last state is E. Proceeding similarly. We get Output: 1110000010 Possible states FABDEFDACEF ABE BC But we know that the first state is A and since the first output is 1, the next state is B. Also, since the next output is 1, the next state is B or D, But we have found that this state is B or E, Hence, the state is B. So, the state transition are: ‘A> BD BD D> ESFSDADCS EDF Hence, the input string is: 0101000110 17. Is the following machine information lossless? If yes, find the order of losslessness. [WBUT 2009) Zz PS 0 Pa 0 0 1 4 ol o]c0}>| Pols] Answer: The first step of this testing procedure is to check each row of the transition table, whether there is two identical next state entries associated with the same output symbol. From the above table it is clear that, there is no identical next state entries. ‘Now we have to construct the output successor table. Testing table for Machine-M 5 Ps z=0 z=1 A (AB) = B (cD) — c = CD) D (AB) AB__| (AB) (CD) — cD = (AB) (CD) ac f= = AD Saeed a Bc. «| — cad sp |— 1 ted from the compatible pair of states of the The lower part of the testing table is construct ompa P upper part of the table. In the lower part of the table all the implied pairs have been taken, as a row heading, FAT-31 Fig; Testing graph for machine M From the lower part of the testing table it is clear that, there is no compatibl, 7 ; le pair wi repeated entries. This is necessary and sufficient for a machine to be lossless,” Mth So clearly the given machine is lossless. f In the above testing graph the length of the largest path is /= 2. Hence the order of losslessness, = /+2=2+2=4 48, Show that L = {a° | p is prime} is not regular. IWBUT 2005 Answer: L= {a : Pis Prime} Let L be regular. Let “adversary” choose n. Let z= a", where P > n. Clearly.|z|>=n. Let adversary choose a decomposition uvw satisfying the conditions of pumping lemma. Let [ul =p, Iv|=q and |w|=r So we have: q>0 ptqn ping Lemma that guage. Then there exists some positive integer 0 5u°* FAT-32 a Can be decomposed as z= Uw with — |w|sn, and 21 such that 7=uv'w, is also in L for all #=0,1,2,.... ‘The two commonest ways to use the Pumping Lemma to prove a language is NOT regular are: e show that there is no possible n for the. (there exists n), this is usually accomplished by showing a contradiction such as (n+1)(n+1) 0} Let L be regular. Let “adversary” choose n. We choose z = ab". Obviously, [2] >=n Now, let adversary choose decomposition z= uvw such that juv| <= n and [v| > 0. We note that whatever be the decomposition, the string uv consists only of 0-s and v has at Ieast one 0. Therefore, for i > 1, uv’ has more 0-s than uv and hence the string uv'w has more 0-s at the beginning than there are 1-s at the end, allowing us to conclude that uv'w is not in L. Hence L is not regular. QED. Note: Similar logic can be applied to prove the languages L= {a"b* n> 0, k > n} non-regular. 20. Draw the transition diagram of a finite state automaton that accepts all strings over {0, 1} a) having odd number of 0's: b) having even number of 0’s and even number of 1’s. [WBUT 2010] Answer: a) (1*01*)* + 1* b) (0*1#0#1+)+ FAT-33 POPULAR PUBLICATIONS 21. State the difference between DFA and NFA. [WBUT 2040 os 1 2019) Answer: The transition function for nfa valued. a Checking membership is easy with dfa where as it is-difficult for nfa Construction of nfa is very easy where as for dfa it is difficult Space required for dfa is more where for nfa itis less Backtracking is allowed in dfa, but it is not possible in every casi in nfa, For every input and output we can constuct dfa machine, but it is not ues construct an nfa machine for every input and output. . Possible to 7. There is only 1 final state in nfa but there can be more'then 1 final state in dfa, se delta is multi valued where as for dfa iti . 'S single DPN 22, Convert the following NFA to DFA. [WBUT 20: 19 O Answer: ‘ NFA State/e 0 i «SAIS [os > | Goh % cA % a DFA 2 a 9 [a] | [aoal — [al [4054] |. [40.%4]- [41592] {a.42] [a] [a] ; [4004142] | [40942] [41542] (al 6 {a.] [a] [a] ¢ $ ¢ FAT-34 23. Construct a NFA with < or / transition forr=(11+0) (00-+1)' . (WBUT 2011, 2012] Answer: Answer: The NFA diagram: ‘01 iG start & & 6 ‘According to the above diagram, the transition table will be formed as: Present ip ip state oO 1 ++ % {a0 ar} {#} a {¢) {au a2} % ae {405 41} {qo a} {a1 2} {41 2} ® {a1 2} Now, according to the above table the DFA diagram will be, ‘The DFA Diagram FAT-35 | ULAR PUBLICATION! ive Closure? Give example for both, iti 25. What are Kleene Closure and Posi DWT 34, an al OR, is positive closure? Give exa, i s star? Give example. What imple, What is Klenne’s sta van Se Por a Regula expression R, Kleene closure, denoted by R*, is defined to be ic expression obtained by concatenating zero OF more : R-s. Thus, R* = 6|R|RR| RRR...» where the vertical bar means disjunction, A. Positive closure, denoted by R+, is defined to be the expression on the other hand is obtaj concatenating one or more R-s. Thus, R+=€ RRR|RRR\... Example: i ~ Suppose R=a|bb Then, Re = e|a|bb|aalabb|bba|bbbe| R+=albb|aa|abb|bba| bbbb| ined by 26. Give the Regular Expression for the DFA using Arden Theorem. - [WBUT 2014, 2012, 2016) 1 Answer: The state Equations are N= 2+G,049,0 H=gltgl+gyl % = 9,0 : Substituting (3) in (2) we get: %=41+9,(1401) (4) We know that if R=0+RP, then R=gp* Hence, from (4), H=4i(1+01)* 05) Substituting (3) and (5) in (1) Weget: 4 = €+90+9,00 = 6+, (0+1(1+01)*00) FAT-36 FORMAL AGE AND AUTOMATA: Y org, =£(0+1(1+01)*00)* = (0+1(1+01)*00)* which is the RE for the given transition diagram. 27. Using Pumping Lemma show that L={a"b":n20} is not regular. [WBUT 2011, 2012] Answer? Let L be regular. Let “adversary” choose n, We choose z = ab". Obviously, |z| >= n. Now, let adversary choose decomposition z = uvw such that [uv] <= n and |v|> 0. We note that whatever be the decomposition, the string uv consists only of 0-s and v has al least one 0. Therefore, for i> 1, uv! has more 0-s than uv and hence the string uvw has more 0-s at the beginning than there are 1-s at the end, allowing us to conclude that uvw is not in L. Hence L is not regular. QED. Note: Similar logic can be applied to prove the languages L= {a"b* n> 0, k>n} non-regular. - Suppose L is regular. There exists a finite state automation m which accepts L. Suppose M has k states. Let w = a“b*. Then |w| > k. By the pumping Lemma w = xyz where y is not empty and w2 = xy’z is also accepted by M. If y consists of only a’s or only b’s the w2 will not have the same number of a’s as b’s. If y contains both a’s and b’s, then w2 will have a’s followed b’s. In either case w, does not belong to L, which is contradiction. Thus L is not regular. 28. Convert Mealy Machine to Moore Machine. [WBUT 2011, 2012, 2016] Answer: Poe : According to the above diagram the Melay machine is transition diagram will be, FAT-37 NSjz PS [ip=d |e | Zq Zi aan} | (9.2) Fa | (9322) {on%1}_J u NS,Z PS [p20 ip=t “fan {43,21} te [am 2) | fa 2) qu_|_{ca0 Za} {q.2i} _| so | {a0 2a) {gar 21} qu] {430.22} | {a %1} The corresponding Moore Machine will be, Present | NS State__ | /p=0 p= Output a qe qs zy G20. ge 3 22 G21 2 3 zy 30 43 de Ze Lqst gs qo Z 29. Is the following machine information lossless? If yes, find the order of losslessness. [WBUT 2011] NS,z X=0 X=1 a ‘AsO BO Co c Dit ca D BA Al Answer: * Test of information losslessness PS N x A A, B lc 4 c lp ; Pe Al FAT-38 > * FORMAL ‘Testing table for Machine-M PS z=0, = aR) c Oe. = = (cD) Deb aes an (AB) (CD) — red a (4B) (CD) AD aa ne BC = sag BD _- ali ‘The lower part of the testing-table is constructed from the compatible pair of states of the upper part of the table. In the lower part of the table all the implied pairs have been taken as a row heading. Fig.: Testing graph for machine M From the lower part of the testing table it is clear that, there is no compatibl repeated entries. This is necessary and sufficient for a machine to be lossless. So clearly the given machine is lossless. In the above testing graph the length of the largest path is /= 2. Hence the order of losslessness, y= /+2 le pair with 30. Test whether the following machine is definite or not [WBUT 2011} i) by using synchronization tree il) by using repeated derivation of contracted table iii) if the machine is definite, what is the order of definiteness? Justify. Next State Present State a=0 DO} c|m| o}a| a> a|>|0) FAT-39 POPULAR PUBLICATIONS i Answer: Level (ABCD) ° 0 1 (ac) 0 EP) 1 : 1 fj ° 2 «@ (BD) © @) 0 if 3 © ®) It is clear that the tree is terminated by rule 2. So machine is definite machine, Here k =3 Therefore order of the definiteness is 3. 31. a) Give DFA which reads strings from {a,b} and with aaa. b) Construct a DFA equivalent to if ={{4,.9},{0,1},540,{4.}} +6 is given by the state table. sce 5 [WBUT 2012) [qo qo |qt qi qi q0,qi Answer: a) b) Assuming qi to be the final state, 32. Design a Finite automata that it , see at accepts set of strings that every string ands bl Answer: oT FA that accepts set of strings that every string ends with 00 over alphabet {0, I} FAT-40 FORMAL LANGUAGE AND AUTO! ORY 33. What will be regular expression over the alphabet {a, b}, for the language Lofton n= 4m 3}? [WBUT 2013] Answer: The regular expression over the alphabet {a, b}, for the language = {atb" >= 4,m <= 3} is as follows, : Separate into cases m= 0, 1, 2, 3. Generate 4 ormore a's, followed by the requisite number of b's. $o, the regular expression for the following language is aaaaa’(h.+ b + bb + bbb). 44, Design a two input two output sequence detector which generates an output “1” avery time the sequence 1001 is detected. And for all other cases output ‘O" is enerated, Overlapping sequences are also counted. [Denote State Graph, State Table'and perform State assignment) [WBUT 2014, 2015] Answer: - Before designing this circuit some ¢ Let’s assign the input string as 1001001. yy that it will take one input at a time. The input We have to design the circuit is such a wa tan be either ‘0° or ‘1° (two types of input). The output will be also two types, either "O° or '1*, The circuit can store (memorize) the input string up to four clock pulses (1,5 10 4). Ifthe input string is placed according to clock pulses, the output is as follows: fee Be ge BA ty TP ts TO reds ee OO eel Oresonral op oo 0 1 ‘The first input at 1, is | and as there is no input from 4, to 4, the input sequence does not equal to 1001. So the output will be 0. Similar cases occur for the inputs upto ¢, - However at time 1, the input from ¢,, t0, 4 becomes 1001, hence the output ‘1’ is produced at time 1,..At time ¢, and /, the input string from 4. £0 f) at 0010 and 0100, respectively. Therefore, the output ‘0’ is produced. At 4, clock pulse the input string is 1001, hence output ‘1° is produced. As the output “I” at4, is overlapped from 4 to t, and from 1, to f,, this is called overlapping condition. larifications regarding sequence detector is needed. T0O1JO01 FAT-41 POPULAR PUBLICATIONS 1 according the followin, : gram is to be drawn i. a 8 Process. In this case the state dia; 0 mM In state S,, input may be either ‘0° of aU siven input eee is no chance tp 1001. Hence it loops on S, with output ‘0’. If the te is ‘1’, there is a chance to pet 1001 then machine moves to S, producing output ‘O°. In S, again the input may be either ‘0’ or “L. If itis 1 sae input becomes 11, There is no chance to get 1001 by taking previous inputs. But again there isa chance to get 1001 by considering the given input ‘I’. Hence it will be in state 5,.(Ifit goes to 5, then thee will be loss of clock pulse, i.e., from S, by taking input ‘1’, again it has to come to Sig ite., one extra input, i.e., one clock pulse is needed and hence the output will not be in right pattern). If the input is ‘0’, the input becomes 10 — by considering the previous input and there is chance to get 1001, so it will come to S,. In S, if it gets input ‘0’, the input becomes 100 by considering the previous input and it has a chance to get 1001, so it can shift to S,. But if it gets ‘0’, it has no chance to get 1001 considering the previous input, but there is a chance to get 1001 by considering the given input ‘1°. So it will shift to S, as we know by getting ‘I’ in S, the machine comes to S,. In S, if it gets ‘0°, the input will become 1000, but it.does not match with 1001. Therefore, it has to start from the beginning i.c., S,..As. overlapping condition i accepted, hence from the last ‘1’ of 1001 if it gets 001 only, it will give an output ‘I’. Therefore, it will go to S,. : State table: A state table can easily be constructed from the above state diagram. PS aN OM GoTo x 0 REGIE eon Soe e each aiceeide ages FAT-42 Pa FORMAL LANGUAGE AND AUTOMATA THEORY. state assignment: ‘The states must be souenet to some binary numbers to make a digital circuit. This is led state assignment. As the number of states is four, only two digit number is call sufficient to represent the four states (2 =4), Let’s assign: 5, to 00 S, to Ol, S, toll, $, to 10. After doing this state assignment the state table becomes. PS(y,y2) _NS(¥%,) ov (z) XoE0 oasanl 00. 00. OLeerOknaO or UL Oo 0 ul 10 or 0-7.-0 10 00 C1 su OT 0 0 0 00 mn 00 z=Xyyh On Oe 01 als I oro 0 Ls val 0) HL oes0ed m0 0 100 0 10-1 10,01 35. Define NFA. Construct equivalent DFA from the given NFA. St Present State next ate = qo g0, qt | 42 qi g2 qt (@ qi q2 [WBUT 2014, 2015, 2017, 2019] Answer: In automata theory, finite state machine, is a finite st State transitions and (2) is capable of transit anonedeterministic finite automaton (NFA), or non-deterministic tate machine that (1) does not require-input symbols for tioning to zero or two or more states for a given start state and input symbol. This distinguishes it from a deterministic finite’ automaton (DFA), in which all transitions are uniquely determined and in which an input Symbol is required for all state transitions. Although NFA and DFA have distinct definitions, all NFAs can be translated to equivalent DFAs using the subset construction FAT-43 POPULAR PUBI algorithm, ie., constructed DFAs and their corresponding NFAs recognize same formal language. Like DFAs, NFAs only recognize regular languages, the State able 7 q (40+) (a2) (4041) (do+ 442) (41,42) (404142) (4,42) (41.42) (41,43) a CA 36. Construct Finite Automata equivalent to the Reguilar.” Expression. L=ab(aatbb)(a+b)*b. [WBUT 2014] Answer: 37. Minimize the machine using equivalent partitioning pweuT 2018] Present state Next state, output X=0 X= A EO Da B F,0 Do c Eo Bt D F,0 B,O FAT-44 KE INGUAGE AND AUTOMATA THI Say: £0 F4 B,0 c (AC) 4,E>B,(BD)> 4, F> 8 ‘The standard form of the reduced machine is: PS | NS x=0 x=1 a [Bo Aa f__|a0 Cae a 5,0 aa o Ao a1 38. Convert the following NFA into an equivalent DFA. Answer: ri aye 40 o> % Gos I 4 % EB = % % 4% PS a ea >% (40. %) (4s 42) (gor %) (4040s) | (dor %) (do 42) (do 91) (dor 4219) [os Uv Is (402410) | (dor 422%) fo avy (409%) | (Gor 4%) FAT-45 [WBUT 2016] t sequence detector which generates an ty Srury te the parunces 4010 detected. And for all other cases output generated. Overlapping sequences are also counted. Draw only state table ang state diagram. [WBUT 2045) ‘The input string 1010100 is placed according to the clock pulses, and it looks like tke following $64.5 4° t 4 Tot ofio mae0 1 0 1 0.0 ae Nene Bee 6 6 ig: Overlapping Sequence And the output becomes as given earlier. Overlapping portion is 10, as shown in above figure. The state diagram is in following: Fig: State diagram State Table: From the previous state diagram, constructed. t a state table as follows can easily Next State, O/P Present State ~X=0 = Ss $0 a) “& $30 S2,0 Ss $0 Ss0 FAT-46 i FORMAL LANGUAGE AND AUTOMATA THEORY rind the string which is applied on state ‘D’ producing output string 10011110 ‘ for the machine given below: oy final state ‘D NS, ol p x=0 xsl A Al OF B E,0 Bl Cc D,0 4,0 D C,0 B,0 E Bl 4,0 Answer? [WBUT 2016] First we need to prove the machine is information lossless. For this we need to construct a testing table for information lossless. If the machine is information lossless then and only a single input string can be found for a single beginning state and single final state. The testing table for information lossless: NS PS_“z-0) al A= (AQ) B/E a -|B c__|(AD = D_|(@®C) = E A B AC [= = AD | - co BC_| (AEXDE) |- AE |— (AB\(BC) DE _| (ABYAC) | - AB [— (ABYBO) " The testing table does not contain any repeated entry. The machine is information lossless machine. The output successor table for the given machine: NS, i/p PS_“z-0 ZI A [- @ 0). C " i) B E,0 B, 1 C_[@,0,@1) [= D__|(C,0), (B, 1) | = Besar) BO FAT-47 POPULAR PUBLICATIONS ‘Transition is as follows: 1, 08, poo ea: 2 state B and final state D is obtained from one path with input string 10] 00, Beginnin 41. Define DFA. Derive the DFA for the jegular language 0(0+1)*1 for the 8yTbolg E=(0. 1}. BNBUT 2016) Answer: 1" part: inistic fini PA) is a 5-tuple. (Q,E, , qo,F), where. Q is a fini A deterministic finite automaton (DFA) is @ 5-tup! ; : Finite set called the states, © is a finite set called the alphabet, 8 : Q * © — Q is the transition function, q0 € Q is the start state, and F © Qis the set of accept states, 2" part: @-@--@® 42. Construct a minimum state automaton from the transition table given below: PS. x=0 x=1 Go 4 % % Gite ® 4% de 4 Breeds % 4s Ga % Is qs ds 45> Gu» 4s are final states, _ WBUT 2016] Answer: In the finite automata, the states are { 0 :{400 4042543544045} All of the states are 0 equivalents, In the finite automata, there are t ul divide the set of states into two ma Guig? ni raler kaart) 7 ». 4054>42+43>44>45} . Name this set as Sy. FAT-48 FORMAL LANGUAGE AND AUTOMATA THEORY 2,140} P= {439495} 5, :{{40»%»42} {4504u095}} ing to the same subset are 1-equivalent bes it he states belonging Ds J -equivalent because they are in the same set i string length 1. The states belonging to different subsets are 1-distinguishable. For input O.and 1, go goes to g, and g,, respectively. Both of the states belong to the same subset. For 4, and g, with input 0 and 1, the next states are G9 %31 M4 45,94 respectively. For both of the states, for input 0, the next state belongs to one subset, and for input 1, the next state belongs to another subset. So, g, can be distinguished from g, and 92. : ‘The next states with input 0 and 1 for states g,,9,, and q,, belong to the same subset. So, they cannot be divided 8, :{{4o}s{41042}{43»d4095}} qyis the single state in the subset, So, it cannot be divided. For states g, and g, with input 0 and 1, for both of the cases, one state belongs to one subset and another state belongs to another subset. So, they cannot be divided. The next states with input 0 and 1 for states q,,q,-and , belong to the same subset. So, they cannot be divided. So in the next step, $5 :{{40},{4192} {43+9495}} S, and S, are equivalent. Asstep (n—1) and step » are the same, there is no need of further advancement. Inthe minimized automata, the number of states is 3. The minimized finite automata is presented in tabular format as follows: Next State State YP=0 VP=1 {40} {a} {a} {4.42} {a} {446} {4.4095} | {4090095} | {a-40095} But {9,},{¢,}, and {q,,q,} do not exist under the column of present state. They are not States of the minimized finite automata, but they are subset of the states. In the next state Columns, by replacing the subsets by proper state, the modified table becomes Next State State YP=0 VP=1 {a0} {4092} {4042} {a9} {ada}, | {45-495} {45,400% PopULAR PUBLICATIONS finite automata, {4} will be the bepinnin riginal ate ae . qu and gyate the final states of the cai tomata. AS 9s» ny of the states as element is final sta 7 ining states contain! and, therefore, it j od in a single set {41544545} '8 the fing yas B, and {43540095} as C, the modified Minimize state, By replacing {qo} #8 A» {ao% finite automata becomes,_——yeqrSiate As gy is the beginning st ae er state of minimized finite . i finite automata, the set of se Here, all the states are contail mt /e=1 State is) 2 oA : c © le ‘le The transitional diagram of the minimized inte automata is given in following figure, 43. Design a two-input two-output sequence detector which generates an output 4 every time the sequence 1101 is detected. And for all other cases output 0 is generated. Overlapping sequences are also counted. [WBUT 2017, 2019] Answer: . The sequence is 1101. We have to start’ from Sj. If we get input 0, then there is no chance, so it is confined in S, producing output 0. If we get-input 1 then there is a chance to get 1101, so the control moves to S; producing output 0 (as we have not till got 1101 as input), In S, if we get 0 then there is a chance to get 1101 considering the last 1, so the to get | 10] so the control moves to $3 producing output 0. In S; if we get 0, there is a chance to achieve the string 1101, so the control moves to 8, aire ree 0. But in S; if we get 1 then there is no chance to get the string aay pita we have to Start again from the beginning ie., S,. In S, also, if we Sine se : po chance of achieving the input 1101 so the control moves to the rece as out wea i Bet I then the string 1101 is achieved, ae ee equence is also ack ‘ol moves Ss, so that by getting 101, the sequence detector can prods = oe the contr lo1y FAT.s9 - diagram is given below ~ ‘The state igure 1 The state table for the sequence detector, ES NS OF. x0 1 Sy S10 S20 S, $30 [S20 Ss S,0 - | S,0 Se Si, 0 S21 44, Define Deterministic Finite Automata. What do you mean by NFA a nee | Answer: Definition of DFA: DFA isa 5-tuple. (2, 2,5, do, F) Q- finite set of states ¥-+ finite set of alphabets 6 transition function b:2x0 30 — Start stable F ~sets of final states NFA with 4-moves: Let Q be finite set. Let © bea finite set of symbols. +. 6 be transition function defined as, Ox EU {A} > 2° % > be a state in Q and 4 bea subset of Q. “A is set of accepting states. So, NFA with 4-moves, is a S-tuple {Q, E, qo, 5, A} FAT-51 POPULAR PUBLICATIONS ith A ». Basically, any NFA is also a NFA with e uage for the grammar G=({5},(a,d),8,P), with p a -move 45. Construct the lang! by : S—aSb fe on Saa ' ‘ Answer: G=({S}, {a,b}, S, P) with P given by S—aSb, SA S>aSb-a>b->ab S—aS baa $ bb aa>bb— aabb i. S—+a$b- aa$ bb aaa § bbb > aaa io So, the eats is — “Equal rio. of a’s followed by equal no. of &’s with Null”, 1(G)={0"6"; n20} 46. What is Homomorphism? Find the homomorphic image ‘of L ={aa, aba} where h is defined as h(a)=ab and h(b)=bbc. _DWBUT 2018 Answer: 1" Part: Homomorphism: A homomorphism is a map between two algebraic Structures of the same type, that Preserves the operations of the structures, <. f:AB where two sets A, B having same structure. Then, say ‘*” is a binary operation, = F(*y)= F(z)" f(y) for every pair of (x, yeA 2™ Part: L={aa, aba} where h(a) = ab, h(b) =bbe h(a a)=h(a) h(a)=ab ab Hab a)=h(a) i(b) *. Homomorphic image of 7 {ab ab, ab bbe ab} (2)=ab bbe ap is— FAT-52 FORMAL LANGUAGE AND AUTOMATA THEORY “A for the followii 7, construct @ OF. Ing regular ex, ! : (11+0)*(00+1)*. Pression: IWBUT 2019] ir: Anssrction of DFA: R=(11+0)*(00+1)* 4g, Construct a Finite Automata Equivalent to the Regular expression: L=ab(aa+ab)(a+b)*b [WBUT 2019] Answer: . L=ab(aa+ab)(a+b)*b 1. a) In response to an unknown input sequence, the machine of table-4 produces the output sequence 1110000010. Find the input sequence to the machine If it is known that Its initial state is A and final state is F. PS NS, Z > | c0|e0] 0) |Joo|-[o|4 fololof-s|[5) 2} ch a) -n|-n] 0] 00] >| Table-4 FAT-53 yy R PUBLICATIONS. b) Find the minimal inverse machine of the machine given in table.5, eu; NS,Z 2004 PS tao [xed A Go [34 B | 0,0 | C1 c [Ao | B60 D161 10,1 | Table-5 OR, ‘Show that the following FSM is information lossless of finite order: NS,Z PS [xs0_ [xed A C,0 D1 B_ [D0 C1 c A, 0 B,O D C1 D4 Table-5 Also find its order of information losslessness. [WBUT 2009, Answer: a) We use the backward sequencing to get ABBDEFDACEF 1/1-1.. 0 05 0+,0°1.0 #1: Hence, the input sequence is 0101000100 b) D GI DiI Machine-M This machine is loss less of order 3. If we know the initial state and the values of three successive outputs, which are produced due to transition from this initial state, then we can determine the first input to the machine. : Now the present states of the inverse machine can be defined by a set of triples, whichis denoted by (S(1),Z(+1),Z(t+2)) where’ S(t) is the possible states of the original machine M and Z(1+1), Z(t+2) are 2 outputs. For the above machine we have the following triples: (A,0,0) (B,0,1) (C,0,0) (D,1,0) (A,1,1) (B,1,0) (C,0,1) (D,1,1) The rest of the triples are not defined. ‘ Thus the inverse machine has present states defined by the eight triples shown above- Now the next state of the inverse machine can also be defined by triples. The first member of this triple is the state to which the machine M will go first input symbol. consuming tH FAT-54 —_— FORMAL LANGUAGE AND AUTOMATA THEORY cond member is nothing but the third mem qT wet and finally the thitd member is the presen ba state table of the corresponding inverse machi Machine M ber of the present state of the inverse it output of M, ine is shown below: NS, X PS z=0 z=1 (A.0,0) “| (C0,0).0 [G00 ALD TO... [Oni (B01) 10,1,0),0_TOr,0 (B10) 1 C0.0),1 [Eo (C,0,0) 1 (A,0,0),0[B,0,1),1 (C01) 1B,1,0),1 (A. 0 (Di1,0) 1 (C,0,0),01(C.0,),0 (B11) [1,01 OAD, 2. 2) Construct a minimum state automaton equivalent to a given automation M whose transition table is given below: [WBUT 2007] Input State a b 7% [wi | 4%, qh % | 4s D qs ds. qs 5% qs % I d % qd a Answer: gi | * a] * [x as |* [x [x “a eT as|* [> [x] [x qs | fm [eT ao Fa [ae [as Fas | as Since all states are distinguishable, the DFA is already minimized. ‘FAT-55 b) Find the regular ¢ Answer: : OOTY O! tition .for the machine shown in Table. Show , 3. a) Find the equivalence partition {21 Techie and find a minimumdon standard form of the correspon sequence that distinguishes state A from: state B. [WBUT 2007, 2012, 2015) PS [xs0 [x=1 K Bit [Ht B F.4__| 0,1 c Do |e1 D Co Fd E D1 [G1 F Gt [G4 G C1 [0,4 H Co [At Answer: Po P,=(A) (B) EFG)(CD) (A) P= (A) (B) (EF G) (CD) (H) — Final equivalent partition Let a=(A,) B=(B),7=(EF G), 8=(CD), «=(H). Hence the standard form machine is PS NS, Z x=0|x=1 @ 181 lel Bolyt [31 7 16,0 181 8 180 Tyr e [31 [Tot There are no 1-length or 2-length Sequence that distinguishes A and B. FAT-56 . FORMALLANG| . wience 000 distinguishes AandB ied on state A, the output is lL nstate B, the output is 110 incompletely specified machines shown in Table-2 find a minimum-state bor containing th ees machine cot ing the original one. i WOU 2007] rable = ps [NSZ hy h A_|E,0 |B,0 BU /F,0 AO c [&- [Co DIF [D0 E (G1 [Co F[o,- [8,0 ‘ : B EF c D a CD, F SE D. Procedure” Write down all compatible pair in respective cell. « An‘? is inserted in cell where the states have conflicting outputs. Here A and D have conflicting output. Similarly AE, BD, BE having conflicting output. «Insert a check mark in cell CE because state E contain State C. : © Cross those cells having incompatible pair. Here cell BF contain incompatible pair DF so ignored the cell BF. Coinpatibitt «® ‘ompatibility Graph me (DE) (cd) ; oe {(AB), (AC), (BC), (CD), (EF)} > {(ABC), (CD), (EF)}_ is a minimal cover of ve machine, FAT-57 BLICATIOI i Table determine whether 4. a) For the following machine shown in oFngt Nesalees! If itis lossy, ‘ind the shortest output sequence produced fy tty © di input sequences with the same initial and final states. If itis lossiogs, dota order. NS,Z Ps tye [xeT A__[A0 | B,0 B C,0 D0 c D4 C4 D Bit [A4 b) Design a minimal inverse of the iashine shown ip Table WAU 2p PS [x=0 [x=1 A_|[¢,0 [D4 B [D0 [C4 ¢_[A0 |B,0 D114 [D1 Answer: 2) As another illustration, the above test is applied to machine My of Table (i). This machine is shown to be lossless of order 3, since its testing graph (Fig. a) is loop-free ang the longest path is of length 1. "Fig: Testing graph for machine My Table (i): Machine My Table (ii): Testing table for My PS NS, z PS z=0 z=0 x20 7 ¥=1 A (4B) B,0 A 4,0 BO B (CD) D,0 B c,0 D,0 Cc Gi Gl c D1 C1 D = Al D Bl Al * 4B (AC)(AD) (BC)(BD) = cD - (AC)(AD) (BC)(BD) FAT-58 FORMAL LANGUAGE AND AUTOMATA THEORY py We have the following triples: . (A,0,0) (B,0,1) (C00) 30, D, (Aylt) (B,1,0) (1) oe ‘phe rest of the triples are not defined, 1,1) ‘Thus the inverse machine has present states defined by the ei i Now te next sate of the inverse machine ca aso iednen yee above. ‘The first member of this triple is the state to which the machine M will ; 7 first input symbol, 7 will go consuming the The second member is nothing but the third member of the i machine and finally the third member is the present output of i eee ‘The state table of the corresponding inverse machine is shown below: « Machine-M" PS NS, X z=0 [z=1 (A,0,0) {[(C.0,0),0 | (C0,1),0 (ALT) | (D,1,0),1 | (D,1,1),1 (B,0,1) | (D,1,0),0 | (D,1,1),0 (B,1,0) | (C,0,0),1_ | (C,0,1),1 (C,0,0) | (A,0,0),0 | (B,0,1),1 (C,0,1) | (B,1,0),1 | (A,1,1),0 (D,1,0) | (C,0,0),0 | (C,0,1),0 (D,1,1) | (D,1,0),1 | (D1 Dal 5. a) Design a 2-input 2-output Mealy machine, which takes as input a binary stream and generates an output of 1 only when a sequence of the pattern 01011 is found in the input stream. Design should be clearly justified. [WBUT 2007, 2010] Answer: The required Mealy machine is given below: NS, Z = X=0 X=1 A BO [AO B BO |Co ic Do [Ao D BO E,0 E D0 BL FE BO [Ao Justification of Design > CDE > F) transitions can be trivially states A, C and F to state A because this letely and scanning must begin again from The forward moving (i.c., A > B Justified. Also justified are 1 transitions from indicates the sequence has been broken comp State A, We Note that the sequence starts with a 0 “nce, if the sequence breaks in any state 's Os the first possible symbol of the input FAT-59 and upon receiving the first 0, the state is B. B, D or F upon receiving a 0, we should count it and begin from state B. i : 7 POPULAR PUBL! rec State E is reached upon receiy special case. State on D101. If a 0 is received, the sequence is eee symbol ao ie the frst three symbols of the sequence to be reognized, Bue al eel ial receiving subsequence 010 is D. Hence the 0 transition from Py E should be state D. 10 Getting a 0 in the state Bisa State recognizing : ._ | Basic String | largest suffix of ‘State Basic String ~ Pending Possible basic string A c possible B o Al 1 A Cc ol BO 00 B D 010 Gl lr A E olor D0 0100 B F oe EO 01010 D FO o10110 B Fl O1011T A b) From the Mealy machine above find the equivalent Moore machine. [WBUT 2007] Answer: The Mealy machine designed in part a) produces output 1 only when there is a transition into state F. Hence the equivalent Moore machine is: NS Output a X=0 | X=1 = A B A 0 B B c 0 c [D> A 0 D B E 0 E D F 0 F B A T ©) Check whether the Mealy machine yo ini or not. Gv? Proper justification to your answer, Obtained is @ minimal one oF 1 oon 5 (BU Answer: w The designed Mealy machine is NOT minimal, If in with the initial pati? = i |. If we begin with the initi i PO = (ABCDEF), we will get P1 = (ABCDF)(E) because ae ith Eat 1 FAT-60 FORMAL LANGUAGE AND AUTOMATA THEORY ,, states D, C and 'B form independent sets but states A and F are be nguishable. _ mal machine is therefore: ‘The mini NZ PS +[xs0 [x= A BO A,O B_ [BO [Co Cc [D0 TAO D_ [BO |E,0 E [D0 [At 6.a) Finda reduced grammar equivalent to the grammar [WBUT 2009] sada, A> DBB, B-> ab, C—aB. Ansty Cis auseless symbol, Eliminating C, we get, S$ ada, A> bBB, B— ab Now we replace all occurrences of B on rhs of production using B — ab, getting: Sasa, A babab Now we similarly substitute A, getting. Saba baba which is the equivalent reduced grammar. +) Explain the concept of 2-way finite automata. [WBUT 2009] Answer: Ina one-way (deterministic) finite autom moves to the ‘next’ input, i.e., to the ‘right’ move either to the “right” or to the “left”. More formally: A2DFA isa quintuple M=(Q, Y, 5, dor) where -Y) is a finite set of input symbols, Oisa finite set of states, qy €Q is a “start state” and F CQ is a set of accepting states. 6 isa map from Qx 5. to Ox{L,R}. If 5(q,) =(p,L), then in state q, scanning symbol a, the 2DFA enters state p and moves its head “left”, if 5(q,a)=(p.R), the ata, after every state transition, the input “head” >. Ina two way finite automata, the “head’ can es enters state p and moves “right”. ~ ext ‘A accepts a string if it moves “right” It eae accepting state. : Proved that if L is a language accepted beyond the last symbol, at the same time by a 2DFA then L is a regular set. FAT-61 BLICATIOI 7. a) What do you mean by k-equivalent states? 4 TWBUT 2g, b) Minimize the following machine by partitioning the distinguishable gage’ 201) 7 fates; Present | i/p=0 i/p=1 state [Next State__[ olp | Next State | oip A E a) 7 B FE Ca) 0 ¢c E o |B 1 D F 0/8 0 E G oO |F 1 F B 0 c 0 Cc c 41_./H 0 A 1 [¢ 0 H + ¢) Give definition of lossy and lossless machine. Answer:, a) Two states S, and S, of a finite state machine are said to be K equivalent it there exists No input sequence of length K or less that produces different out upon whether S, or S;, is the initial state. (weut 2009) Puts depending b) Initial partition B= (ABCDEFGH) Partition of 1-distinguishable states = P =(ACE)(BDF)(GH) Partition of 2-distinguishable states = P, = (AC)(E\(BD\(F (GH) Partition of 3-distinguisbable states So, minimal machine has 5 states. Let us map: (AC) > P (£E)>Q (BD) R (F)-Sand (GH) >T The minimal machine is: = None NS, z Lg x=0° x=1 Pi Q.0 RT Q 7,0 SI R S,0 R,0 5 RO P.O T Pwd 7,0 ©) A machine M is said to be (information) lossless if the output sequence and the fi sequence. A machine that is not lossless is said to be lossy, the knowledge of the initial st nal state is sufficient to determine unequally the im FAT-62 Po LLAN( raw the merger graph, merger table, compatibility graph and then minimize the z machine: UT 2008] telewe Next State, ofp | Next State, ofp Present state [-7—— : n ifp=0 | i/p=1 | i[p=2 | fp=3 A = C4 E1 B,1 B a = = Cc F,0 Fa = 7 D = = B14 a E FO |A0 [D- F 7 Bo [¢,1 Answer? Merger Graph Merger Tale Compatibility Graph Bly (AB) (CF) <—— AQ, Cc | CF | EF (EF) <———. (8C) @e D|BE |v va any ae Elx [v [x [x ‘ADy Fix [ce |v |x 3B A 6B Cc D E From the compatibility graph, we get {(AB), (CD), (EF)} as a closed covering of compatibles, “ Minimal Machine : NS, z = ip=0 ip=1 ip=2 | ip=3 (AB) > @ 7,0 Bl rl @,l (CD)> g 70 rl @,l =1 ER) > 7 B- 7,0 @,0 Ba 8.8) What is regular language? FAT-63 [WBUT 2009, 2010, 2018] “= POPULAR PUBLICATIONS peurnn language is a formal language defined over a finite alphabet such tis string in the language can be: : 7 a) Accepted by some NFA/DFA b)’ Described by.a regular expression ©) Generated by a Regular (ie. Type-3) Grammar. b) Find regular expressions over D={a, 5} for the languages defined as follows; i) Li={a"b" :m>0} ii) L2={a"" 5" | n20,mn20} iit) £3={0" ab" :m>0,n>0} [BUT 2008, 2010, 2049 Answer: i) Not possible since the language is not regular. it) (aa) (bb) * ii) b+ abb* c) Find the regular expression for following transition graph. [WBUT 2009, 2010) Construct the regular expression corresponding to the state diagram given below: 2 [WBUT 2013] Answer: The state equations are H=E+G,04+9,0 ool) H=gtgltgl — (2) = 40 Substituting (3) in (2) we get: H=qltq(1+0l) (4) We know that if R=Q+ RP, then R=QP* Hence, from (4), 4 =4,1(1+01)* nS) FAT-64 << Fol LANGUAGE AND A\ gubsttutin @and (8) in (1) yet: ' Meta Fog (0#1(1+01)* 00) 7 ee(0+H(l +01)*00)* q = (0+10 +01)*00)* which is the RE for the given transition diagram. what is information lossless machine? BUT epsider the machine shown in the following table: weur 2010, aot Present State |Next State X=0 [x=1 A At (CA B E,0 [8,4 c Do [Ao D C0 |B,0 E Bt [Ao ietis machine information lossless of finite order? Ifyes, find the order p. Answer: be (information) lossless if the knowledge of the initial state, the 2) A machine is to output sequence, and the final state is sufficient to determine uniquely the input sequence. b) Step 1: Check each row of the state table for an appearance of two identical next- state entries associated with the same output symbol. Here (AC) is a compatible pair, since both A and C are the Similarly, the pairs (AD) and (BC) are compatible pairs. is to construct the output successor output 1-successors of A. an 2; If no identical entries appear, the next step i table. These pairs are used as row headings for the lower part of the testing table, Pairs (AE) and (DE), which are implied by (BC), are now made row headings, ‘and so on. Note . that contrary to the testing procedure for finite output memory, the testing table for information losslessness does not necessarily include all distinct pairs of states, but only _ thecompatible ones. FAT-65 POPULAR PUBLICATIONS Testing table of machine M_ AE : (ABYBC) DE — (ABYAC - 7 ¢ aK ) (aByBc) Testing graph for machine M ‘The testing graph G of machine M is derived from the lower half of the testing table, The testing table does not contain any compatible pair consisting of repeated entries, So the machine is information lossless. 11. Consider the following machine: [WBUT 2010) Present State [Next State __ i [iy Tk Tis Te K Paaee | rome ER ale B C0 [A160 |- c Teo [D.1]- [Ao D = E,1 [B- |- E Bo |- c,- [BO i) Draw the merger graph. ii) Draw the merger table. iii) Draw the compatibility graph. iv) Find the minimal closed covering with justification. Answer: Step 1: First draw the merger graph of machine. (scl ye c The set of maximal compatibles derives fro, A menibets tt is git m four" is given by {(ACD),(BC),BE),(DE)} the merger graph contain FAT-66

You might also like