PMF Utilities #
NB: This module is temporary #
The bind/pure and posterior lemmas here have no dependence on any domain-specific
structure. They should be upstreamed to Mathlib
(likely Mathlib.Probability.ProbabilityMassFunction.Monad or a new
Mathlib.Probability.ProbabilityMassFunction.Prod). Once accepted upstream,
these lemmas should be removed and their consumers should import the Mathlib module instead.
The uniform samplers retain the PMF interface removed in
mathlib#42909,
pending a decision on CSLib's probability API. Their definitions and proofs are adapted from
Mathlib.Probability.Distributions.Uniform before that PR, by Josha Dekker, Devon Tuma,
and Kexing Ying, under the Apache 2.0 license.
Original sampler copyright (c) 2024 Josha Dekker. All rights reserved.
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.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
Uniform probability mass function on a nonempty finite set.
Equations
- Cslib.Probability.PMF.uniformOfFinset s hs = PMF.ofFinset (fun (a : α) => if a ∈ s then (↑s.card)⁻¹ else 0) s ⋯ ⋯
Instances For
Uniform probability mass function on a nonempty finite type.
Equations
Instances For
Evaluating the "pairing" bind (do let a ← p; return (a, ← f a)) at (a, b)
gives the product p a * f a b.
Independent uniform sampling on α and β equals uniform sampling on α × β.
The posterior distribution Pr[A = a | B = b] as a PMF,
given a ← p, b ← f a, and that b has positive marginal probability:
the joint distribution's slice at b, normalized.
Equations
Instances For
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.