Consider the following statements.

I. If L1 ∪ L2 is regular, then both L1 and L2 must be regular.

II. The class of regular languages is closed under infinite union.

Which of the above statements is/are TRUE?

A.

I only

B.

II only

C.

Both I and II

D.

Neither I nor II

Solution:

Statement I: False,
Let L1 = {anbn | n > 0} ⇒ CFL
L2 = Complement of L1
Then L1 ∪ L2 = {(a + b)*} ⇒ Regular language.

It is not necessary that both L1 and L2 are regular for the union to be regular as well.

Statement II: False, Let
L1 = {ab}
L2 = {aabb}
L3 = {aaabbb}
.
.
Ln = {anbn}

L1L2L3 ∪ . . .Ln

{anbn | n > 0} ⇒ CFL, It is not Regular Language.

Regular languages are not closed under inifinite UNION.

(Read for more Closure Properties)