1. Assume otherwise that A is regular. Let p be the pumping length

1. Assume otherwise that A is regular. Let p be the pumping length given by pumping lemma. p p p
Choose s = a b a b a b, then s ∈ A, and |s| = 3p + 3 > p By pumping lemma, s can be split into three pieces s = xyz such that i
1. xy z ∈ A for every i=0,1,2... 2. |y|>0 3. |xy| <= p Since |y| > 0 and |xy| <= p, y can only contain a’s and must include at least one ‘a’. 0
k p p
Pumping y down, we have xy z = a ba ba b, for some k < p. This string must belong to 0
k p p
A and so let xy z = a ba ba b = uuu for some u. Obviously, u must end with ‘b’, start k
p
with ‘a’ and so we must have u = a b = a b, which is impossible because k < p. Hence, the contradiction. In conclusion, A is not regular. 2. n n
*
* p q
The complement of {a b |n>=0} is the union of ∑ ba∑ and {a b |p,q ∈ N, p≠=q} S -­‐> T | U T -­‐> WbaW W -­‐> aW | bW | Ɛ U -­‐> aUb | A | B A -­‐> aA | a B -­‐> Bb | b 3. Because A appears on the right side of its rule, introduce a new start state S S -­‐> A A -­‐> BAB | B | Ɛ B -­‐> 00 | Ɛ Remove B -­‐> Ɛ S -­‐> A A -­‐> BAB | BA | AB | B | Ɛ (A -­‐> A is always true and not necessary) B -­‐> 00 Remove A -­‐> Ɛ S -­‐> A | Ɛ A -­‐> BAB | BA | AB | B B -­‐> 00 Remove A -­‐> B S -­‐> A | Ɛ A -­‐> BAB | BA | AB | 00 B -­‐> 00 Remove S -­‐> A S -­‐> BAB | BA | AB | 00 | Ɛ A -­‐> BAB | BA | AB | 00 B -­‐> 00
Adding additional rules S -­‐> BC | BA | AB | ZZ | Ɛ A -­‐> BC | BA | AB | ZZ C -­‐> AB B -­‐> ZZ Z -­‐> 0 4. n n n n
5. Assume that B = {0 1 0 1 |n >= 0} is context free Let p be the pumping length in the pumping lemma p p p p
Choose s = 0 1 0 1 , then s ∈ B, and |s| = 4p > p By pumping lemma, s can be split into five pieces s = uvxyz such that i i
1. uv xy z ∈ B for i=0,1,2,... 2. |vy| > 0 3. |vxy| <= p Since |vxy| <= p and |vy| > 0, there can only be the following cases: k n a) vxy = 0 for some 0 < k <= p (which is a non-­‐empty substring inside a 0 cluster) i i
In this case, if we pump v and y down (setting i=0 in uv xy z), the two substrings 0 0
of zero’s will not have the same number of zeros. Therefore, uv xy z cannot be a member of B. k n
b) vxy = 1 for some 0 < k <= p (which is a non-­‐empty substring inside a 1 cluster) i i
In this case, if we pump v and y down (setting i=0 in uv xy z), the two substrings 0 0
of one’s will not have the same number of ones. Therefore, uv xy z cannot be a member of B. k l c) vxy = 0 1 for some k, l such that 0 < k+l <= p (which is a non-­‐empty string inside n n k l a 0 1 cluster) or vxy = 1 0 for some k, l such that 0 < k+l <= p (which is a non-­‐
n n empty string inside the 1 0 cluster) i i
In this case, if we pump v and y down (setting i=0 in uv xy z), the two halves of 0 0
uv xy z will either (1) not have the same number of zero’s (if k>0) or (2) not 0 0
have the same number of one’s (if l>0). Therefore, uv xy z cannot be a member of B. In any case, there is a contradiction. Hence, B is not context free.