# Context-free pumping lemma of $a^nb^n$

I know $$a^nb^n$$ with $$n\geq0$$ is considered a context-free language, but if I try:

Using pumping length $$p = 3$$

$$n = p$$, thus we have $$aaabbb$$

$$u =aa$$ and $$y = bb$$

$$v = a$$, $$w = b$$ and $$x=λ$$, then $$|vwx|=2\leq p=3$$ and $$|vx| = 1 \geq 1$$

$$uv^iwx^iy \notin L$$, for instance, with $$i=2$$ we have: $$aaaabbb$$

I know I'm wrong in some part of the process, that's I'm attempting to 'break' the lemma, to fully understand it.

• The pumping lemma states that there exists a decomposition $uvwxyz$ which can be pumped, not that every decomposition can be pumped. Apr 11, 2022 at 5:00
• @YuvalFilmus but doesn't the lemma says that if a language fails to be pumped then it wouldn't be CFG? CFGs are excepetions on its own pumping lemma? Apr 11, 2022 at 10:29
• No it doesn’t. It says that if a language is context-free, then every long enough word in the language is “pumbable” with respect to some decomposition. Apr 11, 2022 at 10:30
• @YuvalFilmus I get it. About the decomposition topic, I'm pretty sure mine is supposed to fit the requirements. Doesn't it? Apr 11, 2022 at 10:37
• Pumpability is one of the requirements. (See my answer below) Apr 11, 2022 at 10:41

You picked a wrong decomposition. Similarly to the pumping lemma for regular languages, the pumping lemma for context-free languages states that for every context-free language $$L$$, there exists some legal decomposition for every string $$s$$ with $$|s| \geq p$$ where $$p$$ is a pumping length of $$L$$.

By legal decomposition, I mean dividing $$s$$ into partitions $$uvwxy$$ such that

• $$|vx| \geq 1$$
• $$|uvw| \leq p$$
• $$uv^nwx^ny \in L$$ for all $$n \in \mathbb{N}_0$$

In the case of the string $$aaabbb$$ with $$p = 3$$, a legal decomposition would be eg. $$u, w, y = \epsilon$$, $$v = aaa$$, $$x = bbb$$.

• Could you say where my decomposition fails the criteria? I can't see it Apr 11, 2022 at 10:42
• @AkariOozora It fails the third criterion: "pumping" the string does not result in strings of $L$ as you note yourself. If all decompositions fail at least one of the criteria, then the language cannot be pumped. Apr 11, 2022 at 10:48
• but for languages that are not CFG they would also fail for the third criteria, wouldn't they? Apr 11, 2022 at 10:52
• @AkariOozora For every langauge, you can produce some decomposition that fails one of the criteria, and that does not prove anything. The pumping lemma states that every sufficiently long string of any context-free language has some legal decomposition in this manner. You need to prove no legal decomposition exists, which you haven't done. Apr 11, 2022 at 10:55
• You're using $w$ to mean two different things... Apr 11, 2022 at 11:11