2

I have been looking around for a good source to answer the following question. Have read a few different sources but have not found the answer I was looking for.

The question is:

Give an example of an infinite set of:

a. Regular languages whose union is a regular language

b. Regular languages whose union is a non-regular language

c. Non-regular languages whose union is a regular language

d. Non-regular languages whose union is a non-regular language

I've used this post to answer part b, and I understand the method behind it (at least I think I do).

What is the right way to approach this question?

Wouldn't an infinite set of anything constitute a non-regular language, by definition?

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
Immanuel
  • 43
  • 4

2 Answers2

1

a. is pretty easy. Just consider $\{a\}^\ast = \bigcup_{i \in \mathbb{N}_0} \{a\}^i$. This also answers the last question in your post (i.e., regular does not mean finite).

The answer to b., as you have said, can be found in the linked question.

Finally, for c. and d. you can use subsets of $\{ 0^n 1^n \mid n \in \mathbb{N}_0 \}$ and $\{ 1^n 0^n \mid n \in \mathbb{N}_0 \}$, which are both non-regular languages. Hint: The exercise text does not require the languages to be disjoint.

dkaeae
  • 5,057
  • 1
  • 17
  • 31
1

Regarding a and b, let us make the following observation:

Every language is a union of regular languages.

This follows from the identity $$ L = \bigcup_{w \in L} \{w\}. $$

For part c, it is easy to write $\Sigma^*$ as a union of infinitely many distinct non-regular languages. Using your favorite non-regular language $L$, $$ \Sigma^* = \bigcup_{w \in \Sigma^*} (L \cup \{w\}). $$

For part d, again take your favorite non-regular language $L$. Then $$ L = \bigcup_{n=0}^\infty \{ w \in L : |w| \geq n \}. $$ Since $L$ is infinite, infinitely many of the summands would be distinct.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514