Solution to HW1 of Honors Theory

February 27, 2002

1. (10+10 Points) (i)

2. (10+10 Points) (i) (0 + 1) ∗ 0101(0 + 1)∗ (ii) (01) ∗ +(01) ∗ 0 + (10) ∗ +(10) ∗ 1

3. (10+10 Points)

(i)

(ii)

4. (10+10+10+10 Points)

(i) It’s regular, as there is a NFA M1 that recognizes it. The regular expression (1111111)∗ describes it.

(ii) It’s regular, as there is a DFA M2 that recognizes it.

To understand this, note that the state labeled i (for i = 0, 1, …, 6) indicates the binary string read so far is equal to i mod 7. It is easy to verify this for each of the arrows. For instance, from state 1, if we see 0, then we go to state 2. This is because if the current string w has a binary value of 7m + 1, then the new string w0 has value 14m + 2 which is congruent to 2 mod 7.

Most student’s solution is slightly defective in that their dfa accepts the empty string, which does not represent any binary number.

(iii) Use the pumping lemma to prove the language A is not regular. Assume to the contrary that the language A is regular. Let p be the pumping length given by the pumping lemma. Choose s to be the string 0^{p}10^{m}10^{p+m}. Because s is a member of A and s has length more than p, the pumping lemma guarantees that s can be split into three pieces, s = xyz, where for any i ≥ 1, the string xy^{i}z is in A. By conditin 3, y consists only of 0’s, let y = 0^{k}, k > 0. The string xy^{2}z = 0^{p+k}10^{m}10^{p+m} can not be a member of A, as p + k + m ≠ p + m for any k > 0. Thus we obtain a contradiction.

(iv) Use the pumping lemma to prove the language B is not regular. Assume to the contrary that B is regular. Let p be the pumping length given by the pumping lemma. Choose s to be the string 0^{p}1^{p}. Because s is a member of B and s has length more than p, the pumping lemma guarantees that s can be split into three pieces, s = xyz, where for any i ≥ 0 the string xy^{i}z is in B. By condition 3, y consists only 0’s, let it be 0^{k} where k > 0. The string xy^{2}z = 0^{p+k}1^{p} can not be a member of B. Thus we obtain a contradiction.

5. (20+20 Points) (i) If A is regular, then some regular expression R describes it. We construct a regular expression R′ from R by replacing each symbol a ∈ Σ in R with the string h(a). We must now show L(R′) describes h[L(R)]. BASIS: (a) If R = ∅ which means A and h[A] are empty sets, then R′ = ∅, so h[A] = L(R′).

(b) If R = ϵ which means A = {ϵ}, and h[A] = {h(ϵ)} = {ϵ}, then R′ = ϵ, so h[A] = L(R′).

(c) If R = a where a ∈ Σ, which means A = {a}, h[A] = {h(a)}, then R′ = h(a), so h[A] = L(R′). INDUCTION: Suppose R, R_{1}, R_{2} are regular expressions, and R′, R′_{1}, R′_{2} are their transformations as above. Assume that inductively, h[L(R_{i})] =