Documentation

CslibFrontier.Languages.Probabilistic.Oracle.Substitution.RunWith

Stateful runs of substituted programs #

Running ProbOracleComp.simulate handler A against a stateful oracle is a stateful run of A itself, in which each external query q is answered by running handler q against that oracle from the current state. This lets a reduction built with simulate be analysed through runWith, for example with an identical-until-bad bound, without unfolding the substitution.

Main results #

theorem Cslib.ProbOracleComp.runWith_simulate {Query : Type u} {Query' : Type v} {State : Type} {α : Type w} {spec : Query → Type} {spec' : Query' → Type} (oracle : (q : Query) → StateT State PMF (spec q)) (handler : (q : Query') → ProbOracleComp spec (spec' q)) (program : ProbOracleComp spec' α) (s : State) :
runWith oracle (simulate handler program) s = runWith (fun (q : Query') => runWith oracle (handler q)) program s

Running a substituted program against oracle runs the original program against the oracle that runs each handler program against oracle.