CFG for $a^ib^jc^k | i\neq j\ or\ j\neq k$

1.9k Views Asked by At

This is my Homework problem. Can someone please help me out! Find CFG(Context Free Grammar) for the language L={$a^ib^jc^k | i\neq j\ or\ j\neq k$}.

1

There are 1 best solutions below

2
On BEST ANSWER

Hint: (for the grammar.) The language $L$ is the union of $\{a^ib^jc^k \mid i<j\}$, $\{a^ib^jc^j \mid i>j\}$, $\{a^ib^jc^k\mid j>k\}$, and $\{a^ib^jc^k\mid j<k\}$. If you find grammars for the four previous languages, there exists a grammar for $L$ since context-free languages are closed under union.