Langlib

Langlib.Classes.ContextFree.Closure.ConverseFailures

Context-Free Closure Converses Fail #

This file proves that the closure properties of context-free languages under union, concatenation, and substitution are strict implications, not biconditionals. That is, while:

Proof sketch #

All counterexamples derive from the existence of a non-context-free language, which is obtained from nnyCF_of_CF_i_CF (non-closure under intersection): there exist CF languages L₁, L₂ whose intersection L₁ ⊓ L₂ is not CF.

Main declarations #

theorem not_iff_CF_union :
¬∀ (T : Type) (L₁ L₂ : Language T), is_CF (L₁ + L₂) is_CF L₁ is_CF L₂

The converse of union closure fails: there exist languages where L₁ + L₂ is CF but not both L₁ and L₂ are CF.

theorem not_iff_CF_concat :
¬∀ (T : Type) (L₁ L₂ : Language T), is_CF (L₁ * L₂) is_CF L₁ is_CF L₂

The converse of concatenation closure fails: there exist languages where L₁ * L₂ is CF but not both L₁ and L₂ are CF.

theorem not_iff_CF_subst :
¬∀ (α β : Type) (L : Language α) (f : αLanguage β), is_CF (L.subst f) is_CF L ∀ (a : α), is_CF (f a)

The converse of substitution closure fails: there exist a language L and substitution f where L.subst f is CF but the premises is_CF L ∧ ∀ a, is_CF (f a) fail.