mathlib3 documentation

probability.probability_mass_function.uniform

Uniform Probability Mass Functions #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

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

pmf.uniform_of_finset gives each element in the set equal probability, with 0 probability for elements not in the set.

pmf.uniform_of_fintype gives all elements equal probability, equal to the inverse of the size of the fintype.

pmf.of_multiset 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

noncomputable def pmf.uniform_of_finset {α : Type u_1} (s : finset α) (hs : s.nonempty) :
pmf α

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

Equations
@[simp]
theorem pmf.uniform_of_finset_apply {α : Type u_1} {s : finset α} (hs : s.nonempty) (a : α) :
theorem pmf.uniform_of_finset_apply_of_mem {α : Type u_1} {s : finset α} (hs : s.nonempty) {a : α} (ha : a s) :
theorem pmf.uniform_of_finset_apply_of_not_mem {α : Type u_1} {s : finset α} (hs : s.nonempty) {a : α} (ha : a s) :
@[simp]
theorem pmf.support_uniform_of_finset {α : Type u_1} {s : finset α} (hs : s.nonempty) :
theorem pmf.mem_support_uniform_of_finset_iff {α : Type u_1} {s : finset α} (hs : s.nonempty) (a : α) :
@[simp]
theorem pmf.to_outer_measure_uniform_of_finset_apply {α : Type u_1} {s : finset α} (hs : s.nonempty) (t : set α) :
((pmf.uniform_of_finset s hs).to_outer_measure) t = ((finset.filter (λ (_x : α), _x t) s).card) / (s.card)
@[simp]
theorem pmf.to_measure_uniform_of_finset_apply {α : Type u_1} {s : finset α} (hs : s.nonempty) (t : set α) [measurable_space α] (ht : measurable_set t) :
((pmf.uniform_of_finset s hs).to_measure) t = ((finset.filter (λ (_x : α), _x t) s).card) / (s.card)
noncomputable def pmf.uniform_of_fintype (α : Type u_1) [fintype α] [nonempty α] :
pmf α

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

Equations
@[simp]
theorem pmf.uniform_of_fintype_apply {α : Type u_1} [fintype α] [nonempty α] (a : α) :
noncomputable def pmf.of_multiset {α : 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
@[simp]
theorem pmf.of_multiset_apply {α : Type u_1} {s : multiset α} (hs : s 0) (a : α) :
@[simp]
theorem pmf.support_of_multiset {α : Type u_1} {s : multiset α} (hs : s 0) :
theorem pmf.mem_support_of_multiset_iff {α : Type u_1} {s : multiset α} (hs : s 0) (a : α) :
theorem pmf.of_multiset_apply_of_not_mem {α : Type u_1} {s : multiset α} (hs : s 0) {a : α} (ha : a s) :
@[simp]
theorem pmf.to_outer_measure_of_multiset_apply {α : Type u_1} {s : multiset α} (hs : s 0) (t : set α) :
@[simp]
theorem pmf.to_measure_of_multiset_apply {α : Type u_1} {s : multiset α} (hs : s 0) (t : set α) [measurable_space α] (ht : measurable_set t) :
((pmf.of_multiset s hs).to_measure) t = (∑' (x : α), (multiset.count x (multiset.filter (λ (_x : α), _x t) s))) / (multiset.card s)