Priority-ordered normalization of stateful and stateless oracle runs #
Tags the lemmas of the simp set runWith_norm. Combined with pmf_norm,
simp only [runWith_norm, pmf_norm] reduces concrete ProbOracleComp and OracleComp do-blocks
to PMF.bind, PMF.pure, and PMF.map in one pass, while stopping cleanly at
ProbOracleComp.runWith oracle (adversary n pk) s or OracleComp.evalWith handler (adversary n pk)
when adversary is a black-box parameter:
- folding
ProbOracleComp.runand spelled-out runs intoProbOracleComp.runWithorOracleComp.evalWith:ProbOracleComp.eval_interpret_eq_evalWith,ProbOracleComp.eval_run_eq_evalWith,ProbOracleComp.eval_run_interpret_eq_runWith,ProbOracleComp.runWith_eq_run_interpret; - composing
ProbOracleComp.simulateand spelled-out handlers insideProbOracleComp.runWithorOracleComp.evalWith:ProbOracleComp.evalWith_run_interpret,ProbOracleComp.evalWith_sumHandler_simulate,ProbOracleComp.evalWith_interpret_sumHandler,ProbOracleComp.runWith_interpret_sumHandler_eta,ProbOracleComp.runWith_simulate_eta,ProbOracleComp.runWith_run_interpret; - stepping
ProbOracleComp.runWithover program syntax, lifted sub-interfaces, and memoryless oracles:ProbOracleComp.runWith_lift,ProbOracleComp.runWith_memoryless,ProbOracleComp.runWith_pure_state,ProbOracleComp.runWith_sample_bind,ProbOracleComp.runWith_pure,ProbOracleComp.runWith_bind,ProbOracleComp.runWith_map,ProbOracleComp.runWith_query,ProbOracleComp.runWith_sample,ProbOracleComp.runWith_liftLeft,ProbOracleComp.runWith_liftRight; - stepping generic
OracleComp.runWithand statelessOracleComp.evalWith:OracleComp.runWith_lift,OracleComp.runWith_memoryless,OracleComp.runWith_pure,OracleComp.runWith_bind,OracleComp.runWith_map,OracleComp.runWith_query,OracleComp.runWith_sumHandler_liftLeft,OracleComp.runWith_sumHandler_liftRight,OracleComp.evalWith_pure,OracleComp.evalWith_bind,OracleComp.evalWith_map,OracleComp.evalWith_query,OracleComp.evalWith_interpret,OracleComp.evalWith_sumHandler_liftLeft,OracleComp.evalWith_sumHandler_liftRight,OracleComp.sumHandler_inl,OracleComp.sumHandler_inr,ProbOracleComp.evalWith_sumHandler_unifOracle_sample,ProbOracleComp.evalWith_sumHandler_sample,ProbOracleComp.evalWith_sumHandler_query; - normalizing embedded private sampling and identity/tuple maps produced by
runWith_mapand memoryless runs:ProbOracleComp.sample_pure,ProbOracleComp.sample_bind,ProbOracleComp.sample_map,Probability.PMF.map_id',PMF.map_id,Prod.map_apply,Prod.map_fst,Prod.map_snd,id_eq.
OracleComp.interpret_bind, ProbOracleComp.run_bind, ProbOracleComp.simulate_bind, and
StateT.run_bind are deliberately excluded: bottom-up simp would otherwise rewrite inside
((OracleComp.interpret …).run s), (program.run oracle), or (ProbOracleComp.simulate …) before
the enclosing priority-1200 run-folding or handler-composition rules match.
The set is priority-ordered and is not claimed to be confluent: when several rules match the same term, the run-folding and handler-composition rules (priority 1200) and the memoryless-oracle and embedded-sampling rules (priority 1100) take precedence over the default-priority syntax-stepping rules.
Main results #
Cslib.ProbOracleComp.eval_interpret_eq_evalWith,Cslib.ProbOracleComp.eval_run_eq_evalWith: fold closed statelessProbComp.evalruns intoOracleComp.evalWith.Cslib.ProbOracleComp.evalWith_run_interpret: folds a stateful reduction run inside a statelessOracleComp.evalWithintoProbOracleComp.runWith.Cslib.ProbOracleComp.evalWith_sumHandler_simulate,Cslib.ProbOracleComp.evalWith_interpret_sumHandler: fold statelessProbOracleComp.simulateand spelled-out sum-handler substitutions underOracleComp.evalWith.Cslib.ProbOracleComp.runWith_eq_run_interpret: folds the spelled-outProbComp.unifOraclesum handler run intoProbOracleComp.runWith.Cslib.ProbOracleComp.runWith_interpret_sumHandler_eta,Cslib.ProbOracleComp.runWith_simulate_eta: eta-expanded forms ofProbOracleComp.runWith_interpret_sumHandlerandProbOracleComp.runWith_simulatesorunWith_normalso steps concrete handler bodies when the client program is a black-box parameter.Cslib.ProbOracleComp.runWith_pure_state: folds a deterministic memoryless raw oraclefun q state => PMF.pure (f q, state)intoOracleComp.evalWithafterPMF.pure_mapsimplifies(PMF.pure (f q)).map (·, state).Cslib.ProbOracleComp.runWith_liftLeft,Cslib.ProbOracleComp.runWith_liftRight: stepProbOracleComp.runWithacrossOracleComp.liftLeftandOracleComp.liftRight.Cslib.ProbOracleComp.evalWith_sumHandler_unifOracle_sample,Cslib.ProbOracleComp.evalWith_sumHandler_sample,Cslib.ProbOracleComp.evalWith_sumHandler_query: stepOracleComp.evalWithacrossProbOracleComp.sampleandProbOracleComp.query.Cslib.Probability.PMF.map_id': eta-expandedp.map (fun x => x) = prule matching composed projections(p.map (·, s)).map Prod.fst.
Evaluating a ProbOracleComp against a stateless ProbComp oracle is OracleComp.evalWith
with ProbComp.unifOracle and the evaluated oracle.
Evaluating program.run oracle is OracleComp.evalWith with ProbComp.unifOracle and the
evaluated oracle.
Evaluating a stateful ProbOracleComp handler run under a stateless PMF external oracle is
ProbOracleComp.runWith against the evaluated handler.
Eta-expanded form of ProbOracleComp.runWith_interpret_sumHandler supplying the state argument
to the inner ProbOracleComp.runWith, so runWith_norm normalizes concrete handler programs even
when program is an opaque adversary.
Eta-expanded form of ProbOracleComp.runWith_simulate supplying the state argument to the inner
ProbOracleComp.runWith, so runWith_norm normalizes concrete handler programs even when program
is an opaque adversary.
Evaluating ProbOracleComp.simulate handler program under a stateless sum handler evaluates
program against the evaluated handler programs while preserving uniform private sampling.
Spelled-out OracleComp.interpret counterpart of ProbOracleComp.evalWith_sumHandler_simulate,
folding a stateless handler substitution under OracleComp.evalWith while preserving
ProbComp.unifOracle on private samples.
Against a deterministic memoryless raw oracle returning (f q, state), ProbOracleComp.runWith
evaluates program against fun q => PMF.pure (f q) and leaves s unchanged. Unlike
ProbOracleComp.runWith_memoryless, this matches after PMF.pure_map simplifies
(PMF.pure (f q)).map (·, state) inside simp only [runWith_norm, pmf_norm].
Evaluating an embedded private sample under a sum handler uses only the sampling handler.
Evaluating an embedded private sample under ProbComp.unifOracle and an external handler gives
ProbComp.eval.
Running an embedded left (ProbComp) program under ProbOracleComp.runWith evaluates the
program and leaves the oracle state unchanged.
Running an embedded right (OracleComp spec) program under ProbOracleComp.runWith runs it
directly against oracle via OracleComp.runWith.
Eta-expanded form of PMF.map_id, matching p.map (fun x => x) after PMF.map_comp and
Function.comp_def unfold (p.map (·, s)).map Prod.fst.