Langlib

Langlib.Classes.ContextFree.Closure.Bijection

Context-Free Closure Under Bijections #

This file proves that context-free languages are preserved under renaming terminals along an equivalence.

Strategy #

We reuse the unrestricted-level result bijection_grammar_language by showing that the CF bijection construction commutes with the embedding into unrestricted grammars. The derivation correspondence is proved only once at the unrestricted level; the CF file only needs to verify structure preservation.

Main declarations #

theorem CF_of_map_CF {T₁ T₂ : Type} (f : T₁T₂) (L : Language T₁) :
is_CF Lis_CF ((Language.map f) L)

Context-free languages are closed under alphabet maps.

theorem CF_of_map_injective_CF_rev {T₁ T₂ : Type} {f : T₁T₂} (hf : Function.Injective f) (L : Language T₁) :
is_CF ((Language.map f) L)is_CF L

Injective alphabet maps reflect context-freeness.

def bijection_CF_grammar {T₁ T₂ : Type} (g : CF_grammar T₁) (π : T₁ T₂) :

Map a CF grammar along a terminal bijection.

Equations
Instances For
    theorem bijection_CF_grammar_language {T₁ T₂ : Type} (g : CF_grammar T₁) (π : T₁ T₂) :

    The bijection CF grammar generates exactly the π-image of the original language.

    theorem CF_of_bijemap_CF {T₁ T₂ : Type} (π : T₁ T₂) (L : Language T₁) :
    is_CF Lis_CF (L.bijemapLang π)

    The class of context-free languages is closed under bijection between terminal alphabets.

    theorem CF_of_bijemap_CF_rev {T₁ T₂ : Type} (π : T₁ T₂) (L : Language T₁) :
    is_CF (L.bijemapLang π)is_CF L

    The converse direction of CF_of_bijemap_CF, obtained by applying the forward result to the inverse bijection.

    @[simp]
    theorem CF_bijemap_iff_CF {T₁ T₂ : Type} (π : T₁ T₂) (L : Language T₁) :

    A language is context-free iff its image under a bijection of terminal alphabets is context-free.