Captured inputs in efficient probabilistic programs #
Ordinary monadic continuations and callbacks may use both the caller's input and a sampled result. These operations specialize the strict oracle calculus to empty external channels. Its clean-realization compiler charges copying, framing and preparation; the existing pair encoding makes the retained data a typed value for the next computation. Prefixing is pairing followed by efficient deterministic concatenation.
Main results #
Cslib.Probability.IsPPTOn.pair: retain efficiently computed data alongside a sampled result.Cslib.Probability.IsPPTOn.bind_with: a monadic continuation may capture the original input.Cslib.Probability.IsPPTOn.map_with: a deterministic callback may capture the original input.Cslib.Probability.IsPPTOn.cond,Cslib.Probability.IsPPTOn.ite: efficient branch selection.
References #
Adapted from Computability/Probabilistic/{Realization/Composition,Composition}.lean on the cslib
crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8, using the existing tidy calculus
and framed pair encoding.
Write efficiently computed input data before a probabilistic output, charging preparation.
Retain efficiently computed input data beside a sampled result, using the existing encoding.
A monadic continuation may use both the caller's input and the sampled result.
A deterministic callback may capture the original argument.
Select a closed probabilistic branch with an efficient Boolean condition, using the empty-channel specialization of oracle branch selection.
Select a closed probabilistic branch with an efficiently decidable condition.