Langlib

Langlib.Classes.RecursivelyEnumerable.Closure.Substitution

RE Closure Under Substitution #

This file proves that recursively enumerable languages over finite alphabets are closed under finite-alphabet substitution. The key result is RE_closedUnderSubstitution: encode each substituted symbol as a block inl a :: map inr u, take the Kleene star of the RE block language, restrict the projected source word to the original RE language by inverse homomorphism and intersection, then erase the source-symbol markers by homomorphism.

Main declarations #

theorem RE_of_finite_iUnion {α ι : Type} [Fintype α] [Fintype ι] (L : ιLanguage α) (hL : ∀ (i : ι), is_RE (L i)) :
is_RE (⋃ (i : ι), L i)

RE languages are closed under finite indexed union.

def Language.substProj {α β : Type} (x : α β) :
List α

Projection from encoded substitution blocks to the source alphabet.

Equations
Instances For
    def Language.substErase {α β : Type} (x : α β) :
    List β

    Erasure from encoded substitution blocks to the target alphabet.

    Equations
    Instances For
      def Language.substBlock {α β : Type} (f : αLanguage β) :
      Language (α β)

      The language of one encoded substitution block.

      Equations
      Instances For
        @[simp]
        theorem Language.substProj_block {α β : Type} (a : α) (u : List β) :
        @[simp]
        theorem Language.substErase_block {α β : Type} (a : α) (u : List β) :
        theorem Language.mem_homomorphicImage_iff_flatMap {α β : Type} (L : Language α) (h : αList β) (w : List β) :
        w L.homomorphicImage h xL, List.flatMap h x = w
        theorem Language.mem_substBlock_iff {α β : Type} (f : αLanguage β) (z : List (α β)) :
        z substBlock f ∃ (a : α), uf a, z = Sum.inl a :: List.map Sum.inr u
        theorem RE_of_substBlock_RE {α β : Type} [Fintype α] [Fintype β] (f : αLanguage β) (hf : ∀ (a : α), is_RE (f a)) :

        The encoded single-block language for an RE substitution family is RE.

        theorem RE_of_subst_RE {α β : Type} [Fintype α] [Fintype β] (L : Language α) (f : αLanguage β) (hL : is_RE L) (hf : ∀ (a : α), is_RE (f a)) :
        is_RE (L.subst f)

        RE languages over finite alphabets are closed under substitution.

        The class of recursively enumerable languages is closed under substitution.