Documentation

LeanPool.PumpingCfg.ChomskyNormalForm.TerminalRestriction

Terminal Restriction #

This file contains the algorithm to restrict rules to either rewrite to a single terminal or only nonterminals.

Main definitions #

Main theorems #

References #

Definitions of embeding into and projecting to the type of symbols of the new grammar

def embedSymbol {T : Type} {N : Type uN} (s : Symbol T N) :
Symbol T (N T)

Intuitive embedding of symbols of the original grammar into symbols of the new grammar's type

Equations
Instances For
    @[reducible, inline]
    abbrev embedString {T : Type} {N : Type uN} (u : List (Symbol T N)) :
    List (Symbol T (N T))

    Intuitive embedding of strings of the original grammar into strings of the new grammar's type

    Equations
    Instances For
      def rightEmbedSymbol {T : Type} {N : Type uN} (s : Symbol T N) :
      Symbol T (N T)

      Embedding of symbols of the original grammar into nonterminals of the new grammar

      Equations
      Instances For
        @[reducible, inline]
        abbrev rightEmbedString {T : Type} {N : Type uN} (w : List (Symbol T N)) :
        List (Symbol T (N T))

        Embedding of strings of the original grammar into nonterminal (symbol) strings of the new grammar

        Equations
        Instances For
          def projectSymbol {T : Type} {N : Type uN} (s : Symbol T (N T)) :
          Symbol T N

          Projection from symbols of the new grammars type into symbols of the original grammar

          Equations
          Instances For
            def projectString {T : Type} {N : Type uN} (u : List (Symbol T (N T))) :
            List (Symbol T N)

            Projection from strings of the new grammars type into strings of the original grammar

            Equations
            Instances For
              theorem embedString_preserves_nonempty {T : Type} {N : Type uN} {u : List (Symbol T N)} (hu : u []) :
              theorem embedString_append {T : Type} {N : Type uN} {u v : List (Symbol T N)} :

              Definition of ContextFreeGrammar.restrictTerminals, the algorithm to restrict rules s.t. terminals occur only as the single symbol at the right-hand side of a rule.

              Computes rules r' : T -> t, for all terminals t occuring in r.output

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

                If r.output is a single terminal, we lift the rule to the new grammar, otherwise add new rules for each terminal symbol in r.output and right-lift the rule, i.e., replace all terminals with nonterminals

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

                  Construct new grammar, using the lifted rules. Each rule's output is either a single terminal or only nonterminals

                  Equations
                  Instances For