How to prove not a CFL with pumping lemma?

399 Views Asked by At

need to prove using the pumping lemma that

$L=\{a^{2N} b^{N} c^M d^N| M,N>=0\}$ is not Context-Free.

This is what I have so far:

Suppose that L is a CFL. Let p be the pumping length.

Choose $s=a^{2p} b^p c^p d^p$, $|s|=5p>=p$

write $s=uvxyz$, $|xy|<=p$, $|vy|>=1$.

I believe there are 3 cases, Case 1: vxy contains no d's Case 2: vxy contains no a's Case 3: vxy contains at least 1 a and 1 b

But I'm not sure these are the actual cases I need to solve for so I am a little confused and I'm not sure where to go from here.

Any input would be greatly appreciated!

1

There are 1 best solutions below

2
On BEST ANSWER

It's convenient first to get rid of the $c$s: If $L$ is context-free, then wqe could take a grammar for it, declare $c$ to be a nonterminal, add the production $c\to \epsilon$, and then we'd get a grammar for $L'=\{a^{2n}b^nd^n\mid n\ge 0\}$. So if we can prove that $L'$ is not context-free it will follow that $L$ is not context-free either.

Now enter the pumping lemma. Instead of arguing explicitly about pumping lengths and so forth, we can just say that because $L'$ contains arbitarily long strings, if it is context-free, then there will be some $uvxyz\in L'$ such that $v$ and $y$ are not both empty and $uv^nxy^nz\in L'$ for all $n\ge 1$.

Then, first neither $v$ nor $y$ can possibly contain more than one kind of letter -- because if they did, $uv^2xy^2z$ would have a $b$ before an $a$ or a $c$ before a $b$, which would clearly mean it is not in $L'$.

Therefore are least one of the letters $\{a,b,d\}$ will be in neither $v$ or $y$ -- on the other hand, since $v$ and $y$ are not both empty, some of the letters will appear in one of them.

Therefore, comparing to $uvxyz$ to $uv^2xy^2z$, there's one letter they have the same number of and another letter they have different numbers of. But this means that they can't both be in $L'$ (because if we know how many copies of just one of the letters there are in a word from $L'$, the number of copies of the other letters will be determined) -- a contradiction!