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 #
reversal_CF_grammar— reverse the RHS of every CF rulegrammar_of_cfg_reversal_comm— commutation with the CF→unrestricted embeddingCF_of_reverse_CFCF_of_reverse_CF_revCF_reverse_iff_CF
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.
The converse direction of CF_of_reverse_CF, using that reversal is an involution.
The class of context-free languages is closed under reversal.