Skip to content

feat: require Statlib, bump Mathlib to 2ddf59c - #298

Merged
RemyDegenne merged 7 commits into
mainfrom
require-statlib
Nov 13, 2026
Merged

RemyDegenne merged 7 commits into
mainfrom
require-statlib

Conversation

@RemyDegenne

@RemyDegenne RemyDegenne commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Makes LML depend on Statlib, and get Mathlib through it (now 2ddf59c, the commit Tau Ceti's main pins). LML's copies of Statlib material are replaced with Statlib's.
With Statlib, we gain access to many properties of klDiv and other information divergences. No Statlib definition is added to the dependencies of the LML definitions.

Dependencies

Using Statlib

stat-lib/statlib#81 moved into Statlib the LML material that Statlib lacked or had in less generality: the measurable space on kernels, klDiv_compProd_left_of_ae, the convexity of klDiv for finite mixtures, and the generality of rnDeriv_restrict_restrict. LML now uses Statlib's versions, and removes its copies together with the material that duplicated Statlib:

  • Three files are removed: LeanMachineLearning.ForMathlib.Probability.Kernel.MeasurableSpace, LeanMachineLearning.ForMathlib.InformationTheory.KullbackLeibler.ChainRule and LeanMachineLearning.ForMathlib.InformationTheory.KullbackLeibler.Convex.
  • klDiv_eq_iSup_map: the 130-line proof (Lévy's upward theorem and Fatou) becomes a 4-line corollary of Statlib's tendsto_fDiv_map_of_iSup_comap_eq.
  • klDiv_restrict_add_restrict_compl: now a corollary of Statlib's klDiv_eq_klDiv_restrict_add_klDiv_restrict_compl.

Before this PR, LML and Statlib declared some of the same names, two instances of MeasurableSpace (Kernel α β) that are not definitionally equal, and a klDiv_smul_add_smul_le in two namespaces. None of these remain.

Removed or renamed declarations

Old Replacement
ProbabilityTheory.instMeasurableSpaceKernel, ProbabilityTheory.measurable_kernel_iff, ProbabilityTheory.Kernel.measurable_const the same names, from Statlib
InformationTheory.klDiv_map_measurableEmbedding, InformationTheory.klDiv_comp_le_compProd, InformationTheory.klDiv_compProd_left_of_ae the same names, from Statlib
MeasureTheory.Measure.rnDeriv_restrict_restrict the same name, from Statlib (now as general)
InformationTheory.klDiv_le_compProd InformationTheory.le_klDiv_compProd
InformationTheory.klDiv_smul_add_smul_le ProbabilityTheory.klDiv_smul_add_smul_le
InformationTheory.measurable_klDiv_kernel ProbabilityTheory.measurable_klDiv
InformationTheory.klDiv_compProd_right_eq_lintegral ProbabilityTheory.condKL_eq_lintegral, where condKL κ η μ is klDiv (μ ⊗ₘ κ) (μ ⊗ₘ η) (rewrite with ← condKL first)
InformationTheory.klDiv_compProd_eq_add_lintegral ProbabilityTheory.klDiv_compProd_eq_add_condKL, then condKL_eq_lintegral
InformationTheory.klDiv_finsetSum_smul_le, klDiv_sum_smul_le, klDiv_finsetSum_smul_left_le, klDiv_sum_smul_left_le, klDiv_finsetSum_smul_right_le, klDiv_sum_smul_right_le the same names in ProbabilityTheory, from Statlib

Automatic updates

update.yml now bumps Statlib instead of Mathlib. Every six hours it does the following:

  1. Runs lake update Statlib. This moves Statlib to its latest main and Mathlib to the commit Statlib pins; I checked this locally from an older Statlib pin.
  2. Builds LML and its tutorial with --wfail.
  3. Opens or updates a pull request on the statlib-bump branch.

Pull requests opened with the workflow token do not trigger the Build workflow, so the job builds before opening one.

The two downstream-reports jobs are removed (bump-to-latest and track-incompatibility). They act on a direct Mathlib requirement, which LML no longer has. Statlib's own updater keeps it close to Mathlib master and tracks the incompatibilities there.

LML's entry in downstream-reports' inventory (ci/inventory/downstreams.json, with dependency_name: "mathlib") assumes a direct Mathlib requirement, so it should probably be disabled there.

🤖 Generated with Claude Code

https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo

RemyDegenne and others added 4 commits November 13, 2026 10:03
Require Statlib (at b1c8cb5, on the same Mathlib) and move Mathlib from
6135ffb to 2ddf59c, the commit Tau Ceti's main pins. Statlib is required
before Verso so that Verso's `subverso` pin wins.

Fixes for Mathlib changes: `EventuallyEqSet` (mathlib4#45712) and the
`enorm` → `eNorm` rename (mathlib4#45735).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
`Submartingale.ae_tendsto_limitProcess` now takes `⨆ n, eLpNorm (f n) 1 μ < ∞`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
LML and Statlib declared the same names, so they could not be imported
together.

- Remove `InformationTheory.klDiv_map_measurableEmbedding` and
  `InformationTheory.klDiv_comp_le_compProd`, which Statlib provides with
  the same statements, and `InformationTheory.klDiv_le_compProd`, which
  is Statlib's `InformationTheory.le_klDiv_compProd`.
- Rename `MeasureTheory.Measure.rnDeriv_restrict_restrict` to
  `rnDeriv_restrict_restrict'`: it generalizes Statlib's lemma of that
  name (`μ.HaveLebesgueDecomposition ν` instead of `SigmaFinite μ`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
- `klDiv_eq_iSup_map`: the 130-line proof (Lévy's upward theorem and
  Fatou) becomes a corollary of Statlib's approximation of f-divergences
  along a generating sequence of maps (`tendsto_fDiv_map_of_iSup_comap_eq`).
- `klDiv_restrict_add_restrict_compl`: a corollary of Statlib's
  `klDiv_eq_klDiv_restrict_add_klDiv_restrict_compl`.
- Remove `InformationTheory.klDiv_smul_add_smul_le`, which duplicates
  Statlib's `ProbabilityTheory.klDiv_smul_add_smul_le`: with both
  namespaces open, the short name was ambiguous.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
…xity

Bump Statlib to af34969 (stat-lib/statlib#81), which provides LML's
measurable space on kernels, `klDiv_compProd_left_of_ae`, the convexity of
`klDiv` for finite mixtures and the generality of
`rnDeriv_restrict_restrict`, and delete LML's copies:

- `LeanMachineLearning.ForMathlib.Probability.Kernel.MeasurableSpace`:
  the same declarations are in `Statlib.ForMathlib.Probability.Kernel.MeasurableSpace`.
- `LeanMachineLearning.ForMathlib.InformationTheory.KullbackLeibler.ChainRule`:
  `measurable_klDiv_kernel` is `ProbabilityTheory.measurable_klDiv`,
  `klDiv_compProd_right_eq_lintegral` is `ProbabilityTheory.condKL_eq_lintegral`
  (`condKL κ η μ` is `klDiv (μ ⊗ₘ κ) (μ ⊗ₘ η)`), `klDiv_compProd_eq_add_lintegral`
  follows from `klDiv_compProd_eq_add_condKL`, and `klDiv_compProd_left_of_ae` keeps
  its name.
- `LeanMachineLearning.ForMathlib.InformationTheory.KullbackLeibler.Convex`:
  the lemmas are in Statlib, in the `ProbabilityTheory` namespace.
- `MeasureTheory.Measure.rnDeriv_restrict_restrict'`: Statlib's
  `rnDeriv_restrict_restrict` now has the same generality.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
RemyDegenne and others added 2 commits November 13, 2026 11:47
Drop the direct Mathlib requirement: Mathlib now comes through Statlib,
at the commit Statlib pins (still 2ddf59c), so that LML always builds
against the Mathlib that Statlib was tested with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
LML now gets Mathlib through Statlib, so the scheduled updater bumps
Statlib to its latest `main` (which moves Mathlib to Statlib's pin),
builds LML and its tutorial with `--wfail`, and opens or updates a pull
request on the `statlib-bump` branch.

The downstream-reports Mathlib bump and incompatibility jobs are removed:
they act on a direct Mathlib requirement, which LML no longer has, and
Mathlib incompatibilities are tracked on Statlib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
@RemyDegenne
RemyDegenne merged commit 86a0ab0 into main Nov 13, 2026
1 check passed
@RemyDegenne
RemyDegenne deleted the require-statlib branch November 13, 2026 16:12
RemyDegenne added a commit to LeanMachineLearning/LMLExplore that referenced this pull request Nov 13, 2026
…tatlib

Pins: Tau Ceti 4d91513 (main, prebuilt files published), Mathlib
2ddf59c (Tau Ceti's), LML edad3c0 (LeanMachineLearning/LML#298, on the
same Mathlib), and Statlib af34969, which LML requires.

Repairs:
- Mathlib: `EventuallyEqSet` and `EventuallySubset` (mathlib4#45712),
  `enorm` → `eNorm` and `nnnorm` → `nnNorm` renames, and two more
  deprecations.
- Tau Ceti: `TotalVariation` and `Kernel.Matrix` became directories;
  `TauCeti.Probability.measurable_bernoulliMeasure` is now
  `Measurable.bernoulliMeasure`; `TauCeti.lowerSemicontinuous_iInf_of_compactSpace`
  is now `LowerSemicontinuous.iInf_of_compactSpace`.
- LML: its chain rule and kernel modules moved to Statlib.
- Duplicates with the new dependencies, found by the axioms audit:
  remove `EReal.toENNReal_inv` (and `LMLExplore.Data.EReal.Inv`), now
  Statlib's, and `ProbabilityTheory.Kernel.Invariant.pow`, now Tau Ceti's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
RemyDegenne added a commit to LeanMachineLearning/LMLExplore that referenced this pull request Nov 13, 2026
LML is now pinned at 86a0ab0, the merge of LeanMachineLearning/LML#298 (same tree as the
previous pin edad3c0 plus LML's CI and lakefile changes).

Two files that landed on main during the sync used names that the new pins change:
- `KullbackLeibler/Bernoulli.lean` imported LML's `KullbackLeibler.Convex`, which moved to
  Statlib: it now imports `Statlib.Divergence.KullbackLeibler.Basic` for
  `ProbabilityTheory.klDiv_smul_add_smul_le`.
- `ExponentialFamily/Bernoulli.lean`: Tau Ceti's `map_withDensity_abs_deriv_mul` no longer takes
  a measurability hypothesis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
RemyDegenne added a commit to LeanMachineLearning/LMLExplore that referenced this pull request Nov 13, 2026
…tatlib (#315)

* chore: sync Tau Ceti 4d91513, Mathlib 2ddf59c and LML, which brings Statlib

Pins: Tau Ceti 4d91513 (main, prebuilt files published), Mathlib
2ddf59c (Tau Ceti's), LML edad3c0 (LeanMachineLearning/LML#298, on the
same Mathlib), and Statlib af34969, which LML requires.

Repairs:
- Mathlib: `EventuallyEqSet` and `EventuallySubset` (mathlib4#45712),
  `enorm` → `eNorm` and `nnnorm` → `nnNorm` renames, and two more
  deprecations.
- Tau Ceti: `TotalVariation` and `Kernel.Matrix` became directories;
  `TauCeti.Probability.measurable_bernoulliMeasure` is now
  `Measurable.bernoulliMeasure`; `TauCeti.lowerSemicontinuous_iInf_of_compactSpace`
  is now `LowerSemicontinuous.iInf_of_compactSpace`.
- LML: its chain rule and kernel modules moved to Statlib.
- Duplicates with the new dependencies, found by the axioms audit:
  remove `EReal.toENNReal_inv` (and `LMLExplore.Data.EReal.Inv`), now
  Statlib's, and `ProbabilityTheory.Kernel.Invariant.pow`, now Tau Ceti's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo

* docs: Statlib as a dependency, and the sync policy

Statlib comes through LML: list it with the other dependencies (agent
instructions, README, overlap scan, CI comments) and give it an
`[[upstreams]]` entry in `tauceti.toml`, so that the overlap scan covers
it. The sync policy now pins Tau Ceti at a `main` commit whose prebuilt
files are published (usually its release tag), and LML and Statlib on
the same Mathlib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo

* chore: pin LML at the merge of LML#298, and repair main's new code

LML is now pinned at 86a0ab0, the merge of LeanMachineLearning/LML#298 (same tree as the
previous pin edad3c0 plus LML's CI and lakefile changes).

Two files that landed on main during the sync used names that the new pins change:
- `KullbackLeibler/Bernoulli.lean` imported LML's `KullbackLeibler.Convex`, which moved to
  Statlib: it now imports `Statlib.Divergence.KullbackLeibler.Basic` for
  `ProbabilityTheory.klDiv_smul_add_smul_le`.
- `ExponentialFamily/Bernoulli.lean`: Tau Ceti's `map_withDensity_abs_deriv_mul` no longer takes
  a measurability hypothesis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant