Documentation

Complexitylib.Models.TuringMachine.UTM.Internal.ClockFrontier

Frontier-parked clock machines for the time-bounded universal machine #

Frontier variants of decClockTM / zeroTestTM (see Clock.lean): to make each clock tick O(1), the clock head stays parked at the frontier (the last unary mark) between ticks, rather than rewinding to cell 1.

Frontier representation: clock value v ⟺ tape-6 (clkT) cells are regCells v and the head is at max v 1. At v = 0 the head sits at cell 1 reading ; at v ≥ 1 it sits at cell v reading 1.

Two TM 7 machines, both with ghost-initial-tapes HoareTime specs:

@[implicit_reducible]
Equations
  • One or more equations did not get rendered due to their size.

Frontier decrement: with the clock head parked at the frontier (max v 1), reading 1 (v ≥ 1) blanks the mark and moves left; the settle step then either steps right off (was at cell 1, v = 1 → 0) or stays on the new frontier mark (v ≥ 2). Reading (v = 0) halts immediately — decrement of zero is a no-op. All other tapes idle throughout.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem Complexity.TM.decFrontierTM_hoareTime (v : ) (inp₀ : Tape) (work₀ : Fin 7Tape) (out₀ : Tape) (hclk : (work₀ clkT).cells = regCells v) (hclkh : (work₀ clkT).head = max v 1) (hinp : inp₀.read Γ.start) (hwork : ∀ (i : Fin 7), i clkT(work₀ i).read Γ.start) (hout : out₀.read Γ.start) :
    decFrontierTM.HoareTime (fun (inp : Tape) (work : Fin 7Tape) (out : Tape) => inp = inp₀ work = work₀ out = out₀) (fun (inp : Tape) (work : Fin 7Tape) (out : Tape) => inp = inp₀ (∀ (i : Fin 7), i clkTwork i = work₀ i) (work clkT).cells = regCells (v - 1) (work clkT).head = max (v - 1) 1 out = out₀) 3

    decFrontierTM specification (ghost-initial-tapes style). Starting from qstart with the clock tape (clkT = work tape 6) holding regCells v with its head parked at the frontier (max v 1), and every other tape parked on a non- symbol, decFrontierTM halts within 3 steps having decremented the clock to regCells (v - 1) with the head parked at the new frontier (max (v - 1) 1); the input tape, the output tape, and every other work tape are preserved exactly. The zero clock is left unchanged (0 - 1 = 0).

    Control states of orZeroTM.

    Instances For
      @[implicit_reducible]
      Equations

      Combined loop-exit test: read output cell 1 (the halt-test verdict, head parked at 1) and the frontier-parked clock tape; overwrite output cell 1 with 1 if the verdict is 1 or the clock reads (i.e. is zero), else 0, keeping the output head at cell 1; then halt. Every work tape and the input tape idle.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem Complexity.TM.orZeroTM_hoareTime (v : ) (verdict : Γ) (inp₀ : Tape) (work₀ : Fin 7Tape) (out₀ : Tape) (hclk : (work₀ clkT).cells = regCells v) (hclkh : (work₀ clkT).head = max v 1) (hverd : out₀.cells 1 = verdict) (hverdns : verdict Γ.start) (houth : out₀.head = 1) (hout0 : out₀.cells 0 = Γ.start) (hinp : inp₀.read Γ.start) (hwork : ∀ (i : Fin 7), i clkT(work₀ i).read Γ.start) :
        orZeroTM.HoareTime (fun (inp : Tape) (work : Fin 7Tape) (out : Tape) => inp = inp₀ work = work₀ out = out₀) (fun (inp : Tape) (work : Fin 7Tape) (out : Tape) => inp = inp₀ work = work₀ out.cells = Function.update out₀.cells 1 (if verdict = Γ.one v = 0 then Γ.one else Γ.zero) out.head = 1) 2

        orZeroTM specification (ghost-initial-tapes style). Starting from qstart with the clock tape (clkT = work tape 6) holding regCells v with its head parked at the frontier (max v 1), the output head resting at cell 1 on the halt-test verdict (a non- symbol), and every other tape parked on a non- symbol, orZeroTM halts within 2 steps having

        • written the combined loop-exit verdict at output cell 1: Γ.one iff verdict = Γ.one ∨ v = 0, else Γ.zero (all other output cells unchanged, head still at cell 1);
        • left the input tape and every work tape exactly unchanged.