Skip to content

feat: kernel measurable space and KL generalizations from LML - #81

Merged
RemyDegenne merged 4 commits into
stat-lib:mainfrom
RemyDegenne:generalize-from-lml
Nov 13, 2026
Merged

RemyDegenne merged 4 commits into
stat-lib:mainfrom
RemyDegenne:generalize-from-lml

Conversation

@RemyDegenne

Copy link
Copy Markdown
Collaborator

Brings over material from LML that is more general than Statlib's or missing from it, so that LML, which is about to depend on Statlib (LeanMachineLearning/LML#298), can delete its copies.

Measurable space on kernels

  • New file Statlib/ForMathlib/Probability/Kernel/MeasurableSpace.lean, with LML's instance instMeasurableSpaceKernel (the comap of the coercion Kernel 𝓧 𝓨 → (𝓧 → Measure 𝓨)), measurable_kernel_iff and Kernel.measurable_const. Kernel.measurable_eval and Kernel.measurable_eval' move there from Inference.lean.
  • Removes the instance in Inference.lean (a supremum of comaps of the evaluations). It defined the same σ-algebra, but it is not definitionally equal to LML's, so the two instances could not coexist.

Generalizations

  • Measure.rnDeriv_restrict_restrict now assumes [μ.HaveLebesgueDecomposition ν] instead of [SigmaFinite μ], as in LML. Measure.singularPart_restrict_restrict now assumes only [μ.HaveLebesgueDecomposition ν], instead of [SigmaFinite μ] [SigmaFinite ν]. Both proofs are unchanged.
  • New InformationTheory.klDiv_compProd_left_of_ae (from LML): KL(μ ⊗ₘ κ, ν ⊗ₘ κ) = KL(μ, ν) when κ is only a probability measure on a measurable set of full μ- and ν-measure.
  • Joint convexity of KL for finite mixtures (from LML): klDiv_finsetSum_smul_le and klDiv_sum_smul_le, with convexity in each argument (klDiv_finsetSum_smul_left_le, klDiv_sum_smul_left_le, klDiv_finsetSum_smul_right_le, klDiv_sum_smul_right_le). They are proved by induction from klDiv_add_add_le, which is shorter than LML's proof.

Removed or renamed

Old Replacement
ProbabilityTheory.Kernel.instMeasurableSpaceKernel ProbabilityTheory.instMeasurableSpaceKernel
ProbabilityTheory.Kernel.measurable_iff ProbabilityTheory.measurable_kernel_iff
ProbabilityTheory.Kernel.measurable_of_measurable_eval (measurable_kernel_iff κ).2

Checks run locally

  • lake build --iofail, lake lint and lake exe mk_all --check pass.
  • The tutorial's two build steps (subverso-extract-mod and the :highlighted files of Statlib.Inference.Inference and Statlib.Inference.QMD) succeed.
  • None of the new names is already used in Tau Ceti main.

This PR stays on Mathlib 2ddf59c, which LML#298 needs.

🤖 Generated with Claude Code

https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo

RemyDegenne and others added 4 commits November 13, 2026 10:23
Add `Statlib/ForMathlib/Probability/Kernel/MeasurableSpace.lean` with
LML's instance `instMeasurableSpaceKernel` (the comap of the coercion to
functions), `measurable_kernel_iff` and `Kernel.measurable_const`, and
move `Kernel.measurable_eval` and `Kernel.measurable_eval'` there.

Remove the instance of `Inference.lean`, which defined the same
σ-algebra but is not definitionally equal to LML's, and its
`Kernel.measurable_iff` and `Kernel.measurable_of_measurable_eval`
(use `measurable_kernel_iff`).

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

Assume `μ.HaveLebesgueDecomposition ν` instead of `SigmaFinite μ` (and,
for the singular part, no assumption on `ν`). The proofs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
`KL(μ ⊗ₘ κ, ν ⊗ₘ κ) = KL(μ, ν)` when `κ` is a probability measure on a
measurable set of full `μ`- and `ν`-measure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
`klDiv_finsetSum_smul_le`, `klDiv_sum_smul_le` and the versions in each
argument, proved by induction from `klDiv_add_add_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0196ftMV379vy48QfzHBVNvo
@RemyDegenne
RemyDegenne merged commit af34969 into stat-lib:main Nov 13, 2026
1 check passed
RemyDegenne added a commit to LeanMachineLearning/LML that referenced this pull request Nov 13, 2026
…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
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