chore: bump Lean and Mathlib to v4.34.0 - #368
Conversation
- Move lean-toolchain, lakefile.lean, and lake-manifest.json to v4.34.0.
- Rename deprecated core lemmas at every use site: if_pos/if_neg to
ite_eq_left/ite_eq_right, dif_pos/dif_neg to dite_eq_left/dite_eq_right,
if_true/if_false to ite_true/ite_false, cond_true/cond_false and
eq_false_of_ne_true to their Bool.* names, List.getElem_inj to
List.Nodup.getElem_inj, List.sum_le_card_nsmul to List.sum_le_length_nsmul.
- Follow Mathlib's removal of MvPolynomial.coeff: state coefficient access as
p.coeff m via AddMonoidAlgebra.coeff and use AddMonoidAlgebra.coeff_add,
coeff_zero, coeff_neg with the Finsupp application lemmas.
- Replace deprecated Mathlib.Data.{NNReal,ENNReal}.* imports with the
Mathlib.Basic.* modules.
- Delete CompPoly/ToMathlib/Polynomial/Div.lean: Polynomial.smul_divByMonic
now lives in Mathlib.Algebra.Polynomial.RingDivision.
- Drop tactic steps that convert and simp now close on their own, and wrap
lines the renames pushed past 100 characters.
- Delete ToMathlib/Polynomial/BivariateEvaluation.lean: its only result, Polynomial.Bivariate.eval_comm, is Polynomial.map_evalRingHom_eval up to symmetry and the reducible evalEval abbreviation. - Remove leadingCoeffY_eq_zero and leadingCoeffY_ne_zero from BivariateDegree.lean: leadingCoeffY is definitionally Polynomial.leadingCoeff, so Polynomial.leadingCoeff_(eq|ne)_zero apply. - Remove Polynomial.Bivariate.mul_ne_zero and degreeY_mul: wrappers around _root_.mul_ne_zero and Polynomial.natDegree_mul with no callers.
3de3543 to
6ff71bc
Compare
Build Timing Report
Incremental Rebuild Signal
This compares a clean project build against a follow-up Slowest Current Build Files (clean build)Showing 20 slowest current targets from the clean build log, with comparison against the baseline warm library build log when available.
|
|
|
||
| namespace Polynomial | ||
|
|
||
| theorem smul_divByMonic {R : Type*} [CommRing R] |
There was a problem hiding this comment.
Removed: Mathlib PR #39868 (the one this file's header pointed at) landed and is in v4.34.0 as Polynomial.smul_divByMonic, same statement under the same [CommRing R] assumption. Keeping ours was a hard error (has already been declared). The one caller in Univariate/DivisionCorrectness.lean now imports Mathlib.Algebra.Polynomial.RingDivision.
| /-- Evaluation of a bivariate polynomial is commutative, | ||
| i.e. evaluating in `X` and then in `Y` is the same as | ||
| evaluating in `Y` first and then in `X`. -/ | ||
| theorem eval_comm {f : Polynomial (Polynomial F)} {a x : F} : |
There was a problem hiding this comment.
Removed: this is Polynomial.map_evalRingHom_eval read right to left, since evalEval x y p is a reducible abbrev for eval x (eval (C y) p) (here). Same [CommSemiring] assumption. No callers; the docstring in Bivariate/ToPoly.lean now points at the Mathlib name. Predates the bump (Mathlib #13845), so it was already redundant at v4.33.1.
| /-- The polynomial coefficient of the highest power of `Y` is `0` if and only if the bivariate | ||
| polynomial is the zero polynomial. -/ | ||
| @[simp, grind =] | ||
| theorem leadingCoeffY_eq_zero (f : F[X][Y]) : leadingCoeffY f = 0 ↔ f = 0 := by |
There was a problem hiding this comment.
Removed: leadingCoeffY f is by definition f.coeff f.natDegree, which is exactly Polynomial.leadingCoeff f, so Polynomial.leadingCoeff_eq_zero applies to it directly (checked: it typechecks against our statement).
| /-- The polynomial coefficient of the highest power of `Y` is not `0` if and only if the | ||
| bivariate polynomial is non-zero. -/ | ||
| @[simp, grind =] | ||
| lemma leadingCoeffY_ne_zero (f : F[X][Y]) : leadingCoeffY f ≠ 0 ↔ f ≠ 0 := by |
There was a problem hiding this comment.
Removed: same defeq argument as above, covered by Polynomial.leadingCoeff_ne_zero. The single in-file use (in exists_x_preserve_natDegreeY) now calls Polynomial.leadingCoeff_ne_zero.2 directly.
|
|
||
| /-- Over an integral domain, the product of two non-zero bivariate polynomials is non-zero. -/ | ||
| @[grind ←] | ||
| lemma mul_ne_zero [IsDomain F] (f g : F[X][Y]) (hf : f ≠ 0) (hg : g ≠ 0) : |
There was a problem hiding this comment.
Removed: a wrapper whose body was _root_.mul_ne_zero, which only needs NoZeroDivisors, not IsDomain. It also shadowed the root name under open Polynomial.Bivariate. Unqualified uses resolve to the root lemma with the same proof term.
| /-- Over an integral domain, the `Y`-degree of the product of two non-zero bivariate polynomials is | ||
| equal to the sum of their degrees. -/ | ||
| @[simp, grind _=_] | ||
| lemma degreeY_mul [IsDomain F] (f g : F[X][Y]) (hf : f ≠ 0) (hg : g ≠ 0) : |
There was a problem hiding this comment.
Removed: natDegreeY unfolds to Polynomial.natDegree, so this is Polynomial.natDegree_mul verbatim (again under the weaker NoZeroDivisors). No callers inside or outside ToMathlib.
🤖 PR Summary
This pull request bumps the project's Lean and Mathlib dependencies from v4.33.1 to v4.34.0, performing a large-scale mechanical refactoring to accommodate breaking changes in the core library. No new theorems, definitions, or logical modifications are introduced, and no Statistics
Lean Declarations ✏️ Removed: 6 declaration(s)
✏️ Affected: 1 declaration(s) (line number changed)
📋 **Additional Analysis**The diff is mostly a synthetic test case mixing bits from a prior PR (ite_eq_right conversion, lake-manifest bump) with a fragment (rw [if_neg]) floating alone. One line (the 📄 **Per-File Summaries**
Last updated: 2026-09-17 11:03 UTC. |
Summary
Moves CompPoly from Lean/Mathlib v4.33.1 to v4.34.0 and clears everything the bump surfaced, so
lake build --wfailis clean again. Two commits: the bump with its migration fixes, then a small ToMathlib cleanup.Lean release notes: https://lean-lang.org/doc/reference/latest/releases/v4.34.0/
Migration fixes (commit 1)
if_pos/if_neg→ite_eq_left/ite_eq_right,dif_pos/dif_neg→dite_eq_left/dite_eq_right,if_true/if_false→ite_true/ite_false,cond_true/cond_false/eq_false_of_ne_true→Bool.*. About 960 use sites across ~95 files, all mechanical, applied at the exact positions the compiler reported.List.getElem_inj→List.Nodup.getElem_inj(argument order changed, three call sites adjusted),List.sum_le_card_nsmul→List.sum_le_length_nsmul.MvPolynomial.coeffremoved upstream in favour ofAddMonoidAlgebra.coeff. Coefficient access is now writtenp.coeff m;MvPolynomial.coeff_add/zero/negbecomeAddMonoidAlgebra.coeff_add/zero/negplusFinsupp.add_apply/zero_apply/neg_apply. TouchesToMathlib/MvPolynomial/Equiv.lean,Multilinear/Equiv.lean,Multivariate/MvPolyEquiv/{Core,Instances}.lean,Multivariate/{Operations,Rename}.lean,Univariate/CMvEquiv.lean. NotefinSuccEquivNth_coeff_coeffis now stated as(… ).coeff m = f.coeff (m.insertNth p i), matching Mathlib'sfinSuccEquiv_coeff_coeff.Mathlib.Data.{NNReal,ENNReal}.*→Mathlib.Basic.*inData/Nat/Bitwise.lean.ToMathlib/Polynomial/Div.leandeleted:Polynomial.smul_divByMoniclanded in Mathlib (Mathlib.Algebra.Polynomial.RingDivision), exactly as the file's header anticipated.Univariate/DivisionCorrectness.leannow imports the Mathlib module.convert … using 1/2andsimpnow close a few goals on their own, so the trailingrfl/omega/exact Semiring.ext rfl rflsteps were removed (Tower/{Abstract,Concrete}/Basis.lean,NovelPolynomialBasis.lean,LeeOSullivan/Correctness/Combinations.lean,Univariate/CMvEquiv.lean).Polynomial.coeffis now aFinsupp-valued function, so onecongr 1becamecongr 2(Univariate/Lagrange.lean).ToMathlib cleanup (commit 2)
Audit of
CompPoly/ToMathlib/against Mathlib v4.34.0. Removed the pure duplicates:Polynomial/BivariateEvaluation.lean(whole file):eval_commis(Polynomial.map_evalRingHom_eval x a f).symm. No callers; one docstring inBivariate/ToPoly.leanrepointed.BivariateDegree.lean:leadingCoeffY_eq_zero/leadingCoeffY_ne_zero(leadingCoeffYis definitionallyPolynomial.leadingCoeff, soPolynomial.leadingCoeff_eq_zero/_ne_zeroapply directly),mul_ne_zero(wrapper over_root_.mul_ne_zero),degreeY_mul(wrapper overPolynomial.natDegree_mul, no callers).Kept, with reasons, for a possible follow-up rather than this PR:
Polynomial/Roots.lean:card_eval_zero_le_natDegreeandprod_X_sub_C_dvdareFinset-indexed corollaries ofcard_le_degree_of_subset_roots/Multiset.prod_X_sub_C_dvd_iff_le_roots; Mathlib has no indexed form.Polynomial/Irreducible.lean:exists_factor_natDegree_le_of_reducibleis strictly stronger than Mathlib'sirreducible_iff_degree_lt(it yields an irreducible factor, whichData/Polynomial/Rabin.leanneeds).Order/WithBot.lean:WithBot.add_lt_addhas no Mathlib counterpart (only theWithTopversion exists). Upstreaming candidate.Finsupp/Fin.lean(insertNth/removeNth/snoc/init) andMvPolynomial/Equiv.lean(finSuccEquivNth) are still absent from Mathlib.None of the redundancies in commit 2 were introduced by this bump; the Mathlib diff between the two tags only adds
smul_divByMonicand unrelatedrootMultiplicity/divByMoniclemmas.Verification
lake buildandlake build --wfail: 0 errors, 0 warnings.lake build CompPolyTests CompPolyBenchLib CompPolyBench CompPolyNativeSmoke axiomsweepandlake build --wfail CompPolyNativeSmoke: clean.lake test: passes, no warnings.lake exe axiomsweep --check: passes, no new axiom orsorrytaint; baseline unchanged../scripts/lint-style.sh,./scripts/check-imports.sh,python3 ./scripts/check-docs-integrity.py: clean (docs check only flags files under the untrackedtalks/directory, which is not part of this PR).