Base camp: a two-state average you can finish by hand

Let the state space be \(\Omega=\{a,b\}\). One deterministic update swaps the states:

\[ T(a)=b,\qquad T(b)=a. \]

An observable is a function that assigns a reading to each state. Take

\[ g(a)=0,\qquad g(b)=2. \]

Starting at \(a\), the readings are \(0,2,0,2,\ldots\). Starting at \(b\), they are \(2,0,2,0,\ldots\). Write \(S_n^g(x)\) for the sum of the first \(n\) readings from \(x\), and \(A_n^g(x)=S_n^g(x)/n\) for \(n\gt0\). Lean’s totalized convention also sets \(A_0^g(x)=0\).

The first values are completely explicit:

horizon \(n\)\(0\)\(1\)\(2\)\(3\)\(4\)\(5\)\(6\)\(7\)\(8\)
\(A_n^g(a)\)\(0\)\(0\)\(1\)\(2/3\)\(1\)\(4/5\)\(1\)\(6/7\)\(1\)
\(A_n^g(b)\)\(0\)\(2\)\(1\)\(4/3\)\(1\)\(6/5\)\(1\)\(8/7\)\(1\)

The table suggests a limit, but a finite table cannot prove one. The formulas for every \(k\ge1\) do:

\[ \begin{aligned} A_{2k}^g(a)&=A_{2k}^g(b)=1,\\ A_{2k+1}^g(a)&=\frac{2k}{2k+1}\longrightarrow1,\\ A_{2k+1}^g(b)&=\frac{2k+2}{2k+1}\longrightarrow1. \end{aligned} \]

Both possible starts therefore have convergent averages with limit \(1\). The convergence event is the set of starting states whose full average sequence tends to some finite real number. For this model, it is the whole state space:

\[ E(T,g)=\{a,b\}=\Omega. \]

That is a direct every-point calculation. It does not use ergodicity to choose a branch of a dichotomy.

On the two-state swap with readings zero and two, the totalized averages from a through horizon eight are zero, zero, one, two thirds, one, four fifths, one, six sevenths, one. From b they are zero, two, one, four thirds, one, six fifths, one, eight sevenths, one. A uniform-measure ledger shows finite sums and averages are measurable and integrable. Exact five-term prefix arithmetic removes and restores the first reading. Even averages equal one, and odd averages tend to one.
FigureFinding: the exact formulas \(A_{2k}(a)=A_{2k}(b)=1\), \(A_{2k+1}(a)=2k/(2k+1)\), and \(A_{2k+1}(b)=(2k+2)/(2k+1)\) prove convergence to \(1\) from both starts. Under the uniform probability measure, every subset is measurable and every finite real-valued function is integrable; the displayed absolute integrals are \(0,1,2,3,4\) for the sums and \(0,1,1,1,1\) for the averages at horizons zero through four. The prefix equations are exact toy arithmetic, not sampled data or a general convergence theorem.

A finite-horizon measurability and integrability ledger

Give \(\Omega\) its full power-set measurable space and the uniform probability measure \(\mu(\{a\})=\mu(\{b\})=1/2\). Every subset is measurable, so every function from this two-point space to \(\mathbb R\) is a measurable function . Every such function with finite values is also integrable .

Here is the complete finite ledger through horizon four:

| \(n\) | \((S_n(a),S_n(b))\) | \((A_n(a),A_n(b))\) | \(\int |S_n|\,d\mu\) | \(\int |A_n|\,d\mu\) | measurable? | integrable? | |—:|—:|—:|—:|—:|—:|—:| | \(0\) | \((0,0)\) | \((0,0)\) | \(0\) | \(0\) | yes | yes | | \(1\) | \((0,2)\) | \((0,2)\) | \(1\) | \(1\) | yes | yes | | \(2\) | \((2,2)\) | \((1,1)\) | \(2\) | \(1\) | yes | yes | | \(3\) | \((2,4)\) | \((2/3,4/3)\) | \(3\) | \(1\) | yes | yes | | \(4\) | \((4,4)\) | \((1,1)\) | \(4\) | \(1\) | yes | yes |

The general Lean theorems mirror this elementary ledger. Measurability of \(T\) and \(g\) makes every finite sum and average measurable. Measure preservation plus integrability of \(g\) makes every finite sum and average integrable. Those are finite-horizon statements; they do not yet discuss a limit.

Delete one reading, then restore it

The basic prefix identity is

\[ S_{n+1}^g(\omega)=g(\omega)+S_n^g(T\omega). \]

For \(n=4\) and \(\omega=a\), every number is visible:

\[ S_5^g(a)=g(a)+S_4^g(Ta)=0+S_4^g(b)=0+4=4. \]

Normalize and solve in either direction:

\[ \begin{aligned} A_4^g(Ta) &=\frac54A_5^g(a)-\frac{g(a)}4 =\frac54\frac45-0=1,\\ A_5^g(a) &=\frac{g(a)}5+\frac45A_4^g(Ta) =0+\frac45\cdot1=\frac45. \end{aligned} \]

The first line deletes the initial reading; the second restores it. For a general fixed value \(g(\omega)\), its normalized contribution is divided by a growing horizon and tends to zero. That is the mechanism behind the same-limit theorem later in the chapter.

A deterministic near miss: bounded readings need not settle

Now use a separate state space \(\Omega=\mathbb N\), the shift \(T(k)=k+1\), and a bounded zero-one observable. Set \(g(0)=0\). For \(m\ge0\), put

\[ g(k)= \begin{cases} 1,&10^m\le k\lt10^{m+1}\text{ and }m\text{ is even},\\ 0,&10^m\le k\lt10^{m+1}\text{ and }m\text{ is odd}. \end{cases} \]

Thus the values are \(1\) on \(1,\ldots,9\), \(0\) on \(10,\ldots,99\), \(1\) on \(100,\ldots,999\), and so on. At the first four decimal endpoints:

horizon \(N\)number of ones below \(N\)\(A_N^g(0)\)
\(10\)\(9\)\(9/10=0.9\)
\(100\)\(9\)\(9/100=0.09\)
\(1000\)\(909\)\(909/1000=0.909\)
\(10000\)\(909\)\(909/10000=0.0909\)

For \(r\ge0\), the number of ones below both \(10^{2r+1}\) and \(10^{2r+2}\) is

\[ 9\sum_{j=0}^{r}100^j=\frac{100^{r+1}-1}{11}. \]

Dividing by the two different horizons gives

\[ A_{10^{2r+1}}^g(0)\longrightarrow\frac{10}{11}, \qquad A_{10^{2r+2}}^g(0)\longrightarrow\frac{1}{11}. \]

One sequence cannot converge to two distinct real limits. Hence \(0\notin E(T,g)\). The readings are bounded; the failure comes from successively longer blocks pulling the running mean into two different camps. No measure has been introduced, so this example does not contradict a pointwise ergodic theorem. It only proves that the event definition alone cannot supply membership.

For the natural-number shift, a bounded zero-one observable alternates on growing decimal blocks. The endpoint averages are nine tenths, nine hundredths, nine hundred nine thousandths, and nine hundred nine ten-thousandths. The odd decimal endpoint subsequence tends to ten elevenths, while the even decimal endpoint subsequence tends to one eleventh, so the average sequence does not converge.
FigureFinding: the ones count below \(10^{2r+1}\) and \(10^{2r+2}\) is \((100^{r+1}-1)/11\). The two normalizations force distinct subsequential limits \(10/11\) and \(1/11\), so the start \(0\) is outside the convergence event. The block widths are drawn equally for readability and are explicitly not to scale. This is a designed deterministic teaching model, not empirical data and not the rising-observable boundary probe compiled in the project source.

Why formalize the event before proving a pointwise theorem?

There is a seductive but invalid shortcut in ergodic formalization. Define the set where the averages converge, prove that the set is invariant, invoke ergodicity, and then speak as if convergence had been established almost everywhere. Ergodicity does not justify that last step. It says an invariant measurable event is trivial up to null sets. The trivial event may be the empty one.

Random-matrix-theory milestone 22 (RMT-22) formalizes everything in that sentence except the shortcut. It starts with Mathlib’s finite birkhoffSum and birkhoffAverage, supplies their missing real measurability and finite integrability lemmas, defines the convergence event, transports that event across almost-everywhere representatives, proves a boundedness-free finite-prefix equivalence, and derives conditional ergodic dichotomies. It also compiles a divergent example, making it impossible to mistake the event definition for an existence theorem.

The compact term page is Birkhoff convergence event . The declaration-complete implementation narrative is Birkhoff Convergence Events and Ergodic Rigidity in Lean. The finite combinatorial predecessor is Finite Ordered Interval Packing for Nonpositive Subadditive Processes.

Choose a route up

RouteBeginDestination
First encounterA two-state averageCompute a convergent orbit and its finite measure ledger
Boundary routeA deterministic near missProve bounded deterministic nonconvergence from two subsequences
Finite routeThe object below every asymptotic theoremRebuild sums and totalized averages
Event routeConvergence becomes a subsetUnderstand membership without existence
Measure routeOrdinary measurability gives a measurable eventSeparate measurable from null measurable
Representative routeAn integrable observable is only measurable almost everywhereFollow the measurable representative safely
Shift routeDelete one finite prefix without boundednessProve the same-limit equivalence
Rigidity routeTwo ergodic routes, two precise receiversDistinguish pre-ergodic and quasi-ergodic paths
Lean translation routeSeven Lean bridgesMatch spoken mathematics, notation, and exact project names
Hands-on routeRun the worksheetExecute the finite swap and decimal-block checks with only Std
Project routeThin wrappers should keep thin premisesRead candidate and cocycle specializations
Lean routeThe complete thirty-seven-declaration ledgerAudit every public name
Source boundary routeModels that test the API boundaryTest zero time, zero measure, and the compiled rising-observable divergence
Summit routeThe existence theorem RMT-22 leaves openLocate the exact analytic gap and the later project module that closes it

Learning objectives

By the summit, a reader should be able to:

  1. define a finite Birkhoff sum and average with the correct zero-based range;
  2. explain why Mathlib’s time-zero average is totalized to zero;
  3. prove finite measurability from measurable iterates and finite sums;
  4. prove finite integrability from preservation and one-step integrability;
  5. define the convergence event without asserting membership;
  6. state why a real convergence event is measurable for a measurable sequence;
  7. distinguish ordinary measurability, almost-everywhere measurability, and null measurability;
  8. explain why integrability does not upgrade the supplied representative to ordinary measurability;
  9. construct an ordinarily measurable representative with AEMeasurable.mk;
  10. state where quasi-measure preservation enters representative transport;
  11. explain the countable all-horizon intersection behind event congruence;
  12. derive both positive-index finite-prefix identities;
  13. prove convergence at \(\omega\) implies convergence at \(T\omega\) to the same limit;
  14. prove the converse without assuming that \(T\) is invertible;
  15. deduce exact preimage invariance of the event;
  16. distinguish preimage invariance from image invariance;
  17. explain why ordinary measurable rigidity needs only PreErgodic;
  18. explain why the representative-safe path uses QuasiErgodic;
  19. derive a probability zero-one corollary from an almost-everywhere dichotomy;
  20. explain why zero-measure rigidity is formally valid and informationally vacuous;
  21. interpret the candidate one-step event without assuming anything about \(X_0\);
  22. interpret the matrix-cocycle wrapper without generator integrability;
  23. explain why the empty matrix index needs no special exclusion;
  24. reproduce the divergent successor-orbit example;
  25. classify each of the thirty-seven public declarations by proof layer;
  26. state the common axiom footprint of the high-level theorems;
  27. distinguish event rigidity from convergence existence;
  28. state what a pointwise ergodic theorem would add;
  29. explain why this milestone does not complete Kingman’s theorem;
  30. identify the next analytic dependencies without overclaiming them;
  31. derive the even and odd average formulas for the two-state swap;
  32. prove decimal-block nonconvergence from the limits \(10/11\) and \(1/11\);
  33. run the byte-identical standalone Std worksheet on a normal macOS or Linux machine; and
  34. distinguish all thirty-seven public declarations from the imported helper APIs and twelve anonymous source probes.

The common setup and notation ledger

Let:

  • \(\Omega\) be a type equipped with a measurable space;
  • \(\mu\) be a measure on \(\Omega\);
  • \(T:\Omega\to\Omega\) be a discrete-time map;
  • \(T^j\) be its \(j\)-fold iterate;
  • \(g,h:\Omega\to\mathbb R\) be real observables;
  • \(n\in\mathbb N\) be a finite horizon;
  • \(\omega\in\Omega\) be a starting point; and
  • \(A_n^g(\omega)\) denote the real Birkhoff average of \(g\) along the first \(n\) orbit positions of \(\omega\).

The almost-everywhere equality

\[ g=h\quad\mu\text{-almost everywhere} \]

means that the set of points where the two functions differ has \(\mu\)-measure zero. The notation \(E=F\) almost everywhere for sets means their membership predicates agree outside a μ-null set. The almost everywhere glossary entry gives the foundational distinction from pointwise equality.

The object below every asymptotic theorem

Mathlib defines the finite Birkhoff sum by

\[ S_n^g(\omega) {} = \sum_{\substack{j\in\mathbb N\\j\lt n}} g\bigl(T^j\omega\bigr). \]

The finite set Finset.range n contains \(0,1,\ldots,n-1\). Thus \(S_0^g=0\), \(S_1^g(\omega)=g(\omega)\), and

\[ S_{n+1}^g(\omega)=S_n^g(\omega)+g(T^n\omega). \]

The alternative successor law peels from the other end:

\[ S_{n+1}^g(\omega)=g(\omega)+S_n^g(T\omega). \]

The finite average is

\[ A_n^g(\omega)=n^{-1}S_n^g(\omega). \]

Lean works in a division semiring where inversion is total. Consequently \(0^{-1}=0\) and \(A_0^g=0\). This is a useful API convention: formulas have a value at every natural horizon. It is not evidence about the value of a different process \(X_0\), and it cannot turn a positive-time argument into a time-zero theorem.

Finite measurability

Assume \(T\) and \(g\) are measurable. The proof of measurable_birkhoffSum follows the displayed sum literally:

  1. hT.iterate j makes every finite iterate measurable;
  2. hg.comp makes \(g\circ T^j\) measurable; and
  3. Finset.measurable_sum closes the finite sum.

The average is a constant multiple of the sum, so measurable_birkhoffAverage needs no new dynamics. These theorems use neither \(\mu\) nor preservation.

Finite integrability

Assume instead that \(T\) preserves \(\mu\) and \(g\) is integrable. Every iterate \(T^j\) also preserves \(\mu\). Mathlib’s MeasurePreserving.integrable_comp_of_integrable therefore makes \(g\circ T^j\) integrable. A finite sum of integrable functions is integrable, and scalar multiplication gives the average theorem.

No finite-measure or probability typeclass is needed. Preservation, not probability, is what moves integrability along the orbit.

Convergence becomes a subset

Define

\[ E(T,g) {} = \left\{\omega:\exists c\in\mathbb R, A_n^g(\omega)\longrightarrow c\right\}. \]

This definition packages a property of a whole sequence into a set. It has three deliberate features.

First, the limit is existential. The event asks whether there is some finite real limit, not whether the limit equals a chosen constant. Second, the target is the real line. A sequence tending to positive infinity is outside the event. Third, membership is pointwise. Measure theory enters only when one asks whether the set is measurable or how large it is.

The simp theorem mem_birkhoffConvergenceSet_iff is definitionally true, but its public name matters. It gives rewriting tools a stable boundary and makes boundary probes readable.

The logical direction must remain visible:

\[ \text{define }E \quad\not\Rightarrow\quad \exists\omega,\ \omega\in E. \]

A set-builder expression can define the set of solutions to an impossible equation. Naming the set does not solve the equation.

Ordinary measurability gives a measurable event

Suppose each map \(\omega\mapsto A_n^g(\omega)\) is measurable. The real line is a completely metrizable second-countable space whose open sets are measurable. Mathlib’s MeasureTheory.measurableSet_exists_tendsto states that the set of points where a measurable sequence converges to some target point is measurable.

Applying it yields

\[ \operatorname{MeasurableSet}(E(T,g)). \]

This theorem consumes only ordinary measurability of \(T\) and \(g\). It does not consume a measure, so it cannot depend on probability, preservation, integrability, or ergodicity.

The proof is topological as well as measurable. Convergence to some real can be expressed through countably many accuracy and tail conditions. The second-countability and complete-metrizability hypotheses are the library’s general route to making that description measurable. RMT-22 reuses the general theorem instead of reconstructing a real-specific countable formula.

An integrable observable is only measurable almost everywhere

The raw function stored in an Integrable g μ proof need not be ordinarily measurable at every point. It is almost-everywhere strongly measurable. Since the target is real, that gives almost-everywhere measurability, but exceptional values remain possible.

The safe route begins one layer lower with

hg : AEMeasurable g μ

Mathlib’s representative API constructs hg.mk g, an ordinarily measurable function equal to \(g\) almost everywhere. Call it \(\widetilde g\). The event \(E(T,\widetilde g)\) is measurable by the preceding section. To transfer that fact back to \(E(T,g)\), one must prove the two events agree almost everywhere.

Why quasi-measure preservation appears

From \(g=\widetilde g\) almost everywhere, it does not follow for an arbitrary map \(T\) that

\[ g(T^j\omega)=\widetilde g(T^j\omega) \]

almost everywhere. The exceptional set is pulled back by \(T^j\). A quasi-measure-preserving self-map sends null sets to null preimages, which is exactly the property needed.

Mathlib already proves fixed-horizon transport:

\[ A_n^g=A_n^{\widetilde g} \qquad\text{almost everywhere} \]

for each \(n\). Event convergence depends on every \(n\), so RMT-22 takes the countable intersection of these almost-everywhere facts with ae_all_iff. Outside one null set, the two entire sequences agree term by term. They therefore converge to exactly the same finite limits.

This gives

\[ E(T,g)=E(T,\widetilde g) \qquad\text{almost everywhere}. \]

The event for \(g\) is consequently null measurable. It agrees almost everywhere with an ordinarily measurable event, but RMT-22 never claims the raw representative’s event is itself ordinarily measurable.

An almost-everywhere measurable observable is replaced by an ordinary measurable representative. Quasi-measure preservation transports equality through every finite orbit horizon. Countable all-horizon agreement then makes the two convergence events equal almost everywhere, so the raw event is null measurable.
FigureFinding: the representative argument has four separate bridges. Almost-everywhere measurability supplies an ordinary representative; quasi-measure preservation protects null exceptions under orbit pullback; a countable all-horizon intersection upgrades fixed-horizon equality to equality of complete average sequences; and event congruence transfers null measurability back to the original observable. Integrability is only one sufficient source of almost-everywhere measurability.

Three public interfaces, one proof core

RMT-22 exposes:

  • nullMeasurableSet_birkhoffConvergenceSet_of_aemeasurable;
  • nullMeasurableSet_birkhoffConvergenceSet_of_aestronglyMeasurable; and
  • nullMeasurableSet_birkhoffConvergenceSet_of_integrable.

These are top-level theorem names, not declarations placed inside the Integrable namespace as though they were upstream methods. The suffix records the premise through which each corollary enters. The primary mathematics lives in the almost-everywhere-measurable theorem.

Delete one finite prefix without boundedness

The event is invariant because passing from \(\omega\) to \(T\omega\) deletes the first orbit value. A finite prefix cannot affect convergence of normalized averages, but formalizing that sentence requires exact coefficient control.

For every \(n\in\mathbb N\), RMT-22 proves

\[ A_{n+1}^g(T\omega) {} = \frac{n+2}{n+1}A_{n+2}^g(\omega) -\frac{g(\omega)}{n+1}. \]

If \(A_n^g(\omega)\to c\), then the shifted subsequence \(A_{n+2}^g(\omega)\to c\). The first coefficient tends to one and the final correction tends to zero. Hence \(A_n^g(T\omega)\to c\).

The converse identity is

\[ A_{n+2}^g(\omega) {} = \frac{g(\omega)}{n+2} +\frac{n+1}{n+2}A_{n+1}^g(T\omega). \]

If the shifted averages converge to \(c\), the correction again vanishes and the coefficient again tends to one. Thus the original averages converge to the same \(c\).

Why the formulas start at positive indices

The denominators are \(n+1\) and \(n+2\), so they are nonzero. Writing the identities directly at index \(n\) would force a separate positive-horizon premise or invite a vacuous time-zero division. The successor form keeps the useful theorem total in \(n\) while every displayed denominator remains positive.

Why no boundedness premise is needed

Mathlib already contains exact shifted-difference identities and boundedness-based convergence results under bounded-orbit or global boundedness hypotheses. RMT-22 does not claim that no shift API existed upstream. Its contribution is the boundedness-free same-limit equivalence obtained by solving the exact finite identities in both directions and taking limits.

The proof uses only real algebra and elementary sequence limits. It needs no measurability, measure, preservation, integrability, boundedness, or invertibility.

Exact preimage invariance, not image invariance

Combining both limit directions gives

\[ A_n^g(T\omega)\to c \quad\Longleftrightarrow\quad A_n^g(\omega)\to c. \]

Existentially quantify \(c\). Pointwise membership then satisfies

\[ T\omega\in E(T,g) \quad\Longleftrightarrow\quad \omega\in E(T,g). \]

This is exactly the set equality

\[ T^{-1}(E(T,g))=E(T,g). \]

The theorem is stronger than almost-everywhere invariance and weaker than an image statement. If \(T\) is constant on a two-point space, it is not injective, yet the preimage equation remains valid. No inverse is constructed.

One must not rewrite the result as \(T(E)=E\). Image equality can fail for a nonsurjective map because points outside the image have no predecessor. The formal module makes no image-invariance declaration.

The orbit from a starting point and the orbit after one base-map step differ by one deleted value. Two arrows show convergence to the same finite limit in both directions. The shared convergence event then enters an ergodic fork with null and conull branches; the diagram stops at that unresolved fork.
FigureFinding: deleting or restoring one finite orbit prefix preserves the exact finite limit, so the convergence event is strictly preimage invariant even for a noninvertible map. Ergodic rigidity then leaves two branches, null or conull. A separate convergence-existence theorem is required to rule out the null branch. The plate shows logical dependence, not a proof of the pointwise ergodic theorem.

Two ergodic routes, two precise receivers

Mathlib separates pre-ergodicity, quasi-ergodicity, and ergodicity.

  • PreErgodic T μ says ordinarily measurable strictly invariant sets are almost everywhere empty or full.
  • QuasiErgodic T μ adds quasi-measure preservation and supports null-measurable, almost-invariant sets.
  • Ergodic T μ adds full measure preservation to the same pre-ergodic core.

The ordinarily measurable event and its exact preimage equation need only the first receiver:

\[ \operatorname{PreErgodic}(T,\mu) \quad\Longrightarrow\quad E(T,g)=\varnothing\ \text{a.e.} \ \text{or}\ E(T,g)=\Omega\ \text{a.e.} \]

provided the event’s measurability is supplied.

The representative-safe event may be only null measurable. Its generic rigidity theorem therefore takes QuasiErgodic T μ. Exact invariance is converted to almost-everywhere invariance, and Mathlib’s QuasiErgodic.ae_empty_or_univ₀ closes the dichotomy.

An ordinary ergodic map can enter through hT.quasiErgodic. Keeping the generic receiver weak makes the dependency visible instead of baking a stronger project-specific assumption into the theorem.

Probability converts conull to the number one

Under [IsProbabilityMeasure μ], the full space has measure one. An almost-everywhere-empty event has measure zero, while an almost-everywhere-full event has measure one. RMT-22 therefore derives

\[ \mu(E(T,g))=0\quad\text{or}\quad\mu(E(T,g))=1. \]

Probability does not create the dichotomy. Ergodic rigidity creates it; probability converts the full branch into the numeral one.

The zero-measure boundary

Every measurable map is quasi-ergodic for the zero measure. Every two sets are equal almost everywhere for that measure. The null-or-conull result therefore compiles for every observable, but it carries no information about pointwise membership. RMT-22 includes this probe because it exposes the difference between a valid almost-everywhere proposition and a substantive probability statement.

In Lean: seven bridges from the ledger to conditional rigidity

Each bridge presents one idea in spoken mathematics, paper notation, and exact project syntax. The first two concern one finite horizon. The next three build and shift the convergence event. The final two state exact invariance and its conditional measure-theoretic consequences.

Bridge 1: name one finite orbit average

One idea, three languages Read across, then read the syntax map
A human says
Average the first n readings of g along the orbit that starts at omega.
On paper
\(A_n^g(\omega)=n^{-1}\sum_{j=0}^{n-1}g(T^j\omega).\)
In Lean
birkhoffAverage ℝ T g n ω
Syntax map
  • birkhoffAverage is Mathlib’s total finite-average definition.
  • The first argument ℝ chooses real scalar normalization.
  • T is the update map, g is the observable, n is the horizon, and ω is the start.
  • Internally, birkhoffSum T g n ω sums the indices in Finset.range n, namely \(0,\ldots,n-1\).
  • At n = 0, inverse zero is totalized to zero, so the displayed Lean term has value zero.

Bridge 2: state the finite measure ledger

One idea, three languages Read across, then read the syntax map
A human says
If T and g are measurable, then the horizon-n average is measurable; if T preserves the measure and g is integrable, that average is integrable.
On paper
\(\operatorname{Measurable}(T),\operatorname{Measurable}(g)\Rightarrow\operatorname{Measurable}(A_n^g)\), and \(\operatorname{MeasurePreserving}(T,\mu),g\in L^1(\mu)\Rightarrow A_n^g\in L^1(\mu).\)
In Lean
measurable_birkhoffAverage hT hg n
Syntax map
  • In the measurable call, hT : Measurable T and hg : Measurable g.
  • The integrable companion has exact name integrable_birkhoffAverage and is called as integrable_birkhoffAverage hT hg n with hT : MeasurePreserving T μ μ and hg : Integrable g μ.
  • The sum-level companions are measurable_birkhoffSum and integrable_birkhoffSum.
  • None of these four finite declarations states that a sequence converges.

Bridge 3: turn convergence into point membership

One idea, three languages Read across, then read the syntax map
A human says
The start omega is in the convergence event exactly when its full average sequence approaches some finite real number.
On paper
\(\omega\in E(T,g)\Longleftrightarrow\exists c\in\mathbb R,\ A_n^g(\omega)\to c.\)
In Lean
mem_birkhoffConvergenceSet_iff
Syntax map
  • birkhoffConvergenceSet T g is the set \(E(T,g)\).
  • ∃ c : ℝ in the theorem’s expanded type asks for a finite real limit witness.
  • Tendsto … atTop (nhds c) means that, as natural horizons grow, the average enters every neighborhood of c.
  • The theorem is a simp boundary for the definition. It does not manufacture a value of c or a member of the event.

Bridge 4: transport the event across representatives

One idea, three languages Read across, then read the syntax map
A human says
If g and h agree almost everywhere and T pulls null sets back to null sets, then their convergence events agree almost everywhere.
On paper
\(g=h\ \mu\text{-a.e.}\Longrightarrow E(T,g)=E(T,h)\ \mu\text{-a.e.}\)
In Lean
birkhoffConvergenceSet_ae_eq_of_ae_eq hT hgh
Syntax map
  • hT : Measure.QuasiMeasurePreserving T μ μ protects a null exceptional set when the orbit repeatedly takes preimages.
  • hgh : g =ᵐ[μ] h is equality outside a \(\mu\)-null set.
  • The proof first obtains equality of every fixed-horizon average, then uses ae_all_iff to choose one conull set where all horizons agree.
  • The result is almost-everywhere equality of membership predicates, not literal equality of sets at every point.

Bridge 5: delete or restore one prefix without changing the limit

One idea, three languages Read across, then read the syntax map
A human says
The averages from omega converge to c exactly when the averages from the next point T omega converge to the same c.
On paper
\(A_n^g(T\omega)\to c\Longleftrightarrow A_n^g(\omega)\to c.\)
In Lean
tendsto_birkhoffAverage_apply_base_iff
Syntax map
  • The forward algebraic helper is birkhoffAverage_succ_apply_base: \(A_{n+1}(T\omega)=\frac{n+2}{n+1}A_{n+2}(\omega) -g(\omega)/(n+1)\).
  • The reverse helper is birkhoffAverage_succ_succ_apply.
  • The corresponding one-way limit theorems are tendsto_birkhoffAverage_apply_base and tendsto_birkhoffAverage_of_apply_base.
  • No inverse for T is used. The reverse implication restores the deleted value algebraically.

Bridge 6: express pointwise equivalence as exact set invariance

One idea, three languages Read across, then read the syntax map
A human says
A start belongs to the event if and only if its next orbit point belongs, so taking the preimage of the event changes nothing.
On paper
\(T^{-1}(E(T,g))=E(T,g).\)
In Lean
preimage_birkhoffConvergenceSet T g
Syntax map
  • T ⁻¹’ E is the set of starts whose next point lies in E.
  • The equality is exact, not merely almost everywhere.
  • No measurable-space, measure, preservation, injectivity, surjectivity, or boundedness premise occurs.
  • This is a preimage statement. It does not assert T ’’ E = E.

Bridge 7: keep rigidity and existence separate

One idea, three languages Read across, then read the syntax map
A human says
For an integrable observable and a quasi-ergodic base, the convergence event is almost everywhere empty or almost everywhere full.
On paper
\(E(T,g)=\varnothing\ \mu\text{-a.e.}\ \lor\ E(T,g)=\Omega\ \mu\text{-a.e.}\)
In Lean
birkhoffConvergenceSet_ae_empty_or_univ_of_integrable hg hT
Syntax map
  • hg : Integrable g μ supplies almost-everywhere strong measurability; it does not supply convergence.
  • hT : QuasiErgodic T μ supplies quasi-measure preservation and rigidity for null-measurable almost-invariant sets.
  • With [IsProbabilityMeasure μ], the separate corollary measure_birkhoffConvergenceSet_eq_zero_or_one_of_integrable concludes only \(\mu(E)=0\lor\mu(E)=1\).
  • Neither theorem chooses the full or measure-one branch. In the two-state example, the explicit even-and-odd formulas choose it. In general, a pointwise theorem or another membership argument must do so.

Try the exact declarations in the repository

Try it in the repository NonlinearDynamics/Random/RandomCocycles/BirkhoffConvergence.lean

The authoritative source is formalization/NonlinearDynamics/Random/RandomCocycles/BirkhoffConvergence.lean. For a full project check, put the following query block in a temporary project scratch file after installing the repository’s pinned dependencies:

import NonlinearDynamics.Random.RandomCocycles.BirkhoffConvergence

open MeasureTheory Set Filter
open NonlinearDynamics.Random.RandomCocycles

#check measurable_birkhoffSum
#check measurable_birkhoffAverage
#check integrable_birkhoffSum
#check integrable_birkhoffAverage
#check birkhoffConvergenceSet
#check mem_birkhoffConvergenceSet_iff
#check measurableSet_birkhoffConvergenceSet
#check birkhoffConvergenceSet_ae_eq_of_ae_eq
#check nullMeasurableSet_birkhoffConvergenceSet_of_aemeasurable
#check nullMeasurableSet_birkhoffConvergenceSet_of_aestronglyMeasurable
#check nullMeasurableSet_birkhoffConvergenceSet_of_integrable
#check birkhoffAverage_succ_apply_base
#check tendsto_birkhoffAverage_apply_base
#check birkhoffAverage_succ_succ_apply
#check tendsto_birkhoffAverage_of_apply_base
#check tendsto_birkhoffAverage_apply_base_iff
#check preimage_birkhoffConvergenceSet
#check birkhoffConvergenceSet_ae_empty_or_univ_of_measurableSet
#check birkhoffConvergenceSet_ae_empty_or_univ_of_nullMeasurableSet
#check birkhoffConvergenceSet_ae_empty_or_univ_of_aemeasurable
#check birkhoffConvergenceSet_ae_empty_or_univ_of_aestronglyMeasurable
#check birkhoffConvergenceSet_ae_empty_or_univ_of_integrable
#check measure_birkhoffConvergenceSet_eq_zero_or_one_of_measurableSet
#check measure_birkhoffConvergenceSet_eq_zero_or_one_of_nullMeasurableSet
#check measure_birkhoffConvergenceSet_eq_zero_or_one_of_aemeasurable
#check measure_birkhoffConvergenceSet_eq_zero_or_one_of_aestronglyMeasurable
#check measure_birkhoffConvergenceSet_eq_zero_or_one_of_integrable
#check oneStepBirkhoffConvergenceSet
#check IsIntegrableSubadditiveProcessCandidate.nullMeasurableSet_oneStepBirkhoffConvergenceSet
#check IsIntegrableSubadditiveProcessCandidate.preimage_oneStepBirkhoffConvergenceSet
#check IsIntegrableSubadditiveProcessCandidate.oneStepBirkhoffConvergenceSet_ae_empty_or_univ
#check IsIntegrableSubadditiveProcessCandidate.measure_oneStepBirkhoffConvergenceSet_eq_zero_or_one
#check DiscreteMatrixCocycle.generatorLogPlusBirkhoffConvergenceSet
#check DiscreteMatrixCocycle.measurableSet_generatorLogPlusBirkhoffConvergenceSet
#check DiscreteMatrixCocycle.preimage_generatorLogPlusBirkhoffConvergenceSet
#check DiscreteMatrixCocycle.generatorLogPlusBirkhoffConvergenceSet_ae_empty_or_univ
#check DiscreteMatrixCocycle.measure_generatorLogPlusBirkhoffConvergenceSet_eq_zero_or_one

The 37 checks follow the public declarations in source order. They query exact types; they do not create a theorem or rerun the examples by themselves.

Full project check, from the repository root
cd formalization
lake env lean -DwarningAsError=true NonlinearDynamics/Random/RandomCocycles/BirkhoffConvergence.lean

Resource note: this exact file uses the repository's pinned Lean and Mathlib dependencies. Initial project setup can require substantial disk space and build time. For a lightweight first step on macOS or Linux, use the page's standalone Lean-core or Std tutorial.

Type both ledgers yourself with Lean and Std

The next worksheet imports only Lean’s small Std library. It computes both starts of the two-state swap, checks the finite prefix identity, and computes the first four decimal-block endpoints with exact rational numbers. It does not import Mathlib, create a measure, or prove an infinite limit.

Save this exact text as /tmp/BirkhoffConvergenceTutorial.lean:

import Std

namespace BirkhoffConvergenceTutorial

inductive Point where
  | a
  | b
  deriving Repr, DecidableEq

def step : Point → Point
  | .a => .b
  | .b => .a

def observe : Point → Nat
  | .a => 0
  | .b => 2

def iterate : Nat → Point → Point
  | 0, p => p
  | n + 1, p => iterate n (step p)

def orbitValues (n : Nat) (p : Point) : List Nat :=
  (List.range n).map fun j => observe (iterate j p)

def orbitSum (n : Nat) (p : Point) : Nat :=
  (orbitValues n p).sum

def orbitAverage (n : Nat) (p : Point) : Rat :=
  if n = 0 then 0 else (orbitSum n p : Rat) / (n : Rat)

def decadeValueAux : Nat → Nat → Bool → Nat
  | 0, _, _ => 0
  | fuel + 1, n, oneBlock =>
      if n < 10 then
        if oneBlock then 1 else 0
      else
        decadeValueAux fuel (n / 10) (!oneBlock)

def decadeValue (n : Nat) : Nat :=
  if n = 0 then 0 else decadeValueAux (n + 1) n true

def decadeOnes (n : Nat) : Nat :=
  ((List.range n).map decadeValue).sum

def decadeAverage (n : Nat) : Rat :=
  if n = 0 then 0 else (decadeOnes n : Rat) / (n : Rat)

#eval orbitValues 8 .a
#eval orbitValues 8 .b
#eval (List.range 9).map fun n => (n, orbitSum n .a, orbitAverage n .a)
#eval (List.range 9).map fun n => (n, orbitSum n .b, orbitAverage n .b)
#eval (orbitSum 5 .a, observe .a + orbitSum 4 (step .a))
#eval (orbitAverage 4 (step .a),
  (5 : Rat) / 4 * orbitAverage 5 .a - (observe .a : Rat) / 4)
#eval [10, 100, 1000, 10000].map fun n =>
  (n, decadeOnes n, decadeAverage n)

example : orbitValues 8 .a = [0, 2, 0, 2, 0, 2, 0, 2] := by
  native_decide

example : orbitValues 8 .b = [2, 0, 2, 0, 2, 0, 2, 0] := by
  native_decide

example :
    (List.range 12).all (fun n =>
      orbitSum (n + 1) .a = observe .a + orbitSum n (step .a)) = true := by
  native_decide

example :
    [10, 100, 1000, 10000].map (fun n => decadeAverage n) =
      [9 / 10, 9 / 100, 909 / 1000, 909 / 10000] := by
  native_decide

end BirkhoffConvergenceTutorial

From the repository root or any other directory, type:

source "$HOME/.elan/env"
elan run leanprover/lean4:v4.32.0 lean \
  /tmp/BirkhoffConvergenceTutorial.lean

The byte-for-byte standard output is:

[0, 2, 0, 2, 0, 2, 0, 2]
[2, 0, 2, 0, 2, 0, 2, 0]
[(0, 0, 0),
 (1, 0, 0),
 (2, 2, 1),
 (3, 2, (2 : Rat)/3),
 (4, 4, 1),
 (5, 4, (4 : Rat)/5),
 (6, 6, 1),
 (7, 6, (6 : Rat)/7),
 (8, 8, 1)]
[(0, 0, 0),
 (1, 2, 2),
 (2, 2, 1),
 (3, 4, (4 : Rat)/3),
 (4, 4, 1),
 (5, 6, (6 : Rat)/5),
 (6, 6, 1),
 (7, 8, (8 : Rat)/7),
 (8, 8, 1)]
(4, 4)
(1, 1)
[(10, 9, (9 : Rat)/10), (100, 9, (9 : Rat)/100), (1000, 909, (909 : Rat)/1000), (10000, 909, (909 : Rat)/10000)]

The first two lists are the orbit readings. The next two ledgers contain \((n,S_n,A_n)\). The pair (4, 4) checks \(S_5(a)=g(a)+S_4(Ta)\), and (1, 1) checks the normalized delete-one-prefix identity. The final line reproduces every endpoint count and fraction in the nonconvergence table.

Standalone tutorial, suitable for a normal macOS or Linux machine. It imports only Std and never opens this project’s Mathlib dependency graph. This exact file and output were checked with the pinned Lean 4.32.0 toolchain. The full project declarations use the command in the preceding repository box.

Thin wrappers should keep thin premises

Integrable subadditive-process candidates

Let \(X:\mathbb N\to\Omega\to\mathbb R\) satisfy the RMT-17 candidate interface: every \(X_n\) is integrable and the family is shifted subadditive. RMT-22 defines

\[ E_1(T,X)=E(T,X_1). \]

The subadditive inequality is not used in the event definition, exact invariance, or one-step integrability extraction. The wrapper remains useful because it connects the project process to a standard event; the candidate package itself does not imply convergence.

The null-measurability wrapper takes the candidate and a quasi-measure-preserving map. The rigidity and zero-one wrappers take QuasiErgodic. They do not take a stronger Ergodic receiver merely because matrix-cocycle applications often have one.

The value \(X_0\) remains irrelevant. A compiled model sets \(X_0=1\) and \(X_n=0\) for positive \(n\) over the zero measure. It satisfies the candidate laws, and its one-step event is the whole space.

Discrete matrix cocycles

For a discrete matrix cocycle \(C\), define

\[ E_C {} = E\left(C.\mathrm{base}, \omega\mapsto\log^+\lVert C(1,\omega)\rVert_\infty\right). \]

The cocycle already stores measurability of its generator and preservation of its base. Earlier modules prove ordinary measurability of the one-step log-positive norm. Therefore \(E_C\) is ordinarily measurable, and exact preimage invariance is purely pointwise.

The rigidity wrapper takes only PreErgodic C.base μ. It does not require C.HasIntegrableGeneratorLogPlus, because no proof step uses integrability. It does not require Nonempty ι, because the empty-index matrix observable remains measurable and the event remains well-typed. An explicit ι := Empty probe calls both wrappers without an hC hypothesis.

This is premise auditing in action: a natural application may possess stronger structure, but a theorem should expose only what its proof consumes.

The complete thirty-seven-declaration ledger

The frozen RMT-22 source is 602 lines and has SHA-256 cec39333cd0751ca7b52283049cf11ec8a8a8870eff3dbeaf32bfda81d111fbd. It contains exactly thirty-seven public declarations and twelve anonymous compiled boundary probes. The named interface appears below in source order.

Finite measurability and integrability

No.DeclarationExact role
1measurable_birkhoffSumFinite real orbit sums are measurable from measurable \(T\) and \(g\)
2measurable_birkhoffAverageTotalized finite real averages are measurable under the same premises
3integrable_birkhoffSumFinite sums are integrable from measure preservation and integrable \(g\)
4integrable_birkhoffAverageScalar normalization preserves finite-horizon integrability

The first pair has no measure argument. The second pair has no probability or ergodicity premise.

Event and representative layer

No.DeclarationExact role
5birkhoffConvergenceSetPoints where the real averages tend to some finite real
6mem_birkhoffConvergenceSet_iffSimp-normal form for membership
7measurableSet_birkhoffConvergenceSetOrdinary measurable (T,g) give an ordinarily measurable event
8birkhoffConvergenceSet_ae_eq_of_ae_eqQuasi-measure preservation transports the event across a.e.-equal observables
9nullMeasurableSet_birkhoffConvergenceSet_of_aemeasurablePrimary measurable-representative theorem
10nullMeasurableSet_birkhoffConvergenceSet_of_aestronglyMeasurableStrong-measurability corollary
11nullMeasurableSet_birkhoffConvergenceSet_of_integrableIntegrability corollary, using only its measurability field

The ae_eq in declaration 8 refers to equality of event membership almost everywhere. It does not produce set equality pointwise.

Positive-index shift and exact invariance

No.DeclarationExact role
12birkhoffAverage_succ_apply_baseExpress \(A_{n+1}(T\omega)\) through \(A_{n+2}(\omega)\)
13tendsto_birkhoffAverage_apply_baseMove convergence from \(\omega\) to \(T\omega\)
14birkhoffAverage_succ_succ_applyExpress \(A_{n+2}(\omega)\) through \(A_{n+1}(T\omega)\)
15tendsto_birkhoffAverage_of_apply_baseMove convergence from \(T\omega\) back to \(\omega\)
16tendsto_birkhoffAverage_apply_base_iffSame finite limit in both directions
17preimage_birkhoffConvergenceSetExact equality \(T^{-1}E=E\)

All six are pointwise and measure free. Declaration 17 says nothing about the image \(T(E)\).

Generic rigidity and probability laws

No.DeclarationExact role
18birkhoffConvergenceSet_ae_empty_or_univ_of_measurableSetMeasurable event plus PreErgodic gives null-or-conull
19birkhoffConvergenceSet_ae_empty_or_univ_of_nullMeasurableSetNull-measurable event plus QuasiErgodic gives null-or-conull
20birkhoffConvergenceSet_ae_empty_or_univ_of_aemeasurableRepresentative-safe rigidity from AEMeasurable
21birkhoffConvergenceSet_ae_empty_or_univ_of_aestronglyMeasurableStrong-measurability rigidity corollary
22birkhoffConvergenceSet_ae_empty_or_univ_of_integrableIntegrable rigidity corollary
23measure_birkhoffConvergenceSet_eq_zero_or_one_of_measurableSetProbability zero-one law on the measurable/pre-ergodic path
24measure_birkhoffConvergenceSet_eq_zero_or_one_of_nullMeasurableSetProbability zero-one law on the null-measurable/quasi-ergodic path
25measure_birkhoffConvergenceSet_eq_zero_or_one_of_aemeasurableRepresentative-safe numerical corollary
26measure_birkhoffConvergenceSet_eq_zero_or_one_of_aestronglyMeasurableStrong-measurability numerical corollary
27measure_birkhoffConvergenceSet_eq_zero_or_one_of_integrableIntegrable numerical corollary

The five numerical theorems require a probability measure. The five preceding dichotomies do not.

Candidate specialization

No.DeclarationExact role
28oneStepBirkhoffConvergenceSetName \(E(T,X_1)\) at the root namespace
29IsIntegrableSubadditiveProcessCandidate.nullMeasurableSet_oneStepBirkhoffConvergenceSetUse \(X_1\) integrability and quasi-measure preservation
30IsIntegrableSubadditiveProcessCandidate.preimage_oneStepBirkhoffConvergenceSetExact invariance without using candidate laws
31IsIntegrableSubadditiveProcessCandidate.oneStepBirkhoffConvergenceSet_ae_empty_or_univConditional quasi-ergodic rigidity
32IsIntegrableSubadditiveProcessCandidate.measure_oneStepBirkhoffConvergenceSet_eq_zero_or_oneConditional probability zero-one law

The wrapper never states that \(X_n/n\) converges. It studies only ordinary Birkhoff averages of the one-step observable \(X_1\).

Matrix-cocycle specialization

No.DeclarationExact role
33DiscreteMatrixCocycle.generatorLogPlusBirkhoffConvergenceSetName the event for the generator log-positive observable
34DiscreteMatrixCocycle.measurableSet_generatorLogPlusBirkhoffConvergenceSetObtain ordinary event measurability directly from the cocycle
35DiscreteMatrixCocycle.preimage_generatorLogPlusBirkhoffConvergenceSetExact base-preimage invariance
36DiscreteMatrixCocycle.generatorLogPlusBirkhoffConvergenceSet_ae_empty_or_univApply PreErgodic with no generator-integrability premise
37DiscreteMatrixCocycle.measure_generatorLogPlusBirkhoffConvergenceSet_eq_zero_or_oneProbability zero-one corollary with the same thin premises

The source-level count treats every declaration once. Anonymous examples and the six #print axioms commands are verification surfaces, not public API names.

Complete proof-helper map

The module declares no private named helper theorem. Its proof bodies use imported Mathlib interfaces and local have statements. The table below accounts for those helper families and shows exactly which public declarations consume them.

Public declarationsImported or bundled helper used in the proofExact job
1-2Measurable.iterate, Measurable.comp, Finset.measurable_sum, Measurable.mulMake each orbit term, finite sum, and scalar-normalized average measurable
3-4MeasurePreserving.iterate, MeasurePreserving.integrable_comp_of_integrable, integrable_finsetSum, Integrable.const_mulMove one-step integrability through every iterate, add finitely, then normalize
5-6no imported proof helper; definition and rflName the convergence predicate as a set and expose membership without asserting a witness
7MeasureTheory.measurableSet_exists_tendstoConvert a measurable real-valued sequence into a measurable set of points where some finite limit exists
8Measure.QuasiMeasurePreserving.birkhoffAverage_ae_eq_of_ae_eq, ae_all_iff, Tendsto.congr’Upgrade fixed-horizon almost-everywhere equality to one conull set carrying equality at every horizon, then preserve limits
9-11AEMeasurable.mk, AEMeasurable.measurable_mk, AEMeasurable.ae_eq_mk, NullMeasurableSet.congrChoose an ordinary representative and transfer its measurable convergence event back to the raw observable
12 and 14birkhoffSum_succ’, field_simp, ring_nfPeel the first orbit reading and solve the normalized identity in each direction
13 and 15tendsto_add_atTop_iff_nat, tendsto_add_atTop_nat, tendsto_one_div_add_atTop_nhds_zero_nat, tendsto_const_div_atTop_nhds_zero_nat, tendsto_natCast_div_add_atTop, Filter.Tendsto.mul, Filter.Tendsto.add, Filter.Tendsto.subShift the horizon, send the coefficient to one and the prefix correction to zero, and combine limits
16-17declarations 13 and 15, Set.ext, mem_birkhoffConvergenceSet_iffPackage the two limit directions and turn pointwise membership equivalence into exact preimage equality
18 and 23PreErgodic.ae_empty_or_univ, PreErgodic.prob_eq_zero_or_oneApply ordinary measurable strict-invariance rigidity, then add probability normalization only for numerical zero-one output
19 and 24QuasiErgodic.ae_empty_or_univ₀, ae_eq_empty, measure_congrApply null-measurable almost-invariant rigidity and convert its two branches to measures
20-22 and 25-27AEStronglyMeasurable.aemeasurable, Integrable.aestronglyMeasurableExpose progressively stronger ergonomic premises while reusing the almost-everywhere-measurable proof core
28no imported proof helper; definitional abbreviationName the generic event for the one-step observable \(X_1\) without consuming a candidate law
29-32IsIntegrableSubadditiveProcessCandidate.integrable 1 plus generic declarations 11, 17, 22, and 27Reuse only one-step integrability and the generic event API; the shifted-subadditive field is not used
33no imported proof helper; definitional abbreviationName the event for the cocycle’s one-step log-positive norm observable
34-37DiscreteMatrixCocycle.base_preserving.measurable, DiscreteMatrixCocycle.measurable_logPlusNormObservable 1, plus generic declarations 7, 17, 18, and 23Supply ordinary measurability from the cocycle bundle and reuse the generic event API without generator integrability
boundary probes 1-9birkhoffAverage_zero, birkhoffAverage_of_comp_eq, Function.IsFixedPt.birkhoffAverage_eq, zero-measure and empty-index instancesTest time zero, constants, identity dynamics, noninjectivity, representatives, zero measure, \(X_0\), and an empty matrix index
boundary probes 10-12mem_birkhoffConvergenceSet_iff, Finset.sum_range_id_mul_two, tendsto_natCast_atTop_atTop, not_tendsto_atTop_of_tendsto_nhdsTurn abstract divergence into nonmembership and compile the explicit successor-orbit formula \(A_{n+1}(0)=n/2\)

This map distinguishes project declarations from upstream machinery. For example, birkhoffSum_succ’ is an imported finite-sum recurrence; birkhoffAverage_succ_apply_base is this module’s new solved average identity. The 37-name ledger, this helper map, the 12-probe narrative below, and the six axiom prints together cover every source-level proof surface in the 602-line file.

Proof architecture as a dependency graph

The declarations form three main routes.

Route A: ordinary measurable observable

\[ \begin{aligned} &T,g\text{ measurable}\\ &\quad\Longrightarrow A_n^g\text{ measurable for every }n\\ &\quad\Longrightarrow E(T,g)\text{ measurable}\\ &\quad\Longrightarrow \bigl(\operatorname{PreErgodic}(T,\mu) \text{ and }T^{-1}E=E\bigr)\\ &\quad\Longrightarrow E\text{ null or conull}. \end{aligned} \]

Probability is added only if the final conclusion must be written \(\mu(E)=0\) or \(\mu(E)=1\).

Route B: almost-everywhere representative

\[ \begin{aligned} &g\text{ a.e. measurable},\quad T\text{ quasi-measure-preserving}\\ &\quad\Longrightarrow g\sim\widetilde g\text{ a.e. with }\widetilde g\text{ measurable}\\ &\quad\Longrightarrow E(T,g)\sim E(T,\widetilde g)\text{ a.e.}\\ &\quad\Longrightarrow E(T,g)\text{ null measurable}\\ &\quad\Longrightarrow \bigl(\operatorname{QuasiErgodic}(T,\mu) \text{ and }T^{-1}E=E\bigr)\\ &\quad\Longrightarrow E\text{ null or conull}. \end{aligned} \]

The quasi-measure-preserving field of QuasiErgodic supports both representative transport and the null-measurable rigidity theorem.

Route C: pointwise shift

\[ \begin{aligned} &\text{two positive-index algebraic identities}\\ &\quad\Longrightarrow A_n^g(\omega)\to c\iff A_n^g(T\omega)\to c\\ &\quad\Longrightarrow T^{-1}E(T,g)=E(T,g). \end{aligned} \]

This route is independent of A and B. It needs no measurable space at all. The final rigidity theorems join the pointwise shift route to either event measurability route.

Models that test the API boundary

The source compiles twelve anonymous probes. Each tests a possible source of accidental strengthening.

Probe 1: time zero

For every \(T,g,\omega\), Mathlib gives \(A_0^g(\omega)=0\). This tests the totalized convention and prevents prose from calling it a positive-time average.

Probes 2 and 3: zero and constant observables

The zero observable has event \(\Omega\). A constant \(c\) also has event \(\Omega\) even though the time-zero value is zero: the sequence is \(0,c,c,c,\ldots\), which converges to \(c\).

Probe 4: identity dynamics

For the identity map and arbitrary \(g\), every positive average at \(\omega\) equals \(g(\omega)\). The event is \(\Omega\) without any measurability premise.

Probe 5: a constant noninjective base

On the two-element Boolean type, the constant map is not injective. The exact preimage theorem still applies. This refutes any hidden use of invertibility.

Probe 6: representative transport

For hg : AEMeasurable g μ, the event for \(g\) is almost everywhere equal to the event for hg.mk g under quasi-measure-preserving dynamics. This tests the direction of ae_eq_mk and the set-congruence proof.

Probe 7: zero measure

Every measurable map is quasi-ergodic for the zero measure, so the event dichotomy holds for arbitrary \(g\). The statement is intentionally described as vacuous.

Probe 8: a candidate with nonzero time zero

Set \(X_0=1\) and \(X_n=0\) for every positive \(n\), over the zero measure. This is an integrable shifted-subadditive-process candidate. The one-step event is \(\Omega\). Thus no theorem silently assumes \(X_0=0\).

Probe 9: empty matrix index without generator integrability

A cocycle indexed by the empty type calls event measurability and exact invariance without HasIntegrableGeneratorLogPlus and without a nonempty-index instance.

Probe 10: abstract nonmembership

If the average sequence is proved not to tend to any real \(c\), membership in the convergence event is definitionally impossible. The simp theorem closes that argument directly.

Probes 11 and 12: an explicit divergent orbit

Take \(\Omega\) to be the natural numbers, \(T(k)=k+1\), \(g(k)=k\), and \(\omega=0\). A finite calculation gives

\[ \begin{aligned} A_{n+1}^g(0) &=\frac{1}{n+1}\sum_{j=0}^{n}j\\ &=\frac{1}{n+1}\frac{n(n+1)}{2}\\ &=\frac n2. \end{aligned} \]

In the first probe, the finite-sum identity establishes the exact formula. The second proves \(n/2\to+\infty\), contradicting convergence to any finite real. Therefore \(0\notin E(T,g)\).

Axiom and source-integrity audit

RMT-22 prints the axioms of six representative high-level theorems:

  • almost-everywhere event congruence;
  • null measurability from an almost-everywhere measurable representative;
  • the same-limit shift equivalence;
  • integrable-observable ergodic rigidity;
  • the candidate rigidity wrapper; and
  • the matrix-cocycle rigidity wrapper.

Each print contains only propext, Classical.choice, and Quot.sound. These are the standard logical axioms inherited from Mathlib’s classical and quotient infrastructure. There is no sorry, admit, custom axiom, or unsafe declaration.

The source imports Mathlib’s finite Birkhoff algebra, quasi-measure-preserving transport, and the general measurable convergence-set theorem. It does not redefine the upstream finite sum or average.

Solved exercises

These exercises are cumulative. Try each problem before opening its solution.

Exercise 1: expand the first three sums

Write \(S_0^g(\omega)\), \(S_1^g(\omega)\), and \(S_3^g(\omega)\).

Details

The range for zero is empty, so \(S_0^g(\omega)=0\). The range for one contains only zero, so \(S_1^g(\omega)=g(\omega)\). The range for three contains zero, one, and two, so

\[ S_3^g(\omega)=g(\omega)+g(T\omega)+g(T^2\omega). \]

Exercise 2: explain the time-zero average

Why does \(A_0^g=0\) not imply \(X_0=0\) for a process \(X\)?

Details

The Birkhoff average is a particular totalized definition: \(A_0^g=0^{-1}S_0^g=0\). A process \(X:\mathbb N\to\Omega\to\mathbb R\) is separate input data. Unless its definition or hypotheses connect \(X_0\) to a Birkhoff average, the two values are logically unrelated.

Exercise 3: locate the preservation premise

Which finite theorem needs measure preservation: measurability of the sum or integrability of the sum?

Details

Integrability needs preservation so that integrability of \(g\) transports to \(g\circ T^j\). Measurability needs only measurability of \(T\) and \(g\).

Exercise 4: definition versus witness

Does defining \(E(T,g)\) give a term of type ∃ ω, ω ∈ birkhoffConvergenceSet T g?

Details

No. The definition gives a set, meaning a predicate on ω. A nonemptiness proof would have to construct a point and a finite real limit for its average sequence. RMT-22 constructs neither in general.

Exercise 5: measurable event without a measure

Why can measurableSet_birkhoffConvergenceSet omit μ entirely?

Details

A measurable set is defined by the measurable-space structure, not by a particular measure. The theorem assembles measurable functions and applies a topological measurability result. Measures enter later through null sets, almost-everywhere equality, and ergodicity.

Exercise 6: the representative trap

What invalid step would occur if one wrote “\(g\) is integrable, therefore \(g\) is measurable” in the ordinary pointwise sense?

Details

Mathlib’s integrability package supplies almost-everywhere strong measurability. The given representative may differ on a null set from every ordinary measurable representative. Upgrading it to ordinary measurability would strengthen the premise without proof.

Exercise 7: why quasi-measure preservation

Let \(N=\{\omega:g(\omega)\ne h(\omega)\}\) be null. Where can the orbitwise equality fail at horizon \(j\)?

Details

It can fail at points \(\omega\) such that \(T^j\omega\in N\), namely on \((T^j)^{-1}(N)\). Quasi-measure preservation ensures that this preimage is still null.

Exercise 8: fixed horizon versus every horizon

Why is one application of birkhoffAverage_ae_eq_of_ae_eq insufficient for event congruence?

Details

The upstream theorem fixes one \(n\). Convergence is a property of all horizons simultaneously. RMT-22 uses countability of the natural numbers to choose one conull set on which the averages agree for every \(n\).

Exercise 9: derive the forward shift identity

Starting from \(S_{n+2}^g(\omega)=g(\omega)+S_{n+1}^g(T\omega)\), solve for \(A_{n+1}^g(T\omega)\).

Details

Since \(S_m^g=mA_m^g\) at positive \(m\),

\[ (n+2)A_{n+2}^g(\omega) =g(\omega)+(n+1)A_{n+1}^g(T\omega). \]

Divide by \(n+1\) and rearrange:

\[ A_{n+1}^g(T\omega) =\frac{n+2}{n+1}A_{n+2}^g(\omega) -\frac{g(\omega)}{n+1}. \]

Exercise 10: preserve the limit value

Suppose \(A_n^g(\omega)\to c\). Why does the forward identity give limit \(c\), not merely existence of some limit at \(T\omega\)?

Details

The shifted average is the product of a coefficient tending to one with a sequence tending to \(c\), minus a correction tending to zero. Limit algebra therefore gives \(1\cdot c-0=c\).

Exercise 11: no inverse map

Why does the converse shift theorem not require a point \(\upsilon\) with \(T\upsilon=\omega\)?

Details

It restores the deleted first value algebraically using

\[ A_{n+2}^g(\omega) =\frac{g(\omega)}{n+2} +\frac{n+1}{n+2}A_{n+1}^g(T\omega). \]

No predecessor of \(\omega\) is requested.

Exercise 12: preimage versus image

Translate \(T^{-1}E=E\) into a pointwise biconditional. Does it imply \(T(E)=E\)?

Details

It says \(T\omega\in E\iff\omega\in E\) for every \(\omega\). It does not imply image equality without additional surjectivity information. A point of \(E\) outside the image of \(T\) cannot lie in \(T(E)\).

Exercise 13: identify the weakest ordinary receiver

Given a measurable set \(E\) and exact equality \(T^{-1}E=E\), which Mathlib structure suffices for the null-or-conull conclusion?

Details

PreErgodic T μ suffices. Its defining field is precisely the rigidity of ordinarily measurable strictly invariant sets.

Exercise 14: identify the representative-safe receiver

Why does a null-measurable event naturally pair with QuasiErgodic T μ?

Details

The quasi-ergodic API contains quasi-measure preservation and a theorem for null-measurable almost-invariant sets. The ordinary pre-ergodic definition is phrased only for ordinarily measurable strictly invariant sets.

Exercise 15: do not choose the branch

Suppose ergodicity yields \(E=\varnothing\) almost everywhere or \(E=\Omega\) almost everywhere. What extra fact would rule out the first branch?

Details

Any proof that \(E\) has positive measure would rule out the null branch. A pointwise ergodic theorem supplies the much stronger statement that \(E\) is conull under its analytic hypotheses. RMT-22 supplies neither fact.

Exercise 16: probability’s exact job

What does [IsProbabilityMeasure μ] add to an already proved null-or-conull dichotomy?

Details

It identifies the measure of the full space with one. Thus the conull branch has event measure one, while the null branch has measure zero. It does not prove ergodicity or convergence.

Exercise 17: zero measure

Why can a set be both almost everywhere empty and almost everywhere full for the zero measure?

Details

Every subset has zero measure, so every membership disagreement lies in a null set. Almost-everywhere equality cannot distinguish any two predicates. The result is logically consistent and informationally empty.

Exercise 18: constant observable and time zero

For \(g\equiv c\ne0\), list the average sequence and its limit.

Details

The sequence is \(0,c,c,c,\ldots\): time zero is totalized to zero, and every positive horizon averages \(n\) copies of \(c\). The finite prefix does not affect the limit, which is \(c\).

Exercise 19: successor orbit divergence

Verify that \(A_{n+1}^g(0)=n/2\) for \(T(k)=k+1\) and \(g(k)=k\).

Details

The orbit values are \(0,1,\ldots,n\). Their sum is \(n(n+1)/2\). Dividing by the positive horizon \(n+1\) gives \(n/2\).

Exercise 20: finite real versus infinity

Why is a sequence tending to positive infinity outside the convergence event?

Details

Membership requires a witness \(c\in\mathbb R\) and convergence in the neighborhood filter of that finite \(c\). Tending to the order filter at positive infinity is incompatible with convergence to a finite real.

Exercise 21: candidate time zero

Which candidate field could force \(X_0=0\)?

Details

Neither field does. Integrability permits nonzero functions, and shifted subadditivity at \(m=k=0\) gives only \(X_0(\omega)\le X_0(\omega)+X_0(\omega)\). The compiled candidate with \(X_0=1\) shows the interface is consistent with nonzero time zero.

Exercise 22: candidate law usage

Does preimage_oneStepBirkhoffConvergenceSet use integrability or subadditivity?

Details

No. It is the generic pointwise preimage theorem specialized to the function \(X_1\). Its signature therefore takes \(T\) and \(X\), not a candidate proof.

Exercise 23: cocycle integrability

Why is HasIntegrableGeneratorLogPlus absent from the cocycle event measurability theorem?

Details

The cocycle’s one-step log-positive norm is ordinarily measurable from the generator and finite matrix operations. Event measurability needs ordinary measurability, not integrability.

Exercise 24: empty matrix index

What breaks in the event definition when the finite matrix index is empty?

Details

Nothing. Earlier cocycle modules totalize the empty-dimensional norm observable and prove it measurable. The convergence event and its preimage equation remain meaningful, so no Nonempty premise is necessary.

Exercise 25: classify declaration 8

Is birkhoffConvergenceSet_ae_eq_of_ae_eq a measurability theorem, an existence theorem, or a congruence theorem?

Details

It is a congruence theorem. It transports event membership almost everywhere between two observables already known to agree almost everywhere. It neither proves the event measurable nor proves that it has members.

Exercise 26: count the generic rigidity family

Why are declarations 18 through 27 ten theorems rather than one theorem with many typeclass searches?

Details

The split makes the two set-measurability routes and three observable premise levels explicit, then separately records the almost-everywhere and numerical probability conclusions. The names expose proof dependencies and prevent automatic inference from hiding a strengthened premise.

Exercise 27: axiom footprint

What would be suspicious in the printed axiom list beyond the three standard axioms reported here?

Details

A project-specific axiom, a theorem introduced with sorryAx, or an unexpected classical postulate would require investigation. The actual prints contain only propext, Classical.choice, and Quot.sound.

Exercise 28: distinguish Birkhoff from Kingman

What sequence does RMT-22 study for a candidate \(X\), and what sequence would a subadditive ergodic theorem study?

Details

RMT-22 studies the ordinary Birkhoff averages of the single observable \(X_1\): \(n^{-1}\sum_{j\lt n}X_1(T^j\omega)\). Kingman’s theorem concerns the normalized subadditive process values \(X_n(\omega)/n\). Earlier finite bounds relate them, but they are not definitionally the same sequence.

Exercise 29: identify the missing theorem role

What logical statement would a pointwise Birkhoff theorem add to the present event layer?

Details

Under its measure-preserving and integrability hypotheses, it would prove that the Birkhoff averages converge for almost every starting point. In event language, it would prove \(E(T,g)=\Omega\) almost everywhere, selecting the conull branch rather than merely presenting a dichotomy.

Exercise 30: state the exact summit

Summarize RMT-22 in one sentence without using the words “proves Birkhoff’s theorem.”

Details

RMT-22 builds a measurable, representative-safe, exactly preimage-invariant event for finite-real convergence of Birkhoff averages and proves its conditional ergodic rigidity, while leaving convergence existence to a separate pointwise theorem.

Premise ledger

ResultMinimal visible premisesPremises deliberately absent
Finite sum measurabilitymeasurable \(T\), measurable \(g\)measure, preservation, probability, integrability, ergodicity
Finite sum integrabilitymeasure-preserving \(T\), integrable \(g\)finite measure, probability, ergodicity
Event measurabilitymeasurable \(T\), measurable \(g\)preservation, integrability, probability, ergodicity
Event a.e. congruencequasi-measure-preserving \(T\), \(g=h\) a.e.measurability and integrability of either representative
Event null measurabilitya.e. measurable \(g\), quasi-measure-preserving \(T\)ordinary measurability of raw \(g\), probability, ergodicity
Same-limit shift equivalencenone beyond real-valued finite averagesmeasurable space, measure, boundedness, invertibility
Exact preimage invariancearbitrary \(T,g\)every analytic or dynamical premise
Measurable event rigidityPreErgodic, event measurabilitypreservation beyond what a caller may possess, probability
Null-measurable event rigidityQuasiErgodic, null measurabilityfull measure preservation, probability
Numerical zero-one lawcorresponding rigidity path, probabilityconvergence existence
Candidate null measurabilitycandidate, quasi-measure-preserving \(T\)\(X_0=0\), probability, ergodicity
Cocycle event rigiditycocycle, PreErgodic C.base μgenerator integrability, nonempty matrix index, convergence

The distinction between proof dependency and ambient structure matters. A DiscreteMatrixCocycle stores a measure-preserving base even when a specific wrapper calls only its measurability or passes an external pre-ergodic proof. The theorem should not be described as assumption free; its receiver still carries structure. It should be described as requiring no additional generator-integrability or nonempty-index premise.

Nonclaim ledger

RMT-22 does not establish:

  1. that \(E(T,g)\) is nonempty for arbitrary \(T,g\);
  2. that any named point belongs to the event, except in boundary examples;
  3. that the event has positive measure;
  4. that the conull branch of ergodic rigidity holds;
  5. a maximal ergodic inequality;
  6. the pointwise Birkhoff ergodic theorem;
  7. convergence to a conditional expectation;
  8. convergence to the space average under ergodicity;
  9. convergence in integrable norm, probability, or distribution;
  10. interchange of limit and integral;
  11. a density or frequency theorem for marked orbit starts;
  12. Kingman’s subadditive ergodic theorem;
  13. almost-everywhere convergence of \(X_n/n\);
  14. equality of a samplewise limit with the deterministic Fekete rate;
  15. ergodicity of \(T^b\) from ergodicity of \(T\);
  16. mixing, independence, or correlation decay;
  17. image invariance of the convergence event;
  18. a signed cocycle growth limit;
  19. a Lyapunov exponent; or
  20. an Oseledets filtration or splitting.

The theorem that a convergence event is null or conull is genuinely useful. It becomes decisive once another argument gives positive measure or almost-everywhere membership. It is not a substitute for that argument.

The existence theorem that RMT-22 leaves open

The classical pointwise Birkhoff ergodic theorem starts with a measure-preserving transformation and an integrable observable. In a standard probability-space formulation, it proves that the finite averages converge almost everywhere to an invariant integrable function; under ergodicity that limit is almost everywhere constant and agrees with the space average.

RMT-22 stops before every part of that existence statement. The pinned Mathlib release contains finite Birkhoff algebra, quasi-measure-preserving representative transport, ergodic rigidity, and specialized mean-ergodic results in normed settings. The Mathlib API audited for RMT-22 did not itself contain the measure-theoretic pointwise Birkhoff theorem needed here.

The project later built that analytic route in separate modules. RMT-23 supplies a finite Hopf-style maximal ergodic inequality and a horizon-uniform weak estimate for strict finite average-threshold events. The finite maximal Deep Dive begins that climb. The later Pointwise Birkhoff from Maximal Control and Dense Good Functions chapter reaches the project theorem ae_mem_birkhoffConvergenceSet_of_integrable. Under a finite measure, measure-preserving dynamics, and an integrable real observable, that theorem proves almost-everywhere membership in the convergence event.

This later result does not change what RMT-22 proves. In the present module, the null-or-conull and zero-one theorems remain conditional dichotomies. A caller that wants the conull branch must import and apply the later pointwise theorem or provide another membership argument. The later theorem also stops at convergence-event membership: it does not identify the limit with a conditional expectation or, under ergodicity, with the space average.

For the subadditive program, even a pointwise theorem for the one-step observable is not the final summit. The RMT-20 phase estimate and RMT-21 interval packing still need a checked density or frequency input to control marked starts and connect finite bounds to \(X_n/n\). Only after that analytic bridge can the project proceed toward Kingman’s theorem without adding an unsupported convergence claim.

Where to continue

The Birkhoff convergence event entry is the compact definition, boundary, and premise reference.

The Birkhoff sum entry develops the finite sum and powered-map block interpretation. The ergodic probability base entry separates preservation, probability, ergodicity, and integrability.

Probability Normalization and Ergodic Rigidity Before Kingman is the RMT-17 foundation for the two rigidity receivers and candidate wrapper.

Finite Ordered Interval Packing for Nonpositive Subadditive Processes is the immediate finite predecessor. Its marked-start density gap remains open after RMT-22.

Birkhoff Convergence Events and Ergodic Rigidity in Lean maps all thirty-seven names to their checked proofs and build commands.

Finite Maximal Ergodic Inequalities: From Orbit Maxima to Threshold Events continues the analytic route with strict finite running maxima, measure-preserving cancellation, and a positive-threshold weak estimate. It still makes no pointwise convergence claim.

Pointwise Birkhoff from Maximal Control and Dense Good Functions completes the later finite-measure maximal-closure route to ae_mem_birkhoffConvergenceSet_of_integrable. Read it after this chapter to see exactly which new hypotheses and approximation machinery choose the conull branch.

References

All Mathlib links below use the v4.32.0 revision pinned by this project. The local source authority is commit 81a5d257c8e410db227a6665ed08f64fea08e997.

Mathlib contributors. Finite Birkhoff sums, with the pinned definition and recurrence laws. The same pinned source contains the exact shifted finite-sum difference used to audit the new finite-prefix formulas.

Mathlib contributors. Finite Birkhoff averages, with the pinned totalized definition and shifted-difference identity. RMT-22 reuses these finite objects and adds a boundedness-free same-limit equivalence.

Mathlib contributors. Quasi-measure-preserving Birkhoff transport, with the pinned fixed-horizon a.e. theorem. RMT-22 takes a countable all-horizon intersection before transporting convergence events.

Mathlib contributors. Measurable convergence sets, with the pinned theorem. This is the general topological-measure bridge used for the real event.

Mathlib contributors. Almost-everywhere measurable representatives, with the pinned AEMeasurable.mk, measurable_mk, and ae_eq_mk API. The project uses this AEMeasurable layer as its primary theorem and exposes strong-measurability and integrability corollaries.

Mathlib contributors. Ergodic maps and measures, with the pinned ordinary measurable rigidity and zero-one law and null-measurable quasi-ergodic rigidity.

Mathlib contributors. Normed-space Birkhoff sums, with the pinned boundedness-based shift convergence results. These theorems define the novelty boundary accurately: shift infrastructure already existed, while RMT-22 supplies the real boundedness-free two-way same-limit statement needed for exact event invariance.

George D. Birkhoff. Proof of the Ergodic Theorem, Proceedings of the National Academy of Sciences 17(12), 656-660, 1931, DOI 10.1073/pnas.17.2.656. This primary source is the historical pointwise theorem. The current module formalizes event infrastructure before that existence result.

J. F. C. Kingman. The ergodic theory of subadditive stochastic processes, Journal of the Royal Statistical Society: Series B 30(3), 499-510, 1968. This primary source is the later subadditive destination. RMT-22 proves none of its normalized-process convergence conclusions.

The exact upstream revision audited for this chapter is commit 81a5d257, the v4.32.0 revision pinned by formalization/lake-manifest.json.