# Probability mass functions #

This file is about probability mass functions or discrete probability measures: a function α → ℝ≥0∞ such that the values have (infinite) sum 1.

Construction of monadic pure and bind is found in ProbabilityMassFunction/Monad.lean, other constructions of PMFs are found in ProbabilityMassFunction/Constructions.lean.

Given p : PMF α, PMF.toOuterMeasure constructs an OuterMeasure on α, by assigning each set the sum of the probabilities of each of its elements. Under this outer measure, every set is Carathéodory-measurable, so we can further extend this to a Measure on α, see PMF.toMeasure. PMF.toMeasure.isProbabilityMeasure shows this associated measure is a probability measure. Conversely, given a probability measure μ on a measurable space α with all singleton sets measurable, μ.toPMF constructs a PMF on α, setting the probability mass of a point x to be the measure of the singleton set {x}.

## Tags #

probability mass function, discrete probability measure

def PMF (α : Type u) :

A probability mass function, or discrete probability measures is a function α → ℝ≥0∞ such that the values have (infinite) sum 1.

Equations
Instances For
instance PMF.instFunLike {α : Type u_1} :
Equations
• PMF.instFunLike = { coe := fun (p : PMF α) (a : α) => p a, coe_injective' := }
theorem PMF.ext {α : Type u_1} {p : PMF α} {q : PMF α} (h : ∀ (x : α), p x = q x) :
p = q
theorem PMF.ext_iff {α : Type u_1} {p : PMF α} {q : PMF α} :
p = q ∀ (x : α), p x = q x
theorem PMF.hasSum_coe_one {α : Type u_1} (p : PMF α) :
HasSum (p) 1
@[simp]
theorem PMF.tsum_coe {α : Type u_1} (p : PMF α) :
∑' (a : α), p a = 1
theorem PMF.tsum_coe_ne_top {α : Type u_1} (p : PMF α) :
∑' (a : α), p a
theorem PMF.tsum_coe_indicator_ne_top {α : Type u_1} (p : PMF α) (s : Set α) :
∑' (a : α), Set.indicator s (p) a
@[simp]
theorem PMF.coe_ne_zero {α : Type u_1} (p : PMF α) :
p 0
def PMF.support {α : Type u_1} (p : PMF α) :
Set α

The support of a PMF is the set where it is nonzero.

Equations
Instances For
@[simp]
theorem PMF.mem_support_iff {α : Type u_1} (p : PMF α) (a : α) :
a p a 0
@[simp]
theorem PMF.support_nonempty {α : Type u_1} (p : PMF α) :
@[simp]
theorem PMF.support_countable {α : Type u_1} (p : PMF α) :
theorem PMF.apply_eq_zero_iff {α : Type u_1} (p : PMF α) (a : α) :
p a = 0 a
theorem PMF.apply_pos_iff {α : Type u_1} (p : PMF α) (a : α) :
0 < p a a
theorem PMF.apply_eq_one_iff {α : Type u_1} (p : PMF α) (a : α) :
p a = 1 = {a}
theorem PMF.coe_le_one {α : Type u_1} (p : PMF α) (a : α) :
p a 1
theorem PMF.apply_ne_top {α : Type u_1} (p : PMF α) (a : α) :
p a
theorem PMF.apply_lt_top {α : Type u_1} (p : PMF α) (a : α) :
p a <
def PMF.toOuterMeasure {α : Type u_1} (p : PMF α) :

Construct an OuterMeasure from a PMF, by assigning measure to each set s : Set α equal to the sum of p x for each x ∈ α.

Equations
Instances For
theorem PMF.toOuterMeasure_apply {α : Type u_1} (p : PMF α) (s : Set α) :
s = ∑' (x : α), Set.indicator s (p) x
@[simp]
theorem PMF.toOuterMeasure_caratheodory {α : Type u_1} (p : PMF α) :
@[simp]
theorem PMF.toOuterMeasure_apply_finset {α : Type u_1} (p : PMF α) (s : ) :
s = Finset.sum s fun (x : α) => p x
theorem PMF.toOuterMeasure_apply_singleton {α : Type u_1} (p : PMF α) (a : α) :
{a} = p a
theorem PMF.toOuterMeasure_injective {α : Type u_1} :
Function.Injective PMF.toOuterMeasure
@[simp]
theorem PMF.toOuterMeasure_inj {α : Type u_1} {p : PMF α} {q : PMF α} :
p = q
theorem PMF.toOuterMeasure_apply_eq_zero_iff {α : Type u_1} (p : PMF α) (s : Set α) :
s = 0 Disjoint () s
theorem PMF.toOuterMeasure_apply_eq_one_iff {α : Type u_1} (p : PMF α) (s : Set α) :
s = 1 s
@[simp]
theorem PMF.toOuterMeasure_apply_inter_support {α : Type u_1} (p : PMF α) (s : Set α) :
(s ) = s
theorem PMF.toOuterMeasure_mono {α : Type u_1} (p : PMF α) {s : Set α} {t : Set α} (h : s t) :
s t

Slightly stronger than OuterMeasure.mono having an intersection with p.support.

theorem PMF.toOuterMeasure_apply_eq_of_inter_support_eq {α : Type u_1} (p : PMF α) {s : Set α} {t : Set α} (h : s = t ) :
s = t
@[simp]
theorem PMF.toOuterMeasure_apply_fintype {α : Type u_1} (p : PMF α) (s : Set α) [] :
s = Finset.sum Finset.univ fun (x : α) => Set.indicator s (p) x
def PMF.toMeasure {α : Type u_1} [] (p : PMF α) :

Since every set is Carathéodory-measurable under PMF.toOuterMeasure, we can further extend this OuterMeasure to a Measure on α.

Equations
Instances For
theorem PMF.toOuterMeasure_apply_le_toMeasure_apply {α : Type u_1} [] (p : PMF α) (s : Set α) :
s () s
theorem PMF.toMeasure_apply_eq_toOuterMeasure_apply {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
() s = s
theorem PMF.toMeasure_apply {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
() s = ∑' (x : α), Set.indicator s (p) x
theorem PMF.toMeasure_apply_singleton {α : Type u_1} [] (p : PMF α) (a : α) (h : ) :
() {a} = p a
theorem PMF.toMeasure_apply_eq_zero_iff {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
() s = 0 Disjoint () s
theorem PMF.toMeasure_apply_eq_one_iff {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
() s = 1 s
@[simp]
theorem PMF.toMeasure_apply_inter_support {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) (hp : ) :
() (s ) = () s
@[simp]
theorem PMF.restrict_toMeasure_support {α : Type u_1} [] (p : PMF α) :
().restrict () =
theorem PMF.toMeasure_mono {α : Type u_1} [] (p : PMF α) {s : Set α} {t : Set α} (hs : ) (ht : ) (h : s t) :
() s () t
theorem PMF.toMeasure_apply_eq_of_inter_support_eq {α : Type u_1} [] (p : PMF α) {s : Set α} {t : Set α} (hs : ) (ht : ) (h : s = t ) :
() s = () t
theorem PMF.toMeasure_injective {α : Type u_1} [] :
Function.Injective PMF.toMeasure
@[simp]
theorem PMF.toMeasure_inj {α : Type u_1} [] {p : PMF α} {q : PMF α} :
p = q
@[simp]
theorem PMF.toMeasure_apply_finset {α : Type u_1} [] (p : PMF α) (s : ) :
() s = Finset.sum s fun (x : α) => p x
theorem PMF.toMeasure_apply_of_finite {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
() s = ∑' (x : α), Set.indicator s (p) x
@[simp]
theorem PMF.toMeasure_apply_fintype {α : Type u_1} [] (p : PMF α) (s : Set α) [] :
() s = Finset.sum Finset.univ fun (x : α) => Set.indicator s (p) x
def MeasureTheory.Measure.toPMF {α : Type u_1} [] [] (μ : ) :
PMF α

Given that α is a countable, measurable space with all singleton sets measurable, we can convert any probability measure into a PMF, where the mass of a point is the measure of the singleton set under the original measure.

Equations
• = { val := fun (x : α) => μ {x}, property := }
Instances For
theorem MeasureTheory.Measure.toPMF_apply {α : Type u_1} [] [] (μ : ) (x : α) :
= μ {x}
@[simp]
theorem MeasureTheory.Measure.toPMF_toMeasure {α : Type u_1} [] [] (μ : ) :
instance PMF.toMeasure.isProbabilityMeasure {α : Type u_1} [] (p : PMF α) :

The measure associated to a PMF by toMeasure is a probability measure.

Equations
• =
@[simp]
theorem PMF.toMeasure_toPMF {α : Type u_1} [] [] (p : PMF α) :
theorem PMF.toMeasure_eq_iff_eq_toPMF {α : Type u_1} [] [] (p : PMF α) (μ : ) :
theorem PMF.toPMF_eq_iff_toMeasure_eq {α : Type u_1} [] [] (p : PMF α) (μ : ) :