Documentation

Mathlib.Probability.ProbabilityMassFunction.Basic

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_iff {α : Type u_1} {p : PMF α} {q : PMF α} :
    p = q ∀ (x : α), p x = q x
    theorem PMF.ext {α : Type u_1} {p : PMF α} {q : PMF α} (h : ∀ (x : α), p x = q x) :
    p = q
    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
    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 <

      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 : Finset α) :
        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 α) [Fintype α] :
        p.toOuterMeasure s = x : α, s.indicator (⇑p) x

        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} [MeasurableSpace α] (p : PMF α) (s : Set α) :
          p.toOuterMeasure s p.toMeasure s
          theorem PMF.toMeasure_apply_eq_toOuterMeasure_apply {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) (hs : MeasurableSet s) :
          p.toMeasure s = p.toOuterMeasure s
          theorem PMF.toMeasure_apply {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) (hs : MeasurableSet s) :
          p.toMeasure s = ∑' (x : α), s.indicator (⇑p) x
          theorem PMF.toMeasure_apply_singleton {α : Type u_1} [MeasurableSpace α] (p : PMF α) (a : α) (h : MeasurableSet {a}) :
          p.toMeasure {a} = p a
          theorem PMF.toMeasure_apply_eq_zero_iff {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) (hs : MeasurableSet s) :
          p.toMeasure s = 0 Disjoint p.support s
          theorem PMF.toMeasure_apply_eq_one_iff {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) (hs : MeasurableSet s) :
          p.toMeasure s = 1 p.support s
          @[simp]
          theorem PMF.toMeasure_apply_inter_support {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) (hs : MeasurableSet s) (hp : MeasurableSet p.support) :
          p.toMeasure (s p.support) = p.toMeasure s
          @[simp]
          theorem PMF.restrict_toMeasure_support {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] (p : PMF α) :
          p.toMeasure.restrict p.support = p.toMeasure
          theorem PMF.toMeasure_mono {α : Type u_1} [MeasurableSpace α] (p : PMF α) {s : Set α} {t : Set α} (hs : MeasurableSet s) (ht : MeasurableSet t) (h : s p.support t) :
          p.toMeasure s p.toMeasure t
          theorem PMF.toMeasure_apply_eq_of_inter_support_eq {α : Type u_1} [MeasurableSpace α] (p : PMF α) {s : Set α} {t : Set α} (hs : MeasurableSet s) (ht : MeasurableSet t) (h : s p.support = t p.support) :
          p.toMeasure s = p.toMeasure t
          @[simp]
          theorem PMF.toMeasure_inj {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {p : PMF α} {q : PMF α} :
          p.toMeasure = q.toMeasure p = q
          @[simp]
          theorem PMF.toMeasure_apply_finset {α : Type u_1} [MeasurableSpace α] (p : PMF α) [MeasurableSingletonClass α] (s : Finset α) :
          p.toMeasure s = xs, p x
          theorem PMF.toMeasure_apply_of_finite {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) [MeasurableSingletonClass α] (hs : s.Finite) :
          p.toMeasure s = ∑' (x : α), s.indicator (⇑p) x
          @[simp]
          theorem PMF.toMeasure_apply_fintype {α : Type u_1} [MeasurableSpace α] (p : PMF α) (s : Set α) [MeasurableSingletonClass α] [Fintype α] :
          p.toMeasure s = x : α, s.indicator (⇑p) x

          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

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

            Equations
            • =
            @[simp]
            theorem PMF.toMeasure_toPMF {α : Type u_1} [Countable α] [MeasurableSpace α] [MeasurableSingletonClass α] (p : PMF α) :
            p.toMeasure.toPMF = p