1
1
1
Problem 1. Create a DFA that represents the language {binary representation of n ∈ N | n mod 8 is either 4 or 1}
Problem 2. Create a regular expression over the alphabet {0, 1} that represents the language mentioned in
Problem 1.
Problem 3. Construct a DFA which accept the language L = {w | w ∈ {a, b}∗ and N a(w) mod 3 = N b(w)
mod 3}, where N a(w) and N b(w) return the number of occurrences of a and b in w respectively.
Problem 4. Construct a DFA that recognizes the following language over the alphabet {0, 1}.
Problem 5. Let Cn = {x | x is a binary number that is a multiple of n}. Show that for each n ≥ 1, the
language Cn is regular. Provide a general construction for Ci for i ≥ 0.
Problem 6. You already know from the lectures that regular languages are closed under complementation.
Given DFAs D1 and D2 that recognize languages L1 (over Σ1 ) and L2 (over Σ2 ) respectively, construct an
automaton D recognizing the following languages, if you believe that the class of regular languages is closed
under the following operations. Provide a counterexample otherwise.
1. Difference: L1 \ L2 := {x | x ∈ L1 and x ∈
/ L2 }
2. Star: L∗1 := {w1 w2 . . . wn | wi ∈ L1 for n ≥ 0, and every 1 ≤ i ≤ n}
Problem 7. Design an efficient algorithm that takes input the description of a DFA D and determines if
the resulting language L(D) is
1. Empty
2. Infinite
3. Σ∗
Problem 8. Given two DFAs, D1 and D2 , design an efficient algorithm to determine if L(D1 ) = L(D2 ).
Problem 9. L1 = (0|1)∗ 0(0|1)∗ 1(0|1)∗ , L2 = (0|1)∗ 01(0|1)∗ . Show that the two languages are equal.
Problem 10. Let L1 be a regular language and L2 be any language (not necessarily regular) over the same
alphabet Σ. Prove that the language L = {x ∈ Σ∗ | x · y ∈ L1 for some y ∈ L2 } is regular by defining a DFA
for L starting from a DFA for L1 and the language L2 .
Problem 11. ϕ : Σ∗ → Γ∗ is called a homomorphism over strings if for all x, y ∈ Σ∗ , ϕ(xy) = ϕ(x)ϕ(y).
Show that if L is a regular language, then ϕ(L) := {y ∈ Γ∗ | y = ϕ(x), x ∈ L} where ϕ is a homomorphism
as defined above is also regular.
Problem 12. Prove that the class of regular languages is closed under inverse homomorphisms. That is,
prove that if L ⊆ Γ∗ is a regular language and ϕ : Σ∗ → Γ∗ is a string homomorphism, then ϕ−1 (L) = {x ∈
Σ∗ | f (x) ∈ L} is regular.
1
Problem 13. Prove that the class of non-regular languages is not closed under the Union operation.
Hint: use the closure properties mentioned in the lectures.
Problem 14. Let L be an arbitrary regular language. Prove that the following languages are regular.
1. {x | x · reverse(x) ∈ L}
2. {x | x · reverse(x) · x ∈ L}.
3. {x | xxx ∈ L}
Problem 15. Let L be a regular language with DFA D. We define Pre(L) = {x | x is a prefix of some y ∈
L}. Show that Pre(L) is regular by constructing a DFA.
Problem 16. Let A be any language. Define DROP-OUT(A) to be the language containing all strings
that can be obtained by removing one symbol from a string in A. Thus, DROP-OUT(A) = {xz|xyz ∈
A where x, z ∈ Σ∗ , y ∈ Σ}. Show that the class of regular languages is closed under the DROP-OUT
operation.