Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.TrackedRun

Polynomial-time runs of a fixed deterministic machine #

For a fixed deterministic machine tm with finitely many states, the configuration reached after t steps on an input w is computable in polynomial time in the length of w and the number t, written in unary (Turing.MultiTapeTM.computableInPolyTime_trackedRun). The configuration is stored as finite data (Turing.FiniteCfg), whose work tapes are kept relative to their heads, together with the absolute positions of the work heads; Turing.MultiTapeTM.trackedAgrees_trackedRun relates it to the native run tm.runFrom (tm.initCfg w) t.

The machine is a fixed parameter: one step is a finite case analysis on the state and the symbols read (Turing.MultiTapeTM.ComputableInPolyTime.finite_cases), followed by a fixed action, and the run iterates it with storage growing by at most one cell per step on each tape.

Main definitions #

Main results #

noncomputable def Turing.MultiTapeTM.trackedStep {k : ℕ} {State : Type} (tm : MultiTapeTM k Bool State) (c : FiniteCfg k Bool State × (Fin k → ℤ)) :
FiniteCfg k Bool State × (Fin k → ℤ)

One step of tm on finite storage, tracking the absolute positions of the work heads. A halted configuration is left unchanged.

noncomputable def Turing.MultiTapeTM.trackedRun {k : ℕ} {State : Type} (tm : MultiTapeTM k Bool State) (x : List Bool × ℕ) :
FiniteCfg k Bool State × (Fin k → ℤ)

The tracked run: x.2 steps of tm from the initial configuration on the input x.1, with all work heads starting at position 0.

structure Turing.MultiTapeTM.TrackedAgrees {k : ℕ} {State : Type} {w : List Bool} (c : FiniteCfg k Bool State × (Fin k → ℤ)) (cfg : Cfg k Bool State w) :

Finite storage c.1 with work-head positions c.2 describes the native configuration cfg on the input w: the stored input is w, the control, input head and output agree, the positions are the native ones, and each finite work tape reads the native tape relative to its head.

theorem Turing.MultiTapeTM.TrackedAgrees.inputSymbol {k : ℕ} {State : Type} {w : List Bool} {c : FiniteCfg k Bool State × (Fin k → ℤ)} {cfg : Cfg k Bool State w} (h : TrackedAgrees c cfg) :

Agreeing configurations read the same input symbol.

theorem Turing.MultiTapeTM.TrackedAgrees.workTapeSymbols {k : ℕ} {State : Type} {w : List Bool} {c : FiniteCfg k Bool State × (Fin k → ℤ)} {cfg : Cfg k Bool State w} (h : TrackedAgrees c cfg) :

Agreeing configurations read the same work-tape symbols.

theorem Turing.MultiTapeTM.TrackedAgrees.read_sub {k : ℕ} {State : Type} {w : List Bool} {c : FiniteCfg k Bool State × (Fin k → ℤ)} {cfg : Cfg k Bool State w} (h : TrackedAgrees c cfg) (i : Fin k) (z : ℤ) :
(c.1.workTapes i).read (z - c.2 i) = cfg.workTapes i z

A work tape of agreeing configurations, at an absolute position.

theorem Turing.MultiTapeTM.trackedAgrees_init {k : ℕ} {State : Type} (tm : MultiTapeTM k Bool State) (w : List Bool) :
TrackedAgrees (FiniteCfg.init tm.q₀ w, fun (x : Fin k) => 0) (tm.initCfg w)

The initial finite storage, with every work head at position 0, describes the initial native configuration.

theorem Turing.MultiTapeTM.TrackedAgrees.trackedStep {k : ℕ} {State : Type} {tm : MultiTapeTM k Bool State} {w : List Bool} {c : FiniteCfg k Bool State × (Fin k → ℤ)} {cfg : Cfg k Bool State w} (h : TrackedAgrees c cfg) :

One step preserves agreement.

theorem Turing.MultiTapeTM.trackedAgrees_trackedRun {k : ℕ} {State : Type} (tm : MultiTapeTM k Bool State) (w : List Bool) (t : ℕ) :

The tracked run describes the native run.

Polynomial time #

@[reducible, inline]
noncomputable abbrev Turing.MultiTapeTM.encTrackedCfg {k : ℕ} {State : Type} [Finite State] :
FiniteCfg k Bool State × (Fin k → ℤ) ↪ List Bool

The encoding of tracked storage: the finite configuration and the unary head positions.

One tracked step of a fixed machine is polynomial-time: a finite case analysis on the control and the symbols read selects a fixed action.

The tracked run of a fixed machine is polynomial-time in the input and the number of steps, written in unary.