Union of two non-regular languages.

13.1k Views Asked by At

Can the union of two non-regular languages be regular?? I have $L_1 = \{a^i b^j \mid i > j\}$ and $L_2 = \{a^i b^j \mid i < j\}$. I am using Pumping lemma with $s = a^{p+1} b^p$ for $L_1$ and $s = a^p b^{p-1}$ for $L_2$ and the two are non-regular but I am not sure that is correct.

2

There are 2 best solutions below

0
On

Let $L$ be any non-regular language. Then observe that its complement is also non-regular. Their union is the set of all strings, which is regular.

The two languages you gave also work. Let $L_1=\{a^ib^j|i>j\}$ and $L_2=\{a^ib^j|i<j\}$. Once you've proven that $L_1$ is not regular, it also follows that $L_2$ is not regular: the reason is that regular languages are closed under reversal: if $L$ is regular, so is $\{rev(x)|x \in L\}$. If $L_2$ were regular, then $rev(L_2)$ would be regular and this is just $L_1$ with $a$s and $b$s swapped.

0
On

Union of two non-regular languages may or may not be non-regular. It may be regular.


Let us assume two Non-regular languages $L_1 = \{a^ib^j|i>=j\}$ and $L_2 = \{a^ib^j|i<j\}$ where $ i,j\ge 0$. But their union is $L = L_1 \cup L_2 = \{a^*b^*\}$, which is regular.