Probability Distributions on Potentially Failing Computations #
This file lifts MonadLiftT _ SetM and MonadLiftT _ SPMF semantics through the
OptionT monad transformer, providing support, finSupport, and evalDist-based
probability lemmas for OptionT m α in terms of the underlying m (Option α).
Standalone MonadLiftT (OptionT m) SetM instance under the weaker [MonadLiftT m SetM]
assumption. Keeping this standalone means support on OptionT m works without requiring a
full MonadLiftT m SPMF lift — only MonadLiftT m SetM is needed.
We declare a MonadLiftT (rather than MonadLift) so the instance has no semiOutParam
arguments to synthesize — OptionT m's m cannot be recovered from the SetM codomain.
Peel the leading sample off the support of an OptionT.mk'd bind: any element of the
support of OptionT.mk (sample >>= body) factors through a sample a in the support of
sample, with the element in the support of OptionT.mk (body a).
Lift a HasEvalFinset instance to OptionT. by just taking preimage under some.
Lift a MonadLiftT m SPMF instance to MonadLiftT (OptionT m) SPMF. Failure in OptionT
contributes to the failure mass of the resulting SPMF.
The SetM-lift of OptionT m (preimage of support mx.run under some) agrees with the
SPMF-lift (the OptionT.mapM' bind into SPMF) on outputs, given EvalDistCompatible m.
Bridge lemma: when two OptionT computations have underlying runs related by an
Option.map of a function f, their probabilities for the events P and P ∘ f agree.