4

First of all, there's already a question very similar to this, but in my case I just wanted to show my attempt with the hope that if there are any erros or it's wrong completely you can help me in the process of understanding better.

So, I am asked to prove using the pumping lemma that $L = \{0^m1^n \mid m \neq n \}$ is not regular.

Here's my attempt.

Suppose $L$ is regular. Then $\exists$ a $p$ (the pumping length), s.t. $\forall s \in L$ with $|s| \geq p$ and $s = xyz$ (that is $s$ can be decomposed in three smaller strings $x$, $y$ and $z$). Then, the following is also true:

  1. $xy^iz \in L, \forall i=0...n$

  2. $|y| > 0$

  3. $|xy| \leq p$

Now, lets pick one of these strings s, and lets call it $t$, and define like this $$t = 0^p1^{p + |y|}$$ Note that $|y| > 0$, so $p \neq p + |y|$.

Because of condition $3$, we know that $xy$ only contains $0$s, so $y$ is composed of just $0$s too. Take now for example $xy^{\mid y \mid}z$, which should be in $L$ according to condition $1$, but $xy^{\mid y \mid}z$ = $0^{p + |y|}1^{p + |y|}$, which is not in the language, and this contradicts the fact that $L$ is regular.

I am not $100 \%$ sure this is correct. If not, any corrections, suggestions to improve are well-accepted. Actually, I am quite doubtful about the following statement $xy^{\mid y \mid}z$ = $0^{p + |y|}1^{p + |y|}$...

2 Answers2

4

You went a little bit astray very early, when you wrote this:

Then $\exists$ a $p$ (the pumping length), s.t. $\forall s \in L$ with $|s| \geq p$ and $s = xyz$ (that is $s$ can be decomposed in three smaller strings $x$, $y$ and $z$). Then, the following is also true:

  1. $xy^iz \in L, \forall i=0...n$

  2. $|y| > 0$

  3. $|xy| \leq p$

What you should say is that for each $s\in L$ with $|s|\ge p$, there exists a decomposition $s=xyz$ such that the following are true:

  1. $xy^iz\in L$ for all $i\ge 0$;
  2. $|y|>0$; and
  3. $|xy|\le p$.

Those conditions don’t hold for just any old decomposition of $s$ into three parts; the claim is merely that there is at least one decomposition for which they hold. This means that your next step is impossible:

Now, lets pick one of these strings s, and lets call it $t$, and define like this $$t = 0^p1^{p + |y|}$$

You don’t know what the decomposition is going to be until after you choose the string, so you can’t use $|y|$ to define the string.

This problem is actually a bit tricky. The simplest solution that I know that uses the pumping lemma directly is to let $s=0^p1^{p+p!}$. Now suppose that there is a decomposition $s=xyz$ satisfying the three conditions. Clearly $xy$ consists entirely of zeroes, and hence so does $y$. Say $y=0^k$, where we know that $0<k\le p$. Then for any $n\ge 1$ we have

$$xy^nz=x0^{kn}z=xy0^{k(n-1)}z=0^{p+k(n-1)}1^{p+p!}\;.$$

To finish the proof, just explain why there must be some $n\ge 1$ such that $p+k(n-1)=p+p!$: for that $n$, $xy^nz$ is not in $L$ after all.

Brian M. Scott
  • 631,399
  • @BrianMScott, How did you make the transition $xy0^{k(n−1)}z=0^{p+k(n−1)}$? We only know that $|xy|\leq p$, not that $|xy|=p$, don't we? – Dennis May 21 '21 at 10:07
  • 1
    @Dennis: $x=0^r$ and $z=0^{p-r-k}1^{p+p!}$ for some $r$ such that $0\le r\le p-k$, so $$x0^{kn}z=0^r0^k0^{k(n-1)}0^{p-r-k}1^{p+p!}=0^{p+k(n-1)}1^{p+p!},.$$ – Brian M. Scott May 21 '21 at 21:34
1

A much easier proof, essentially using the pumping lemma, is to assume $ 0^m1^n $ is regular ( $ m \ne n $ throughout ), then there exist a DFA that ends in an final state if and only if the input is $ 0^m1^n $. Now swap the role of final state and non-final state, you get a state machine that stop if and only if the input is $ 0^m1^m $, but by pumping lemma we know this language is not regular, so we proved that $ 0^m1^n $ is not regular.

Andrew Au
  • 1,177