CS 390 Solutions to Unit 18 Exercises



p. 195

5.23 (a)  
5.20(a): Let n be the number of states of DFA that accepts L. Consider the string x = 0n102n.

Suppose that x is written as x = uvw, |v| > 0, |uv| n.
There are three possibilities for v: v = 0k from the first part of x for some k, v = 0k1 for some k including 0, and v = 0k from the lasrt part of x for some k.

If v = 0k from either part of x, then uv2w is not in L since it is not in the form 0n102n.
If v = 0k1 for some k including 0, then uv2w has two 1's. Hence it is not in L.
Hence by Pumping Lemma, L is not regular.

5.20(c): Let n be the number of states of DFA that accepts L. Consider the string x = 0n12n.

Suppose that x is written as x = uvw, |v| > 0, |uv| n.
There are three possibilities for v: v = 0k for some k, v = 0k1m for some k and m, and v = 1k for some k.

If v = 0k for some k, then repeat v t times so that tk > 2n. Then uvtkw = 0p+tk+q12n, where u = 0p, w = 0q12n and n = p + k + q. Hence p +tk + q > 2n. Hence 0p+tk+q12n is not in L.
If v = 0k1m for some k and m, then v2 = 0k1m0k1m. Hence uv2w can not be in in L.
Finally, if v = 1k for some k, then uv2w = 0n1p12k1q, where u = 0n1p, w = 1q and 2n = p + k + q. Hence p + 2k + q > 2n. Hence uv2w is not in the language L.

Thus by Pumping Lemma, L is not regular.