Professional Documents
Culture Documents
Tut-3 Solutions
Tut-3 Solutions
Tut-3 Solutions
Tutorial-3
Note: ∗ marked problems can be left to the students to try after the tutorial.
Problem 1 Design a DFA for the language, over Σ = {a, b}, such that all strings in the language contain
Now we construct the DFA for the given language as discussed in the class.
1
Figure 1: Solution to Problem 2.1.
2. (∗) L2 = {x ∈ {0, 1}∗ | x contains two 0s separated by a substring whose length is a multiple of 3}.
Solution:
2
Problem 3 (∗) Say that string x is a prex of y if a string z such that y = xz and that x is a proper
prex of y if x ̸= y. Let A be a regular language.
1. Q′ = Q.
δ(r, a) if r ∈
/F
2. For r ∈ Q′ and a ∈ Σ dene δ ′ (r, a) =
∅ if r ∈ F
3. q0′ = q0 .
4. F ′ = F .
1. ({q0 , q1 , q2 , q3 }, {0, 1}, δ, q0 , {q3 }) where δ is Solution: The equivalent DFA is given be-
given in the below table. low. The states marked with ∗ are the nal
states.
δ 0 1 δ 0 1
→ q0 {q0 , q1 } {q0 } → {q0 } {q0 , q1 } {q0 }
q1 {q2 } {q2 } {q0 , q1 } {q0 , q1 , q2 } {q0 , q2 }
q2 {q3 } ∅ {q0 , q1 , q2 } {q0 , q1 , q2 , q3 } {q0 , q2 }
q3 {q3 } {q3 } {q0 , q2 } {q0 , q1 , q3 } {q0 }
∗{q0 , q1 , q2 , q3 } {q0 , q1 , q2 , q3 } {q0 , q2 , q3 }
∗{q0 , q1 , q3 } {q0 , q1 , q2 , q3 } {q0 , q2 , q3 }
∗{q0 , q2 , q3 } {q0 , q1 , q3 } {q0 , q3 }
∗{q0 , q3 } {q0 , q1 , q3 } {q0 , q3 }
2. (∗) ({q0 , q1 , q2 , q3 }, {0, 1}, δ, q0 , {q1 , q3 }) where Solution: The equivalent DFA is given be-
δ is given in the below table. low. The states marked with ∗ are the nal
states.
δ 0 1
δ 0 1
→ q0 {q1 , q3 } {q1 }
→ {q0 } {q1 , q3 } {q1 }
q1 {q2 } {q1 , q2 }
∗{q1 , q3 } {q2 } {q0 , q1 , q2 }
q2 {q3 } {q0 } ∗{q1 } {q2 } {q1 , q2 }
q3 ∅ {q0 } {q2 } {q3 } {q0 }
∗{q0 , q1 , q2 } {q1 , q2 , q3 } {q0 , q1 , q2 }
∗{q1 , q2 } {q2 , q3 } {q0 , q1 , q2 }
∗{q3 } ∅ {q0 }
∗{q1 , q2 , q3 } {q2 , q3 } {q0 , q1 , q2 }
∗{q2 , q3 } {q3 } {q0 }
∅ ∅ ∅