[Math] Is the intersection of a finite language and an infinite language always a regular language

automataregular-language

Is the intersection of a finite language $L_1$ and an infinite language $L_2$ always a regular language?

I've tried a few examples and the result always seems regular.

$\{\} \cap a^nb^n = \{\}$

$\lambda \cap a^nb^n = \lambda$

$ab \cap a^nb^n = ab$

(where $n \geq 0$ for $a^nb^n$)

When I try:

$a^nb^m \cap a^nb^n = a^nb^n$ which is not regular.

However, is $a^nb^m$ considered finite or infinite? $\{a^nb^m : m,n \geq 0\}$ is regular because there is a DFA for it. So, can it be considered finite?

Best Answer

$\{a^nb^m:m,n\ge 0\}$ is a regular language, but it is clearly not finite. It contains one word for each ordered pair $\langle m,n\rangle\in\Bbb N\times\Bbb N$, so it has the same cardinality as the set $\Bbb N\times\Bbb N$ and is therefore countably infinite. Every finite language is regular, but there are many regular languages that are not finite. Indeed, for every non-empty finite set $F$ the language $F^*$ is regular and infinite.

The fact that every finite language is regular answers your first question, as Hagen pointed out in the comments: if $F$ is a finite language, and $L$ is any language, then $F\cap L$ is a finite language and therefore regular.