Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Probabilistic.IntervalCount.PolyTime

Interval counts in polynomial time #

The interval count on plain data (Turing.MultiTapePTM.localIntervalCount) is computable in polynomial time, as long as its 2 ^ b coin strings are polynomially many in the input. This is the machine-simulation part of the polynomial-time construction of the block-counting networks of #1833.

Finite storage (Turing.MultiTapePTM.LocalCfg) is encoded by Turing.MultiTapePTM.encLocalCfg: the control and output track by their ranks, the input position in unary, the work tapes with all their stored cells (Turing.MultiTapeTM.encBiTape), and the head positions in binary (Turing.MultiTapeTM.encIntBin).

Main definitions #

Main results #

Encoding finite storage #

Finite storage as the tuple of its fields.

noncomputable def Turing.MultiTapePTM.encLocalCfg {k : ℕ} {State : Type} [Finite State] :

The encoding of finite storage: the control and the output track by their ranks, the input position in unary, the work tapes with all their stored cells, and the head positions in binary.

Rules for finite storage #

One coin step #

Growth of a coin step #

Replays #

theorem Turing.MultiTapePTM.computableInPolyTime_localRun {k : ℕ} {State : Type} [Finite State] (machine : MultiTapePTM k Bool State) {α : Type} {enc : α ↪ List Bool} {input coins : α → List Bool} {start : α → LocalCfg k State} (hinput : MultiTapeTM.ComputableInPolyTime input enc MultiTapeTM.encBits) (hcoins : MultiTapeTM.ComputableInPolyTime coins enc MultiTapeTM.encBits) (hstart : MultiTapeTM.ComputableInPolyTime start enc encLocalCfg) :
MultiTapeTM.ComputableInPolyTime (fun (a : α) => machine.localRun (input a) (coins a) (start a)) enc encLocalCfg

Replays are polynomial-time: replaying computed coins from computed finite storage, on a computed input.

Tapes of windows, reads and head coordinates #

The interval count #

structure Turing.MultiTapePTM.IntervalData (k : ℕ) (State : Type) :

The arguments of an interval count on plain data.

The arguments of an interval count as a tuple.

noncomputable def Turing.MultiTapePTM.encControlData {k : ℕ} {State : Type} [Finite State] :

The encoding of a control record on plain data: the state and the track by their ranks, and the offsets in unary.

noncomputable def Turing.MultiTapePTM.encIntervalData {k : ℕ} {State : Type} [Finite State] :

The encoding of the arguments of an interval count: the input, the block length in unary, the block indices in binary, the movements by their ranks, and the records and window cells.

def Turing.MultiTapePTM.IntervalData.count {k : ℕ} {State : Type} [DecidableEq State] (machine : MultiTapePTM k Bool State) (d : IntervalData k State) :

The interval count of its arguments.

Assemble a control record on plain data from its certified components.

theorem Turing.MultiTapePTM.IntervalData.computableInPolyTime_mk {k : ℕ} {State : Type} [Finite State] {α : Type} {input : α ↪ List Bool} {word : α → List Bool} {b : α → ℕ} {J : α → Option (Fin k) → ℤ} {δ : α → Option (Fin k) → SignType} {cIn cOut : α → ControlData k State} {wIn wOut : α → Fin k → List (Option Bool)} (hword : MultiTapeTM.ComputableInPolyTime word input MultiTapeTM.encBits) (hb : MultiTapeTM.ComputableInPolyTime b input MultiTapeTM.encUnary) (hJ : MultiTapeTM.ComputableInPolyTime J input (MultiTapeTM.encPi MultiTapeTM.encIntBin)) (hδ : MultiTapeTM.ComputableInPolyTime δ input (MultiTapeTM.encFinite (Option (Fin k) → SignType))) (hcIn : MultiTapeTM.ComputableInPolyTime cIn input encControlData) (hwIn : MultiTapeTM.ComputableInPolyTime wIn input (MultiTapeTM.encPi (MultiTapeTM.encList (MultiTapeTM.encOption MultiTapeTM.encBool)))) (hcOut : MultiTapeTM.ComputableInPolyTime cOut input encControlData) (hwOut : MultiTapeTM.ComputableInPolyTime wOut input (MultiTapeTM.encPi (MultiTapeTM.encList (MultiTapeTM.encOption MultiTapeTM.encBool)))) :
MultiTapeTM.ComputableInPolyTime (fun (a : α) => { input := word a, b := b a, J := J a, δ := δ a, cIn := cIn a, wIn := wIn a, cOut := cOut a, wOut := wOut a }) input encIntervalData

Assemble the arguments of an interval count from their certified components.

theorem Turing.MultiTapePTM.computableInPolyTime_localIntervalCount {k : ℕ} {State : Type} [Finite State] {α : Type} {input : α ↪ List Bool} [DecidableEq State] (machine : MultiTapePTM k Bool State) {d : α → IntervalData k State} (hd : MultiTapeTM.ComputableInPolyTime d input encIntervalData) {size : ℕ → ℕ} (hsize : Cslib.PolynomiallyBounded size) (hbudget : ∀ (a : α), 2 ^ (d a).b * (2 * (d a).b + 1) ≤ size (input a).length) :

Interval counts are polynomial-time in their computed arguments, provided that the 2 ^ b coin strings, with their encodings, are polynomially many in the input: the count enumerates them and replays each on the finite storage of the embedded window.