1

The following comment on an other question says that if we have an infinite language L that satisfies the pumping lemma for regular languages then we have a word with n≤|w|≤2n which is in L. (n is the constant in the pumping lemma)

https://cs.stackexchange.com/a/55606/99669

Why is this the case? The lower limit can be explained by the constant of the regular pumping lemma, because in infinite languages there exists a word in L which is longer than n.

But how comes there is an upper limit? The pumping lemma does not say anthing about a upper limit for the words we choose.

2 Answers2

2

Suppose that $L$ is an infinite language which satisfies the pumping lemma with constant $n$. Let $w \in L$ be a word of minimal length in $L \cap \Sigma^{\geq n}$ (i.e., among the words in $L$ of length at least $n$, choose a word of minimal length). Since $L$ satisfies the pumping lemma, we can write $w = xyz$ in such a way that $|xy| \leq n$, $y \neq \epsilon$, and $xy^iz \in L$ for all $i \geq 0$. In particular, $xz \in L$. Since $|xz| < |xyz|$, we must have $|xz| < n$, and so $|w| = |xz| + |y| < n + |xy| \leq 2n$.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
1

Think about it in terms of the proof of the pumping lemma.

The pumping lemma is true because, if you read a long enough word, you must visit the same state of the automaton twice, so you can go around that loop as many times as you want (including zero) and then go on to an accepting state. How long does this take? If the automaton has $n$ states, you know you must have been once around the loop after at most $n+1$ steps. From there, you need to get ot an accepting state and either you're in one already, or you need to visit at most $n-1$ more states before you get there. So the total is at most $2n$.

If that procedure results in a word of length less than $n$, just go around the loop enough times to lengthen it.

David Richerby
  • 82,470
  • 26
  • 145
  • 239