Finding a CFG for this Language

38 Views Asked by At

Prove that the following Language is context-free and provide a CFG.
$L=\{a^i b^j a^i b^{j+1} \mid \text{$i, j$ ∈ N}\}$
I have already proven that the language is context-free by using the Pumping-Lemma:

  • Let $n$ be the Pumping-Lemma-Number, $z$ be a word in the language and $\lvert z \rvert \geq n$.
  • Let $uvwxy$ represent $z$.
  • Let $u$ and $w$ represent $a^i$.
  • Let $v$ and $x$ represent $b^j$.
  • Let $y$ represent $b$.
  • Then $uv^2wx^2y$ is still in the language.

But I just cannot think of a grammar that would produce this language. Did I make a mistake in my proof?