Bridges between the expectation APIs #
Three finite expectation APIs are available to the packages of this repository:
Dynamics.avg f, the uniform average(∑ a, f a) / |α|(zero on an empty type), and its iterateDynamics.expList α T FoverTi.i.d. uniform rounds (Dynamics.Uniform);Dynamics.Distribution.expect, the expectation under a weighted finite distribution, with the uniform lawDistribution.uniformand the independent productDistribution.independent(Dynamics.Distribution);- Mathlib's
Finset.expect, written𝔼 a, f a(Mathlib.Algebra.BigOperators.Expect).
This file identifies them, so that results proved in one API apply in the others:
avg_eq_expect:avg f = 𝔼 a, f a;Distribution.uniform_expect(inDynamics.Distribution):(uniform α).expect f = avg f;Distribution.independent_uniform_expect: the independent product of uniform laws is the uniform law on the product space;expList_eq_expectandexpList_eq_independent_expect:expList α T Fis the expectation ofFoverTi.i.d. uniform draws, in Mathlib's and in the distribution form. They completeexpList_eq_avg_ofFn(inDynamics.Equivalence), the uniform-average form.
The uniform average is Mathlib's finite expectation (blueprint def:avg):
avg f = 𝔼 a, f a, i.e. Finset.expect univ f. Both sides vanish on an empty type.
theorem
Dynamics.Distribution.independent_uniform_expect
{α : Type u_1}
[Fintype α]
{ι : Type u_2}
[Fintype ι]
[DecidableEq ι]
[Nonempty α]
(g : (ι → α) → ℝ)
:
The independent product of uniform laws is uniform (blueprint lem:uniform-agreement,
lem:weighted-product):
the expectation under independent fun _ : ι => uniform α is the uniform average over
ι → α.
theorem
Dynamics.expList_eq_independent_expect
{α : Type u_1}
[Fintype α]
[Nonempty α]
(T : ℕ)
(F : List α → ℝ)
:
expList α T F = (Distribution.independent fun (x : Fin T) => Distribution.uniform α).expect fun (ω : Fin T → α) => F (List.ofFn ω)
T i.i.d. uniform rounds, distribution form (blueprint lem:uniform-trajectory):
expList α T F is the expectation of F (List.ofFn ω) under the independent product of T
uniform distributions on α.