Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Chain law from an initial distribution, sample averages, and the CLT property

Definition
MarkovChainPathMeasure

by Shuze Chen · Aug 15, 2026 · Mathlib c5ea003 (Lean v4.30.0)

markov-chainsmcmcprobability

Three notions used throughout the mission, for a transition kernel PPP on a state space X\mathsf{X}X.

(i) The law of the chain: for an initial distribution λ\lambdaλ, the probability measure on the path space XN\mathsf{X}^{\mathbb{N}}XN under which the coordinate at time 000 has law λ\lambdaλ and transitions are governed by PPP (the Ionescu–Tulcea construction).

(ii) The sample average of a function f:X→Rf : \mathsf{X} \to \mathbb{R}f:X→R along the first nnn steps of a path:

fˉn  =  1n∑i=1nf(Xi),\bar f_n \;=\; \frac{1}{n} \sum_{i=1}^{n} f(X_i),fˉ​n​=n1​i=1∑n​f(Xi​),

the initial state X0X_0X0​ not included, matching the source.

(iii) The central limit theorem property of the chain (P,π)(P, \pi)(P,π) and functional fff: there exists an asymptotic variance σ2≥0\sigma^2 \ge 0σ2≥0 such that for every initial distribution λ\lambdaλ,

n (fˉn−Eπf)→dN(0,σ2)(n→∞).\sqrt{n}\,\bigl(\bar f_n - E_\pi f\bigr) \xrightarrow{d} N(0, \sigma^2) \qquad (n \to \infty).n​(fˉ​n​−Eπ​f)d​N(0,σ2)(n→∞).

The CLT property is the shared conclusion of the drift-condition theorems, the five corollaries, and the goal theorem of the mission.

Formalization Note The chain law is built by composing the platform's existing Markov-chain trajectory kernel (from the Gittins mission's Ionescu–Tulcea infrastructure) with the initial distribution. Convergence in distribution is weak convergence of laws; N(0,0)N(0,0)N(0,0) is read as the point mass at 000. In the CLT property the existential quantifier over σ2\sigma^2σ2 comes first, so one variance is shared by all initial distributions.

Definition code
import Definitions.Def_MarkovChainKernel
import Mathlib.Probability.Kernel.Composition.MeasureComp
import Mathlib.MeasureTheory.Function.ConvergenceInDistribution
import Mathlib.Probability.Distributions.Gaussian.Real

/-!
The law of a time-homogeneous Markov chain started from an initial
distribution, sample averages of a functional along the chain, and the Markov
chain central limit theorem property.

Source: Galin L. Jones, *On the Markov Chain Central Limit Theorem*,
Probability Surveys 1 (2004) 299-320 (arXiv math/0409112v2), §1: the sample
average `f̄_n` (Section 1) and the CLT of eq. (1).

Builds on the platform's Ionescu-Tulcea infrastructure
(`BanditAlgorithm.markovChainKernel`, itself built on
`BanditAlgorithm.markovChainStep` and `ProbabilityTheory.Kernel.traj`).
-/

open MeasureTheory ProbabilityTheory Filter
open scoped NNReal

namespace MarkovChainCLT

/-- The law of the trajectory `(X₀, X₁, X₂, …)` of the time-homogeneous Markov chain
with transition kernel `P` and **initial distribution** `lam` (coordinate `0` has law
`lam`), as a measure on the path space `ℕ → X`.  Built from the platform's
Ionescu-Tulcea infrastructure: `BanditAlgorithm.markovChainKernel P` is the kernel
sending a starting point to the law of the trajectory from that point. -/
noncomputable def chainMeasure {X : Type*} [MeasurableSpace X] (P : Kernel X X)
    [IsMarkovKernel P] (lam : Measure X) : Measure (ℕ → X) :=
  (BanditAlgorithm.markovChainKernel P) ∘ₘ lam

instance chainMeasure.instIsProbabilityMeasure {X : Type*} [MeasurableSpace X]
    (P : Kernel X X) [IsMarkovKernel P] (lam : Measure X) [IsProbabilityMeasure lam] :
    IsProbabilityMeasure (chainMeasure P lam) :=
  inferInstanceAs (IsProbabilityMeasure ((BanditAlgorithm.markovChainKernel P) ∘ₘ lam))

/-- The sample average `f̄_n = n⁻¹ ∑_{i=1}^n f(X_i)` of a functional `f` along the
first `n` steps of a trajectory `ω` (the initial point `ω 0` is not included,
matching Jones 2004, Section 1). -/
noncomputable def sampleAvg {X : Type*} (f : X → ℝ) (n : ℕ) (ω : ℕ → X) : ℝ :=
  (n : ℝ)⁻¹ * ∑ i ∈ Finset.range n, f (ω (i + 1))

/-- `SatisfiesCLT P π f` says: there is an asymptotic variance `v ≥ 0` such that for
**every** initial distribution `lam`, under the chain law started from `lam`,
`√n (f̄_n - E_π f)` converges in distribution to `N(0, v)` (Jones 2004 eq. (1); the
degenerate case `v = 0` means convergence to the point mass at `0`). -/
def SatisfiesCLT {X : Type*} [MeasurableSpace X] (P : Kernel X X) [IsMarkovKernel P]
    (π : Measure X) (f : X → ℝ) : Prop :=
  ∃ v : ℝ≥0, ∀ (lam : Measure X) [IsProbabilityMeasure lam],
    TendstoInDistribution
      (fun (n : ℕ) (ω : ℕ → X) => Real.sqrt n * (sampleAvg f n ω - ∫ x, f x ∂π))
      atTop (id : ℝ → ℝ) (fun _ => chainMeasure P lam) (gaussianReal 0 v)

end MarkovChainCLT
Source
G. L. Jones, "On the Markov Chain Central Limit Theorem", Probability Surveys 1 (2004) 299-320, arXiv math/0409112v2, Section 1 (arXiv v2 pp. 1-2), eq. (1)
Read-back

What the Lean code literally says, in plain math · claude-fable-5

chainMeasure — For a measurable type XXX, a kernel PPP from XXX to XXX assumed (typeclass) to be a Markov kernel (each P(x,⋅)P(x,\cdot)P(x,⋅) a probability measure), and an arbitrary measure λ\lambdaλ on XXX (not assumed to be a probability measure in this definition), chainMeasure P λ\mathrm{chainMeasure}\,P\,\lambdachainMeasurePλ is the measure on the sequence space N→X\mathbb{N} \to XN→X obtained by composing the kernel markovChainKernel P\mathrm{markovChainKernel}\,PmarkovChainKernelP with λ\lambdaλ: the measure B↦∫(markovChainKernel P)(x)(B) dλ(x)B \mapsto \int (\mathrm{markovChainKernel}\,P)(x)(B)\, d\lambda(x)B↦∫(markovChainKernelP)(x)(B)dλ(x). Unfolding the imported declaration: markovChainKernel P\mathrm{markovChainKernel}\,PmarkovChainKernelP is the Ionescu–Tulcea trajectory kernel built from the step kernels which map a finite history (ω0,…,ωn)(\omega_0,\dots,\omega_n)(ω0​,…,ωn​) (a function on {0,…,n}\{0,\dots,n\}{0,…,n}) to the measure P(ωn,⋅)P(\omega_n,\cdot)P(ωn​,⋅) — the next state depends only on the last coordinate, through PPP — precomposed with the map sending xxx to the one-point time-000 history with value xxx; an accompanying lemma identifies (markovChainKernel P)(x)(\mathrm{markovChainKernel}\,P)(x)(markovChainKernelP)(x) with the trajectory measure started from δx\delta_xδx​. Concretely, (markovChainKernel P)(x)(\mathrm{markovChainKernel}\,P)(x)(markovChainKernelP)(x) is the probability measure on N→X\mathbb{N} \to XN→X under which coordinate 000 equals xxx almost surely and, for each nnn, the conditional law of coordinate n+1n+1n+1 given coordinates 0,…,n0,\dots,n0,…,n is P(ωn,⋅)P(\omega_n,\cdot)P(ωn​,⋅). So chainMeasure P λ\mathrm{chainMeasure}\,P\,\lambdachainMeasurePλ is this path law with the initial state integrated against λ\lambdaλ.

chainMeasure.instIsProbabilityMeasure — Under the same hypotheses (XXX measurable, PPP a Markov kernel), with the additional typeclass hypothesis that λ\lambdaλ is a probability measure, the declaration provides the fact that chainMeasure P λ\mathrm{chainMeasure}\,P\,\lambdachainMeasurePλ (the composition of the trajectory kernel with λ\lambdaλ, as unfolded above) is a probability measure on N→X\mathbb{N} \to XN→X.

sampleAvg — For an arbitrary type XXX (no σ-algebra needed here), an arbitrary function f:X→Rf : X \to \mathbb{R}f:X→R (no measurability assumed), n∈Nn \in \mathbb{N}n∈N, and a sequence ω:N→X\omega : \mathbb{N} \to Xω:N→X: sampleAvg f n ω=n−1∑i=0n−1f(ω(i+1))\mathrm{sampleAvg}\,f\,n\,\omega = n^{-1} \sum_{i=0}^{n-1} f(\omega(i+1))sampleAvgfnω=n−1∑i=0n−1​f(ω(i+1)), i.e., 1n(f(ω1)+⋯+f(ωn))\tfrac{1}{n}\bigl(f(\omega_1) + \dots + f(\omega_n)\bigr)n1​(f(ω1​)+⋯+f(ωn​)). Coordinate ω0\omega_0ω0​ is never used — the average runs over coordinates 111 through nnn. For n=0n = 0n=0 the sum is empty and the real inverse of 000 is 000 by convention, so the value is 000.

SatisfiesCLT — For a measurable type XXX, a kernel PPP on XXX assumed (typeclass) to be a Markov kernel, a measure π\piπ on XXX (completely arbitrary: not assumed to be a probability measure, finite, or invariant for PPP), and a function f:X→Rf : X \to \mathbb{R}f:X→R (no measurability or integrability assumed): the proposition that there exists v∈[0,∞)v \in [0,\infty)v∈[0,∞) (a nonnegative real; v=0v = 0v=0 is allowed) such that for every measure λ\lambdaλ on XXX that is a probability measure, the sequence of functions on path space Zn(ω)=n (sampleAvg f n ω−∫f dπ)Z_n(\omega) = \sqrt{n}\,\bigl(\mathrm{sampleAvg}\,f\,n\,\omega - \int f\,d\pi\bigr)Zn​(ω)=n​(sampleAvgfnω−∫fdπ) — where sampleAvg f n ω=n−1∑i=0n−1f(ω(i+1))\mathrm{sampleAvg}\,f\,n\,\omega = n^{-1}\sum_{i=0}^{n-1} f(\omega(i+1))sampleAvgfnω=n−1∑i=0n−1​f(ω(i+1)) (value 000 at n=0n=0n=0) and ⋅\sqrt{\cdot}⋅​ is the real square root — converges in distribution as n→∞n \to \inftyn→∞, each ZnZ_nZn​ taken under the single fixed measure chainMeasure P λ\mathrm{chainMeasure}\,P\,\lambdachainMeasurePλ (the path law of the chain with one-step kernel PPP and initial law λ\lambdaλ, as unfolded above), to the identity map on R\mathbb{R}R under the real Gaussian measure with mean 000 and variance vvv — i.e., the image laws of the ZnZ_nZn​ converge weakly to that Gaussian measure (v=0v = 0v=0 gives the Dirac mass at 000). Points to note: the quantifier order makes one single vvv work uniformly for all initial probability laws λ\lambdaλ; the centering constant is the Bochner integral ∫f dπ\int f\,d\pi∫fdπ, which equals 000 by convention when fff is not π\piπ-integrable; and since fff carries no measurability hypothesis, the ZnZ_nZn​ need not be almost-everywhere measurable, in which case their image laws are the zero measure by the pushforward convention.

Human review
  • Endorsed by Community (Bot) · Aug 15, 2026

  • Endorsed by Shuze Chen · Aug 15, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

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.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me