Revealing a hidden sample along an experiment #
A real experiment runs on states a. An ideal experiment first draws a hidden sample k and then
runs on smaller states that depend on it. The two are linked by a law exp a of the hidden sample
given the real state and by a representation rep a: the real state together with the explained
sample, (exp a).map (·, rep a), has the law of the ideal pair. Lazy and eager sampling of a
random function are an example, where exp completes the table that a lazy state has not yet
sampled.
Such a link is preserved by a step that keeps it on reachable real states. The lemmas carry an
invariant of those states, so the local link need only hold where the invariant does. A trivial
hidden sample turns the link into a plain state representation, (d.map rep).
Main definitions #
Cslib.Probability.PMF.HiddenCoupling: link(exp a).map (·, rep a)between a concrete distribution and an ideal hidden-sample experiment, bundled with a support invariant.Cslib.Probability.PMF.RepInv: deterministic state representationd₁.map rep = d₂, bundled with a support invariant.
Main results #
Cslib.Probability.PMF.HiddenCoupling.pure,.congr,.bind,.bind_pure,.map,.iterate: dot-notation combinators inferring intermediate distributions and continuations.Cslib.Probability.PMF.RepInv.pure,.of_eq,.map_eq,.bind,.map,.iterate: dot-notation combinators for deterministic state representations with invariants.Cslib.Probability.PMF.iterate_bind_invariant: invariant preservation acrossmmonadic steps.
Couple a concrete distribution d₁ with an ideal two-stage distribution drawing k ← exp₀ and
running d₂ k, linked by the conditional law exp a of the hidden sample and representation
rep a, carrying inv on d₁.support.
Transport HiddenCoupling along distribution equalities on support and invariant weakening.
Sequence two HiddenCoupling stages with distributions and continuations inferred.
Sequence a HiddenCoupling whose ideal first stage is PMF.pure (b k) with a continuation
fun k => f₂ k (b k).
Postprocess both sides of a HiddenCoupling on d₁.support and (exp₁ a).support.
Lift a step-wise HiddenCoupling across m monadic iterations.
Couple a concrete distribution d₁ with an abstract distribution d₂ via d₁.map rep = d₂,
carrying inv on d₁.support.
Pushforward of
d₁alongrepequalsd₂.Every reachable concrete outcome satisfies
inv.
Sequence two RepInv stages with distributions and continuations inferred.
Postprocess both sides of a RepInv coupling on d₁.support.
Lift a step-wise RepInv coupling across m monadic iterations.
Every reachable state of a chain of m steps satisfies an invariant indexed by the round,
when every possible step from a state satisfying the invariant of its round preserves it.