Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
430 views
123 pages
Automata Theory
Uploaded by
Aratrik Basak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Automata Theory For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
430 views
123 pages
Automata Theory
Uploaded by
Aratrik Basak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Automata Theory For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Automata Theory For Later
You are on page 1
/ 123
Search
Fullscreen
AUTOMATA THEORY Finite State Machine Finite State Models Structure of Sequential Machines Finite Automation Closure Properties of Regular Sets Context Free Grammars Pushdown Automation Closure Properties of CFLs Turing Machine NOTE: 36 41 67 81 101 109 112 Formal Language & Automata Theory (4” Sem, CS) has been redesigned Tak ng Special care of this matter we are providing the relevant WBUT solutions of old Formal Language & Automata Theory, trom 2006 to 2011 along with th Solutions of new university papers also, so that students can get an university questions pattern: complete dea aboutPOPULAR PUBLICATIONS FINITE STATE MACHINE Multiple Choice Type Questions 1. The basic limitation of Finite State Machine of that [WBUT 2007, 2010 | a) it cannot remember arbitrary large amount of information b) it cannot recognize grammars that are regular c) it sometimes recognize grammars that are not regular d) all of these Answer: (a) 2. Ashift register is a a) Mealy Mic Answer: (d) b) Moore Mic 3. FSM can recognize [WBUT 2019) c) Turing M/c ce dy All of these [WBUT 2011] a) a grammar dependent on characteristic of ee CFG c) any unambiguous grammar Answer: (d) 4, Which is true of the following? a) Merger graph is directed graph c) Both are directed Answer: (b) 5. Compatible pairs are obtained from “ey Merger Graph c) Testing Table Answer: (a) 6. A finite automata recognizes a) Any Language c) Context Free Language Answer: (d) énly regular grammar [WBUT 2043] _-4y Compatible graph is directed graph d) None of these (WBUT 2014, 2015, 20171 b) Compatible Graph 4) Testing Graph [wBuT 2 b) Context Sensitive Language onal _sr Regular Language 7. Maximum number of states of a DFA converted from a NFA with 7 states is a)n b) Answer: (c) 8. Regular Expression is accepted by a) Finite Automata c) Turing Machine Answer: (d) [WBUT 2018) c) 2" d) None of these (WBUT 2018) b) Push Down Automata d) All of these FAT-2FORMAL LANGUAGE AND AUTOMA‘ Short Answer Type Questions 1. A long sequence of pulses enters a two-input, sequential circuit, which is required to produce an output Sequence 1141 occurs. Overlapping sequences are accepted; for example, if the imput is 01011111........., the required output is 00000011. i) Drawa state diagram. ii) Select the assignment and show the excitation and output tables. [WBUT 2004, 2008] a two-output synchronous pulse Z = 1 whenever the Answer: A>00 00 B01 00 vu _ 2 (b> 10 Too Ti To 2. What are the ions of sequential circuit? [WBUT 2009) Answer: : A sequential circuit can only represent a finite-state machine. In such a machine, an arbitrarily long sequence of input symbols is bound to create a periodic output with a period not more than the number of states in the machine. Thus, computations which needs to remember an arbitrary number of past input symbols, for example in recognizing 6’. 0, cannot be implemented by sequential machines. By the same reasoning, a sequential machine cannot multiply two arbitrary length binary strings. 3. Define Deter istic Finite Automata. What do you mean by NFA with -moves. (WBUT 2018] FAT-3POPULAR PUBLICATIONS Answer: Definition of DFA: DFA isa 5-tuple. (Q, E, 5, 4. F) Q— finite set of states E> finite set of alphabets 6 transition function 6:3x030 Go — Start stable F —+sets of final states NFA with -moves: Let Q be finite set. Let © bea finite set of symbols. :. 5 be transition function defined as, QxZU {A} +2 qo > be a state in O and A bea subset of Q. ©. A is set of accepting states. So, NFA with Z-moves, is a S-tuple {0.E, q+ 5, A} :. Basically, any NFA is also a NFA with 2-move Long Answer Type Que ition: 4. Draw the Merger graph, Merger Table, Compatibility graph and then minimize the (WBUT 2011, 2016] [Next State, o/ p_ __fip=0 itp ie cA feo [- F,0 F 7 Fo A} = Answ 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. FAT-4FORMAL LANGUAGE AND. AUTOMATA THEORY On other hands DE is a conflicting pair, because output of Is is conflicting ie. B consist the next state output of Is 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 of state is compatible only if its implied pair is, ‘Step 2: Check and determine whether the implied pair are indeed compatibles. A pair (S/Sy is incompatible if no arc is drawn between vertices S, and S, In such a case, if (S,Sy is written space of an interrupted arc, the entry (S,S,) is crossed off, and the, corresponding arc is ignored. Here the condition for (BF) to be compatible is that (CE) be compatible, but since there is no arc drawn between C and E, (CE) is incompatible and the arc between B and F is ignored. Thus states B and F are incompatible. Next, itis necessary to check whether the incompatibility of (BF) does not invalidate any other implied pair, that is. if (BF) is not written in the space of another interrupted arc, and so on. The interrupted ares which remain in graph, after all the implied pairs have been verified to be compatible are regarded as solid ones. The merger graph of Machine M reveals the existence of compatible pairs (AB), (AC}AD) (BC), (BD) (BE) (CD). (CF), (EF) In order to find a minimal set of compatibles, which covers original machine and can be used as a basis for the construction of the minimal machine, it is often useful to find the set of maximal compatibles Recall that a compatible is maximal if it is not contained in any other compatible. In terms of the merger graph, we are looking for complete polygous which are not contained within any higher-order polygons. [A complete polygon is one in which all possible (n-3) n/2 diagonals exist, where 1 is the number of sides in the polygon. Since the states covered by a complete polygon are all pair wise compatible they constitute a compatible; and if the polygon is not contained; higher-order complete polygon, they constitute a maximal compatible. In the merger graph the set of highest-order polygons are the (ABCD) and the ares (CF), (BE), and (EF). Generally, after a complete polygon of order » has been found, all polygons of order n—1 contained in it can be ignored. Consequently, the triangles (ABC), etc., are not considered. Thus the following set of maximal compatibles for machine Mis {(ABCD),(BE),(CF),(EF)} 2. a) A long sequence of pulses enters a synchronous sequential circuit, which is required to produce an output pulse z=1 whenever the sequence 1001 occurs. Overlapping sequences are accepted. i) Draw a state diagram ii) Select an assignment and show the excitation and output tables. [WBUT 2015] FAT-5Answer: a)i) ii) — mines SGEIZE Next State, Z Presemt State tout x=0 [Inputx=T A 40 | BO a 40 co a DO. AO 5 TA0 Cl YY, [Z Liye _jxo0 [xed {xr0_{ xe A>00 [00 [oro 0 B01 jo Jo em _{o [o To D>10 Cs Oe 3. Convert the following Mealy machines into Moore machine. __ [WBUT 2015] w FAT-6FORMAL LANGUAGE AND AUTOMATA THEORY Answer: Cc» : 4. Draw sequence detector diagram, table, k-map and circuit for the sequence 0101 which generates a 1 as output after every 0101 sequence. Consider overlapping of sequences. [WBUT 2018] Answer: Sequence detector: vp: 01010101 ofp: 00010101 vo Diagram Next State ] Present State =a + a = conc a) FAT-7POPULAR PUBLICATIONS K-map: Let A=00,B—01.C + 10,D>1 Present State Next State Circuit: FAT-8FINITE STATE MODELS Multiple Choice Type Questions 1. Choose the correct statements: [WBUT 2006, 2012] a) moore and mealy machine are FSM with output capability bf any given Moore machine has an equivalent Mealy machine ‘any given Mealy machine has an equivalent Moore machine ) moore machine is not an FSM Answer: (a), (b) and (c) 2. Which is true of the following? [WBUT 2009] a) Merger graph is a directed graph ¢) both are directed __-by Compatible graph is a directed graph d) None of these Answer: (b) 3. Merger table is a substitute of [WBUT 2003] lerger graph b) Compatible graph ¢) Minimized machine 4d) Finite state machine Answer: (4) (WBUT 2010) 4, The loop-free testing graph indicates that ay the machine has finite memory c) the machine has finite states Answer: (2) b) the machine has non-finite memory d) the machine has non-finite states \ 5. Input sequence of an information lossless machine can be determined from the knowledge of (WBUT 2010] _ayonly output sequence ~~ b) output sequence and initial state ¢) output sequence, initial state and final state d) initial state Answer: (a) [WBUT 2011) b) input and present state 4) none of these 6. Moore machine output depends on a) input ~_oypresent state Answer: (c) output is associated with [WBUT 2017] b) next state only d) none of these 7. In Moore machi _-4fj present state only ¢) present state and input Answer: (a) FAT-9POPULAR PUBLICATIONS 8. Number of vertices of a Merger graph is A eeame a) The number of state of the machine _b) Number of compat PF ~~¢) Number of states combinations d) None of the above ‘Answer: (a) 9. Number of vertices of a compatible graph is __ [WBUT 2018) a) the number of states of the machine__-b} Tiumber of compatible pairs c) number of states combinations d) None of the above Answer: (b) Short Answe: ye Questions 4. NS,Z Ps hh h Is A Co Ef B|co e- - cB CO A- D Bo c,- &,- Table-4t BE - 60 A- For the incompletely specified machine shown in table-1, find a minimum state reduced machine containing the original one. [WBUT 2004, 2008, 2012] Answer: Compatible pairs = AB, AD, BC, BD, BE, CD, CE, DE 1. A 2. ~N (cry (cry Bi? oF co Final merger graph De—— (ty ——+c¢ FAT-10FORMAL LANGUAGE AND AUTOMATA THEORY Compatibility Graph ap a o Be Merger table B fy a | v « [ce | CL ey ee) || ce 4\(Be D Le | de | BE 7] eE| « v 2 ~ |e fae EK] — j——} 1 E| «|v x x A BC D Final merger table _____ DWBUT 2006, 2008} 2. Minimize the following machine to standard form: NS, Answer: Let’s do the partitioning process. FAT-11POPULAR PUBLICATIONS Partitions | Reason P,=(ABCDEFG) P.=(ABCDFG) (£) | Ehas of p=1 on i/p=0 P,=(BCDG)(AF)(E) (AF) goes to £ on if/p=0 P, =(BD)(CG)(AF)(E) (BD) goes to Aon i/p=! P, =(BD)(CG)(A4)(F)(E) | A goes to C but F goes to D on ifp=l P.=(BD)(CG)(A)(E)(F) | Final partition. Let (4)>a@ (BD) > B (CG)=y7 (F)>6 (F)=e Reduced machine NS {Ps | x=0 [| x=1 a |50 | 7,0 B 7,0 @,0 Y EO || ao 5 |41 | Bo [tO lemel| 265 Ole ern Omee| 3. 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, & deterministic inverse can be constructed only if M is lossless, and it can be constructed so that it produces M's input sequence afier 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 4. What is the basic difference between Mealy machine and Moore machine? [WBUT 2009) [WBUT 2015) oR, Define and compare Moore and Mealy machines. FAT-12FORMAL LANGUAGE AND AUTOMATA THEORY 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,°,A,5.2.q,) where Q, 97,8 and qy are as ina DFA. A is the output alphabet and A is a mapping from Q to A. giving the output associated with each state. Any Moore machine gives output 4(q, ) 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 Input ' | 7) comb ; cu esses | J | F come | 20" Block diagram of Moore Machine of Present State 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, presented in class, is that of a Mealy machine, ‘A Mealy machine is a six-tuple M = (Q.E, A,A,qo), where Q is a finite non-empty set of states, © is the input alphabet, A is the output alphabet, 4 : QxE — Q is the state transition function, and A: Q x¥ -> A is the output function. The % function gives the output symbol associated with the transition from state q on input symbol a, i.e., 2q,a)=2€A Notice the six-tuple does not have a set of final states. That is because sequential 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. FAT-13POPULAR PUBLICATIONS me | rag LF | | L_J wey |- | 1=| L }) Output s Function of : Present State AND Present Input Block diagram of Mealy Machine OR Part also: Moore vs. Mealy Machine Moore Machine: Outp ut only depends on present state Mealy Machine: Outpi tut depends on both the present state and the present input, 5. In response to an the output sex known that its initial state is A and final state unknown input sequence, the machine given below produces uence 1110000010. Find the input sequence to the machine if it is F. state | [WBUT 2008] NS eee PS x=0 x A Bi C0 B D4 Bf c et BO D A,0 E,0 E i) D1 | (Fo | DO at Answer: | This problem is best solved by tracing backwards from state F. We see th: at the only F, 0 entry is for E and x = 0. Hence the second-last state is E. Proceedit ing 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. S6, the state transition are: A> BD BS D> EDF D> ASCO ESE Hence, the input string is: 0101000110 6. Is the following machine information lossless? If yes, find the order of losslessness. ee 7 {WBUT 2009]FORMAL LANGUAGE AND AUTOMATA THEORY [oi Tor c D B41 At 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 Ps__fz-0 2 (AB) = (cD) (AB) (CD) = (CD) (AB) (AB) (CD) 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 compatible pair with 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 Hence the order of losslessness, w=/+2=2+2=4 7. Convert Mealy Machine to Moore Machine. [WBUT 2011, 2012, 2016] | | | i4 , two output sequence detector which generates an output “ 8. Design See aaaea Toor is detected. And for all other cases output ‘0’ is cee aay Overtapping sequences are also counted. eae State Graph, State Table and perform State assignment] [WBUT 2014, 2015, Answer: larifications 190190 ha way that it will ta ng sequence detector is neede at a time. The inp~ two types of input). The output will be also two types, either store (memorize) the input string up to four clock pulse according to clock pulses, the output is as follows: a eee, Spee eee ee mee OP 9 9 8 1 0 4 oy FAT-16FORMAL LANGUAGE AND AUTOMATA THEORY The first input at 1, is 1 and as there is no input from ¢,, to 1, the input sequence does not equal to 1001 - So the output will be 0. Similar cases occur for the inputs upto 1,. However at time s, the input from ¢,, to 4 becomes 1001, hence the output ‘Vis Produced at time 1,. At time 1 and r, the input string from 1, , to 4, are 0010 and 0100, respectively. Therefore, the output ‘0° is produced. At 1, clock pulse the input string i: 1001, hence output ‘1” is produced. As the output ‘I’ at 1, is overlapped from 4 to 4 and from 1, to +, , this is called overlapping condition, o {oolijoor In this case the state diagram is to be drawn first according the following process: 1” In state S,, input may be either *0” or ‘I’. If given input ‘0’, there is no chance to get 1001. Hence it loops on S, with output ‘0°. If the input is ‘I’, there is a chance to get 1001 then machine moves to S, producing output “ In S, again the input may be either °0’ or ‘I’. fit is ‘1°, the input becomes 11. There is no chance to get 1001 by taking previous inputs. But again there is a chance to get 1001 by considering the given input ‘1°. Hence it will be in state 5. (IFit goes to S, then there will be loss of clock pulse, i.e., from 5, by taking input ‘1’, again it has to come to S,, i.e, one extra input, ie., one clock pulse is needed and hence the output will not be in right pattern). Ifthe input is “0°, the input becomes 10 ~ by considering the previous input and there is chance to get 1001, so it will come to 5,. In &, ifit 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 "So it will shift to S, as we know by getting ‘I’ in S, the machine comes given input ‘1° 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.e., S,. As overlapping condition is FAT-17POPULAR PUBLICATIONS. accepted. hence trom the last “1° of 1001 if it gets O01 only, it will give an output °| Therefore, it will goto S State table: A state table can easily be constructed from the above state diagram Ps NSO. State assignment: . The states must be assigned to some binary numbers to make a digital circuit. This is called state assignment. As the number of states is four, only two digit number is sufficient to represent the four states Let’s assign 5, 0 00 S, 1001, S, toll, S, 1010. After doing this state assign ent the state table becomes. ) NS) OPE) FAT-18FORMAL LANGUAGE AND AUTOMATA THEORY 9. Minimize the machine using equivalent partitioning [WBUT 2015) Present state Next stat X ABC.DEF) ACE) (B.D.F) (A,C.E) (B.D) (F) A.C) (E) (B,D) (F) Say: (AC) > a,E>B.(BD)>2,F> 8 The standard form of the reduced machine is: PS NS x=0 x= a |B. Al B | a0 31 A_ | 80 Al 6 [Ao ou 40. Design a two-input two-output sequence detector which generates an output ‘1° every time the sequence 1010 is detected. And for all other cases output 0’ is ences are also counted. Draw only state table and generated. Overlapping sequ state diagram. [WBUT 2016] Answer: ‘The input string 1010100 is placed according to the clock pulses, and it looks like the following ——= 4 4 & 4 ts 4 4, 1O}1 O10 o 10 0 voiol Fig: Overlapping Sequence moo 0 1 01-0 ‘And the output becomes as given earlier. Overlapping portion is 10, as shown in above cou figure. The state diagram is in following: Fig: State diagram FAT-19PO! JLAR PUBLICATIONS State Table: From the previous state diagram. a state table as follows can easily be constructed. Next State, O/P Present X=0 =I State S) Si S: Ss, S S: ° Ss. S, Ss Se jooco ooo 11, Find the string which is applied on state ‘ D’ producing output string 10011110 and final state ‘ D' for the machine given below: NS,ol p [WBUT 2016] Answer: 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 0 =I AD - = “BC (AENDE)) - AE - | (AB\BC) {ABYAC ) - AB (AB\BC) The testing table does not contain any repeated entry. The machine is information lossless machine. The output successor table for the given machine: FAT-20FORMAL LANGUAGE AND AUTOMATA THEORY Transition is as follows: A pos mo Os c —A 1a 00 at ui a ate Set, Lc 7 c va Beginning state B and final state D is obtained from one path with input string 10100010. 12. Design a two-input two-output sequence detector which generates an output 1 every time the sequence 1101 is detected. And for all other cases output 0 is generated. Overlapping sequences are also counted. [WBUT 2017] 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 | 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 control will be confined in S» producing output 0. In S; if we get 1 then there is a chance to get 1101 so the control moves to S; producing output 0. In Ss if we get 0. there is a chance to achieve the string 1101, so the control moves to Sy producing the output 0. But in S; if we get 1 then there is no chance to get the string 1101, so in this case we have to start again from the beginning i.e, S). In Sy also, if we get 0 then there is no chance of achieving the input 1101 so the control moves to the beginning producing output 0, but if we get 1 then the string 1101 is achieved, thus producing the output 1. As overlapping sequence is also accepted, the control moves to S., so that by getting 101, the sequence detector can produce 1. ror FAT-21POPULAR PUBLICATIONS The state diagram is given below ~ on Figure | The state table for the sequence detector, 1. a) In response to PS | NS OP 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. b) Find the minimal NS, Z fos |sex=One|eax= [LA Bi | Cc B Di | 6B D E,1 B, FE AsOme [ener F [Fo | ot | F | Do A, Table-4 inverse machine of the machine given in table-5. [WBUT 2004) NS,Z PS [eso [x=t A c,0 D4 B D0 C1 Fe yao | Bo D | C1 | D1 | Tables FAT-22FORMAL LANGUAGE AND AUTOMATA THEORY oR, Show that the following FSM is information lossless of finite order: IS, Also find its order of information losslessness. [WBUT 2008] Answer: a) We use the backward sequencing to get (ABB DEE ED AGE r 111000001 Hence, the input sequence is 0101000100 b) i) Cl Dl 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, which is denoted by (S(t),Z(¢+1),Z(¢+2)) where S(t) is the possible states of the original machine M and Z(t+1), Z(¢+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) (ALD (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 consuming the first input symbol. + The second member is nothing but the third member of the present state of the inverse machine and finally the third member is the present output of M. ‘The state table of the corresponding inverse machine is shown below: Machine-M" So — NS, X. 2-0 (C000 | (D,1,0).1__| (DLD,t Wo _|(D,L.0POPULAR PUBLICATIONS 0,0) | (A.0,0),0 | (B,0.1).1 (C01) | (B.10)1 | (A1D.0 (01,0) | (€,0,0),0 | (C.0,1),0 | _(D,1,1) (D,1,0),1 (D,1,D,1 2. a) Find the equivalence partition for the machine shown in Table. Show a standard form of the corresponding reduced machine and find a minimum-length sequence that distinguishes state A from state B. [WBUT 2007, 2012, 2015] ps NS.Z X20 ‘x|o|7|m\o|o|a)|>) |x| oloolplolo|>|a ol4|[a\olo]—|4) >|9 ololn|m! Answer: Po=(ABCDEFGH) P, =(ABEFG)(CDH) P, =(A B) (EF G)(CDH) P; = (A) (B) (EF G) (C DH) P, = (A) (B) (E F G) (C D) (H) Ps = (A) (B) (E F G) (C D) (H) — Final equivalent partition Let a =(A,) B = (B), y= (EF G), 8=(CD), € =(H). Hence the standard form machine is NS,Z PS y=0[x=1 a [pt [el B lyt [ar y 180 [81 3 [80 [yl e [81 lal There are no I-length or 2-length sequence that distinguishes A and B. ‘The sequence 000 distinguishes A and B In state A, the output is 111 In state B, the output is 110 b) For the incompletely specified machines shown in Table-2 find a minimum-state reduced machine containing the original one. [WBUT 2007] FAT-24FORMAL LANGUAGE AND AUTOMATA THEORY Table - 2 Answer: BEF cy sc] &, AC a ees E CD, cE F x | BC, cD Dewee Procedure ¢ Write down all compatible pair in respective cell. * An ‘x’ 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. (ce) Compatibility Graph . (De) (cd) The set {(AB), (AC), (BC), (CD), (EF)} — {(ABC), (CD), (EF)} is a minimal cover of the above machine. 3. a) For the following machine shown in Table determine whether or not it is lossless. If it is lossy, find the shortest output sequence produced by two different input sequences with the same initial and final states. If it is lossless, determine its order. FAT-25POPULAR PUBLICATIONS PS yea [x= ia jaa | 8.0 fe ico (0,0 te {o.4 \o4 do (81 (At i [WBUT 2007) b) Design a minimal inverse of the machine shown in Table Answer: : ; a) As another illustration, the above test is applied to machine My of Table & This machine is shown to be lossless of order 3, since its testing graph (Fig. a) is loop-free and the longest path is of length 1. Fig: Testing graph for machine My Table (i): Machine My Table (ii): Testing table for NS, z PS =0 Ps x20 x=] _ A 4,0 BO 2 (CD) B co | Do ¢ - c DI] G1 -—B_| = _ D Bl | Ad AB | (ACAD) —_1- oe | (BO)(BD) | cb | (b) we have the following triples: LBB) (A0.0) (B,0,1) (C00) (ALD (B,1,0) (C01) oi ‘The rest of the triples are not defined. ee ‘Thus the inverse machine has present states defined by : y the eight triples s ove. Now the next state ofthe inverse machine can also b ee ¢ detined by triples, FAT-26FORMAL LANGUAGE AND AUTOMATA THEORY The first member of this triple is the state to which the machine M will go consuming the first input symbol The second member is nothing but the third member of the present state of the inverse machine and finally the third member is the present output of M The state table of the corresponding inverse machine is shown below a NS.X an wel F(A.) | (C.0.0)0 | (C.0,1)0 [ALN TOL [Dt (B.0.1) | (D.1,0),0 | (D.1,1),0 (BLO) | (C00) (CO.1D.1 | (€.0.0) | (A.0,0).0 | (B.0,1).1 [C.0.1) (B10). | (ALO (D.1.0) | (€.0.0).0 | (€,0.1).0 | (DAD [D101 | (DAD. | 4. a) What do you mean by k-equivalent states? [WBUT 2009, 2011] b) Minimize the following machine by partitioning the distinguishable state Present | i/p -0 | ifp=1 | state [Next State | ofp | Next State | olp cA fe jo jo 4 3 F jo jo fo c E fo [8 1 bp FE jo je 0 E S oF 1 FE 8 fo [ce 0 6 c [1TH o iE A 1 [6 0= c) Give definition of lossy and lossless machine. [WBUT 2009) 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 outputs depending upon whether S, or S, is the initial state. b) Initial partition P, = (ABCDEFGH) Partition of I-distinguishable states = 2. = (ACE) BDF (GH) Partition of 2-distinguishable states = P, = (ACE) BDF (GH) Partition of 3-distinguisbable states = P, = None So, minimal machine has 5 states. Let us map: (AC)-»P (E)Q (BD)>R (F)->Sand (GH) >T FAT-27POPULAR PUBLICATIONS The minimal machine ¢) A machine M is said to be (information) lossless if the knowledge of the initial state, the output sequence and the final state is sufficient sequence. A machine that is not lossless is said to be lossy. 5. Draw the merger graph, merger table, compatibi following machine: to determine unequally the input graph and then minimize the UT 2009] | Next State, o/p Next State, o/p_ | Present state i/p=0 i[p=t A = Ct 8 E,0 [- - [= ic F,0 Fit = =1 D 7 = B14 = E - F,0 A,O D, — F Cc, B,O C1 Answer: Merger Graph A B {AB} (CD) oe) D c Merger Tale (AB) (CF)'<—— (AC) Bly | « (BC) Cc (CF [EF | Qe (BE) D/BE |v [v | (cd) E |x vy [x x (Ady ae) "| FAT-28FORMAL LANGUAGE AND AUTOMATA THEORY From the compatibility graph, we get {(AB), (CD), (EF)} as a closed covering of compatibles. Minimal Machine PS _ NS, z - __fisp=0 | itp=t | ip=2 [ipa 3 (AB) > @ 70 BA nl al (CD)> B 70 yl al =) LR) ay B 0 a0 BA 6. a) What is information lossless machine? [WBUT 2010) b) Consider the machine shown in the following tal _. [WBUT 2010, 2014] Present State | Next siete A {AA [Ch B{[E&0 |[B1 c Do [AO D co [Bo | E — [Bt [Ao Is this machine information lossless of finite order? If yes, find the order ». Answer: (a) 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. (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 output I-successors of 4 Similarly, the pairs (AD) and (BC) are compatible pairs. Step 2: If no identical entries appear, the next step is to construct the output successor 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 the compatible ones. FAT-29POPULAR PUBLICATIONS Testing table of machine M (AD) D (BC) S (AB)\(BC) @) DE (ABXAC) AB : (AB\(BC) 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. Testing graph for machine M 7. Consider the following machine: [WBUT 2010] Present State | Next State mest | npr Gpeaees tg A - - Et |- a co [AT [Bo |- Cueme Color]. Tao D - E1 |B; - E Bo |- c.- [Bo | i) Draw the merger graph. ii) Draw the merger table. iil) Draw the compatibility graph. iv) Find the minimal closed covering with justification, Answer: Step 1: First draw the merger graph of machine. ’ The set of maximal compatibles derives from the merger graph contain four members and is given by ((ACD),(BC),(BE),(DE)} FAT-30FORMAL LANGUAGE AND AUTOMATA THEORY Step 2: The compatible pairs and their implied pairs are usually obtained by the merger graph, and since a set of states is a compatible if and only if every pair of states in that ser is compatible, then for a given , the set of compatible pairs defines uniquely the entire set of compatibles . Here from the above merger graph. an arc leads from vertex (AD) to the compatibility of (BE) is implied by that of (AD) No arcs en no other compatible is implied by it, and so on tex (BE) because te from (AC) since Step 3: Select closed subgraph in the compatible graph. 8. Convert the following Mealy machine to equivalent Moore mach P t State UP=0 UP=1 nemenne! Next State | O/P | Next State | O/P | L qo qi 4 q2 [a qi a3 0 qo 1 q2 94 0 q3 1] 3 a 0 a4 0 a4 a2 1 a4 0 [WBUT 2014, 2017] Answer: % O1 LA 0,1 | % _ 0 | I 0.1 State Redesignated | % Ot Gor Ia FAT-31POPULAR PUBLICATIONS. Moore Machine Table n Presens State Next State Outpu 1-0 wl 1 q. q q g q gq. 9 yy gq | ¢. 4 q 0 2 4 % | ! q q 0 4g Wo | ioe eees leans Yo 4 | Go| oe 4% | 4: | 1 9. Consider the following state | Present state a) Draw the merger graph. _ b) Draw the merger table. ¢) Draw the compatibility graph. 4) Find the minimal machine which covers that machi [WBuT 2015) Answer: a)THEOR FORMAL LANGUAGE AND AUTOM. b), ©) & d) Refer to Question No. 2(b) of Long Answer Type Questions. 10. Construct a minimum state automata equivalent to a given automata M which transition table is given below: [WBUT 2018] | I input | State Go |g. % Answer: input State a a Go % 4% % 4 4 % 4 I A cs . Partition algorithm is applied — Po=(4 % % I I % 4) Pi=Po As, here not any state has same outputs and also no same state transition So, the given m/c is itself the minimized one. 11. Construct the merger table, merger graph, compatibility graph and minimal machine for the following Machin [WBUT 2018]POPULAR PUBLICATIONS: D F.4 \ — | C4 L F [ D,- oe Answer: Refer to Question No >. 9a), (b). (c) & (d) of Long Answer Type Questions. 1 the following machine and test hf ig graph fo [WBUT 2018] if yes then find the order. NS, z 12. Construct testing table, testin: whether it has finite memory or Not, i xv=0 A BO B co c Gir [ o 0,0 Answer: . - PS i =O A Bo L B | C0 c. | bdo Dd DLO Testing Table: : PS oo ol voy A RT ns BFC c dD ae (AB) ) (BO) (Ac) | (BD) (AD) + =I (AD) (RD) | a | 5) T 1p T om a 2 wy) ra) —— (BD) (cb) tT |FORMAL LANGUAGE AND AUTOMATA THEORY .. Here, in this testing graph, 3 no loop so, we can say it is a finite memory machine. Order (7) = Maximum length path (0)+1 . Here, (AB BC + AC + AD + BD>CD) t max. path length is 6 w=6+1=7 (Ans) Testing Graph: FAT-35POPULAR PUBLICATIONS STRUCTURE OF SEQUENTIAL MACHINES Short Answer ye Questions 1. Is the following machine information lossless? If yes, find the order of losslessness. [WBUT 2011] NS.z X=1 BO D.0 Cd Al SEP] Answer: Test of information losslessness NS, PSiea|i x A AO BO B co D,0 Cc Dt Git D BL Al 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 PS. z=0 (CD) (A3) co |— (AB) (CD) ac |— . AD | — = Bo |— = BD 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 FAT-36FORMAL LANGUAGE AND AUTOMATA THEORY 0 Ly)! © 5° 6 Fig. Testing graph for machine M From the lower part of the testing table it is clear that, there is no compatible pair with Peated 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, wal+2 [WBUT 2011] 2. Test whether the following machine is definite or not i) by using synchronization tree ii) by using repeated derivation of contracted table iii) if the machine is definite, ololo|a| Answer: 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 FAT-37POPULAR PUBLICATIONS 1. Consit Drive th Long Answer Type Questions BUT 201 ider the machine given below: w 0) "Next State _ Present State o m>poqunrojlo e closed partitions. Construct a n-lattice for it. Answer: First we 1 Rv . B.EDB. determin ABPABC.DH.G:FABCDEGE HD x A.CPA.C:DH:G.E:PA.C.D.AG EPEC EAGBD> AY CEP.G:B.D.H:D.N.BG.AGE.BD.9A.B.C.D.EE.GH:> 7 ADPAD:DEGE:OAD.G.EBD.GEPABD.GEACD, ABCD.EFGABCDEGHIABCDEEGH x1) ALFA EBD.BG.OALBDGACL BEE ABCDEF.GHP RO) APIALD.G:IALD.GBEOABED.G.CD.G.DEG:OABECD.GEA. BPH: ABPACD.LG,> = AGPA.G:A.D:B.G.9A.B.D.G:ACDFBEL,G:9A.B.CD.EL.G:D.CHEB, GALE PABCDEL GIL xy AHDAHLDE-C.G PAH DEO GBED x B.COB.C.CILEF9BCCAREL LE ALCEB.D:B.G:9B.C.D,E.E,G.H:C HEB GAFPDABC DAL GHD ml) B,DDB.D:CF:L.F:9B.D-CEEBGAB.DE:>B.C.D.E CHEBGAEDAB.CDEEGIH x(1) CBE BCCHEL I B.CELHB.CEGILEE,D.B,C-B.CD 1 CHEBGAE OA, He a(t) BFOBEC . DEP BECG DEA 1 sis, for every pair of states: °G:B,D.H:OA, ) G:B,D.G.EF;> A GH:9A eeu F.G.H:> x1) . BHD B.H:C,E:9B.H:C.E;B.F:>B.F.H:C.E;C,E.G:C,D,E;>B.F,H:C,D,E,.G;> B.F.H:C.D. ABEHOABE IC DEG:> x. C.D9C,D:H.F:9C,.D3H.F:G CED, GABF, . CPOCFC HD.F:3C, OROHeGNT ooCo CHAT cecor DAB. G.H:> x(1) FAT-38FORMAL LANGUAGE AND AUTOMATA THEORY 17. CGICG ABE DOG AH BEDE TN 18. CHICH-CE EM OCE PHBE G.H.B,C.D,F,9B,C.D.E.F.G.HC HE BG AED ABC.D.EE GH. nl) 19. DESD.EBESDEBECG. DEBE CGAH my 20. DFOD.FE.G:F.D.9D.FG.A.E,G.B.D.F.9A.B.DE G:C.DAF.GG_E.F B.D. PABC.DLEF.G:D.C.HF,B.G.ADA.B.C.D.EF.GH:> m1) 2. D.GI9D.G:AF.BE:9D.G.A.B.E:9D.G:A.BECD.G.DE.GICD.G.E ABE :9C,D.G.E;A.B.F.H:> 5, 22. DH D.H-E. FCF. D.H:C.E.F:B.G.H:B.D.F,9B.C,D.E.F.G.H.CHE.B.GA E:DAB.C.DEF.GH: xD E.FOE.F:B.D;B,G;9E,F:B.D.G:A.C.F:B.E.F:9A.B.C,D.EF.G:D.C,H.F.BGA : Hi x) E.GPE.G:A.B:9E.G:A.B:C.D:9E.G:A.B:C.D:FH:> % 3 B.C.E.FH;B.CE.G.H.OB.CE > x) AB.CDEFGDC, Machine M, TNS Ja x0 wel 1 Alda [8 ie z BIO [4 +8 CG, | + a pits [fs i FAT-39POPULAR PUBLICATIONS Machine My = rl M, rq Z | x] Lae i Me M Le UJ (a) x-Lattice schematic diagram of machine (0) M. with parallel components FAT-40 Z=2..2:FORMAL LANGUAGE AND AUTOMATA THEO! RY FINITE AUTOMATION 1. Palindromes cannot be recognized b y any FSM because BUT 2007, 2012 a) an FSM cannot remember arbitrary, large amount of information ) b) an FSM cannot deterministically fix the mid-point _o) een 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) 2. If S is the number of states in NDFA then equivalent DFA can have maximum of [WBUT 2008} a) S states b) S-1 state _cy 2 states d) 2°-4 states Answer: (c) ea 3. DFA has . [WBUT 2008) a) single final state b) more than one initial states _— _cy unique path (for a set of inputs) to the final state d) all of these Answer: (c) 4. 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 ¢) two Sytiree Answer: (4) 5. Given an arbitrary NDFA with n states, the maximum number of states in an i nimi: is at least [WBUT 2008] eauivalgnt minimized ae at yn tee Answer: (4) 6. DFA converted from an NFA with n states can have maximum = [WBUT 2009] a) n states b) n! states gy states d) "C, states Answer: (c) 7. The production grammar {S —> aSbb, S—> abb} is [WBUT 2010) b) type-2 grammar ¢) d) type-0 grammar Answer: (a) 8. The reduced grammar of S—> ABla,4— ais [WBUT 2010] a) Soa b) Sal4 MSra d) S aa Ata Ara Answer: (c) FAT-41POPULAR PUBLICATIONS - og with any number of 9. Which of the following grammars vonorats strat ye we, a) Sold, Ave : " G c) S818 e _SH{6) & (©) Answer: (d) DWBUT 2, 10. DFA has a transition function ~ayOxE to by Ox¥ to 2! ) and (b) 4) none of these ¢) both (a) Answer: (a) 11. If Qis the number of states in the NFA, the equivalent DFA can ee number of states i e a) O b) O-1 ¢) 20-1 or Answer: (d) 12. Can a DFA simulate NFA? (WBUT 2; on _Prives c) sometimes d) depends on DF Answer: (b) be an NFA with n states and let M be the minimized DFA with mse 13. Let recognizing the same language. Which of the following is NECESSARILY true? —a)ms2" b)nsm {[WBUT 2014, 2 c) M has one accept state d)m=2" ‘Answer: (a) 14, The string 1101 does not belong to the set represented by [WBUT 2014, 2018, 2° 430(0+4) b) 1(0+4)*101 (10)*(01)*(00+11)* d) (00- aa Answer: (c) a ‘ory 15, 4=(a+6)*a and B=5(a+b)* then 4 intersection Bwillbe — [WBUT?” a) (a+b)*ab b) ab(a+b)* ¢) a(a+b)* bat Answer: (d) 46. The string 1101 does not belong to the a) 110*(0+1) Set represented by qweut?” (10)*(01)*(00+11)* §) 1(0+1)*101 ¢) (10)* ' ) 0 Answer: (4) ol O+(11)*0] 47. An automata is alan .... devi ice ' a) acceptor only : - ¢) rejector only AS acceptor / | wu’ Answer: (b) Senerating ejector FAT.42FORMAL LANGUAGE AND AUTOMA’ 18. k -level equivalence is possible between two finite automata [WBUT 2016) a) if all equivalence above i -level exist between them _by if all level equivalence up to &~1 level already exist ~ ¢) if both contain at least & number of states. d) if both contain exactly k number of states Answer: (b) 1. Convert the Mealy Machine (given below) toa Moore Machine. _ [WBUT 2008] Answer: The Mealy machine constructed form transition diagram is uw Mealy circuit The equivalent Moore circuit is given by FAT-43>, POPULAR PUBLICATIONS 2. Construct a Mealy machine which is equivalent to the Moore machine gi, below: IWBUT 200 Answer: % |G»! | 3. State the difference between DFA and NFA. [WBUT 2009, 2010] Answer: Ina DPA, these can be no €- transitions. Also, for a given state q and a symbol a€¥. there can be at most one entry. An NFA does not have any of the above restrictions. 4. Design an NFA which accepts set of all binary strings containing 1100 or 1010 as substrings [WBUT 2009, 2010, 2016] Answer: 5. ria, Pa transition diagram of a finite ‘state automaton that accepts all strings over (0, a) having odd number of 0's b) having even number of 0's and even number of 1’s, [WBUT 2010] FAT-44FORMAL LANGUAGE AND AUTOMATA THEOR’ Answer: a) (1201*)* +1 b) (0* 190" 6. State the difference between DFA and NFA [WBUT 2010, 2018] Answer: We The transition function for nfa ie delta ss multi valued where as for dfa it is single valued 2, Checking membership is easy with dfa where 1 8 is difficult for nfa 3. Construction of nfa is very easy where as 0F fa itis difficult 4. Space required for dfa is more where for nfa it is less S$. Backtracking is allowed in dfa, Dut 5 Pet possible in every casi in nfa 6 For every input and output we can constuct dfa machine, but it is not possible to hine for every mput and output «runt but there can be more then I final state in dfa. -~O-89 1 construct an nfa mac 7. There is only | final stat 7. Convert the following NFA to DFA. Answer: FAT-45POPULAR PUBLICATIONS NFA ° 2 Lgl | [doal [ai] Load | [40-40%] [ange] [anal [a] [a] [40-404] | [40-40%] [492] [a] ¢ {4] @® [a] [a] DFA ¢ é 4 8. Construct a DFA diagram from the NFA given below: os (WBUT 2011, 2012) Answer: ‘The NFA diagram: According to the above diagram, the transition table will be formed as: Present ip 1 stare | 0 | a q {do qu} te) a {9} {ana} Qe qa faa) | faoad | faaed {qi a2} a | {aa} FAT-46FORMAL LANGUAGE AND AUTOMATA THEORY Now, according to the w, according to the above table the DEA diagram will be, The DEA Diagram 9. Construct a NFA with < or 4 transition forr=(I1 +0) (0041). [WBUT 2011, 2012) Answer: 40. a) Give DFA which reads strings from {a,b} and with aaa. }.6 is given by the b) Construct a DFA equivalent to Mf = {{qo.9} {0.1}. 8ay-ta0h . [WBUT 2012] state table. Answer: a) b) “Assuming q to be the final state FAT-47os POPULAR PUBLICATIONS 11. Design a Finite automata that accepts set of strings that every string ends with 00 over alphabet {0, 1}. [BUT 2013) Answer: FA that accepts set of strings that every string ends with 00 over alphabet {0,1} (© Present State [WBUT 2014, 2015, 2017] Answer: In automata theory, a non-deterministic finite automaton (NFA), or non-deterministic finite state machine, is a finite state machine that (1) does not require input symbols for state transitions and (2) is capable of transitioning 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 algorithm, j.e., constructed DFAs and their corresponding NFAs recognize the same formal language. Like DFAs, NFAs only recognize regular languages State table 0 ae | ay Pay (4-4) | (41-43) (a..43) | (4.-4;.4:) (q,4:) (4.43) q iFORMAL LANGUAGE AND AUTOMATA THEORY X*) ae) ) | | & WC © (@« «)—7 ; cy Us @ Yo 13. Construct Finite Automata equivalent to the Regular Expression. Leab(aatbb)(a+b)*b. [weuT 2014] Answer: _— Lon / oor Hos NO na x 44. Convert the following NFA into an equivalent DFA. _ PWBUT 2016] [ NS. PS asd [asl be + t |. dots | % - [a | fa _ + — L@ PS 3H | (44) (Go. 4) (4-409) (dos 42) | (or 4) CR) FAT-49POPULAR PUBLICATIONS a=l 45. Define DFA. Derive the DFA for the regular language 0(0+1)*1 for the symbols ={0. I} [WBUT 2016] ‘Answer: 1* part: : 3, 8, oF), where. Q is a finite set iA deterministic finite automaton (DFA) is a 5-tuple, (Q . re % E — Q is the transition called the states, Z is a finite set called the alphabet, 5 : Q function, q0 € Q is the start state, and F ¢ Qis the set of accept states. 2" part: ' aton from the transition table given below: 16. Construct a minimum state autom: femers, x=0 x=1 [4% 4 4 4 a % % a u 4 4 % a | 4% a | 4 4 4% Gy 440 4s ae final states. [WBUT 2016] Answer: In the finite automata, the states are {4004424440095} . Name this set as S14 d041042 95-40 4ss All of the states are 0 equivalents. In the finite automata, there are two types of states: final state and non-final states. So. divide the set of states into two parts, Q, and Qo. FAT-SOEORMAL LANGUAGE AND AVIOMATA THEORY teh Nt 295} The states ‘onging to the ig same forstring length 1 The states bolus are ‘equivalent because they are in the same set S Setonging to different subsets are | -distinguishable. For input 0 and 1, 9. goes to same subset. For g . ° Pectively. Both of the states belong to the h wd 1, the next states are and respectively, For f . a GG dds ee ne Poth Of the states, for ‘nput 0. the next state belongs to one subset, and her subset. So, g, can be distinguished from a and q.. The nent states with iny they cannot be divided {a0} 19:.93}.{9,.9,.94}} 4e $s 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 | for states q,.q, and 4. belong to the same subset. So, they cannot be divided. So in the next step, Ss{ldo} fags} fas a.rash} S, and S, are equivalent. AS step (n—1) and step » are the same, there is no need of further advancement, In the minimized automata, the number of states is 3. ‘The minimized finite automata is presented in tabular format as follows: Next State eC 4. belong to the same subset. So, State TP=0 vi {90} ta} {as} {a..9:} {as} faa} {4-9-9} | {4 Qerds} | {ddunds) ist under the column of present state. They are not {a} id 1.} do not exist un we f i i me a automata, but they are subset of the states. In the next state States of the mini in roper state, the modified table becomes. columns, by replacing the subsets by proper stat: th sme State 1P=0 = {40} {4092} {4.95} {ana} {a4} {4544095} Lantos) | feeds) | {redods}POPULAR CATION: ‘As qq is the beginning state of the original finite automata, {qo} will be the beginning state of minimized finite automata. As q,g,, and q,are the final states of the original finite automata, the set of the states containing any of the states as element is final state, Here, all the states are contained in a single set {g,,q,,g,} and, therefore, it is the final state, By replacing {qo} as A, {g,,g,} a8 B, and {9,,q,,9} aC, the modified minimized finite automata becomes, Next State State V/P=0 VP=1_ 3A B B B B c © Cc Cc ‘The transitional diagram of the minimized finite automata is given in following figure. 17. What is Homomorphism? Find the homomorphic image of L ={aa, aba} where fined as h(a)=ab and h(b)=bbc. [WBUT 2018] Homomorphism: ‘A homomorphism is a map between two algebraic structures of the same type, that preserves the operations of the structures. -. f:A—»B where two sets A,B having same structure. Then, say ‘*” is a binary operation. = F(x*y)=F0)*F0) for every pair of (x, y)e A 2" Part: L={aa, aba} where h(a)=ab, h(b)=bbe h(a a)=h(a) h(a)=ab ab h(a b a)=h(a) h(b) h(a)=ab bbe ab <. Homomorphic image of L is — {ab ab, ab bbe ab} FAT-52THEORY FORMAL LANGUAGE AND AUTOMATA 4. a) Design a 2-inj -input 2-out; stream and generate utput Mealy machine, which tak i i found in the input eral a output of 4 only when a sequence of ‘the pattern owns ‘Answer: . Design should be clearly justified. _ [WBUT 2007, 2010] The required Mealy machine is given belo PS [A [B Cc D E — Justification of Design OO The forward moving (ie, A> B > C > D > E > F) transitions can be trivially A, C and F to state A because this tified are 1 transitions from states has been broken completely and scanning must begin again from justified. Also jus indicates the sequence state A. We note that the sequence starts with a 0 and upon receiving the first 0, the state is B- Hence, if the sequence breaks in any state B, D or F upon receiving a 0, we should count bol of the input and begin from state B. iving the this 0 as the first possible sym! state Eis a special case. State E is reached upon recei (01010, the last three symbols of Getting a 0 in the subsequence 0101. Ifa 0 is received, the sequence is ' which (.e. 010) is the first three symbols of the sequal to be recognized. But the state aeeich s reached upon receiving subsequence 010 is D. Hence the 0 transition from state Wo E should be state D. State recognizing largest suffix of basic string possible Basic String PossiblePOPULAR PUBLICATIONS nt Moore machine. (WBUT 2007] b) From the Mealy machine above find the equiv Answer: The Mealy machine designed in part a) produces output into state Hence the equivalent Moore machine is: 1 1 only when there is a transition LAS. | Output PS Tx=0 [x=11 A (B. {A [0 BBC jo c_j[o [a {0 D B F | 0 E Daas iE 0 F B A 1 ¢) Check whether the Mealy machine you obtained is a minimal one or not. Give proper justification to your answer. [WBUT 2007) Answer: The designed Mealy machine is NOT minimal. If we begin with the initial partition PO = (ABCDEF), we will get PI ~ (ABCDF KE) because only in state F we get output | Thereafter, states D, C and B form independent sets but states A and F are indistinguishable The minimal machine is therefore - NS - Xoo Net ABO A.0 B TBO [Co © "bo 1 A0 D BO [EO E DO Al 2. a) Find a reduced grammar equivalent to the grammar Sada, A> bBB, B-> ab,C >a (WBUT 2009] Answer: Clearly C is a useless symbol. Eliminating C, we get, Sata, A> PBB. B-» ab e replace all occurrences of B o Now we repac oe cee ths of production using B—» ah. geting Now we similarly substitute A, getting Saba ba ba which is the equivalent reduced grammar. b) Explain the concept of 2-way finite automata, [weuT 2009) FAT-54FORMAL LANGUAGE AND AUTOMATA THEORY Answer: Ina one-way (deterministic) finite automata, after every state transition, the input “head” moves to the ‘next’ input, i.,to the ‘right’. In a two way finite automata, the “head” can move either to the “right” or to the “l More formally: A2DFA isa quintuple M =(Q, x. 6, qo, F) where > is a finite set of input symbols, isa finite set of states, gy €Q is a “start state” and F CQ is a set of accepting states. 6 isa map trom Ox to Ox{L,R}. If 5(q,a)=(p,L), then in state g, scanning symbol a. the 2DFA enters state p and moves its head “left”, if 5(q,a) =(p,R), the 2DFA enters state p and moves “right” A 2DFA accepts a string if it moves “right” beyond the last symbol, at the same time entering an accepting state. It can be proved that if L is a language accepted by a 2DFA then L is a regular set. 3. a) What do you mean by Distinguishable and Indistinguishable state? (WBUT 2011, 2012, 2016] Answer: 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 (5,.5, )- If no distinguishing sequence exists for the pair (S,,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. b) Use Myhill Nerode Theorem to minimize the following finite automata: ee [WBUT 2011, 2012) FAT-55POPULAR PUBLICATIONS Answer: Tete tt te [a {__[h_[g jf je _[e_ Next we can see that delta (a, 0) = b, and delta (d, 0) = gets marked too. Similarly we can mark, Te T* 1 fg [* | _ fj ___4 , < 4*__} 4. 1 14. +~— x | eft fee [ a tg tf Je [a Te 1b In the next round we can find that delta (d, 1) gand delta (g, 1) marked. So, (d, £) will be marked. Similarly we can mark ¢ where, (g, ¢) is 2 |" 41 [e ae I « [ff ica [oT i _T- : : { [hfe Tf ideal femmnal |b letely distinguishable state nguishable states are (e, g), (fh), (e, hy, (b, 1). (b, d). This can be refined to get indistinguishable sets of states as: je, bf}, feeb. td hy We get the minimized DFA as shown in figui OAD OT® 4, a) Construct a DFA from the NFA given below: State/E | oO ~}Q.0s FAT-5S6FORMAL LANGUAGE AND AUTOMATA THEORY Answer: #) DFA from the NFA: Here Null transitions are replaced by New (N) states f—_______Input__ Ie 0 Qo {Qu Qu} On Qe _ Q N_ }_{Q@3 [e@ - |___{Qo, Qu} {Qo Qs} | (Qo, Qu, Qe} {Qo Qs} {Qo, Qs, Qe} {Qo, Qs} _| {Qo, Qs, Qe} {Qo, Qs. Qe} {Qo Qu Qe} | {Qo, Qu, Qe} {Qo, Qs, Qe} {Qo, Qe, Qe} The following are the states that have been renamed. [Q]=s [Q0, Q]=A [&, Qs, Q] =B [Q, QJ=C [Q0, Q, Qd =D [Q]=F [Q]=G [Q=EPOPULAR PUBLICATIONS 5. Minimize the following machine by applying Myhill-Nerode theorem. 7 NS a Kea | x=e | ae B E iB = 5 [eo H i a) T H [ E FE S Lo H T LS a 1 ——— [ T 1 + Answer: . [WBUT 2013] Fig: 1 ; OS CEere / Sea unreachable state in Fig. | so we can directly apply Myhill-Nerode theorem O={A4,B,C,D.E,F.GH.1} Diab} Initial state = A F={C.D,F.G} {O-F} ={A,B,E,H,T} we wea reed PF -WEDUCFCE(D.FYIC.6)(r.6) and (PF, (2-F)x(@-7) MABMAE)AI)(AD,(B.8).(3 H) (a 1) (EH)(ED) CHD) 3.H).(B.1),FORMAL LANGUAG AUTOMATA THEORY Transition table will be following: sy | a | 6 aA B E B G D | *c H 1 | a) H E F G “F H | oT “GOH i H H H I I I Step 1: Now build the matrix labeling the "p" rows A,B,C ... and labeling the "q" column ‘AB... and put the dashes on the diagonal and below the diagonal 4[8[C| Dl el FI[GlalZ Al-| | ‘F: c|-|-|- | pi-|-|-|- E|-|- ala P| | eae 7 | of-}-]-|-]=|-]: | Ale eee ele Ga) ee eae Fig: 2 g) in upper triangle such that p in F (Final states) and q in Step 2: Now mark X at (p, ; ; cript of p is lower than the subscript of q or p in (Q — F) or (non-final states) as subs (Q—F) and q in F and p is lower than q. F={C,D,F,G} O-F={4,B,E,HJ} F x(Q—F) or (Q=F)*F such that p is lower than q. ={(CE).(CH) (CDE) (PH) (DD AE HF DGD AGH), (4,0), (A.D) (AF) (4G)(BC)(B, D),(B,F),(B,G).(E,F).(£.G)} FAT-59POPULAR PUBLICATIONS Now mark ® in the matrix given in Fig: [ Fig: 3 Step 3: Mark's’ and’ Q' in the matrix: First we are considering Q-F Q-F ={A,B,E,H.J}, so ordered pair of (O-F)x(O-F)={(4.8).(4E) (AH). (A1) (BE) (BH) (BD (EH)- (E.),(AD} * Now we will select (p. ) from (Q-F) x (Q-F) and find (r,s) as r=6(p.a).s=5(g.a), if (r,s) is X oF x then (p, q) will be x. If (r, s) is neither X nor x then (p, q) will be ‘0’. = for (4,B).7 = 5(A,a)=B, $= 5(B.a)=C. It can be check from matrix in Fig. 3 that (B,C)is * so (A,B) will be x. + for (A,E).7 = 8(A.a) =B.s = 5(E.a) =F (B.F) is also x so (4,£) will be x. = for (4 H).r = 8( 4H) = Bs =3(H.a)=H (B.H) is not x but itis x so (4H) will be x. + for (Ad). =0(Aa)=B. (/.a)=7 so (A.J) will be x. =6(H,a)=H (B.2) is not * but iti = for (B.H).r = 5(B.a)= : (C.H) isso (B.H) will be x. — for (BI).r = 6(B.a)=C. =6(1,a)=1 (Cu) is x80 (B,J) will be x. = for ( £.H).r =5(E.a)= F.s=5(H.a)= 1 FAT-60FORMAL LANGUAGE AND AUTOMATA TI iEORY (F.H) is * so (E,#) will be x, — for (E,1),r=6(E,a)= F,s=8(1,a)=1 (F.1) is * so (E,1) will be x. — for (H,1),r=5(H,a) =H, =6(La)=1 (H.1) is neither x nor x so (1,1) will be "0", Now consider F ={C, D, F,G} Ordered pair of F x F ={(C.0)(C.F),(C.6),(0,F),(,6),(F,0)} = for (C,D),r=5(C,a)=H,s =6(D,a)=1 (4.1) is neither « nor x so (C,D) will be "0". ~ for (C,F),r=6(C,a)= Hs =6(F,a)=H (H,#) is dash so (C,F) will be "0", ~ for (C,G),r=65(C,a)=H,s=5(G,a)=H (H,H) is dash so (C,G) is "0", ~ for (D,F),r=6(D,a)=1,s=5(F,a)=H (1,#) is dash so check (#,7), itis also neither x nor x so (D,F) is"0" entry. ~ for (D,G),r =6(D,a)=1,s=5(G,a)=H (D,G) is also "0" entry. > for (F,G),r=5(F,a)=H,s=6(G,a)=H (#,H) is dash so (F,G) will be "0" entry. Rest of the entries in upper triangle will be "0". Now fill the "x" and "0" in matrix given in Fig, 3. A|B[C|D[E|F[G|H#]I Al-[x]x[x[x]xlxlxls B\-|-|x]x]o]x}x]x]x c]-|-|-]o]x]olo}x |x D|-|-|-|-|x]o]o]x|}x E|-|-|-}-]-|«|x]x]x F{-|-|-]-]-]- x| x Glee les x] x H|-/-|-|-]-]-]-]-]lo ri-|-|-|-|-]-{]-]-]_ Fig: 4PUBLICATIONS The “O" at (B,£) means (B, £) is a state in minimum machine. So if resulting minimum machine is M’= ( oy. a4F) {4},{B,£},(C,D,F,G},(H,1}) : {C,D,F,G}) Now consider Fig. | (given DFA and draw the transition table for minimum machine as &({4},q)=(B,E} Since 6(4,a)=8 in given DFA, B is in {B,E} state of minimized machinery on the same way, the transition table for M’ is avy, @ b {A} {B,E} {BE} | fc, {C,D,F,G} *{C,D.F.G}| {1,1} faa) | (Ht) | fat) | (na So minimized machine is Fig: 5 Minimized DFA Find equivalent partitions and minimize the followi owing [WBUT 2014]FORMAL LANGUAGE AND AUTOMATA THEORY Minimize the following incompletely specified machine, PS : NS,z i 1 : AAT e BALD: en | © E,0 At aoaal o E, Ad E E,0 aot Answer: [WBUT 2014, 2017] 1" Part: Equivalence partitions are = (ABCDEFGH) (ABC) (DEFGH)) (A) (BC)) ((D) (A) (EFG))) ((A) (BC)) ((D) (A) (EFG))) Minimization: We know that equivalent partition is unique. So, P3 = (((A) (BC)) (((D) (H)) (EFG))) is the unique combination. Here, every single set represents one state of the minimized machine. Let us rename these partitions for simplification. Rename (A) as $1, (BC) as S2, (D) as Ss, (H) as Su to (B) and So there will be a transaction from S; to S> to (H) and so there will be a transaction from $; to S, with input 1. (BC) with input 0 goes to (BC) for input 0. There will be a transaction from S, to S for input 0. (BC) with input 1 goes to (FG). There will be a transaction from S: to Ss for input |. By this process, the whole table of the minimized machine is constructed. The minimized machine becomes _ and (EFG) as $,(A) with input 0 goes with input 0. (A) with input 1 goes Next State, z __ Present State X= X= 1 SA) 2,0 Su 1 (BO) $2.0 Ss, $,(D) Ss, 1 S., 1 S.(H) S31 Sil 2™ Part: P, =(ABCDE) # =(AB) (CDE) This is the final partition. _ Hence minimized machine is:_~ PS S,= (AB) {ieeS= (CDE)POPULAR PUBLICATIONS 7. Consider the N.F.A given by the following diagram ab [WBUT 2015} Find the equivalent D.F.A without e-transition. Answer: State | a | b Q {Qi} o Q {Qu {Q1, Qo} {Qu Q} {Qi} {Qi, Qo, Qa} {Qi Qe, Q3} {Qi} {Qi, Q, Qs} So the equivalent D.F.A. is 8. State and prove Arden’s theorem in regular expression. [weuT 2017] OR, State and prove Erden’s Theorem. [WBUT 2018) Answer: In order to find out a regular expression of a Finite Automaton, we use Arden’s Theorem along with the properties of regular expressions. Statement — Let P and Q be two regular expressions. If P does not contain null string, then R= Q + RP has a unique solution that isR=QP* Proof — : R=Q+(Q+RP)P [After putting the value R = Q + RP] =Q+QP+RPP 7 .n we put the value of R recursively again and again, we get ‘ - ao 7 oe OP tor? S get the following equation R=Q(etP+P?+P+....) R=OP* [As P* represents (c+ P+P2+P3+....)] Hence, proved. FAT-64FORMAL LANGUAGE AND AUTOMATA THEORY 9, Construct Finite Automata equivalent to p=ab(a+b)(ab)*d, Answer: the Regular Expression [WBUT 2017) Answer: Using Arden’s theorem — R=Q+RP, R=OP* . Here, 4g =6+9,049,0+40 % = 401+ 91+)! 9s = 40 = 41 = 64g, 0+HIFH Go = 401+ 41 +9! = 91+ 911 +4! Go = Gol + G00 4 41 Go = G1 +90 (14 011) ~ gy =qi(i+0ll)* get Gs0t G04 H 2 get g lot gota 3g, = 6+ G,010+ G00 4% UuULSY FAT-65POPULAR PUBLICATIONS. > HET G MLE ON)*O1O Lg ILE OL) #004 4, > He (E(LH OL) F010 F1(L 1 O11) #00 Fe) ye (1 OL) *O10 + 1(L4 O11) #004 2) * a> (EE (1 011) #010 114011) #00) * Ge db gol gi(L4 O11)FO1 (Is OLt) solos A(L 4 O11)*00)*1(1 4-011) *01 Final regular expression: (4 #40) = (I+ (14 011) #010 + 1(1+ 011) 00)*1(1+01 )*)(2+01) (Ans) 11. Design an NFA which accepts set of all binary strings containing 1100 or 1010 as substrings. [WBUT 2018] Answer: “ ANFA over © ={0,1}" with 1100 or 1010 as substring. . Regular expression: (01) 1100(0 +1) +(0-+1) 1010(0+1), MICs (0+1)'1100(0+1) +(0+1) 1010(0 41" FAT-66HORMAL LANGUAGE AND AULOMAIA THLORL CLOSURE PROPERTIES OF REGULAR SETS Multiple Chot ‘ype Questions ] 1, Pumping Lemma is. generally used for proving whether [WBUT 2006, 2016) a) a given grammar is regular ~d)a given grammar is not regular c) two given grammars are equivalent or not d) none of these Answer: (b) 2. A solution to the equation Rs KV Is [WBUT 2007, 2013, 2017] a) R= OP* b) O-RPS oP RUF dk ryt Atiswer: (a) 3. Which of the following is regular? {WBUT 2007, 2012) a) fa'si= nn >t} b) fa": pis a primey ¢) {worsw isin {a,b} * } Bfa no A Answer: (d) 7 4, The value of /.(¢*) is [wBurT 2007) a) b) fe} ot } d) none of these Answer: (c) over |x, y} ending [WBUT 2007, 2012} o) (vs y)ter dhev(ay) 5. The regular expression representing the set of all strings with xx beginning with y is a) wire) ty b) (vt y)tr Answer: (d) 6. Regular expression (a| b)(a| 4) denotes the sot {WBUT 2007, 2012] a){a,h,ab, aa} b) {a, b, ba, bh} c)fa,h} Sirti, ab, ba, bb} Answer: (4) 0 sot of all wing regular expressions over (0, 1) denotes th 100 as a sub-string? [WBUT 2008] 7. Which of the follo\ b) 0*1010' ) 01°01" ayprsorsy strings not containing a) 0*(1°0)* Answer: (d) FAT-67POPULAR PUBLICATIONS 8. Which of the following is regular? ae a) Strings of 0's, whose length is a perfect square b) Strings of all palindromes made up of 0's & 1's ©) Strings of 0's, whose length is a prime number __9)-Btrings of odd number of zeroes Answer: (d) 9. a’ (a+b) is equivalent to [WBUT 2009, 2013) ase b) (ab)" | Arifone of these Answer: (d) 10. Consider the following regular expression: R= (ab + abb)* bbab Which of the following is not in the set denoted by R? [WBUT 2010] __-ayababab b) ababbabbbab c) abbbab d) abbabbbab Answer: (a) 11. Which of the following is correct? [WBUT 2010, 2016] a) Language can be derived from the FA b) Regular expressions can be derived from the FA c) FA can be derived from the language joth (a) & (b) Answer: (d) 12. The following production rules of a regular grammar generates a language L S—aS/bS/alb The regular expression for Lis (WBUT 2011) a) a+b are) ©) (a+b)(a+b)* dy (aa+bb)a*b* Answer: (b) . can’t remember arbitrary large amount of information b) it sometimes recognize grammar that is not regular c) it sometimes fails to recognize grammar that is regular d) all of these Answer: (a) years limitation of FSM is that [WBUT 2012, 2016] 14. What is the RE for the language set strings with at least one 4, one 2 and one 3? ateoaas BUT 201 a) 14243 rt 22" 33) 123" W) both Ayan (b) : ‘Answer: (b) : 1 8. Taso of pumping lemma is a good example of [wut 2013) in-hole principle b) the divide an, ; The pigeor pl a) tease id Conquer technique c) Recursion Answer: (a) FAT-68FORMAL I non AL LANGUAGE AND. a ji : 46. Which of the following strings can be obtained by the language 1. {a’h” |i!) gyaaabbbbbb —b) aabbb [WBUT 2013] sewer: (2) c) abbabbba d) aaaabbbabb 47. Which string is not accepted by the following FSA? [WBUT 2013] ea b) 00110 c) 01010 d) 11010 wer: (2) 48. Regular sets are closed under [WBUT 2014, 2015] a) Union b) Concatenation c) Kleene Closure _SYAll of the above Answer: (d) [WBUT 2017] b) context sensitive grammar d) none of these 19, Regular grammar is _aycontext free grammar c) non-context grammar Answer: (a) 20. Regular expression is accepted by , [WBUT 2017] a) Finite automata b) Mealy machine c) Pushdown automata es of these Answer: (4) 21. Pumping Lemma for Regular Expression is used to prove that [WBUT 2018] Mena sets are Regular Certain sets are not Regular ; i nr produce Regular Expression ¢) Certain Regular Grammar tree not produce Regular Expression d) Certain Regular Grammar does n' Answer: (b) Short Answer Type Questions i ete procedure to convert a regular 1. What i xpression? Give a compl cents 8 roger ee equivalont NFA. Using that" procedure conve O1f((10) +114)" +0] 1 into its equivalent NFA a ; [WBUT 2013) What is regular expression? FAT-69POPULAR PUBLICATIONS Answer: Let i) 5 =(10) ii) ry =(4 +) iii) = (+0) iv) nant v) = 0ly, Corresponding nfa of regular expression 7, is h “<0 x Corresponding nfa of regular expression r, is In this way the final nfa is Lo 4 1 ° i ~ekc0#0*0 1 2 1 NY : oo OW» 2. State Myhill-Nerode theorem. 7 [WBUT 2008, 2007, 2008, 2010] State Myhill-Nerode theorem with the definition of equivalent relation and Invariance. qwaur 2013 Answer: Statement of the Theorem . The Myhill-Nerode Theorem says the following three statements are equivalent: FAT-701, The set L,a subset of Sigma star, is accepted by a DFA. (We know this means L js a regular language.) : L is the union of some of the equivalence classes of a right invariant (with respect to concatenation) equivalence relation of finite index. 3, Let equivalence relation RL be defined by: x RL y if and only if for all z €2" star, xz €L exactly when yz €L. Then RL is of finite index 3. Prove that the language 1 ={0"|"|n>0} is not regular. [WBUT 2006, 2007, 2012] Answer: Suppose L is regular. There exists a finite state automation m which accepts L. Suppose Mhas 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. Ify consists of only a’s or only b’s the ws 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 w2 does not belong to L, which is contradiction ‘Thus L is not regular. 4, 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, L(s +t)= SUT. Hence L(1(s + t)) = R(S U T) = RS U RT [from Set theory] = L(rs +) Hence L(r(s +t)) = L(rs + rt). QED. 5. 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 P=a+b(a+b)* We construct the DFA corresponding to P using the construction is given the following figure. DFA with “moves FAT-71POPULAR PUBLICATIONS, After eliminating *-moves, we get the DFA straight away, ¢ YY 6 ‘ DFA without * moves Let G={(4,, 4). (a,b), P, A,} where P is given by A > ad, Aad, Ay > dA, A, bA, Ab Aa Ab Gis required regular grammar. 6. Let R be an equivalence relation in {0} * with the following equivalence classes: Fs {o}, = {o}' [00}, = {0}* U {o}" U{o}* Show that R is a right invariant. [WBUT 2007, 2014, 2015] Answer: IER is a right-invariant the for all x, y, 2 xRy => xzRyz, Clearly. [ Jp has the null-string, (Ox has only the string 0 and [00]. has strings 00, 000, 0000, etc. Suppose x and y are in [ Jx. Then, x trivially true Suppose x and y are in (O]}g. Then x = null, ie, xz= x and y2= y. Hence xzRyz. If zis from [O]p, then z=0. Thus, x2 = 00 and yz = 00. Hence xz= 37 implying that xzRyz, Finally, if zis from [00], z has at least two 0-s, Therehec xe & ell as yz have at least three zeroes and hence both belong to [00], Le, eh yz. rae ad Se in {00le Then both x and y have at least two Os. Hence respecte of what zis, xz as well as yz will have atleast two O-s and thes bot belong to [00}e- Thus xzRyz. g So we see that forall eases xRy —> xzRyz. Thus Ris right invariant = null. Hence xz = z and yz = z and zRz is y= 0. If zis from [ Jp, then z= 7. The set answer. Answer: Suppose I. is regular Let n be given by pumping lemma. = talble' nA ; . = {a'b'c'/where i, j, k are integer and i, j, k 2A). Is L regular? Justify your [WBUT 2008] FAT-72Be broken up as shown|y|>0 Hence xz € L, 120 by pumping lemma. . P
n. Clearly jz) >= n. Let adversary choose a decomposition uvw Let |ul = p, [v= 4 and |w| =r So we have: q>0 p+q
0} Let L be regular. Let “adversary” choose n. We choose z = a°b". Obviously, [z| >= n Now, let adversary choose decomposition z = uvw such that |uv| <= n and Ivy|>0. We note that whatever be the decomposition, the string uv consists only of 0-s and y has at least 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 I-s at the end, allowing us to conclude that ws 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. 10. What are Kleene Closure and Positive Closure? Give example for both. [WBUT 2011, 2017) oR, What is Klenne’s star? Give example. What is positive closure? Give example. [WBUT 2016] Answer: For a Regular expression R, Kleene closure, denoted by R* expression obtained by concatenating zer 0 or more R-s. Thus, R* = |R|RR|RRR.. closure, denoted by R+, is defin + is defined to be the «+ where the vertical bar means disjunction, A Post ed to be the expression on concatenating one or more R-s. Thus, R+ =< R|RR| RRR... Example: Suppose R=albb Then, R¥= elalbb|aalabb|bba\bbo4| Re = albb|aalabb| bba|bbb4| the other hand is obtained by FAT-74ion for the DFA using Arden Theorem [WBUT 2011, 2012, 2016] 11. Give the Regular Expr Answer? NG The state equations are go 8 +G0r GO () Wl Glt gl —Q) gn 3) Substituting (3) in (2) we get ge -altg, (1401) A) We know that if R=Q+ RP, then R= QP" Hence, from (4), qo = ql(1+01)* eS) Substituting (3) and (5) in (1) We get g- 644,04 4,00 = 64g,(041(1+01)*00) org, = £(0+1(1+01)*00)* (0+1(1+01)*00)* Which is the RE for the given transition diagram. 42. Using Pumping Lemma show that L={a"b" :n20} is not regular. (WBUT 2011, 2012) Answer: Let |. be regular. Let “adversary” choose n- We choose 7 = a"b". Obviously, [Z| 7= 9 Now, let adversary choose decomposition z = uvw such that Juv| <= nr and |v > 0. We note that whatever be the decomposition, the string uv consists only of O-s and v has al least 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 I-s at the end, allowing us to conclude that uv isnot in L. Hence L is not regular. QED. Note: Similar logic can be applied to prove the languages Lo fa"! n> Ok > nb non-regular. FAT-75POPULAR PUBLICATIONS 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 js not empty and w, = xy’z is also accepted by M. If y consists of only a’s or only b's the w, will not have the same number of a's as b’s. If y contains both a’s and b’s, then w, wil have a’s followed b’s. In cither case w; does not belong to L, which is contradiction, Thus L is not regular. 13. What will be regular expression over the alphabet {a, b}, for the language L={a"b" :n>=4,m << 3}? [WBUT 2013) Answer: The regular expression over the alphabet {a, b}, for the language L={a"b" in >=4,m co 3} is as follows : Separate into cases m = 0, 1, 2, 3. Generate 4 or more a’s, followed by the requisite number of b’s. So, the regular expression for the following language is aaaaa"(i. + b + bb + bbb). 14. Construct the language for the grammar G=({S},(a,6),5,P), with P given by S—aSb Soa {WBUT 2018] Answer: G=({S}, {a,b}, S, P) with P given by S > aSb, SA S—aSb-a>b-ab S—>aSb—>aaS bb aa > bb aabb S—aSb->aaS bb aaa § bbb + aaabbb So, the Language is > “Equal no. of a's followed by equal no. of b's with Null”. L(G)={a"b";n20} Ans.) FAT-76| FORMAL LANG, . AND AUTOMATA THEORY Lon; Answer uestions a) Construct a minimum state automaton equ) ; ; whose transition table en below: n equivalent to a given Gaaur sare State | Input a | | a Answer: al* a | * |» NESESED qx) ls [* x tele pel || maf onl) wlalala lala i dy minimized. Since all states are distinguishable, the DFA is already i figure: [WBUT 2007] ion corresponding to the following figu b) Find the regular expressio! " 9 Answer: 7 iene 9, 2010, 201; ororyol [WBUT 200! je? : ever 2. a) What is regular languag' defined over & finite alphabet such that Answer: formal languase A regular language is 4 e: string in the language ca” FAT-77POPULAR PUBLICATIONS 4) Accepted by some NEA/DEA b) Described by aregular expression ©) Generated by a Regular (ic. Type 3) Grammar b) Find regular expressions over >, {a} for the languages defined as fojin,, i) Lie fa" b™ sm > 0} i) 12 - far" "| n> 0, mn > Of iii) 13 {b" ab" m>0,n> Oh [WBUT 2009, 2019, 2014 Answei i) Not possible since the language is not regular. ii) (aa) *b(bb)* ii) bb+ abe ¢) Find the regular expression for following transition graph. — [WBUT 2008, 2010) OR, Construct the regular expression corresponding to the state diagram given beloy. [WBUT 2013, Answer: The state equations are gq =6+9q,0+9,0 Al) H=Gltql+al (2) 9 = 9,0 ~-3) Substituting (3) in (2) we get: gz. = l+q,(1+0l) 2.4) We know that if R=Q+RP, then R=QP* Hence. from (4), g.=4,(1+01)* oS) Substituting (3) and (5) in (1) We g gq = 6 +4,044,00 e+ g,(0+1(1+01)*00) FAT-78ORMAL LA LANGUAGE AND AUTOMATA THEORY = €(0+1(1+01)*00)* = (0+1(1+01)*00)* which is the RE for the given transition dia gram. org 1a M defined 3, Construct the mini ee state automata equivalent to given automat [WBUT 2010] below: _— Pe | states | = hd a a 4 _| 4% q | a | 4 lana ae| eer 4 |g | 4 ; ae ae : 4 % 4 (qz indicates that q; is the final state) Answer: q a 4: cm | q | |" | ga ew ee gftadtad pe 4. Using Pumping lemma prove that £=|(' | >1| is not regular. Construct Finite Expression. Automata equivalent to the Regular EXP [wBUT 2014] L=ab(aa+bb)(atb)"®- FAT-79POPULAR PUBLICATIONS Answer: Suppose L in regular and we get a contradiction. Let n be the number of state accepting L. inlA Let w=a". Then [|= n' > 2 by pumping lemma we can write wx with [av]
0 *3ty+lel>ls}eLel el] vye|=[s]+ [f+ Consider xy'z as |y|>0. This means 1 =| «|r as |x sn.|y| sn. Therefore [+3] y] +z sntan Le, Sn tnsn'43n' +3n41 Hence, | xyz strictly lies between n° and (1+1)' but it is not equal to any one of them. Thus | is a contradiction. | in not perfect case and so xyz L. But by pumping lemma xy'ze /.. This 5. Using Pumping lemma prove that 1 ={a"b"|n>1} is not regular. BUT 201 7) Answer: At first, we assume that L is regular and n is the number of s Let w = a’b’. Thus |w| = 2i >i. By pumping lemma, let w = xyz, where |xy|
B_b}A > BC ae answer: (6) c) A>aB d) A a ” 2. L={a"b"c”, wherene lis [WBUT 2009] 9) a) regular iti: b) conte __S)}context sensitive but not context free a sone atinete ae Answer: (c) 3. Which of the following productions is in CNF? [WBUT 20089} a) Sad b) SA AS _ SVS > AB d) All of these Answer: (c) 4. Which is more suitable for an Ambiguous Grammar? [WBUT 2009] a) All ambiguities can be removed b) Ambiguity can be removed by setting priority _eyGnly inherent ambiguity can be removed d) There is no suitable rule for removing ambiguity Answer: (c) 5. The class of CFG is not closed under __-eyifterscction [WBUT 2011] a SO ee d) repeated concatenation ¢) union Answer: (b) [WBUT 2011] 6. Consider the CFG X XY X 2X /bX/a Y—Y¥al¥b/b Any string of terminals, a) has at least one b ecorb’s ¢) has no consecutive oe enerated by the CFG b) ends with a fas at least 2 a’s which can be 9 a than one parse tree for some sentence is said to = nat proauces ore [WBUT 2011] coh grammar tha . igus) unambiguous —d) regular sn a) contiguous Answer: (b) FAT-81POPULAR PUBLICATIONS 8. ACFG, S >aS/bS'/a/b, is equivalent to [WBUT 2011] a) (ath) by (a+h)(at by c) (ath) (ath) d) all of these Answer: (b) 7 9. (P+oy [WBUT 2012] a) (P" +0") by rig 9 (roy AY both (a) and (c) Answer: (d) 10. Which of the following production is in CNF? _ [WBUT 2013] a)S > aa b)SA > AS © AB d) All of these Answer: (c) 11. Consider the following language: L = {a Lis [WBUT 2013] a) CFL but not regular ‘SL but not CFL ¢) Regular d) Type 0 language but not type 1 Answer: (b) 12. Consider the grammar S — aSAbl< A bAle ‘ The grammar generates the strings of the form a‘b! for some i, j20. What is the conditions of the values of i and j? Sere 2015) ajizj b)j$2i ¢) j22i disi Answer: (4) 13. Which of the following common in both CNF & GNF? [WBUT 2014, 2015, 2017] a) (NT) — (Single T) (String of NT) b) (NT) — (Single of exactly two NT) ¢) (NT) —+-(String of NT) AAT) = (Single T) Answer: (d) 14. Consider the languages: 1, ={ww" |W € {0,134} L= {www € {0,1} “| , where # is a special symbol L, = {WWW {0,1} *} Which one of the following is true? IWBUT 2014, 2015, 2017] a) L, is a deterministic CFL _DYL, is a deterministic CFL c) Z,is a CFL, but not a deterministic CFL d) L,is a deterministic CFL Answer: (b) FAT-82FORMAL LANGUAGE AND AUTOMATA THEORY, 15. A context free gramm: a) Product ‘ar is not closed under [WBUT 2016) _9r-Complementation b) Union Answer: (c) d) Kleen star 16. Context sensitive gramm: i: dominate posh oman 8 7 non-det it i pene sterministic Push down machine _-dyfinearly bounded memo Answer: (4) ry machine 3 bl ‘ontext sensitive [WBUT 2016] q) Answer: (b) !) none of these 17. Which of the following is most general ee grammar? [WBUT 2018) 18.CFLis______tanguage. d) Type 3 a) Type 0 b) Type 1 Answer: (c) 4. Convert the following context free grammar into an equivalent grammar in CNF: S—>aAbB A> abAB/aAAla [WBUT 2006, 2007, 2010] B—> bBaA/aBB/b Answer: ae presented as C and D respectively. Let us assume that a and b may be re So, the products are as follows:- SCABD A>CDABICAAa B—DBCAICBB|b Coa ye A be G and DB be Let us assume that AA be E, BB be F, CA be Gat S>GH AGH BGH Coa Db ESAA FBB GCA H. So the productions are:- FAT-83POPULAR PUBLICATIONS H-BD 2. a) What do you mean by a sub-tree of a derivation tree? [WBUT 2008] Answer: A subtree of a derivation tree is a partial derivation tree such that, for any node of the subtree, either all of its children are also in the subtree, or none of them are. b) Consider G whose productions are S—raAS/a, A--SbA/SS/ba. Show that S—aabbaa by constructing a derivation tree, by right most derivation, whose yield is aabbaa. ¢ _ BNBUT 2008] Answer: S+aAS ZN —saSbAS —aabAS “ i> . —saabbaS A 4 > —aabbaa (proved), 3. Reduce the following grammars to GNF: [WBUT 2008) S—A0, A-+0B, B0A, B41 ‘Answer: ‘As it is already in GNF form, so there is no requirement for converting it into GNF. 4, Write the CFG for the language [WBUT 2008, 2012] L={0! 1! 2" | isj or =k}. Answer: S—AB|B A >0A/0 B>1B2\12 5. Let G be a grammar [WBUT 2009, 2010] 5 0B|14,4>0[05| 144, B +1] 15 |0BB. For the string 00110101, find i) leftmost derivation rightmost derivation iii) derivation tree Convert the following Context-free grammar into an equivalent grammar in CNF S—1A/0B A>1AA/08/0 BoOBBIIS/I [WBUT 2041] Answer: i) ren» OB => O0BB = 0018 = 0011S => 00110B = 0011018 = 00110108 => 001 10101 FAT-84FORMAL LANGUAGE AND AUTOMATA THEORY ii) S=> 0B > 00BB = 0081S = 00B10B = oon0IS = 00B1010B => 00810101 => 00110101 - iii) b — 6. Let G be the grammar [WBUT 2011] S—aB/ba, Aa/aS/bAA, B-»b/bS/aBB For the string aaabbabbba , find a) leftmost derivation b) rightmost derivation c) parse tree. Answer: a) S>aB= aa, BB = aaa BBB = waabBB = aaabbSB abbaBB = aaabbab B => aaabbab an S => aaabbabbba Bhba => aaaB Bbba b) S=9aB = aaBB> aaBbS = a4 |Bhabbba > aaabbabbba =>aaaBbSbba > aaaBbaBbba = aaa. FAT-85POPULAR PUBLICATIONS ce) 5 aN a a [Ss MN | IN 1, b 7. What is Griebach Normal Form (GNF) for Context Free grammar? Convert the following grammar into GNF [WBUT 2011, 2012, 2016] S—>ABbla A->vaaalB B->bAb Answer: A Context Free Grammar is said to be in Greibach Normal Form if each rule in the grammar has one of the following forms. 1. A ad A, «A, 2A+a where, 4:4, €V,,i=1,2.........nandae > If & belongs to the language of the grammar, the rule 4-5 ¢ (where S is the stat symbol) is also permitted. Greibach's Theorem: Every Context Free Language can be gener- ated by a Context Free Grammar which is in Greibach Normal Form GNF. ° : The above theorem implies that given a grammar G (which generates the language /G) the grammar can be converted to an equivalent grammar G’ which is in GNF such that 1(G')= L(G) For Step-0, we need to add a rule ¥ -». So we start the main process of conversion of the grammar to GNF with the rules: S— ABY\a A->aad|B FAT-86B- bBY Yoob There is no immediate left Tecurstion in the grammar. We select the order S,AB.Y, So, the final grammar in GNF is: Yb Bo bBY A~aad|bBY S aaBY|DBY BY|a 8. Find a GNF grammar equivalent to the following CFG: A> A,A, A> AA|b A> AAla Answer: Given: A, > 4,4, A> Alb 4 > AA|a The grammar is already in CNF. Round-1 A> AA, 4, > AAA|aAlb A> AA|a Round-2 A, > A,A,A,As|04,A]b4s / But this requires removal of left recursion 4, > ad, AZ| AZ 0A AoA Z-> AAAAL|AAAA Ay > AArAladl® 47 AA,|a FAT-87 FORMAL LANGUAGE AND AUTOMATA THEORY Clearly there is no need for nonterminal substitution. [WBUT 2012]
You might also like
BNY Mellon OA Questions
PDF
No ratings yet
BNY Mellon OA Questions
11 pages
Basic TOC 2022 - Solution of CFL - TM & Backside Test
PDF
No ratings yet
Basic TOC 2022 - Solution of CFL - TM & Backside Test
163 pages
Juspay 2
PDF
100% (1)
Juspay 2
4 pages
TAFL AKTU Last 5 Years Papers
PDF
No ratings yet
TAFL AKTU Last 5 Years Papers
12 pages
Automata and Complexity Theory
PDF
No ratings yet
Automata and Complexity Theory
42 pages
FLAT Notes
PDF
No ratings yet
FLAT Notes
50 pages
MODULE 3 Syntax Analysis
PDF
100% (1)
MODULE 3 Syntax Analysis
182 pages
Moore and Mealy Machine
PDF
No ratings yet
Moore and Mealy Machine
9 pages
CoCubes Test 1
PDF
No ratings yet
CoCubes Test 1
17 pages
Merged Mcqs
PDF
No ratings yet
Merged Mcqs
214 pages
6 - State Table Based Testing
PDF
No ratings yet
6 - State Table Based Testing
31 pages
Theory of Computation Long Type of Questions-1
PDF
100% (1)
Theory of Computation Long Type of Questions-1
22 pages
Simplification of CFG: Presented To Presented by
PDF
100% (2)
Simplification of CFG: Presented To Presented by
12 pages
Compiler Design - Chapter 4 - Syntax Directed Translation
PDF
No ratings yet
Compiler Design - Chapter 4 - Syntax Directed Translation
49 pages
Moore and Mealy Machines - Tutorialspoint
PDF
100% (1)
Moore and Mealy Machines - Tutorialspoint
6 pages
Examples: Finite Automata With Output
PDF
No ratings yet
Examples: Finite Automata With Output
6 pages
Rich Automata Solns
PDF
100% (1)
Rich Automata Solns
187 pages
@vtucode - in Module 2 ATC 5th Semester 2021 Scheme
PDF
0% (1)
@vtucode - in Module 2 ATC 5th Semester 2021 Scheme
49 pages
Introduction To Common Lisp
PDF
No ratings yet
Introduction To Common Lisp
32 pages
Arduino - Loop Statement
PDF
No ratings yet
Arduino - Loop Statement
23 pages
Theory of Computation: II B. Tech. - II Semester L T P C Course Code: A3CS10 4 1 - 4
PDF
0% (1)
Theory of Computation: II B. Tech. - II Semester L T P C Course Code: A3CS10 4 1 - 4
2 pages
Finite Automata: Basic Terminologies
PDF
100% (1)
Finite Automata: Basic Terminologies
12 pages
Moore and Mealy Machines
PDF
No ratings yet
Moore and Mealy Machines
21 pages
Moore and Mealy Machines
PDF
No ratings yet
Moore and Mealy Machines
4 pages
Flat 01
PDF
No ratings yet
Flat 01
100 pages
Turing Machine
PDF
No ratings yet
Turing Machine
3 pages
Basic Terminologies
PDF
No ratings yet
Basic Terminologies
8 pages
Formal Language and Automata Theory: UNIT-1
PDF
No ratings yet
Formal Language and Automata Theory: UNIT-1
38 pages
MT Kenya University: Department of Information Technology Course Code: Course Title: Basic Discrete
PDF
No ratings yet
MT Kenya University: Department of Information Technology Course Code: Course Title: Basic Discrete
72 pages
Topic 4
PDF
No ratings yet
Topic 4
198 pages
Class 11 converting NFA with ε to DFA
PDF
No ratings yet
Class 11 converting NFA with ε to DFA
9 pages
Lecture 10-Mealy and Moore Machine and Their Conversions
PDF
No ratings yet
Lecture 10-Mealy and Moore Machine and Their Conversions
5 pages
Full Notes
PDF
No ratings yet
Full Notes
152 pages
Formal Languages & Automata
PDF
No ratings yet
Formal Languages & Automata
100 pages
Coding Questions 09-11-2024
PDF
0% (1)
Coding Questions 09-11-2024
5 pages
Formal Language & Automata Theory
PDF
No ratings yet
Formal Language & Automata Theory
19 pages
Chapter 2 RegularExpressions
PDF
No ratings yet
Chapter 2 RegularExpressions
95 pages
NFA ( (Unsaved 310885703214693280) )
PDF
No ratings yet
NFA ( (Unsaved 310885703214693280) )
15 pages
Finite State Machine: 2.1 Automata
PDF
No ratings yet
Finite State Machine: 2.1 Automata
65 pages
CH10-COA10e - Computer Arithmetic PDF
PDF
No ratings yet
CH10-COA10e - Computer Arithmetic PDF
56 pages
Microprogrammed Control
PDF
No ratings yet
Microprogrammed Control
56 pages
Toc Unit-1 Part-2
PDF
No ratings yet
Toc Unit-1 Part-2
23 pages
Unit 2a
PDF
No ratings yet
Unit 2a
31 pages
Arden's Theorem, Moore Machine, Mealy Machine
PDF
No ratings yet
Arden's Theorem, Moore Machine, Mealy Machine
31 pages
Chapter 11 - Digital Logic
PDF
No ratings yet
Chapter 11 - Digital Logic
24 pages
Introduction To Compiler Design - Solutions
PDF
0% (1)
Introduction To Compiler Design - Solutions
23 pages
Practice Questions Logic
PDF
No ratings yet
Practice Questions Logic
15 pages
Moore and Mealy Machines: By: Engr - Syed Atir Iftikhar
PDF
No ratings yet
Moore and Mealy Machines: By: Engr - Syed Atir Iftikhar
21 pages
Unit-2 (TOC) GGSIPU Previous Year Questions
PDF
No ratings yet
Unit-2 (TOC) GGSIPU Previous Year Questions
4 pages
Handout 4: Iii. Turing Machines
PDF
No ratings yet
Handout 4: Iii. Turing Machines
12 pages
Verilog Sequential Modeling
PDF
No ratings yet
Verilog Sequential Modeling
8 pages
Term-Paper of Formal Languages and Automation Theory: Faisal Hussian Shah
PDF
No ratings yet
Term-Paper of Formal Languages and Automation Theory: Faisal Hussian Shah
8 pages
Tcs Paper Soln
PDF
No ratings yet
Tcs Paper Soln
37 pages
Automata Theory
PDF
No ratings yet
Automata Theory
9 pages
Type - 0 Grammar: Type-0 Grammars Generate Recursively Enumerable Languages. The
PDF
No ratings yet
Type - 0 Grammar: Type-0 Grammars Generate Recursively Enumerable Languages. The
4 pages
Theory of Computation
PDF
50% (2)
Theory of Computation
1 page
Toc Unit III
PDF
No ratings yet
Toc Unit III
14 pages
(WWW - Entrance-Exam - Net) - Hexaware Placement Sample Paper 1
PDF
No ratings yet
(WWW - Entrance-Exam - Net) - Hexaware Placement Sample Paper 1
4 pages
Computer Algoritham For Chennai Univarsity Unit5
PDF
No ratings yet
Computer Algoritham For Chennai Univarsity Unit5
11 pages
Intro To Automata Theory
PDF
No ratings yet
Intro To Automata Theory
23 pages