COT4420 Theory of Computation February 4, 2016 Problem Set 3 Due February 16, 2016 1. Which of the following sequences belong to the set denoted by the regular expression: (1 + 0*11)* (0 + 10 (0 + 11)*10) (a) 100010 (b) 10001 (c) 010101 (d) 1111110 (e) 0001100 (f) 0001110 2. Consider the two regular expressions: r = a* + b* and s = ab* + ba* +b*a + (a*b)* (a) Find a string in r but not in s. (b) Find a string in s but not in r. (c) Find a string in both r and s. (d) Find a string in {a,b}* that is in neither r nor s. 3. Consider the n.f.a pictured below: a q0 λ q4 q1 a b q2 b a q3 λ Eliminate the λ transitions from this n.f.a to create an equivalent n.f.a without λ (or epsilon) transitions. 4. (a) Construct an n.f.a with no more than 5 states that accepts the set: {ababn : n ≥ 0} ∪ {aban : n ≥ 0}. (b) Convert your n.f.a. in part (a) to a d.f.a. 5. Which of the following languages are regular sets. Justify your answer. (a) { (0110)2n : n ≥ 0 } (b) { anbm : n + m is odd } (c) { x xR : x ∈ {a,b,c}* } (note that that xR denotes the reverse of the string x.) (d) {w x wR : w, x ∈ {a,b}+ } (e) { an^2 : n ≥ 1 } 1 6. Give concise word descriptions of the sets denoted by the following regular expressions: (a) (0+1)*010(0+1)* (b) (0 +11)*(1 + λ) (c) 00(11*)(00*) (d) (11 + 111 + 11111)* 7. Construct a d.f.a. that accepts the language generated by the following regular grammar: G = ({S , A, B}, {a, b}, P, S ) with P: S -> bA | aB | λ A -> abS | aaS B -> baS |bbS 8. Consider the following n.f.a. Find an equivalent regular grammar. The start state is q0. b q1 q0 a b b a q2 a 9. Explain how every NFA can be converted into an equivalent NFA that has a single final state. Why is this important? Give a counterexample to show that this is not true for DFAs. 10. Using generalized transition graphs, eliminate the middle state and find the equivalent regular expression for the acceptor below. a c a b a c c 2 11. A language is said to be a palindrome language if L = LR. Find an algorithm for determining if a given regular language is a palindrome language. 12. (a) Prove using the pumping lemma that the following languages are not regular: i. L = { na(w) ≠ nb(w) } ii. L = { wcw : w ∈ {a,b}* } iii. L = { 0m1n : 0<n≤ m} (b) Consider the languages below. For each, make a conjecture whether or not it is regular. Then justify your conjecture. i. L = { anbm : n ≤ m ≤ 2n } ii. L = { anbm : n ≤ 25, m ≥ 50} 13. Suppose that we know that L1 ⋃ L2 is regular and that L1 is finite. Can we conclude that L2 is regular? Explain. 14. Let L be a regular language over Σ = {a,b,c}. (a) Show that an algorithm exists for determining if L contains any strings of even length. (Hint: is the set of strings of even length a regular language?) (b) Show that an algorithm exists for determining if L contains an infinite number of even-length strings. 3