-1

How can I prove whether irregular languages are infinite? I thought about proving it by the definition of regular language but got stuck.

Raphael
  • 73,212
  • 30
  • 182
  • 400
Adi Ml
  • 83
  • 1
  • 7

2 Answers2

3

An intuitive classification between regular and non-regular languages is based on their recognizers. In case of regular languages, Finite State Automata are enough, while for non-regular languages you need more powerful automata.

A language is regular if you can build a FSA for it. Thus, given that you can always build an FSA for a language with a finite number of strings (via the Prefix Tree Acceptor, for example), than every language with a finite number of strings is regular.

If a language has an infinite number of strings, it can be regular or not, it depends (you could use the pumping lemma or other approaches to demonstrate if the language is not regular: take a look here: How to prove that a language is not regular?); on the other hand, no language with a finite number of strings is non-regular. Hence, non-regular languages are composed of an infinite number of strings.

I hope this can help you.

Marco D.G.
  • 103
  • 4
PieCot
  • 466
  • 5
  • 9
2

Here's a proof in more or less complete detail. You want to show that non-regular languages are infinite. In more formal terms, this statement is

If $L$ is a non-regular language, then $L$ is infinite.

Let's define two predicates, $P=\text{"$L$ is not regular"}$ and $Q=\text{"$L$ is not finite"}$. Then your statement is the same as asserting $P\Rightarrow Q$, and you want to show that this implication is true (for any language L$).

Fact 1. The expression $P\Rightarrow Q$ is logically equivalent to $\lnot Q\Rightarrow \lnot P$ (called the contrapositive). In other words, if we can prove that $\lnot Q\Rightarrow \lnot P$ is true, then $P\Rightarrow Q$ must also be true.

Using this equivalence, we can show that the highlighted sentence above is true by showing that

If $L$ is finite, then $L$ is regular.

is true.

To prove this, you can use two facts:

Fact 2. If a language consists of a single string, $w$, then it is regular. This is almost immediately obvious: just make a finite automaton that accepts $w$ and nothing else.

Fact 3. The union of two regular languages is regular. This is a result that you should have seen.

From these two facts, you can conclude (by induction),

Fact 4. Any language consisting of a finite number of strings is regular.

Note that this is exactly the second highlighted statement above, so, since it is logically equivalent to the first statement above, that statement must be true: Every non-regular language is infinite. That completes the proof.

Rick Decker
  • 15,016
  • 5
  • 43
  • 54