Skip to content

refactor(MeasureTheory/Covering/VitaliFamily): make filterAt a field - #46220

Draft
urkud wants to merge 9 commits into
leanprover-community:masterfrom
urkud:vitali-redefine
Draft

urkud wants to merge 9 commits into
leanprover-community:masterfrom
urkud:vitali-redefine

Conversation

@urkud

@urkud urkud commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Redefine VitaliFamily μ in terms of the filters filterAt x and the covering property
exists_covering, instead of the families of sets setsAt x. The ambient space now only needs to
be a topological space, and exists_covering no longer needs SecondCountableTopology.

structure VitaliFamily {X : Type*} [TopologicalSpace X] {m : MeasurableSpace X} (μ : Measure X) where
  filterAt : X → Filter (Set X)
  filterAt_le_smallSets_nhds (x : X) : filterAt x ≤ (𝓝 x).smallSets
  eventually_measurableSet (x : X) : ∀ᶠ a in filterAt x, MeasurableSet a
  filterAt_neBot (x : X) : (filterAt x).NeBot
  exists_covering (s : Set X) (P : X → Set X → Prop)
    (frequently_filterAt : ∀ x ∈ s, ∃ᶠ a in filterAt x, P x a) :
    ∃ t : Set (X × Set X), t.Countable ∧ MapsTo Prod.fst t s ∧ t.PairwiseDisjoint Prod.snd ∧
      (∀ p ∈ t, P p.1 p.2) ∧ s ≤ᵐ[μ] ⋃ p ∈ t, p.2

Constructors:

  • Besicovitch.vitaliFamily μ: filterAt x := (𝓝[>] 0).map (closedBall x), so
    Besicovitch.tendsto_filterAt is now tendsto_map.
  • Vitali.vitaliFamily μ C h: filterAt x := (𝓝 x).smallSets ⊓ 𝓟 {a | IsClosed a ∧ …},
    a literal translation of the old setsAt.
  • IsUnifLocDoublingMeasure.vitaliFamily K no longer uses enlarge.
    tendsto_closedBall_filterAt keeps its statement.

Dropped the now unneeded [SecondCountableTopology α] from VitaliFamily.ae_eventually_measure_pos,
outerMeasure_le_of_frequently_le, outerMeasure_toMeasurable_le_of_frequently_le,
measure_le_of_frequently_le and the lemmas assuming [SigmaFinite μ] [OuterRegular μ] in
Differentiation.lean.

New: VitaliFamily.mono_filterAt, Besicovitch.filterAt_vitaliFamily,
Vitali.filterAt_vitaliFamily.

Breaking. Removed without deprecation, because their statements mention setsAt:


This is PR E of the Vitali families refactor plan in urkud#2.

🤖 Generated with Claude Code

urkud and others added 8 commits November 18, 2026 17:27
Generalize `Vitali.exists_disjoint_covering_ae`, `Vitali.exists_disjoint_covering_ae'` and
`Vitali.vitaliFamily` so that the doubling constant `C : α → ℝ≥0` may depend on the center of
the ball. The proof iterates the uniform-constant version on `{x ∈ s | C x ≤ n}`, measuring
leftovers with the finite measure `μ.toFinite`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Vitali families

Let `ρ` be an outer measure that vanishes on `μ`-null sets. Prove that
`ρ s ≤ ∫⁻ x in s, v.liminfRatio ρ x ∂μ`, where `v.liminfRatio ρ x` is the lower limit of
`ρ a / μ a` along the Vitali family. This holds with the (lower) Lebesgue integral even though
`v.liminfRatio ρ` need not be measurable.

* Replace the internal `VitaliFamily.limRatio` (a `limUnder`) with the public
  `VitaliFamily.liminfRatio`, defined for any `FunLike F (Set α) ℝ≥0∞`.
* Generalize `FineSubfamilyOn.measure_le_tsum_of_absolutelyContinuous` and
  `VitaliFamily.measure_le_of_frequently_le` to outer measures;
  the latter now assumes `[OuterRegular ν]` instead of `[IsLocallyFiniteMeasure ν]`.
* Add `outerMeasure_toMeasurable_le_of_frequently_le`,
  `outerMeasure_le_lintegral_liminfRatio`, `outerMeasure_le_lintegral_of_liminfRatio_le`,
  `outerMeasure_le_mul_of_liminfRatio_le`, `outerMeasure_eq_zero_of_liminfRatio_eq_zero`,
  `liminfRatio_ae_eq_rnDeriv`.

Supersedes leanprover-community#33269.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…` instead of `IsLocallyFiniteMeasure`

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nfRatio_le`

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `VitaliFamily.exists_covering`, `filterAt_le_smallSets_nhds` and
`eventually_measurableSet`, stated in terms of `filterAt` only, and port all
users of `setsAt`/`FineSubfamilyOn` outside the constructors to them.
Deprecate `FineSubfamilyOn` and its API,
`eventually_filterAt_measurableSet`,
`IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul` and
`Real.Icc_mem_vitaliFamily_at_{left,right}`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redefine `VitaliFamily μ` in terms of the filters `filterAt x` and the covering property
`exists_covering`, instead of the families `setsAt x`. The ambient space only needs to be a
topological space.

Removed: `VitaliFamily.setsAt`, `measurableSet`, `nonempty_interior`, `nontrivial`, `covering`,
`enlarge`, `filterAt_enlarge`, `FineSubfamilyOn` and its API, `fineSubfamilyOn_iff_frequently`,
`fineSubfamilyOn_of_frequently`, `HasBasis.vitaliFamily`, `filterAt_basis_closedBall`,
`mem_filterAt_iff`, `eventually_filterAt_iff`, `tendsto_filterAt_iff`,
`eventually_filterAt_mem_setsAt`, `frequently_filterAt_iff`,
`IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul`,
`Real.Icc_mem_vitaliFamily_at_right`, `Real.Icc_mem_vitaliFamily_at_left`.

New: `VitaliFamily.mono_filterAt`, `Besicovitch.filterAt_vitaliFamily`,
`Vitali.filterAt_vitaliFamily`.

`IsUnifLocDoublingMeasure.vitaliFamily` no longer uses `enlarge`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR summary 78cdb217e0

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.MeasureTheory.Covering.Vitali 1689 1695 +6 (+0.36%)
Mathlib.MeasureTheory.Covering.DensityTheorem 2612 2613 +1 (+0.04%)
Mathlib.MeasureTheory.Covering.OneDim 2647 2648 +1 (+0.04%)
Mathlib.MeasureTheory.Integral.IntervalIntegral.AbsolutelyContinuousFun 2721 2722 +1 (+0.04%)
Import changes for all files
Files Import difference
35 files Mathlib.Analysis.BoundedVariation Mathlib.Analysis.Calculus.Monotone Mathlib.Analysis.Calculus.Rademacher Mathlib.Analysis.Calculus.Taylor Mathlib.Dynamics.Ergodic.AddCircle Mathlib.MeasureTheory.Covering.DensityTheorem Mathlib.MeasureTheory.Covering.LiminfLimsup Mathlib.MeasureTheory.Covering.OneDim Mathlib.MeasureTheory.Function.AbsolutelyContinuous Mathlib.MeasureTheory.Integral.IntervalIntegral.AbsolutelyContinuousFun Mathlib.MeasureTheory.Integral.IntervalIntegral.DerivIntegrable Mathlib.MeasureTheory.Integral.IntervalIntegral.LebesgueDifferentiationThm Mathlib.MeasureTheory.Measure.CharacteristicFunction.TaylorExpansion Mathlib.MeasureTheory.Measure.LevyConvergence Mathlib.MeasureTheory.VectorMeasure.IntegrationByParts Mathlib.NumberTheory.WellApproximable Mathlib.Probability.BrownianMotion.Basic Mathlib.Probability.BrownianMotion.GaussianProjectiveFamily Mathlib.Probability.CentralLimitTheorem Mathlib.Probability.CramerWold Mathlib.Probability.Distributions.Gaussian.Basic Mathlib.Probability.Distributions.Gaussian.CharFun Mathlib.Probability.Distributions.Gaussian.Fernique Mathlib.Probability.Distributions.Gaussian.HasGaussianLaw.Basic Mathlib.Probability.Distributions.Gaussian.HasGaussianLaw.Def Mathlib.Probability.Distributions.Gaussian.HasGaussianLaw.Independence Mathlib.Probability.Distributions.Gaussian.IsGaussianProcess.Basic Mathlib.Probability.Distributions.Gaussian.IsGaussianProcess.Def Mathlib.Probability.Distributions.Gaussian.IsGaussianProcess.Independence Mathlib.Probability.Distributions.Gaussian.Multivariate Mathlib.Probability.Distributions.Gaussian.Real Mathlib.Probability.Independence.Process.HasIndepIncrements.IsGaussianProcess Mathlib.Probability.Moments.MGFAnalytic Mathlib.Probability.Moments.SubGaussian Mathlib.Probability.Moments.Tilted
1
Mathlib.MeasureTheory.Covering.Vitali 6

Declarations diff (regex)

+ ae_tendsto_liminfRatio
+ aemeasurable_liminfRatio
+ closedBall_mem_of_dist_le_mul
+ exists_disjoint_covering_ae_of_const
+ exists_measurable_supersets_liminfRatio
+ frequently_le_mul_of_liminfRatio_lt
+ liminfRatio
+ liminfRatio_ae_eq_rnDeriv
+ liminfRatio_eq_of_tendsto
+ measure_le_of_measure_sdiff_eq_zero
+ mono_filterAt
+ outerMeasure_eq_zero_of_liminfRatio_eq_zero
+ outerMeasure_le_lintegral_liminfRatio
+ outerMeasure_le_lintegral_of_liminfRatio_le
+ outerMeasure_le_mul_of_liminfRatio_le
+ outerMeasure_le_of_frequently_le
+ outerMeasure_le_of_frequently_le_aux
+ outerMeasure_toMeasurable_le_of_frequently_le
+ tendsto_liminfRatio
++ filterAt_vitaliFamily
- FineSubfamilyOn
- Icc_mem_vitaliFamily_at_left
- Icc_mem_vitaliFamily_at_right
- _root_.Filter.HasBasis.vitaliFamily
- closedBall_mem_vitaliFamily_of_dist_le_mul
- covering
- covering_disjoint
- covering_disjoint_subtype
- covering_mem
- covering_mem_family
- enlarge
- eventually_filterAt_iff
- eventually_filterAt_mem_setsAt
- exists_disjoint_covering_ae
- filterAt
- filterAt_basis_closedBall
- filterAt_enlarge
- filterAt_neBot
- fineSubfamilyOn_iff_frequently
- fineSubfamilyOn_of_frequently
- frequently_filterAt_iff
- index
- index_countable
- index_subset
- measurableSet_u
- measure_diff_biUnion
- measure_le_tsum
- measure_le_tsum_of_absolutelyContinuous
- measure_sdiff_biUnion
- mem_filterAt_iff
- tendsto_filterAt_iff

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 78cdb21).

  • +21 new declarations
  • −38 removed declarations
+Besicovitch.filterAt_vitaliFamily
-Filter.HasBasis.vitaliFamily
-IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul
-IsUnifLocDoublingMeasure.scalingScaleOf.congr_simp
+IsUnifLocDoublingMeasure.vitaliFamily.congr_simp
-Real.Icc_mem_vitaliFamily_at_left
-Real.Icc_mem_vitaliFamily_at_right
+Vitali.filterAt_vitaliFamily
-VitaliFamily.FineSubfamilyOn
-VitaliFamily.FineSubfamilyOn.covering
-VitaliFamily.FineSubfamilyOn.covering.congr_simp
-VitaliFamily.FineSubfamilyOn.covering_disjoint
-VitaliFamily.FineSubfamilyOn.covering_disjoint_subtype
-VitaliFamily.FineSubfamilyOn.covering_mem
-VitaliFamily.FineSubfamilyOn.covering_mem_family
-VitaliFamily.FineSubfamilyOn.exists_disjoint_covering_ae
-VitaliFamily.FineSubfamilyOn.index
-VitaliFamily.FineSubfamilyOn.index.congr_simp
-VitaliFamily.FineSubfamilyOn.index_countable
-VitaliFamily.FineSubfamilyOn.index_subset
-VitaliFamily.FineSubfamilyOn.measurableSet_u
-VitaliFamily.FineSubfamilyOn.measure_diff_biUnion
-VitaliFamily.FineSubfamilyOn.measure_le_tsum
-VitaliFamily.FineSubfamilyOn.measure_le_tsum_of_absolutelyContinuous
-VitaliFamily.FineSubfamilyOn.measure_sdiff_biUnion
+VitaliFamily.ae_tendsto_liminfRatio
+VitaliFamily.aemeasurable_liminfRatio
-VitaliFamily.covering
-VitaliFamily.enlarge
-VitaliFamily.eventually_filterAt_iff
-VitaliFamily.eventually_filterAt_mem_setsAt
+VitaliFamily.eventually_measurableSet
+VitaliFamily.exists_covering
+VitaliFamily.exists_measurable_supersets_liminfRatio
-VitaliFamily.filterAt_basis_closedBall
-VitaliFamily.filterAt_enlarge
+VitaliFamily.filterAt_le_smallSets_nhds
-VitaliFamily.fineSubfamilyOn_iff_frequently
-VitaliFamily.fineSubfamilyOn_of_frequently
-VitaliFamily.frequently_filterAt_iff
+VitaliFamily.frequently_le_mul_of_liminfRatio_lt
+VitaliFamily.liminfRatio
+VitaliFamily.liminfRatio_ae_eq_rnDeriv
+VitaliFamily.liminfRatio_eq_of_tendsto
-VitaliFamily.measurableSet
-VitaliFamily.mem_filterAt_iff
-VitaliFamily.mk.congr_simp
+VitaliFamily.mono_filterAt
-VitaliFamily.nonempty_interior
-VitaliFamily.nontrivial
+VitaliFamily.outerMeasure_eq_zero_of_liminfRatio_eq_zero
+VitaliFamily.outerMeasure_le_lintegral_liminfRatio
+VitaliFamily.outerMeasure_le_lintegral_of_liminfRatio_le
+VitaliFamily.outerMeasure_le_mul_of_liminfRatio_le
+VitaliFamily.outerMeasure_le_of_frequently_le
+VitaliFamily.outerMeasure_toMeasurable_le_of_frequently_le
-VitaliFamily.setsAt
-VitaliFamily.tendsto_filterAt_iff
+VitaliFamily.tendsto_liminfRatio

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 78cdb217e0
Reference commit cedb8afa01

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-measure-probability Measure theory / Probability theory label Nov 19, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Nov 19, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

…ntableTopology`

`VitaliFamily.exists_covering` now provides a countable family, so the covering lemmas no
longer need second countability.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 19, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-measure-probability Measure theory / Probability theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant