0

Exam coming up and prof wants these info included. I understand how the lemma works but I can't conceptualize how the "pumping" happens in terms of in or out and how many times.

1 Answers1

0

The pumping lemma for regular languages is a necessary, though not sufficient, condition for regularity of a formal language. If L is a regular language, then there is a natural number p such that any string s of length at least p can be written s = xyz, where:

  • y has length at least one;
  • xy has length no greater than p;
  • x(y^n)p is also in L for any natural number n.

Logically, the condition is:

1. if (L is regular) then
2.  there exists a natural number p such that
3.      if s is in L and |s| >= p then
4.          s = xyz
5.          and |y| > 0
6.          and |xy| <= p
7.          and x(y^n)z is in L

On line 7, we say that "pumped" versions of the string s must be in L. Note that for n = 1, we recover s itself; we have already assumed s is in L by the hypothetical in line 3. Whether you are "pumping in" or "pumping out", and by how much, depends on your selection of n.

The pumping lemma for regular languages works by this logic:

  1. If a language is regular, there is a minimal DFA for it.
  2. If a minimal DFA for the language has p states, any string in the language of length p or greater must have caused the DFA to visit some state more than once (pigeonhole principle).
  3. If the DFA visited a state more than once, there's a cycle in the DFA and this string caused the DFA to traverse it.
  4. If this string, which caused the DFA to cycle some number of times, is in L, then there are other strings which travel around the cycle more times or fewer times that also must be in L.

Given this logic:

  1. p = hypothetical number of states in a minimal DFA for L
  2. x = the part of the input string before some cycle was executed
  3. y = the part of the input string representing one executed cycle
  4. z = the part of the input string after some cycle was executed

For example, consider this minimal DFA:

        0,1      0     /---\
--->(q0)--->(q1)--->(q2)<--/ 0,1
     ^       |
      \------/ 
          1

The string 0100 is in L. p = 3 and |0100| = 4, so the pumping lemma must hold. Our only choices for x, y and z are x=0, y=10 and z=0. The pumping lemma claims we can get rid of y or add any number of multiples to it and get another string in L. We see that this works because y is simply the loop from q1 to q0; we can skip it (n = 0) or we can repeat it (n > 1).

Patrick87
  • 27,682
  • 3
  • 38
  • 73