2

Possible Duplicate:
Prove that the complement of $\{0^n1^n \mid n \geq{} 0\}$ is not regular using closure properties

Is $L=\{ a^nb^m \mid n,m \ge 0, n\ne m\}$ a regular language?

I think it is but can't prove it.

2 Answers2

4

Using Ran G.'s comment which links to a very similar question:

Suppose $L$ is regular. $M=a^*b^*$ is regular, too, so since regularity is closed by set difference, $M\backslash L=\{a^nb^n\}$ would be, too, which is the usual counterexample.

jmad
  • 9,488
  • 1
  • 39
  • 42
0

The comment of Patrick87 correctly points out the flaw in my "proof" below, but I let it be as it were as it might be a good starting point. Together with his comment, it should be simple to prove that the language is not regular.

First you should know that a language $L$ is regular if and only if its complement is regular. This is fairly simple to prove, given a deterministic finite automaton $M$, let $M^{-1}$ be the automaton where a state is accepting if and only if it is not accepting in $M$.

Given this theorem you should be able to prove that since $L$ is the complement of the classic non-regular language, $L$ is not regular either.

(Handwaving: A language is usually not regular if you need to count stuff in a word to determine whether or not a word belongs to the language. You can, for any constant $k$ count stuff with respect to $k$, like modulo, $\leq$ etc, but in your example you need to be able to count to $m$ and $n$ for any $n$ and $m$.)

Pål GD
  • 16,115
  • 2
  • 41
  • 65
  • Minor nitpick: $L$ isn't really the complement of any "classic" nonregular language, right? $L$ is the complement of the language "Any string of $a$s and $b$s where either there are some $b$s before $a$s or the number of $a$s is equal to the number of $b$s." – Patrick87 Nov 14 '12 at 16:30