Langlib

Langlib.Automata.Turing.DSL.PartrecCodeToTM0

Partrec Code → TM0 Assembly #

This file assembles the full chain Code → TM2 → TM1 → TM0, proving that any partial recursive function (given as ToPartrec.Code) can be evaluated by a TM0 machine.

Main results #

Stack Equality #

The stacks of PartrecToTM2.init c v equal those of TM2.init K'.main (trList v).

TrCfg for PartrecToTM2.init #

Chain Type Abbreviations #

@[reducible, inline]
Equations
Instances For
    Equations
    • One or more equations did not get rendered due to their size.

    Full Chain: Code → TM0 #

    Support Chain (for Fintype states) #

    The TM0 support set.

    Equations
    Instances For

      Full Chain with Fintype States #

      @[reducible, inline]

      The initial TM1 config for the chain.

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

        Generalized version of chainTM0_trCfg_eq_nc for arbitrary v : List. Works because the TM0 state depends only on the Code c (via the non-canonical Inhabited instance), not on the input list. The var component of init c v is always none : Option Γ'.

        Full chain: Code → TM0 with Fintype states.

        This is the strengthened version of code_to_tm0 that provides Fintype Λ. The key insight is to override the Inhabited PartrecToTM2.Λ' instance to ⟨trNormal c halt⟩ (matching tr_supports), then thread the non-canonical @[expose] public instance through the entire chain. The resulting TM0 machine is definitionally the same as ChainTM0 (since TM1to0.tr ignores Inhabited), but the support proof uses the non-canonical default.

        Generalized chain: Code → TM0 with Fintype states and multi-element input.

        Same as code_to_tm0_fintype but works for arbitrary v : List instead of just [n]. The machine and state space are identical — only the input encoding trInit K'.main (trList v) varies with the input list.