Probability Distributions on Potentially Failing Computations #
This file lifts MonadLiftT _ SetM and MonadLiftT _ SPMF semantics through the
OptionT monad transformer.
dt: should add more instances and connecting lemmas
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.
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.