Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Chapter MeasurementLLN

Definition
ChapterMeasurementLLN

by leonardopedro · Oct 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

definitionsformalizationtimepiece

Formal definitions for the timepiece Lean 4 formalization (source chapter BookProof/ChapterMeasurementLLN.lean): generated def bundle for ChapterMeasurementLLN. See BookProof/ChapterMeasurementLLN.lean for full context.

Definition code
import Mathlib


/-!
# Chapter "Wave-function parametrization of a probability measure", §10
*"Ensemble forecasting …"* — measurements reproduce the probability distribution
in the limit of infinitely many measurements

This file formalizes the self-contained mathematical claim of the section
*"10. Ensemble forecasting allows the approximation of a non-linear
infinite-dimensional model …"* (`book.tex` line ~2005):

> *"a measurement is applying the Bayes rule to update a probability: destroy the
> uncertainty … by converting probabilities into events, unpredictably and
> **reproducing the probability distribution in the limit of infinite
> measurements**. … It is not different from an unbiased sampling process taken
> over infinite time."*

The precise mathematical statement is the **strong law of large numbers** applied
to a (finite-outcome) measurement: if we repeat a measurement `M` — an i.i.d.
sequence of `Fin k`-valued random variables, each distributed like the physical
state being measured — then for every outcome `a` the **empirical frequency** of
`a` over the first `n` measurements,

`freqₙ(a) = (number of i < n with Mᵢ = a) / n`,

converges *almost surely*, as `n → ∞`, to the true probability of that outcome,
`ℙ(M₀ = a)`.  In other words, an infinite sequence of measurements reproduces the
probability distribution of the state, exactly as the book asserts.

## Deliverables

* `outcomeIndicator` — the `{0,1}`-valued indicator of the event "`Mᵢ = a`".
* `outcomeIndicator_integral` — its expectation is the outcome probability,
  `∫ outcomeIndicator M a 0 = (ℙ(M₀ = a)).toReal`.
* `measurement_average_tendsto` — the general real-observable version (the
  "unbiased sampling over infinite time" statement): the running average of an
  observable `f ∘ Mᵢ` tends a.s. to its expectation `𝔼[f ∘ M₀]`.
* `measurement_frequency_tendsto` — the headline: for i.i.d. measurements the
  empirical frequency of every outcome `a` tends almost surely to the outcome
  probability `(ℙ(M₀ = a)).toReal`.

Everything here is `sorry`-free and `axiom`-free (only `propext`,
`Classical.choice`, `Quot.sound`).
-/

open MeasureTheory ProbabilityTheory
open scoped ENNReal

namespace BookProof.ChapterMeasurementLLN

variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
variable {k : ℕ}

/-- The `{0,1}`-valued indicator of the measurement outcome "`Mᵢ = a`",
i.e. the observable that returns `1` when the `i`-th measurement yields outcome
`a` and `0` otherwise. -/
noncomputable def outcomeIndicator (M : ℕ → Ω → Fin k) (a : Fin k) (i : ℕ) : Ω → ℝ :=
  fun ω => if M i ω = a then (1 : ℝ) else 0







end BookProof.ChapterMeasurementLLN
Source
https://github.com/leonardopedro/timepiece/blob/61595bc/BookProof/ChapterMeasurementLLN.lean

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me