Finite languages are regular
Theorem: If
L
has a ﬁnite number of words, it is regular.
Proof: By induction on

L

:
•
Base case:

L

= 0. Then
L
=
/0, which is regular.
•
Inductive case: Suppose all ﬁnite languages with
k
members are regular, and that

L

=
k
+
1.
–
Then
L
=
{
w
1
,
w
2
, . . . ,
w
k
+
1
}
=
{
w
1
,
w
2
, . . . ,
w
k
}∪
w
k
+
1
.
–
By hypothesis, the ﬁrst language is regular.
–
By the previous theorem, the second one is.
–
So
L
is the union of two regular languages, and thus regular.
3.5
Are all languages regular?
All languages are the union of a collection of oneword languages.
Are all languages regular, using the proof model just shown?
•
No!
•
Finite unions are not inﬁnite unions! Can’t do induction in that way!
•
In fact,
{
ε
,
01
,
0011
,
000111
,
00001111
,
0000011111
,
000000111111
, . . .
}
is not regular, which
we’ll see later.
3.6
Regular expressions
Another way of representing regular languages:
L
=
/0
/0
L
=
{
ε
}
ε
L
=
{
a
}
a
L
=
L
*
1
r
*
1
L
=
L
1
L
2
r
1
r
2
L
=
L
1
∪
L
2
r
1
+
r
2
•
(Yes, just like in
grep
. But you might have already known that.)
•
If
r
is a regular expression, then
L
(
r
)
is the language of
r
, deﬁned as you’d expect.