Documentation

Mathlib.Probability.ProbabilityMassFunction.Uniform

Uniform Probability Mass Functions #

This file defines a number of uniform PMF distributions from various inputs, uniformly drawing from the corresponding object.

PMF.uniformOfFinset gives each element in the set equal probability, with 0 probability for elements not in the set.

PMF.uniformOfFintype gives all elements equal probability, equal to the inverse of the size of the Fintype.

PMF.ofMultiset draws randomly from the given Multiset, treating duplicate values as distinct. Each probability is given by the count of the element divided by the size of the Multiset

def PMF.uniformOfFinset {α : Type u_1} (s : Finset α) (hs : s.Nonempty) :
PMF α

Uniform distribution taking the same non-zero probability on the nonempty finset s

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    @[simp]
    theorem PMF.uniformOfFinset_apply {α : Type u_1} {s : Finset α} (hs : s.Nonempty) (a : α) :
    (PMF.uniformOfFinset s hs) a = if a s then (s.card)⁻¹ else 0
    theorem PMF.uniformOfFinset_apply_of_mem {α : Type u_1} {s : Finset α} (hs : s.Nonempty) {a : α} (ha : a s) :
    (PMF.uniformOfFinset s hs) a = (s.card)⁻¹
    theorem PMF.uniformOfFinset_apply_of_not_mem {α : Type u_1} {s : Finset α} (hs : s.Nonempty) {a : α} (ha : as) :
    @[simp]
    theorem PMF.support_uniformOfFinset {α : Type u_1} {s : Finset α} (hs : s.Nonempty) :
    theorem PMF.mem_support_uniformOfFinset_iff {α : Type u_1} {s : Finset α} (hs : s.Nonempty) (a : α) :
    @[simp]
    theorem PMF.toOuterMeasure_uniformOfFinset_apply {α : Type u_1} {s : Finset α} (hs : s.Nonempty) (t : Set α) :
    (PMF.toOuterMeasure (PMF.uniformOfFinset s hs)) t = (Finset.filter (fun (x : α) => x t) s).card / s.card
    @[simp]
    theorem PMF.toMeasure_uniformOfFinset_apply {α : Type u_1} {s : Finset α} (hs : s.Nonempty) (t : Set α) [MeasurableSpace α] (ht : MeasurableSet t) :
    (PMF.toMeasure (PMF.uniformOfFinset s hs)) t = (Finset.filter (fun (x : α) => x t) s).card / s.card
    def PMF.uniformOfFintype (α : Type u_4) [Fintype α] [Nonempty α] :
    PMF α

    The uniform pmf taking the same uniform value on all of the fintype α

    Equations
    Instances For
      @[simp]
      theorem PMF.uniformOfFintype_apply {α : Type u_1} [Fintype α] [Nonempty α] (a : α) :
      def PMF.ofMultiset {α : Type u_1} (s : Multiset α) (hs : s 0) :
      PMF α

      Given a non-empty multiset s we construct the PMF which sends a to the fraction of elements in s that are a.

      Equations
      Instances For
        @[simp]
        theorem PMF.ofMultiset_apply {α : Type u_1} {s : Multiset α} (hs : s 0) (a : α) :
        (PMF.ofMultiset s hs) a = (Multiset.count a s) / (Multiset.card s)
        @[simp]
        theorem PMF.support_ofMultiset {α : Type u_1} {s : Multiset α} (hs : s 0) :
        theorem PMF.mem_support_ofMultiset_iff {α : Type u_1} {s : Multiset α} (hs : s 0) (a : α) :
        theorem PMF.ofMultiset_apply_of_not_mem {α : Type u_1} {s : Multiset α} (hs : s 0) {a : α} (ha : as) :
        (PMF.ofMultiset s hs) a = 0
        @[simp]
        theorem PMF.toOuterMeasure_ofMultiset_apply {α : Type u_1} {s : Multiset α} (hs : s 0) (t : Set α) :
        (PMF.toOuterMeasure (PMF.ofMultiset s hs)) t = (∑' (x : α), (Multiset.count x (Multiset.filter (fun (x : α) => x t) s))) / (Multiset.card s)
        @[simp]
        theorem PMF.toMeasure_ofMultiset_apply {α : Type u_1} {s : Multiset α} (hs : s 0) (t : Set α) [MeasurableSpace α] (ht : MeasurableSet t) :
        (PMF.toMeasure (PMF.ofMultiset s hs)) t = (∑' (x : α), (Multiset.count x (Multiset.filter (fun (x : α) => x t) s))) / (Multiset.card s)