Documentation

ToCslib.Probability.UniformOn

Uniform measures on finite sets #

Mathlib's ProbabilityTheory.uniformOn s is the counting measure conditioned on s. It is a probability measure when s is finite and nonempty, and zero when s is infinite and singletons are measurable. This file adds the facts that finite uniform sampling uses. It computes the mass of a point and of a decidable event under the uniform measure on a finite type or a finite set, and integrals against it. The coordinates of a uniform pair are independent and uniform, and bijections preserve uniform measures.

Main statements #

The measurable-space assumptions stay explicit. The results ask for measurable singletons where they need them and install no discrete measurable-space instance.

Invariance under measurable equivalences #

A measurable equivalence carries the uniform measure on s to the uniform measure on the image of s. The statement holds for every set: the counting measure, and so its conditioning on a set, is invariant under measurable equivalences.

A measurable equivalence preserves the uniform measure on the whole space.

Finite types #

A measurable space on a finite type with measurable singletons is discrete.

@[simp]

Every point in a finite space has mass 1 / |α| under its uniform measure.

The uniform measure of a predicate on a finite type is its normalized cardinality.

theorem ProbabilityTheory.lintegral_uniformOn_univ {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] [Fintype α] (f : α → ENNReal) :
∫⁻ (a : α), f a ∂uniformOn Set.univ = (∑ a : α, f a) / ↑(Fintype.card α)

Integrating over a finite uniform space averages the values of the integrand. The formula also holds for the empty space.

The uniform measure on a product of finite spaces is the product of their uniform measures. Thus the two coordinates are independent uniform draws.

Finite sets #

Under the uniform measure on a finite set, a point of the set has mass 1 / #s and a point outside it has mass zero.

theorem ProbabilityTheory.uniformOn_finset_apply_setOf {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] (s : Finset α) (p : α → Prop) [DecidablePred p] :
(uniformOn ↑s) {x : α | p x} = ↑(Finset.filter p s).card / ↑s.card

The uniform measure on a finite set gives a predicate the fraction of the set that satisfies it.

Invariance under injective maps and bijections #

A measurable map injective on s carries the uniform measure on s to the uniform measure on the image of s. When s is infinite, both measures are zero.

Pushing the uniform measure on the whole space through a measurable bijection gives the uniform measure on its codomain. Only forward measurability is needed.

An equivalence of countable types carries the uniform measure on its domain to the uniform measure on its codomain. Countability with measurable singletons makes the equivalence measurable.