Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.PolyTime.Configuration

Polynomial-time finite configuration operations #

Ordinary and oracle structure construction, observations, fixed native actions, channel replies and initialization are certified in plain polynomial time (Turing.MultiTapeTM.ComputableInPolyTime), by composition of pair, list, table and tape rules. Copying the input, work tapes, accumulated output and every channel is charged by their encodings. Tidy forms of the observations and oracle transitions, derived from the plain rules, remain for the tidy proofs that still use them.

Main results #

References #

Adapts Computability/Probabilistic/Configuration.lean on the cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8 to plain polynomial time.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteCfg_mk {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {word : α → List Bool} {state : α → Option State} {position : (a : α) → Fin ((word a).length + 2)} {work : α → Fin k → Cslib.Turing.BiTape Bool} {output : α → List Bool} (hword : ComputableInPolyTime word input encBits) (hstate : ComputableInPolyTime state input (encFinite (Option State))) (hposition : ComputableInPolyTime (fun (a : α) => ↑(position a)) input encUnary) (hwork : ComputableInPolyTime work input (encPi (encBiTape encBool))) (houtput : ComputableInPolyTime output input encBits) :
ComputableInPolyTime (fun (a : α) => { input := word a, state := state a, inputPos := position a, workTapes := work a, output := output a }) input encFiniteCfg

Assemble an ordinary configuration from its certified components.

Read the input head's unary position.

Observe the read-only input, including both blank boundary cells.

theorem Turing.MultiTapeTM.ComputableInPolyTime.moveInputPos {α : Type} {input : α ↪ List Bool} {word : α → List Bool} {position : (a : α) → Fin ((word a).length + 2)} (hword : ComputableInPolyTime word input encBits) (hposition : ComputableInPolyTime (fun (a : α) => ↑(position a)) input encUnary) (move : SignType) :
ComputableInPolyTime (fun (a : α) => ↑(Turing.moveInputPos (position a) move)) input encUnary

Clamped native input-head movement is efficient on the stored unary position.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteCfg_step {k : ℕ} {State : Type} [Finite State] (action : Action k Bool State) :
ComputableInPolyTime (fun (cfg : FiniteCfg k Bool State) => cfg.step action) encFiniteCfg encFiniteCfg

Execute a fixed ordinary native action, including all retained storage.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteCfg_init {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {word : α → List Bool} (hword : ComputableInPolyTime word input encBits) (state : State) :
ComputableInPolyTime (fun (a : α) => FiniteCfg.init state (word a)) input encFiniteCfg

Initialize with the native input-head convention and blank work tapes.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteConfig_mk {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {Oracle : Type} [Fintype Oracle] {tapes : α → FiniteCfg k Bool State} {channels : α → Oracle → List Bool × Cslib.Turing.BiTape Bool} (htapes : ComputableInPolyTime tapes input encFiniteCfg) (hchannels : ComputableInPolyTime channels input encChannels) :
ComputableInPolyTime (fun (a : α) => { tapes := tapes a, channels := channels a }) input encFiniteConfig

Assemble ordinary storage and its family of oracle channels.

Observe every answer head as a single fixed finite value.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteConfig_step {k : ℕ} {State : Type} [Finite State] {Oracle : Type} [Fintype Oracle] (action : Action k Bool State) (symbol : Oracle → Option Bool) (move : Oracle → SignType) :
ComputableInPolyTime (fun (cfg : MultiTapeMachine.FiniteConfig k Bool State Oracle) => cfg.step action symbol move) encFiniteConfig encFiniteConfig

Execute a fixed local action, including all pending requests and stored answers.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteConfig_receive {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {Oracle : Type} [Fintype Oracle] [DecidableEq Oracle] {cfg : α → MultiTapeMachine.FiniteConfig k Bool State Oracle} {answer : α → List Bool} (hcfg : ComputableInPolyTime cfg input encFiniteConfig) (hanswer : ComputableInPolyTime answer input encBits) (channel : Oracle) (next : State) :
ComputableInPolyTime (fun (a : α) => (cfg a).receive channel next (answer a)) input encFiniteConfig

Install a computed reply, clear its selected request and retain all other channels.

theorem Turing.MultiTapeTM.ComputableInPolyTime.finiteConfig_init {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {Oracle : Type} [Fintype Oracle] {word : α → List Bool} (hword : ComputableInPolyTime word input encBits) (state : State) :

Initialize every channel with an empty request and blank answer tape.

Observe the read-only input, including both blank boundary cells.

theorem Turing.MultiTapeTM.ComputableTidilyInPolyTime.finiteConfig_step {k : ℕ} {State : Type} [Finite State] {Oracle : Type} [Fintype Oracle] (action : Action k Bool State) (symbol : Oracle → Option Bool) (move : Oracle → SignType) :

Execute a fixed local action, including all pending requests and stored answers.

theorem Turing.MultiTapeTM.ComputableTidilyInPolyTime.finiteConfig_receive {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {Oracle : Type} [Fintype Oracle] [DecidableEq Oracle] {cfg : α → MultiTapeMachine.FiniteConfig k Bool State Oracle} {answer : α → List Bool} (hcfg : ComputableTidilyInPolyTime cfg input encFiniteConfig) (hanswer : ComputableTidilyInPolyTime answer input encBits) (channel : Oracle) (next : State) :
ComputableTidilyInPolyTime (fun (a : α) => (cfg a).receive channel next (answer a)) input encFiniteConfig

Install a computed reply, clear its selected request and retain all other channels.

theorem Turing.MultiTapeTM.ComputableTidilyInPolyTime.finiteConfig_init {k : ℕ} {State α : Type} [Finite State] {input : α ↪ List Bool} {Oracle : Type} [Fintype Oracle] {word : α → List Bool} (hword : ComputableTidilyInPolyTime word input encBits) (state : State) :

Initialize every channel with an empty request and blank answer tape.