Not quite, you draw the correct conclusion, but the reasoning is a bit off. The Pumping lemma states that for every regular language L
, there exists an integer p >= 1
where every string s
of length greater than or equal to p
can be written as s = xyz
where the following conditions hold:
y
is non-empty- The length of xy ≤ p
- xyiz is in the language
L
for all i ≥ 0
Your first step is correct, s = a2p is indeed longer than p. However, the pumping lemma states that s can be divided as s = xyz
satisfying the above conditions. In other words, there exists a division of s as s = xyz
, but you don't get to choose what that division is, beyond knowing that it should satisfy the above three properties.
In your case L
is the language consisting of just a's where the number of a's is a power of 2. Now taking s = a2p, we know that the next longest string in L
is (a2p)2. From there, if the first two conditions hold, it can be seen that the third condition certainly cannot hold for i = 2
, since a2p < xy2z < (a2p)2. (In plain english, the length of xy2z is between powers of two, so it is not in the language L
as it would have been if it were a regular language)