Problem 1: CS 103 Homework 6 Solutions Spring 2013-14
Problem 1: CS 103 Homework 6 Solutions Spring 2013-14
Problem 1
For this question, Σ = {a, b}.
– ((a|b)* (aaa|aab|abb|baa|bab|bba|bbb))|(a|b|ε)(a|b|ε)
– The first part of this regular expression generates all strings w with |w| ≥ 3 that don’t end in aba.
The second part of the regular expression generates all strings w with |w| < 3, which by definition
don’t end in aba.
Problem 2
For this question, Σ = {a, b}.
– What is the minimum number of states that a DFA to recognise L must have? Give a represen-
tative string from each equivalence class.
– Write a regular expression for L. (Submit this online : HW6 2a)
– Give a short (1-2 sentences) justification for the logic behind the regular expression.
b. Let L = {w|w ∈ Σ∗ , w has an odd number of as and starts and ends with a b}.
– What is the minimum number of states that a DFA to recognise L must have? Give a represen-
tative string from each equivalence class.
– Write a regular expression for L. (Submit this online : HW6 2b)
– Give a short (1-2 sentences) justification for the logic behind the regular expression.
CS 103 Homework 6 Solutions Spring 2013-14
Problem 3
For this question, Σ = {a, b}.
n 2
o
a. Let L = an bn |n ∈ N . Use the Myhill Nerode theorem to prove that L is not regular.
b. Let L = {w|w ∈ Σ∗ , w = wR } 1 . Use the Myhill Nerode theorem to prove that L is not regular.
Problem 4
Let L = {w ∈ {0, 1, 2}∗ |w contains the same number of copies of the substrings 01 and 10 }. Is L regular?
If so, give a regular expression for L (Submit this online : HW6 4opt - optional, of course). If not, use the
Myhill Nerode theorem to prove that L is not regular.
Problem 5
a. – Convert the following NFA to a DFA using the subset construction. (Submit the resulting DFA
online : HW6 5a)
– List the subsets of {A, B, C, D} that correspond to states in the constructed DFA.
A a B
b b
a
D C
b. Minimise the resulting DFA. (Submit the minimised DFA online : HW6 5b)
A a B
b b a, b
a
b
B, D C
b
a
A B, D
a, b
a, b a b
a
b
C