If and are context free languages and a regular set, one of the languages below is not necessarily a context free language. Which one?
View worked solution
Answer: B
Context-free languages (CFLs) have specific closure properties:
- Union (): Closed. If and are CFLs, their union is also a CFL.
- Concatenation (): Closed. If and are CFLs, their concatenation is also a CFL.
- Intersection with a regular language (): Closed. The intersection of a CFL and a regular language is always a CFL.
- Intersection (): Not closed. The intersection of two CFLs is not necessarily a CFL.
For example, the languages and are both context-free, but their intersection is a well-known non-context-free language.
Free practice · Your answers on this page are not saved.
