r/AskComputerScience • • Jul 18 '25

Pumping Lemma Question.

I think I misunderstood something about the Pumping lemma. Why doesn't this proof work? For some reason, I get that the language L = {a^n | n ∈ N} is irregular.

Proof:

Assume, for contradiction, that L is regular.
Then, by the pumping lemma, there exists a pumping length ppp such that every string s∈L with ∣s∣≥p can be written as s=xyz, with ∣xy∣≤p, ∣y∣>0, and x y^i z∈L for all i≥0.

s = a^p = xyz

x: 0^a
y: 0^b
z: 0^(p-a-b)

a + b ≤ p
b > 0

x y^i z = 0^a 0^(bi) 0^(p-a-b)

By definition:

p = a + bi + p - a - b
0 = bi - b

i = 0 -> -b = 0

Language is irregular, since b > 0, so -b cannot be 0.

I have to missing something, I just don't know what. Of course, this doesn't make any sense. No matter what i is, the word will always be in the language. This proof works well for languages like {0^n1^n | n ∈ N}. Why does it cause problems here? What should I look out for when using this proof?
Thanks in advance!

7 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/Acceptable-Tip-9702 Jul 18 '25

Sorry for bad form, thanks a lot for the reply, I got it now!