# 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 : α), s.indicator (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
• p.support =
Instances For
@[simp]
theorem PMF.mem_support_iff {α : Type u_1} (p : PMF α) (a : α) :
a p.support p a 0
@[simp]
theorem PMF.support_nonempty {α : Type u_1} (p : PMF α) :
p.support.Nonempty
@[simp]
theorem PMF.support_countable {α : Type u_1} (p : PMF α) :
p.support.Countable
theorem PMF.apply_eq_zero_iff {α : Type u_1} (p : PMF α) (a : α) :
p a = 0 ap.support
theorem PMF.apply_pos_iff {α : Type u_1} (p : PMF α) (a : α) :
0 < p a a p.support
theorem PMF.apply_eq_one_iff {α : Type u_1} (p : PMF α) (a : α) :
p a = 1 p.support = {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 α) :
p.toOuterMeasure s = ∑' (x : α), s.indicator (p) x
@[simp]
theorem PMF.toOuterMeasure_caratheodory {α : Type u_1} (p : PMF α) :
p.toOuterMeasure.caratheodory =
@[simp]
theorem PMF.toOuterMeasure_apply_finset {α : Type u_1} (p : PMF α) (s : ) :
p.toOuterMeasure s = xs, p x
theorem PMF.toOuterMeasure_apply_singleton {α : Type u_1} (p : PMF α) (a : α) :
p.toOuterMeasure {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.toOuterMeasure = q.toOuterMeasure p = q
theorem PMF.toOuterMeasure_apply_eq_zero_iff {α : Type u_1} (p : PMF α) (s : Set α) :
p.toOuterMeasure s = 0 Disjoint p.support s
theorem PMF.toOuterMeasure_apply_eq_one_iff {α : Type u_1} (p : PMF α) (s : Set α) :
p.toOuterMeasure s = 1 p.support s
@[simp]
theorem PMF.toOuterMeasure_apply_inter_support {α : Type u_1} (p : PMF α) (s : Set α) :
p.toOuterMeasure (s p.support) = p.toOuterMeasure s
theorem PMF.toOuterMeasure_mono {α : Type u_1} (p : PMF α) {s : Set α} {t : Set α} (h : s p.support t) :
p.toOuterMeasure s p.toOuterMeasure 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 p.support = t p.support) :
p.toOuterMeasure s = p.toOuterMeasure t
@[simp]
theorem PMF.toOuterMeasure_apply_fintype {α : Type u_1} (p : PMF α) (s : Set α) [] :
p.toOuterMeasure s = x : α, s.indicator (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
• p.toMeasure = p.toOuterMeasure.toMeasure
Instances For
theorem PMF.toOuterMeasure_apply_le_toMeasure_apply {α : Type u_1} [] (p : PMF α) (s : Set α) :
p.toOuterMeasure s p.toMeasure s
theorem PMF.toMeasure_apply_eq_toOuterMeasure_apply {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
p.toMeasure s = p.toOuterMeasure s
theorem PMF.toMeasure_apply {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
p.toMeasure s = ∑' (x : α), s.indicator (p) x
theorem PMF.toMeasure_apply_singleton {α : Type u_1} [] (p : PMF α) (a : α) (h : ) :
p.toMeasure {a} = p a
theorem PMF.toMeasure_apply_eq_zero_iff {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
p.toMeasure s = 0 Disjoint p.support s
theorem PMF.toMeasure_apply_eq_one_iff {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) :
p.toMeasure s = 1 p.support s
@[simp]
theorem PMF.toMeasure_apply_inter_support {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : ) (hp : MeasurableSet p.support) :
p.toMeasure (s p.support) = p.toMeasure s
@[simp]
theorem PMF.restrict_toMeasure_support {α : Type u_1} [] (p : PMF α) :
p.toMeasure.restrict p.support = p.toMeasure
theorem PMF.toMeasure_mono {α : Type u_1} [] (p : PMF α) {s : Set α} {t : Set α} (hs : ) (ht : ) (h : s p.support t) :
p.toMeasure s p.toMeasure t
theorem PMF.toMeasure_apply_eq_of_inter_support_eq {α : Type u_1} [] (p : PMF α) {s : Set α} {t : Set α} (hs : ) (ht : ) (h : s p.support = t p.support) :
p.toMeasure s = p.toMeasure 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.toMeasure = q.toMeasure p = q
@[simp]
theorem PMF.toMeasure_apply_finset {α : Type u_1} [] (p : PMF α) (s : ) :
p.toMeasure s = xs, p x
theorem PMF.toMeasure_apply_of_finite {α : Type u_1} [] (p : PMF α) (s : Set α) (hs : s.Finite) :
p.toMeasure s = ∑' (x : α), s.indicator (p) x
@[simp]
theorem PMF.toMeasure_apply_fintype {α : Type u_1} [] (p : PMF α) (s : Set α) [] :
p.toMeasure s = x : α, s.indicator (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
• μ.toPMF = fun (x : α) => μ {x},
Instances For
theorem MeasureTheory.Measure.toPMF_apply {α : Type u_1} [] [] (μ : ) (x : α) :
μ.toPMF x = μ {x}
@[simp]
theorem MeasureTheory.Measure.toPMF_toMeasure {α : Type u_1} [] [] (μ : ) :
μ.toPMF.toMeasure = μ

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

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