formal-languages

Is there a way to create a type 3 grammar for this language?


I'm trying to find a grammar of the highest type possible for this language:

L={0^2n 1^(n-1)|n>=1}
I only managed to do this:

S->00X
X->00X1|λ

Which is not type 3. I can't seem to figure out how to get it to type 3 (if that's even possible).


Solution

  • You can't do it, because L is not a regular language.

    Assume that L is regular. Let w = 0^(2p)1^(p-1) for some integer p>=1, so that |w| > p. Further, consider the strings x, y, and z such that w = xyz with |xy| <= p, which means both x and y are sequences of 0s (since p < 2p). By the pumping lemma, any string of the form xy^nz is also in L, but that means we can increase the number of 0s without increasing the number of 1s found in z. Thus, our assumption that L is regular must be false.