Documentation

CslibFrontier.Computability.Probabilistic.Oracle.RunState

Efficient stateful oracle runs #

An oracle-PPT word program run against an efficient stateful oracle is PPT, with the final oracle state returned. The statements use ProbOracleComp.runState: the run is (program.runState (oracle caller)).run (initial caller). They are IsOraclePPTOn.run_interpret_preprocess and IsOraclePPT.run_interpret_preprocess stated on runState, with the same resource allowance: a local invariant of the oracle state bounds each reply and the encoded state added by each call. Each is derived from the corresponding theorem, whose conclusion is definitionally the same run. State a run as (P.runState O).run s and certify it here; run_interpret_preprocess remains for runs still written with OracleComp.interpret and OracleComp.sumHandler.

Main results #

theorem Cslib.Probability.IsOraclePPTOn.isPPTOn_runState {Operation α β Caller State : Type} [DecidableEq Operation] {source : α ↪ List Bool} {input : Caller ↪ List Bool} {output : β ↪ List Bool} {operationEncoding : Operation ↪ List Bool} {stateEncoding : State ↪ List Bool} {program : α → WordOracleComp Operation β} {oracle : Caller → Operation × List Bool → StateT State ProbComp (List Bool)} {prepare : Caller → α} {initial : Caller → State} {resources : Caller → List Bool → ℕ} (hprogram : IsOraclePPTOn source output program) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime prepare input source) (horacle : IsPPTOn (encHandlerCall input operationEncoding stateEncoding) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits stateEncoding) fun (x : Caller × (Operation × List Bool) × State) => match x with | (caller, request, state) => oracle caller request state) (hinitial : Turing.MultiTapeTM.ComputableInPolyTime initial input stateEncoding) (invariant : Caller → State → Prop) (hinit : ∀ (a : Caller), invariant a (initial a)) (hresources : Turing.MultiTapeTM.ComputableInPolyTime (fun (pair : Caller × List Bool) => resources pair.1 pair.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hpreserve : ∀ (a : Caller) (request : Operation × List Bool) (state : State), invariant a state → ∀ result ∈ (oracle a request state).eval.support, invariant a result.2 ∧ result.1.length ≤ resources a request.2 ∧ (stateEncoding result.2).length ≤ (stateEncoding state).length + resources a request.2) :
IsPPTOn input (Turing.MultiTapeTM.encPair output stateEncoding) fun (a : Caller) => (ProbOracleComp.runState (program (prepare a)) (oracle a)).run (initial a)

Running an oracle-PPT program against an efficient stateful oracle is PPT in the caller, with the final oracle state returned. prepare computes the program's input from the caller and initial the oracle's initial state. On every supported call from a state satisfying invariant, the oracle keeps the invariant, and the reply and the encoded state it adds are bounded by the computed allowance resources caller request.

theorem Cslib.Probability.IsOraclePPT.isPPTOn_runState {Operation β Caller State : Type} [DecidableEq Operation] {input : Caller ↪ List Bool} {output : β ↪ List Bool} {operationEncoding : Operation ↪ List Bool} {stateEncoding : State ↪ List Bool} {program : ℕ → List Bool → WordOracleComp Operation β} {oracle : Caller → Operation × List Bool → StateT State ProbComp (List Bool)} {prepare : Caller → ℕ × List Bool} {initial : Caller → State} {resources : Caller → List Bool → ℕ} (hprogram : IsOraclePPT output program) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime prepare input (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits)) (horacle : IsPPTOn (encHandlerCall input operationEncoding stateEncoding) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits stateEncoding) fun (x : Caller × (Operation × List Bool) × State) => match x with | (caller, request, state) => oracle caller request state) (hinitial : Turing.MultiTapeTM.ComputableInPolyTime initial input stateEncoding) (invariant : Caller → State → Prop) (hinit : ∀ (a : Caller), invariant a (initial a)) (hresources : Turing.MultiTapeTM.ComputableInPolyTime (fun (pair : Caller × List Bool) => resources pair.1 pair.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hpreserve : ∀ (a : Caller) (request : Operation × List Bool) (state : State), invariant a state → ∀ result ∈ (oracle a request state).eval.support, invariant a result.2 ∧ result.1.length ≤ resources a request.2 ∧ (stateEncoding result.2).length ≤ (stateEncoding state).length + resources a request.2) :
IsPPTOn input (Turing.MultiTapeTM.encPair output stateEncoding) fun (a : Caller) => (ProbOracleComp.runState (program (prepare a).1 (prepare a).2) (oracle a)).run (initial a)

Running a parameterized oracle-PPT program against an efficient stateful oracle is PPT in the caller, with the final oracle state returned. prepare computes the security parameter and word from the caller, and initial the oracle's initial state, both in polynomial time; the oracle condition is that of IsOraclePPTOn.isPPTOn_runState.