4

Hello I'm having trouble understanding how an intersection/union of regular languages can be regular and in other case non-regular.

Can someone please give me some good examples?

xskxzr
  • 7,455
  • 5
  • 23
  • 46
Yogzis
  • 41
  • 1
  • 2

2 Answers2

9

For every word $w$, there's a language $\{ w\}$, which is regular, and $\Sigma^* \setminus \{ w\}$, which is also regular.

But, we can express every language (regular or not) $L$ as an infinite union: $L = \bigcup_{w \in L} \{ w \}$, which is an infinite union of regular languages.

For intersection, you do the opposite:

$L = \bigcap_{w \not \in L} (\Sigma^* \setminus \{w \})$.

So, we know that there are regular languages, and non-regular languages, and they can all be expressed as infinite unions or intersections of regular languages.

Joey Eremondi
  • 29,754
  • 5
  • 64
  • 121
  • OK and how about an infinite union/intersection of regular languages that is non-regular? that is what troubles me more. – Yogzis Dec 13 '16 at 02:39
  • 2
    @Yogzis. You misunderstand my answer. You can use the construction above to construct any language: regular, non-regular, undecidable, etc. You pick your $L$, and we can define it as an infinite union or intersection of regular languages. – Joey Eremondi Dec 13 '16 at 02:52
0

Every regular language can be described as a DFA. So assume you have a DFA that represents language one, and a DFA that represents language two. Now construct a third DFA that represents the union of the first two DFA. Construct another DFA that represents the intersection of the first two DFA.

Logan Leland
  • 160
  • 6