Show that $L(G) = L$ for a given grammar $G$ and language $L$.

129 Views Asked by At

I had an exam today, and I think that there was a mistake in the following question:

Let $G$ be the grammar defined by $$G=(\{S,A,B\},\{a,b\},\{S \rightarrow AB, A \rightarrow a, A \rightarrow AS, B \rightarrow bb \},S)$$ and the language $$L=\{a^n b^{2n},n ∈ \mathbb N \}$$ Show that $L(G) = L$.

I think the wrong part is: $A \rightarrow AS$ since we can generate the string $w =AAABBB$ and then since $A \rightarrow AS$, $w$ can be $ASAABBB$, then $ABAABBB$ which is wrong in our case.

Am I right?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes, this is correct. The $A \to AS$ is probably a typo for $A\to aS$ (everything works fine if you make this one-letter change).