Documentation

CslibFrontier.Languages.Probabilistic.Oracle.QueryBoundedSimulation

Simulating query-bounded programs #

A program with private coins runs against a real stateful oracle or against an ideal oracle that depends on a hidden sample. The two are linked by a law exp s of the hidden sample given the real oracle state and by a representation rep s of that state. When each external query keeps the link, the whole program keeps it, retaining its result and the final oracle state.

The local link need only hold on states satisfying an invariant indexed by the remaining query budget. Each query may use one unit of the budget, as when the invariant reserves room in a bounded cache for every query still to come. Private samples use none.

Main results #

theorem Cslib.ProbOracleComp.IsQueryBounded.run_interpret_bind_comm_of_invariant {Query α : Type} {spec : Query → Type} {σ₁ σ₂ γ : Type} (h₁ : (q : Query) → StateT σ₁ PMF (spec q)) (h₂ : γ → (q : Query) → StateT σ₂ PMF (spec q)) (exp : σ₁ → PMF γ) (rep : σ₁ → σ₂) (inv : ℕ → σ₁ → Prop) (hweaken : ∀ (r : ℕ) (s : σ₁), inv (r + 1) s → inv r s) (hstep : ∀ (rem : ℕ) (q : Query) (s : σ₁), inv (rem + 1) s → (((h₁ q s).bind fun (x : spec q × σ₁) => PMF.map (fun (k : γ) => (k, x.1, rep x.2)) (exp x.2)) = (exp s).bind fun (k : γ) => PMF.map (fun (y : spec q × σ₂) => (k, y.1, y.2)) (h₂ k q (rep s))) ∧ ∀ (ans : spec q) (s' : σ₁), (ans, s') ∈ (h₁ q s).support → inv rem s') {program : ProbOracleComp spec α} {rem : ℕ} (hq : program.IsQueryBounded rem) {s : σ₁} (hinv : inv rem s) :
((((OracleComp.interpret (OracleComp.sumHandler (fun (n : ℕ) => StateT.lift (ProbComp.unifOracle n)) h₁) program).run s).bind fun (x : α × σ₁) => PMF.map (fun (k : γ) => (k, x.1, rep x.2)) (exp x.2)) = (exp s).bind fun (k : γ) => PMF.map (fun (y : α × σ₂) => (k, y.1, y.2)) ((OracleComp.interpret (OracleComp.sumHandler (fun (n : ℕ) => StateT.lift (ProbComp.unifOracle n)) (h₂ k)) program).run (rep s))) ∧ ∀ (res : α) (s' : σ₁), (res, s') ∈ ((OracleComp.interpret (OracleComp.sumHandler (fun (n : ℕ) => StateT.lift (ProbComp.unifOracle n)) h₁) program).run s).support → inv 0 s'

A query-bounded program keeps the link (exp s).map (·, a, rep s) between the real run and an ideal run on a hidden sample, when every external query keeps it on states satisfying the invariant inv (rem + 1) and leads to states satisfying inv rem. Private samples are fresh in both runs.

theorem Cslib.ProbOracleComp.IsQueryBounded.run_interpret_invariant {Query α : Type} {spec : Query → Type} {σ : Type} (h : (q : Query) → StateT σ PMF (spec q)) (inv : ℕ → σ → Prop) (hweaken : ∀ (r : ℕ) (s : σ), inv (r + 1) s → inv r s) (hstep : ∀ (rem : ℕ) (q : Query) (s : σ), inv (rem + 1) s → ∀ (ans : spec q) (s' : σ), (ans, s') ∈ (h q s).support → inv rem s') {program : ProbOracleComp spec α} {rem : ℕ} (hq : program.IsQueryBounded rem) {s : σ} (hinv : inv rem s) (res : α) (s' : σ) :
(res, s') ∈ ((OracleComp.interpret (OracleComp.sumHandler (fun (n : ℕ) => StateT.lift (ProbComp.unifOracle n)) h) program).run s).support → inv 0 s'

A budget-indexed invariant holds after a query-bounded program when every external query from a state satisfying inv (rem + 1) leads to states satisfying inv rem. Private samples leave the state unchanged.