Denotational Semantics for Output Distributions #
This file defines a typeclass for monads that can be canonically embedded in the SPMF
monad.
We require this embedding respect the basic monad laws.
We also define a number of specific cases:
Pr[= x | mx]
/probOutput mx x
for odds ofmx
returningx
Pr[p | mx]
/probEvent mx p
for odds ofmx
's result satisfyingp
Pr[e | x ← mx]
wherex
is free in the expressione
Pr{x ← mx}[e]
wherex
is free in the expressione
Pr[⊥ | mx]
/probFailure mx
for odds ofmx
resulting in failure
For the last case, we assume mx
has an OptionT
transformer to represent the failure.
In future it may be nice to generalize to any AlternativeMonad
using an additional typeclass
(note that it can't extend the existing one as it outputs in an SPMF
).
The monad m
has a well-behaved embedding into the SPMF
monad.
TODO: modify this to extend MonadHom
to get some lemmas for free.
Instances
Probability that a computation mx
returns the value x
.
Equations
Instances For
Probability that a compuutation mx
will fail to return a value.
Equations
Instances For
Probability that a computation returns a particular output.
Equations
Instances For
Probability that a computation returns a value satisfying a predicate.
Equations
Instances For
Probability that a computation fails to return a value.
Equations
Instances For
Probability that a computation returns a value satisfying a predicate.
Equations
Instances For
Probability that a computation returns a value satisfying a predicate.
Equations
Instances For
Add instance for SPMF
just to give access to notation.