Langlib

Langlib.Classes.ContextFree.Closure.Intersection

Context-Free Non-Closure Under Intersection #

This file proves that context-free languages are not closed under intersection.

The witnesses are lang_eq_any = {aⁿbⁿcᵐ | n,m ∈ ℕ} and lang_any_eq = {aⁿbᵐcᵐ | n,m ∈ ℕ}, each context-free (CF_lang_eq_any / CF_lang_any_eq, in Langlib.Classes.ContextFree.Examples.{AnBnCm,AnBmCm}). Their intersection is lang_eq_eq = {aⁿbⁿcⁿ | n ∈ ℕ}, which is not context-free (notCF_lang_eq_eq, in Langlib.Classes.ContextFree.Examples.AnBnCn).

This file supplies the intersection bookkeeping lang_eq_anylang_any_eq = lang_eq_eq and assembles the non-closure statements.

Main declarations #

theorem nnyCF_of_CF_i_CF :
¬∀ (L₁ L₂ : Language (Fin 3)), is_CF L₁ is_CF L₂is_CF (L₁L₂)

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

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

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

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

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