PMF Utilities #
NB: This module is temporary #
Everything here is a general PMF bind/pure lemma with no dependence on
any domain-specific structure. It should be upstreamed to Mathlib
(likely Mathlib.Probability.ProbabilityMassFunction.Monad or a new
Mathlib.Probability.ProbabilityMassFunction.Prod). Once accepted
upstream, this file should be deleted and its consumers should import
the Mathlib module instead.
Main results #
Cslib.Probability.PMF.bind_pair_apply: the "pairing" bind at(a, b)equalsp a * f a bCslib.Probability.PMF.bind_pair_tsum_fst: marginalizing over the first componentCslib.Probability.PMF.uniformOfFintype_map_equiv: a uniform distribution is invariant under equivalenceCslib.Probability.PMF.posterior_hasSum: posterior probabilities sum to 1Cslib.Probability.PMF.posteriorDist: the posterior as aPMFCslib.Probability.PMF.posteriorDist_eq_prior_of_outputIndist: if the output distribution does not depend on the input, conditioning does not change the prior
theorem
Cslib.Probability.PMF.bind_pair_apply
{α : Type u}
{β : Type v}
(p : PMF α)
(f : α → PMF β)
(a : α)
(b : β)
:
Evaluating the "pairing" bind (do let a ← p; return (a, ← f a)) at (a, b)
gives the product p a * f a b.
theorem
Cslib.Probability.PMF.posteriorDist_eq_prior_of_outputIndist
{α : Type u}
{β : Type v}
(p : PMF α)
(f : α → PMF β)
(h : ∀ (a₀ a₁ : α), f a₀ = f a₁)
(b : β)
(hb : b ∈ (p.bind f).support)
:
If the output distribution of a channel does not depend on the input, then conditioning on any output with positive probability leaves the prior unchanged.