Documentation

CslibFrontier.Computability.Complexity.Classes.Oracle.Deterministic

Deterministic machines behind polynomial time relative to an oracle #

A certificate of Cslib.Complexity.ComputableInPolyTimeWithOracle is a fair-coin machine that reproduces a deterministic program against every stateful oracle. Fixing all of its coins to false gives a deterministic run of the same machine, itself a word-query program (Turing.MultiTapePTM.run with the coin program pure false). Its result against every answer function is the program's (Cslib.Probability.IsOraclePPTOn.exists_run_pure_false): the coin-fixed run is one of the supported runs of the certificate, whose result is determined (Turing.MultiTapePTM.mem_support_runConfigFrom_pure). The same holds against every deterministic stateful oracle, for the result and the final state (Cslib.Probability.IsOraclePPTOn.exists_run_pure_false_stateM, from which the stateless form is derived), so the coin-fixed run makes the same requests as the program. The run makes at most one request per instruction (Turing.MultiTapeMachine.length_queriesWith_runConfigFrom_le).

Relabelling the finite control states to Fin m (Turing.MultiTapePTM.relabel, Turing.MultiTapePTM.runFrom_relabel) shows that the deterministic runs behind all certificates come from countably many machines with control Fin m (Cslib.Probability.IsOraclePPTOn.exists_fin_run_pure_false), as oracle diagonalizations need.

Main results #

References #

theorem Turing.MultiTapeMachine.length_queriesWith_runConfigFrom_le {k : ℕ} {Symbol State Oracle : Type} {input : List Symbol} {Choose : Type → Type} [DecidableEq Oracle] (machine : MultiTapeMachine k Symbol State Oracle Choose) (pick : Choose (Action k Symbol State Oracle) → Action k Symbol State Oracle) (answer : Oracle × List Symbol → List Symbol) (fuel : ℕ) (cfg : Config k Symbol State Oracle input) :
(Cslib.OracleComp.queriesWith answer (machine.runConfigFrom (fun (choices : Choose (Action k Symbol State Oracle)) => pure (pick choices)) (fun (oracle : Oracle) (word : List Symbol) => Cslib.OracleComp.query (oracle, word)) fuel cfg)).length ≤ fuel

A deterministic run makes at most one request per instruction, under every answer function.

theorem Cslib.Probability.IsOraclePPTOn.exists_run_pure_false_stateM {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → Complexity.WordQueryComp Operation β} (h : IsOraclePPTOn input output fun (a : α) => OracleComp.interpret ProbOracleComp.query (program a)) :
∃ (k : ℕ) (Control : Type) (_ : Finite Control) (machine : Turing.MultiTapePTM k Bool Control Operation) (c : ℕ) (d : ℕ), ∀ (a : α) (σ : Type) (step : Operation × List Bool → σ → List Bool × σ) (s : σ), StateT.run (OracleComp.interpret (fun (q : Operation × List Bool) => step q) (machine.run (pure false) (fun (op : Operation) (word : List Bool) => OracleComp.query (op, word)) (c * ((input a).length + 1) ^ d) (input a))) s = Prod.map (⇑output) id (StateT.run (OracleComp.interpret (fun (q : Operation × List Bool) => step q) (program a)) s)

Certificates are deterministic runs, against stateful oracles. A certificate for a deterministic program yields a finite machine and a polynomial clock whose run with every coin fixed to false returns, against every deterministic stateful oracle, the encoded result of the program and the same final state.

theorem Cslib.Probability.IsOraclePPTOn.exists_run_pure_false {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → Complexity.WordQueryComp Operation β} (h : IsOraclePPTOn input output fun (a : α) => OracleComp.interpret ProbOracleComp.query (program a)) :
∃ (k : ℕ) (Control : Type) (_ : Finite Control) (machine : Turing.MultiTapePTM k Bool Control Operation) (c : ℕ) (d : ℕ), ∀ (a : α) (answer : Operation × List Bool → List Bool), OracleComp.interpret answer (machine.run (pure false) (fun (op : Operation) (word : List Bool) => OracleComp.query (op, word)) (c * ((input a).length + 1) ^ d) (input a)) = output (OracleComp.interpret answer (program a))

Certificates are deterministic runs. A certificate for a deterministic program yields a finite machine and a polynomial clock whose run with every coin fixed to false returns, against every answer function, the encoded result of the program.

theorem Cslib.Probability.IsOraclePPTOn.exists_fin_run_pure_false {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → Complexity.WordQueryComp Operation β} (h : IsOraclePPTOn input output fun (a : α) => OracleComp.interpret ProbOracleComp.query (program a)) :
∃ (k : ℕ) (m : ℕ) (machine : Turing.MultiTapePTM k Bool (Fin m) Operation) (c : ℕ) (d : ℕ), ∀ (a : α) (answer : Operation × List Bool → List Bool), OracleComp.interpret answer (machine.run (pure false) (fun (op : Operation) (word : List Bool) => OracleComp.query (op, word)) (c * ((input a).length + 1) ^ d) (input a)) = output (OracleComp.interpret answer (program a))

Certificates are deterministic runs of countably many machines. As exists_run_pure_false, with control states Fin m.

theorem Cslib.Complexity.ComputableInPolyTimeWithOracle.polyBounded_length {α β : Type} {A : Set (List Bool)} {f : α → β} {input : α ↪ List Bool} {output : β ↪ List Bool} (hf : ComputableInPolyTimeWithOracle A f input output) :
Turing.MultiTapeTM.PolyBounded (fun (a : α) => (input a).length) fun (a : α) => (output (f a)).length

A deterministic polynomial-time oracle computation has polynomially bounded encoded output length. The bound follows from its strict machine certificate, not from an extra promise.