0
$\begingroup$

Some Languages are trivial to find their respective context-free grammar. Like for example $ L= \{a^nb^n: n \geqslant 0\}$. However some are really difficult to solve. I would like to have some advice on how I can tackle them.

For example I have the following language that I have been trying to solve for a while :enter image description here

I tried to divide the problem into three cases as follow:

case i: na $\le$ nb

case ii: nb $\le$ na $<$ 2nb

case iii: na $\ge$ 2nb

The first case was easy to solve however I am stuck in case ii. At this point I don't even know if the procedure that I chose is the correct one.

EDIT: It is not an duplicate 3 of the links that you have provided me are not the same problem one of them is the same suggests the same strategy however doesn't solve the problem.

$\endgroup$
2
  • $\begingroup$ @D.W.♦ It is not an duplicate 3 of the links that you have provided me are not the same problem one of them is the same suggests the same strategy however doesn't solve the problem. $\endgroup$
    – Kbiir
    Oct 19, 2019 at 16:20
  • $\begingroup$ You should be able to adapt the methods there; it's the same idea. Hint: build a PDA. $\endgroup$
    – D.W.
    Oct 19, 2019 at 20:22

0