Langlib

Langlib.Grammars.NonContracting.ErasingImage

Recursively enumerable languages as erasing images of non-contracting languages #

This file implements the standard padding construction for unrestricted grammars. A rule whose output is shorter than its input emits enough padding symbols to preserve length. The padding symbols then commute to the right and survive as terminals in the generated word; an erasing homomorphism removes them again.

The construction first restricts the source grammar to its finitely many used nonterminals. For a grammar with finite terminal and nonterminal alphabets, its simulation uses:

Projection erases padding and recovers every simulated source step. Conversely, padding can be moved across the untouched right context after every source step, so every source derivation lifts to the new grammar.

This is the grammar-theoretic core of the classical fact that every recursively enumerable language is a homomorphic image of a context-sensitive language.

Main declarations #

Reference #

J. E. Hopcroft and J. D. Ullman, Formal Languages and Their Relation to Automata, Theorem 9.9 and Corollary 9.3, 1969.

Delete padding terminals and retain original terminals.

Equations
Instances For

    Embed a source sentential form into the padded grammar symbol by symbol.

    Equations
    Instances For

      The nonterminal used while padding is moved to the right edge.

      Equations
      Instances For

        The terminal padding symbol that survives in a generated padded word.

        Equations
        Instances For

          Length of a rule's complete left-hand side.

          Equations
          Instances For

            Number of padding symbols needed to make a source rule non-contracting.

            Equations
            Instances For

              A source rule with enough padding appended to make it non-contracting.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Move the padding nonterminal one position to the right across a lifted source symbol.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Convert the padding nonterminal into the padding terminal.

                  Equations
                  Instances For
                    noncomputable def Grammar.ErasingImage.activeSymbols {T N : Type} [Fintype T] [Fintype N] :
                    List (symbol T N)

                    The finite list of source symbols across which padding may have to move.

                    Equations
                    Instances For
                      noncomputable def Grammar.ErasingImage.swapRules {T N : Type} [Fintype T] [Fintype N] :

                      Commuting rules for every symbol of finite terminal and nonterminal alphabets.

                      Equations
                      Instances For

                        Padded simulation for a grammar whose terminal and nonterminal alphabets are finite.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Every rule of the finite padded simulation is non-contracting.

                          Projection and soundness #

                          Padding motion and completeness #

                          Language equivalence #

                          Embed a terminal word and append k padding terminals.

                          Equations
                          Instances For

                            Erasing the padding terminals from the finite padded simulation recovers exactly the source grammar's language.

                            The padded simulation of an arbitrary grammar. Restricting to the nonterminals occurring in its finite rule list supplies the finite alphabet needed to enumerate the commuting rules.

                            Equations
                            Instances For

                              The padded simulation of an arbitrary grammar is non-contracting.

                              Erasing padding from the padded simulation of an arbitrary grammar recovers its language.

                              Every source word has a representative generated by erasingImageGrammar whose padding occurs entirely as a terminal suffix. This is the non-erasing witness used by quotient reductions.

                              Projecting any terminal word generated by erasingImageGrammar gives a terminal word of the source grammar.

                              Every unrestricted grammar language is the erasing homomorphic image of a non-contracting language.