Normal Form for Indexed Grammars #
This file assembles the normal form theorem for indexed grammars following Aho (1968).
An indexed grammar is in normal form if every production has one of the four forms:
A → BC— binary split, no flag consumed, no flag pushedAf → B— flag consumption (pop)A → Bf— flag pushA → a— terminal production
and the start symbol does not appear on the right-hand side of any production.
Main results #
IndexedGrammar.exists_normalForm_all— every ε-free indexed grammar has an equivalent grammar in normal formIndexedGrammar.exists_normalForm— compatibility wrapper for non-empty wordsIndexedGrammar.exists_finiteSupport_normalForm_nonempty— every indexed grammar has a finite-support normal-form grammar preserving all non-empty words
Proof outline #
The proof proceeds by a sequence of language-preserving transformations:
- Fresh start (
FreshStart.lean, fully proved): introduce a new start symbol that does not appear on any right-hand side. - ε-free pass-through (
EpsilonElim.lean): use the explicit ε-free hypothesis. - Terminal isolation (
TerminalIsolation.lean, fully proved): replace terminals in multi-symbol right-hand sides with dedicated nonterminals. - Flag separation (
FlagSeparation.lean): split rules with complex flag operations. - Binarization (
Binarization.lean): replace right-hand sides of length ≥ 3 with chains of binary rules.
References #
- A. V. Aho, "Indexed grammars — an extension of context-free grammars", JACM 15(4), 1968.
Aho's Normal Form Theorem #
Before ε-elimination is available, any indexed grammar can still be made terminal-isolated and flag-separated without changing its language. This is the structural preprocessing target for the arbitrary-ε part of the normal-form construction.
It is enough to prove ε-elimination after terminal isolation and flag separation. The preprocessing is language-preserving and can be run before the ε-free invariant exists.
Every indexed grammar has an ε-free grammar preserving all non-empty generated words.
The construction first makes the grammar flag-separated, restricts to finite support, and then applies the exact finite nullable-summary ε-elimination.
Normal-form theorem for ε-free indexed grammars. For every indexed grammar g
with no ε-productions, there exists an indexed grammar g' in normal form such that
g' generates exactly the same words as g.
Compatibility form of the normal-form theorem, preserving all non-empty words.
Every ε-free indexed grammar has a finite-support normal-form grammar preserving all generated words.
Compatibility form of the finite-support normal-form theorem, preserving all non-empty generated words.
Every indexed grammar has a finite-support normal-form grammar preserving all non-empty generated words. The empty word is intentionally omitted: normal-form grammars are ε-free.