# Creating a CFG from a specific CFL

I am pretty desperate finding the correct context free grammar for the following language: $$L=\{a^lb^mc^n \mid l,m,n \in \mathbb{N}_0, \, l\geq 2n+m\}$$

I would really appreciate if anyone could tell me how to generate the CFG from this language as I am stuck on this one for 2 days now.

I can't find a solution for adding the right amount of $$b$$'s and $$c$$'s to a generated string.

At the moment I have: \begin{align*} S &\rightarrow aS \mid T \mid U \mid \varepsilon \\ T &\rightarrow aTb \mid \varepsilon \\ U &\rightarrow aaUc \mid \varepsilon \end{align*}

• After rewriting into $\{ a^k a^{2n} a^m b^m c^n\mid k,m,n\ge 0 \}$, see accepted answer by @Apass Jack, the grammar can be constructed using the "basic toolbox". – Hendrik Jan May 17 '19 at 13:14

It might be easier than you have been thinking.

\begin{aligned} S&\rightarrow aS\mid U\\ U&\rightarrow aaUc\mid T\\ T&\rightarrow aTb\mid \epsilon \end{aligned}

The idea is to identify the language that could be obtained by a fixed operation that peels off some symbols. Peeling off $$a$$'s, we shrink words in $$S$$ to words in $$U$$. Peeling off some $$a$$'s and $$c$$'s, we shrink words in $$U$$ to words in $$T$$. \begin{aligned} S&=\{a^ka^{2n}a^mb^mc^n \mid k,m,n \in \mathbb{N}_0\}\\ U&=\{a^{2n}a^mb^mc^n \mid m,n \in \mathbb{N}_0\}\\ T&=\{a^mb^m\mid m \in \mathbb{N}_0\} \end{aligned}