Is it possible that L1 U L2
= regular language ?
Yes, it is possible.
But its always better to take an example:
L1 = {0*1*}
(regular) and L2 = {0^n1^n |n>=0}
(context-free).
L = L1 U L2 = {0*1*}
which is regular language but since every regular language is context-free. So, we can say the union of two always results in context-free language.
Is it possible that L1·L2
= regular language ?
the concatenation of a regular and a context-free language always results in a context-free language.Take the above example again:
L = L1·L2 = {(0*1*)·(0^n1^n) |n>=0}
(context free).
It can be regular too if for example one of L1
or L2
is Ø
, L1·L2
will result in Ø
(regular). But since, all regular languages are context-free, Ø
is also a context-free.
Check this out: Geeks for Geeks