1

L = {w belongs to {0, 1}* ∣ w has at most three 0’s}. Why is this regular language?

According to pumping lemma, what I think is that.... Suppose $x$=$0^2$, $y$=$0^1$, $z$=$1^n$ ($w=xyz$=${0^2}{0^1}{1^n}$), then if we pump $y$, we may have more than three $0$s. What am I missing?

Mansumen
  • 43
  • 1
  • 7

3 Answers3

1

As the other answers have said, the key is in the statement of the pumping lemma.

The key to understanding how to apply the pumping (and how not to as well) is paying close attention to the quantifiers ("for all" and "there exists") and the order they come in:

The Pumping Lemma for Regular Languages

If the language $L \subseteq \Sigma^{\ast}$ is regular, then there exists a constant $p \geq 1$ such that for every string $s \in L$ where $|s| \geq p$, there exists a division of $s = xyz$ such that:

  1. $|xy| \leq p$,
  2. $|y| \geq 1$, and
  3. for all $i \in \mathbb{N}$, $s' = xy^{i}z \in L$.

So if you wanted to show that a language obeyed the pumping lemma (note that is would not prove that it's regular, there are non-regular languages that can also be pumped), you have to first determine the pumping length $p$, then look at every string $s \in L$ and show that there is some way that $s$ can be broken down so that it can be pumped according to the conditions.

So in your case, if we ignore that you don't know $p$, the mistake is showing that one way of breaking it up doesn't work. So assuming that the pumping length is at least $4$ (it is, but why...?), then the breakdown $x = 000$, $y = 1$, $z = 1^{n-1}$ can quite happily be pumped.

When this has settled in, it also shows how the proofs of non-regularity via the pumping lemma work. You just have to find one string, but you have to show that there is no workable breakdown for that string.

Luke Mathieson
  • 18,373
  • 4
  • 60
  • 87
0

You can't use the pumping lemma to prove that a language is regular.

The pumping lemma can be used to prove that a language is not regular, but it doesn't let you prove that a language is regular.

(Why? The pumping lemma says something like "If $L$ is regular then (stuff)." If you prove that (stuff) is false, then you can conclude that $L$ is not regular; that follows from the contrapositive of the pumping lemma. But if you prove that (stuff) is true, you can't conclude anything: $L$ might be regular, or it might not; the pumping lemma makes no promises.)

Instead, to prove that a language is regular, you should use the techniques described in How to prove a language is regular?

D.W.
  • 167,959
  • 22
  • 232
  • 500
0

We use the pumping lemma to prove that a determinate language is not regular.

If you want to prove that a determinate language $L$ is regular then you have to write a regular expression, draw a NFA or draw a DFA that denotes $L$.

For example I can say that $L=\{w \in \{0,1\}|$ $w$ has at most three 0's $\}$ is regular because I found the regular expression:

$RE$ = $1^*(0|\epsilon)1^*(0|\epsilon)1^*(0|\epsilon)1^*$

and $\mathscr{L}(RE)=L$

Renato Sanhueza
  • 1,345
  • 8
  • 21