Documentation

CslibFrontier.Computability.Probabilistic.Internal.Oracle.AuxClock

Internal primary-input clock and auxiliary-prefix machines #

The public auxiliary-clock contracts are defined in PPT.AuxClock.Basic; this module keeps primary-input-only budget construction, prefix truncation and exact joint-state proofs together.

theorem Cslib.Probability.IsOraclePPTWithAux.isOraclePPTOn {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → WordOracleComp Operation β} (h : IsOraclePPTWithAux input output program) :
IsOraclePPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a z

Every IsOraclePPTWithAux program is a standard IsOraclePPTOn program on encPair input encBits: the machine recovers (input a).length by unframing the self-delimiting first component frame (input a) without reading z.

theorem Cslib.Probability.IsPPTWithAux.isOraclePPTWithAux {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → ProbComp β} [Finite Operation] (h : IsPPTWithAux input output program) :
IsOraclePPTWithAux input output fun (a : α) (z : List Bool) => ProbOracleComp.sample (program a z)

Closed IsPPTWithAux programs lift to IsOraclePPTWithAux with no external operations.

theorem Cslib.Probability.IsPPTWithAux.isPPTOn {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → ProbComp β} (h : IsPPTWithAux input output program) :
IsPPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a z

Every IsPPTWithAux program is a standard IsPPTOn program on encPair input encBits.

Truncating the auxiliary input word z to a polynomial in the primary input length (input a).length is computable in plain polynomial time on encPair input encBits.

theorem Cslib.Probability.IsPPTOn.take_aux {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → ProbComp β} (h : IsPPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a z) (c d : ℕ) :
IsPPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a (List.take (c * ((input a).length + 1) ^ d) z)

Truncating the auxiliary input of a standard IsPPTOn program to a polynomial in the primary input length preserves IsPPTOn.

theorem Cslib.Probability.IsOraclePPTOn.take_aux {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → WordOracleComp Operation β} (h : IsOraclePPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a z) (c d : ℕ) :
IsOraclePPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a (List.take (c * ((input a).length + 1) ^ d) z)

Truncating the auxiliary input of a standard IsOraclePPTOn program to a polynomial in the primary input length preserves IsOraclePPTOn.

Upgrading prefix-truncated IsOraclePPTOn / IsPPTOn programs to #

IsOraclePPTWithAux / IsPPTWithAux

theorem Cslib.Probability.IsOraclePPTOn.isOraclePPTWithAux_take {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → WordOracleComp Operation β} (h : IsOraclePPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a z) (c d : ℕ) :
IsOraclePPTWithAux input output fun (a : α) (z : List Bool) => program a (List.take (c * ((input a).length + 1) ^ d) z)

Upgrading prefix-truncated IsOraclePPTOn to IsOraclePPTWithAux. If program is a standard IsOraclePPTOn program on encPair input encBits, then truncating its auxiliary input word z to a polynomial c * ((input a).length + 1) ^ d in the primary input length (input a).length yields an IsOraclePPTWithAux program clocked in a alone.

theorem Cslib.Probability.IsPPTOn.isPPTWithAux_take {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → ProbComp β} (h : IsPPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) output fun (x : α × List Bool) => match x with | (a, z) => program a z) (c d : ℕ) :
IsPPTWithAux input output fun (a : α) (z : List Bool) => program a (List.take (c * ((input a).length + 1) ^ d) z)

Upgrading prefix-truncated IsPPTOn to IsPPTWithAux. If program is a standard IsPPTOn program on encPair input encBits, then truncating its auxiliary input word z to a polynomial c * ((input a).length + 1) ^ d in (input a).length yields an IsPPTWithAux program clocked in a alone.

theorem Cslib.Probability.IsPPTWithAux.length_le {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → ProbComp β} (h : IsPPTWithAux input output program) :
∃ (c : ℕ) (d : ℕ), ∀ (a : α) (z : List Bool), ∀ result ∈ (program a z).eval.support, (output result).length ≤ c * ((input a).length + 1) ^ d

Every supported encoded output of an IsPPTWithAux program has length bounded by a polynomial in the primary input length (input a).length, uniformly over all auxiliary inputs z.

theorem Cslib.Probability.IsOraclePPTWithAux.length_le {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → WordOracleComp Operation β} (h : IsOraclePPTWithAux input output program) :
∃ (c : ℕ) (d : ℕ), ∀ (a : α) (z : List Bool) (State : Type) (oracle : Operation × List Bool → StateT State PMF (List Bool)) (s s' : State) (result : β), (result, s') ∈ (ProbOracleComp.runWith oracle (program a z) s).support → (output result).length ≤ c * ((input a).length + 1) ^ d

Every supported encoded output of an IsOraclePPTWithAux program has length bounded by a polynomial in (input a).length, uniformly over all auxiliary inputs z and all oracle replies.

theorem Cslib.Probability.IsPPTWithAux.exists_eval_take {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → ProbComp β} (h : IsPPTWithAux input output program) :
∃ (c : ℕ) (d : ℕ), ∀ (a : α) (z : List Bool) {m : ℕ}, c * ((input a).length + 1) ^ d ≤ m → (program a (List.take m z)).eval = (program a z).eval

Prefix truncation for IsPPTWithAux. A closed program clocked in a produces the exact same output distribution on (a, z.take m) as on (a, z) whenever m is at least its polynomial clock c * ((input a).length + 1) ^ d.

theorem Cslib.Probability.IsOraclePPTWithAux.exists_run_interpret_take {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {output : β ↪ List Bool} {program : α → List Bool → WordOracleComp Operation β} (h : IsOraclePPTWithAux input output program) :
∃ (c : ℕ) (d : ℕ), ∀ (a : α) (z : List Bool) {m : ℕ}, c * ((input a).length + 1) ^ d ≤ m → ∀ (State : Type) (oracle : Operation × List Bool → StateT State PMF (List Bool)) (s : State), ProbOracleComp.runWith oracle (program a (List.take m z)) s = ProbOracleComp.runWith oracle (program a z) s

Prefix truncation for IsOraclePPTWithAux. An oracle program clocked in a produces the exact same joint distribution of (result, finalState) on (a, z.take m) as on (a, z) under every stateful oracle handler whenever m ≥ c * ((input a).length + 1) ^ d.

theorem Cslib.Probability.IsPPTWithAux.preprocess {α β : Type} {input : α ↪ List Bool} {γ : Type} {middle : β ↪ List Bool} {out : γ ↪ List Bool} {program : β → List Bool → ProbComp γ} {prepare : α → β} (h : IsPPTWithAux middle out program) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime prepare input middle) :
IsPPTWithAux input out fun (a : α) (z : List Bool) => program (prepare a) z

Polynomial-time deterministic preprocessing of the primary input preserves IsPPTWithAux.

theorem Cslib.Probability.IsOraclePPTWithAux.preprocess {Operation α β : Type} [DecidableEq Operation] {input : α ↪ List Bool} {γ : Type} {middle : β ↪ List Bool} {out : γ ↪ List Bool} {program : β → List Bool → WordOracleComp Operation γ} {prepare : α → β} (h : IsOraclePPTWithAux middle out program) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime prepare input middle) :
IsOraclePPTWithAux input out fun (a : α) (z : List Bool) => program (prepare a) z

Polynomial-time deterministic preprocessing of the primary input preserves IsOraclePPTWithAux.