Langlib

Langlib.Automata.Turing.DSL.CodeToTMDirect

Direct ToPartrec.Code → TM Recognition #

This file proves the direct bridge from a semideciding ToPartrec.Code to is_TM. It composes the user code with listEncodeCode, so the Partrec chain runs on a variable-length List input representing the encoded word. The tape-level part realizes the finite per-symbol conversion from the input alphabet to the shifted chain fragments used by shiftedEncoding.

Key results #

Blank-preserving embedding #

noncomputable def directBlankEmb {T Γ₀ : Type} [DecidableEq Γ₀] [Inhabited Γ₀] (γ : Γ₀) :
Option (T Γ₀)
Equations
Instances For
    noncomputable def directBlankInv {T Γ₀ : Type} [Inhabited Γ₀] (a : Option (T Γ₀)) :
    Γ₀
    Equations
    Instances For
      theorem directBlankInv_emb {T Γ₀ : Type} [DecidableEq Γ₀] [Inhabited Γ₀] (γ : Γ₀) :
      theorem directBlankEmb_ne_default {T Γ₀ : Type} [DecidableEq Γ₀] [Inhabited Γ₀] (γ : Γ₀) ( : γ default) :

      Direct shifted tape construction #

      noncomputable def shiftedNatBlock (n : ) :
      Equations
      Instances For
        noncomputable def shiftedSymbolBlock {T : Type} [Primcodable T] (t : T) :
        Equations
        Instances For
          noncomputable def shiftedPayload {T : Type} [Primcodable T] :
          Equations
          Instances For
            noncomputable def shiftedFoldAccStep {T : Type} [Primcodable T] (t : T) (acc : List ChainΓ) :
            Equations
            Instances For
              noncomputable def shiftedFoldTapeStep (T : Type) [DecidableEq T] [Fintype T] [Primcodable T] (t : T) :
              Equations
              Instances For
                theorem shiftedFoldTapeStep_hetMix (T : Type) [DecidableEq T] [Fintype T] [Primcodable T] (t : T) (ts : List T) (acc : List ChainΓ) :
                theorem shiftedFoldAccStep_ne_default {T : Type} [Primcodable T] (t : T) (acc : List ChainΓ) (hacc : gacc, g default) (g : ChainΓ) :
                theorem shiftedFoldTapeStep_ne_default (T : Type) [DecidableEq T] [Fintype T] [Primcodable T] (t : T) (block : List (Option (T ChainΓ))) (hblock : gblock, g default) (g : Option (T ChainΓ)) :
                noncomputable def shiftedFinishBlock {T : Type} (block : List (Option (T ChainΓ))) :
                Equations
                Instances For

                  Remaining direct-converter obligation #

                  The reduced converter obligation for the direct bridge.

                  It maps identity-encoded input w to the embedded Partrec-chain tape for shiftedEncoding w. Since T is finite, this is implemented by the finite per-symbol substitution fold above rather than binary arithmetic on the tape.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Local alphabet embedding #

                    noncomputable def directEmbedTM0 {T Λ : Type} [Inhabited Λ] (M : Turing.TM0.Machine ChainΓ Λ) :

                    Embed a ChainΓ TM0 into Option (T ⊕ ChainΓ), preserving blanks.

                    Equations
                    Instances For

                      The direct embedding preserves halting behavior.

                      Once the reduced converter exists, any ToPartrec.Code-semidecidable language is is_TM.

                      This is the sound replacement target for the current arithmetic converter: the Code-level list encoding is already handled by composedCode, and the tape-level converter only needs to write shiftedEncoding w.