Langlib

Langlib.Classes.Regular.Closure.Homomorphism

Regular Closure Under Homomorphism #

Proof idea: a homomorphism is implemented as regular substitution by replacing each input letter with the regular singleton language containing its image string. The epsilon-free variant is the same construction with the extra nonempty-image hypothesis carried through the closure predicate.

Regular Closure Under (String) Homomorphism #

This file proves that regular languages are closed under symbol maps (letter-to-letter homomorphisms) and, more generally, under string homomorphisms.

Main results #

noncomputable def Language.mapNFA {α : Type u_1} {β : Type u_2} {σ : Type u_3} (M : DFA α σ) (f : αβ) :
NFA β σ

NFA recognising the image of a DFA language under a symbol map.

For a DFA M over α and a function f : α → β, the NFA over β has the same states. On symbol b, from state q, the NFA non-deterministically guesses a preimage a with f a = b and transitions to M.step q a.

Equations
Instances For
    theorem Language.mapNFA_correct {α : Type u_1} {β : Type u_2} {σ : Type u_3} (M : DFA α σ) (f : αβ) :
    (mapNFA M f).accepts = (map f) M.accepts
    theorem Language.IsRegular.map {α : Type u_1} {β : Type u_2} {L : Language α} (hL : L.IsRegular) (f : αβ) :

    Regular languages are closed under symbol maps (letter-to-letter homomorphisms).

    Singleton word languages are regular #

    Any singleton word language is regular.

    theorem Language.IsRegular.homomorphicImage {γ α' : Type} [Fintype α'] {L : Language α'} (hL : L.IsRegular) (h : α'List γ) :

    Regular languages are closed under string homomorphism.

    Given a regular language L over a finite alphabet and a string homomorphism h : α' → List γ, the image {h(w) | w ∈ L} is regular.

    The class of regular languages is closed under homomorphism.

    The class of regular languages is closed under ε-free homomorphism.