chore: Bump v4.32.0#1445
Conversation
Bump lean-toolchain, mathlib, and doc-gen4 to v4.32.0 (tracker leanprover-community#1437) and repair the source breakages from the Mathlib 4.31->4.32 API drift across Physlib, QuantumInfo, and PhyslibAlpha. Proofs, instances, and imports only; no lemma/definition statement or mathematical content was changed. Breakage classes fixed: - Hand-rolled AddMonoid/AddCommMonoid/AddCommGroup instances whose nsmul/zsmul field proofs relied on `ring` closing scalar-multiplication (smul) goals, which it no longer does in 4.32. - Structure refactors: MonoidAlgebra and MvPolynomial are now wrapper structs (no longer defeq to their coefficient Finsupp); ContRepresentation gained a toMonoidHom field; Mathlib.Meta.Positivity.Strictness gained an Option PartialOrder index (13 positivity extensions); LeftOrdContinuous gained an s.Nonempty hypothesis. - Tactic drift in fun_prop / measurability (metavariable goals), simp / simpa / convert normal forms. - Deprecation renames: PiTensorProduct import, IsOpen.locallyPathConnectedSpace, Finset.le_eq_subset, TwoSidedIdeal.mem_ofRingCon, and the removed simpVarHead linter; def -> lemma for the propositions flagged by the defProp linter. `lake build` (Physlib + QuantumInfo + PhyslibAlpha) is green; `lake exe lint_all` and the version-bump scripts (TODO_to_yml, stats, informal, make_tag) pass. Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>
|
Thank you for this PR, which will now be reviewed. If submitting to ./Physlib or ./QuantumInfo, please see our review guidelines if you are not familiar with the process. You should expect a back and forth with a reviewer before your PR is merged. See also that link for how to add appropriate labels to your PR. The PR will also go through a number of automated checks. You can learn more about these here, including how to run them locally. If you are submitting to ./PhyslibAlpha there will be a lighter review process, though your PR must still pass the automated checks. If you want to bring attention to this PR, please write a message on this thread of the Lean Zulip. Important: If a reviewer adds an |
nateabr
left a comment
There was a problem hiding this comment.
Great work on your first PR!!
Incidentally I was also working on the bump, and our work seems to be quite similar (in some instances your fixes are better). I have provided some minor suggestions that might help.
There was a problem hiding this comment.
| ⟨fun μS ↦ ⇑μS.toVectorMeasure⟩ |
There was a problem hiding this comment.
The break here is really this Coefun coercion and not the downstream lemmas, you should be able to revert them to how they were before after this suggestion. Please do double check.
There was a problem hiding this comment.
| zsmul z p := ⟨fun i => z • p.val i⟩ |
With this change you should be able to drop the zsmul_zero' / zsmul_succ' / zsmul_neg' blocks below
| @@ -206,9 +206,18 @@ instance : AddCommMonoid Fluxes where | |||
| add_zero f := Fluxes.ext_iff.mpr <| by simp | |||
| add_comm f1 f2 := Fluxes.ext_iff.mpr <| by simp only [add_M, add_N]; ring_nf; simp | |||
| nsmul n f := ⟨n * f.M, n * f.N⟩ | |||
There was a problem hiding this comment.
| nsmul n f := ⟨n * f.M, n * f.N⟩ | |
| nsmul n f := ⟨n • f.M, n • f.N⟩ |
Same idea as my previous comment, switching the operators make this proof more robust to the breakage that happened here.
| nsmul_zero f := Fluxes.ext_iff.mpr <| by | ||
| refine ⟨?_, ?_⟩ | ||
| · show ((0 : ℕ) : ℤ) * f.M = 0 | ||
| simp | ||
| · show ((0 : ℕ) : ℤ) * f.N = 0 | ||
| simp |
There was a problem hiding this comment.
| nsmul_zero f := Fluxes.ext_iff.mpr <| by | |
| refine ⟨?_, ?_⟩ | |
| · show ((0 : ℕ) : ℤ) * f.M = 0 | |
| simp | |
| · show ((0 : ℕ) : ℤ) * f.N = 0 | |
| simp | |
| nsmul_zero f := Fluxes.ext_iff.mpr ⟨zero_nsmul f.M, zero_nsmul f.N⟩ |
| refine ⟨?_, ?_⟩ | ||
| · show ((n + 1 : ℕ) : ℤ) * f.M = (n : ℤ) * f.M + f.M | ||
| push_cast; ring | ||
| · show ((n + 1 : ℕ) : ℤ) * f.N = (n : ℤ) * f.N + f.N | ||
| push_cast; ring |
There was a problem hiding this comment.
| refine ⟨?_, ?_⟩ | |
| · show ((n + 1 : ℕ) : ℤ) * f.M = (n : ℤ) * f.M + f.M | |
| push_cast; ring | |
| · show ((n + 1 : ℕ) : ℤ) * f.N = (n : ℤ) * f.N + f.N | |
| push_cast; ring | |
| nsmul_succ n f := Fluxes.ext_iff.mpr ⟨succ_nsmul f.M n, succ_nsmul f.N n⟩ |
Apply @nateabr's review suggestions, which simplify the migration in three places and, for the spectral measure, identify a cleaner root-cause fix: - SpaceAndTime/Space/Module.lean: define `zsmul` via `•` (`z • p.val i`), so the default `zsmul_zero'`/`zsmul_succ'`/`zsmul_neg'` proofs discharge and those blocks are dropped. - StringTheory/FTheory/SU5/Fluxes/Basic.lean: define `nsmul` via `•` and close `nsmul_zero`/`nsmul_succ` with `zero_nsmul`/`succ_nsmul`. - QuantumMechanics/Operators/SpectralTheory/SpectralMeasure.lean: the 4.32 breakage was the `CoeFun` coercion, not the composition lemmas; use `⇑μS.toVectorMeasure` and revert `comp_of_disjoint`, `comp_eq_of_inter`, and `commute` to their original form. Thanks to @nateabr for the careful and constructive review. Co-authored-by: nateabr <135662056+nateabr@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>
|
Thanks so much for the review, @nateabr — these were all spot-on and made the diff noticeably cleaner. Applied all five in 978ce09:
Full lake build is green (9235 jobs) and the style/declaration linters pass. Thanks again for the careful and constructive review — much appreciated! |
|
Hi @NicolasRouquette! Many thanks for this PR. It looks great. There are some linter issues which need fixing (see the workflows) before we can merge this. awaiting-author |
…ilation The `unusedArguments` alpha-linter (`runPhyslibAlphaLinters`) fails under the v4.32.0 toolchain on `StinespringDilation`. The file is unchanged since the v4.31.0 bump and the same linter is green on master, so the reports are a consequence of the 4.31 -> 4.32 Mathlib bump: the matrix operations these lemmas call (`tr₂`, `stinespringOp`, `Matrix.one`) no longer thread the flagged instances through their elaborated proof terms, so the arguments are now genuinely dead. Verified against each definition's signature: - `tr₂_e₀Xe₀`: `[Zero w]` — `tr₂` needs only `[Fintype n]` on the traced index. - `tracefree_version`: `[Zero r]`, `[DecidableEq m]` — `(1 : Matrix r r R)` needs `[DecidableEq r]` (index) and `Zero/One R` (from `RCLike R`), not `Zero r`; `stinespringForm` needs `[Fintype r] [DecidableEq r] [Fintype m]`, not `[DecidableEq m]`. - `stinespringOp_apply`: `[Fintype m]`, `[DecidableEq m]` — `stinespringOp` needs only `[Fintype r] [DecidableEq r]`. - `heisenberg_schrõdinger`: `[Zero r]`, `[DecidableEq m]` — same two; these were live only because its proof (`rw [tracefree_version]`) threaded them into `tracefree_version`. CI reported only the first three; removing them from `tracefree_version` exposes this caller, which the local linter then flags. Removing instance-implicit arguments is safe for callers (they are inferred, never passed positionally). `runPhyslibAlphaLinters` is now clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Fixed in 60528a6. The three
One thing CI didn't surface: after dropping those, a fourth declaration,
|
…ions
Toolchain collateral from the v4.32.0 bump — not a source change.
## Symptom
The `runLinter on Physlib` CI step (`env LEAN_ABORT_ON_PANIC=1 lake exe
runPhyslibLinters`, build.yml) fails on this PR with 5 errors, while the
*identical* step is green on `master`. `master` still runs Lean/Mathlib
v4.31.0; this PR is the v4.32.0 bump. The v4.32.0 `#lint` linters
(`unusedArguments`, `checkType`) are stricter than v4.31.0's and now flag
code that predates this PR.
## These are not our edits
None of the 5 flagged declarations is changed by this bump:
- Physlib/Relativity/Tensors/LeviCivita/Basic.lean (untouched file)
- Physlib/Relativity/.../Vector/Causality/LightLike.lean (untouched file)
- Physlib/SpaceAndTime/Space/Integrals/Basic.lean (untouched file)
- Physlib/StatisticalMechanics/CanonicalEnsemble/Basic.lean (untouched file)
- Physlib/Particles/.../SU5/ChargeSpectrum/Basic.lean (this PR only
edits `subset_trans` at L187; the flagged `min_exists_inductive` at L333
is unchanged)
## The 5 findings and the fix
1. checkType — `leviCivita_contract_self`: whnf on its tensor-notation
statement now exceeds the linter's 200k-heartbeat budget (v4.31.0 stayed
under it). Statement unchanged. → `@[nolint checkType]`.
2-5. unusedArguments — `min_exists_inductive` (`hn`),
`lightlike_spatial_parallel_implies_proportional` (`hv`, `hw`),
`integrable_spherical_of_integrable` (`NormedSpace ℝ F`),
`probability_nonneg` (`IsFiniteMeasure`, `NeZero`): each argument is part
of the intended interface / goal statement but unused by the proof term.
→ `@[nolint unusedArguments]` (matching 17 existing uses in the tree).
Consistent with this PR's charter (a toolchain bump: no lemma/definition
statement or signature is added, removed, or changed), these are *silenced*,
not restructured. Dropping the now-"unused" binders would alter public
signatures and risk downstream breakage; that is out of scope for a bump.
## Why local `lake exe lint_all` did not catch it
`scripts/lint_all.lean`'s `main` ends in an unconditional `pure 0` — it prints
linter output but never sets a non-zero exit code, so it cannot gate a PR. CI
does not use it; it invokes `lake exe runPhyslibLinters` directly, which *does*
exit 1 on findings. Reproduce the CI gate locally with:
env LEAN_ABORT_ON_PANIC=1 lake exe runPhyslibLinters Physlib
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed c85984a to green the The failure was toolchain collateral, not a source change. The v4.32.0 Consistent with this PR's charter (a toolchain bump — no lemma/definition statement or signature added, removed, or changed), the findings are silenced, not restructured; dropping the now-"unused" binders would alter public signatures and risk downstream breakage. The fix adds:
Each carries an inline comment; the commit message has the full breakdown. Verified locally with the exact CI command — The re-triggered workflows are sitting at |
|
I have run the workflows. FYI when you are ready for your PR to have another look, please comment (-)(awaiting-author) without the brackets. This removes the awaiting author tag and helps the maintainers keep track as they get far too many notifications from github. |
|
-awaiting-author |
Version bump to Lean/Mathlib v4.32.0 — tracker #1437.
This is a toolchain bump. It repairs the source breakages from the Mathlib
4.31→4.32 API drift across
Physlib,QuantumInfo, andPhyslibAlpha.No lemma or definition statement — nor any mathematical content — is added,
removed, or changed. Only proofs, instance / structure-instance syntax, and
imports are touched.
lake build(both default targets) andlake build PhyslibAlphaare green;lake exe lint_all,TODO_to_yml mkFile,stats mkHTML,informal mkFile mkDot mkHTML, andmake_tagall pass. README Lean badgeupdated.
Breakage classes fixed
nsmul/zsmulfield proofs in hand-rolledAddMonoid/AddCommMonoid/AddCommGroupinstances — in 4.32ringno longer closesscalar-multiplication (
•) goals. The customnsmul/zsmuldata iskept unchanged; only the recursor obligations are repaired
(
Mathematics/RatComplexNum,SpaceAndTime/Space/Module,StringTheory/FTheory/SU5/Fluxes,QFT/PerturbationTheory/FieldStatistics,QFT/AnomalyCancellation).Structure refactors (data unchanged, only repackaged):
MonoidAlgebraandMvPolynomialare now wrapper structs, no longer defeqto their coefficient
Finsupp— unwrapped viacoeff/.ofCoeff(
QFT/PerturbationTheory/FieldOpFreeAlgebra,PhyslibAlpha/…/TwoHDM/Invariants).ContRepresentationgained atoMonoidHomfield — nested the existingtoFun/map_one'/map_mul'inside it (…/EuclideanGroup/SchwartzAction).Mathlib.Meta.Positivity.Strictnessgained anOption PartialOrderindex —13 positivity extensions guarded with the
none-case short-circuit, exactlyas Mathlib's own
evalAddnow does (QuantumInfo/…/HermitianMat/Order,Sqrt,LogExp).LeftOrdContinuousgained ans.Nonemptyhypothesis — the proof nowcase-splits on it (
QuantumInfo/ForMathlib/SionMinimax).Tactic drift —
fun_prop/measurabilitymetavariable goals (pinnedwith named function args) and
simp/simpa/convertnormal-form drift(
SpaceAndTime/Space/IsDistBounded,QuantumMechanics/Operators/Position,…/SpectralTheory/SpectralMeasure,Relativity/LorentzAlgebra/ExponentialMap,QFT/PerturbationTheory/WickContraction/*, and severalQuantumInfo/ForMathlib/HermitianMat/*files).Deprecation renames —
Mathlib.LinearAlgebra.PiTensorProduct→…PiTensorProduct.Basic,IsOpen.locallyPathConnectedSpace,Finset.le_eq_subset(dropped fromsimpsets),TwoSidedIdeal.mem_ofRingCon, the removedsimpVarHeadlinter attribute;and
def→lemmafor the propositions thedefProplinter now flags.Reviewer map
lean-toolchain,lakefile.toml,lake-manifest.json,README.md.file depends on another. These can be skimmed.
non-mechanical changes — the two wrapper-struct fixes
(
FieldOpFreeAlgebra/Basic.lean'sofListBasis_eq_ofList,TwoHDM/Invariants.lean'srealPart) and the positivity-extensionmigration (
HermitianMat/Order.lean).Scope note: pre-existing
redundant_imports/unusedArgumentslint findingsin files untouched by this bump are intentionally left as-is (
lint_allexitscleanly with them, as on
master).AI-assisted per the repository's AI policy; commit carries the
Co-authored-bytrailer.