FACTOID # 17: Senior gentlemen might consider a trip to Russia, where there are two women over 65 for every man.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Pumping lemma for regular languages

In the theory of formal languages, the pumping lemma for regular languages is a lemma that gives a property that all regular languages have. Its primary use is to prove a language is not regular. In mathematics, logic, and computer science, a formal language is a set of finite-length words (i. ... In mathematics, a lemma is a proven proposition which is used as a stepping stone to a larger result rather than an independent statement, in and of itself. ... A regular language is a formal language (i. ...

Contents

Formal statement

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

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

y is the substring that can be pumped (removed or repeated any number of times, and the resulting string is always in L). (i) means the loop y to be pumped must be of length at least one; (ii) means the loop must occur within the first p characters. There is no restriction on x and z.


Use of lemma

When using this lemma to prove a language non-regular, it is generally done with a proof by contradiction. If we assume that a language L is regular, then the pumping lemma for regular languages must hold for all strings in L. By showing that there exists an instance where the lemma does not hold, we also show that our assumption is incorrect: L cannot be regular. This is done by finding a string wL and integer i where the pumping lemma does not hold. Reductio ad absurdum (Latin for reduction to the absurd, traceable back to the Greek ἡ εις το αδυνατον απαγωγη, reduction to the impossible, often used by Aristotle) is a type of logical argument...


Using this lemma, one can, for instance, prove that the language L = {anbn : n ≥ 0} over the alphabet Σ = {a, b} is not regular. We will let w, x, y, z, p, and i be as stated in the pumping lemma for regular languages. Let w = apbp. It is obviously in L, and the pumping lemma therefore yields a decomposition of w = xyz with |xy| ≤ p, |y| ≥ 1 and xyiz in L for every i ≥ 0. If we let |xy|=p and |z|=p, then xy is the the first half of w, or all p of the as. Because |y| ≥ 1, it consists of a non-zero number of as, and xy2z has more as than bs and is therefore not in L (note that any value of i ≠ 1 will give us a contradiction). We have reached a contradiction because, in this case, the pumping lemma does not hold. Therefore, the assumption that L is regular must be incorrect. L is not regular.


The proof that the language of balanced (i.e., properly nested) parentheses is not regular follows the same idea. Given p, there is a string of balanced parentheses that begins with more than p left parentheses, so that y will consist entirely of left parentheses. By repeating y, we can produce a string that does not contain the same number of left and right parentheses, and so they cannot be balanced.


Proof of lemma

The proof idea uses the fact that for every regular language there is a finite state machine (FSA) that accepts the language. If the regular language is finite, then the pumping lemma is trivially true since there are no strings in the language greater than the pumping length. Fig. ...


If the regular language is infinite, then there must be some minimal FSA that accepts the language. The number of states in this FSA are counted, and then, that count is used as the pumping length p. If the string's length is longer than p, then there must be at least one state that is repeated (which we will call state S). The transitions that take the machine from state S back to state S match some string. This string is called y in the lemma, and since the machine will match a string without the y portion, or the string y can be repeated, the conditions of the lemma are satisfied.


This makes more sense with an example. The following image shows an FSA.


Image File history File links Summary An automaton accepting the language I created this image myself using the free program JFLAP. Licensing File links The following pages link to this file: Pumping lemma for regular languages ...


The FSA accepts the string: abcbcd . Since this is longer than the number of states there are repeated states. In this example, the repeated states are states q1 and q2. Since the substring bcbc of string abcbcd takes the machine through transitions that start at state q1 and end at state q1, the string portion could be repeated and the FSA would still accept giving the string abcbcbcbcd, and the string portion could be removed and the FSA would still accept giving the string ad. In terms of the pumping lemma, the string abcbcd is broken into a x portion a, a y portion bc and a z portion bcd. (Note, it could be broken in different ways such as a x portion a , a y portion bcbc and a z portion d and all the conditions hold except that |xy| ≤ p)


Lemma not sufficient

Note that the pumping lemma does not give a sufficient condition for a language to be regular. That is, the lemma holds for some non-regular languages. If the lemma does not hold for a language L, then L is not regular. If the lemma does hold for a language L, L might be regular. For example, the language {uuRv : u,v in {0,1}+} (strings over the alphabet {0,1} consisting of a nonempty even palindrome followed by another nonempty string) is not regular but can still be "pumped" with p = 4: Suppose w=uuRv has length at least 4. If u has length 1, then |v| ≥ 2 and we can take y to be the first character in v. Otherwise, take y to be the first character of u and note that yk for k ≥ 2 starts with the nonempty palindrome yy. For a practical test that exactly characterizes regular languages, see the Myhill-Nerode theorem. The typical method for proving that a language is regular is to construct either a Finite State Machine or a Regular Expression for the language. see also Alexadrome For the movie, see Palindromes (film) Look up Palindrome in Wiktionary, the free dictionary. ... In the theory of formal languages, the Myhill-Nerode theorem provides a necessary and sufficient condition for a language to be regular. ... Fig. ... In computing, a regular expression is a string that is used to describe or match a set of strings, according to certain syntax rules. ...


General version of Pumping Lemma for Regular Languages

If a language L is regular, then there exists a number p > 0 such that every string uwv in L with |w| ≥ p can be written in the form; where p is a pumping length.

uwv = uxyzv

with strings x, y and z such that |xy| ≤ p, |y| > 0 and

uxyizv is in L for every integer i ≥ 0.

This version can be used to prove many more languages are non-regular, since it imposes stricter requirements on the language.


See also

In the theory of formal languages, a pumping lemma states that any language of a given class can be pumped and still belong to that class. ...

References

  • Michael Sipser (1997). Introduction to the Theory of Computation. PWS Publishing. ISBN 0-534-94728-X.  Section 1.4: Nonregular Languages, pp.77–83.

  Results from FactBites:
 
Pumping lemma - Wikipedia, the free encyclopedia (980 words)
The two most important examples are the pumping lemma for regular languages and the pumping lemma for context-free languages.
However, they cannot be used to determine if a language is in a given class, since satisfying the pumping lemma is a necessary, but not sufficient, condition for class membership.
The proof idea for the pumping lemma itself is as follows: the regular language is accepted by a certain deterministic finite acceptor; every string that's longer than the number p of states of that acceptor will revisit a certain state, thereby causing a loop which can be repeated; the loop corresponds to the string y.
Article about "Pumping lemma" in the English Wikipedia on 24-Apr-2004 (723 words)
However, they cannot be used to prove the statement that a language is in the class; satisfying the pumping lemma is a necessary, but not sufficient, condition.
Someone familiar with the pumping lemma for regular languages can see immediately that a language that allows parenthesized expressions, but requires the parentheses to balance, cannot be a regular language, and so the language cannot be generated by a regular grammar nor recognized by a finite state machine.
The proof idea for the pumping lemma itself is as follows: the regular language is accepted by a certain deterministic finite acceptor; every string that's longer than the number m of states of that acceptor will revisit a certain state, thereby causing a loop which can be repeated; the loop corresponds to the string y.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.