Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 206
Lars Knickrehm Avatar asked Aug 06 '12 16:08

Lars Knickrehm


2 Answers

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.

like image 134
Antal Spector-Zabusky Avatar answered Nov 07 '22 08:11

Antal Spector-Zabusky


"IN CONTEXT OF PUMPING LEMMA FOR REGULAR LANGUAGES "

Yes we agree, All finite languages are regular language means we can have Finite automata as well as regular expression for any finite language.
Whereas a infinite language may be regular or not. Venn-Diagram is shown below. So we need to only check for infinite language L where its regular of not!

Think about FA:

  • Any automata for a finite language can not contains loop! (also regular expressions for finite language will be without * and +operation).

  • Any automata for a infinite language(regular) will contain the loop. We can't construct an automata for infinite language without loop; where loop may be a self loop of via some other state. {If its self loop then a single symbol repeats any number of time, if via other state a sequence of symbols comes in loop can be repeat any numbers of time}.

Pumping means repeating. In pumping lemma w can be break in three parts x, y, z. The 'y' is in part of w occurs in loop (that's y>=1 ). So pumping lemma is nothing finding looping part y and repeating this looping part any numbers of time.
enter image description here You can see if you repeat loop any number of times and generates new string w' its still in language.

NOTE: Regular Expressions for infinite language can't be without * and +operation!

[answer] There is no loop in an automata for finite language so we can't pump(generate by repeating) new strings in language. And Pumping Lemma is not applicable for finite language.

Although some writers also explain pumping lemma for finite language where i in xyiz can be repeat boundedly (say k ≤ i ≤ m )


enter image description here

In Venn-Diagram Every finite set is regular. Infinite set may be regular or not. Regular-Languages ⊆ Non-Regular Languages


like image 43
Grijesh Chauhan Avatar answered Nov 07 '22 08:11

Grijesh Chauhan