Langlib

Langlib.Grammars.Indexed.NormalForm.TerminalIsolation

Terminal Isolation for Indexed Grammars #

This file constructs a terminal-isolation transformation for indexed grammars. Given an indexed grammar with no ε-productions, it produces an equivalent grammar where every rule's RHS is either a single terminal or consists entirely of nonterminals.

This is Step 3 of Aho's Normal Form theorem.

Transform an RHS symbol by replacing terminals with fresh nonterminals.

Equations
Instances For

    Transform an RHS symbol for the identity embedding (no terminal replacement).

    Equations
    Instances For

      Collect all terminals appearing in all rules' RHS.

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

        The terminal-isolation grammar. Every terminal in a rule's RHS is replaced with a fresh nonterminal Sum.inr t, and for each such terminal a rule Sum.inr t → t is added.

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

          Properties of the construction #

          Lifting/projection for sentential forms #

          Forward direction: g.Generates w → termIsolate.Generates w #

          theorem IndexedGrammar.termIsolate_resolve_inr {T : Type} (g : IndexedGrammar T) (rhs : List (IRhsSymbol T g.nt g.flag)) (σ : List g.flag) (r : IRule T g.nt g.flag) (hr : r g.rules) (hrhs : rhs = r.rhs) :
          theorem IndexedGrammar.termIsolate_lift_derives {T : Type} (g : IndexedGrammar T) {w₁ w₂ : List g.ISym} (h : g.Derives w₁ w₂) :

          Backward direction: termIsolate.Generates w → g.Generates w #

          Project a sentential form.

          Equations
          Instances For

            A sentential form is "resolved" if it contains no Sum.inr nonterminals.

            Equations
            Instances For
              theorem IndexedGrammar.termIsolate_proj_transforms {T : Type} (g : IndexedGrammar T) {w₁ w₂ : List g.termIsolate.ISym} (ht : g.termIsolate.Transforms w₁ w₂) :
              g.Derives (g.tiProjSF w₁) (g.tiProjSF w₂)
              theorem IndexedGrammar.termIsolate_proj_derives {T : Type} (g : IndexedGrammar T) {w₁ w₂ : List g.termIsolate.ISym} (hd : g.termIsolate.Derives w₁ w₂) :
              g.Derives (g.tiProjSF w₁) (g.tiProjSF w₂)

              Main result #

              Terminal isolation preserves the language of any indexed grammar. This unconditional packaging is used by the arbitrary-ε pipeline before the ε-free invariant is available.