Let L1, L2 be any two context-free languages and R be any regular language. Then which of the following is/are CORRECT? I. L1 ∪ L2 is context-free II. L̅1 is context-free III. L1 – R is context-free IV. L1 ∩ L2 is context-free
Let L1, L2 be any two context-free languages and R be any regular language. Then which of the following is/are CORRECT? I. L1 ∪ L2 is context-free II. L̅1 is context-free III. L1 – R is context-free IV. L1 ∩ L2 is context-free Correct Answer I and III only
Concept: Property of context-free languages is:
Context-free languages are closed under union and difference but not closed under complementation and intersection.
Explanation:
Option 1) L1 ∪ L2 is context-free
As context-free languages are closed under union. So it is correct.
Option 2). L̅1 is context-free
L1 is a context-free language. According to the property, its complement can’t be context-free.
Option 3) L1 – R is context-free
As the difference of a context-free language with regular is context-free. So, it is correct.
Option 4) L1 ∩ L2 is context-free
It violated the context-free language property. The intersection of two CFL’s is not CFL. So, it is incorrect.