RE Closure Under String Homomorphism #
This file proves that the class of recursively enumerable languages is closed under string homomorphism. It also provides a grammar construction for the ε-free case, where no symbol is erased.
Proof idea for arbitrary finite-alphabet homomorphisms: a word w is in the
homomorphic image iff there exists a source word x and a derivation witness for
x in the original grammar such that x.flatMap h = w. This existential search
is computable over finite alphabets, so the search-to-TM and TM-to-RE bridges
produce the RE witness.
Given an unrestricted grammar g over terminals α generating L, and an ε-free string
homomorphism h : α → List β, we construct an unrestricted grammar hom_grammar g h
over terminals β whose language is L.homomorphicImage h.
Main declarations #
hom_grammarRE_closed_under_homomorphismRE_closedUnderHomomorphismRE_closed_under_epsfree_homomorphism
Note on erasing homomorphisms #
The two-phase grammar construction hom_grammar is correct only for ε-free homomorphisms
(where h a ≠ [] for all a). For erasing homomorphisms (where some h a = []),
the Phase 2 expansion can remove nonterminal placeholders, which may create new adjacencies
that enable Phase 1 rules that have no corresponding rule application in the original grammar.
A correct construction for the general case would require a more sophisticated mechanism
(e.g., a scanning phase to ensure Phase 1 is complete before Phase 2 begins).
Map a symbol by replacing terminals with nonterminal placeholders.
Equations
Instances For
Lift an entire string to placeholder form.
Equations
Instances For
Lift a rule to phase 1 form.
Equations
- homLiftRule r = { input_L := homLiftStr r.input_L, input_N := Sum.inl r.input_N, input_R := homLiftStr r.input_R, output_string := homLiftStr r.output_string }
Instances For
The two-phase grammar for the homomorphic image.
Equations
- hom_grammar g h = { nt := g.nt ⊕ α, initial := Sum.inl g.initial, rules := List.map homLiftRule g.rules ++ List.map (homExpandRule h) (all_used_terminals g) }
Instances For
The ε-free homomorphic-image grammar generates exactly the homomorphic image.
Search test for the homomorphic image of a grammar language.
The witness contains both a preimage word and a derivation sequence for that preimage.
Equations
- reHomomorphismTest g h p w = (grammarTest g p.2 p.1 && decide (List.flatMap h p.1 = w))
Instances For
The homomorphic-image search test is computable over finite source alphabets.
The class of RE languages is closed under arbitrary finite-alphabet string homomorphism.
The class of recursively enumerable languages is closed under string homomorphism.
The class of RE languages is closed under ε-free string homomorphism.
The class of recursively enumerable languages is closed under ε-free string homomorphism.