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
- g.tiLiftRhsSym (IRhsSymbol.terminal t) = IRhsSymbol.nonterminal (Sum.inr t) none
- g.tiLiftRhsSym (IRhsSymbol.nonterminal n f) = IRhsSymbol.nonterminal (Sum.inl n) f
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
Properties of the construction #
Lifting/projection for sentential forms #
Project a sentential-form symbol from termIsolate g to g, sending
Sum.inr t to terminal t.
Equations
Instances For
Forward direction: g.Generates w → termIsolate.Generates w #
Backward direction: termIsolate.Generates w → g.Generates w #
Project a sentential form.
Equations
- g.tiProjSF = List.map g.tiProjISym
Instances For
A sentential form is "resolved" if it contains no Sum.inr nonterminals.
Equations
- g.TIResolved w = ∀ s ∈ w, ∀ (t : T) (σ : List g.termIsolate.flag), s ≠ IndexedGrammar.ISym.indexed (Sum.inr t) σ
Instances For
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.