Fresh Start Symbol for Indexed Grammars #
This file proves that every indexed grammar can be transformed into one whose start symbol does not appear on the right-hand side of any production rule, while preserving the generated language.
This is Step 1 of Aho's Normal Form theorem for indexed grammars.
References #
- A. V. Aho, "Indexed grammars — an extension of context-free grammars", JACM 15(4), 1968.
Lifting functions #
Lift an RHS symbol to the Option nonterminal type.
Equations
- g.liftRhsSym (IRhsSymbol.terminal t) = IRhsSymbol.terminal t
- g.liftRhsSym (IRhsSymbol.nonterminal n f) = IRhsSymbol.nonterminal (some n) f
Instances For
The grammar with a fresh start symbol none : Option g.nt. Has one start rule
S' → S (where S' = none, S = some g.initial) and all original rules lifted.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Key helper: expandRhs commutes with lifting #
Forward direction: g.Language ⊆ (freshStart g).Language #
Backward direction: (freshStart g).Language ⊆ g.Language #
A sentential form of freshStart g is "proper" if it contains no occurrence of the
fresh start symbol none.
Equations
- g.Proper w = ∀ s ∈ w, ∀ (σ : List g.freshStart.flag), s ≠ IndexedGrammar.ISym.indexed none σ
Instances For
Unlift a sentential-form symbol. For proper forms, this is the inverse of liftISym.
Equations
Instances For
Unlift a proper sentential form.
Equations
- g.unliftSF w = List.map g.unliftISym w
Instances For
Main result #
The fresh-start grammar generates the same language as the original.
Adding a fresh start symbol preserves the absence of ε-productions.