Begin with two atoms and five possible block lengths

We will first calculate everything on a probability space with only two outcomes:

\[ \Omega=\{\text{amber},\text{blue}\}, \qquad \mu(\{\text{amber}\})=\mu(\{\text{blue}\})=\frac12. \]

An outcome is one possible state of this finite world. A measurable subset of outcomes is an event . Its probability is the total mass assigned by \(\mu\).

Let the dynamics be the identity map:

\[ T(\omega)=\omega. \]

Every orbit therefore stays on its starting atom. This map is measure preserving because moving an event backward through \(T\) does not change the event or its mass. It is not ergodic: the singleton event \(\{\text{amber}\}\) is invariant and has mass \(1/2\).

Define a real process by

\[ Y_n(\text{amber})=-(n-1), \qquad Y_n(\text{blue})=0. \]

Natural-number subtraction is truncated at zero, so \(Y_0=0\). On amber the first values are

\[ 0,-1,-2,-3,-4,\ldots; \]

on blue they are all zero. This is the exact private two-point model compiled in SubadditiveBadBlockMeasure.lean. In the source it is first packaged as a subadditive candidate \(X\). Since \(X_1=0\) and \(T\) is the identity, the repository’s orbit-majorant centered process

\[ \operatorname{centeredProcess}(T,X,n,\omega) =X_n(\omega)-\sum_{j=0}^{n-1}X_1(T^j\omega) \]

is exactly \(Y_n(\omega)\) in this model.

Three properties follow directly from the displayed formulas:

  1. every \(Y_n\) is integrable because the probability space has two atoms;

  2. \(Y_n\le0\) for every positive \(n\); and

  3. the shifted subadditive inequality holds:

    \[ Y_{a+b}(\omega) \le Y_b(T^a\omega)+Y_a(\omega). \]

On blue this is \(0\le0\). On amber, when \(a,b\gt0\), the left side is \(-(a+b-1)\) and the right side is \(-(a+b-2)\). Zero-length cases reduce to equality.

Mark blocks below one negative line

Fix the block-length cap and strict threshold

\[ m=5, \qquad c=-\frac34. \]

A block of length \(n\) is bad at \(\omega\) when

\[ 1\le n\le5 \quad\text{and}\quad Y_n(\omega)\lt cn. \]

Here is the complete finite search:

\(n\)\(Y_n(\text{amber})\)\(cn\)Amber is strictly bad?Blue is strictly bad?
1\(0\)\(-3/4\)nono
2\(-1\)\(-3/2\)nono
3\(-2\)\(-9/4\)nono
4\(-3\)\(-3\)no: equality is excludedno
5\(-4\)\(-15/4\)yesno

Write

\[ E_n(c)=\{\omega:Y_n(\omega)\lt cn\}. \]

The rows give

\[ E_1=E_2=E_3=E_4=\varnothing, \qquad E_5=\{\text{amber}\}. \]

The finite bad-block event is their union:

\[ \begin{aligned} B_5(-3/4) &=\bigcup_{n=1}^{5}E_n(-3/4)\\ &=\{\text{amber}\}. \end{aligned} \]

Its exact probability is

\[ q:=\mu(B_5(-3/4))=\frac12. \]
At threshold negative three quarters, amber misses the strict test at lengths one through four and passes it only at length five, while blue never passes; the union is the amber atom of probability one half.
FigureThe complete finite ledger for the running example. The length-four amber value equals its threshold and is therefore not marked. Only the length-five amber block is strictly below the line, so the union of all five candidate events is the singleton amber event with mass one half. These are exact model values, not sampled frequencies.

Two boundary tests before any theorem

If the cap is zero, there are no positive candidate lengths:

\[ B_0(c)=\varnothing \qquad\text{for every }c. \]

Threshold zero needs more care. At cap one,

\[ B_1(0)=\varnothing \]

because \(Y_1=0\) and the event uses a strict inequality. It is false that threshold zero always makes the bad event empty. With the same process and cap five,

\[ B_5(0)=\{\text{amber}\}, \]

because \(Y_2(\text{amber})=-1\lt0\). The cap, strictness, and sign must all be read together.

Count twelve visits, then pack three witnesses

Choose a counting horizon

\[ H=12. \]

The finite orbit-visit count is

\[ N_H(\omega) := \#\{j\in\{0,\ldots,H-1\}:T^j\omega\in B_5(-3/4)\}. \]

The amber orbit remains in the bad event at all twelve starts, while the blue orbit never enters it:

\[ N_{12}(\text{amber})=12, \qquad N_{12}(\text{blue})=0. \]

At each marked amber start, length five is a witness because

\[ Y_5(\text{amber})=-4 \lt -\frac34\cdot5=-\frac{15}{4}. \]

Starting from the left, a greedy disjoint cover can retain

\[ [0,5),\qquad[5,10),\qquad[10,15). \]

These three intervals cover every marked start \(0,\ldots,11\). Their total covered length is \(15\), and they fit in the safe buffered horizon

\[ H+m=12+5=17. \]

The selected interval costs add to

\[ -4-4-4=-12. \]

The full amber chain is therefore

\[ \begin{aligned} Y_{17}(\text{amber}) &=-16\\ &\le -12\\ &\lt -\frac34\cdot15=-\frac{45}{4}\\ &\le -\frac34\cdot12=-9. \end{aligned} \]

The final comparison uses both \(15\ge12\) and \(c\le0\). Multiplication by a nonpositive coefficient reverses the usual length comparison. The blue orbit has no marks and gives \(Y_{17}(\text{blue})=0\le0\).

Thus both atoms satisfy the pointwise theorem’s conclusion:

\[ Y_{H+m}(\omega)\le cN_H(\omega). \]
Twelve amber visit marks are covered by the three disjoint intervals zero to five, five to ten, and ten to fifteen inside a seventeen-step buffered horizon; atomwise averages give visit integral six, process integral negative eight, and final mass one half below ratio two thirds.
FigureThe exact orbit, packing, integration, and ratio ledger. On amber, three length-five intervals cover twelve marked starts and yield the chain negative sixteen at most negative twelve, below negative forty-five quarters, at most negative nine. On blue all values are zero. Averaging the two atoms gives visit integral six and buffered-process integral negative eight. The final finite event has mass one half and the theorem’s ceiling is two thirds. No samplewise limit appears.

Integrate atom by atom

On this two-atom probability space, integrating a function means averaging its two values. For the visit count,

\[ \begin{aligned} \int_\Omega N_{12}\,d\mu &=\frac12\cdot12+\frac12\cdot0\\ &=6\\ &=12\cdot\mu(B_5(-3/4)). \end{aligned} \]

This is the finite identity

\[ \int_\Omega N_H\,d\mu =H\,\mu(B_m(c)) \]

made completely explicit.

For the buffered centered process,

\[ \int_\Omega Y_{17}\,d\mu =\frac12(-16)+\frac12(0) =-8. \]

The integrated right side is

\[ c\int_\Omega N_{12}\,d\mu =-\frac34\cdot6 =-\frac92. \]

The pointwise inequality therefore integrates to the true finite comparison

\[ -8\le-\frac92. \]

Nothing was averaged over time here. We integrated two finite atom values after proving a finite pointwise inequality.

Compute the lower-rate witness and the ratio

Let

\[ I_n:=\int_\Omega Y_n\,d\mu. \]

For every positive \(n\),

\[ I_n=-\frac{n-1}{2}. \]

Consequently,

\[ \frac{I_n}{n} =-\frac12+\frac{1}{2n} \ge-\frac12. \]

Choose

\[ \delta=-\frac12. \]

This is a lower bound for every positive normalized centered integral. It is not a statement about samplewise convergence. It is one deterministic inequality for the scalar sequence \(I_n/n\).

At the displayed buffered horizon,

\[ \delta(H+m) =-\frac12\cdot17 =-\frac{17}{2} \le I_{17}=-8 \le cHq=-\frac92. \]

For an arbitrary positive \(H\), the same proof gives

\[ \delta \le cq\frac{H}{H+m}. \]

Only the elementary scalar factor moves toward a limit:

\[ \frac{H}{H+m}\longrightarrow1. \]

Hence

\[ \delta\le cq. \]

Because

\[ c=-\frac34\lt-\frac12=\delta\le0, \]

division by \(c\) reverses the inequality:

\[ q\le\frac{\delta}{c}. \]

In the running example,

\[ \boxed{\frac12\le \frac{-1/2}{-3/4} =\frac23.} \]

This is the requested finite measure ratio.

The sign-reversal near miss

If one divides \(\delta\le cq\) by the negative number \(c\) without reversing the order, one obtains the wrong proposal

\[ q\ge\frac{\delta}{c}. \]

Our exact values refute it:

\[ \frac12\not\ge\frac23. \]

This error is not a minor notation issue. It changes a useful upper bound into a false lower bound.

Climb from the finite ledger to the general definitions

Now let \((\Omega,\mu)\) be any measurable space with finite total measure, let \(T:\Omega\to\Omega\) preserve \(\mu\), and let \(X_n:\Omega\to\mathbb R\) be an integrable shifted-subadditive process:

\[ X_{a+b}(\omega) \le X_b(T^a\omega)+X_a(\omega). \]

Define the orbit-majorant-centered process

[ Y_n(\omega) := X_n(\omega)

\sum_{j=0}^{n-1}X_1(T^j\omega). ]

The word centered here does not mean expectation centering. The subtracted quantity depends on \(\omega\). Shifted subadditivity gives

\[ Y_1=0, \qquad Y_n\le0\quad(n\gt0), \]

and \(Y\) is again shifted subadditive.

In Lean: define the finite strict bad-block event

One idea, three languages Read across, then read the syntax map
A human says
A point is marked when at least one positive block length from one through m has centered value strictly below the line of slope c.
On paper
\(B_m(c)=\bigcup_{n=1}^{m}\{\omega:Y_n(\omega)<cn\}.\)
In Lean
finiteCenteredBadBlockSet T X m c
Syntax map
  • finiteCenteredBadBlockSet is a Set Ω, so it is an event, not a number.
  • Finset.Icc 1 m is the inclusive finite window \(1\le n\le m\).
  • ⋃ n ∈ Finset.Icc 1 m forms the finite union over witness lengths.
  • centeredProcess T X n ω is \(Y_n(\omega)\).
  • < c * (n : ℝ) is strict and casts the natural length to a real number.
  • No probability, preservation, integrability, or ergodicity hypothesis is needed merely to define this set.

The exact source definition is:

def finiteCenteredBadBlockSet {Ω : Type uΩ} (T : Ω → Ω)
    (X : ℕ → Ω → ℝ) (m : ℕ) (c : ℝ) : Set Ω :=
  ⋃ n ∈ Finset.Icc 1 m,
    {ω | centeredProcess T X n ω < c * (n : ℝ)}

Candidate integrability and preservation are introduced only when the source proves that this finite union is null measurable. A null set has measure zero. A null measurable set may differ from an ordinary measurable set by a null set. That weaker regularity is exactly what the integration interface needs.

Turn visits into an indicator Birkhoff sum

For a set \(s\subseteq\Omega\), define

\[ N_H^s(\omega) := \#\{j\in\{0,\ldots,H-1\}:T^j\omega\in s\}. \]

The corresponding Birkhoff sum is finite:

\[ \sum_{j=0}^{H-1}\mathbf 1_s(T^j\omega). \]

The symbol \(\mathbf 1_s\) is the indicator of \(s\): it is one on \(s\) and zero outside.

In Lean: cast the count to the exact finite sum

One idea, three languages Read across, then read the syntax map
A human says
Count the first H orbit positions that lie in s; after casting the natural count to the reals, it equals the sum of H zero-or-one indicators.
On paper
\((N_H^s(\omega):\mathbb R)=\sum_{j=0}^{H-1}\mathbf 1_s(T^j\omega).\)
In Lean
natCast_finiteOrbitVisitCount_eq_birkhoffSum_indicator T s H ω
Syntax map
  • finiteOrbitVisitCount T s H ω is a natural-number cardinality.
  • ( ... : ℝ) is its real cast.
  • birkhoffSum T samples along iterates of the original map \(T\).
  • s.indicator fun _ ↦ (1 : ℝ) is the real-valued indicator.
  • H is the exact number of summands.
  • This theorem is finite combinatorics. It assumes no measurable space, measure, preservation, probability, or ergodicity.

At \(H=0\), both sides are zero. No separate positivity premise is required.

In Lean: integrate the finite visit count

One idea, three languages Read across, then read the syntax map
A human says
If T preserves a finite measure and s is null measurable, every translated indicator has the same integral, so the H-term count integrates to H times the real measure of s.
On paper
\(\int N_H^s\,d\mu=H\,\mu_{\mathbb R}(s).\)
In Lean
integral_finiteOrbitVisitCount hT hs H
Syntax map
  • [IsFiniteMeasure μ] says the whole space has finite total mass.
  • hT : MeasurePreserving T μ μ keeps \(\mu\) unchanged under \(T\).
  • hs : NullMeasurableSet s μ is enough for indicator integration.
  • μ.real s is Mathlib’s real-valued projection of the measure of \(s\).
  • H * μ.real s uses the coerced natural horizon as a real scalar.
  • The conclusion is exact for every finite \(H\), including zero.

Probability normalization is absent. If the total mass were two, the two sides would both scale by two.

From one witness per visit to a pointwise cost bound

At every marked start \(j\lt H\), membership in \(B_m(c)\) supplies at least one witness length

\[ 1\le\ell(j)\le m, \qquad Y_{\ell(j)}(T^j\omega)\lt c\ell(j). \]

The source uses classical choice to select one such \(\ell(j)\). It does not choose a shortest, longest, or globally optimal witness. RMT-21’s greedy interval theorem then extracts disjoint intervals that cover every marked start.

Positive-time nonpositivity lets the proof discard uncovered gaps from an upper bound. Shifted subadditivity concatenates the retained interval costs. Because \(c\le0\), covered length at least the number of marks implies the marked-cardinality estimate in the required direction.

In Lean: obtain the buffered pointwise inequality

One idea, three languages Read across, then read the syntax map
A human says
Choose one short bad witness at every marked orbit start, greedily keep a disjoint cover, and bound the centered process at H plus m by c times the number of marked starts.
On paper
\(Y_{H+m}(\omega)\le cN_H^{B_m(c)}(\omega).\)
In Lean
hX.centeredProcess_le_badBlockVisitCount H m hHm c hc ω
Syntax map
  • hX packages finite-horizon integrability and shifted subadditivity.
  • hHm : H + m ≠ 0 excludes the genuine joint zero corner.
  • hc : c ≤ 0 is needed when covered length is compared with marked cardinality.
  • ω remains arbitrary, so the result is pointwise.
  • The proof body consumes shifted subadditivity and positive-time nonpositivity. The public receiver still carries the stronger integrability package.
  • No measure, probability, preservation, ergodicity, or limit appears in the conclusion.

The corner \(H=m=0\) cannot be erased. Then the right side is zero while

\[ Y_0=X_0 \]

may be positive. If \(H=0\) but \(m\gt0\), the theorem reduces to \(Y_m\le0\), which is valid. If \(m=0\) but \(H\gt0\), the bad set is empty and the theorem reduces to \(Y_H\le0\).

Integrate first, then remove only the finite buffer

Assume a scalar \(\delta\) satisfies

\[ \delta \le \frac{\int_\Omega Y_n\,d\mu}{n} \qquad \text{for every }n\gt0. \]

Applying this at \(H+m\), integrating the pointwise packing bound, and using the exact count identity gives

\[ \delta \le \left(c\,\mu_{\mathbb R}(B_m(c))\right) \frac{H}{H+m}. \]

At time one, \(Y_1=0\), so the premise forces \(\delta\le0\). The additional assumption \(c\lt\delta\) gives \(c\lt0\). The elementary coefficient tends to one as \(H\) grows. Therefore

\[ \delta \le c\,\mu_{\mathbb R}(B_m(c)). \]

Negative division finally yields the finite ratio.

In Lean: invoke the generic finite-measure ratio

One idea, three languages Read across, then read the syntax map
A human says
If delta lies below every positive normalized centered integral and c is strictly below delta, then the real measure of the finite strict bad-block event is at most delta divided by c.
On paper
\(c<\delta\ \Longrightarrow\ \mu_{\mathbb R}(B_m(c))\le\delta/c.\)
In Lean
hX.measureReal_finiteCenteredBadBlockSet_le_rateRatio hT m δ c hδ hc
Syntax map
  • [IsFiniteMeasure μ] is the only total-mass typeclass.
  • hT supplies preservation of \(\mu\) by \(T\).
  • hδ has type ∀ n : ℕ, n ≠ 0 → δ ≤ (∫ ω, centeredProcess T X n ω ∂μ) / (n : ℝ).
  • hc : c < δ lets the proof derive both \(\delta\le0\) and \(c\lt0\).
  • le_div_iff_of_neg hcneg performs the final order reversal explicitly.
  • The theorem contains no probability or ergodicity premise.
  • The only limiting object is the deterministic coefficient \(H/(H+m)\), not a sample process.

The stronger strict comparison \(c\lt\delta\) also makes

\[ 0\le\frac{\delta}{c}\lt1. \]

That subunit ceiling is useful to a later probability-and-ergodicity argument. This module does not perform that later argument.

Specialize the lower-rate witness to matrix cocycles

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

\[ \begin{aligned} X_n(\omega) &=\log^+\lVert C(n,\omega)\rVert_\infty. \end{aligned} \]

The one-step log-positive integrability package produces an integrable subadditive candidate. Define the deterministic offset

[ \delta_C := \gamma_\mu^+(C)

\int_\Omega X_1,d\mu, ]

where \(\gamma_\mu^+(C)\) is the integrated log-positive Fekete rate.

In Lean: prove the cocycle offset is a lower bound

One idea, three languages Read across, then read the syntax map
A human says
For every positive horizon, the integrated Fekete rate minus the one-step integral lies below the normalized integral of the centered log-positive process.
On paper
\(\delta_C\le n^{-1}\int Y_n\,d\mu\quad(n>0).\)
In Lean
hC.centeredFeketeOffset_le_normalizedIntegral n hn
Syntax map
  • hC : C.HasIntegrableGeneratorLogPlus supplies one-step integrability.
  • n : ℕ is the finite horizon.
  • hn : n ≠ 0 licenses real division by the cast horizon.
  • integratedLogPlusGrowthRate hC is a deterministic infimum from Fekete’s lemma.
  • integratedLogPlusNorm 1 is the raw one-step integral.
  • integral_centeredProcess rewrites the centered integral exactly.
  • This theorem compares deterministic integrals. It is not a samplewise limit.

In Lean: obtain the cocycle finite bad-set ratio

One idea, three languages Read across, then read the syntax map
A human says
Choose any threshold strictly below the cocycle’s centered Fekete offset; the finite centered log-positive bad-block event has real measure at most offset divided by threshold.
On paper
\(c<\delta_C\ \Longrightarrow\ \mu_{\mathbb R}(B_m^C(c))\le\delta_C/c.\)
In Lean
hC.measureReal_centeredLogPlusBadBlockSet_le_rateRatio m c hc
Syntax map
  • centeredLogPlusBadBlockSet is only a named specialization of the generic event.
  • [IsFiniteMeasure μ] supplies finite total mass.
  • C.base_preserving supplies preservation already bundled with the cocycle.
  • hC.isIntegrableSubadditiveProcessCandidate supplies the generic process.
  • hc is the strict threshold comparison.
  • No PreErgodic, Ergodic, IsProbabilityMeasure, or nonempty matrix-index hypothesis is introduced.
  • The endpoint remains valid when the finite matrix index type is empty.

Assumption ledger: keep the layers separate

LayerAssumptions actually exposedWhat it obtains
Define \(B_m(c)\)A map \(T\), process \(X\), cap \(m\), slope \(c\)A set of sample points
Count visitsA map, set, finite horizon, sample pointA natural number
Cast count to a Birkhoff sumFinite combinatorics onlyExact pointwise equality
Prove bad-set regularityCandidate integrability and measure preservationNull measurability
Pack witnesses pointwiseShifted subadditivity, positive-time nonpositivity, \(H+m\ne0\), \(c\le0\)\(Y_{H+m}\le cN_H\)
Integrate visit countsFinite total measure, preservation, null measurability\(\int N_H=H\mu_{\mathbb R}(B)\)
Prove the generic ratioAll preceding measure hypotheses, the all-positive-horizon lower bound, \(c\lt\delta\)\(\mu_{\mathbb R}(B_m(c))\le\delta/c\)
Specialize to cocyclesFinite total measure and integrable generator log-positive normThe same finite ratio for \(B_m^C(c)\)

The opening example uses a probability measure to make atomwise averaging explicit. The generic theorem needs only a finite measure. Neither the generic theorem nor its cocycle specialization needs ergodicity.

Exact declaration map

The source exposes ten public declarations in dependency order:

#Public declarationExact role
1finiteOrbitVisitCountDefines the natural count of visits among positions \(0,\ldots,H-1\)
2natCast_finiteOrbitVisitCount_eq_birkhoffSum_indicatorCasts that count to the exact indicator Birkhoff sum
3integral_finiteOrbitVisitCountIntegrates the count as \(H\mu_{\mathbb R}(s)\)
4finiteCenteredBadBlockSetDefines the strict finite union over Finset.Icc 1 m
5IsIntegrableSubadditiveProcessCandidate.nullMeasurableSet_finiteCenteredBadBlockSetProves null measurability under preservation
6IsIntegrableSubadditiveProcessCandidate.centeredProcess_le_badBlockVisitCountProves the buffered pointwise packing bound
7IsIntegrableSubadditiveProcessCandidate.measureReal_finiteCenteredBadBlockSet_le_rateRatioProves the generic finite-measure ratio
8DiscreteMatrixCocycle.centeredLogPlusBadBlockSetNames the cocycle’s finite centered bad-block event
9DiscreteMatrixCocycle.HasIntegrableGeneratorLogPlus.centeredFeketeOffset_le_normalizedIntegralSupplies the normalized-centered-integral lower bound
10DiscreteMatrixCocycle.HasIntegrableGeneratorLogPlus.measureReal_centeredLogPlusBadBlockSet_le_rateRatioSpecializes the generic ratio to the cocycle

The previous version of this chapter counted nine and omitted declaration 9. The table above matches the checked 506-line source.

All eleven private support declarations

Private itemWhy it exists
rmt30ZeroProcessA process that is zero at every horizon and sample
rmt30ZeroProcess_candidatePackages that process as an integrable shifted-subadditive candidate
rmt30PositiveAtZeroProcessMakes only the time-zero value positive
rmt30PositiveAtZeroProcess_candidateCertifies the joint-zero countermodel as a valid candidate
rmt30TwoPointProbabilityDefines the equal-weight Bool probability measure
Anonymous IsProbabilityMeasure rmt30TwoPointProbability instanceChecks that the two half masses sum to one
rmt30Id_not_preErgodicProves the identity base is not pre-ergodic
rmt30TwoPointProcessDefines the exact amber/blue process used in this chapter
rmt30TwoPointProcess_candidateCertifies its integrability and shifted subadditivity
rmt30MassTwoMeasureDefines a finite measure of total mass two
Anonymous IsFiniteMeasure rmt30MassTwoMeasure instanceSupplies the finite-mass typeclass for the rescaling boundary

All nine compiled anonymous boundary examples

  1. A zero cap makes the candidate-length window empty.
  2. Horizon zero is valid when the cap is positive.
  3. The zero process has no bad blocks at a negative threshold.
  4. The joint corner \(H=m=0\) fails for the positive-at-zero candidate.
  5. Zero measure gives every bad set real measure zero.
  6. The nonergodic two-point identity model has exact bad mass \(1/2\) and satisfies \(1/2\le2/3\).
  7. Equality with the time-one zero threshold is not marked.
  8. A mass-two finite measure is accepted without probability normalization.
  9. The cocycle endpoint accepts an empty matrix-index type.

All seven axiom reports

The file prints axiom footprints for:

  1. natCast_finiteOrbitVisitCount_eq_birkhoffSum_indicator;
  2. integral_finiteOrbitVisitCount;
  3. nullMeasurableSet_finiteCenteredBadBlockSet;
  4. centeredProcess_le_badBlockVisitCount;
  5. measureReal_finiteCenteredBadBlockSet_le_rateRatio;
  6. centeredFeketeOffset_le_normalizedIntegral; and
  7. measureReal_centeredLogPlusBadBlockSet_le_rateRatio.

The source’s recorded project validation found the expected Mathlib logical footprint.

A bounded executable model using only Std

The next worksheet reproduces the complete two-atom ledger without importing Mathlib or this project. It is a standalone tutorial suitable for a normal macOS or Linux machine. It is not a proof of the general measure theorem.

Save this exact block as /tmp/SubadditiveBadBlockMeasureTutorial.lean:

import Std

namespace SubadditiveBadBlockMeasureTutorial

inductive Atom where
  | amber
  | blue
  deriving Repr, DecidableEq

open Atom

def cap : Nat := 5
def countingHorizon : Nat := 12
def bufferedHorizon : Nat := countingHorizon + cap
def slope : Rat := -(3 : Rat) / 4
def lowerRate : Rat := -(1 : Rat) / 2

def centered (n : Nat) : Atom → Rat
  | amber => -((n - 1 : Nat) : Rat)
  | blue => 0

def candidateLengths (m : Nat) : List Nat :=
  (List.range m).map Nat.succ

def badAtLength (c : Rat) (n : Nat) (ω : Atom) : Bool :=
  decide (centered n ω < c * (n : Rat))

def badAtCap (m : Nat) (c : Rat) (ω : Atom) : Bool :=
  (candidateLengths m).any fun n => badAtLength c n ω

def shortRows : List (Nat × Rat × Rat × Bool × Bool) :=
  (candidateLengths cap).map fun n =>
    (n, centered n amber, slope * (n : Rat),
      badAtLength slope n amber, badAtLength slope n blue)

def badSet : List Atom :=
  [amber, blue].filter fun ω => badAtCap cap slope ω

def visitCount (H : Nat) (ω : Atom) : Nat :=
  ((List.range H).filter fun _ => badAtCap cap slope ω).length

def packedStarts : List Nat := [0, 5, 10]

def packedIntervals : List (Nat × Nat) :=
  packedStarts.map fun start => (start, start + cap)

def allMarkedStartsCovered : Bool :=
  (List.range countingHorizon).all fun j =>
    packedStarts.any fun start =>
      decide (start ≤ j ∧ j < start + cap)

def packedCost : Rat :=
  (packedStarts.map fun _ => centered cap amber).sum

def coveredLength : Nat :=
  packedStarts.length * cap

def integral (f : Atom → Rat) : Rat :=
  (f amber + f blue) / 2

def badMass : Rat :=
  ((badSet.length : Rat) / 2)

def visitIntegral : Rat :=
  integral fun ω => (visitCount countingHorizon ω : Rat)

def bufferedIntegral : Rat :=
  integral fun ω => centered bufferedHorizon ω

def packingChain : List Bool :=
  [decide (centered bufferedHorizon amber ≤ packedCost),
   decide (packedCost ≤ slope * (coveredLength : Rat)),
   decide (slope * (coveredLength : Rat) ≤
     slope * (visitCount countingHorizon amber : Rat))]

def ratio : Rat :=
  lowerRate / slope

def zeroThresholdBoundary : Bool × Bool × Bool :=
  (badAtCap 0 slope amber,
   badAtCap 1 0 amber,
   badAtCap cap 0 amber)

#eval shortRows
#eval badSet
#eval [visitCount countingHorizon amber, visitCount countingHorizon blue]
#eval packedIntervals
#eval (allMarkedStartsCovered, packedCost, coveredLength, packingChain)
#eval (visitIntegral,
  (countingHorizon : Rat) * badMass,
  bufferedIntegral,
  slope * visitIntegral)
#eval (badMass, ratio,
  decide (badMass ≤ ratio),
  decide (badMass ≥ ratio))
#eval zeroThresholdBoundary

example : shortRows =
    [(1, 0, -(3 : Rat) / 4, false, false),
     (2, -1, -(3 : Rat) / 2, false, false),
     (3, -2, -(9 : Rat) / 4, false, false),
     (4, -3, -3, false, false),
     (5, -4, -(15 : Rat) / 4, true, false)] := by
  native_decide

example : badSet = [amber] := by native_decide
example : packedIntervals = [(0, 5), (5, 10), (10, 15)] := by native_decide
example : allMarkedStartsCovered := by native_decide
example : packingChain = [true, true, true] := by native_decide
example : visitIntegral = 6 := by native_decide
example : bufferedIntegral = -8 := by native_decide
example : badMass = (1 : Rat) / 2 := by native_decide
example : ratio = (2 : Rat) / 3 := by native_decide
example : badMass ≤ ratio := by native_decide
example : ¬ badMass ≥ ratio := by native_decide
example : zeroThresholdBoundary = (false, false, true) := by native_decide

end SubadditiveBadBlockMeasureTutorial

Type:

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

The exact worksheet above was run successfully under Lean 4.32.0. Its exact transcript is:

[(1, 0, (-3 : Rat)/4, false, false),
 (2, -1, (-3 : Rat)/2, false, false),
 (3, -2, (-9 : Rat)/4, false, false),
 (4, -3, -3, false, false),
 (5, -4, (-15 : Rat)/4, true, false)]
[SubadditiveBadBlockMeasureTutorial.Atom.amber]
[12, 0]
[(0, 5), (5, 10), (10, 15)]
(true, -12, 15, [true, true, true])
(6, 6, -8, (-9 : Rat)/2)
((1 : Rat)/2, (2 : Rat)/3, true, false)
(false, false, true)

Read the last two lines carefully:

  • the actual mass is \(1/2\);
  • the ratio ceiling is \(2/3\);
  • true certifies \(1/2\le2/3\);
  • false refutes the unreversed proposal \(1/2\ge2/3\); and
  • the final triple says cap zero is empty, cap one at threshold zero is empty, but cap five at threshold zero is not empty.

Inspect and check the exact project interfaces

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

The authoritative source is formalization/NonlinearDynamics/Random/RandomCocycles/SubadditiveBadBlockMeasure.lean. For a full project check, install the repository’s pinned dependencies and place these inspection commands in a temporary project scratch file:

import NonlinearDynamics.Random.RandomCocycles.SubadditiveBadBlockMeasure

open MeasureTheory
open NonlinearDynamics.Random.RandomCocycles

#check finiteOrbitVisitCount
#check natCast_finiteOrbitVisitCount_eq_birkhoffSum_indicator
#check integral_finiteOrbitVisitCount
#check finiteCenteredBadBlockSet
#check IsIntegrableSubadditiveProcessCandidate.nullMeasurableSet_finiteCenteredBadBlockSet
#check IsIntegrableSubadditiveProcessCandidate.centeredProcess_le_badBlockVisitCount
#check IsIntegrableSubadditiveProcessCandidate.measureReal_finiteCenteredBadBlockSet_le_rateRatio
#check DiscreteMatrixCocycle.centeredLogPlusBadBlockSet
#check DiscreteMatrixCocycle.HasIntegrableGeneratorLogPlus.centeredFeketeOffset_le_normalizedIntegral
#check DiscreteMatrixCocycle.HasIntegrableGeneratorLogPlus.measureReal_centeredLogPlusBadBlockSet_le_rateRatio

The exact module check from the repository root is:

cd formalization
lake env lean NonlinearDynamics/Random/RandomCocycles/SubadditiveBadBlockMeasure.lean

That Mathlib-backed command may require substantial disk space and memory. The lightweight Std worksheet above is the smaller learning path.

Full project check, from the repository root
cd formalization
lake env lean -DwarningAsError=true NonlinearDynamics/Random/RandomCocycles/SubadditiveBadBlockMeasure.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.

Neither command changes pro_reviewed: false; technical validation and human review are separate gates.

Common wrong turns

Treating the bad event as a long-time event

\(B_m(c)\) asks whether one witness exists among finitely many lengths. It does not mean:

  • bad blocks occur infinitely often;
  • witnesses occur after every cutoff;
  • a normalized lower limit is below \(c\); or
  • the process converges.

Those are different events with different quantifiers.

Replacing strict inequality by a weak one

At length four in the running example,

\[ Y_4(\text{amber})=-3=c\cdot4. \]

The block is not marked. Replacing \(\lt\) by \(\le\) changes the event.

Forgetting the orbit shift

At a marked start \(j\), the witness cost is

\[ Y_{\ell(j)}(T^j\omega), \]

not \(Y_{\ell(j)}(\omega)\) unless the base happens to be the identity. The running example uses identity dynamics for arithmetic clarity. The theorem does not.

Calling the pointwise packing theorem measure theoretic

The public method is attached to an integrable candidate, but its proof body uses shifted subadditivity and positive-time nonpositivity. The integration field is consumed later, when the inequality is integrated.

Calling a finite measure a probability measure

The generic theorem assumes finite total mass, not total mass one. The source compiles a mass-two boundary. Probability normalization becomes important only when a later argument interprets a strict subunit ratio canonically.

Claiming that the auxiliary limit is Kingman’s theorem

The proof sends the elementary number \(H/(H+m)\) to one. It does not prove that \(Y_n(\omega)/n\), \(X_n(\omega)/n\), or any matrix growth observable converges.

What this module proves

It proves:

  • a natural-valued finite orbit-visit count;
  • the exact equality between its real cast and an indicator Birkhoff sum;
  • exact finite visit-count integration under finite measure and preservation;
  • null measurability of the finite centered strict bad-block event;
  • a pointwise greedy-packing estimate on the buffered horizon;
  • a generic finite-measure ratio with negative division made explicit;
  • the integrated Fekete-offset lower-bound bridge; and
  • the finite log-positive matrix-cocycle specialization.

It proves neither lower liminf nor Kingman convergence. It also proves no:

  • almost-everywhere convergence;
  • equality of a sample rate with the integrated Fekete rate;
  • \(L^1\) convergence;
  • limit-integral interchange;
  • ergodicity of \(T\) or a powered map;
  • signed logarithmic growth theorem;
  • Lyapunov exponent;
  • Oseledets filtration or splitting; or
  • quantitative rate or concentration inequality.

The next chapters first pass from fixed finite caps to the union over all positive lengths, then build an arbitrarily-late rational-threshold event. Only later does an ergodic probability argument connect such events to a lower liminf.

Exercises with answers

  1. Which candidate length is bad on amber? Only \(n=5\). At \(n=4\) the value equals the threshold, and strictness excludes it.
  2. What is the bad event? \(B_5(-3/4)=\{\text{amber}\}\).
  3. What is its probability? \(1/2\).
  4. Why does blue contribute no visits? Its orbit remains blue and every centered value is zero, while all five thresholds are negative.
  5. Why do twelve amber marks need only three retained intervals? The intervals \([0,5)\), \([5,10)\), and \([10,15)\) cover all starts \(0,\ldots,11\).
  6. What is their total cost? Three copies of \(-4\), hence \(-12\).
  7. Why is \(-45/4\le-9\)? Covered length \(15\) is at least marked count \(12\), and multiplying by \(-3/4\) reverses the comparison.
  8. Compute the visit integral. \((12+0)/2=6\).
  9. Compute the buffered-process integral. \((-16+0)/2=-8\).
  10. Why is \(\delta=-1/2\) valid for every positive \(n\)? Because \(I_n/n=-1/2+1/(2n)\ge-1/2\).
  11. Compute the theorem’s ceiling. \(\delta/c=(-1/2)/(-3/4)=2/3\).
  12. What does the wrong sign rule predict? \(1/2\ge2/3\), which is false.
  13. Is \(B_1(0)\) empty? Yes, because \(Y_1=0\) and the test is strict.
  14. Is \(B_5(0)\) empty in this model? No. Amber is already bad at length two.
  15. Where is probability normalization used in the generic theorem? Nowhere. The example uses it for a simple atomwise calculation.
  16. Where is ergodicity used? Nowhere in this module.
  17. What limit is taken? Only \(H/(H+m)\to1\) for fixed \(m\).
  18. What major theorem is still absent? Any lower-liminf conclusion and Kingman’s samplewise convergence theorem.

Continue the dependency-ordered climb

The immediate predecessor is Finite Ordered Interval Packing for Nonpositive Subadditive Processes. The next textbook step is From Finite Centered Bad-Block Bounds to All-Positive-Length Control. The paired Development Notebook records the proof construction and source history. The finite orbit-visit count glossary chapter isolates the counting primitive.

References

J. F. C. Kingman. The ergodic theory of subadditive stochastic processes, Journal of the Royal Statistical Society: Series B 30(3), 499-510, 1968, doi:10.1111/j.2517-6161.1968.tb00749.x. This is the primary source for the full theorem that this finite module does not yet prove.

J. Michael Steele. Kingman’s subadditive ergodic theorem, Annales de l’Institut Henri Poincare, Probabilites et Statistiques 25(1), 93-98, 1989. Steele gives an interval-decomposition proof of the full theorem. RMT-30 isolates and checks one finite bad-block measure bridge from that proof lineage.

Mathlib contributors. Indicator integration, Mathlib commit 81a5d257. The pinned library supplies the null-measurable indicator integration interface used by the checked proof.

Mathlib contributors. Elementary limits at infinity, Mathlib commit 81a5d257. The source uses tendsto_natCast_div_add_atTop only for the auxiliary finite-buffer coefficient.

The audited Lean source SHA-256 for this chapter is a8aee618a10f8434c1c33d8e433fd77e98ed3e5c8dee399e7d6fa323c5079b28.