1
$\begingroup$

It is known that union of two context-free languages is also context-free.

But how about union of context-free and non-context-free languages?

$\endgroup$

1 Answer 1

3
$\begingroup$

Not in general. Consider a language $L$ over some alphabet $\Sigma$ such that neither $L$ nor its complement $\overline{L}$ is a decidable language. It is obvious that neither of these languages can be context-free. But $L \cup \overline{L} = \Sigma^*$, which is a context-free language.

And consider $\emptyset$, which is trivially a context-free language. Clearly $L \cup \emptyset = L$ is not a context-free language.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.