Documentation

CslibFrontier.Languages.Probabilistic.Simulation.CloseTo

Approximate stateful oracle simulation #

OracleComp.run_interpret_simulation lifts an exact local simulation, relating each call of one stateful oracle to a call of another through a probabilistic change of state, to every adaptive program. This module lifts an approximate local simulation in the same way: when each call q commutes with the change of state up to statistical distance cost q * ε, a program whose calls cost at most d in total commutes with it up to d * ε.

The typical use is a lazy-to-eager hop in which one kind of call is answered from partial information (a cache) on the lazy side and from the completed table on the eager side, so that the two disagree on an event of small probability; calls of other kinds cost nothing.

Main results #

theorem Cslib.OracleComp.closeTo_run_interpret_simulation {ι State State' α : Type} {spec : OracleSpec ι} (cost : ι → ℕ) (oracle : (q : ι) → StateT State PMF (spec q)) (oracle' : (q : ι) → StateT State' PMF (spec q)) (relate : State → PMF State') (ε : ENNReal) (step : ∀ (q : ι) (s : State), Probability.CloseTo ((oracle q s).bind fun (x : spec q × State) => PMF.map (fun (x_1 : State') => (x.1, x_1)) (relate x.2)) ((relate s).bind (oracle' q)) (↑(cost q) * ε)) (prog : OracleComp spec α) {d : ℕ} (hd : IsCostBounded cost prog d) (s : State) :
Probability.CloseTo (((interpret oracle prog).run s).bind fun (x : α × State) => PMF.map (fun (x_1 : State') => (x.1, x_1)) (relate x.2)) ((relate s).bind fun (t : State') => (interpret oracle' prog).run t) (↑d * ε)

Approximate stateful simulation. If each call q of oracle commutes with the change of state relate up to statistical distance cost q * ε, then running any program prog with IsCostBounded cost prog d commutes with relate up to statistical distance d * ε.

theorem Cslib.OracleComp.closeTo_run_interpret_simulation_readOnly {ι State State' α : Type} {spec : OracleSpec ι} (cost : ι → ℕ) (oracle : (q : ι) → StateT State PMF (spec q)) (oracle' : State' → (q : ι) → PMF (spec q)) (relate : State → PMF State') (ε : ENNReal) (step : ∀ (q : ι) (s : State), Probability.CloseTo ((oracle q s).bind fun (x : spec q × State) => PMF.map (fun (x_1 : State') => (x.1, x_1)) (relate x.2)) ((relate s).bind fun (t : State') => PMF.map (fun (x : spec q) => (x, t)) (oracle' t q)) (↑(cost q) * ε)) (prog : OracleComp spec α) {d : ℕ} (hd : IsCostBounded cost prog d) (s : State) :
Probability.CloseTo (PMF.map Prod.fst ((interpret oracle prog).run s)) ((relate s).bind fun (t : State') => interpret (oracle' t) prog) (↑d * ε)

Approximate simulation by a read-only oracle. If each call q of oracle commutes up to statistical distance cost q * ε with answering it by oracle' t q from a state t ← relate s that the call leaves unchanged, then the result of running any program prog with IsCostBounded cost prog d is within d * ε of sampling t ← relate s and interpreting prog against oracle' t.