2

I've searched on the internet and most say just say that context free languages are closed for union, concatenation, reversal, and Kleene Star. Are they also closed for set difference?

JohnnyBoi
  • 35
  • 1
  • 5

1 Answers1

5

The context-free languages are not closed under set difference. One way to see this is to note that

  1. the context-free languages are not closed under complementation,
  2. the language Σ* is context-free, and
  3. for any language L, the complement of L is given by Σ* - L.

Therefore, if the CFLs were closed under set difference, then they'd be closed under complementation... except that they aren't. :-)

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065