Prove that $\mathcal L=\{a^ib^jc^k|i+k=j\}$ is context-free

197 Views Asked by At

Prove that $\mathcal L=\{a^ib^jc^k|i+k=j\}$ is context-free

I am trying to prove it without to build a pushdown automaton

First I tried to look which words are in $\mathcal L$,

$\{\varepsilon,ab,bc,abbc,aabb,bbcc,aabbbbcc,\dots\}\in \mathcal L$


Here is my start I am stuck couple of hours and don't know how to finish

$$S\to A|\varepsilon\\ A\to aB|B\\ B\to bC|\\ C\to c|\varepsilon$$

1

There are 1 best solutions below

2
On

Your current grammar will not work because it only allows for a single $a$ on the left side. You could allow for more $a$'s on the left side with the rule:

$$A \rightarrow aB|aA|B$$

but then we would be allowing an infinite number of $a$'s on the left side.

Here's a hint: $\mathcal{L}$ is the concatenation of two context-free languages.