Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transparency No. 2-1 Formal Language and Automata Theory Homework 2.

Similar presentations


Presentation on theme: "Transparency No. 2-1 Formal Language and Automata Theory Homework 2."— Presentation transcript:

1 Transparency No. 2-1 Formal Language and Automata Theory Homework 2

2 Homework Transparency No. 2-2 DFA definition 1. Given the DFA : (a) Draw a state transition diagram for the DFA M. (b) Let M = (Q, , , s, F). Then what are the contents of Q, , , S and F, respectively. Q = _______________________  = _____________________ s =_______________________ F =______________________  = _____________ (c) List all strings of length  3 which are accepted by the machine. M cd 0 31 11 23 2F 12 3F 30

3 Homework Transparency No. 2-3 DFA design Answer problem 2 & 3 using state transition diagram. Note #a(x), where a is a symbol, denotes the number of a's appearing in x. 2.Design deterministic finite automata (FDA) for each of the following sets: (a) the set of strings in {a,b,c}* containing the substring abc; (b) the set of strings in {a}* whose length is divisible by either 3 or 5; (c) the set of strings x in {0,1}* such that #0(x) is odd and #1(x) is a multiple of three; (d) the set of strings over the alphabet {a,b} containing at least three occurrences of three consecutive b's, overlapping permitted (e.g., the string bbbbb should be accepted); (e) the set of strings overt he alphabet {0; 1; 2 } that are ternary (base 3) representations, leading zeros permitted, of numbers that are not multiples of four. (Consider the empty string  a representation of zero.) 3.Let  = {a,b}. Construct DFA's for the following languages : (a) A1 = { a, ab, ba, bbaa}. (b) A2 = { x | x contains at most two a's, i.e., #a(x)  2} (c) A3 = { xaba | x  {a,b}* } (d) A4 = { x b y | |x|  2, |y| > 0 and x,y  {a,b}* }

4 Homework Transparency No. 2-4 Regular languages are closed under basic set operations 4. Use state transition table for your answer. (a) Given the following two DFAs M1 and M2 : Construct two DFAs M3 and M4 such that 1. L(M3) = {a,b}* - L(M1) and 2. L(M4) = L(M1) U LM(2) -- use the product construction. (b) : Find a DFA M5 for the language B = { x  {a,b}* | x contains substring ‘bab' but not ‘bb' } by firstly 1.construct two DFA M51 and M52 such that L(M51) = { x  {a,b}* | x contains substring ‘bab' } and L(M52) = { x  {a,b}* | x contains substring ‘bb' } and then 2.use the product construction to construct M5 such that L(M5) = L(M51) - L(M52) = B. M1ab >pFpr qpq rFqp M2ab >112 2F21

5 Homework Transparency No. 2-5 NFA to DFA 5. Let N1={Q, , ,S,F) be an NFA with the following transition table: (a) : What is the value of Q, , ,S and F, respectively? (b) : Draw a state transition diagram for N1. (c) : Final all strings of length  3 accepted by N1. (d) : Find a DFA M1 equivalent to N1. Give your answer using transition table. Remember to name each state of M1 with the corresponding state subset of N1. 6. Let M = (Q;  ;  ; s; F) be an arbitrary DFA. Prove by induction on |y| that for all strings x,y  * and q  Q,  (q, xy) =  (  (q, x), y) where  is the extended version of  defined on all strings described in ch2. Q\  ab >0{0,2}{0} 1{1}{2} 2F{1,3}{3} 3F{0}{1}


Download ppt "Transparency No. 2-1 Formal Language and Automata Theory Homework 2."

Similar presentations


Ads by Google