Specific Constructions of Probability Mass Functions #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file gives a number of different pmf constructions for common probability distributions.
map and seq allow pushing a pmf α along a function f : α → β (or distribution of
functions f : pmf (α → β)) to get a pmf β
of_finset and of_fintype simplify the construction of a pmf α from a function f : α → ℝ≥0∞,
by allowing the "sum equals 1" constraint to be in terms of finset.sum instead of tsum.
normalize constructs a pmf α by normalizing a function f : α → ℝ≥0∞ by its sum,
and filter uses this to filter the support of a pmf and re-normalize the new distribution.
Given a finite type α and a function f : α → ℝ≥0∞ with sum 1, we get a pmf.
Equations
- pmf.of_fintype f h = pmf.of_finset f finset.univ h _
A pmf which assigns probability p to tt and 1 - p to ff.
Equations
- pmf.bernoulli p h = pmf.of_fintype (λ (b : bool), cond b p (1 - p)) _