Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
793 views
in Technique[技术] by (71.8m points)

math - To make sure: Pumping lemma for infinite regular languages only?

So this is not about the pumping lemma and how it works, it's about a pre-condition.

Everywhere in the net you can read, that regular languages must pass the pumping lemma, but noweher anybody talks about finite languages, which actually are a part of regular languages.

So we might all aggree, that the following language is a finite language as well as it's a regular one, but it definitely does not pass the pumping lemma:

L = {'abc', 'defghi'}

Please, tell me if simply no one writes about it or why we're wrong - or even not.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The reason that finite languages work with the pumping lemma is because you can make the pumping length longer than the longest word in the language. The pumping lemma, as stated on Wikipedia (I don't have my theory of computation book with me) is the following:

Let L be a regular language. Then there exists an integer p ≥ 1 depending only on L such that every string w in L of length at least p (p is called the "pumping length") can be written as w = xyz (i.e., w can be divided into three substrings), satisfying the following conditions:

  1. |y| ≥ 1
  2. |xy| ≤ p
  3. for all i ≥ 0, xyizL

Now, consider some finite language L, and let k = maxwL |w| be the length of the longest word in L. Then I claim that the minimal pumping length for L is p = k+1. Since there are no words in L with length at least k+1, it is (vacuously) true that every such word satisfies the three conditions (or, indeed, any other condition you care to specify).

You can see that any finite language is regular, of course (regular languages are closed under finite union, and all languages of one word are regular), but note that this argument doesn't show this; it's important to remember that while any regular language can be pumped, there exist languages that can be pumped but are not regular.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...