Langlib

Langlib.Classes.ContextFree.Closure.Reverse

Context-Free Closure Under Reversal #

This file proves that context-free languages are closed under word reversal.

Strategy #

Instead of re-proving the derivation-reversal argument from scratch, we reuse grammar_language_reversal_grammar (the unrestricted result) together with a commutation lemma that shows reversing a CF grammar and then embedding it into an unrestricted grammar gives the same result as embedding first and then reversing.

Main declarations #

Reverse the right-hand side of every rule in a context-free grammar.

Equations
Instances For

    Reversing a CF grammar and then embedding it as an unrestricted grammar gives the same grammar as embedding first and then applying the unrestricted reversal.

    theorem CF_of_reverse_CF {T : Type} (L : Language T) :

    The class of context-free languages is closed under reversal.

    theorem CF_of_reverse_CF_rev {T : Type} (L : Language T) :

    The converse direction of CF_of_reverse_CF, using that reversal is an involution.

    @[simp]
    theorem CF_reverse_iff_CF {T : Type} (L : Language T) :

    A language is context-free iff its reversal is context-free.

    The class of context-free languages is closed under reversal.