Skip to content

feat: bump lean version to 4.29.0#176

Merged
dhsorens merged 14 commits intomasterfrom
dhsorens/bump_to_4.29.0-rc6
Apr 14, 2026
Merged

feat: bump lean version to 4.29.0#176
dhsorens merged 14 commits intomasterfrom
dhsorens/bump_to_4.29.0-rc6

Conversation

@dhsorens
Copy link
Copy Markdown
Collaborator

@dhsorens dhsorens commented Mar 28, 2026

UPDATE - this PR updates to 4.29.0. See comments below. Originally this PR was meant to bump to v4.29.0-rc6

Comments starting from v4.29.0-rc6 update

Thanks Claude! Bumps to v4.29.0-rc6

CHANGELOG

  • Lean v4.28.0v4.29.0-rc6; Mathlib v4.28.0v4.29.0-rc6; ExtTreeMapLemmas v4.28.0-patch-1v4.29.0-rc6 (lean-toolchain, lakefile.lean, lake-manifest.json).
  • 36 Lean files touched: mostly tactic/instance fixes (rwerw, Quotient.eqQuotient.sound on quotient descent lemmas, stricter simp → dropped unused args, simp (config := { failIfUnchanged := false }), higher maxHeartbeats / maxSteps where needed).
  • set_option backward.isDefEq.respectTransparency false (file-scoped): Fields/Binary/Tower/Concrete/{Field,Algebra,Basis}.lean, Fields/Binary/Tower/Equiv.lean; scoped on theorems in Tower/Abstract/Basis.lean, Tower/Support/Preliminaries.lean, ToMathlib/MvPolynomial/Equiv.lean (support_finSuccEquivNth).
  • @[reducible] added on various class-valued defs (e.g. Data/RingTheory/AlgebraTower.lean toAlgebra + AlgebraTowerEquiv algebra defs; abstract/concrete binary tower algebra/module/scalar-tower helpers; Concrete/Core mkAddCommGroup/mkRing/mkDivisionRing/mkField; Concrete/Field liftConcreteBTField).
  • noncomputable: CBivariate.ofPoly; CMvPolynomial.degreeOf / degrees / vars; getBTFResult; Fintype instances for ConcreteBTField k and test BTF₃.
  • Lawful.lean / Unlawful.lean: set_option allowUnsafeReducibility true + attribute [local reducible] instDecidableEqOfLawfulBEq; mem_iff / zero_eq_empty proof tweaks.
  • Mathlib renames in proofs: Nat.cast_leENat.coe_le_coe (ENat floor lemma); Array.sum_eq_sum_toListArray.sum_toList; List.extract_eq_drop_takeList.extract_eq_take_drop.
  • ENNReal.mul_inv_rev_ENNReal: statement now only ha : a ≠ 0 (drops hb); proof via ENNReal.mul_inv.
  • Binary tower / GHASH / NTT / multilinear / mv poly equiv: assorted erw, convert, conv, and simp list edits; NovelPolynomialBasis: degree_Xⱼ WithBot cast path reworked, redundant CoeffVecSpace AddCommGroup instance removed, toCoeffsVec.map_smul' unfolded; Split.lean unique_linear_decomposition_succ and split_algebraMap_eq_zero_x proofs reworked.
  • Multivariate/MvPolyEquiv/Instances.lean: Finsupp.single/single_eq_* steps adjusted for new simp behavior.
  • Rename.lean: toFinsupp_zero finishes with Vector.getElem_zero.
  • Tests Univariate/Linear.lean: test-local BEq defs @[reducible]; LawfulBEq proofs use erw on beq unfolds.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

🤖 Gemini PR Summary

Updates the project to Lean v4.29.0 and synchronizes mathlib and ExtTreeMapLemmas to their corresponding releases.

Infrastructure & Dependencies

  • Updates lean-toolchain, lakefile.lean, and lake-manifest.json to target Lean v4.29.0.

Elaboration & Typeclass Optimization

  • Reducibility: Marks numerous algebra, module, and scalar tower definitions as @[reducible] or abbrev (notably in Data/RingTheory/AlgebraTower.lean and binary tower implementations) to facilitate typeclass resolution.
  • Transparency: Sets backward.isDefEq.respectTransparency to false in files covering field towers and multivariate polynomial equivalences to maintain definitional equality under stricter Lean 4.29.0 defaults.
  • Unsafe Reducibility: Enables allowUnsafeReducibility in Lawful.lean and Unlawful.lean to support local reducible instances.
  • Computability: Designates CBivariate.ofPoly, CMvPolynomial degree/variable operations, and Fintype instances for ConcreteBTField as noncomputable.

API & Tactic Maintenance

  • Mathlib Alignment: Updates proofs to use renamed or modified lemmas:
    • Nat.cast_leENat.coe_le_coe
    • Array.sum_eq_sum_toListArray.sum_toList
    • List.extract_eq_drop_takeList.extract_eq_take_drop
  • Lemma Refinement: Generalizes ENNReal.mul_inv_rev_ENNReal by removing the redundant hypothesis hb : b ≠ 0.
  • Tactic Adjustments: Transitions from rw to erw in several files to resolve definitional issues and replaces push_neg with push Not.
  • Simp Cleanup: Drops unused arguments in simp calls and uses simp (config := { failIfUnchanged := false }) to handle altered simplifier behavior.

Universe Generalization

  • Refactors multivariate polynomial components (monomials, evaluation, and variable handling) in CompPoly/Multivariate/ to be universe-polymorphic by replacing Type with Type*.

CRITICAL: No sorry or admit placeholders were introduced in this Pull Request; all modified proofs have been verified to remain complete under Lean v4.29.0.

Note on Discrepancies: The draft summary identifies a universe generalization refactor in CompPoly/Multivariate/ and a transition from push_neg to push Not, neither of which is explicitly mentioned in the provided PR body or changelog.


Statistics

Metric Count
📝 Files Changed 46
Lines Added 383
Lines Removed 380

Lean Declarations

✏️ **Removed:** 12 declaration(s)
  • def mkFieldInstance {k : ℕ} (props : ConcreteBTFieldProps k) : Field (ConcreteBTField k) where in CompPoly/Fields/Binary/Tower/Concrete/Core.lean
  • def binaryAlgebraTower {l r : ℕ} (h_le : l ≤ r) : Algebra (BTField l) (BTField r) in CompPoly/Fields/Binary/Tower/Abstract/Algebra.lean
  • instance instFintype {k : ℕ} : Fintype (ConcreteBTField k) in CompPoly/Fields/Binary/Tower/Concrete/Field.lean
  • def isScalarTower_succ_right (l r : ℕ) (h_le : l ≤ r) in CompPoly/Fields/Binary/Tower/Concrete/Basis.lean
  • def liftConcreteBTField (k : ℕ) (prevBTFResult : ConcreteBTFStepResult (k in CompPoly/Fields/Binary/Tower/Concrete/Field.lean
  • def getBTFResult (k : ℕ) : ConcreteBTFStepResult k in CompPoly/Fields/Binary/Tower/Concrete/Field.lean
  • def mkRingInstance {k : ℕ} (props : ConcreteBTFieldProps k) : Ring (ConcreteBTField k) where in CompPoly/Fields/Binary/Tower/Concrete/Core.lean
  • def NZConst {n : ℕ} {R : Type} [Zero R] (p : Lawful n R) : Prop in CompPoly/Multivariate/Lawful.lean
  • def BTField.isScalarTower_succ_right (l r : ℕ) (h_le : l ≤ r) in CompPoly/Fields/Binary/Tower/Abstract/Basis.lean
  • def mkAddCommGroupInstance {k : ℕ} : AddCommGroup (ConcreteBTField k) in CompPoly/Fields/Binary/Tower/Concrete/Core.lean
  • def mkDivisionRingInstance {k : ℕ} (props : ConcreteBTFieldProps k) : in CompPoly/Fields/Binary/Tower/Concrete/Core.lean
  • def binaryTowerModule {l r : ℕ} (h_le : l ≤ r) : Module (BTField l) (BTField r) in CompPoly/Fields/Binary/Tower/Abstract/Algebra.lean
✏️ **Added:** 1 declaration(s)
  • def NzConst {n : ℕ} {R : Type*} [Zero R] (p : Lawful n R) : Prop in CompPoly/Multivariate/Lawful.lean
✏️ **Affected:** 58 declaration(s) (line number changed)
  • theorem ENNReal.mul_inv_rev_ENNReal {a b : ℕ} (ha : a ≠ 0) : in CompPoly/Data/Nat/Bitwise.lean moved from L52 to L52
  • lemma coeff_sumToIter {n : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L389 to L389
  • def support {R : Type*} {n : ℕ} [Zero R] (p : CMvPolynomial n R) : Finset (Fin n →₀ ℕ) in CompPoly/Multivariate/CMvPolynomial.lean moved from L138 to L138
  • def sumToIter {n : ℕ} {R : Type*} [Zero R] [Add R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L216 to L216
  • abbrev Unlawful (n : ℕ) (R : Type*) : Type _ in CompPoly/Multivariate/Unlawful.lean moved from L34 to L34
  • def restrictDegree {n : ℕ} {R : Type*} [BEq R] [LawfulBEq R] [Zero R] in CompPoly/Multivariate/CMvPolynomial.lean moved from L211 to L208
  • lemma filter_get {R : Type*} [BEq R] [LawfulBEq R] {v : R} {m : CMvMonomial n} (a : Unlawful n R) : in CompPoly/Multivariate/Unlawful.lean moved from L225 to L227
  • abbrev CMvPolynomial (n : ℕ) (R : Type*) [Zero R] : Type _ in CompPoly/Multivariate/CMvPolynomial.lean moved from L42 to L42
  • lemma eval₂Hom_apply {S : Type*} [CommSemiring S] in CompPoly/Multivariate/MvPolyEquiv/Eval.lean moved from L98 to L93
  • lemma totalDegree_equiv {S : Type*} {p : CMvPolynomial n R} [CommSemiring S] : in CompPoly/Multivariate/MvPolyEquiv/Eval.lean moved from L56 to L56
  • lemma list_foldl_add_comm {β K V : Type*} [AddCommMonoid β] in CompPoly/Multivariate/Rename.lean moved from L36 to L36
  • lemma not_mem_zero : x ∉ (0 : Unlawful n R) in CompPoly/Multivariate/Unlawful.lean moved from L148 to L150
  • lemma foldl_add_comm {β : Type*} [AddCommMonoid β] {k : ℕ} in CompPoly/Multivariate/Operations.lean moved from L359 to L359
  • def aeval {n : ℕ} {R σ : Type*} [CommSemiring R] [CommSemiring σ] [Algebra R σ] in CompPoly/Multivariate/Operations.lean moved from L126 to L126
  • lemma zero_eq_empty : (0 : Lawful n R) = ∅ in CompPoly/Multivariate/Lawful.lean moved from L114 to L116
  • abbrev AlgebraTowerEquiv.toAlgebraOverRight (e : AlgebraTowerEquiv A B) (i j : ι) in CompPoly/Data/RingTheory/AlgebraTower.lean moved from L109 to L109
  • abbrev binaryTowerModule {l r : ℕ} (h_le : l ≤ r) : in CompPoly/Fields/Binary/Tower/Concrete/Algebra.lean moved from L411 to L413
  • lemma X_eq_monomial {k : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L222 to L222
  • def coeff {R : Type*} {n : ℕ} [Zero R] (m : CMvMonomial n) (p : CMvPolynomial n R) : R in CompPoly/Multivariate/CMvPolynomial.lean moved from L59 to L59
  • def leadingCoeff {n : ℕ} {R : Type*} [Zero R] [MonomialOrder n] in CompPoly/Multivariate/Operations.lean moved from L85 to L85
  • def rename {n m : ℕ} {R : Type*} [Zero R] [Add R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L207 to L207
  • def X {n : ℕ} {R : Type*} [Zero R] [One R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/CMvPolynomial.lean moved from L53 to L53
  • lemma add_getD? [AddZeroClass R] {m : CMvMonomial n} {p q : Unlawful n R} : in CompPoly/Multivariate/Unlawful.lean moved from L229 to L231
  • def eval {R : Type*} {n : ℕ} [CommSemiring R] : (Fin n → R) → CMvPolynomial n R → R in CompPoly/Multivariate/CMvPolynomial.lean moved from L133 to L133
  • def vars {n : ℕ} {R : Type*} [Zero R] (p : CMvPolynomial n R) : Finset (Fin n) in CompPoly/Multivariate/CMvPolynomial.lean moved from L190 to L187
  • lemma foldl_eq_sum {β : Type*} [AddCommMonoid β] in CompPoly/Multivariate/MvPolyEquiv/Instances.lean moved from L190 to L187
  • def coeff {R : Type*} {n : ℕ} [Zero R] (m : CMvMonomial n) (p : Unlawful n R) : R in CompPoly/Multivariate/Unlawful.lean moved from L221 to L223
  • lemma foldl_add_comm' {β : Type*} [AddCommMonoid β] {k : ℕ} in CompPoly/Multivariate/Rename.lean moved from L48 to L48
  • lemma sumToIter_eq {n : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L378 to L378
  • def bind₁ {n m : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L166 to L166
  • def C {n : ℕ} {R : Type*} [BEq R] [LawfulBEq R] [Zero R] (c : R) : CMvPolynomial n R in CompPoly/Multivariate/CMvPolynomial.lean moved from L49 to L49
  • lemma zero_eq_empty [BEq R] [LawfulBEq R] : (0 : Unlawful n R) = ∅ in CompPoly/Multivariate/Unlawful.lean moved from L138 to L138
  • abbrev ConcreteBTFieldAlgebra {l r : ℕ} (h_le : l ≤ r) : in CompPoly/Fields/Binary/Tower/Concrete/Algebra.lean moved from L209 to L211
  • lemma eval₂_equiv {S : Type*} {p : CMvPolynomial n R} [CommSemiring S] {f : (R →+* S)} in CompPoly/Multivariate/MvPolyEquiv/Eval.lean moved from L25 to L25
  • def leadingMonomial {n : ℕ} {R : Type*} [Zero R] [MonomialOrder n] in CompPoly/Multivariate/Operations.lean moved from L58 to L58
  • abbrev MonoR (n : ℕ) (R : Type*) in CompPoly/Multivariate/CMvMonomial.lean moved from L167 to L167
  • lemma degreeOf_eq_count_degrees {n : ℕ} {R : Type*} [Zero R] in CompPoly/Multivariate/CMvPolynomial.lean moved from L169 to L166
  • def eval₂ {R S : Type*} {n : ℕ} [Semiring R] [CommSemiring S] : in CompPoly/Multivariate/CMvPolynomial.lean moved from L128 to L128
  • lemma isNoZeroCoef_zero : isNoZeroCoef (n in CompPoly/Multivariate/Unlawful.lean moved from L151 to L153
  • def degreeOf {R : Type*} {n : ℕ} [Zero R] (i : Fin n) : CMvPolynomial n R → ℕ in CompPoly/Multivariate/CMvPolynomial.lean moved from L147 to L147
  • def degrees {n : ℕ} {R : Type*} [Zero R] (p : CMvPolynomial n R) : Multiset (Fin n) in CompPoly/Multivariate/CMvPolynomial.lean moved from L165 to L162
  • def Lawful (n : ℕ) (R : Type*) [Zero R] : Type _ in CompPoly/Multivariate/Lawful.lean moved from L28 to L30
  • def eval₂Hom {S : Type*} [CommSemiring S] in CompPoly/Multivariate/MvPolyEquiv/Eval.lean moved from L89 to L84
  • def restrictBy {n : ℕ} {R : Type*} [BEq R] [LawfulBEq R] [Zero R] in CompPoly/Multivariate/CMvPolynomial.lean moved from L194 to L191
  • lemma fromCMvPolynomial_X {k : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L271 to L271
  • abbrev AlgebraTowerEquiv.toAlgebraOverLeft (e : AlgebraTowerEquiv A B) (i j : ι) in CompPoly/Data/RingTheory/AlgebraTower.lean moved from L105 to L105
  • lemma toList_pairs_monomial_coeff {β : Type*} [AddCommMonoid β] in CompPoly/Multivariate/MvPolyEquiv/Instances.lean moved from L179 to L176
  • lemma fromCMvPolynomial_monomial {k : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L244 to L244
  • def monomial {n : ℕ} {R : Type*} [BEq R] [LawfulBEq R] [Zero R] in CompPoly/Multivariate/CMvPolynomial.lean moved from L157 to L154
  • def leadingTerm {n : ℕ} {R : Type*} [Zero R] [BEq R] [LawfulBEq R] [MonomialOrder n] in CompPoly/Multivariate/Operations.lean moved from L75 to L75
  • lemma bind₁_eq_aeval {n m : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L173 to L173
  • def restrictTotalDegree {n : ℕ} {R : Type*} [BEq R] [LawfulBEq R] [Zero R] in CompPoly/Multivariate/CMvPolynomial.lean moved from L203 to L200
  • lemma list_foldl_add_comm {β K V : Type*} [AddCommMonoid β] in CompPoly/Multivariate/Operations.lean moved from L348 to L348
  • lemma degreeOf_equiv {S : Type*} {p : CMvPolynomial n R} [CommSemiring S] : in CompPoly/Multivariate/MvPolyEquiv/Eval.lean moved from L60 to L60
  • lemma sumToIter_add {n : ℕ} {R : Type*} [CommSemiring R] [BEq R] [LawfulBEq R] in CompPoly/Multivariate/Operations.lean moved from L398 to L398
  • def evalMonomial {R : Type*} {n : ℕ} [CommSemiring R] : (Fin n → R) → CMvMonomial n → R in CompPoly/Multivariate/CMvMonomial.lean moved from L198 to L198
  • def totalDegree {R : Type*} {n : ℕ} [Zero R] : CMvPolynomial n R → ℕ in CompPoly/Multivariate/CMvPolynomial.lean moved from L142 to L142
  • abbrev AlgebraTower.toAlgebra {i j : ι} (h : i ≤ j) : Algebra (A i) (A j) in CompPoly/Data/RingTheory/AlgebraTower.lean moved from L45 to L45

sorry Tracking

  • No sorrys were added, removed, or affected.

🎨 **Style Guide Adherence**

Based on the provided style guide, here are the violations found in the code changes:

  • Acronyms: Treat as words (e.g., HtmlParser not HTMLParser).

    • Violation Count: > 20
    • Examples:
      • CompPoly/Multivariate/CMvPolynomial.lean, line 39: CMvPolynomial (should be CmvPolynomial).
      • CompPoly/Fields/Binary/Tower/Abstract/Algebra.lean, line 135: BTField (should be BtField).
      • CompPoly/Fields/Binary/AdditiveNTT/Impl.lean, line 399: BTF₃ (should be Btf₃).
  • Functions: Prefer fun x ↦ ... over λ x, ....

    • Violation Count: > 20 (The project uses the symbol in some areas, but continues to use => elsewhere).
    • Examples:
      • CompPoly/Multivariate/CMvPolynomial.lean, line 159: fun i => Multiset.replicate (p.degreeOf i) i
      • CompPoly/Multivariate/MvPolyEquiv/Eval.lean, line 53: ...sup fun m => m.degreeOf i) = ...
      • tests/CompPolyTests/Univariate/Linear.lean, line 14: fun a b => decide (a = b)
  • Line Length: Keep lines under 100 characters.

    • CompPoly/Fields/Binary/Tower/Abstract/Split.lean, line 326: This line exceeds 100 characters.
    • CompPoly/Multivariate/MvPolyEquiv/Eval.lean, line 53: This line exceeds 100 characters (approx. 164 characters).

📄 **Per-File Summaries**
  • CompPoly/Bivariate/ToPoly.lean: This PR refines the conversion between computable and standard bivariate polynomials by adding necessary semiring instances and updating proofs to maintain compatibility with the underlying representation. The changes modify several existing lemmas and theorems (e.g., ofPoly_add, toPoly_mul, and ofPoly_zero) using more robust tactics and explicit subtype extensionality, and no sorry placeholders are introduced.
  • CompPoly/Data/Fin/BigOperators.lean: This change performs a minor tactical refactoring in two proofs, replacing the push_neg tactic with push Not to handle negation pushing. The modification does not alter any definitions or theorem statements and introduces no sorry placeholders.
  • CompPoly/Data/Nat/Bitwise.lean: This PR streamlines and modernizes several proofs related to ENat, ENNReal, and bitwise natural number operations. The proof of ENNReal.mul_inv_rev_ENNReal is significantly simplified and generalized by removing a redundant hypothesis, while other proofs are shortened by replacing explicit rewrites with the omega tactic and updating tactic syntax.
  • CompPoly/Data/Polynomial/Frobenius.lean: This change modifies the proof of degree_dvd_of_irreducible_dvd_X_pow_card_pow_sub_X by replacing a standard rewrite with erw to resolve a definitional equality involving the cardinality of units. No new theorems or definitions are introduced, and the file contains no sorry or admit placeholders.
  • CompPoly/Data/RingTheory/AlgebraTower.lean: The changes convert several algebra instance definitions within AlgebraTower and AlgebraTowerEquiv from def to abbrev. This modification improves the reducibility of these instances, facilitating better typeclass resolution and unification in Lean's elaborator.
  • CompPoly/Data/Vector/Basic.lean: This change modifies the proof of the theorem tail_cons by updating a lemma name in a simplification tactic to match current library naming conventions. No new theorems or definitions are introduced, and the file contains no sorry placeholders.
  • CompPoly/Fields/Binary/AdditiveNTT/Algorithm.lean: This change refactors two proofs in the additive NTT algorithm by replacing the push_neg tactic with push Not. It modifies existing proof scripts to use more specific logic tactics without introducing new definitions or theorems.
  • CompPoly/Fields/Binary/AdditiveNTT/Correctness.lean: This change refines existing proofs for the correctness of the binary Additive NTT by updating tactic applications and rewriting strategies. Specifically, it adjusts how negations are handled and utilizes erw to resolve definitional issues in the additiveNTT_correctness theorem.
  • CompPoly/Fields/Binary/AdditiveNTT/Impl.lean: This change modifies the Fintype instance for the 8-bit binary tower field BTF₃ by providing an explicit implementation through an equivalence with BitVec and Fin types. The update introduces a dependency on Mathlib.Data.BitVec to support this more concrete definition.
  • CompPoly/Fields/Binary/AdditiveNTT/Intermediate.lean: This change modifies existing proofs by replacing rw with erw in two lemmas to resolve unification issues during rewriting. No new theorems, definitions, or sorry placeholders are introduced.
  • CompPoly/Fields/Binary/AdditiveNTT/NovelPolynomialBasis.lean: This PR refines and simplifies proofs related to the novel polynomial basis, specifically by streamlining the degree calculation in degree_Xⱼ and updating negation tactics. The changes remove a redundant algebraic instance for CoeffVecSpace and improve proof robustness without introducing any new definitions or sorry placeholders.
  • CompPoly/Fields/Binary/BF128Ghash/Basic.lean: This change refines the proof of the root_satisfies_poly theorem by adjusting the simplification and rewriting tactics used to evaluate the field's minimal polynomial. Specifically, it replaces a portion of the simp call with erw to ensure that polynomial evaluation lemmas for powers and variables are applied correctly.
  • CompPoly/Fields/Binary/Common.lean: This PR refactors existing proofs in CompPoly/Fields/Binary/Common.lean by replacing push_neg with push Not and streamlining the proof of toPoly_128_extend_256 for better clarity. The changes focus exclusively on proof maintenance and tactic updates, introducing no new theorems, definitions, or sorry placeholders.
  • CompPoly/Fields/Binary/Tower/Abstract/Algebra.lean: This update refines proofs involving towerAlgebraMap by using erw to better handle type casts and marks binaryAlgebraTower and binaryTowerModule as @[reducible] to facilitate typeclass resolution. The changes modify existing proofs and definitions without introducing new theorems or sorry placeholders.
  • CompPoly/Fields/Binary/Tower/Abstract/Basis.lean: This PR refines and fixes proofs related to power bases and multilinear bases in binary tower fields by addressing issues with instance resolution and definitional equality. Key changes include using erw and specific compiler options (backward.isDefEq.respectTransparency) to bridge gaps where simp failed, and increasing resource limits for the complex multilinearBasis_apply theorem. No new theorems were added, and no sorry or admit placeholders were introduced.
  • CompPoly/Fields/Binary/Tower/Abstract/Split.lean: This PR refines the proofs for the linear decomposition and splitting of binary tower field elements, primarily by improving the handling of algebraic mappings and dependent type casts (eqRec). The changes replace implicit convert tactics with more explicit derivation steps in unique_linear_decomposition_succ and update the simplification path for embeddings in split_algebraMap_eq_zero_x. No new theorems or sorry placeholders are introduced.
  • CompPoly/Fields/Binary/Tower/Concrete/Algebra.lean: This update converts the ConcreteBTFieldAlgebra and binaryTowerModule definitions to abbrev to facilitate better typeclass inference and unification within the field tower. It also relaxes a transparency setting for definitional equality to ensure consistent behavior during algebraic instance resolution.
  • CompPoly/Fields/Binary/Tower/Concrete/Basis.lean: This change refactors and optimizes proofs related to basis constructions in the concrete binary tower field, notably by marking isScalarTower_succ_right as reducible and adjusting definitional equality transparency settings. The PR streamlines the proofs of PowerBasis.cast_basis_succ_of_eq_rec_apply and multilinearBasis_apply and introduces no new theorems or sorry placeholders.
  • CompPoly/Fields/Binary/Tower/Concrete/Core.lean: Refactors several proofs to improve clarity and efficiency, primarily by streamlining tactic blocks and replacing push_neg with push Not. It also marks algebraic instance constructors (like mkFieldInstance) as @[reducible] to facilitate better unfolding during typeclass resolution. No new theorems or sorry placeholders are introduced.
  • CompPoly/Fields/Binary/Tower/Concrete/Field.lean: This change optimizes typeclass resolution and definitional equality for the concrete binary tower by marking liftConcreteBTField as reducible and relaxing transparency settings for unification. Additionally, it designates getBTFResult and the Fintype instance as noncomputable to accommodate non-constructive dependencies in the field construction.
  • CompPoly/Fields/Binary/Tower/Equiv.lean: This Lean file updates the environment configuration by setting the backward.isDefEq.respectTransparency option to false. This change is intended to facilitate definitional equality checks and unification during the proofs of equivalences between abstract and concrete binary tower constructions.
  • CompPoly/Fields/Binary/Tower/Support/Preliminaries.lean: This change performs maintenance on existing proofs by replacing push_neg calls with push Not and adjusting transparency settings for definitional equality to ensure compatibility with the Lean 4 environment. No new theorems or definitions are introduced, and no sorry placeholders were added.
  • CompPoly/Multilinear/Equiv.lean: This PR refactors several proofs related to the equivalence between multilinear polynomials and degree-restricted multivariate polynomials. It replaces the push_neg tactic with push Not and simplifies the implementation of linearEquivMvPolynomialDeg1 by streamlining rewrites and removing redundant conversion steps. No new theorems or definitions are introduced, and no sorry placeholders are present.
  • CompPoly/Multivariate/CMvMonomial.lean: This change generalizes the universe level of the type parameter R from Type to Type* across the MonoR and evalMonomial definitions. This ensures that these multivariate monomial structures and their evaluation functions can be used with types residing in any universe level.
  • CompPoly/Multivariate/CMvPolynomial.lean: This update generalizes the universe levels for coefficient types across CMvPolynomial definitions and lemmas by replacing Type with Type*. Additionally, it simplifies the implementation of the degreeOf definition to calculate the supremum of variable degrees across monomials more directly.
  • CompPoly/Multivariate/CMvPolynomialEvalLemmas.lean: This change generalizes the universe level of the commutative semiring type R by replacing Type with Type*. It maintains the existing lemmas without introducing new definitions, theorems, or sorry placeholders.
  • CompPoly/Multivariate/FinSuccEquiv.lean: This change generalizes the universe level of the ring type R by replacing Type with Type* in the variable declaration. It does not introduce new theorems or definitions.
  • CompPoly/Multivariate/Lawful.lean: This update generalizes Lawful multivariate polynomials to be universe-polymorphic and improves the reducibility of decidable equality instances to facilitate automation. It also standardizes naming conventions for constant checks and makes minor tactical adjustments to existing proofs.
  • CompPoly/Multivariate/MvPolyEquiv/Core.lean: This change generalizes the universe level of the coefficient ring and refines the proofs for the equivalence between CMvPolynomial and MvPolynomial. It modifies existing proofs to use more explicit lemma applications for ExtTreeMap operations and contains no sorry or admit placeholders.
  • CompPoly/Multivariate/MvPolyEquiv/Eval.lean: This update generalizes universe levels for the types R and S (changing Type to Type*) and refactors the proof of degreeOf_equiv to use more idiomatic Finset lemmas. The changes improve the maintainability and generality of the library without introducing any sorry or admit placeholders.
  • CompPoly/Multivariate/MvPolyEquiv/Instances.lean: This update generalizes several definitions and lemmas to use universe polymorphism and refines existing proofs to ensure compatibility with newer Lean 4 versions. Specifically, it modifies the proofs for map_one and map_mul to handle changes in beta-reduction behavior and improves robustness without introducing any new theorems, definitions, or sorry placeholders.
  • CompPoly/Multivariate/Operations.lean: This change generalizes the universe levels for types (such as the coefficient ring $R$) across various multivariate polynomial definitions and lemmas by replacing Type with Type*. These updates increase the library's flexibility by allowing operations like leadingMonomial, aeval, and bind₁ to be used in higher type universes.
  • CompPoly/Multivariate/Rename.lean: This update generalizes universe levels from Type to Type* across several declarations and modifies the proof of toFinsupp_zero by adding an explicit terminal step. No new theorems, definitions, or sorry placeholders are introduced.
  • CompPoly/Multivariate/Restrict.lean: This update introduces universe polymorphism for type parameters and refactors a proof to use the renamed Array.sum_toList lemma. No new theorems or sorry placeholders are added.
  • CompPoly/Multivariate/Unlawful.lean: This PR refactors the Unlawful multivariate polynomial type from a definition to an abbreviation and updates the coefficient type R to be universe polymorphic. It also generalizes the add_getD? lemma to require only an AddZeroClass instance and adjusts internal reducible attributes to improve elaborator performance. No sorry or admit placeholders were introduced.
  • CompPoly/Multivariate/VarsDegrees.lean: This change generalizes the universe level of the type parameter R from Type to Type*. This allows the definitions and lemmas in the file to be used with types in any universe level rather than being restricted to Type 0.
  • CompPoly/ToMathlib/MvPolynomial/Equiv.lean: This change applies the backward.isDefEq.respectTransparency configuration option to the support_finSuccEquivNth theorem to adjust how definitional equality is handled during proof elaboration. It does not introduce new theorems or sorry placeholders.
  • CompPoly/ToMathlib/Polynomial/BivariateDegree.lean: This PR refines existing proofs for bivariate polynomials by simplifying simp calls and updating tactic usage. No new definitions or theorems are introduced, and no sorry placeholders are added.
  • CompPoly/Univariate/Quotient/Core.lean: This refactors several proofs in the polynomial quotient implementation by replacing manual rewrites of quotient equality with the more idiomatic Quotient.sound. These changes simplify the proofs for operational "descending" lemmas (such as addition, multiplication, and power) without introducing new definitions or theorems.
  • CompPoly/Univariate/Raw/Core.lean: This change modifies the proof of the lastNonzero_induct theorem by replacing the push_neg tactic with push Not. No new definitions or theorems are introduced, and no sorry or admit placeholders are added.
  • CompPoly/Univariate/Raw/Proofs.lean: This update modifies the proof of equiv_mul_one by replacing the lemma Array.sum_eq_sum_toList with Array.sum_toList. The change aligns the theorem's proof with the current naming conventions or API of the underlying library.
  • lakefile.lean: Updates the mathlib and ExtTreeMapLemmas dependencies to version v4.29.0 to align the project with newer library releases.
  • tests/CompPolyTests/Univariate/Linear.lean: This change adds the @[implicit_reducible] attribute to private BEq instances for Nat and refactors their corresponding LawfulBEq proofs to use erw with explicit unfolding. The modifications focus on improving the transparency and robustness of these local definitions and proofs, and no sorry or admit placeholders are introduced.
  • CompPoly/Multilinear/Basic.lean: This change streamlines the proofs of mobius_apply_zeta_apply_eq_id and zeta_apply_mobius_apply_eq_id by removing redundant lemmas from simplification tactics. It modifies existing proofs without introducing new definitions or sorry placeholders.

Last updated: 2026-04-14 08:17 UTC.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

Build Timing Report

  • Commit: f79add6
  • Message: Merge df89660 into 6c3c131
  • Ref: dhsorens/bump_to_4.29.0-rc6
  • Comparison baseline: bc7abd8 from the previous successful PR update.
  • Measured on ubuntu-latest with /usr/bin/time -p.
  • Commands: clean build rm -rf .lake/build && lake build; warm rebuild lake build; test path lake test.
Measurement Baseline (s) Current (s) Delta (s) Status
Clean build 248.43 250.89 +2.46 ok
Warm rebuild 2.15 2.04 -0.11 ok
Test path 17.27 17.18 -0.09 ok

Incremental Rebuild Signal

  • Warm rebuild saved 248.85s vs clean (122.99x faster).

This compares a clean project build against an incremental rebuild in the same CI job; it is a lightweight variability signal, not a full cross-run benchmark.

Slowest Current Clean-Build Files

Showing 20 slowest current targets, with comparison against the selected baseline when available.

Current (s) Baseline (s) Delta (s) Path
71.00 76.00 -5.00 CompPoly/Fields/Binary/Tower/Abstract/Basis.lean
57.00 55.00 +2.00 CompPoly/Fields/Binary/BF128Ghash/XPowTwoPowModCertificate.lean
49.00 51.00 -2.00 CompPoly/Bivariate/ToPoly.lean
30.00 31.00 -1.00 CompPoly/Fields/Binary/BF128Ghash/Impl.lean
29.00 30.00 -1.00 CompPoly/Univariate/Raw/Proofs.lean
28.00 25.00 +3.00 CompPoly/Fields/Binary/Tower/Support/Preliminaries.lean
25.00 27.00 -2.00 CompPoly/Univariate/Lagrange.lean
24.00 25.00 -1.00 CompPoly/Fields/Binary/AdditiveNTT/NovelPolynomialBasis.lean
20.00 19.00 +1.00 CompPoly/Univariate/Quotient/Core.lean
18.00 15.00 +3.00 CompPoly/Fields/Binary/AdditiveNTT/Intermediate.lean
17.00 17.00 +0.00 CompPoly/Multivariate/Unlawful.lean
16.00 14.00 +2.00 CompPoly/Fields/Binary/AdditiveNTT/Domain.lean
16.00 9.70 +6.30 CompPoly/Multilinear/Basic.lean
15.00 12.00 +3.00 CompPoly/Fields/Binary/AdditiveNTT/Correctness.lean
13.00 15.00 -2.00 CompPoly/Fields/Binary/Common.lean
12.00 10.00 +2.00 CompPoly/Fields/PrattCertificate.lean
12.00 13.00 -1.00 CompPoly/Univariate/Basic.lean
11.00 11.00 +0.00 CompPoly/Fields/Binary/Tower/Abstract/Split.lean
10.00 9.30 +0.70 CompPoly/Data/Nat/Bitwise.lean
10.00 8.00 +2.00 CompPoly/Fields/Basic.lean

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

🤖 Initial AI review without external context

🤖 AI Review

Overall Summary:

Executive Summary

1. TL;DR
The mathematical logic and proof refactoring in this PR are commendable, introducing significant robustness improvements and elegant simplifications (e.g., leveraging the omega tactic and term-mode golfing). However, changes are requested to resolve several technical Lean 4 issues, most notably a pervasive find-and-replace of push_neg with an invalid tactic, globally scoped definitional equality overrides, and redundant typeclass parameters that risk API pollution.

2. Checklist Coverage
No explicit specification checklist was provided for this review.

3. Critical Misformalizations
None. The mathematical modifications, underlying logic, and core definitions are fundamentally sound. The updates to ENNReal.mul_inv_rev_ENNReal correctly identify trivialities, and replacing brittle simp blocks with explicit forward reasoning greatly improves proof stability.

4. Key Lean 4 / Mathlib Issues

  • Invalid Tactic push Not (4 files): The standard Mathlib tactic push_neg has been systematically replaced with push Not. Standard Lean 4 and Mathlib do not have a built-in push Not tactic; this will cause unknown tactic errors. Even if a local macro exists in your environment, push_neg is the universally recognized idiom for pushing negations inward and must be retained. Please revert these instances.
    • Affected files: CompPoly/Data/Nat/Bitwise.lean, CompPoly/Fields/Binary/AdditiveNTT/NovelPolynomialBasis.lean, CompPoly/Univariate/Raw/Core.lean, CompPoly/Fields/Binary/Tower/Support/Preliminaries.lean.
  • Global Transparency Overrides (3 files): The option set_option backward.isDefEq.respectTransparency false has been applied globally at the top of several files. This alters the core unifier's behavior for the entire file, breaking abstraction boundaries and risking severe performance degradation during typeclass synthesis. If this is genuinely required to bypass a unification bottleneck, it must be strictly localized using set_option ... in or a section ... end block, and accompanied by an explanatory comment.
    • Affected files: CompPoly/Fields/Binary/Tower/Concrete/Algebra.lean, CompPoly/Fields/Binary/Tower/Concrete/Basis.lean, CompPoly/Fields/Binary/Tower/Equiv.lean.
  • Redundant and Uninferrable Typeclass Assumptions (2 files):
    • In CompPoly/Bivariate/ToPoly.lean: The explicit parameter [Semiring (Polynomial R)] in ofPoly is redundant because Lean automatically derives it via Polynomial.semiring (since R has [Semiring R]). Explicitly requesting it pollutes the API and introduces the risk of typeclass diamonds. Please remove it.
    • In CompPoly/Multivariate/MvPolyEquiv/Eval.lean: The implicit parameter {S : Type*} [CommSemiring S] in totalDegree_equiv and degreeOf_equiv does not appear in the statement. This prevents Lean from inferring S, causing unassigned metavariable errors when rewriting. Please drop it.
  • Test Environment Attributes & Fragile Rewrites (1 file):
    • In tests/CompPolyTests/Univariate/Linear.lean: The @[implicit_reducible] attribute is not a standard Lean 4 attribute and should be replaced with @[reducible] or by using an abbrev. Additionally, using erw [show X = Y from rfl] is a fragile anti-pattern; use the change tactic to adjust definitional equalities instead.
  • Unidiomatic Instance Definition (1 file):
    • In CompPoly/Fields/Binary/AdditiveNTT/Impl.lean: The manual construction of Fintype BTF₃ via Fintype.ofEquiv is overly verbose. Because BTF₃ is definitionally BitVec 8, you can cleanly inherit the computable instance via instance : Fintype BTF₃ := inferInstanceAs (Fintype (BitVec 8)).
  • Unidiomatic simp Configuration (1 file):
    • In CompPoly/Fields/Binary/Tower/Concrete/Basis.lean: The use of simp (config := { failIfUnchanged := false }) is generally an anti-pattern in linear proofs. If simp does not change the goal, it should be removed.

5. Overall Verdict
Changes Requested


📄 **Review for `CompPoly/Bivariate/ToPoly.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  • Redundant Typeclass Assumption: In ofPoly, the typeclass assumption [Semiring (Polynomial R)] has been added to the signature. This is redundant and highly unidiomatic. Because R already has a [Semiring R] instance, Lean automatically derives Semiring (Polynomial R) via Polynomial.semiring. Furthermore, the type R[X][Y] (Polynomial (Polynomial R)) strictly requires Polynomial R to be a semiring to even be well-formed.
    Adding this as an explicit parameter pollutes the definition's API and risks creating typeclass diamonds in downstream code if a different path synthesizes the same instance. If typeclass inference was timing out or failing internally within the definition, it should be resolved without altering the public signature (e.g., by ensuring proper imports or using a local letI if absolutely necessary, though it shouldn't be). Please revert this change:
    def ofPoly {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semiring R]
        [DecidableEq R] (p : R[X][Y]) : CBivariate R :=

Nitpicks:

  • Overuse of erw: The diff replaces several instances of rw with erw to fix broken proofs. While acceptable to repair proofs that fail due to strict definitional equality checks (often involving subtypes or algebraic structures), relying heavily on erw can make proofs more brittle and slower to check. If possible, consider using dsimp or simp only to explicitly unfold the problematic terms so that standard rw can succeed.
📄 **Review for `CompPoly/Data/Fin/BigOperators.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Data/Nat/Bitwise.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None. The mathematical modifications are sound. In particular, removing the unnecessary (hb : b ≠ 0) hypothesis from ENNReal.mul_inv_rev_ENNReal is completely correct, since (a ≠ ∞ ∨ b ≠ 0) is trivially satisfied for any natural number a (as a ≠ ∞ is always true).

Lean 4 / Mathlib Issues:

  • Invalid Tactic push Not: Throughout the file, the PR replaces multiple instances of the push_neg tactic with push Not. There is no push tactic in standard Lean 4 or Mathlib. This appears to be an incorrect find-and-replace (or an AI hallucination) and will cause the file to fail to compile with an unknown tactic error. You must revert all instances of push Not at <hyp> back to the standard push_neg at <hyp>.

Nitpicks:

  • Proof Simplifications: Replacing the manual arithmetic proof in div_2_form with the omega tactic is a fantastic, idiomatic Lean 4 improvement. The term-mode golf for ENNReal.mul_inv_rev_ENNReal is also very clean and elegant. Excellent cleanup on these fronts!
📄 **Review for `CompPoly/Data/Polynomial/Frobenius.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Data/RingTheory/AlgebraTower.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:

  • You can drop the by exact in abbrev AlgebraTowerEquiv.toAlgebraOverLeft and toAlgebraOverRight to be slightly more idiomatic and concise:
    abbrev AlgebraTowerEquiv.toAlgebraOverLeft (e : AlgebraTowerEquiv A B) (i j : ι)
        (h : i ≤ j) : Algebra (A i) (B j) :=
      (e.algebraMapRightUp i j h).toAlgebra
    (This was pre-existing code, but stands out a bit more now that it's an abbrev.)
📄 **Review for `CompPoly/Data/Vector/Basic.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/AdditiveNTT/Algorithm.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/AdditiveNTT/Correctness.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/AdditiveNTT/Impl.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None.

Lean 4 / Mathlib Issues:

  1. Unidiomatic Instance Definition (Fintype BTF₃):
    The manual construction of the computable Fintype instance using Fintype.ofEquiv and BitVec.equivFin is overly verbose and unidiomatic. Because BTF₃ is definitionally BitVec 8 (via ConcreteBTField 3), you can bypass the noncomputable instFintype from ConcreteBTField and directly inherit the computable Fintype instance of BitVec by using inferInstanceAs.

    This also avoids calling .toEquiv on something that is already an Equiv (which is generally redundant) and potentially allows you to remove the import Mathlib.Data.BitVec if it was only added for equivFin.

    You can simply replace the instance with:

    instance : Fintype BTF₃ := inferInstanceAs (Fintype (BitVec 8))

Nitpicks:
None.

📄 **Review for `CompPoly/Fields/Binary/AdditiveNTT/Intermediate.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/AdditiveNTT/NovelPolynomialBasis.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  1. Unidiomatic Tactic Replacement (push_neg -> push Not): The diff replaces the standard Mathlib tactic push_neg with push Not in five different places (e.g., βᵢ_not_in_Uᵢ, eval_W_eq_zero_iff_in_U, degree_Xⱼ). Lean 4 and Mathlib do not have a built-in push Not tactic. If this is a custom macro defined elsewhere in the project, it is an anti-pattern. You should use the standard push_neg tactic, which is universally recognized by Lean developers and explicitly designed for pushing negations inward. Please revert these changes back to push_neg to maintain idiomatic code.

Nitpicks:

  1. Excellent Robustness Improvements: Replacing norm_cast with exact lemmas like WithBot.coe_lt_coe.mpr in polynomialFromNovelCoeffsF₂ is a fantastic change. The same goes for the map_smul' field in toCoeffsVec, where replacing the non-terminal simp with an explicit simp only [...] and rw [...] sequence makes the proof significantly more stable and follows Lean 4 best practices.
  2. Verbose suffices Block in degree_Xⱼ: The new explicit casting block using suffices h : (∑ x : Fin ℓ, f x.val) = j.val is quite verbose compared to the previous change ... norm_cast approach. However, because norm_cast is notoriously brittle when mixing WithBot ℕ, Finset.sum, and ite, this verbosity is a completely acceptable tradeoff for proof stability.
📄 **Review for `CompPoly/Fields/Binary/BF128Ghash/Basic.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/Common.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

Comments:
The changes in this PR are excellent. Replacing the large, fragile simp only block with explicit forward reasoning (have h_testBit_false := ...) makes the proof of toPoly_128_extend_256 significantly more robust against future Mathlib updates. The migration from push_neg to push Not is consistent with the rest of the repository's style.

📄 **Review for `CompPoly/Fields/Binary/Tower/Abstract/Algebra.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:

  • Use abbrev instead of @[reducible] def: In Lean 4, abbrev is the preferred, idiomatic syntactic sugar for @[reducible] def.
  • Unnecessary Tactic Blocks: The definition of binaryAlgebraTower uses a by exact ... tactic block where a direct term assignment would suffice and be slightly cleaner.
    abbrev binaryAlgebraTower {l r : ℕ} (h_le : l ≤ r) : Algebra (BTField l) (BTField r) := 
      AlgebraTower.toAlgebra h_le
    The same applies to binaryTowerModule:
    abbrev binaryTowerModule {l r : ℕ} (h_le : l ≤ r) : Module (BTField l) (BTField r) :=
      (binaryAlgebraTower (h_le:=h_le)).toModule
📄 **Review for `CompPoly/Fields/Binary/Tower/Abstract/Basis.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/Tower/Abstract/Split.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/Tower/Concrete/Algebra.lean`**

Verdict: Needs Minor Revisions

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  • Global modification of transparency settings: The addition of set_option backward.isDefEq.respectTransparency false at the top of the file is generally considered an anti-pattern in Lean 4. It alters the core unifier's behavior globally for the file, instructing it to ignore transparency attributes (@[irreducible], opaque, etc.) during fallback definitional equality checks. This can lead to fragile proofs and severe performance issues in typeclass synthesis and unification.
    Since this PR also correctly changes ConcreteBTFieldAlgebra and binaryTowerModule from def to abbrev (which inherently makes them reducible and transparent to the unifier), this set_option might no longer be necessary. If it is still required for specific proofs to compile, it is strongly recommended to remove the global option and instead explicitly unfold the problematic definitions where needed, or limit the scope of the transparency bypass.

Nitpicks:

  • Changing def to abbrev for ConcreteBTFieldAlgebra and binaryTowerModule is a good practice here. Because these definitions require a proof argument (h_le : l ≤ r), they cannot easily be registered as global instances and are instead introduced locally (e.g., via letI). Making them abbrev ensures that the typeclass system and the unifier can aggressively unfold them and see the underlying Algebra and Module structures without getting stuck.
📄 **Review for `CompPoly/Fields/Binary/Tower/Concrete/Basis.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  1. Global set_option backward.isDefEq.respectTransparency false: Adding this option at the top of the file alters the behavior of the definitional equality checker for the entire file, causing it to ignore transparency modifiers (such as irreducible). This breaks abstraction boundaries globally and can lead to severe performance degradation (e.g., timeouts during typeclass synthesis or unification). If this is genuinely required as a workaround for a specific unification failure, it must be strictly localized. You can wrap the specific theorem in a section ... end block with the set_option or apply it locally.
  2. Unidiomatic simp Configuration: The use of simp (config := { failIfUnchanged := false }) only [...] in the proof of multilinearBasis_apply is highly unidiomatic for a linear, non-branching proof. In a sequential proof script, a simp call either modifies the goal or it doesn't. If it modifies the goal, the failIfUnchanged := false configuration is unnecessary. If it does not, the simp call is a no-op and should simply be removed. This usually indicates leftover code from trial-and-error proof construction. Please determine exactly which lemmas are required for the rewrite and remove the configuration flag.

Nitpicks:

  1. @[reducible] def vs abbrev: The change to add @[reducible] to isScalarTower_succ_right is the correct approach since it constructs a typeclass instance (IsScalarTower) and needs to be completely transparent to typeclass synthesis and unification. However, the standard and preferred Lean 4 idiom for this is to use abbrev rather than @[reducible] def.
    -- Preferred:
    abbrev isScalarTower_succ_right (l r : ℕ) (h_le : l ≤ r) :=
        instAlgebraTowerConcreteBTF.toIsScalarTower (i:=l) (j:=r) (k:=r+1)
        (h1:=by omega) (h2:=by omega)
📄 **Review for `CompPoly/Fields/Binary/Tower/Concrete/Core.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
The changes in this PR are excellent. Updating the instance-generating definitions (mkAddCommGroupInstance, mkRingInstance, mkDivisionRingInstance, mkFieldInstance) with the @[reducible] attribute is perfectly aligned with Lean 4 best practices, as it ensures typeclass resolution and unification can transparently see through to the underlying operations without getting stuck on the wrapper definitions.

Replacing sequences of simp only with explicit show goal changes (for definitional equalities) and replacing push_neg with push Not (if utilizing a local macro or custom tactic) or using erw for dependent rewrites are all solid proof maintenance improvements that will make the proofs more robust.

📄 **Review for `CompPoly/Fields/Binary/Tower/Concrete/Field.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Fields/Binary/Tower/Equiv.lean`**

Verdict: Needs Minor Revisions

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:

  • The addition of set_option backward.isDefEq.respectTransparency false is generally considered a temporary workaround for performance regressions or timeouts during definitional equality checks resulting from recent Lean 4 updates. While it is acceptable if currently necessary for the file to compile, it is highly recommended to add a brief comment explaining why it was added (e.g., noting which specific declarations or proofs experience timeouts without it). Ideally, the underlying definitional equality issues should be investigated and refactored in the future to remove the need for this backward compatibility flag.
📄 **Review for `CompPoly/Fields/Binary/Tower/Support/Preliminaries.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:

  • push Not vs push_neg: The diff systematically replaces push_neg with push Not (both with and without at). While push Not clearly compiles in your project's environment (likely via a custom macro, alias, or a newer generic push tactic framework), push_neg remains the standard and universally recognized Mathlib idiom for pushing negations inward. Unless you have a specific architectural reason to deprecate push_neg within your codebase, sticking to push_neg is generally preferred for standard Mathlib consistency.
  • Defeq Workaround (respectTransparency): The addition of set_option backward.isDefEq.respectTransparency false in is a valid and pragmatic workaround for unification bottlenecks (which are notoriously common when Lean tries to unfold typeclasses and definitions around AdjoinRoot and PowerBasis). Because you correctly scoped it locally using in, it won't leak to other declarations. However, it is highly recommended to add a short comment above it (e.g., -- Workaround for unifier timeouts/loops with AdjoinRoot) so future maintainers know exactly why this deep kernel flag was temporarily flipped.
📄 **Review for `CompPoly/Multilinear/Basic.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multilinear/Equiv.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/CMvMonomial.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/CMvPolynomial.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/CMvPolynomialEvalLemmas.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

Comments:
This is a great, straightforward change. Replacing Type with Type* properly makes the definitions universe-polymorphic rather than artificially restricting R to Type 0. Excellent work.

📄 **Review for `CompPoly/Multivariate/FinSuccEquiv.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/Lawful.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/MvPolyEquiv/Core.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/MvPolyEquiv/Eval.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  1. Uninferrable Implicit Arguments: In totalDegree_equiv and degreeOf_equiv, the implicit type parameter {S : Type*} and its typeclass instance [CommSemiring S] are completely unused in both the statement and the conclusion of the lemmas. Because S does not appear in the lemma statements, Lean cannot infer it when you attempt to use these lemmas (e.g., via rw), leading to unassigned metavariable errors unless the user explicitly provides it with @. You should remove {S : Type*} [CommSemiring S] from both lemmas.
omit [BEq R] [LawfulBEq R] in
lemma totalDegree_equiv {p : CMvPolynomial n R} :
    p.totalDegree = (fromCMvPolynomial p).totalDegree := by rfl

omit [BEq R] [LawfulBEq R] in
lemma degreeOf_equiv {p : CMvPolynomial n R} :
    p.degreeOf = (fromCMvPolynomial p).degreeOf := by

Nitpicks:

  1. Use Existing Mathlib Lemmas: In your new proof for degreeOf_equiv, the helper lemma hsupp is already in Mathlib as List.toFinset_map. You can simplify the proof by directly rewriting with it:
  ext i
  rw [MvPolynomial.degreeOf_eq_sup]
  unfold CMvPolynomial.degreeOf fromCMvPolynomial
  change ((Lawful.monomials p).toFinset.sup fun m => m.degreeOf i) =
    ((List.map CMvMonomial.toFinsupp (Lawful.monomials p)).toFinset).sup fun m => m i
  rw [List.toFinset_map, Finset.sup_image]
  refine Finset.sup_congr rfl ?_
  intro m hm
  rfl
📄 **Review for `CompPoly/Multivariate/MvPolyEquiv/Instances.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/Operations.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/Rename.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/Restrict.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/Unlawful.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Multivariate/VarsDegrees.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/ToMathlib/MvPolynomial/Equiv.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/ToMathlib/Polynomial/BivariateDegree.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Univariate/Quotient/Core.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `CompPoly/Univariate/Raw/Core.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  • Non-existent/Unidiomatic Tactic (push Not): The diff replaces push_neg with push Not. push Not is not a standard Lean 4 / Mathlib tactic and will likely result in an unknown tactic syntax error. Even if your environment includes a custom macro or alias for push Not, push_neg is the idiomatic, universally understood standard Mathlib tactic for pushing negations through quantifiers and connectives. It should be strongly preferred for readability and maintainability.

    Please revert this line back to its original state:

    · push_neg at h; rcases h with ⟨ i, hi, h ⟩

Nitpicks:
None

📄 **Review for `CompPoly/Univariate/Raw/Proofs.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `lakefile.lean`**

Verdict: Approved

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:
None

Nitpicks:
None

📄 **Review for `tests/CompPolyTests/Univariate/Linear.lean`**

Verdict: Changes Requested

Critical Misformalizations:
None

Lean 4 / Mathlib Issues:

  1. Unknown Attribute @[implicit_reducible]: The attribute @[implicit_reducible] is not a standard Lean 4 attribute (nor does it exist in Mathlib). If you want typeclass synthesis to be able to transparently unfold these definitions, you should use the standard @[reducible] attribute (or use abbrev).

  2. Unidiomatic Equational Rewrites: The use of erw [show X = Y from rfl] is a fragile and highly unidiomatic anti-pattern in Lean 4. When you need to replace a term with a definitionally equal term (usually because simp refuses to unfold a projection or a specific definition), you should use the change tactic.

You can drastically clean up the proofs in nat_lawful_beq_eq like so:

private theorem nat_lawful_beq_eq : @LawfulBEq Nat natBeqEq := by
  letI : BEq Nat := natBeqEq
  refine { rfl := ?_, eq_of_beq := ?_ }
  · intro a; change decide (a = a) = true; simp
  · intro a b h; change decide (a = b) = true at h; simpa using h

And similarly for nat_lawful_beq_succ:

private theorem nat_lawful_beq_succ : @LawfulBEq Nat natBeqSucc := by
  letI : BEq Nat := natBeqSucc
  refine { rfl := ?_, eq_of_beq := ?_ }
  · intro a; change decide (a.succ = a.succ) = true; simp
  · intro a b h
    change decide (a.succ = b.succ) = true at h
    exact Nat.succ.inj <| by simpa using h

This is much more robust and idiomatic than manually forcing an equality rewrite through erw and show ... from rfl.

Nitpicks:
None

quangvdao and others added 5 commits March 31, 2026 21:43
* refactor(multivariate): generalize coefficient universes

* refactor(multivariate): restore ExtTreeMap lemmas dependency

* style(multivariate): clean review nits

* fix(multivariate): adapt universe branch to Lean 4.29
namespace CPolynomial

private def natBeqEq : BEq Nat := ⟨fun a b => decide (a = b)⟩
@[reducible] private def natBeqEq : BEq Nat := ⟨fun a b => decide (a = b)⟩
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that these @[reducible] tags are for definitions whose codomains are typeclasses. a new Lean compiler warning. @[reducible] is stronger than @[implicit_reducible] - if we run into performance issues we may want to replace @[reducible] instances with @[implicit_reducible]

Comment on lines +52 to +56
theorem ENNReal.mul_inv_rev_ENNReal {a b : ℕ} (ha : a ≠ 0) :
((a : ENNReal)⁻¹ * (b : ENNReal)⁻¹) = ((a : ENNReal) * (b : ENNReal))⁻¹ :=
(ENNReal.mul_inv
(Or.inl (Nat.cast_ne_zero.mpr ha))
(Or.inl (ENNReal.natCast_ne_top a))).symm
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just want to flag this to be checked as an okay change @quangvdao - the removed argument was unused

instance : Field BTF₃ := instFieldConcrete
instance : DecidableEq BTF₃ := (inferInstance : DecidableEq (ConcreteBTField 3))
instance : Fintype BTF₃ := (inferInstance : Fintype (ConcreteBTField 3))
noncomputable instance : Fintype BTF₃ := (inferInstance : Fintype (ConcreteBTField 3))
Copy link
Copy Markdown
Collaborator Author

@dhsorens dhsorens Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a problem that this is now noncomputable do you think @quangvdao ?

Comment thread CompPoly/Bivariate/ToPoly.lean Outdated
Comment on lines 52 to 55
noncomputable def ofPoly {R : Type*} [BEq R] [LawfulBEq R] [Nontrivial R] [Semiring R]
[DecidableEq R] (p : R[X][Y]) : CBivariate R :=
(p.support).sum (fun j ↦
let cj := p.coeff j
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this had to be marked noncomputable due to changes in 4.29.0 here. bc ofPoly is used for proofs and not computation, I think this is fine, though if we can avoid it I wouldn't mind finding a way to avoid it

Copy link
Copy Markdown
Collaborator Author

@dhsorens dhsorens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quangvdao if you could have a look at this PR and approve it I would appreciate it. I've looked carefully thru all the changes and am happy with them (see comments)

@dhsorens dhsorens changed the title feat: bump lean version feat: bump lean version to 4.29.0 Apr 13, 2026
@quangvdao
Copy link
Copy Markdown
Collaborator

I have changes that can address these regressions. Let me push them then we can decide whether we should use these fixes or not?

The core issue is that the Semiring instance for Polynomial R is now explicitly marked as noncomputable in mathlib

@dhsorens
Copy link
Copy Markdown
Collaborator Author

dhsorens commented Apr 14, 2026

nice, I like all these @quangvdao, they resolve all the uneasy feelings I was having on earlier changes. going to go ahead and merge this

@dhsorens
Copy link
Copy Markdown
Collaborator Author

nb the check not passing is the PR review, which was canceled after 4 mins. this failing check does not affect the integrity of the code

@dhsorens dhsorens merged commit ff7e2ff into master Apr 14, 2026
4 of 5 checks passed
@dhsorens dhsorens deleted the dhsorens/bump_to_4.29.0-rc6 branch April 14, 2026 08:21
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.

2 participants