Repository navigation
fix(MeasureTheory): Section 1.4 was never in the build; add imports and repair it - #737
Merged
Merged
Conversation
`Analysis.lean` did not import `Section_1_4_1`, `Section_1_4_2` or `Section_1_4_3`, so `lake build` — and therefore CI — never compiled any of them. They had drifted into a state where none of the three compiled at all, which no CI run could have reported. This adds the three missing imports (the build goes from 8310 to 8313 jobs) and fixes `Section_1_4_3`, the only one still failing once #711, #694, #700 and #712 had landed. The main repair is API that was missing: `FinitelyAdditiveMeasure` and `CountablyAdditiveMeasure` had no `@[ext]` lemma, so the `ext` tactic could not be used on them, and several instance proofs were written as `cases …; congr 1; ext A` in the hope that it would be. Both measures are a single function field plus propositions, so extensionality follows from `funext` and proof irrelevance; with those lemmas registered, the `AddCommMonoid` and `DistribMulAction` instance proofs reduce to `ext A` followed by the pointwise fact. Also fixed: - `FinitelyAdditiveMeasure.restrict`: `Disjoint.image` takes an `InjOn` plus two subset side conditions, and the image of a union needed `Set.image_union`. - `lebesgue_isCountablyAdditive`: `Lebesgue_measure.countable_union` takes its family implicitly, so the field needs it eta-expanded. `smul_add` is left as `sorry` in both `DistribMulAction` instances, with a comment, rather than papered over. Pointwise it asks for `c * (μ A + ν A) = c * μ A + c * ν A` for an *arbitrary* set `A`, but `EReal` is distributive only over nonnegative summands (`EReal.left_distrib_of_nonneg`) and `measure_pos` constrains the sign of `μ A` only for measurable `A`. As the definitions stand the field is not provable, so it needs a design decision rather than a proof. `lake build` passes: 8313 jobs, no errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
An audit by olean presence (the reliable check, since `lean_lib` with no globs builds only `Analysis.lean`'s import closure) found two more MeasureTheory modules that were never compiled. Both already compile cleanly, so they just needed importing. Build: 8313 -> 8315 jobs. `Analysis/Misc/equational.lean` is the one remaining file outside the closure, and it cannot simply be added: it declares a top-level `S` that collides with `Analysis.Misc.erdos_379`, so importing it fails with "environment already contains 'S'". Left alone; it needs a rename or a namespace first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
zhikaip
added a commit
to zhikaip/analysis
that referenced
this pull request
Oct 18, 2026
The MeasureTheory PRs merged since this branch was cut (teorth#694-teorth#737) were written against v4.29.0-rc8, and teorth#737 put Section_1_4_1 through Section_1_4_5 into the build for the first time. Under v4.35.0 they need the same repairs as the rest of the library: - eleven new `List.TFAE.out i j` calls in Section_1_3_2 bumped to 1-based indices; - Section_1_4_1: two `simpa [LebesgueMeasurable.boolean_algebra]` steps that relied on unfolding the `measurable` structure field now `show` the unfolded goal first, and two exercise statements declared as `instance` with non-class types are `theorem`s; - Section_1_4_2 imports `Mathlib.MeasureTheory.MeasurableSpace.Defs` and Section_1_4_3 imports `Mathlib.MeasureTheory.Measure.NullMeasurable`, since `Mathlib.Tactic` no longer provides `MeasurableSpace`, `Measure`, `Measure.completion` or `NullMeasurableSet` transitively; - `Measure.toCountablyAdditiveMeasure` is `noncomputable`, as `ENNReal.toEReal` now is. No statements changed. Full `lake build` passes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Analysis.leandoes not importSection_1_4_1,Section_1_4_2orSection_1_4_3. Sincelake buildbuilds theAnalysistarget, none of those three files has ever been compiled bylake buildor by CI.They had consequently drifted into a state where all three failed to compile. No CI run could have reported this: every PR touching Section 1.4 got a green check that never looked at the file it changed. (I merged a number of such PRs myself over the last few weeks, on exactly that false signal.)
What this does
Adds the three missing imports — the build goes from 8310 to 8313 jobs — and repairs
Section_1_4_3, which was the only one still failing once #711, #694, #700 and #712 had landed. (#711 deserves credit here: it spotted the missingSection_1_4_2import and fixed the genuinely brokencompl_memfields in 1.4.1.)The main repair is missing API.
FinitelyAdditiveMeasureandCountablyAdditiveMeasurehad no@[ext]lemma, so theexttactic did not apply to them, yet several instance proofs were written ascases …; congr 1; ext Ain the hope that it would. Both are one function field plus propositions, so extensionality follows fromfunextand proof irrelevance:With those registered, the
AddCommMonoidandDistribMulActioninstance proofs collapse toext Aplus the pointwise fact. Two other fixes:FinitelyAdditiveMeasure.restrict—Disjoint.imagewants anInjOnand two subset side conditions, and the image of a union neededSet.image_union.lebesgue_isCountablyAdditive—Lebesgue_measure.countable_uniontakes its family implicitly, so the field needs it eta-expanded.One thing left open, deliberately
smul_addissorryin bothDistribMulActioninstances, with a comment, rather than papered over. Pointwise it asks forfor an arbitrary set
A. ButERealis distributive only over nonnegative summands (EReal.left_distrib_of_nonneg), andFinitelyAdditiveMeasure.measure_posconstrains the sign ofμ Aonly forB-measurableA. So as the definitions currently stand this field is not provable, andDistribMulAction ENNReal (FinitelyAdditiveMeasure B)cannot be instantiated as written. That is a design question — restrict the measure field to measurable sets, require a global sign condition, or weaken the algebraic structure — rather than something to settle in a repair PR.Verification
lake build: 8313 jobs, no errors. Net change tosorrycount inSection_1_4_3is +2, both thesmul_addfields above; everything else that previously failed to compile now compiles.Worth considering separately: a CI check that every
Analysis/**/*.leanfile is reachable fromAnalysis.leanwould have caught this at the moment Section 1.4 was added, and would stop it recurring.Scope widened after an audit
Checking by
.oleanpresence (the reliable test —lean_libwith no globs builds onlyAnalysis.lean's closure, so a plain grep of the import list is misleading) turned up two more never-compiled modules,Section_1_4_4andSection_1_4_5. Both already compile, so they just needed importing. Final build: 8315 jobs, no errors, and every file underAnalysis/except one is now in the closure.The exception is
Analysis/Misc/equational.lean, which cannot simply be added: it declares a top-levelSthat collides withAnalysis.Misc.erdos_379, so importing it fails withenvironment already contains 'S'. It needs a rename or a namespace first, which seemed out of scope here.Also included: a
.gitignoreentry for__pycache__, which the test suite added in #731-#735 creates on first run.🤖 Generated with Claude Code