Here is the pumping lemma for context-free languages :
If a language L is context-free, then there exists some integer p ≥ 1
(called a "pumping length") such that every string w
in L that has
a length of p or more symbols (i.e. with |w| ≥ p) can be written as
w = uvxyz with substrings u, v, x, y and z, such that
- |vxy| ≤ p,
- |vy| ≥ 1, and
- u(v^i)x(y^i)z is in L for all i ≥ 0.
Taken from wikipedia
Let's take a look at the string w=(a^4p)(b^2p)(c^p)
To show a contradiction we should show that for every substring of w
, pumping the word, will take it out of the language.
Let's look at several cases:
vxy (or in your case you marked it as "xyz") contains a sequence of 1 letter (let's assume the letter is a
so the sequence is a^k where k>=1).
For this case, if you pump the string for i=2 for example you will get :
u(v^2)x(y^2)z=uvvxyyz=(a^(4p+|vy|))(b^2p)(c^p) which is not a word from the language because 4p+|vy| is bigger than 2*2p (a
s twice amount as b
s).
vxy contains a sequence of 2 letters (let's assume the letters are a
s followed by b
s, so the sequence is (a^k)(b^l) k,l >= 1).
For this case, if you pump the string for i=2 you will get :
u(v^2)x(y^2)z=uvvxyyz=(a^(4p+|vy|))(b^(2p+|vy|))(c^p) which is not a word from the language because 2p+|vy| is bigger than 2*p (b
s twice amount as c
s)
You can show that for every letter a
, b
or c
pumping with the first case will get the word out of the language, and for every sequence of 2 letters (a^k)(b^l)
or (b^k)(c^l)
pumping with the second case will get the word out of the language.
Because of the condition that |vxy| ≤ p, we can not get a sequence of 3 letters.
The shortest substring we can get with 3 letters is : a(b^2p)c with a length of 2p+2 which is not valid for this condition.
So we showed that for every substring that we choose, pumping the word will get it out of the language. We got a contradiction that this language qualifies the pumping lemma, therfore this language is not a Context-Free language.