Linear languages under terminal maps (alphabet renamings) #
This file concerns the letter-to-letter map Language.map f for f : T₁ → T₂
(an alphabet renaming). It is not the general string homomorphism α → List β of
the ClosedUnderHomomorphism predicate — the symbol-to-string case is not treated
here.
Relabelling the terminals of a grammar by such an f (the construction
map_grammar) keeps the nonterminals untouched, so it preserves the linear rule
shape. Because a linear grammar's rules have empty left/right context, the
relabelled grammar generates exactly the f-image of the original language — even
when f is not injective. This yields:
is_Linear_map—Linearis closed under terminal mapsLanguage.map f.is_Linear_of_map_injective— and is reflected along injective maps.
The reflection direction is what lets a non-linearity result over a small concrete
alphabet (e.g. Fin 4) be transported to any larger alphabet.
A symbol list whose entries are all terminals is the image of a terminal word.
Relabelling preserves the linear rule shape (nonterminals are untouched).
Forward relabelling of derivations.
Reflection of derivations: any derivation of the relabelled (linear) grammar comes from a derivation of the original grammar (this uses the empty context of linear rules).
The relabelled grammar generates exactly the f-image of the original language.
Linear languages are closed under terminal maps.
Linearity is reflected along injective terminal maps.