Non-contracting grammars and context-preserving grammars #
This file completes the hard direction of the classical equivalence between non-contracting unrestricted grammars and non-erasing context-preserving grammars.
The terminal alphabet of a grammar is always finitely supported, even when its ambient
terminal type is arbitrary. We therefore first restrict a non-contracting language to
that finite support, use the Kuroda--Myhill CS = LBA development to obtain a
context-preserving grammar there, and finally embed that grammar back into the ambient
terminal type.
The last operation is proved below without a finiteness assumption on the target type. Original terminals are kept as private nonterminals while the source grammar runs and are converted to ambient terminals only by final one-symbol rules. Projecting such a derivation back either gives a source-grammar step or a stuttering step, which proves soundness even when the final conversions are interleaved with simulation steps.
Lift every source symbol to a nonterminal over the target terminal alphabet.
Equations
Instances For
Convert one private source-terminal nonterminal to its ambient terminal.
Equations
- CSGTerminalEmbedding.terminalRule f a = { context_left := [], input_nonterminal := CSGTerminalEmbedding.NT.terminal a, context_right := [], output_string := [symbol.terminal (f a)] }
Instances For
Embed a context-preserving grammar along an injective terminal map.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Project an embedded sentential symbol to the source grammar. Ambient terminals not in
the embedding's range may be sent to the arbitrary invFun default; the support invariant
below proves that no such terminal is reachable.
Equations
- CSGTerminalEmbedding.projectSymbol f (symbol.terminal t) = symbol.terminal (Function.invFun (⇑f) t)
- CSGTerminalEmbedding.projectSymbol f (symbol.nonterminal (CSGTerminalEmbedding.NT.source n)) = symbol.nonterminal n
- CSGTerminalEmbedding.projectSymbol f (symbol.nonterminal (CSGTerminalEmbedding.NT.terminal a)) = symbol.terminal a
Instances For
All ambient terminals in a sentential form lie in the embedding's range.
Equations
- CSGTerminalEmbedding.Supported f s = ∀ (t : T), symbol.terminal t ∈ s → ∃ (a : A), f a = t
Instances For
Embedding a finite source terminal alphabet along an injection produces exactly the language image, while the target terminal type remains completely arbitrary.
Non-contracting implies non-erasing context-preserving, for an arbitrary terminal type. No finiteness hypothesis is imposed on the ambient alphabet; only the finite support actually occurring in the source grammar is used internally.
The classical equivalence between non-contracting unrestricted grammars and non-erasing context-preserving grammars, uniformly over every terminal type.