Langlib

Langlib.Classes.ContextFree.Closure.Complement

Context-Free Non-Closure Under Complement #

This file derives failure of closure under complement from the corresponding intersection result.

Counterexample idea: if CFLs were closed under complement, then together with closure under union they would also be closed under intersection by De Morgan's law. This contradicts the explicit non-closure result for intersection.

Main declarations #

theorem nnyCF_of_complement_CF :
¬∀ (L : Language (Fin 3)), is_CF Lis_CF L

The class of context-free languages isn't closed under complement.

Context-free languages over Fin 3 are not closed under complement.

theorem CF_notClosedUnderComplement_of_three {α : Type} (a b c : α) (hab : a b) (hac : a c) (hbc : b c) :

Context-free languages are not closed under complement for any type with at least 3 elements. That is, as long as α has at least 3 distinct elements, not all complements of context-free languages over α are context-free.

Context-free languages are not closed under complement for any finite alphabet with at least three symbols.