Can a union of two CFLs be regular?
Considering and context languages (but not regular), if that is possible unification of the two it is a regular?L1L2L1 ∪ L2
Yes it is possible!
Suppose the first language is L 1 :
L 1: {anbm | n = m}
L 1 CFL, . L 1 - anbn. , CFL, .
L 2:
L 2: {anbm | n ≠ m}
L 2 CFL, . L 2 L 1.
L 1 L 2:
L: {anbm | n m}
L= L1 ∪ L2 L a*b*.
, - CFL. .
: - , CFL CFL ( CFL), -CFL, CSL.
:
CFL ?
L1 L2 Context Free ( ) , , L1 ∩ L2 ?
!
, L 1:
L 1: {anbm | n = m}
L 2:
L 2: {anbm | n <= 3 or n ≠ m}
L= L1 ∩ L2= {ab, aabb, aaabbb} , , .