40 likes | 211 Views
Homework 2. DFA definition. 1. Given the DFA : a) Draw a state transition diagram for the DFA M. b) Let M = (Q, S , d , s, F). Then what are the contents of Q, S , d , S and F, respectively. Q = _______________________ S = _____________________
E N D
DFA definition 1. Given the DFA : a) Draw a state transition diagram for the DFA M. b) Let M = (Q, S, d, s, F). Then what are the contents of Q, S, d, S and F, respectively. • Q = _______________________ S = _____________________ • s =_______________________ F =______________________ • d = _____________ c) List all strings of length 3 which are accepted by the machine.
DFA design Answer problem 2 & 3 using state transition diagram. Note #a(x) denotes the number of a's appearing in x. • Let S= {a,b}. Construct DFA's for the following languages : • A1 = { b, aa, ab, abba}. • A2 = {x | x contains at least one a, i.e., #a(x) 1 } • A3 = { x | x contains no more than two a's, i.e., #a(x) 2} • A4 = { x | x has exactly two a’s and exactly one b, i.e, #a(x) = 2 and #b(x) = 1. } 3. Let S= {a,b}. Construct DFA's for the following languages: • L1 = { xaaby | x,y {a,b}* } • L2 = { x {a,b}* | #a(x) mod 4 = 2 } . • L3 = { x a y | |x| 2, |y| 2 and x,y {a,b}* } • L4 = { x {a,b}* | Every occurrence of 'ab' in x is followed immediately by 'ba'. }. For instance, 'a', 'abba', 'aabbabba' are in L4 while 'ab', 'abbb', 'aabbaaba' are not.
Regular languages are closed under union and intersection 4. Use state transition table for your answer. 4.1 Given the following two DFAs : • Use the product construction to generate two DFAs M3 and M4 such that • 1. L(M3) = L(M1) - L(M2) and 2. L(M4) = L(M1) LM(2). 4.2: Find a DFA M5 for the language B = { x {a,b}* | x contains substring ‘ba' but not ‘baa' } by firstly • construct two DFA M51 and M52 such that L(M51) = { x {a,b}* | x contains substring ‘ba' } and L(M52) = { x {a,b}* | x contains substring ‘baa' } and then • use the product construction to construct M5 such that L(M5) = L(M51) - L(M52) = B.