Private randomness with typed oracle calls #
ProbOracleComp spec combines the existing finite-uniform sampling interface with spec by a
disjoint sum of query types. It is still an OracleComp, interpreted by OracleComp.interpret.
sample embeds a closed probabilistic program, and query calls the external oracle. A handler
can therefore draw fresh private coins while caching only the external queries.
The finite-uniform interface specifies distributions, not their computational efficiency. Strict fair-coin realizability is certified separately; arbitrary exact finite-uniform sampling is not automatically a strict PPT operation.
Main definitions #
Cslib.probOracleSpec: the disjoint sumunifSpec ⊕ₒ specof the finite-uniform sampling requests and the external queries ofspec.Cslib.ProbOracleComp: the sum of the uniform sampling and external oracle interfaces.Cslib.ProbOracleComp.sample,.query: closed sampling and typed external calls.Cslib.ProbOracleComp.handler: the sum handler of sampling and external queries.
The sampling and external interfaces form the sum unifSpec ⊕ₒ spec of
Complexity/Languages/Probabilistic/Sum.lean: sample is its left embedding
(sample_eq_liftLeft) and handler its sum handler (handler_eq_sumHandler).
Main results #
Cslib.ProbOracleComp.isMonadHom_sample:sampleis a monad morphism fromProbComp.Cslib.ProbOracleComp.interpret_sample: embedded sampling uses only the sampling handler.Cslib.ProbOracleComp.run_interpret_sample: private sampling leaves oracle state unchanged.Cslib.ProbOracleComp.run_interpret_lift_sample: a stateful handler with external calls forwards private sampling unchanged.Cslib.ProbOracleComp.sample_run_interpret: sampling a closed stateful execution is the execution of the sampled handler.Cslib.ProbOracleComp.eval_interpret: closed handlers commute with probability interpretation.Cslib.ProbOracleComp.eval_run_interpret: closed handler programs preserve the joint state law.
References #
Uses the typed interface of cslib PR #1129, by Samuel Schlesinger and Devon Tuma, based on the
VCVio design credited in Languages.Probabilistic.Basic. This replaces the separate sampling
constructor used by the cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8.
A disjoint sum keeps fresh sampling requests separate from external oracle requests.
Instances For
Embed a closed probabilistic program; its calls remain separate from the external oracle.
Instances For
Sampling is the left embedding into the sum unifSpec ⊕ₒ spec.
Lifting a closed sampler into ProbOracleComp spec is a monad morphism.
Make one external call, whose reply may determine later sampling or queries.
Instances For
Combine the two handlers. In particular, memoizing oracle does not memoize random.
This is the sum handler of unifSpec ⊕ₒ spec (handler_eq_sumHandler), with its own case
equations.
Instances For
Interpretation distributes over the sampling and external components of a program handler.
The combined handler answers a single external query through its external component.
Embedded closed programs use only the sampling component of the combined handler.
Private sampling is fresh and leaves the complete external oracle state unchanged.
A stateful handler that itself has private coins and external calls forwards every private draw as a fresh sample, leaving its own state unchanged.
Sampling a closed stateful execution is the execution of the sampled handler: both make the same private draws and retain the same final handler state.
Closed handlers have the same probability law when interpreted before or after evaluation.
Evaluating closed stateful handlers commutes with interpreting the whole oracle program. Private sampling stays independent, and the final state is retained beside the result.