Langlib

Langlib.Classes.DeterministicContextFree.Closure.InverseHomomorphism

Deterministic Context-Free Closure Under Inverse Homomorphism #

The construction first totalizes the source DPDA. Besides preserving its language, the totalizer keeps a permanent bottom-of-stack marker and records in its finite control whether the current epsilon phase can accept.

For a homomorphism h : α → List β, the inverse-image machine stores one source letter and a position in h a in finite control. Consuming a source letter is deliberately performed before the simulated epsilon phase. This ordering is essential when h a = []: prioritizing source-machine epsilon steps can otherwise starve an erasable source letter forever.

@[reducible, inline]
abbrev InvHomBuffer (α β : Type) (h : αList β) :

A buffered source letter together with the next position of its nonempty image.

Equations
Instances For
    def invHomBufferRemaining {α β : Type} (h : αList β) :
    InvHomBuffer α β hList β

    The part of a buffered homomorphic image which remains to be simulated.

    Equations
    Instances For
      def invHomWord {α β : Type} (h : αList β) (w : List α) :
      List β

      Extension of a string homomorphism to words.

      Equations
      Instances For
        def invHomAdvance {α β : Type} (h : αList β) (a : α) (k : Fin (h a).length) :
        InvHomBuffer α β h

        Advance past one simulated symbol in a nonempty buffered image.

        Equations
        Instances For
          @[simp]
          theorem invHomWord_nil {α β : Type} (h : αList β) :
          @[simp]
          theorem invHomWord_cons {α β : Type} (h : αList β) (a : α) (w : List α) :
          invHomWord h (a :: w) = h a ++ invHomWord h w
          @[simp]
          theorem invHomBufferRemaining_none {α β : Type} (h : αList β) :
          def DPDA.inverseHomomorphism {α β : Type} [Fintype α] [Fintype β] {Q S : Type} [Fintype Q] [Fintype S] (M : DPDA Q β S) (h : αList β) :
          DPDA (Q × InvHomBuffer α β h) α S

          DPDA recognizing the inverse image of M under h, provided final-state membership of M is invariant along its empty-input epsilon runs.

          In the ready state (buffer = none) the machine has no epsilon transition: it first consumes the next source letter. A nonempty image is then drained through epsilon transitions, with source-machine epsilon steps taking priority while a buffer is present.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem DPDA.inverseHomomorphism_correct {α β : Type} [Fintype α] [Fintype β] {Q S : Type} [Fintype Q] [Fintype S] (M : DPDA Q β S) (h : αList β) (hfinal : ∀ (q q' : Q) (stack stack' : List S), PDA.Reaches { state := q, input := [], stack := stack } { state := q', input := [], stack := stack' } → (q M.final_states q' M.final_states)) (hne : ∀ (w : List β) (c : M.toPDA.conf), PDA.Reaches { state := M.initial_state, input := w, stack := [M.start_symbol] } cc.stack []) :

            Correctness of the repaired inverse-homomorphism construction under the two normal-form properties supplied by the DPDA totalizer.

            theorem DCF_closed_under_inverse_homomorphism {α β : Type} [Fintype α] [Fintype β] (L : Language β) (h : αList β) (hL : is_DCF L) :

            Deterministic context-free languages are closed under inverse string homomorphism.

            Predicate-form closure theorem used by the README closure table.