4

Consider this example (taken from this document: Showing that language is not regular):

$$L = \{1^n \mid n\text{ is even}\} $$

According to the Pumping Lemma, a language $L$ is regular if :

  • $y \ne ε$
  • $|xy| \lt n$
  • $\forall k \in N, xy^kz \in L$

In the above example, $n$ must be even. Suppose we have $n = 4$, we can express: $$xy^kz$$ such that: $x = 1$, $z = 1$, and with $k = 2$, we have $y^k = y^2 = 11$, so we get the string $1111$. However, since all $k$ must be satisfied, if $k = 1$, the string is $111$, it does not belong to $L$. Yet, I was told that the above example is a regular language. How can it be?

Raphael
  • 72,336
  • 29
  • 179
  • 389
Amumu
  • 431
  • 5
  • 12

2 Answers2

11
  1. Pumping lemma is not a sufficient condition for being regular, it is only a necessarily condition. Satisfying it does not imply that the language is regular.

  2. In the pumping lemma, some parameters are chosen adversarily, i.e. you don't have control over them. If a language is regular then pumping lemma says that "for a long enough string in the language there is a partition s.t. ...". To show that a language is not regular you should show that for all ways of partitioning the conditions will not hold. Your argument does rule out $y=11$ for example, you are only talking about a particular way of partitioning and that does not imply anything.

  3. The language is indeed regular, it is (11)*.

Kaveh
  • 22,231
  • 4
  • 51
  • 111
  • Thanks. So, how would I show that for all ways of partitioning, the condition will not hold? Now that I rethink of it, if I partition the example this way: suppose n = 6, then y = n - 2 = 4 character of 1s (x = 1 and z = 1). Then with y^k, it will always hold. However, if I let x = 2, z = 1, then y = 3 characters of 1s, and with k = 1, x+y+z = 2 + 3 + 1 = 6 holds, but with k = 2, x+y+z = 2 + 6 +1 = 9 will not hold.

    Finally, it is indeed (11)* is regular, but how can I correctly prove it formally by pumping lemma using its notations?

    – Amumu May 07 '12 at 04:31
  • @Amumu, you cannot do it for this language since it is regular. Check examples of pumping lemma to see how you can show it for all ways of partitioning the string (but the idea is you assume an arbitrary partitioning and only based what you know about that partition from the pumping lemma you show that some $xy^kz$ is not in the language, since you haven't used anything particular for that partition the argument holds for all of them). I would suggest that if you want more details then it is better to post a new question asking for that. – Kaveh May 07 '12 at 04:44
  • I reread your post, I and understand now. A language is not regular if all ways of partitioning the conditions will not hold. In my example, there's a partition that holds, so it's regular. Thanks. – Amumu May 07 '12 at 04:56
1

The language is regular. Consider this (rule set of a) simple regular grammar that obviously generates $L$:

$\qquad \displaystyle S \to 11S \mid \varepsilon$

Raphael
  • 72,336
  • 29
  • 179
  • 389