# How to prove ww^r is context free using pumping lemma for context free languages

I am having a hard time to prove it, what i know is we cannot prove that a language is regular by using pumping lemma cause even if the "pumped string" is in the language the language could still be regular.

But since we already know that ww^r is a context free language cause we can design a pda for it, we should be able to divide a string from ww^r into 5 parts and pump it and the result should still be in the language. But i fail to do so, i have done the following:

assume w = 010 then ww^r = 010010

Then, u = 0, v = 10, x = 0, y = 1, z = 0

And then i pumped it once and i got: 010100110, which obviously isn't in the language produced by ww^r which again is contradicting because we can design a pda for it

Where am i going wrong? How do i exactly use pumping lemma for CFL?

• Please note that the pumping lemma for CFL is not meant to prove that a language is context-free. May 8, 2022 at 6:56
• You cannot prove that a language is context-free using the pumping lemma, since some languages which are not context-free also satisfy the conditions of the pumping lemma. May 8, 2022 at 8:23

The pumping lemma for context-free languages is used to prove that a given language is not a context-free language. There exists a PDA accepting the language $$L = \{w w^r: w \in \{0,1\}\}$$, and so $$L$$ is a context-free language.
The pumping lemma states that all regular languages and all CFL's satisfy a certain property: there exists a pumping length $$p$$ such that for every string of length at least $$p$$ in the language, there exists a partition of the string (into 3 parts or 5 parts) such that the pumped string belongs to the language. This property claims only that there exists a $$p$$ and (for every string of length at least $$p$$) a partition satisfying some conditions - if you choose an arbitrary value of $$p$$ and an arbitrary partition, the pumped strings might not be in the language.