Documentation

CslibFrontier.Languages.Probabilistic.Oracle.Simulation.Handler

A simulating handler as one simple oracle #

A reduction often answers its adversary's queries with a stateful handler that draws private coins and calls an outer oracle. Run against that oracle, the handler is a single stateful oracle on the joint state (Cslib.ProbOracleComp.runWith_run_interpret). When a simpler oracle, on a state that represents both the handler's state and the outer oracle's, answers each query as one call of the handler does, the whole run is the simple oracle's run with its final state represented.

Main results #

theorem Cslib.ProbOracleComp.runWith_run_interpret_map {Query Query' S₁ S₂ E₁ α : Type} {spec : Query → Type} {spec' : Query' → Type} (inner : (q : Query) → StateT S₂ (ProbOracleComp spec') (spec q)) (oOuter : (q : Query') → StateT E₁ PMF (spec' q)) (oSimple : (q : Query) → StateT S₁ PMF (spec q)) (rep₂ : S₁ → S₂) (repE : S₁ → E₁) (hstep : ∀ (q : Query) (s₁ : S₁), PMF.map (fun (p : spec q × S₁) => (p.1, rep₂ p.2, repE p.2)) (oSimple q s₁) = PMF.map (fun (x : (spec q × S₂) × E₁) => match x with | ((a, s₂), e) => (a, s₂, e)) (runWith oOuter ((inner q).run (rep₂ s₁)) (repE s₁))) (prog : ProbOracleComp spec α) (s₁ : S₁) :
runWith oOuter ((OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (sample (ProbComp.unifFin m))) inner) prog).run (rep₂ s₁)) (repE s₁) = PMF.map (fun (x : α × S₁) => match x with | (a, s') => ((a, rep₂ s'), repE s')) (runWith oSimple prog s₁)

A stateful handler that draws private coins and calls an outer oracle, run against that oracle, is a run of a simple oracle whose state s represents the handler's state rep₂ s and the outer oracle's state repE s, when each call of the simple oracle maps to one call of the handler.