Language contex-free

61 Views Asked by At

$$L=\{a^kb^nc^md^t\mid n+m=2(k+t)\}.$$ So I am trying to figure out if this language is CFL. So trying to prove that it is not CFL with the pumping lemma, I am not getting anywhere (using the word $a^pb^{2p}c^{2p}d^p$). I also cannot find a grammar for this language. Any tips?

1

There are 1 best solutions below

0
On

You are given that the number of $b$'s and $c$'s is twice the number of $a$'s and $d$'s. Try to create a PDA for this grammar and see if you can build it.

Start with pushing two symbols on the stack for every $a$ and $d$ and popping one symbol for every $b$ and $c$.

But there's a problem. You'll encounter an empty stack after some amount of popping. When you do, do the reverse of what you were doing till now, that is, interchange pushing and popping. This way, you can build a deterministic PDA for your grammar.