Documentation

LeanPool.BeyondBethe.Complexitylib.Models.TuringMachine.Combinators.Helpers

Tape actions shared by Turing-machine combinators #

Idle and leftward directions respect the start marker. Read-back writes preserve off-start tape contents, providing the transition invariants used by combinators.

Direction for an idle tape: move right if reading ▷, else stay. Satisfies δ_right_of_start for tapes not involved in the current phase.

Equations
Instances For

    Direction for a tape we want to move left: move left unless reading ▷, in which case move right to satisfy δ_right_of_start. During actual execution the tape won't be at cell 0, so this always moves left.

    Equations
    Instances For

      idleDir moves right when reading the start symbol ▷.

      If the head reads ▷, then idleDir moves right — the shape of the δ_right_of_start obligation for idle tapes.

      If the head reads ▷, then moveLeftDir moves right — the shape of the δ_right_of_start obligation for tapes being rewound.

      readBackWrite recovers the original symbol away from the left-end marker.

      Writing back the symbol under an off-start head is a no-op.

      Writing back the symbol under an off-start head and moving is just the move.

      def Complexity.TM.allIdle {σ : Type} {k : ℕ} (newState : σ) (iHead : Γ) (wHeads : Fin k → Γ) (oHead : Γ) :
      σ × (Fin k → Γw) × Γw × Dir3 × (Fin k → Dir3) × Dir3

      The "do nothing" transition output: all writes are □, all directions are idleDir. Used for states that only change the control state.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Complexity.TM.allReadBack {σ : Type} {k : ℕ} (newState : σ) (iHead : Γ) (wHeads : Fin k → Γ) (oHead : Γ) :
        σ × (Fin k → Γw) × Γw × Dir3 × (Fin k → Dir3) × Dir3

        The content-preserving driver action: write every currently read work and output symbol back, and use idleDir on every tape. Every off-start tape is preserved exactly; a head on ▷ takes the structurally mandatory move right.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Complexity.TM.rightOfStart_allIdle {k : ℕ} (iHead : Γ) (wHeads : Fin k → Γ) (oHead : Γ) :
          (iHead = Γ.start → idleDir iHead = Dir3.right) ∧ (∀ (i : Fin k), wHeads i = Γ.start → idleDir (wHeads i) = Dir3.right) ∧ (oHead = Γ.start → idleDir oHead = Dir3.right)

          Proof that all-idle directions satisfy δ_right_of_start.

          theorem Complexity.TM.rightOfStart_allReadBack {k : ℕ} (iHead : Γ) (wHeads : Fin k → Γ) (oHead : Γ) :
          (iHead = Γ.start → idleDir iHead = Dir3.right) ∧ (∀ (i : Fin k), wHeads i = Γ.start → idleDir (wHeads i) = Dir3.right) ∧ (oHead = Γ.start → idleDir oHead = Dir3.right)

          allReadBack satisfies the one-sided-tape direction invariant.