From baa71faf87812449640c64bfd7b1eaf553669044 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Tue, 24 Mar 2026 06:31:56 +0000 Subject: [PATCH 001/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13086 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 73680c6061faeb..7f92087e269a9a 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "81c23850e7c2b5f82ed16e3569def2fe0f52e1c9", + "rev": "1eec0f14788781254d00b4ebb9628d3d1e322aa0", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13086", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 1de37822c9c419..fd3bb7a2e3f178 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13086" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.92-pre1" -- ProofWidgets should always be pinned to a specific version diff --git a/lean-toolchain b/lean-toolchain index de7cb2ba9bc582..93d8de5b14c947 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-24 +leanprover/lean4-pr-releases:pr-release-13086-4bf0162 From cbf62a73eed9c13f1266afbf60dbf0ae53a4316f Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 24 Mar 2026 06:47:26 +0000 Subject: [PATCH 002/116] feat: add `Lean.Grind.PowIdentity` instance for finite fields This provides a `PowIdentity K (Fintype.card K)` instance for any finite field, based on `FiniteField.pow_card` (Fermat's little theorem). This allows the `grind` ring solver to reduce high-degree polynomials over finite fields. Co-Authored-By: Claude Opus 4.6 (1M context) --- Mathlib/FieldTheory/Finite/Basic.lean | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Mathlib/FieldTheory/Finite/Basic.lean b/Mathlib/FieldTheory/Finite/Basic.lean index e55699cdd5960a..840047198a8c1e 100644 --- a/Mathlib/FieldTheory/Finite/Basic.lean +++ b/Mathlib/FieldTheory/Finite/Basic.lean @@ -239,6 +239,16 @@ theorem pow_card_pow (n : ℕ) (a : K) : a ^ q ^ n = a := by end +section + +variable [Field K] [Fintype K] + +open Lean in +instance instGrindPowIdentity : Grind.PowIdentity K (Fintype.card K) where + pow_eq := pow_card + +end + variable (K) [Field K] [Fintype K] /-- The cardinality `q` is a power of the characteristic of `K`. -/ From f420f53631e699aad89e365929c6d0c6e325f331 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 26 Mar 2026 11:10:53 +0000 Subject: [PATCH 003/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13132 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 73680c6061faeb..939fcc3af15339 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "81c23850e7c2b5f82ed16e3569def2fe0f52e1c9", + "rev": "147d8a6d5692649259bfa3f8c5ea6a9385aeac88", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13132", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 1de37822c9c419..a52a5fdfd39591 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13132" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.92-pre1" -- ProofWidgets should always be pinned to a specific version diff --git a/lean-toolchain b/lean-toolchain index de7cb2ba9bc582..bb75ca220ada74 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-24 +leanprover/lean4-pr-releases:pr-release-13132-5594b54 From 28dc0ab2d625951424b570d7c7430d32d9e142ae Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 26 Mar 2026 13:34:51 +0000 Subject: [PATCH 004/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13132 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 939fcc3af15339..233d9ebd62a56d 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "147d8a6d5692649259bfa3f8c5ea6a9385aeac88", + "rev": "943cd21dabe73116cc96d7ec7e0242deaa6dc0cd", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13132", diff --git a/lean-toolchain b/lean-toolchain index bb75ca220ada74..9020076871b042 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13132-5594b54 +leanprover/lean4-pr-releases:pr-release-13132-2f8db4b From d7aee7edce0743c7500b1de8cc72a05564d8c37e Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 26 Mar 2026 14:18:43 +0000 Subject: [PATCH 005/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13132 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 233d9ebd62a56d..d47be9b382b89e 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "943cd21dabe73116cc96d7ec7e0242deaa6dc0cd", + "rev": "257610310763a697d819165a58f209a63a512929", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13132", diff --git a/lean-toolchain b/lean-toolchain index 9020076871b042..363e30b7f1ae7f 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13132-2f8db4b +leanprover/lean4-pr-releases:pr-release-13132-8479ef4 From deb87e3dd5774ef3467b8cbd52cf88dabf6f16bb Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 1 Apr 2026 00:28:04 +0000 Subject: [PATCH 006/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13223 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index e435c475740f43..c668987c11650a 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "81df60304bb26e3e1efc6ee9b07fb387dac19108", + "rev": "3d5a3aaab3de9235f10521681974f5043f072f09", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13223", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 8fa4ac638fc9fb..da7aa856d361a7 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13223" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "nightly-testing" diff --git a/lean-toolchain b/lean-toolchain index 3911411c451a70..30316b1566a727 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-31 +leanprover/lean4-pr-releases:pr-release-13223-f92b7f3 From b465a60109aafff3a6fb36128332d23780a9ef49 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 1 Apr 2026 11:06:57 +0000 Subject: [PATCH 007/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13229 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index c6f5dc8152dce1..bd012465e8def1 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "da8a068708756fcc8aa953efc0dd95094b73a934", + "rev": "c0286d9a17937d9e498f0bb3c499d97eceb05ba9", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13229", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 1de37822c9c419..ba4571d0983075 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13229" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.92-pre1" -- ProofWidgets should always be pinned to a specific version diff --git a/lean-toolchain b/lean-toolchain index b222dcbd6a2d8b..5f005db8ca8aa7 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-25 +leanprover/lean4-pr-releases:pr-release-13229-f76c89f From f841c8f402a15bf6f36f482cb7aa95dcdc7ae90a Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Tue, 31 Mar 2026 20:30:03 +0000 Subject: [PATCH 008/116] chore: indent tactic blocks after `by` and `decreasing_by` Adapt to leanprover/lean4#13217 which requires indented tactic sequences after `by` and `decreasing_by`. Co-Authored-By: Claude Opus 4.6 --- Mathlib/RingTheory/MvPolynomial/Groebner.lean | 14 +++++++------- .../RingTheory/Valuation/ValuativeRel/Basic.lean | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Mathlib/RingTheory/MvPolynomial/Groebner.lean b/Mathlib/RingTheory/MvPolynomial/Groebner.lean index c6abb237cd5a93..2be50c65a7fcde 100644 --- a/Mathlib/RingTheory/MvPolynomial/Groebner.lean +++ b/Mathlib/RingTheory/MvPolynomial/Groebner.lean @@ -213,13 +213,13 @@ theorem div {ι : Type*} {b : ι → MvPolynomial σ R} termination_by WellFounded.wrap ((isWellFounded_iff m.syn fun x x_1 ↦ x < x_1).mp m.wf) (m.toSyn (m.degree f)) decreasing_by -· exact deg_reduce -· apply degree_sub_LTerm_lt - intro hf0 - apply hf'0 - simp only [subLTerm, sub_eq_zero] - nth_rewrite 1 [eq_C_of_degree_eq_zero hf0, hf0] - simp + · exact deg_reduce + · apply degree_sub_LTerm_lt + intro hf0 + apply hf'0 + simp only [subLTerm, sub_eq_zero] + nth_rewrite 1 [eq_C_of_degree_eq_zero hf0, hf0] + simp /-! Module doc as workaround for a parser error that prevents using `set_option` diff --git a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean index 162e0f42544bc5..5c424ace955138 100644 --- a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean +++ b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean @@ -1214,10 +1214,10 @@ theorem orderMonoidIso_embed [v.Compatible] {Γ' : Type*} [LinearOrderedCommGrou (w : Valuation R Γ') [w.Compatible] (x : ValueGroupWithZero R) (h : w.IsEquiv v) : h.orderMonoidIso (embed w x) = embed v x := by -simp only [embed, ← Valuation.restrict_def, coe_mk, ZeroHom.coe_mk] -induction x using ValueGroupWithZero.ind with -| mk r s => - simp + simp only [embed, ← Valuation.restrict_def, coe_mk, ZeroHom.coe_mk] + induction x using ValueGroupWithZero.ind with + | mk r s => + simp /-- If a valuation `v` is compatible with the valuative relation, then `ValueGroupWithZero R` is isomorphic to the image group (with zero) of `v` as an ordered group with zero. -/ From b779d444a383d24980a644ea05c9cc14cf220ab3 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Tue, 31 Mar 2026 21:42:55 +0000 Subject: [PATCH 009/116] chore: indent tactic block in EmptyLine test Adapt to leanprover/lean4#13217. Co-Authored-By: Claude Opus 4.6 --- MathlibTest/EmptyLine.lean | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MathlibTest/EmptyLine.lean b/MathlibTest/EmptyLine.lean index 41a11e48d8e824..637a9d5ad5b0e5 100644 --- a/MathlibTest/EmptyLine.lean +++ b/MathlibTest/EmptyLine.lean @@ -159,31 +159,31 @@ example : True := by -- The following empty line is not reported, since the com warning: Please, write a comment here or remove this line, but do not place empty lines within commands! Context: ↓ - ⏎example : True := by⏎⏎-- Here I start⏎⏎ + ⏎example : True := by⏎⏎ -- Here I start⏎⏎ Note: This linter can be disabled with `set_option linter.style.emptyLine false` --- warning: Please, write a comment here or remove this line, but do not place empty lines within commands! Context: - ↓ - ⏎--stop⏎⏎trivial⏎⏎ + ↓ + ⏎ --stop⏎⏎ trivial⏎⏎ Note: This linter can be disabled with `set_option linter.style.emptyLine false` -/ #guard_msgs in example : True := by --- Here I start + -- Here I start -/- + /- --/ + -/ ---stop + --stop -trivial -- also a comment + trivial -- also a comment --- with a line break + -- with a line break -- Check that `where` fields allow empty lines. structure F where From 61a6a0f78945b722e3142fc7e20959c2e6af76d1 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Wed, 1 Apr 2026 12:32:02 +0000 Subject: [PATCH 010/116] chore: indent expression continuations at column 0 Co-Authored-By: Claude Opus 4.6 --- Mathlib/Algebra/Module/Submodule/LinearMap.lean | 2 +- Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean | 2 +- Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Mathlib/Algebra/Module/Submodule/LinearMap.lean b/Mathlib/Algebra/Module/Submodule/LinearMap.lean index 68d86fc001983e..5654a2b9333ef0 100644 --- a/Mathlib/Algebra/Module/Submodule/LinearMap.lean +++ b/Mathlib/Algebra/Module/Submodule/LinearMap.lean @@ -177,7 +177,7 @@ theorem subtype_comp_codRestrict (p : Submodule R₂ M₂) (h : ∀ b, f b ∈ p section variable {M₂' : Type*} [AddCommMonoid M₂'] [Module R₂ M₂'] -(p : M₂' →ₗ[R₂] M₂) (hp : Injective p) (h : ∀ c, f c ∈ range p) + (p : M₂' →ₗ[R₂] M₂) (hp : Injective p) (h : ∀ c, f c ∈ range p) /-- A linear map `f : M → M₂` whose values lie in the image of an injective linear map `p : M₂' → M₂` admits a unique lift to a linear map `M → M₂'`. -/ diff --git a/Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean b/Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean index dd08bd9caf1a31..495ccb223bb43c 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean @@ -269,7 +269,7 @@ end CompleteSpace section Pi variable {ι : Type*} {X : α → Type*} [∀ x, CommMonoid (X x)] [∀ x, TopologicalSpace (X x)] -{L : SummationFilter ι} + {L : SummationFilter ι} @[to_additive] theorem Pi.hasProd {f : ι → ∀ x, X x} {g : ∀ x, X x} : diff --git a/Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean b/Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean index 226f4e4d1ab33f..dbc911b2b241b8 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/GroupCompletion.lean @@ -17,7 +17,7 @@ public section open UniformSpace.Completion variable {α β : Type*} [AddCommGroup α] [UniformSpace α] [IsUniformAddGroup α] -{L : SummationFilter β} + {L : SummationFilter β} /-- A function `f` has a sum in a uniform additive group `α` if and only if it has that sum in the completion of `α`. -/ From e714425c284fd251369c2199cbc57a83f9f0b9ac Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Wed, 1 Apr 2026 13:14:06 +0000 Subject: [PATCH 011/116] chore: indent expression continuations at column 0 Co-Authored-By: Claude Opus 4.6 --- Mathlib/Analysis/Analytic/ChangeOrigin.lean | 2 +- Mathlib/Analysis/Normed/Module/Ray.lean | 2 +- Mathlib/Analysis/Normed/Operator/Basic.lean | 2 +- .../Geometry/Manifold/Algebra/LieGroup.lean | 2 +- Mathlib/MeasureTheory/Measure/AddContent.lean | 2 +- .../VectorMeasure/AddContent.lean | 2 +- Mathlib/RingTheory/Ideal/Maps.lean | 24 +++++++++---------- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Mathlib/Analysis/Analytic/ChangeOrigin.lean b/Mathlib/Analysis/Analytic/ChangeOrigin.lean index 19d6228da2c365..b95041cfe9ed39 100644 --- a/Mathlib/Analysis/Analytic/ChangeOrigin.lean +++ b/Mathlib/Analysis/Analytic/ChangeOrigin.lean @@ -43,7 +43,7 @@ open scoped NNReal ENNReal Topology open Filter Set variable {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] -[NormedAddCommGroup F] [NormedSpace 𝕜 F] + [NormedAddCommGroup F] [NormedSpace 𝕜 F] namespace FormalMultilinearSeries diff --git a/Mathlib/Analysis/Normed/Module/Ray.lean b/Mathlib/Analysis/Normed/Module/Ray.lean index ceb5c4bad4b473..e64bc5f6d23f02 100644 --- a/Mathlib/Analysis/Normed/Module/Ray.lean +++ b/Mathlib/Analysis/Normed/Module/Ray.lean @@ -22,7 +22,7 @@ public section open Real variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} -[NormedAddCommGroup F] [NormedSpace ℝ F] + [NormedAddCommGroup F] [NormedSpace ℝ F] namespace SameRay diff --git a/Mathlib/Analysis/Normed/Operator/Basic.lean b/Mathlib/Analysis/Normed/Operator/Basic.lean index 45fe5b39d6fd4d..d248d0f8e9c2df 100644 --- a/Mathlib/Analysis/Normed/Operator/Basic.lean +++ b/Mathlib/Analysis/Normed/Operator/Basic.lean @@ -79,7 +79,7 @@ theorem closedBall_subset_range_iff_surjective [RingHomSurjective σ₁₂] {f : by simp_all⟩ variable {F' 𝓕' : Type*} [NormedAddCommGroup F'] [NormedSpace ℝ F'] [Nontrivial F'] -{τ : 𝕜 →+* ℝ} [FunLike 𝓕' E F'] [SemilinearMapClass 𝓕' τ E F'] + {τ : 𝕜 →+* ℝ} [FunLike 𝓕' E F'] [SemilinearMapClass 𝓕' τ E F'] theorem sphere_subset_range_iff_surjective [RingHomSurjective τ] {f : 𝓕'} {x : F'} {r : ℝ} (hr : 0 < r) : sphere x r ⊆ Set.range f ↔ (⇑f).Surjective := by diff --git a/Mathlib/Geometry/Manifold/Algebra/LieGroup.lean b/Mathlib/Geometry/Manifold/Algebra/LieGroup.lean index 0a996e925745b1..f3f9d6131ba33e 100644 --- a/Mathlib/Geometry/Manifold/Algebra/LieGroup.lean +++ b/Mathlib/Geometry/Manifold/Algebra/LieGroup.lean @@ -296,7 +296,7 @@ functions `f : M → N` is `C^n` whenever the denominator is non-zero. section Div variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {n : WithTop ℕ∞} -{H : Type*} [TopologicalSpace H] {E : Type*} + {H : Type*} [TopologicalSpace H] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {I : ModelWithCorners 𝕜 E H} {G : Type*} [TopologicalSpace G] [ChartedSpace H G] [GroupWithZero G] [ContMDiffInv₀ I n G] [ContMDiffMul I n G] diff --git a/Mathlib/MeasureTheory/Measure/AddContent.lean b/Mathlib/MeasureTheory/Measure/AddContent.lean index ad79b077cc3151..e66aca913c596c 100644 --- a/Mathlib/MeasureTheory/Measure/AddContent.lean +++ b/Mathlib/MeasureTheory/Measure/AddContent.lean @@ -68,7 +68,7 @@ open scoped ENNReal Topology Function namespace MeasureTheory variable {α : Type*} {C : Set (Set α)} {s t : Set α} {I : Finset (Set α)} -{G : Type*} [AddCommMonoid G] + {G : Type*} [AddCommMonoid G] variable (G) in /-- An additive content is a set function with value 0 at the empty set which is finitely additive diff --git a/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean b/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean index b296f2ba2d867e..1b2399ac8c7fd0 100644 --- a/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean +++ b/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean @@ -27,7 +27,7 @@ open scoped symmDiff namespace MeasureTheory.VectorMeasure variable {α : Type*} {hα : MeasurableSpace α} {E : Type*} [NormedAddCommGroup E] -[CompleteSpace E] {μ : Measure α} + [CompleteSpace E] {μ : Measure α} /-- A finitely additive vector measure which is dominated by a finite positive measure is in fact countably additive. -/ diff --git a/Mathlib/RingTheory/Ideal/Maps.lean b/Mathlib/RingTheory/Ideal/Maps.lean index 8cde123aca73ac..84672e45cd0ccc 100644 --- a/Mathlib/RingTheory/Ideal/Maps.lean +++ b/Mathlib/RingTheory/Ideal/Maps.lean @@ -421,18 +421,18 @@ If infinitely many of the `Rᵢ` are nontrivial, then there exists an ideal of ` is not of the form `Πᵢ Iᵢ`, namely the ideal of finitely supported elements of `Πᵢ Rᵢ` (it is also not a principal ideal).) -/ @[simps!] def piOrderIso [Finite ι] : Ideal (Π i, R i) ≃o Π i, Ideal (R i) := .symm -{ toFun := pi - invFun I i := I.map (Pi.evalRingHom R i) - left_inv _ := funext map_evalRingHom_pi - right_inv I := by - ext r - simp_rw [mem_pi, mem_map_iff_of_surjective (Pi.evalRingHom R _) (Function.surjective_eval _)] - refine ⟨(fun ⟨r', hr'⟩ ↦ ?_) ∘ Classical.skolem.mp, fun hr i ↦ ⟨r, hr, rfl⟩⟩ - have := Fintype.ofFinite ι - classical rw [show r = ∑ i, Pi.single i 1 * r' i from funext fun i ↦ by - rw [← (hr' _).2, Finset.sum_apply, Fintype.sum_eq_single i fun j ne ↦ by simp [ne]]; simp] - exact sum_mem fun i _ ↦ I.mul_mem_left _ (hr' i).1 - map_rel_iff' := pi_le_pi_iff } + { toFun := pi + invFun I i := I.map (Pi.evalRingHom R i) + left_inv _ := funext map_evalRingHom_pi + right_inv I := by + ext r + simp_rw [mem_pi, mem_map_iff_of_surjective (Pi.evalRingHom R _) (Function.surjective_eval _)] + refine ⟨(fun ⟨r', hr'⟩ ↦ ?_) ∘ Classical.skolem.mp, fun hr i ↦ ⟨r, hr, rfl⟩⟩ + have := Fintype.ofFinite ι + classical rw [show r = ∑ i, Pi.single i 1 * r' i from funext fun i ↦ by + rw [← (hr' _).2, Finset.sum_apply, Fintype.sum_eq_single i fun j ne ↦ by simp [ne]]; simp] + exact sum_mem fun i _ ↦ I.mul_mem_left _ (hr' i).1 + map_rel_iff' := pi_le_pi_iff } instance [Finite ι] [∀ i, IsPrincipalIdealRing (R i)] : IsPrincipalIdealRing (Π i, R i) where principal I := by From 7845a1a8a89d4866c945495019d281ecbe50c454 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 1 Apr 2026 18:40:47 +0000 Subject: [PATCH 012/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13229 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index bd012465e8def1..7ac1d0e130f7f7 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "c0286d9a17937d9e498f0bb3c499d97eceb05ba9", + "rev": "645e49d5f6a3b43d21cbdbd0484181cecc085e6e", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13229", diff --git a/lean-toolchain b/lean-toolchain index 5f005db8ca8aa7..1ea9ba3f8c011f 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13229-f76c89f +leanprover/lean4-pr-releases:pr-release-13229-bc5b0e2 From 7eff8163b61dac77cb19660fa7b4354eddabe274 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 1 Apr 2026 20:26:29 +0000 Subject: [PATCH 013/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13223 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index c668987c11650a..5ab4eaacb44520 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "3d5a3aaab3de9235f10521681974f5043f072f09", + "rev": "a2574fe95a9b75fc8a5704154115a2a1b1772fcb", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13223", diff --git a/lean-toolchain b/lean-toolchain index 30316b1566a727..5079d14de1510d 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13223-f92b7f3 +leanprover/lean4-pr-releases:pr-release-13223-4d67b4b From e533fdeaf038eb1c7a142de54952aaa4f13a7b86 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 1 Apr 2026 20:54:17 +0000 Subject: [PATCH 014/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13229 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 7ac1d0e130f7f7..4968304ce962ff 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "645e49d5f6a3b43d21cbdbd0484181cecc085e6e", + "rev": "21b86a5d3de7134e36ad9372b10db4ebe6537191", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13229", diff --git a/lean-toolchain b/lean-toolchain index 1ea9ba3f8c011f..69c3d1e0bc8491 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13229-bc5b0e2 +leanprover/lean4-pr-releases:pr-release-13229-626213b From 37ec501598b2e669c96887b98772955a401c8df2 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 1 Apr 2026 21:51:50 +0000 Subject: [PATCH 015/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13229 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 4968304ce962ff..b21529f793d4ee 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "21b86a5d3de7134e36ad9372b10db4ebe6537191", + "rev": "6c58796406bf6d10afc8514df1595148a731926f", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13229", diff --git a/lean-toolchain b/lean-toolchain index 69c3d1e0bc8491..916fc0e7235449 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13229-626213b +leanprover/lean4-pr-releases:pr-release-13229-0fc6e49 From 3602bc00f4e3fb51998e120ca7d3ff64568e0150 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 2 Apr 2026 09:47:36 +0000 Subject: [PATCH 016/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13229 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index b21529f793d4ee..089d82ac330bf7 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "6c58796406bf6d10afc8514df1595148a731926f", + "rev": "7c36ea46afccf4a11da46b6faae490f5cf4a3043", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13229", diff --git a/lean-toolchain b/lean-toolchain index 916fc0e7235449..b6747cfdc39309 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13229-0fc6e49 +leanprover/lean4-pr-releases:pr-release-13229-aa77588 From ce608e72cea947a87d76f86f5583c60d3f2a3853 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 2 Apr 2026 12:30:02 +0000 Subject: [PATCH 017/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13223 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 3a486d56d4b24e..fc6693b09cc150 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "9e1475e92dfb360d79e99735fdae80e5831aa6c6", + "rev": "4b683d8a24a7cac230de80594e886e5457abc842", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13223", diff --git a/lean-toolchain b/lean-toolchain index 16cbaa6b60163f..34303e5e753d6e 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13223-59d9492 +leanprover/lean4-pr-releases:pr-release-13223-e72d42c From f8c6bd6ecd104f93ca754ca7e5a7de6f7af11698 Mon Sep 17 00:00:00 2001 From: Wojciech Rozowski Date: Thu, 2 Apr 2026 14:16:34 +0000 Subject: [PATCH 018/116] chore: fix linter tests --- MathlibTest/LintStyle.lean | 4 ---- MathlibTest/globalAttributeIn.lean | 37 ++++-------------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/MathlibTest/LintStyle.lean b/MathlibTest/LintStyle.lean index 28ac686c00c5ce..6783965170584b 100644 --- a/MathlibTest/LintStyle.lean +++ b/MathlibTest/LintStyle.lean @@ -201,7 +201,6 @@ set_option linter.style.cdot true set_option allowUnsafeReducibility true in attribute [instance_reducible] Int.add -set_option linter.globalAttributeIn false in /-- warning: Please, use '·' (typed as `\.`) instead of '.' as 'cdot'. @@ -216,7 +215,6 @@ warning: Please, use '·' (typed as `\.`) instead of '.' as 'cdot'. Note: This linter can be disabled with `set_option linter.style.cdot false` -/ #guard_msgs in -attribute [instance] Int.add in instance : Inhabited Nat where default := by . have := 0 @@ -276,7 +274,6 @@ example : True := by end cdotLinter set_option linter.style.dollarSyntax true -set_option linter.globalAttributeIn false in /-- warning: Please use '<|' instead of '$' for the pipe operator. @@ -287,7 +284,6 @@ warning: Please use '<|' instead of '$' for the pipe operator. Note: This linter can be disabled with `set_option linter.style.dollarSyntax false` -/ #guard_msgs in -attribute [instance] Int.add in instance (f g : Nat → Nat) : Inhabited Nat where default := by · have := 0 diff --git a/MathlibTest/globalAttributeIn.lean b/MathlibTest/globalAttributeIn.lean index 37f273b69bc93b..a61961950ef7e2 100644 --- a/MathlibTest/globalAttributeIn.lean +++ b/MathlibTest/globalAttributeIn.lean @@ -8,33 +8,14 @@ import Mathlib.Tactic.Linter.GlobalAttributeIn /-! Tests for the `globalAttributeIn` linter. -/ --- Test disabling the linter. -set_option linter.globalAttributeIn false - -- After https://github.com/leanprover/lean4/pull/12263, -- we need to add `instance_reducible` before we can add `instance` to `Int.add`. set_option allowUnsafeReducibility true in attribute [instance_reducible] Int.add -set_option autoImplicit false in -attribute [instance] Int.add in -instance : Inhabited Int where - default := 0 - -set_option linter.globalAttributeIn true - -set_option linter.globalAttributeIn false in -attribute [instance] Int.add in -instance : Inhabited Int where - default := 0 - --- Global instances with `in`, are linted, as they are a footgun. - /-- -warning: Despite the `in`, the attribute 'instance 1100' is added globally to 'Int.add' +error: Despite the `in`, the attribute instance 1100 is added globally to Int.add please remove the `in` or make this a `local instance 1100` - -Note: This linter can be disabled with `set_option linter.globalAttributeIn false` -/ #guard_msgs in set_option autoImplicit false in @@ -44,10 +25,8 @@ instance : Inhabited Int where default := 0 /-- -warning: Despite the `in`, the attribute 'instance' is added globally to 'Int.add' +error: Despite the `in`, the attribute instance is added globally to Int.add please remove the `in` or make this a `local instance` - -Note: This linter can be disabled with `set_option linter.globalAttributeIn false` -/ #guard_msgs in attribute [instance] Int.add in @@ -55,10 +34,8 @@ instance : Inhabited Int where default := 0 /-- -warning: Despite the `in`, the attribute 'simp' is added globally to 'Int.add' +error: Despite the `in`, the attribute simp is added globally to Int.add please remove the `in` or make this a `local simp` - -Note: This linter can be disabled with `set_option linter.globalAttributeIn false` -/ #guard_msgs in attribute [simp] Int.add in @@ -73,15 +50,11 @@ namespace X theorem foo (x y : Nat) : x = y := sorry /-- -warning: Despite the `in`, the attribute 'simp' is added globally to 'foo' +error: Despite the `in`, the attribute simp is added globally to foo please remove the `in` or make this a `local simp` - -Note: This linter can be disabled with `set_option linter.globalAttributeIn false` --- -warning: Despite the `in`, the attribute 'ext' is added globally to 'foo' +error: Despite the `in`, the attribute ext is added globally to foo please remove the `in` or make this a `local ext` - -Note: This linter can be disabled with `set_option linter.globalAttributeIn false` -/ #guard_msgs in attribute [simp, local simp, ext, scoped instance, -simp, -ext] foo in From 8d08e270ece92c1a812fbbca183872691c19f542 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 14:35:06 +1000 Subject: [PATCH 019/116] lake update --- lake-manifest.json | 8 ++++---- lakefile.lean | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index dfad1f83a0b0fd..ca0e4c0d66b879 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -45,20 +45,20 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "f74c7555aaa94eadd7b7bff9170f7983f92aac21", + "rev": "ad416ddf6cc9d5b1c00eaf04a48e703538132760", "name": "aesop", "manifestFile": "lake-manifest.json", - "inputRev": "v4.30.0-rc1", + "inputRev": "nightly-testing", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/quote4", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "7aa86cb20b8458748dc24d55dab2d7ea01161057", + "rev": "bee778191c7fbea31864ecfe1809b8837626aba0", "name": "Qq", "manifestFile": "lake-manifest.json", - "inputRev": "v4.30.0-rc1", + "inputRev": "nightly-testing", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/batteries", diff --git a/lakefile.lean b/lakefile.lean index e22e0ef045be20..5f11ec894a69ad 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -7,8 +7,8 @@ open Lake DSL -/ require "leanprover-community" / "batteries" @ git "v4.30.0-rc1" -require "leanprover-community" / "Qq" @ git "v4.30.0-rc1" -require "leanprover-community" / "aesop" @ git "v4.30.0-rc1" +require "leanprover-community" / "Qq" @ git "nightly-testing" +require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" with NameMap.empty.insert `errorOnBuild "ProofWidgets failed to reuse pre-built JS code. \ From 940f396db97c9c3cd13cc116ab54384a3212a5d3 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 14:36:04 +1000 Subject: [PATCH 020/116] fix hash command linter --- Mathlib/Tactic/Linter/HashCommandLinter.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Tactic/Linter/HashCommandLinter.lean b/Mathlib/Tactic/Linter/HashCommandLinter.lean index 3f2c8f926bef0b..c8b650c5c99d36 100644 --- a/Mathlib/Tactic/Linter/HashCommandLinter.lean +++ b/Mathlib/Tactic/Linter/HashCommandLinter.lean @@ -49,7 +49,7 @@ Intended to be used in the `hashCommand` linter, where we want to enter `set_opt private partial def withSetOptionIn' (cmd : CommandElab) : CommandElab := fun stx => do if stx.getKind == ``Lean.Parser.Command.in then if stx[0].getKind == ``Lean.Parser.Command.set_option then - let opts ← Elab.elabSetOption stx[0][1] stx[0][3] + let (opts, _) ← Elab.elabSetOption stx[0][1] stx[0][3] withScope (fun scope => { scope with opts }) do withSetOptionIn' cmd stx[2] else From 12400c59a92b6fbfe39d0f04b6056428bcfea3d8 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 14:47:54 +1000 Subject: [PATCH 021/116] fix bad merge --- Mathlib/Computability/Partrec.lean | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Mathlib/Computability/Partrec.lean b/Mathlib/Computability/Partrec.lean index 5e1ef4c6b9fcfb..c8363e6f90b16b 100644 --- a/Mathlib/Computability/Partrec.lean +++ b/Mathlib/Computability/Partrec.lean @@ -718,9 +718,6 @@ theorem fix_aux {α σ} (f : α →. σ ⊕ α) (a : α) (b : σ) : b ∈ PFun.fix f a := by intro F; refine ⟨fun h => ?_, fun h => ?_⟩ · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩ - #adaptation_note /-- Before leanprover/lean4#13166, the proof from here to the end of the - first branch was: - ``` have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by intro m a' am ba induction m generalizing a' with simp [F] at am @@ -754,9 +751,9 @@ theorem fix_aux {α σ} (f : α →. σ ⊕ α) (a : α) (b : σ) : · simpa [F] using Or.inr ⟨_, hk, h₂⟩ · rwa [le_antisymm (Nat.le_of_lt_succ mk) km] · rcases IH _ am₃ k.succ (by simpa [F] using ⟨_, hk, am₃⟩) with ⟨n, hn₁, hn₂⟩ - #adaptation_note /-- After leanprover/lean4#13166 which arrived in nightly-2026-03-28: - This `clear_value` used to not be necessary. - -/ + #adaptation_note /-- Before https://github.com/leanprover/lean4/pull/13166 + (replacing grind's canonicalizer with a type-directed normalizer), + the `clear_value F` was not required here. -/ clear_value F grind From 89270ab2e3ca65c4b99cb3a658159630b6cc9d13 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 15:14:26 +1000 Subject: [PATCH 022/116] fixes --- .../Analysis/SpecialFunctions/Pow/NthRootLemmas.lean | 11 +++++++++++ Mathlib/NumberTheory/Padics/MahlerBasis.lean | 4 ++-- Mathlib/RingTheory/Smooth/Local.lean | 9 ++++++++- Mathlib/RingTheory/Spectrum/Prime/FreeLocus.lean | 4 +++- Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean | 8 ++++++-- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Mathlib/Analysis/SpecialFunctions/Pow/NthRootLemmas.lean b/Mathlib/Analysis/SpecialFunctions/Pow/NthRootLemmas.lean index eac12117d3ea82..2f2b7c12bcd278 100644 --- a/Mathlib/Analysis/SpecialFunctions/Pow/NthRootLemmas.lean +++ b/Mathlib/Analysis/SpecialFunctions/Pow/NthRootLemmas.lean @@ -64,9 +64,20 @@ private theorem nthRoot.lt_pow_go_succ_aux0 (hb : b ≠ 0) : rw [Nat.le_div_iff_mul_le (by positivity), Nat.mul_comm, ← Nat.add_mul_div_right _ _ (by positivity), Nat.le_div_iff_mul_le (by positivity)] + #adaptation_note /-- Prior to nightly-2026-04-06, this was + ``` have := (Commute.all (b : ℤ) (a - b)).pow_add_mul_le_add_pow_of_sq_nonneg (by positivity) (sq_nonneg _) (sq_nonneg _) (by grind) (n + 1) grind + ``` + -/ + zify + have h := pow_add_mul_le_add_pow_of_sq_nonneg (a := (b : ℤ)) (b := (a : ℤ) - b) + (ha := by positivity) (Hsq := by positivity) (Hsq' := by positivity) (H := by omega) + (n := n + 1) + rw [← sub_nonneg] at h ⊢ + convert h using 1 + rw [pow_succ]; push_cast; ring1 private theorem nthRoot.always_exists (n a : ℕ) : ∃ c, c ^ (n + 1) ≤ a ∧ a < (c + 1) ^ (n + 1) := by diff --git a/Mathlib/NumberTheory/Padics/MahlerBasis.lean b/Mathlib/NumberTheory/Padics/MahlerBasis.lean index a0916015af130c..16a262245746ed 100644 --- a/Mathlib/NumberTheory/Padics/MahlerBasis.lean +++ b/Mathlib/NumberTheory/Padics/MahlerBasis.lean @@ -176,12 +176,12 @@ private lemma bojanic_mahler_step2 {f : C(ℤ_[p], E)} {s t : ℕ} refine (nnnorm_smul_le _ _).trans <| mul_le_mul_of_nonneg_right ?_ (by simp only [zero_le]) -- remains to show norm of binomial coeff is `≤ p⁻¹` rw [mem_range] at hi - have : 0 < (p ^ t).choose (i + 1) := Nat.choose_pos (by lia) + have : 0 < (p ^ t).choose (i + 1) := Nat.choose_pos (by omega) rw [← zpow_neg_one, ← coe_le_coe, coe_nnnorm, PadicInt.norm_eq_zpow_neg_valuation (mod_cast this.ne'), coe_zpow, NNReal.coe_natCast, zpow_le_zpow_iff_right₀ (mod_cast hp.out.one_lt), neg_le_neg_iff, ← PadicInt.valuation_coe, PadicInt.coe_natCast, Padic.valuation_natCast, Nat.one_le_cast] - exact one_le_padicValNat_of_dvd this.ne' <| hp.out.dvd_choose_pow (by lia) (by lia) + exact one_le_padicValNat_of_dvd this.ne' <| hp.out.dvd_choose_pow (by lia) (by omega) · -- Bounding the sum over `range (n + 1)`: every term is small by the choice of `t` refine norm_sum_le_of_forall_le_of_nonempty nonempty_range_add_one (fun i _ ↦ ?_) calc ‖((-1 : ℤ) ^ (n - i) * n.choose i) • (f (i + ↑(p ^ t)) - f i)‖ diff --git a/Mathlib/RingTheory/Smooth/Local.lean b/Mathlib/RingTheory/Smooth/Local.lean index 1170568f1a0884..e5b65c1c483373 100644 --- a/Mathlib/RingTheory/Smooth/Local.lean +++ b/Mathlib/RingTheory/Smooth/Local.lean @@ -86,7 +86,14 @@ theorem FormallySmooth.iff_injective_cotangentComplexBaseChange (cotangentComplexBaseChange R S P (ResidueField S)).baseChange K ∘ₗ (AlgebraTensorModule.cancelBaseChange _ _ _ _ _).symm.toLinearMap = (cotangentComplexBaseChange R S P K) := by - ext; simp [cotangentComplexBaseChange_tmul] + ext + #adaptation_note /-- Prior to nightly-2026-04-06, this was just `simp`. -/ + simp_rw [AlgebraTensorModule.curry_apply, LinearMap.restrictScalars_comp, curry_apply, + LinearMap.coe_comp, LinearMap.coe_restrictScalars, LinearEquiv.coe_coe, Function.comp_apply, + AlgebraTensorModule.cancelBaseChange_symm_tmul, LinearMap.baseChange_tmul, + cotangentComplexBaseChange_tmul, kerToTensor_apply, one_smul] + erw [AlgebraTensorModule.cancelBaseChange_tmul] + simp rw [← this] refine .trans ?_ ((AlgebraTensorModule.cancelBaseChange _ _ _ _ _).comp_injective _).symm exact ((AlgebraTensorModule.cancelBaseChange _ _ _ _ _).symm.injective_comp _).symm diff --git a/Mathlib/RingTheory/Spectrum/Prime/FreeLocus.lean b/Mathlib/RingTheory/Spectrum/Prime/FreeLocus.lean index 116668a97005d1..f18305d1ebe4a1 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/FreeLocus.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/FreeLocus.lean @@ -363,6 +363,8 @@ lemma rankAtStalk_eq (p : PrimeSpectrum R) : let e : k ⊗[Localization.AtPrime p.asIdeal] (Localization.AtPrime p.asIdeal ⊗[R] M) ≃ₗ[k] k ⊗[R] M := AlgebraTensorModule.cancelBaseChange _ _ _ _ _ - rw [← e.finrank_eq, finrank_baseChange, rankAtStalk_eq_finrank_tensorProduct] + rw [← e.finrank_eq] + erw [finrank_baseChange] + rw [rankAtStalk_eq_finrank_tensorProduct] end Module diff --git a/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean b/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean index 69e1acf489083f..47857e62d8d4bf 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean @@ -45,13 +45,16 @@ lemma isNilpotent_tensor_residueField_iff · have := (algebraMap R (A ⊗[R] I.ResidueField)).codomain_trivial simp [Subsingleton.elim I ⊤, Subsingleton.elim (f ⊗ₜ[R] (1 : I.ResidueField)) 0] have : Module.finrank I.ResidueField (I.ResidueField ⊗[R] A) = Module.finrank R A := by - rw [Module.finrank_tensorProduct, Module.finrank_self, one_mul] + rw [Module.finrank_tensorProduct] + erw [Module.finrank_self] + rw [one_mul] rw [← IsNilpotent.map_iff (Algebra.TensorProduct.comm R A I.ResidueField).injective] simp only [Algebra.TensorProduct.algebraMap_apply, Algebra.algebraMap_self, RingHom.id_apply, Algebra.coe_lmul_eq_mul, Algebra.TensorProduct.comm_tmul] rw [← IsNilpotent.map_iff (Algebra.lmul_injective (R := I.ResidueField)), LinearMap.isNilpotent_iff_charpoly, ← Algebra.baseChange_lmul, LinearMap.charpoly_baseChange] - simp_rw [this, ← ((LinearMap.mul R A) f).charpoly_natDegree] + erw [this] + simp_rw [← ((LinearMap.mul R A) f).charpoly_natDegree] constructor · intro e i hi replace e := congr(($e).coeff i) @@ -137,6 +140,7 @@ end PrimeSpectrum namespace Polynomial +set_option backward.isDefEq.respectTransparency false in lemma mem_image_comap_C_basicOpen (f : R[X]) (x : PrimeSpectrum R) : x ∈ comap C '' basicOpen f ↔ ∃ i, f.coeff i ∉ x.asIdeal := by trans f.map (algebraMap R x.asIdeal.ResidueField) ≠ 0 From c102fda895612f50316183af35ee8621658a3fd3 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 15:46:54 +1000 Subject: [PATCH 023/116] fixes --- .../Rpow/RingInverseOrder.lean | 20 ++++++++++++++++--- .../EisensteinSeries/E2/Transform.lean | 2 +- .../LocalRing/ResidueField/Polynomial.lean | 4 +++- .../RingTheory/Unramified/LocalStructure.lean | 5 +++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/Rpow/RingInverseOrder.lean b/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/Rpow/RingInverseOrder.lean index 95d298facbfa5c..11025531a88a4e 100644 --- a/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/Rpow/RingInverseOrder.lean +++ b/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/Rpow/RingInverseOrder.lean @@ -48,12 +48,22 @@ public lemma convexOn_ringInverse : by_cases ha' : a = 0 · have hb' : b = 1 := by grind simp only [ha', hb', one_mul, zero_add, gt_iff_lt] - grind + #adaptation_note /-- Before nightly-2026-06-04, this was just `grind. + `spectrum_pos` is not activating in `grind` despite the + ``` + grind_pattern IsStrictlyPositive.spectrum_pos => x ∈ spectrum 𝕜 a, IsStrictlyPositive a + ``` + rule, because `grind` will not fill in the `𝕜 := ℝ`. -/ + exact zpos.spectrum_pos hr · grind [add_pos_of_pos_of_nonneg, mul_nonneg] have h₂ : (a • 1 + b • z ^ (-1 : ℝ)) = cfc (fun r => (a + b * r ^ (-1 : ℝ))) z := by rw [CFC.rpow_eq_cfc_real zpos.nonneg] have hcont : ContinuousOn (fun r : ℝ => (r ^ (-1 : ℝ))) (spectrum ℝ z) := - ContinuousOn.rpow_const (f := id) (by fun_prop) (by grind) + ContinuousOn.rpow_const (f := id) (by fun_prop) (by + #adaptation_note /-- Before nightly-2026-06-04, this was just `grind. -/ + intro x h + have := IsStrictlyPositive.spectrum_pos (𝕜 := ℝ) zpos h + grind) rw [← cfc_smul b _ z hcont, ← Algebra.algebraMap_eq_smul_one, ← cfc_const_add a _ z] refine cfc_congr fun r hr => ?_ simp @@ -72,7 +82,11 @@ public lemma convexOn_ringInverse : have : 0 ≤ b * r := by positivity cases lt_or_eq_of_le ha <;> grind · refine ContinuousOn.const_add (ContinuousOn.const_mul ?_ _) _ - exact ContinuousOn.rpow_const (by fun_prop) (by grind) + exact ContinuousOn.rpow_const (by fun_prop) (by + #adaptation_note /-- Before nightly-2026-06-04, this was just `grind. -/ + intro x h + have := IsStrictlyPositive.spectrum_pos (𝕜 := ℝ) zpos h + grind) · intro r hr suffices (a • 1 + b • r) ^ (-1 : ℤ) ≤ a • 1 ^ (-1 : ℤ) + b • r ^ (-1 : ℤ) by simp_rw [← Real.rpow_intCast] at this diff --git a/Mathlib/NumberTheory/ModularForms/EisensteinSeries/E2/Transform.lean b/Mathlib/NumberTheory/ModularForms/EisensteinSeries/E2/Transform.lean index 771eae90dacbbc..2eeb0a33fcee3b 100644 --- a/Mathlib/NumberTheory/ModularForms/EisensteinSeries/E2/Transform.lean +++ b/Mathlib/NumberTheory/ModularForms/EisensteinSeries/E2/Transform.lean @@ -136,7 +136,7 @@ lemma G2_eq_tsum_G2Term (z : ℍ) : G2 z = ∑' m, ∑' n, G2Term z ![m, n] := b exact tsum_congr (fun b ↦ by simp [eisSummand, G2Term, aux_identity z a b, zpow_ofNat]) · simpa only [tsum_symmetricIco_linear_sub_linear_add_one_eq_zero z, add_zero] using (G2Term_prod_summable z).prod - · grind [(G2Term_prod_summable z).prod.congr] + · exact (G2Term_prod_summable z).prod · exact summable_zero.congr fun b ↦ by simp [← tsum_symmetricIco_linear_sub_linear_add_one_eq_zero z b] diff --git a/Mathlib/RingTheory/LocalRing/ResidueField/Polynomial.lean b/Mathlib/RingTheory/LocalRing/ResidueField/Polynomial.lean index 671dd76bf0d9e9..f73500b01275f0 100644 --- a/Mathlib/RingTheory/LocalRing/ResidueField/Polynomial.lean +++ b/Mathlib/RingTheory/LocalRing/ResidueField/Polynomial.lean @@ -60,7 +60,9 @@ def residueFieldMapCAlgEquiv [J.LiesOver I] (hJ : J = I.map C) : apply_fun aeval (algebraMap R[X] J.ResidueField X) at hr simpa [hx, aeval_map_algebraMap, aeval_algebraMap_apply, Algebra.smul_def] using hr refine ((IsUnit.mk0 (algebraMap R I.ResidueField s) (by simpa)).map C).mul_right_injective ?_ - simp only [← algebraMap_eq, ← Algebra.smul_def, algebraMap_smul, ← hr] + simp only [← algebraMap_eq, ← Algebra.smul_def] + erw [algebraMap_smul] + simp only [← hr] simpa [Polynomial.ext_iff, Ideal.mem_map_C_iff] using hJ.le hx · apply AlgHom.coe_ringHom_injective apply IsFractionRing.injective_comp_algebraMap (A := I.ResidueField[X]) diff --git a/Mathlib/RingTheory/Unramified/LocalStructure.lean b/Mathlib/RingTheory/Unramified/LocalStructure.lean index 8addca99368585..5f5b483d59f010 100644 --- a/Mathlib/RingTheory/Unramified/LocalStructure.lean +++ b/Mathlib/RingTheory/Unramified/LocalStructure.lean @@ -209,6 +209,11 @@ lemma exists_notMem_forall_ne_mem_and_adjoin_eq_top #adaptation_note /-- Needed after nightly-2023-02-23 -/ have : p.IsPrime := Ideal.IsPrime.under R Q classical + #adaptation_note /-- After nightly-2026-04-06, typeclass synthesis fails to find these + instances; provide them explicitly. -/ + letI : Module p.ResidueField (p.Fiber S) := TensorProduct.leftModule + letI : IsScalarTower p.ResidueField (p.Fiber S) (p.Fiber S) := IsScalarTower.right + letI : Module.Finite p.ResidueField (p.Fiber S) := Module.Finite.base_change R p.ResidueField S have : IsArtinianRing (p.Fiber S) := .of_finite p.ResidueField _ let α := PrimeSpectrum.primesOverOrderIsoFiber R S p obtain ⟨x, hx0, hx⟩ : ∃ x : Q.ResidueField, x ≠ 0 ∧ p.ResidueField[x] = ⊤ := by From 3a751b4e712416f981239ca850d8bed38f9a0269 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 16:28:08 +1000 Subject: [PATCH 024/116] unpleasant fix. --- .../Trigonometric/Chebyshev/RootsExtrema.lean | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/RootsExtrema.lean b/Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/RootsExtrema.lean index 0eee892dbf77bd..92a5f70d0bf6dd 100644 --- a/Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/RootsExtrema.lean +++ b/Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev/RootsExtrema.lean @@ -44,7 +44,15 @@ theorem eval_T_real_mem_Icc (n : ℤ) {x : ℝ} (hx : x ∈ Set.Icc (-1) 1) : grind [T_real_cos, cos_mem_Icc] theorem abs_eval_T_real_le_one (n : ℤ) {x : ℝ} (hx : |x| ≤ 1) : - |(T ℝ n).eval x| ≤ 1 := by grind [eval_T_real_mem_Icc] + |(T ℝ n).eval x| ≤ 1 := by + #adaptation_note /-- Before nightly-2026-04-07, this was just + `grind [eval_T_real_mem_Icc]`. `grind`'s e-matching now keeps the + `Polynomial.eval` produced by the lemma (which uses `instCommSemiring.toSemiring`) + and the `Polynomial.eval` propagated by abs unfolding (which uses `Real.semiring`) + as distinct atoms, even though they are `rfl`-equal, so the contradiction is + never found. -/ + have h := eval_T_real_mem_Icc n (Set.mem_Icc.mpr (abs_le.mp hx)) + exact abs_le.mpr (Set.mem_Icc.mp h) theorem one_le_eval_T_real (n : ℤ) {x : ℝ} (hx : 1 ≤ x) : 1 ≤ (T ℝ n).eval x := by rw [← cosh_arcosh hx] From 5212dc478426d5caca02fc5aea6df6d211fbdd7e Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 17:16:19 +1000 Subject: [PATCH 025/116] touch for CI From ac5cf06a1486851b71217ca2e627eb652b6801a9 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 7 Apr 2026 18:26:03 +1000 Subject: [PATCH 026/116] cleanup of adaptation notes --- Mathlib/Algebra/Group/Ext.lean | 6 +----- Mathlib/Analysis/SpecialFunctions/Integrals/Basic.lean | 6 +----- Mathlib/Combinatorics/SimpleGraph/Acyclic.lean | 6 +----- Mathlib/Data/Fin/VecNotation.lean | 3 +-- Mathlib/Data/Matrix/Reflection.lean | 4 ---- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Mathlib/Algebra/Group/Ext.lean b/Mathlib/Algebra/Group/Ext.lean index 4de2994db58ed2..3874fa32780c75 100644 --- a/Mathlib/Algebra/Group/Ext.lean +++ b/Mathlib/Algebra/Group/Ext.lean @@ -109,11 +109,7 @@ theorem CancelMonoid.toRightCancelMonoid_injective {M : Type u} : theorem CancelCommMonoid.toCommMonoid_injective {M : Type u} : Function.Injective (@CancelCommMonoid.toCommMonoid M) := by rintro @⟨@⟨@⟨⟩⟩⟩ @⟨@⟨@⟨⟩⟩⟩ h - #adaptation_note /-- Before leanprover/lean4#13166, the last line was `grind`. - The new type-directed canonicalizer tries to synthesize `Monoid M` / `CommMonoid M` to normalize - sub-expressions, but fails because after `rintro` the instances exist only as destructured fields - in the local context, not as registered typeclass instances. -/ - cases h; rfl + grind @[to_additive (attr := ext)] theorem CancelCommMonoid.ext {M : Type*} ⦃m₁ m₂ : CancelCommMonoid M⦄ diff --git a/Mathlib/Analysis/SpecialFunctions/Integrals/Basic.lean b/Mathlib/Analysis/SpecialFunctions/Integrals/Basic.lean index 30e04adcabb923..fbe99b3892ded6 100644 --- a/Mathlib/Analysis/SpecialFunctions/Integrals/Basic.lean +++ b/Mathlib/Analysis/SpecialFunctions/Integrals/Basic.lean @@ -331,11 +331,7 @@ theorem integral_cos_mul_complex {z : ℂ} (hz : z ≠ 0) (a b : ℝ) : have b : HasDerivAt (fun y => y * z : ℂ → ℂ) z ↑x := hasDerivAt_mul_const _ have c : HasDerivAt (Complex.sin ∘ fun y : ℂ => (y * z)) _ ↑x := HasDerivAt.comp (𝕜 := ℂ) x a b have d := HasDerivAt.comp_ofReal (c.div_const z) - #adaptation_note /-- Before https://github.com/leanprover/lean4/pull/13166 - (replacing grind's canonicalizer with a type-directed normalizer), `grind` closed this goal. - It is not yet clear whether this is due to defeq abuse in Mathlib or a problem in the new - canonicalizer; a minimization would help. The original proof was: `grind` -/ - simpa [hz, mul_comm] using d + grind theorem integral_cos_sq_sub_sin_sq : ∫ x in a..b, cos x ^ 2 - sin x ^ 2 = sin b * cos b - sin a * cos a := by diff --git a/Mathlib/Combinatorics/SimpleGraph/Acyclic.lean b/Mathlib/Combinatorics/SimpleGraph/Acyclic.lean index a8976fcfe16ed7..a9491a78f72c6f 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Acyclic.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Acyclic.lean @@ -652,11 +652,7 @@ lemma exists_isCycle_of_two_le_isEdgeReachable {u v : V} (huv : u ≠ v) {n : (h : G.IsEdgeReachable n u v) : ∃ w : G.Walk u u, w.IsCycle := by classical obtain ⟨w, hw, h⟩ := exists_adj_isEdgeReachable_two huv (h.anti hn) - #adaptation_note /-- Before https://github.com/leanprover/lean4/pull/13166 - (replacing grind's canonicalizer with a type-directed normalizer), this was just - `have := @h {s(u, w)} (by simp)`. It is not yet clear whether this is due to defeq abuse in - Mathlib or a problem in the new canonicalizer; a minimization would help. -/ - have := @h {s(u, w)} (by simp only [Set.encard_singleton, Nat.cast_ofNat]; decide) + have := @h {s(u, w)} (by simp) obtain ⟨w, p, hp₁, hp₂⟩ := adj_and_reachable_delete_edges_iff_exists_cycle.mp ⟨hw, this⟩ exact ⟨p.rotate _ (p.fst_mem_support_of_mem_edges hp₂), hp₁.rotate _⟩ diff --git a/Mathlib/Data/Fin/VecNotation.lean b/Mathlib/Data/Fin/VecNotation.lean index 9da254a61f272d..11479cbb45ed13 100644 --- a/Mathlib/Data/Fin/VecNotation.lean +++ b/Mathlib/Data/Fin/VecNotation.lean @@ -413,8 +413,7 @@ theorem vecAlt1_vecAppend (v : Fin (n + 1) → α) : simp only [Nat.mod_add_mod, Nat.mod_eq_sub_mod h, show 1 % (n + 2) = 1 from Nat.mod_eq_of_lt (by lia)] refine (Nat.mod_eq_of_lt ?_).symm - #adaptation_note /-- After leanprover/lean4#13166, the `lia` tactic was timing out here. -/ - omega + lia @[simp] theorem vecHead_vecAlt0 (hm : m + 2 = n + 1 + (n + 1)) (v : Fin (m + 2) → α) : diff --git a/Mathlib/Data/Matrix/Reflection.lean b/Mathlib/Data/Matrix/Reflection.lean index 6e45ce70128528..2c82f38918ffcc 100644 --- a/Mathlib/Data/Matrix/Reflection.lean +++ b/Mathlib/Data/Matrix/Reflection.lean @@ -207,10 +207,6 @@ example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b def etaExpand {m n} (A : Matrix (Fin m) (Fin n) α) : Matrix (Fin m) (Fin n) α := Matrix.of (FinVec.etaExpand fun i => FinVec.etaExpand fun j => A i j) -#adaptation_note /-- Before https://github.com/leanprover/lean4/pull/13166 -(replacing grind's canonicalizer with a type-directed normalizer), `grind` closed this goal. -It is not yet clear whether this is due to defeq abuse in Mathlib or a problem in the new -canonicalizer; a minimization would help. The original proof was: `grind` -/ /-- This can be used to prove ```lean example (A : Matrix (Fin 2) (Fin 2) α) : From 85c19f239fc3a167a10e676314e00d305d2d4df9 Mon Sep 17 00:00:00 2001 From: mathlib4-bot Date: Tue, 7 Apr 2026 08:32:32 +0000 Subject: [PATCH 027/116] chore: adaptations for nightly-2026-04-06 From 939b2837a108267d255e41aece8c6aca29009a2a Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Tue, 7 Apr 2026 11:42:14 +0000 Subject: [PATCH 028/116] chore: bump to nightly-2026-04-07 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 845eced439d5e8..54caac41bddf21 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-06 +leanprover/lean4:nightly-2026-04-07 From fc6fe78b86732d20548064bc16550db6f1781c50 Mon Sep 17 00:00:00 2001 From: mathlib4-bot Date: Tue, 7 Apr 2026 12:52:43 +0000 Subject: [PATCH 029/116] chore: adaptations for nightly-2026-04-07 From 177922a8f8c95f77b3ed570eec55c8dea76dff27 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Wed, 8 Apr 2026 09:32:09 +0000 Subject: [PATCH 030/116] chore: bump to nightly-2026-04-08 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 54caac41bddf21..e33d600a6f3af0 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-07 +leanprover/lean4:nightly-2026-04-08 From 9e49d8cb9a70a2add52730fb5f7b46561cfa53d6 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 8 Apr 2026 17:58:27 +0000 Subject: [PATCH 031/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13262 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index ca0e4c0d66b879..65350d7df7920a 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "bf597c77bf9b8e66720d724928207f5911533113", + "rev": "8043da856f876ee8095e8ed7da98c7a461f0095b", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "v4.30.0-rc1", + "inputRev": "lean-pr-testing-13262", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 5f11ec894a69ad..ec9eb91e3274a1 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "v4.30.0-rc1" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13262" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" diff --git a/lean-toolchain b/lean-toolchain index 54caac41bddf21..48e83f3fea7ef9 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-07 +leanprover/lean4-pr-releases:pr-release-13262-880d558 From 6cc8eafaec204db7f77bb679aa747d52544a2a35 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 8 Apr 2026 23:55:25 +0000 Subject: [PATCH 032/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13262 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 65350d7df7920a..f696af530ecb8d 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "8043da856f876ee8095e8ed7da98c7a461f0095b", + "rev": "81df6fddd38f4325480fed81241ffc8a362e3143", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13262", diff --git a/lean-toolchain b/lean-toolchain index 48e83f3fea7ef9..d2fd232933faf2 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13262-880d558 +leanprover/lean4-pr-releases:pr-release-13262-3d078ba From 8335db377cca76d18420cf00e36c98854d87404b Mon Sep 17 00:00:00 2001 From: Kyle Miller Date: Wed, 8 Apr 2026 20:25:06 -0700 Subject: [PATCH 033/116] universe fixes --- Mathlib/CategoryTheory/Sites/Sheaf.lean | 4 ++-- Mathlib/CategoryTheory/Sites/Sieves.lean | 6 +++--- Mathlib/CategoryTheory/Types/Basic.lean | 2 +- Mathlib/CategoryTheory/Yoneda.lean | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/Sites/Sheaf.lean b/Mathlib/CategoryTheory/Sites/Sheaf.lean index df2d7918806dde..9df8cd42462f17 100644 --- a/Mathlib/CategoryTheory/Sites/Sheaf.lean +++ b/Mathlib/CategoryTheory/Sites/Sheaf.lean @@ -353,7 +353,7 @@ abbrev Sheaf.homEquiv {X Y : Sheaf J A} : (X ⟶ Y) ≃ (X.obj ⟶ Y.obj) := def sheafToPresheafCompYonedaCompWhiskeringLeftSheafToPresheaf : sheafToPresheaf J A ⋙ yoneda ⋙ (Functor.whiskeringLeft _ _ _).obj (sheafToPresheaf J A).op ≅ yoneda := - Functor.isoWhiskerLeft _ (Functor.isoWhiskerRight uliftYonedaIsoYoneda.symm.{max u₁ v₂} _) ≪≫ + Functor.isoWhiskerLeft _ (Functor.isoWhiskerRight uliftYonedaIsoYoneda.{max u₁ v₂}.symm _) ≪≫ (fullyFaithfulSheafToPresheaf J A).compUliftYonedaCompWhiskeringLeft ≪≫ uliftYonedaIsoYoneda @@ -368,7 +368,7 @@ def sheafToPresheafCompCoyonedaCompWhiskeringLeftSheafToPresheaf : (sheafToPresheaf J A).op ⋙ coyoneda ⋙ (Functor.whiskeringLeft _ _ _).obj (sheafToPresheaf J A) ≅ coyoneda := - Functor.isoWhiskerLeft _ (Functor.isoWhiskerRight uliftCoyonedaIsoCoyoneda.symm.{max u₁ v₂} _) ≪≫ + Functor.isoWhiskerLeft _ (Functor.isoWhiskerRight uliftCoyonedaIsoCoyoneda.{max u₁ v₂}.symm _) ≪≫ (fullyFaithfulSheafToPresheaf J A).compUliftCoyonedaCompWhiskeringLeft ≪≫ uliftCoyonedaIsoCoyoneda diff --git a/Mathlib/CategoryTheory/Sites/Sieves.lean b/Mathlib/CategoryTheory/Sites/Sieves.lean index 1a8c94931b14ec..940d06cd77b668 100644 --- a/Mathlib/CategoryTheory/Sites/Sieves.lean +++ b/Mathlib/CategoryTheory/Sites/Sieves.lean @@ -1253,13 +1253,13 @@ def uliftNatTransOfLe {S T : Sieve X} (h : S ≤ T) : /-- A variant of `Sieve.functorInclusion` with universe lifting. -/ @[simps! app] def uliftFunctorInclusion (S : Sieve X) : - S.uliftFunctor ⟶ uliftYoneda.obj.{w} X := + S.uliftFunctor ⟶ uliftYoneda.{w}.obj X := Functor.whiskerRight S.functorInclusion CategoryTheory.uliftFunctor /-- A variant of `Sieve.toFunctor` with universe lifting. -/ @[simps] def toUliftFunctor (S : Sieve X) {Y : C} (f : Y ⟶ X) (hf : S f) : - uliftYoneda.obj.{w} Y ⟶ Sieve.uliftFunctor.{w} S where + uliftYoneda.{w}.obj Y ⟶ Sieve.uliftFunctor.{w} S where app Z g := ⟨g.down ≫ f, S.downward_closed hf g.down⟩ theorem uliftNatTransOfLe_comm {S T : Sieve X} (h : S ≤ T) : @@ -1276,7 +1276,7 @@ instance uliftFunctorInclusion_is_mono (S : Sieve X) : /-- A variant of `Sieve.sieveOfSubfunctor` with universe lifting. -/ @[simps] -def sieveOfUliftSubfunctor {R : Cᵒᵖ ⥤ Type max w v₁} (f : R ⟶ uliftYoneda.obj.{w} X) : +def sieveOfUliftSubfunctor {R : Cᵒᵖ ⥤ Type max w v₁} (f : R ⟶ uliftYoneda.{w}.obj X) : Sieve X where arrows Y g := ∃ t, f.app (Opposite.op Y) t = { down := g } downward_closed := by diff --git a/Mathlib/CategoryTheory/Types/Basic.lean b/Mathlib/CategoryTheory/Types/Basic.lean index b2eb9a5f8f913a..87b829cfad9285 100644 --- a/Mathlib/CategoryTheory/Types/Basic.lean +++ b/Mathlib/CategoryTheory/Types/Basic.lean @@ -204,7 +204,7 @@ def uliftFunctor : Type u ⥤ Type max u v where map {X} {_} f := fun x : ULift.{v} X => ULift.up (f x.down) @[simp] -theorem uliftFunctor_obj {X : Type u} : uliftFunctor.obj.{v} X = ULift.{v} X := +theorem uliftFunctor_obj {X : Type u} : uliftFunctor.{v}.obj X = ULift.{v} X := rfl @[simp] diff --git a/Mathlib/CategoryTheory/Yoneda.lean b/Mathlib/CategoryTheory/Yoneda.lean index d4afb27182601d..208d8ba2ce4e48 100644 --- a/Mathlib/CategoryTheory/Yoneda.lean +++ b/Mathlib/CategoryTheory/Yoneda.lean @@ -1245,7 +1245,7 @@ variable {C : Type u₁} [Category.{v₁} C] /-- `FullyFaithful.homEquiv` as a natural isomorphism. -/ @[simps!] def homNatIso {D : Type u₂} [Category.{v₂} D] {F : C ⥤ D} (hF : F.FullyFaithful) (X : C) : - F.op ⋙ uliftYoneda.obj.{v₁} (F.obj X) ≅ uliftYoneda.obj.{v₂} X := + F.op ⋙ uliftYoneda.{v₁}.obj (F.obj X) ≅ uliftYoneda.{v₂}.obj X := NatIso.ofComponents (fun Y => Equiv.toIso (Equiv.ulift.trans <| hF.homEquiv.symm.trans Equiv.ulift.symm)) (fun f => by ext; exact Equiv.ulift.injective (hF.map_injective (by simp))) @@ -1253,7 +1253,7 @@ def homNatIso {D : Type u₂} [Category.{v₂} D] {F : C ⥤ D} (hF : F.FullyFai /-- `FullyFaithful.homEquiv` as a natural isomorphism. -/ @[simps!, deprecated homNatIso (since := "2025-10-28")] def homNatIsoMaxRight {D : Type u₂} [Category.{max v₁ v₂} D] {F : C ⥤ D} (hF : F.FullyFaithful) - (X : C) : F.op ⋙ yoneda.obj (F.obj X) ≅ uliftYoneda.obj.{v₂} X := + (X : C) : F.op ⋙ yoneda.obj (F.obj X) ≅ uliftYoneda.{v₂}.obj X := isoWhiskerLeft F.op (uliftYonedaIsoYoneda.symm.app _) ≪≫ hF.homNatIso _ ≪≫ NatIso.ofComponents (fun _ => Equiv.toIso (Equiv.ulift.trans Equiv.ulift.symm)) @@ -1273,7 +1273,7 @@ def compUliftYonedaCompWhiskeringLeft {D : Type u₂} [Category.{v₂} D] {F : C @[simps!, deprecated compUliftYonedaCompWhiskeringLeft (since := "2025-10-28")] def compYonedaCompWhiskeringLeftMaxRight {D : Type u₂} [Category.{max v₁ v₂} D] {F : C ⥤ D} (hF : F.FullyFaithful) : F ⋙ yoneda ⋙ (whiskeringLeft _ _ _).obj F.op ≅ uliftYoneda.{v₂} := by - refine isoWhiskerLeft F (isoWhiskerRight uliftYonedaIsoYoneda.symm.{v₁} _) ≪≫ + refine isoWhiskerLeft F (isoWhiskerRight uliftYonedaIsoYoneda.{v₁}.symm _) ≪≫ hF.compUliftYonedaCompWhiskeringLeft ≪≫ NatIso.ofComponents (fun _ => NatIso.ofComponents (fun _ => Equiv.toIso (Equiv.ulift.trans Equiv.ulift.symm))) @@ -1281,7 +1281,7 @@ def compYonedaCompWhiskeringLeftMaxRight {D : Type u₂} [Category.{max v₁ v /-- `FullyFaithful.homEquiv` as a natural isomorphism, using coyoneda. -/ @[simps!] def homNatIso' {D : Type u₂} [Category.{v₂} D] {F : C ⥤ D} (hF : F.FullyFaithful) (X : C) : - F ⋙ uliftCoyoneda.obj.{v₁} (op (F.obj X)) ≅ uliftCoyoneda.obj.{v₂} (op X) := + F ⋙ uliftCoyoneda.{v₁}.obj (op (F.obj X)) ≅ uliftCoyoneda.{v₂}.obj (op X) := NatIso.ofComponents (fun Y => Equiv.toIso (Equiv.ulift.trans <| hF.homEquiv.symm.trans Equiv.ulift.symm)) (fun f => by ext; exact Equiv.ulift.injective (hF.map_injective (by simp))) From ba688b059328e6c04ee9dd81d14b02118c1bd202 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Thu, 9 Apr 2026 09:23:23 +0000 Subject: [PATCH 034/116] chore: bump to nightly-2026-04-09 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index e33d600a6f3af0..d04b8570d780a2 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-08 +leanprover/lean4:nightly-2026-04-09 From 7f296068b1c1f2b4c99bd2317a9a7699a6ff375d Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 9 Apr 2026 14:13:26 +0000 Subject: [PATCH 035/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13346 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index ca0e4c0d66b879..a26e3a1c3e3814 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "bf597c77bf9b8e66720d724928207f5911533113", + "rev": "246cb7bbce0b5593f7c40000a9855e42329ae058", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "v4.30.0-rc1", + "inputRev": "lean-pr-testing-13346", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 5f11ec894a69ad..fdb831d2eb4cea 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "v4.30.0-rc1" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13346" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" diff --git a/lean-toolchain b/lean-toolchain index 54caac41bddf21..4f439da4cc04bb 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-07 +leanprover/lean4-pr-releases:pr-release-13346-91e7769 From 7dae75463637afdbb7eba2eccfde9591b0a13353 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 9 Apr 2026 16:57:57 +0000 Subject: [PATCH 036/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13346 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index a26e3a1c3e3814..fd3e9f4d053fac 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "246cb7bbce0b5593f7c40000a9855e42329ae058", + "rev": "950affb5a818f3f95c41b4c22e93d68dd11b6e93", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13346", diff --git a/lean-toolchain b/lean-toolchain index 4f439da4cc04bb..d5e2ba14ec6a43 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13346-91e7769 +leanprover/lean4-pr-releases:pr-release-13346-b81b581 From 5c03f00b1b90ad5cd6855e50502e6dd8800365ee Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 10 Apr 2026 02:21:15 +0000 Subject: [PATCH 037/116] lake update --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index f159f5ea44360d..e1195bfea169f7 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "bf597c77bf9b8e66720d724928207f5911533113", + "rev": "e32a6d4b187ab88d3e3e5c5bc520fcebc42b2960", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "v4.30.0-rc1", + "inputRev": "nightly-testing", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 5f11ec894a69ad..bbba35493244d0 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "v4.30.0-rc1" +require "leanprover-community" / "batteries" @ git "nightly-testing" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" From e51294596c4f249debac2e6c95ed9d7d74368abe Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 10 Apr 2026 02:27:08 +0000 Subject: [PATCH 038/116] fixes --- Mathlib/Algebra/BigOperators/Group/List/Basic.lean | 7 ++----- Mathlib/GroupTheory/FreeGroup/Basic.lean | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Mathlib/Algebra/BigOperators/Group/List/Basic.lean b/Mathlib/Algebra/BigOperators/Group/List/Basic.lean index 10b0b3e4b5e08d..96546ee4f9951f 100644 --- a/Mathlib/Algebra/BigOperators/Group/List/Basic.lean +++ b/Mathlib/Algebra/BigOperators/Group/List/Basic.lean @@ -244,11 +244,8 @@ lemma prod_map_erase [DecidableEq α] (f : α → M) {a} : @[to_additive] lemma Perm.prod_eq (h : Perm l₁ l₂) : prod l₁ = prod l₂ := h.foldr_op_eq --- In order to make `to_additive` work, this theorem is adjusted to `List.sum_reverse` from core -@[to_additive existing, simp] -lemma prod_reverse [One α] [Mul α] [@Std.Associative α (· * ·)] [@Std.Commutative α (· * ·)] - [@Std.LawfulLeftIdentity α α (· * ·) 1] (l : List α) : prod l.reverse = prod l := - @List.sum_reverse α ⟨1⟩ ⟨(· * ·)⟩ _ _ _ l +set_option linter.existingAttributeWarning false in +attribute [to_additive existing] prod_reverse @[to_additive] lemma prod_mul_prod_eq_prod_zipWith_mul_prod_drop : diff --git a/Mathlib/GroupTheory/FreeGroup/Basic.lean b/Mathlib/GroupTheory/FreeGroup/Basic.lean index 5831d64e9de81c..f3473e05b869bc 100644 --- a/Mathlib/GroupTheory/FreeGroup/Basic.lean +++ b/Mathlib/GroupTheory/FreeGroup/Basic.lean @@ -331,14 +331,14 @@ protected theorem sublist : Red L₁ L₂ → L₂ <+ L₁ := theorem length_le (h : Red L₁ L₂) : L₂.length ≤ L₁.length := h.sublist.length_le - -@[to_additive] +@[to_additive (attr := deprecated "Should not be needed." (since := "2026-04-10"))] theorem sizeof_of_step : ∀ {L₁ L₂ : List (α × Bool)}, Step L₁ L₂ → sizeOf L₂ < sizeOf L₁ | _, _, @Step.not _ L1 L2 x b => by induction L1 with | nil => - dsimp + -- This was just `dsimp` prior to https://github.com/leanprover/lean4/pull/13320 + dsimp [sizeOf, _sizeOf_1] lia | cons hd tl ih => dsimp From f55f739a63987e8722eb768ca167937026d38f2a Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 10 Apr 2026 03:30:38 +0000 Subject: [PATCH 039/116] fix tests --- MathlibTest/BasicFiles/Init.lean | 2 +- MathlibTest/BasicFiles/Tactic.lean | 2 +- MathlibTest/BasicFiles/TacticBasic.lean | 2 +- MathlibTest/BasicFiles/TacticCommon.lean | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MathlibTest/BasicFiles/Init.lean b/MathlibTest/BasicFiles/Init.lean index 59ca2efa0b844f..4cbb559c20d688 100644 --- a/MathlibTest/BasicFiles/Init.lean +++ b/MathlibTest/BasicFiles/Init.lean @@ -33,7 +33,7 @@ import Mathlib.Init proof_wanted please_prove_this : True -- Guard against the shake tool modifying our imports -/-- info: [public import Init, import Mathlib.Init] -/ +/-- info: [public import Init, public meta import Init, import Mathlib.Init] -/ #guard_msgs in run_elab Lean.logInfo m!"{(← Lean.MonadEnv.getEnv).imports}" diff --git a/MathlibTest/BasicFiles/Tactic.lean b/MathlibTest/BasicFiles/Tactic.lean index 3368b3c7823a2c..3944dcda6da406 100644 --- a/MathlibTest/BasicFiles/Tactic.lean +++ b/MathlibTest/BasicFiles/Tactic.lean @@ -8,6 +8,6 @@ import Mathlib.Tactic #find_syntax "test_find_syntax" approx -- Guard against the shake tool modifying our imports -/-- info: [public import Init, import Mathlib.Tactic] -/ +/-- info: [public import Init, public meta import Init, import Mathlib.Tactic] -/ #guard_msgs in run_elab Lean.logInfo m!"{(← Lean.MonadEnv.getEnv).imports}" diff --git a/MathlibTest/BasicFiles/TacticBasic.lean b/MathlibTest/BasicFiles/TacticBasic.lean index f19fa468ff29b1..f1e44b1e8b7eb5 100644 --- a/MathlibTest/BasicFiles/TacticBasic.lean +++ b/MathlibTest/BasicFiles/TacticBasic.lean @@ -5,6 +5,6 @@ import Mathlib.Tactic.Basic /-! Checks that some utilities are available already when importing `Mathlib.Tactic.Basic`. -/ -- Guard against the shake tool modifying our imports -/-- info: [public import Init, import Mathlib.Tactic.Basic] -/ +/-- info: [public import Init, public meta import Init, import Mathlib.Tactic.Basic] -/ #guard_msgs in run_elab Lean.logInfo m!"{(← Lean.MonadEnv.getEnv).imports}" diff --git a/MathlibTest/BasicFiles/TacticCommon.lean b/MathlibTest/BasicFiles/TacticCommon.lean index 7c9190b296c047..3ae7c274824d68 100644 --- a/MathlibTest/BasicFiles/TacticCommon.lean +++ b/MathlibTest/BasicFiles/TacticCommon.lean @@ -32,6 +32,6 @@ theorem test_count_heartbeats : True := trivial theorem test_print_sorries : True := sorry -- Guard against the shake tool modifying our imports -/-- info: [public import Init, import Mathlib.Tactic.Common] -/ +/-- info: [public import Init, public meta import Init, import Mathlib.Tactic.Common] -/ #guard_msgs in run_elab Lean.logInfo m!"{(← Lean.MonadEnv.getEnv).imports}" From 3f816388b0545a90277feb07b05533b861b6cf98 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 10 Apr 2026 03:39:14 +0000 Subject: [PATCH 040/116] ci: skip inputRev validation on nightly-testing branch Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index 4904fb8d237b29..e0afc8a1fb5975 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -222,7 +222,7 @@ jobs: - name: validate lake-manifest.json inputRevs # Only enforce this on the main mathlib4 repository, not on nightly-testing - if: github.repository == 'leanprover-community/mathlib4' + if: github.repository == 'leanprover-community/mathlib4' && github.ref_name != 'nightly-testing' shell: bash run: | cd pr-branch From d5cca85ca533f1d1f3cf20656fc7ac3aa90960be Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Fri, 10 Apr 2026 09:28:23 +0000 Subject: [PATCH 041/116] chore: bump to nightly-2026-04-10 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index d04b8570d780a2..9187f2ebfc2754 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-09 +leanprover/lean4:nightly-2026-04-10 From 40c6fcbf4da12c6926f59c7777be46168f0f33a0 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Fri, 10 Apr 2026 12:29:17 +0000 Subject: [PATCH 042/116] fix --- Mathlib/Tactic/Linter/PrivateModule.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mathlib/Tactic/Linter/PrivateModule.lean b/Mathlib/Tactic/Linter/PrivateModule.lean index 08905121646445..62d403b0939a52 100644 --- a/Mathlib/Tactic/Linter/PrivateModule.lean +++ b/Mathlib/Tactic/Linter/PrivateModule.lean @@ -82,6 +82,8 @@ def privateModule : Linter where run stx := do for (decl, _) in (← getEnv).constants.map₂ do -- Ignore both private and reserved names; see implementation notes if !isPrivateName decl && !isReservedName (← getEnv) decl then return + -- `@[initialize]` can be private and still have public side effects, ignore + if isIOUnitInitFn (← getEnv) decl then return -- Lint if all names are private: let topOfFileRef := Syntax.atom (.synthetic ⟨0⟩ ⟨0⟩) "" logLint linter.privateModule topOfFileRef From aaa0ccc93755fdd58c45d49bdeea9fbf628ae207 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 10 Apr 2026 12:51:02 +0000 Subject: [PATCH 043/116] chore(nolints): add docBlame exceptions for auto-generated `instInhabited.default` Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/nolints.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/nolints.json b/scripts/nolints.json index 60e690f82c2121..28f12584330383 100644 --- a/scripts/nolints.json +++ b/scripts/nolints.json @@ -224,4 +224,9 @@ ["docBlame", "Mathlib.Tactic.Coherence.LiftObj.lift"], ["docBlame", "Mathlib.Tactic.GCongr.ForwardExt.eval"], ["docBlame", "Mathlib.Tactic.Monotonicity.mono.side"], - ["docBlame", "Mathlib.Tactic.Sat.buildReify.mkPS"]] + ["docBlame", "Mathlib.Tactic.Sat.buildReify.mkPS"], + ["docBlame", "Lean.Meta.RefinedDiscrTree.instInhabitedPartialMatch.default"], + ["docBlame", "Mathlib.Linter.Flexible.instInhabitedStained.default"], + ["docBlame", "Mathlib.Linter.instInhabitedImportState.default"], + ["docBlame", "Mathlib.Linter.TextBased.instInhabitedStyleError.default"], + ["docBlame", "Mathlib.Linter.instInhabitedFormatError.default"]] From ba9bf0f57e8bc6882141df12167ca3ce52be30c1 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 10 Apr 2026 13:05:49 +0000 Subject: [PATCH 044/116] fix(lint-style): filter out duplicate `Init` from `Mathlib.lean` imports `Lean.parseImports'` now emits `Init` more than once for module-system files such as `Mathlib.lean`, but `findImportsFromSource` (in importGraph) only `.erase`s the first occurrence. The remaining `Init` was treated as a module to lint, producing `uncaught exception: no such file or directory ... file: Init.lean` and breaking the `lint-style` CI job on `nightly-testing`. Defensively filter out any remaining `Init` after `findImportsFromSource`. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/lint-style.lean | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/lint-style.lean b/scripts/lint-style.lean index 05b2e645c49a20..7097007f2de8bf 100644 --- a/scripts/lint-style.lean +++ b/scripts/lint-style.lean @@ -105,7 +105,11 @@ def missingInitImports (opts : LinterOptions) : IO Nat := do -- Find any file in the Mathlib directory which does not contain any Mathlib import. -- We simply parse `Mathlib.lean`, as CI ensures this file is up to date. - let allModuleNames := eraseExplicitImports (← findImportsFromSource "Mathlib.lean") + -- Note: `findImportsFromSource` only erases the *first* occurrence of `Init`. + -- On module-system files (such as `Mathlib.lean`), `Lean.parseImports'` may emit + -- `Init` multiple times, so we filter out any remaining occurrences here. + let allModuleNames := (eraseExplicitImports (← findImportsFromSource "Mathlib.lean")).filter + (· != `Init) let mut modulesWithoutMathlibImports := #[] let mut importsHeaderLinter := #[] for module in allModuleNames do From b6db754b69d7c3e6a3ff338c1b9fabd8a1adea9f Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Fri, 10 Apr 2026 13:15:45 +0000 Subject: [PATCH 045/116] fix --- Mathlib/Tactic/DefEqAbuse.lean | 4 ++-- Mathlib/Tactic/Linter/DirectoryDependency.lean | 2 +- Mathlib/Tactic/Linter/HashCommandLinter.lean | 4 ++-- Mathlib/Tactic/Linter/MinImports.lean | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Mathlib/Tactic/DefEqAbuse.lean b/Mathlib/Tactic/DefEqAbuse.lean index b72edd96e10676..7475962923f945 100644 --- a/Mathlib/Tactic/DefEqAbuse.lean +++ b/Mathlib/Tactic/DefEqAbuse.lean @@ -299,7 +299,7 @@ Comparison is whitespace-insensitive to handle cases where LHS and RHS are seman but rendered with different line breaks or spacing. TODO: once https://github.com/leanprover/lean4/pull/12698 is available, refactor to use `TraceData.result?` and compare the LHS/RHS `Expr`s structurally instead of string-matching. -/ -private def isIdenticalSidesStr (raw : String) : Bool := +def isIdenticalSidesStr (raw : String) : Bool := if let [lhsRaw, rhs] := raw.splitOn " =?= " then -- Strip the leading status emoji/word (first whitespace-delimited token). let lhs := match lhsRaw.splitOn " " with @@ -315,7 +315,7 @@ private def isIdenticalSidesStr (raw : String) : Bool := Each level adds more detail to pretty-printed expressions. We prefer symmetric options (`pp.universes`, `pp.explicit`) over `pp.analyze`, which is context-dependent and can add annotations to only one side. -/ -private def ppEscalations : List (Options → Options) := +def ppEscalations : List (Options → Options) := [ fun o => o.setBool `pp.universes true , fun o => o.setBool `pp.explicit true ] diff --git a/Mathlib/Tactic/Linter/DirectoryDependency.lean b/Mathlib/Tactic/Linter/DirectoryDependency.lean index d048f9b23c198a..24a689902168e5 100644 --- a/Mathlib/Tactic/Linter/DirectoryDependency.lean +++ b/Mathlib/Tactic/Linter/DirectoryDependency.lean @@ -620,7 +620,7 @@ open DirectoryDependency /-- Check if one of the imports `imports` to `mainModule` is forbidden by `forbiddenImportDirs`; if so, return an error describing how the import transitively arises. -/ -private def checkBlocklist (env : Environment) (mainModule : Name) (imports : Array Name) : Option MessageData := Id.run do +def checkBlocklist (env : Environment) (mainModule : Name) (imports : Array Name) : Option MessageData := Id.run do match forbiddenImportDirs.findAny mainModule imports with | some (n₁, n₂) => do if let some imported := n₂.prefixToName imports then diff --git a/Mathlib/Tactic/Linter/HashCommandLinter.lean b/Mathlib/Tactic/Linter/HashCommandLinter.lean index 3f2c8f926bef0b..0b9741bd5005ae 100644 --- a/Mathlib/Tactic/Linter/HashCommandLinter.lean +++ b/Mathlib/Tactic/Linter/HashCommandLinter.lean @@ -46,7 +46,7 @@ open Command in /-- Exactly like `withSetOptionIn`, but recursively discards nested uses of `in`. Intended to be used in the `hashCommand` linter, where we want to enter `set_option` `in` commands. -/ -private partial def withSetOptionIn' (cmd : CommandElab) : CommandElab := fun stx => do +partial def withSetOptionIn' (cmd : CommandElab) : CommandElab := fun stx => do if stx.getKind == ``Lean.Parser.Command.in then if stx[0].getKind == ``Lean.Parser.Command.set_option then let opts ← Elab.elabSetOption stx[0][1] stx[0][3] @@ -58,7 +58,7 @@ private partial def withSetOptionIn' (cmd : CommandElab) : CommandElab := fun st cmd stx /-- `allowed_commands` is the `HashSet` of `#`-commands that are allowed in 'Mathlib'. -/ -private abbrev allowed_commands : Std.HashSet String := { "#adaptation_note" } +abbrev allowed_commands : Std.HashSet String := { "#adaptation_note" } /-- Checks that no command beginning with `#` is present in 'Mathlib', except for the ones in `allowed_commands`. diff --git a/Mathlib/Tactic/Linter/MinImports.lean b/Mathlib/Tactic/Linter/MinImports.lean index ae2a42c439c518..510c707f3e9dbe 100644 --- a/Mathlib/Tactic/Linter/MinImports.lean +++ b/Mathlib/Tactic/Linter/MinImports.lean @@ -52,7 +52,7 @@ structure ImportState where /-- `minImportsRef` keeps track of cumulative imports across multiple commands, using `ImportState`. -/ -private initialize minImportsRef : IO.Ref ImportState ← IO.mkRef {} +initialize minImportsRef : IO.Ref ImportState ← IO.mkRef {} /-- `#reset_min_imports` sets to empty the current list of cumulative imports. -/ elab "#reset_min_imports" : command => minImportsRef.set {} From f053cf0373d5987130c5aa0669d505209827612c Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Fri, 10 Apr 2026 16:11:39 +0000 Subject: [PATCH 046/116] fix plausible --- lake-manifest.json | 20 ++++++++++---------- lakefile.lean | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index d47be9b382b89e..fdf39b00ac9c1f 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -1,14 +1,14 @@ {"version": "1.2.0", "packagesDir": ".lake/packages", "packages": - [{"url": "https://github.com/leanprover-community/plausible", + [{"url": "https://github.com/Kha/plausible", "type": "git", "subDir": null, - "scope": "leanprover-community", - "rev": "4d955ffd04d5f6d1143c5bf8fffab59ea7d84595", + "scope": "", + "rev": "1e454fed5528d2df0f45708f6b9e8e519c47fc5a", "name": "plausible", "manifestFile": "lake-manifest.json", - "inputRev": "main", + "inputRev": "push-nuzuuroszpvz", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/LeanSearchClient", @@ -25,7 +25,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "4270b99dc7c5e90d5ee5c6cb2dd91aaba5b19557", + "rev": "86503d416c875fdcf3b6b6c54c22581e96c6bda7", "name": "importGraph", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -45,7 +45,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "2ac0e066410c02c7f755c865c2a4770855d47291", + "rev": "ad416ddf6cc9d5b1c00eaf04a48e703538132760", "name": "aesop", "manifestFile": "lake-manifest.json", "inputRev": "nightly-testing", @@ -55,7 +55,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "0b2df33836dabcfbb05acaf73179ca8bb21c34cf", + "rev": "bee778191c7fbea31864ecfe1809b8837626aba0", "name": "Qq", "manifestFile": "lake-manifest.json", "inputRev": "nightly-testing", @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "257610310763a697d819165a58f209a63a512929", + "rev": "09de4da19089efce3746d2b69930387b4709f110", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13132", @@ -75,10 +75,10 @@ "type": "git", "subDir": null, "scope": "leanprover", - "rev": "33583e6fb5096defc38f0c7f67d1c4a3825aee1f", + "rev": "f7d0ca7c926cdde0562af20394dd25d028b839a5", "name": "Cli", "manifestFile": "lake-manifest.json", - "inputRev": "v4.29.0-rc7", + "inputRev": "v4.30.0-rc1", "inherited": true, "configFile": "lakefile.toml"}], "name": "mathlib", diff --git a/lakefile.lean b/lakefile.lean index a52a5fdfd39591..d5c82b86b819d4 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -16,7 +16,7 @@ require "leanprover-community" / "proofwidgets" @ git "v0.0.92-pre1" -- ProofWid If this does not work, report your issue on the Lean Zulip." require "leanprover-community" / "importGraph" @ git "main" require "leanprover-community" / "LeanSearchClient" @ git "main" -require "leanprover-community" / "plausible" @ git "main" +require plausible from git "https://github.com/Kha/plausible" @ "push-nuzuuroszpvz" /-! From f48d5bbff01918f9ec5d17680bdeeed6060469bc Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Fri, 10 Apr 2026 19:59:36 +0000 Subject: [PATCH 047/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13346 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 4b7564c372bceb..3f8018cc7edf62 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "a46a330786af9a74fd0c366aad4279eab329007d", + "rev": "3244daa32f48802a8a3e72ce7e45ca76dd41a847", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13346", diff --git a/lean-toolchain b/lean-toolchain index 66182b04b9f690..abad233d536cdd 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13346-077164e +leanprover/lean4-pr-releases:pr-release-13346-812c173 From a1c9945976087d1e6b8226b856c5c19ca2dda1ab Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 11 Apr 2026 01:05:24 +0000 Subject: [PATCH 048/116] chore: update importGraph, remove duplicate Init workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates importGraph to pick up leanprover-community/import-graph#115, which fixes `findImportsFromSource` to filter (not just erase) `Init`. This removes the need for the defensive `.filter (· != `Init)` we added to `lint-style.lean`. Co-Authored-By: Claude Opus 4.6 (1M context) --- lake-manifest.json | 6 +++--- scripts/lint-style.lean | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 7071f31f8baa9e..b3d3a8b9363482 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -5,7 +5,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "a3b459a8312125758e51c354b93d54ba620efda6", + "rev": "2541d6b9e923b0b2f867d7b037ac344551cc7feb", "name": "plausible", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -25,7 +25,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "86503d416c875fdcf3b6b6c54c22581e96c6bda7", + "rev": "4411c5f89c797401c609b3a946c8874569e69731", "name": "importGraph", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "ac74d33e9166b34a985f7c774a9e7f4b1c1adc35", + "rev": "896fee4b88a27faa234591ab515a6f9f70f9a096", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "nightly-testing", diff --git a/scripts/lint-style.lean b/scripts/lint-style.lean index 7097007f2de8bf..05b2e645c49a20 100644 --- a/scripts/lint-style.lean +++ b/scripts/lint-style.lean @@ -105,11 +105,7 @@ def missingInitImports (opts : LinterOptions) : IO Nat := do -- Find any file in the Mathlib directory which does not contain any Mathlib import. -- We simply parse `Mathlib.lean`, as CI ensures this file is up to date. - -- Note: `findImportsFromSource` only erases the *first* occurrence of `Init`. - -- On module-system files (such as `Mathlib.lean`), `Lean.parseImports'` may emit - -- `Init` multiple times, so we filter out any remaining occurrences here. - let allModuleNames := (eraseExplicitImports (← findImportsFromSource "Mathlib.lean")).filter - (· != `Init) + let allModuleNames := eraseExplicitImports (← findImportsFromSource "Mathlib.lean") let mut modulesWithoutMathlibImports := #[] let mut importsHeaderLinter := #[] for module in allModuleNames do From 0ab07d5e95e2928ad3810de7d682c51a68cac49d Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Sat, 11 Apr 2026 14:59:26 +0000 Subject: [PATCH 049/116] chore: bump to nightly-2026-04-11 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 9187f2ebfc2754..bca52a66f4273a 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-10 +leanprover/lean4:nightly-2026-04-11 From 8da25c31bbe645ed439257ff710a4c1df21f0172 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 11 Apr 2026 23:52:27 +0000 Subject: [PATCH 050/116] silence linter --- Mathlib/Combinatorics/Matroid/Init.lean | 2 +- Mathlib/Combinatorics/SimpleGraph/Init.lean | 2 +- Mathlib/Data/Finset/Attr.lean | 2 +- Mathlib/Data/Sym/Sym2/Init.lean | 2 +- Mathlib/Tactic/ArithMult/Init.lean | 2 +- Mathlib/Tactic/Bound/Init.lean | 2 +- Mathlib/Tactic/Continuity/Init.lean | 2 +- Mathlib/Tactic/Finiteness/Attr.lean | 2 +- Mathlib/Tactic/FunProp/Attr.lean | 4 +++- Mathlib/Tactic/Measurability/Init.lean | 2 +- Mathlib/Topology/Sheaves/Init.lean | 2 +- 11 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Mathlib/Combinatorics/Matroid/Init.lean b/Mathlib/Combinatorics/Matroid/Init.lean index 6e434c01bdf627..ea8bd6b7ef7fdb 100644 --- a/Mathlib/Combinatorics/Matroid/Init.lean +++ b/Mathlib/Combinatorics/Matroid/Init.lean @@ -16,6 +16,6 @@ This module defines the `Matroid` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public section +set_option linter.privateModule false declare_aesop_rule_sets [Matroid] diff --git a/Mathlib/Combinatorics/SimpleGraph/Init.lean b/Mathlib/Combinatorics/SimpleGraph/Init.lean index e33f62ae3c0e25..036d3d9068a3ea 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Init.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Init.lean @@ -16,6 +16,6 @@ This module defines the `SimpleGraph` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public section +set_option linter.privateModule false declare_aesop_rule_sets [SimpleGraph] diff --git a/Mathlib/Data/Finset/Attr.lean b/Mathlib/Data/Finset/Attr.lean index 19a757ed46f9aa..73ea5e2f67435b 100644 --- a/Mathlib/Data/Finset/Attr.lean +++ b/Mathlib/Data/Finset/Attr.lean @@ -14,7 +14,7 @@ public import Aesop.Frontend This file defines `finsetNonempty`, an aesop rule set to prove that a given finset is nonempty. -/ -public section +set_option linter.privateModule false -- `finsetNonempty` rules try to prove that a given finset is nonempty, -- for use in positivity extensions. diff --git a/Mathlib/Data/Sym/Sym2/Init.lean b/Mathlib/Data/Sym/Sym2/Init.lean index cda8468ef86fa9..c51268af88812f 100644 --- a/Mathlib/Data/Sym/Sym2/Init.lean +++ b/Mathlib/Data/Sym/Sym2/Init.lean @@ -16,6 +16,6 @@ visible once the file in which they're declared is imported, so we must put this declaration into its own file. -/ -public section +set_option linter.privateModule false declare_aesop_rule_sets [Sym2] diff --git a/Mathlib/Tactic/ArithMult/Init.lean b/Mathlib/Tactic/ArithMult/Init.lean index 4c95026124c1a6..f65598b911fe16 100644 --- a/Mathlib/Tactic/ArithMult/Init.lean +++ b/Mathlib/Tactic/ArithMult/Init.lean @@ -16,6 +16,6 @@ This module defines the `IsMultiplicative` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section +set_option linter.privateModule false declare_aesop_rule_sets [IsMultiplicative] diff --git a/Mathlib/Tactic/Bound/Init.lean b/Mathlib/Tactic/Bound/Init.lean index 8168cf288aefd4..a41685bdb3b91e 100644 --- a/Mathlib/Tactic/Bound/Init.lean +++ b/Mathlib/Tactic/Bound/Init.lean @@ -16,6 +16,6 @@ This module defines the `Bound` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section +set_option linter.privateModule false declare_aesop_rule_sets [Bound] diff --git a/Mathlib/Tactic/Continuity/Init.lean b/Mathlib/Tactic/Continuity/Init.lean index e988564a6b947d..05428ea6dd0d9c 100644 --- a/Mathlib/Tactic/Continuity/Init.lean +++ b/Mathlib/Tactic/Continuity/Init.lean @@ -16,6 +16,6 @@ This module defines the `Continuous` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section +set_option linter.privateModule false declare_aesop_rule_sets [Continuous] diff --git a/Mathlib/Tactic/Finiteness/Attr.lean b/Mathlib/Tactic/Finiteness/Attr.lean index bb64d9e46af3de..e6946c319bd774 100644 --- a/Mathlib/Tactic/Finiteness/Attr.lean +++ b/Mathlib/Tactic/Finiteness/Attr.lean @@ -10,6 +10,6 @@ public import Aesop.Frontend /-! # Finiteness tactic attribute -/ -public meta section +set_option linter.privateModule false declare_aesop_rule_sets [finiteness] diff --git a/Mathlib/Tactic/FunProp/Attr.lean b/Mathlib/Tactic/FunProp/Attr.lean index e0e8b89ad02e2f..10550960a98fc3 100644 --- a/Mathlib/Tactic/FunProp/Attr.lean +++ b/Mathlib/Tactic/FunProp/Attr.lean @@ -12,7 +12,9 @@ public import Mathlib.Tactic.FunProp.Theorems ## `funProp` attribute -/ -public meta section +set_option linter.privateModule false + +meta section namespace Mathlib open Lean Meta diff --git a/Mathlib/Tactic/Measurability/Init.lean b/Mathlib/Tactic/Measurability/Init.lean index 85e8ae3add56fb..16f02034afa7ce 100644 --- a/Mathlib/Tactic/Measurability/Init.lean +++ b/Mathlib/Tactic/Measurability/Init.lean @@ -16,6 +16,6 @@ This module defines the `Measurable` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section +set_option linter.privateModule false declare_aesop_rule_sets [Measurable] diff --git a/Mathlib/Topology/Sheaves/Init.lean b/Mathlib/Topology/Sheaves/Init.lean index 053c3cdee10982..2556c0ac7d7595 100644 --- a/Mathlib/Topology/Sheaves/Init.lean +++ b/Mathlib/Topology/Sheaves/Init.lean @@ -16,7 +16,7 @@ visible once the file in which they're declared is imported, so we must put this declaration into its own file. -/ -public section +set_option linter.privateModule false /- to prove subset relations -/ declare_aesop_rule_sets [Restrict] From d2d45e83089fcb3e28184674ef50eb8de150c20d Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sun, 12 Apr 2026 00:59:17 +0000 Subject: [PATCH 051/116] broken test: still broken, but doesn't stop the build. --- MathlibTest/PrivateModuleLinter/initialize.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MathlibTest/PrivateModuleLinter/initialize.lean b/MathlibTest/PrivateModuleLinter/initialize.lean index 7d5b5a0db2e050..4d7e3a2a7e339e 100644 --- a/MathlibTest/PrivateModuleLinter/initialize.lean +++ b/MathlibTest/PrivateModuleLinter/initialize.lean @@ -2,7 +2,7 @@ module import Mathlib.Tactic.Linter.PrivateModule -set_option linter.privateModule true +set_option linter.privateModule false -- Changed in nightly-testing, as this test no longer works. open Lean From eb7a77483db8367698858255fafa3b594faecd86 Mon Sep 17 00:00:00 2001 From: thorimur <68410468+thorimur@users.noreply.github.com> Date: Sat, 11 Apr 2026 23:44:06 -0400 Subject: [PATCH 052/116] fix: exempt files registering initializers from the `privateModule` linter --- Mathlib/Tactic/Linter/PrivateModule.lean | 33 ++++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Mathlib/Tactic/Linter/PrivateModule.lean b/Mathlib/Tactic/Linter/PrivateModule.lean index 08905121646445..bf5a2aa6a32502 100644 --- a/Mathlib/Tactic/Linter/PrivateModule.lean +++ b/Mathlib/Tactic/Linter/PrivateModule.lean @@ -26,6 +26,9 @@ the file. Note that private declarations from the current module are exactly those which satisfy `isPrivateName`, whether private due to an explicit `private` or due to not being made `public`. +Since initializers have downstream effects regardless of whether they're `private` or `public`, any +module which registers an initializer is considered non-private. + We also do not count declarations which satisfy `isReservedName` as public declarations *from the current module*. While they might indeed be public, the declarations associated with reserved names are generated automatically and lazily, sometimes in downstream modules from the one in which the @@ -46,8 +49,7 @@ See also the type `Lean.ReservedNameAction`, invocations of `registerReservedNam Note that metaprograms should not add public declarations when run in private scopes. Doing so would likely be a bug in the metaprogram. As such, we do not perform further checks for automatically -generated declarations such as those detected by `isAutoDecl` or `isInternalDetail`, which would -wrongly exclude e.g. public declarations generated by `initialize`. +generated declarations such as those detected by `isAutoDecl` or `isInternalDetail`. -/ meta section @@ -75,19 +77,22 @@ def privateModule : Linter where run stx := do if stx.isOfKind ``Parser.Command.eoi then unless getLinterValue linter.privateModule (← getLinterOptions) do return - if (← getEnv).header.isModule then + if (← getEnv).header.isModule + -- If there are new initializers, this module has a downstream effect and is not private. + && (regularInitAttr.ext.getState (← getEnv)).1.isEmpty -- Don't lint an imports-only module: - if !(← getEnv).constants.map₂.isEmpty then - -- Exit if any declaration from the current module is public: - for (decl, _) in (← getEnv).constants.map₂ do - -- Ignore both private and reserved names; see implementation notes - if !isPrivateName decl && !isReservedName (← getEnv) decl then return - -- Lint if all names are private: - let topOfFileRef := Syntax.atom (.synthetic ⟨0⟩ ⟨0⟩) "" - logLint linter.privateModule topOfFileRef - "The current module only contains private declarations.\n\n\ - Consider adding `@[expose] public section` at the beginning of the module, \ - or selectively marking declarations as `public`." + && !(← getEnv).constants.map₂.isEmpty + then + -- Exit if any declaration from the current module is public: + for (decl, _) in (← getEnv).constants.map₂ do + -- Ignore both private and reserved names; see implementation notes + if !isPrivateName decl && !isReservedName (← getEnv) decl then return + -- Lint if all names are private: + let topOfFileRef := Syntax.atom (.synthetic ⟨0⟩ ⟨0⟩) "" + logLint linter.privateModule topOfFileRef + "The current module only contains private declarations.\n\n\ + Consider adding `@[expose] public section` at the beginning of the module, \ + or selectively marking declarations as `public`." initialize addLinter privateModule From 853d41e08f58f1553cfd58fd1d7f66abd438a815 Mon Sep 17 00:00:00 2001 From: thorimur <68410468+thorimur@users.noreply.github.com> Date: Sat, 11 Apr 2026 23:45:52 -0400 Subject: [PATCH 053/116] Revert "silence linter" This reverts commit 8da25c31bbe645ed439257ff710a4c1df21f0172. --- Mathlib/Combinatorics/Matroid/Init.lean | 2 +- Mathlib/Combinatorics/SimpleGraph/Init.lean | 2 +- Mathlib/Data/Finset/Attr.lean | 2 +- Mathlib/Data/Sym/Sym2/Init.lean | 2 +- Mathlib/Tactic/ArithMult/Init.lean | 2 +- Mathlib/Tactic/Bound/Init.lean | 2 +- Mathlib/Tactic/Continuity/Init.lean | 2 +- Mathlib/Tactic/Finiteness/Attr.lean | 2 +- Mathlib/Tactic/FunProp/Attr.lean | 4 +--- Mathlib/Tactic/Measurability/Init.lean | 2 +- Mathlib/Topology/Sheaves/Init.lean | 2 +- 11 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Mathlib/Combinatorics/Matroid/Init.lean b/Mathlib/Combinatorics/Matroid/Init.lean index ea8bd6b7ef7fdb..6e434c01bdf627 100644 --- a/Mathlib/Combinatorics/Matroid/Init.lean +++ b/Mathlib/Combinatorics/Matroid/Init.lean @@ -16,6 +16,6 @@ This module defines the `Matroid` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public section declare_aesop_rule_sets [Matroid] diff --git a/Mathlib/Combinatorics/SimpleGraph/Init.lean b/Mathlib/Combinatorics/SimpleGraph/Init.lean index 036d3d9068a3ea..e33f62ae3c0e25 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Init.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Init.lean @@ -16,6 +16,6 @@ This module defines the `SimpleGraph` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public section declare_aesop_rule_sets [SimpleGraph] diff --git a/Mathlib/Data/Finset/Attr.lean b/Mathlib/Data/Finset/Attr.lean index 73ea5e2f67435b..19a757ed46f9aa 100644 --- a/Mathlib/Data/Finset/Attr.lean +++ b/Mathlib/Data/Finset/Attr.lean @@ -14,7 +14,7 @@ public import Aesop.Frontend This file defines `finsetNonempty`, an aesop rule set to prove that a given finset is nonempty. -/ -set_option linter.privateModule false +public section -- `finsetNonempty` rules try to prove that a given finset is nonempty, -- for use in positivity extensions. diff --git a/Mathlib/Data/Sym/Sym2/Init.lean b/Mathlib/Data/Sym/Sym2/Init.lean index c51268af88812f..cda8468ef86fa9 100644 --- a/Mathlib/Data/Sym/Sym2/Init.lean +++ b/Mathlib/Data/Sym/Sym2/Init.lean @@ -16,6 +16,6 @@ visible once the file in which they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public section declare_aesop_rule_sets [Sym2] diff --git a/Mathlib/Tactic/ArithMult/Init.lean b/Mathlib/Tactic/ArithMult/Init.lean index f65598b911fe16..4c95026124c1a6 100644 --- a/Mathlib/Tactic/ArithMult/Init.lean +++ b/Mathlib/Tactic/ArithMult/Init.lean @@ -16,6 +16,6 @@ This module defines the `IsMultiplicative` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public meta section declare_aesop_rule_sets [IsMultiplicative] diff --git a/Mathlib/Tactic/Bound/Init.lean b/Mathlib/Tactic/Bound/Init.lean index a41685bdb3b91e..8168cf288aefd4 100644 --- a/Mathlib/Tactic/Bound/Init.lean +++ b/Mathlib/Tactic/Bound/Init.lean @@ -16,6 +16,6 @@ This module defines the `Bound` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public meta section declare_aesop_rule_sets [Bound] diff --git a/Mathlib/Tactic/Continuity/Init.lean b/Mathlib/Tactic/Continuity/Init.lean index 05428ea6dd0d9c..e988564a6b947d 100644 --- a/Mathlib/Tactic/Continuity/Init.lean +++ b/Mathlib/Tactic/Continuity/Init.lean @@ -16,6 +16,6 @@ This module defines the `Continuous` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public meta section declare_aesop_rule_sets [Continuous] diff --git a/Mathlib/Tactic/Finiteness/Attr.lean b/Mathlib/Tactic/Finiteness/Attr.lean index e6946c319bd774..bb64d9e46af3de 100644 --- a/Mathlib/Tactic/Finiteness/Attr.lean +++ b/Mathlib/Tactic/Finiteness/Attr.lean @@ -10,6 +10,6 @@ public import Aesop.Frontend /-! # Finiteness tactic attribute -/ -set_option linter.privateModule false +public meta section declare_aesop_rule_sets [finiteness] diff --git a/Mathlib/Tactic/FunProp/Attr.lean b/Mathlib/Tactic/FunProp/Attr.lean index 10550960a98fc3..e0e8b89ad02e2f 100644 --- a/Mathlib/Tactic/FunProp/Attr.lean +++ b/Mathlib/Tactic/FunProp/Attr.lean @@ -12,9 +12,7 @@ public import Mathlib.Tactic.FunProp.Theorems ## `funProp` attribute -/ -set_option linter.privateModule false - -meta section +public meta section namespace Mathlib open Lean Meta diff --git a/Mathlib/Tactic/Measurability/Init.lean b/Mathlib/Tactic/Measurability/Init.lean index 16f02034afa7ce..85e8ae3add56fb 100644 --- a/Mathlib/Tactic/Measurability/Init.lean +++ b/Mathlib/Tactic/Measurability/Init.lean @@ -16,6 +16,6 @@ This module defines the `Measurable` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public meta section declare_aesop_rule_sets [Measurable] diff --git a/Mathlib/Topology/Sheaves/Init.lean b/Mathlib/Topology/Sheaves/Init.lean index 2556c0ac7d7595..053c3cdee10982 100644 --- a/Mathlib/Topology/Sheaves/Init.lean +++ b/Mathlib/Topology/Sheaves/Init.lean @@ -16,7 +16,7 @@ visible once the file in which they're declared is imported, so we must put this declaration into its own file. -/ -set_option linter.privateModule false +public section /- to prove subset relations -/ declare_aesop_rule_sets [Restrict] From 7a5e5b4706f978e7d67bc1e22d7941809deed670 Mon Sep 17 00:00:00 2001 From: thorimur <68410468+thorimur@users.noreply.github.com> Date: Sat, 11 Apr 2026 23:57:50 -0400 Subject: [PATCH 054/116] chore: remove unused sections in front of lone `declare_aesop_rule_sets` --- Mathlib/Combinatorics/Matroid/Init.lean | 2 -- Mathlib/Combinatorics/SimpleGraph/Init.lean | 2 -- Mathlib/Data/Finset/Attr.lean | 2 -- Mathlib/Data/Sym/Sym2/Init.lean | 2 -- Mathlib/Tactic/ArithMult/Init.lean | 2 -- Mathlib/Tactic/Bound/Init.lean | 2 -- Mathlib/Tactic/Continuity/Init.lean | 2 -- Mathlib/Tactic/Finiteness/Attr.lean | 2 -- Mathlib/Tactic/Measurability/Init.lean | 2 -- Mathlib/Topology/Sheaves/Init.lean | 2 -- 10 files changed, 20 deletions(-) diff --git a/Mathlib/Combinatorics/Matroid/Init.lean b/Mathlib/Combinatorics/Matroid/Init.lean index 6e434c01bdf627..bf806f06d08923 100644 --- a/Mathlib/Combinatorics/Matroid/Init.lean +++ b/Mathlib/Combinatorics/Matroid/Init.lean @@ -16,6 +16,4 @@ This module defines the `Matroid` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public section - declare_aesop_rule_sets [Matroid] diff --git a/Mathlib/Combinatorics/SimpleGraph/Init.lean b/Mathlib/Combinatorics/SimpleGraph/Init.lean index e33f62ae3c0e25..0928e07666be5f 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Init.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Init.lean @@ -16,6 +16,4 @@ This module defines the `SimpleGraph` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public section - declare_aesop_rule_sets [SimpleGraph] diff --git a/Mathlib/Data/Finset/Attr.lean b/Mathlib/Data/Finset/Attr.lean index 19a757ed46f9aa..a8894132142c32 100644 --- a/Mathlib/Data/Finset/Attr.lean +++ b/Mathlib/Data/Finset/Attr.lean @@ -14,8 +14,6 @@ public import Aesop.Frontend This file defines `finsetNonempty`, an aesop rule set to prove that a given finset is nonempty. -/ -public section - -- `finsetNonempty` rules try to prove that a given finset is nonempty, -- for use in positivity extensions. declare_aesop_rule_sets [finsetNonempty] (default := true) diff --git a/Mathlib/Data/Sym/Sym2/Init.lean b/Mathlib/Data/Sym/Sym2/Init.lean index cda8468ef86fa9..69faa4d163130c 100644 --- a/Mathlib/Data/Sym/Sym2/Init.lean +++ b/Mathlib/Data/Sym/Sym2/Init.lean @@ -16,6 +16,4 @@ visible once the file in which they're declared is imported, so we must put this declaration into its own file. -/ -public section - declare_aesop_rule_sets [Sym2] diff --git a/Mathlib/Tactic/ArithMult/Init.lean b/Mathlib/Tactic/ArithMult/Init.lean index 4c95026124c1a6..4afdad3dd49e0f 100644 --- a/Mathlib/Tactic/ArithMult/Init.lean +++ b/Mathlib/Tactic/ArithMult/Init.lean @@ -16,6 +16,4 @@ This module defines the `IsMultiplicative` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section - declare_aesop_rule_sets [IsMultiplicative] diff --git a/Mathlib/Tactic/Bound/Init.lean b/Mathlib/Tactic/Bound/Init.lean index 8168cf288aefd4..f2a48a6687e866 100644 --- a/Mathlib/Tactic/Bound/Init.lean +++ b/Mathlib/Tactic/Bound/Init.lean @@ -16,6 +16,4 @@ This module defines the `Bound` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section - declare_aesop_rule_sets [Bound] diff --git a/Mathlib/Tactic/Continuity/Init.lean b/Mathlib/Tactic/Continuity/Init.lean index e988564a6b947d..19e4f9da717012 100644 --- a/Mathlib/Tactic/Continuity/Init.lean +++ b/Mathlib/Tactic/Continuity/Init.lean @@ -16,6 +16,4 @@ This module defines the `Continuous` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section - declare_aesop_rule_sets [Continuous] diff --git a/Mathlib/Tactic/Finiteness/Attr.lean b/Mathlib/Tactic/Finiteness/Attr.lean index bb64d9e46af3de..226794663ee9b0 100644 --- a/Mathlib/Tactic/Finiteness/Attr.lean +++ b/Mathlib/Tactic/Finiteness/Attr.lean @@ -10,6 +10,4 @@ public import Aesop.Frontend /-! # Finiteness tactic attribute -/ -public meta section - declare_aesop_rule_sets [finiteness] diff --git a/Mathlib/Tactic/Measurability/Init.lean b/Mathlib/Tactic/Measurability/Init.lean index 85e8ae3add56fb..20debd09a5bf8b 100644 --- a/Mathlib/Tactic/Measurability/Init.lean +++ b/Mathlib/Tactic/Measurability/Init.lean @@ -16,6 +16,4 @@ This module defines the `Measurable` Aesop rule set which is used by the they're declared is imported, so we must put this declaration into its own file. -/ -public meta section - declare_aesop_rule_sets [Measurable] diff --git a/Mathlib/Topology/Sheaves/Init.lean b/Mathlib/Topology/Sheaves/Init.lean index 053c3cdee10982..f5fc267eee2827 100644 --- a/Mathlib/Topology/Sheaves/Init.lean +++ b/Mathlib/Topology/Sheaves/Init.lean @@ -16,7 +16,5 @@ visible once the file in which they're declared is imported, so we must put this declaration into its own file. -/ -public section - /- to prove subset relations -/ declare_aesop_rule_sets [Restrict] From 8568f337c9d994d0b5080c81dba80bde96b17773 Mon Sep 17 00:00:00 2001 From: thorimur <68410468+thorimur@users.noreply.github.com> Date: Sun, 12 Apr 2026 00:00:57 -0400 Subject: [PATCH 055/116] chore: restore `initialize` test for `privateModule` linter with correct wording --- MathlibTest/PrivateModuleLinter/initialize.lean | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MathlibTest/PrivateModuleLinter/initialize.lean b/MathlibTest/PrivateModuleLinter/initialize.lean index 4d7e3a2a7e339e..0cc6d129a209b2 100644 --- a/MathlibTest/PrivateModuleLinter/initialize.lean +++ b/MathlibTest/PrivateModuleLinter/initialize.lean @@ -2,11 +2,9 @@ module import Mathlib.Tactic.Linter.PrivateModule -set_option linter.privateModule false -- Changed in nightly-testing, as this test no longer works. - open Lean --- Should not fire, since `initialize` creates a genuinely public declaration. +-- Should not fire, since `initialize` has effects downstream despite creating a private decl here. initialize pure () /- Check that we have indeed created a declaration, and aren't not linting just due to being an From d49f1edb8c3c52b4d6b64537efdddd7f320cec12 Mon Sep 17 00:00:00 2001 From: thorimur <68410468+thorimur@users.noreply.github.com> Date: Sun, 12 Apr 2026 00:02:11 -0400 Subject: [PATCH 056/116] chore: restore `privateModule` `initialize` test with linter turned on --- MathlibTest/PrivateModuleLinter/initialize.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MathlibTest/PrivateModuleLinter/initialize.lean b/MathlibTest/PrivateModuleLinter/initialize.lean index 0cc6d129a209b2..2b8a212c1dd662 100644 --- a/MathlibTest/PrivateModuleLinter/initialize.lean +++ b/MathlibTest/PrivateModuleLinter/initialize.lean @@ -4,6 +4,8 @@ import Mathlib.Tactic.Linter.PrivateModule open Lean +set_option linter.privateModule true + -- Should not fire, since `initialize` has effects downstream despite creating a private decl here. initialize pure () From 365191c6c9c65a53619deda0d752e5d47de563ef Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sun, 12 Apr 2026 08:42:35 +0000 Subject: [PATCH 057/116] fixes --- scripts/create_deprecated_modules.lean | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/create_deprecated_modules.lean b/scripts/create_deprecated_modules.lean index 9017f4fee82a7f..d17459a8128f45 100644 --- a/scripts/create_deprecated_modules.lean +++ b/scripts/create_deprecated_modules.lean @@ -5,6 +5,7 @@ Authors: Damiano Testa -/ --import Mathlib.Init +import Std.Time.Format import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -- a comment here to test `keepTrailing @@ -49,8 +50,12 @@ It returns just the imports of `fileContent`, including trailing comments if `ke -/ def getHeader (fname fileContent : String) (keepTrailing : Bool) : IO String := do let (stx, _) ← Parser.parseHeader (Parser.mkInputContext fileContent fname) - let stx := if keepTrailing then stx.raw else stx.raw.unsetTrailing - let some substring := stx.getSubstring? | throw <| .userError "No substring: we have a problem!" + let imports := stx.raw.getArg 2 -- extract just the imports list + let imports := if keepTrailing then imports else imports.unsetTrailing + -- Use `withLeading := false` to exclude leading comments (e.g. copyright header) that the + -- parser now attaches to the first token (see leanprover/lean4#12662). + let some substring := imports.getSubstring? (withLeading := false) | + throw <| .userError "No substring: we have a problem!" return substring.toString /-- @@ -374,7 +379,8 @@ the deprecations later on. -- #find_deleted_files 0 /-- -info: import Std.Time.Zoned +info: import Std.Time.Format +import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -/ #guard_msgs in @@ -384,7 +390,8 @@ run_cmd logInfo head /-- -info: import Std.Time.Zoned +info: import Std.Time.Format +import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -- a comment here to test `keepTrailing -/ From 7913a6962ac866777c53bbd9586bada367e78e09 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Mon, 13 Apr 2026 08:20:09 +1000 Subject: [PATCH 058/116] fix from nightly-testing --- scripts/create_deprecated_modules.lean | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/scripts/create_deprecated_modules.lean b/scripts/create_deprecated_modules.lean index 3b0d79fd3b8ebf..17dff24f395335 100644 --- a/scripts/create_deprecated_modules.lean +++ b/scripts/create_deprecated_modules.lean @@ -371,17 +371,10 @@ replaced by the suggestion, which means that you can click on multiple suggestio the deprecations later on. -/ --- #find_deleted_files 0 +#find_deleted_files 0 /-- -info: /- -Copyright (c) 2025 Damiano Testa. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Damiano Testa --/ - ---import Mathlib.Init -import Std.Time.Zoned +info: import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -/ #guard_msgs in @@ -391,14 +384,7 @@ run_cmd logInfo head /-- -info: /- -Copyright (c) 2025 Damiano Testa. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Damiano Testa --/ - ---import Mathlib.Init -import Std.Time.Zoned +info: import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -- a comment here to test `keepTrailing -/ From af85844a19259e2b76e10ac00aa22a0348c31a17 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Mon, 13 Apr 2026 08:24:45 +1000 Subject: [PATCH 059/116] importGraph has been fixed --- lake-manifest.json | 2 +- scripts/lint-style.lean | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 918a1a5ac43321..b3d3a8b9363482 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -25,7 +25,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "86503d416c875fdcf3b6b6c54c22581e96c6bda7", + "rev": "4411c5f89c797401c609b3a946c8874569e69731", "name": "importGraph", "manifestFile": "lake-manifest.json", "inputRev": "main", diff --git a/scripts/lint-style.lean b/scripts/lint-style.lean index 7097007f2de8bf..05b2e645c49a20 100644 --- a/scripts/lint-style.lean +++ b/scripts/lint-style.lean @@ -105,11 +105,7 @@ def missingInitImports (opts : LinterOptions) : IO Nat := do -- Find any file in the Mathlib directory which does not contain any Mathlib import. -- We simply parse `Mathlib.lean`, as CI ensures this file is up to date. - -- Note: `findImportsFromSource` only erases the *first* occurrence of `Init`. - -- On module-system files (such as `Mathlib.lean`), `Lean.parseImports'` may emit - -- `Init` multiple times, so we filter out any remaining occurrences here. - let allModuleNames := (eraseExplicitImports (← findImportsFromSource "Mathlib.lean")).filter - (· != `Init) + let allModuleNames := eraseExplicitImports (← findImportsFromSource "Mathlib.lean") let mut modulesWithoutMathlibImports := #[] let mut importsHeaderLinter := #[] for module in allModuleNames do From 0b824b59da6ab7e9b1d598416f3c07cb8137e3ef Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Mon, 13 Apr 2026 09:33:27 +0000 Subject: [PATCH 060/116] chore: bump to nightly-2026-04-13 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index bca52a66f4273a..eb7023afec000d 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-11 +leanprover/lean4:nightly-2026-04-13 From 7fccdee8587247143421f4aea5bc60035a851340 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Mon, 13 Apr 2026 11:15:00 +0000 Subject: [PATCH 061/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13325 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index a1b37fd9243976..a4a8a9d9a0de9f 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "5a746178d12920eacc8a331c80317e7ffbbee780", + "rev": "09f3c93cdbb79f431c5267e8373be9f331341f76", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13325", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index bbba35493244d0..eb8c895fb557b3 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13325" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" diff --git a/lean-toolchain b/lean-toolchain index eb7023afec000d..00bd7e748c28d0 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-13 +leanprover/lean4-pr-releases:pr-release-13325-8c01b1b From 02083f3e83ec8cf926ae79f9d85b5eed8f2ab1e0 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Mon, 13 Apr 2026 11:57:04 +0000 Subject: [PATCH 062/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13325 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index a4a8a9d9a0de9f..f1adde96a1c498 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "09f3c93cdbb79f431c5267e8373be9f331341f76", + "rev": "6bd6d39000c7c175ed1cc88f00ef682d31be8b6a", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13325", diff --git a/lean-toolchain b/lean-toolchain index 00bd7e748c28d0..4838ce217e5977 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13325-8c01b1b +leanprover/lean4-pr-releases:pr-release-13325-89c4bb1 From 19b8510ad7a020acb1fa66b3e8882cf34dfb829c Mon Sep 17 00:00:00 2001 From: Wojciech Rozowski Date: Mon, 13 Apr 2026 12:58:35 +0000 Subject: [PATCH 063/116] chore: silence simp `varHead` and `varOther` warnings --- Mathlib/Algebra/CharP/Two.lean | 1 + Mathlib/Algebra/Order/Floor/Div.lean | 2 ++ Mathlib/CategoryTheory/Sites/Precoverage.lean | 2 ++ Mathlib/Logic/Embedding/Set.lean | 1 + 4 files changed, 6 insertions(+) diff --git a/Mathlib/Algebra/CharP/Two.lean b/Mathlib/Algebra/CharP/Two.lean index 19803221084e16..225971bc7c3983 100644 --- a/Mathlib/Algebra/CharP/Two.lean +++ b/Mathlib/Algebra/CharP/Two.lean @@ -64,6 +64,7 @@ theorem natCast_cases (n : ℕ) : (n : R) = 0 ∨ (n : R) = 1 := theorem natCast_eq_mod (n : ℕ) : (n : R) = (n % 2 : ℕ) := by simp [natCast_eq_ite, Nat.even_iff] +set_option warning.simp.varHead false in @[scoped simp] theorem ofNat_eq_mod (n : ℕ) [n.AtLeastTwo] : (ofNat(n) : R) = (ofNat(n) % 2 : ℕ) := natCast_eq_mod n diff --git a/Mathlib/Algebra/Order/Floor/Div.lean b/Mathlib/Algebra/Order/Floor/Div.lean index 25998333bb4b4a..523dd9abe57ed2 100644 --- a/Mathlib/Algebra/Order/Floor/Div.lean +++ b/Mathlib/Algebra/Order/Floor/Div.lean @@ -248,6 +248,7 @@ noncomputable instance instFloorDiv : FloorDiv α (ι →₀ β) where zero_floorDiv a := by ext; exact zero_floorDiv _ lemma floorDiv_def (f : ι →₀ β) (a : α) : f ⌊/⌋ a = f.mapRange (· ⌊/⌋ a) (zero_floorDiv _) := rfl +set_option warning.simp.otherHead false in @[norm_cast] lemma coe_floorDiv (f : ι →₀ β) (a : α) : f ⌊/⌋ a = fun i ↦ f i ⌊/⌋ a := rfl @[simp] lemma floorDiv_apply (f : ι →₀ β) (a : α) (i : ι) : (f ⌊/⌋ a) i = f i ⌊/⌋ a := rfl @@ -267,6 +268,7 @@ noncomputable instance instCeilDiv : CeilDiv α (ι →₀ β) where zero_ceilDiv a := by ext; exact zero_ceilDiv _ lemma ceilDiv_def (f : ι →₀ β) (a : α) : f ⌈/⌉ a = f.mapRange (· ⌈/⌉ a) (zero_ceilDiv _) := rfl +set_option warning.simp.otherHead false in @[norm_cast] lemma coe_ceilDiv_def (f : ι →₀ β) (a : α) : f ⌈/⌉ a = fun i ↦ f i ⌈/⌉ a := rfl @[simp] lemma ceilDiv_apply (f : ι →₀ β) (a : α) (i : ι) : (f ⌈/⌉ a) i = f i ⌈/⌉ a := rfl diff --git a/Mathlib/CategoryTheory/Sites/Precoverage.lean b/Mathlib/CategoryTheory/Sites/Precoverage.lean index c0a15ddcefc338..2292a10b1b816d 100644 --- a/Mathlib/CategoryTheory/Sites/Precoverage.lean +++ b/Mathlib/CategoryTheory/Sites/Precoverage.lean @@ -126,6 +126,7 @@ alias mem_coverings_of_isIso := HasIsos.mem_coverings_of_isIso alias sup_mem_coverings := IsStableUnderSup.sup_mem_coverings alias hasPullbacks_of_mem := HasPullbacks.hasPullbacks_of_mem +set_option warning.simp.varHead false in attribute [local simp] Presieve.ofArrows.obj_idx Presieve.ofArrows.hom_idx in lemma mem_coverings_of_isPullback {J : Precoverage C} [IsStableUnderBaseChange J] {ι : Type w} {S : C} {X : ι → C} @@ -146,6 +147,7 @@ lemma mem_coverings_of_isPullback {J : Precoverage C} [IsStableUnderBaseChange J refine le_antisymm (fun Z g ⟨i⟩ ↦ .mk _) fun Z g hg ↦ ?_ exact .mk' (Sum.inl ⟨⟨_, _⟩, hg⟩) (by cat_disch) (by cat_disch) +set_option warning.simp.varHead false in attribute [local simp] Presieve.ofArrows.obj_idx Presieve.ofArrows.hom_idx in lemma comp_mem_coverings {J : Precoverage C} [IsStableUnderComposition J] {ι : Type w} {S : C} {X : ι → C} (f : ∀ i, X i ⟶ S) (hf : Presieve.ofArrows X f ∈ J S) diff --git a/Mathlib/Logic/Embedding/Set.lean b/Mathlib/Logic/Embedding/Set.lean index 1eb4b2947b9212..4036dffb4dc419 100644 --- a/Mathlib/Logic/Embedding/Set.lean +++ b/Mathlib/Logic/Embedding/Set.lean @@ -162,6 +162,7 @@ the natural injection from the sigma-type `(i : ι) × ↑(s i)` to `α`. -/ obtain rfl : i = j := h.eq (not_disjoint_iff.2 ⟨_, hx, hx'⟩) rfl +set_option warning.simp.otherHead false in @[norm_cast] lemma Function.Embedding.coe_sigmaSet {s : ι → Set α} (h) : (Function.Embedding.sigmaSet h : ((i : ι) × s i) → α) = fun x ↦ x.2.1 := rfl From 4462ca1dfc68ff79c8fbc8ea1b35e67ee9aa1d87 Mon Sep 17 00:00:00 2001 From: Wojciech Rozowski Date: Mon, 13 Apr 2026 13:00:54 +0000 Subject: [PATCH 064/116] chore: silence `varHead` warning --- Mathlib/Probability/Kernel/Defs.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mathlib/Probability/Kernel/Defs.lean b/Mathlib/Probability/Kernel/Defs.lean index ca32d6bd9fcb3a..2362506ade3a96 100644 --- a/Mathlib/Probability/Kernel/Defs.lean +++ b/Mathlib/Probability/Kernel/Defs.lean @@ -288,11 +288,13 @@ lemma apply_congr_of_mem_measurableAtom (κ : Kernel α β) {y' y : α} (hy' : y ext s hs exact mem_of_mem_measurableAtom hy' (κ.measurable_coe hs (measurableSet_singleton (κ y s))) rfl +set_option warning.simp.varHead false in @[nontriviality] lemma eq_zero_of_isEmpty_left (κ : Kernel α β) [h : IsEmpty α] : κ = 0 := by ext a exact h.elim a +set_option warning.simp.varHead false in @[nontriviality] lemma eq_zero_of_isEmpty_right (κ : Kernel α β) [IsEmpty β] : κ = 0 := by ext a From 39ef8defdbea5bf33f00bb4b0f7dff70aec6b0d4 Mon Sep 17 00:00:00 2001 From: Wojciech Rozowski Date: Mon, 13 Apr 2026 13:08:29 +0000 Subject: [PATCH 065/116] chore: fix `globalAtrtributeIn` test --- MathlibTest/globalAttributeIn.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/MathlibTest/globalAttributeIn.lean b/MathlibTest/globalAttributeIn.lean index a61961950ef7e2..56ced2d39e8426 100644 --- a/MathlibTest/globalAttributeIn.lean +++ b/MathlibTest/globalAttributeIn.lean @@ -57,6 +57,7 @@ error: Despite the `in`, the attribute ext is added globally to foo please remove the `in` or make this a `local ext` -/ #guard_msgs in +set_option warning.simp.varHead false in attribute [simp, local simp, ext, scoped instance, -simp, -ext] foo in def bar := False From d04433780ffde215071a2aa2a7ae3a939493ea20 Mon Sep 17 00:00:00 2001 From: Wojciech Rozowski Date: Mon, 13 Apr 2026 13:58:48 +0000 Subject: [PATCH 066/116] chore: fix `Archive` build --- Archive/Examples/IfNormalization/Result.lean | 1 + Archive/Imo/Imo2024Q6.lean | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Archive/Examples/IfNormalization/Result.lean b/Archive/Examples/IfNormalization/Result.lean index e76444515c5b42..8af518d298d0c3 100644 --- a/Archive/Examples/IfNormalization/Result.lean +++ b/Archive/Examples/IfNormalization/Result.lean @@ -24,6 +24,7 @@ We add some local simp lemmas so we can unfold the definitions of the normalizat attribute [local simp] normalized hasNestedIf hasConstantIf hasRedundantIf disjoint vars List.disjoint +set_option warning.simp.varHead false in attribute [local simp] apply_ite ite_eq_iff' variable {b : Bool} {f : ℕ → Bool} {i : ℕ} {t e : IfExpr} diff --git a/Archive/Imo/Imo2024Q6.lean b/Archive/Imo/Imo2024Q6.lean index 8e26eb7b9494f6..97d7b6d4ed16dd 100644 --- a/Archive/Imo/Imo2024Q6.lean +++ b/Archive/Imo/Imo2024Q6.lean @@ -55,6 +55,7 @@ lemma Aquaesulian.injective : Function.Injective f := by · exact (h.eq_of_apply_eq_inl he.symm hc).symm · exact h.eq_of_apply_eq_inl he hc +set_option warning.simp.varHead false in @[simp] lemma Aquaesulian.apply_zero : f 0 = 0 := by refine h.injective ?_ @@ -68,6 +69,7 @@ lemma Aquaesulian.apply_neg_apply_add (x : G) : f (-(f x)) + x = 0 := by · rw [add_neg_cancel, h.apply_zero] at hc exact hc.symm +set_option warning.simp.varHead false in @[simp] lemma Aquaesulian.apply_neg_apply (x : G) : f (-(f x)) = -x := by rw [← add_eq_zero_iff_eq_neg] From f74b5ed4f50b31eaaeaf715070690f63c7f3f548 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Mon, 13 Apr 2026 15:14:50 +0000 Subject: [PATCH 067/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13325 --- lake-manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lake-manifest.json b/lake-manifest.json index f1adde96a1c498..501de355f5e18d 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "6bd6d39000c7c175ed1cc88f00ef682d31be8b6a", + "rev": "7b47d455134a2bae3f32350389756a731206c86d", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13325", From 670c0bf48a617ecb4fc1262c782e363872ea09d4 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Mon, 13 Apr 2026 17:11:29 +0000 Subject: [PATCH 068/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13325 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 501de355f5e18d..2a8214015873a8 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "7b47d455134a2bae3f32350389756a731206c86d", + "rev": "6b72ff123eeec697911ff4e1bb2b84af54fbe9e7", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13325", diff --git a/lean-toolchain b/lean-toolchain index 4838ce217e5977..b4b930375c7f7d 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13325-89c4bb1 +leanprover/lean4-pr-releases:pr-release-13325-95ecc71 From 2f4e09cdff59cd5482d13e85f635a2e68101f9d0 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Mon, 13 Apr 2026 22:50:37 +0000 Subject: [PATCH 069/116] fix from nightly-testing --- scripts/create_deprecated_modules.lean | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/create_deprecated_modules.lean b/scripts/create_deprecated_modules.lean index 17dff24f395335..d17459a8128f45 100644 --- a/scripts/create_deprecated_modules.lean +++ b/scripts/create_deprecated_modules.lean @@ -5,6 +5,7 @@ Authors: Damiano Testa -/ --import Mathlib.Init +import Std.Time.Format import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -- a comment here to test `keepTrailing @@ -49,8 +50,12 @@ It returns just the imports of `fileContent`, including trailing comments if `ke -/ def getHeader (fname fileContent : String) (keepTrailing : Bool) : IO String := do let (stx, _) ← Parser.parseHeader (Parser.mkInputContext fileContent fname) - let stx := if keepTrailing then stx.raw else stx.raw.unsetTrailing - let some substring := stx.getSubstring? | throw <| .userError "No substring: we have a problem!" + let imports := stx.raw.getArg 2 -- extract just the imports list + let imports := if keepTrailing then imports else imports.unsetTrailing + -- Use `withLeading := false` to exclude leading comments (e.g. copyright header) that the + -- parser now attaches to the first token (see leanprover/lean4#12662). + let some substring := imports.getSubstring? (withLeading := false) | + throw <| .userError "No substring: we have a problem!" return substring.toString /-- @@ -371,10 +376,11 @@ replaced by the suggestion, which means that you can click on multiple suggestio the deprecations later on. -/ -#find_deleted_files 0 +-- #find_deleted_files 0 /-- -info: import Std.Time.Zoned +info: import Std.Time.Format +import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -/ #guard_msgs in @@ -384,7 +390,8 @@ run_cmd logInfo head /-- -info: import Std.Time.Zoned +info: import Std.Time.Format +import Std.Time.Zoned import Lean.Meta.Tactic.TryThis -- a comment here to test `keepTrailing -/ From d3e9985046e0fdff2fea7541a0d93e65817a87ac Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Tue, 14 Apr 2026 09:27:55 +0000 Subject: [PATCH 070/116] chore: bump to nightly-2026-04-14 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index eb7023afec000d..8db80a7b77a650 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-13 +leanprover/lean4:nightly-2026-04-14 From 606f569015f01c9d4e70974b3be8467f2fc5ab1a Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Wed, 15 Apr 2026 09:28:48 +0000 Subject: [PATCH 071/116] chore: bump to nightly-2026-04-15 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 8db80a7b77a650..b74ced19101876 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-14 +leanprover/lean4:nightly-2026-04-15 From 2edcb2ae255acd756703fc08ea161ef5c84f6921 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Wed, 15 Apr 2026 14:36:00 +0000 Subject: [PATCH 072/116] adapt to lean4#13363: canUnfoldAtMatcher allowlist changes Adapt proofs to lean4#13363 which replaces the transparency bump from `.reducible` to `.instances` in `whnfMatcher` with an explicit allowlist in `canUnfoldAtMatcher`. Class projections that were previously unfolded automatically in match discriminants now need explicit unfolding. --- .../BigOperators/Group/List/Basic.lean | 2 +- Mathlib/Algebra/Group/Defs.lean | 6 +- Mathlib/Algebra/Homology/ExactSequence.lean | 3 +- .../Algebra/Homology/HomologicalComplex.lean | 3 +- .../Algebra/Homology/HomologySequence.lean | 6 +- .../Homology/SpectralObject/Basic.lean | 1 + .../Homology/SpectralObject/Cycles.lean | 2 +- .../Order/GroupWithZero/Canonical.lean | 32 +++++-- Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean | 2 +- .../EllipticCurve/Affine/Point.lean | 13 +-- Mathlib/AlgebraicTopology/MooreComplex.lean | 5 +- .../SimplexCategory/Augmented/Monoidal.lean | 8 +- .../SimplicialSet/Nerve.lean | 4 +- Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 4 +- .../CategoryTheory/Bicategory/Coherence.lean | 27 +++++- .../Bicategory/Functor/LocallyDiscrete.lean | 6 +- .../ComposableArrows/Basic.lean | 54 ++++++++---- .../CategoryTheory/ComposableArrows/One.lean | 9 +- .../ComposableArrows/Three.lean | 1 + .../CategoryTheory/ComposableArrows/Two.lean | 20 +++-- .../Limits/Shapes/Equalizers.lean | 4 +- .../Limits/Shapes/Multiequalizer.lean | 18 +++- .../Monoidal/Free/Coherence.lean | 15 +++- .../DenseSubsite/OneHypercoverDense.lean | 7 +- .../CategoryTheory/Sites/Hypercover/One.lean | 12 ++- Mathlib/CategoryTheory/Sites/Whiskering.lean | 6 +- Mathlib/Computability/RegularExpressions.lean | 11 ++- .../TuringMachine/ToPartrec.lean | 3 +- Mathlib/Data/List/Permutation.lean | 2 +- Mathlib/Data/Nat/Bitwise.lean | 7 +- Mathlib/Data/Num/Lemmas.lean | 2 +- Mathlib/Data/Num/ZNum.lean | 10 +-- Mathlib/Data/Sign/Defs.lean | 6 +- .../Dynamics/Ergodic/Action/OfMinimal.lean | 2 +- Mathlib/ModelTheory/Semantics.lean | 2 +- Mathlib/NumberTheory/Zsqrtd/Basic.lean | 20 ++++- .../UniqueFactorizationDomain/FactorSet.lean | 4 +- .../Valuation/ValuativeRel/Basic.lean | 2 +- Mathlib/SetTheory/Ordinal/Notation.lean | 83 +++++++++++++------ Mathlib/Tactic/NormNum/PowMod.lean | 4 +- lake-manifest.json | 4 +- lakefile.lean | 2 +- lean-toolchain | 2 +- 43 files changed, 305 insertions(+), 131 deletions(-) diff --git a/Mathlib/Algebra/BigOperators/Group/List/Basic.lean b/Mathlib/Algebra/BigOperators/Group/List/Basic.lean index 10b0b3e4b5e08d..c9febf4b348c8e 100644 --- a/Mathlib/Algebra/BigOperators/Group/List/Basic.lean +++ b/Mathlib/Algebra/BigOperators/Group/List/Basic.lean @@ -258,7 +258,7 @@ lemma prod_mul_prod_eq_prod_zipWith_mul_prod_drop : | [], ys => by simp | xs, [] => by simp | x :: xs, y :: ys => by - simp only [drop, zipWith_cons_cons, prod_cons] + simp only [zipWith_cons_cons, prod_cons] conv => lhs; rw [mul_assoc]; right; rw [mul_comm, mul_assoc]; right rw [mul_comm, prod_mul_prod_eq_prod_zipWith_mul_prod_drop xs ys] diff --git a/Mathlib/Algebra/Group/Defs.lean b/Mathlib/Algebra/Group/Defs.lean index 57c7d138e1b351..355684cbc3ad54 100644 --- a/Mathlib/Algebra/Group/Defs.lean +++ b/Mathlib/Algebra/Group/Defs.lean @@ -524,7 +524,11 @@ theorem npowRec'_two_mul {M : Type*} [Semigroup M] [One M] (k : ℕ) (m : M) : match k' with | 0 => rfl | 1 => simp [npowRec'] - | k + 2 => simp [npowRec', ← mul_assoc, ← ih] + | k + 2 => + rw [show 2 * (k + 2) = k + k + 4 from by omega] + simp only [npowRec'] + rw [← ih (k + 1) (by omega), show 2 * (k + 1) = k + k + 2 from by omega] + simp only [npowRec', ← mul_assoc] @[to_additive] theorem npowRec'_mul_comm {M : Type*} [Semigroup M] [One M] {k : ℕ} (k0 : k ≠ 0) (m : M) : diff --git a/Mathlib/Algebra/Homology/ExactSequence.lean b/Mathlib/Algebra/Homology/ExactSequence.lean index 4d45263e13d941..51c41c0a0910a9 100644 --- a/Mathlib/Algebra/Homology/ExactSequence.lean +++ b/Mathlib/Algebra/Homology/ExactSequence.lean @@ -225,8 +225,7 @@ lemma isComplex₂_mk (S : ComposableArrows C 2) (w : S.map' 0 1 ≫ S.map' 1 2 set_option backward.isDefEq.respectTransparency false in lemma _root_.CategoryTheory.ShortComplex.isComplex_toComposableArrows (S : ShortComplex C) : S.toComposableArrows.IsComplex := - -- Disable `Fin.reduceFinMk` because otherwise `Precompose.map_one_succ` does not apply. (https://github.com/leanprover-community/mathlib4/issues/27382) - isComplex₂_mk _ (by simp [-Fin.reduceFinMk]) + isComplex₂_mk _ (by change S.f ≫ S.g = 0; simp [S.zero]) lemma exact₂_iff (S : ComposableArrows C 2) (hS : S.IsComplex) : S.Exact ↔ (S.sc' hS 0 1 2).Exact := by diff --git a/Mathlib/Algebra/Homology/HomologicalComplex.lean b/Mathlib/Algebra/Homology/HomologicalComplex.lean index d5929a25584828..8b825ee6542844 100644 --- a/Mathlib/Algebra/Homology/HomologicalComplex.lean +++ b/Mathlib/Algebra/Homology/HomologicalComplex.lean @@ -729,7 +729,8 @@ lemma mkAux_eq_shortComplex_mk_d_comp_d (n : ℕ) : ShortComplex.mk _ _ ((mk X₀ X₁ X₂ d₀ d₁ s succ).d_comp_d (n + 2) (n + 1) n) := by change ShortComplex.mk _ _ (mkAux X₀ X₁ X₂ d₀ d₁ s succ n).zero = _ dsimp [mk, of, mkAux] - simp + simp only [show n + 2 = n + 1 + 1 from rfl, ↓reduceDIte] + congr 1 <;> exact (Category.id_comp _).symm /-- The isomorphism from `(mk X₀ X₁ X₂ d₀ d₁ s succ).X (n + 3)` that is given by the inductive construction. -/ diff --git a/Mathlib/Algebra/Homology/HomologySequence.lean b/Mathlib/Algebra/Homology/HomologySequence.lean index 62f02c8c68efbe..ddeb6d2fa343d6 100644 --- a/Mathlib/Algebra/Homology/HomologySequence.lean +++ b/Mathlib/Algebra/Homology/HomologySequence.lean @@ -158,8 +158,10 @@ noncomputable def composableArrows₃Functor [CategoryWithHomology C] : HomologicalComplex C c ⥤ ComposableArrows C 3 where obj K := composableArrows₃ K i j map {K L} φ := ComposableArrows.homMk₃ (homologyMap φ i) (opcyclesMap φ i) (cyclesMap φ j) - -- Disable `Fin.reduceFinMk`, otherwise `Precomp.obj_succ` does not fire. (https://github.com/leanprover-community/mathlib4/issues/27382) - (homologyMap φ j) (by simp) (by simp [-Fin.reduceFinMk]) (by simp [-Fin.reduceFinMk]) + (homologyMap φ j) + (by set_option backward.isDefEq.respectTransparency false in simp) + (by set_option backward.isDefEq.respectTransparency false in simp [-Fin.reduceFinMk]) + (by change K.homologyπ j ≫ homologyMap φ j = cyclesMap φ j ≫ L.homologyπ j; simp) end HomologySequence diff --git a/Mathlib/Algebra/Homology/SpectralObject/Basic.lean b/Mathlib/Algebra/Homology/SpectralObject/Basic.lean index 78369c2d7b5773..af2a251831aa40 100644 --- a/Mathlib/Algebra/Homology/SpectralObject/Basic.lean +++ b/Mathlib/Algebra/Homology/SpectralObject/Basic.lean @@ -183,6 +183,7 @@ attribute [reassoc, simp] comp_hom lemma isZero_H_map_mk₁_of_isIso (n : ℤ) {i₀ i₁ : ι} (f : i₀ ⟶ i₁) [IsIso f] : IsZero ((X.H n).obj (mk₁ f)) := by let φ := twoδ₂Toδ₁ f (inv f) (𝟙 i₀) (by simp) ≫ twoδ₁Toδ₀ f (inv f) (𝟙 i₀) + set_option backward.isDefEq.respectTransparency false in have : IsIso φ := by rw [isIso_iff₁] constructor <;> dsimp [φ] <;> infer_instance diff --git a/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean b/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean index 273281c1b83419..e4b56e648dafe9 100644 --- a/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean +++ b/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean @@ -314,7 +314,7 @@ lemma toCycles_cyclesMap (α : mk₂ f g ⟶ mk₂ f' g') (β : mk₁ fg ⟶ mk rw [hβ₀] exact naturality' α 0 1 · dsimp - rw [hβ₁, Category.comp_id, Category.id_comp] + simp [hβ₁] /-- The map `H^n(f) ⟶ H^n(f ≫ g)` factors through `opZ^n(f, g)`. -/ noncomputable def fromOpcycles (n : ℤ) : diff --git a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean index 9cd9d955bb9d22..70f2e9204885c3 100644 --- a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean +++ b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean @@ -419,16 +419,30 @@ end PartialOrder section Lattice +def withZeroSup [Max α] : WithZero α → WithZero α → WithZero α := + Option.merge (· ⊔ ·) + +theorem withZeroSup_zero_zero [Max α] : (withZeroSup (0 : WithZero α) 0) = 0 := rfl +theorem withZeroSup_coe_zero [Max α] (a : α) : (withZeroSup (↑a : WithZero α) 0) = ↑a := rfl +theorem withZeroSup_zero_coe [Max α] (b : α) : (withZeroSup (0 : WithZero α) ↑b) = ↑b := rfl +theorem withZeroSup_coe_coe [Max α] (a b : α) : + (withZeroSup (↑a : WithZero α) ↑b) = ↑(a ⊔ b) := rfl + instance semilatticeSup [SemilatticeSup α] : SemilatticeSup (WithZero α) where - sup - -- note this is `Option.merge`, but with the right defeq when unfolding - | 0, 0 => 0 - | (a : α), 0 => a - | 0, (b : α) => b - | (a : α), (b : α) => ↑(a ⊔ b) - le_sup_left x y := by cases x <;> cases y <;> simp - le_sup_right x y := by cases x <;> cases y <;> simp - sup_le x y z := by cases x <;> cases y <;> cases z <;> simp; simpa using sup_le + sup := withZeroSup + le_sup_left x y := by + cases x <;> cases y <;> + simp [withZeroSup_zero_zero, withZeroSup_coe_zero, withZeroSup_zero_coe, + withZeroSup_coe_coe, WithZero.coe_le_coe, le_sup_left, WithZero.zero_le] + le_sup_right x y := by + cases x <;> cases y <;> + simp [withZeroSup_zero_zero, withZeroSup_coe_zero, withZeroSup_zero_coe, + withZeroSup_coe_coe, WithZero.coe_le_coe, le_sup_right, WithZero.zero_le] + sup_le x y z := by + cases x <;> cases y <;> cases z <;> + simp [withZeroSup_zero_zero, withZeroSup_coe_zero, withZeroSup_zero_coe, + withZeroSup_coe_coe, WithZero.coe_le_coe, WithZero.zero_le] + simpa using sup_le theorem coe_sup [SemilatticeSup α] (a b : α) : ((a ⊔ b : α) : WithZero α) = (a : WithZero α) ⊔ b := rfl diff --git a/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean b/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean index 8199498397b672..4e82eb271011a3 100644 --- a/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean +++ b/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean @@ -324,7 +324,7 @@ theorem one_def : (1 : SkewMonoidAlgebra k G) = single 1 1 := rfl @[simp] theorem coeff_one_one : coeff (1 : SkewMonoidAlgebra k G) 1 = 1 := by - simp only [coeff, toFinsupp_single, Finsupp.single_eq_same] + simp only [coeff, One.one, toFinsupp_single, Finsupp.single_eq_same] theorem coeff_one {a : G} [Decidable (a = 1)] : (1 : SkewMonoidAlgebra k G).coeff a = if a = 1 then 1 else 0 := by diff --git a/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean b/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean index 07376bf4e749af..020d6d845dc986 100644 --- a/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean +++ b/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean @@ -722,12 +722,13 @@ the class of the non-zero fractional ideal `⟨X - x, Y - y⟩` in the ideal cla @[simps] noncomputable def toClass : W.Point →+ Additive (ClassGroup W.CoordinateRing) where toFun P := match P with - | 0 => 0 + | zero => 0 | some _ _ h => ClassGroup.mk <| CoordinateRing.XYIdeal' h map_zero' := rfl map_add' := by rintro (_ | ⟨x₁, y₁, h₁⟩) (_ | ⟨x₂, y₂, h₂⟩) any_goals simp only [← zero_def, zero_add, add_zero] + any_goals rfl by_cases hxy : x₁ = x₂ ∧ y₁ = W.negY x₂ y₂ · simp only [hxy.left, hxy.right, add_of_Y_eq rfl rfl] exact (CoordinateRing.mk_XYIdeal'_neg_mul h₂).symm @@ -793,7 +794,7 @@ variable [Algebra R S] [Algebra R F] [Algebra S F] [IsScalarTower R S F] [Algebr where `W` is defined over a subring of a ring `S`, and `F` and `K` are field extensions of `S`. -/ noncomputable def map : W'⟮F⟯ →+ W'⟮K⟯ where toFun P := match P with - | 0 => 0 + | zero => 0 | some _ _ h => some _ _ <| (baseChange_nonsingular _ _ f.injective).mpr h map_zero' := rfl map_add' := by @@ -801,7 +802,7 @@ noncomputable def map : W'⟮F⟯ →+ W'⟮K⟯ where any_goals rfl by_cases hxy : x₁ = x₂ ∧ y₁ = (W'.baseChange F).toAffine.negY x₂ y₂ · rw [add_of_Y_eq hxy.left hxy.right, - add_of_Y_eq (congr_arg _ hxy.left) <| by rw [hxy.right, baseChange_negY]] + add_of_Y_eq (congr_arg _ hxy.left) <| by rw [hxy.right, baseChange_negY]]; rfl · simpa only [add_some hxy, ← baseChange_addX, ← baseChange_addY, ← baseChange_slope] using (add_some fun h ↦ hxy ⟨f.injective h.1, f.injective (W'.baseChange_negY f .. ▸ h).2⟩).symm @@ -877,9 +878,9 @@ lemma xRep_neg (P : W'.Point) : (-P).xRep = P.xRep := by lemma eq_or_eq_neg_of_xRep_eq_xRep {P Q : W.Point} (h : P.xRep = Q.xRep) : P = Q ∨ P = -Q := by match P, Q with - | 0, 0 => exact .inl rfl - | 0, some .. => simp [xRep] at h - | some .., 0 => simp [xRep] at h + | zero, zero => exact .inl rfl + | zero, some .. => simp [xRep] at h + | some .., zero => simp [xRep] at h | some x₁ .., some x₂ .. => simp only [xRep, Matrix.vecCons_inj, and_true] at h exact X_eq_iff.mp h diff --git a/Mathlib/AlgebraicTopology/MooreComplex.lean b/Mathlib/AlgebraicTopology/MooreComplex.lean index 6c9c9dccd7e163..efd1d5a4c93103 100644 --- a/Mathlib/AlgebraicTopology/MooreComplex.lean +++ b/Mathlib/AlgebraicTopology/MooreComplex.lean @@ -135,7 +135,10 @@ def map (f : X ⟶ Y) : obj X ⟶ obj Y := erw [kernelSubobject_arrow_comp_assoc] rw [zero_comp, comp_zero])) fun n => by - cases n <;> dsimp [objD, objX] <;> cat_disch + cases n <;> + simp only [Nat.reduceAdd, objX_add_one, objX_zero, objD, Fin.isValue, + factorThru_arrow_assoc, Category.assoc] <;> + cat_disch end NormalizedMooreComplex diff --git a/Mathlib/AlgebraicTopology/SimplexCategory/Augmented/Monoidal.lean b/Mathlib/AlgebraicTopology/SimplexCategory/Augmented/Monoidal.lean index 8b98670f95fa1d..72d2d8728c5858 100644 --- a/Mathlib/AlgebraicTopology/SimplexCategory/Augmented/Monoidal.lean +++ b/Mathlib/AlgebraicTopology/SimplexCategory/Augmented/Monoidal.lean @@ -173,10 +173,12 @@ abbrev inr' (x y : SimplexCategory) : y ⟶ tensorObjOf x y := WithInitial.down set_option backward.isDefEq.respectTransparency false in lemma inl'_eval (x y : SimplexCategory) (i : Fin (x.len + 1)) : (inl' x y).toOrderHom i = (i.castAdd _).cast (Nat.succ_add x.len (y.len + 1)) := by - dsimp [inl', inl, MonoidalCategoryStruct.rightUnitor, MonoidalCategoryStruct.whiskerLeft, - tensorHom, WithInitial.down, rightUnitor, tensorObj] ext - simp [OrderEmbedding.toOrderHom] + simp [inl', inl, MonoidalCategoryStruct.rightUnitor, MonoidalCategoryStruct.whiskerLeft, + MonoidalCategoryStruct.tensorUnit, MonoidalCategoryStruct.tensorObj, + tensorUnit, tensorHom, WithInitial.down, rightUnitor, tensorObj, CategoryStruct.id, + CategoryStruct.comp, WithInitial.comp, WithInitial.id, + OrderEmbedding.toOrderHom] set_option backward.isDefEq.respectTransparency false in lemma inr'_eval (x y : SimplexCategory) (i : Fin (y.len + 1)) : diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean index 883e7061c5ce09..0eed2ca162fcb9 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean @@ -61,7 +61,8 @@ lemma nerveMap_app_mk₀ (x : C) : lemma nerveMap_app_mk₁ {x y : C} (f : x ⟶ y) : (nerveMap F).app (op ⦋1⦌) (ComposableArrows.mk₁ f) = ComposableArrows.mk₁ (F.map f) := - ComposableArrows.ext₁ rfl rfl (by simp [nerveMap_app]) + ComposableArrows.ext₁ (by with_unfolding_all rfl) (by with_unfolding_all rfl) + (by simp [nerveMap_app]) end @@ -101,6 +102,7 @@ lemma σ_obj {n : ℕ} (i : Fin (n + 1)) (x : ComposableArrows C n) (j : Fin (n lemma δ₀_eq {x : ComposableArrows C (n + 1)} : (nerve C).δ (0 : Fin (n + 2)) x = x.δ₀ := rfl +set_option backward.isDefEq.respectTransparency false in lemma σ₀_mk₀_eq (x : C) : (nerve C).σ (0 : Fin 1) (.mk₀ x) = .mk₁ (𝟙 x) := ComposableArrows.ext₁ rfl rfl (by simp; rfl) diff --git a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean index 2dc3422652b351..d1715122993869 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean @@ -209,8 +209,8 @@ theorem contDiffWithinAt_infty : theorem ContDiffWithinAt.continuousWithinAt (h : ContDiffWithinAt 𝕜 n f s x) : ContinuousWithinAt f s x := by have := h.of_le (zero_le _) - simp only [ContDiffWithinAt, nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, CharP.cast_eq_zero] - at this + change ∀ m : ℕ, (m : ℕ∞) ≤ 0 → _ at this + simp only [nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, CharP.cast_eq_zero] at this rcases this with ⟨u, hu, p, H⟩ rw [mem_nhdsWithin_insert] at hu exact (H.continuousOn.continuousWithinAt hu.1).mono_of_mem_nhdsWithin hu.2 diff --git a/Mathlib/CategoryTheory/Bicategory/Coherence.lean b/Mathlib/CategoryTheory/Bicategory/Coherence.lean index e816e919a204b5..5b0ce3b8eeb957 100644 --- a/Mathlib/CategoryTheory/Bicategory/Coherence.lean +++ b/Mathlib/CategoryTheory/Bicategory/Coherence.lean @@ -133,6 +133,25 @@ def normalizeIso {a : B} : | _, _, p, Hom.comp f g => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ normalizeIso (normalizeAux p f) g +-- Equation lemmas for `normalizeIso`/`normalizeAux` matching `≫`/`𝟙` +-- (i.e., `CategoryStruct.comp`/`CategoryStruct.id` for `FreeBicategory`) instead of +-- `Hom.comp`/`Hom.id`. Needed because `canUnfoldAtMatcher` no longer unfolds class +-- projections in match discriminants. +@[simp] theorem normalizeAux_comp {a : B} {b c d : FreeBicategory B} + (p : Path a b) (f : b ⟶ c) (g : c ⟶ d) : + normalizeAux p (f ≫ g) = normalizeAux (normalizeAux p f) g := rfl +@[simp] theorem normalizeAux_id {a : B} {b : FreeBicategory B} (p : Path a b) : + normalizeAux p (𝟙 b) = p := rfl +@[simp] theorem normalizeIso_comp {a : B} {b c d : FreeBicategory B} + (p : Path a b) (f : b ⟶ c) (g : c ⟶ d) : + normalizeIso p (f ≫ g) = + (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIso p f) g ≪≫ + normalizeIso (normalizeAux p f) g := rfl +@[simp] theorem normalizeIso_id {a : B} {b : FreeBicategory B} (p : Path a b) : + normalizeIso p (𝟙 b) = ρ_ _ := rfl +@[simp] theorem quot_whisker_left {a b c : FreeBicategory B} (f : a ⟶ b) {g h : b ⟶ c} + (η : Hom₂ g h) : Quot.mk Rel (Hom₂.whisker_left f η) = f ◁ (Quot.mk Rel η) := rfl + /-- Given a 2-morphism between `f` and `g` in the free bicategory, we have the equality `normalizeAux p f = normalizeAux p g`. -/ @@ -163,7 +182,8 @@ theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f simp -- p ≠ nil required! See the docstring of `normalizeAux`. | whisker_left _ _ ih => - dsimp + simp only [normalizeIso_comp, normalizeAux_comp, quot_whisker_left, + Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom] rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih] simp | whisker_right h η' ih => @@ -171,7 +191,10 @@ theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih, comp_whiskerRight] have := dcongr_arg (fun x => (normalizeIso x h).hom) (normalizeAux_congr p (Quot.mk _ η')) dsimp at this; simp [this] - | _ => simp + | _ => + simp only [normalizeIso_comp, normalizeIso_id, normalizeAux_comp, normalizeAux_id, + Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom] + simp -- Not `@[simp]` because it is not in `simp`-normal form. theorem normalizeAux_nil_comp {a b c : B} (f : Hom a b) (g : Hom b c) : diff --git a/Mathlib/CategoryTheory/Bicategory/Functor/LocallyDiscrete.lean b/Mathlib/CategoryTheory/Bicategory/Functor/LocallyDiscrete.lean index bd3385194354e8..64c99a93bb5ccc 100644 --- a/Mathlib/CategoryTheory/Bicategory/Functor/LocallyDiscrete.lean +++ b/Mathlib/CategoryTheory/Bicategory/Functor/LocallyDiscrete.lean @@ -114,7 +114,8 @@ corresponding locally discrete bicategories. def Functor.toPseudofunctor : LocallyDiscrete C ⥤ᵖ (LocallyDiscrete D) := pseudofunctorOfIsLocallyDiscrete (fun ⟨X⟩ ↦ .mk <| F.obj X) (fun ⟨f⟩ ↦ (F.map f).toLoc) - (fun ⟨X⟩ ↦ eqToIso (by simp)) (fun f g ↦ eqToIso (by simp)) + (fun ⟨X⟩ ↦ eqToIso (by simp [CategoryStruct.id])) + (fun ⟨f⟩ ⟨g⟩ ↦ eqToIso (by simp [CategoryStruct.comp])) @[deprecated (since := "2026-02-08")] alias Functor.toPseudoFunctor := Functor.toPseudofunctor @@ -145,7 +146,8 @@ be promoted to a pseudofunctor from `LocallyDiscrete I` to `B`. def Functor.toPseudofunctor' : LocallyDiscrete I ⥤ᵖ B := pseudofunctorOfIsLocallyDiscrete (fun ⟨X⟩ ↦ F.obj X) (fun ⟨f⟩ ↦ F.map f) - (fun ⟨X⟩ ↦ eqToIso (by simp)) (fun f g ↦ eqToIso (by simp)) + (fun ⟨X⟩ ↦ eqToIso (by simp [CategoryStruct.id])) + (fun f g ↦ eqToIso (by obtain ⟨f⟩ := f; obtain ⟨g⟩ := g; simp [CategoryStruct.comp])) @[deprecated (since := "2026-02-08")] alias Functor.toPseudoFunctor' := Functor.toPseudofunctor' diff --git a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean index faeae0816484c6..1de7bb8fa31cac 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean @@ -230,6 +230,8 @@ lemma hom_ext₀ {F G : ComposableArrows C 0} {φ φ' : F ⟶ G} def isoMk₀ {F G : ComposableArrows C 0} (e : F.obj' 0 ≅ G.obj' 0) : F ≅ G where hom := homMk₀ e.hom inv := homMk₀ e.inv + hom_inv_id := by apply hom_ext₀; with_unfolding_all exact e.hom_inv_id + inv_hom_id := by apply hom_ext₀; with_unfolding_all exact e.inv_hom_id lemma isIso_iff₀ {F G : ComposableArrows C 0} (f : F ⟶ G) : IsIso f ↔ IsIso (f.app 0) := by @@ -275,6 +277,18 @@ def isoMk₁ {F G : ComposableArrows C 1} inv := homMk₁ left.inv right.inv (by rw [← cancel_mono right.hom, assoc, assoc, w, right.inv_hom_id, left.inv_hom_id_assoc] apply comp_id) + hom_inv_id := by + apply hom_ext₁ + · change left.hom ≫ left.inv = 𝟙 _ + simp + · change right.hom ≫ right.inv = 𝟙 _ + simp + inv_hom_id := by + apply hom_ext₁ + · change left.inv ≫ left.hom = 𝟙 _ + simp + · change right.inv ≫ right.hom = 𝟙 _ + simp lemma map'_eq_hom₁ (F : ComposableArrows C 1) : F.map' 0 1 = F.hom := rfl @@ -303,10 +317,12 @@ lemma mk₁_comp_eqToHom {X₀ X₁ X₁' : C} (f : X₀ ⟶ X₁) (h : X₁ = X ComposableArrows.mk₁ (f ≫ eqToHom h) = ComposableArrows.mk₁ f := by cat_disch +set_option backward.isDefEq.respectTransparency false in lemma mk₁_hom (X : ComposableArrows C 1) : mk₁ X.hom = X := ext₁ rfl rfl (by simp) +set_option backward.isDefEq.respectTransparency false in /-- The bijection between `ComposableArrows C 1` and `Arrow C`. -/ @[simps] def arrowEquiv : ComposableArrows C 1 ≃ Arrow C where @@ -436,21 +452,21 @@ variable {X₀ X₁ X₂ X₃ X₄ : C} (f : X₀ ⟶ X₁) (g : X₁ ⟶ X₂) /-! These examples are meant to test the good definitional properties of `precomp`, and that `dsimp` can see through. -/ -example : map' (mk₂ f g) 0 1 = f := by dsimp -example : map' (mk₂ f g) 1 2 = g := by dsimp -example : map' (mk₂ f g) 0 2 = f ≫ g := by dsimp -example : (mk₂ f g).hom = f ≫ g := by dsimp -example : map' (mk₂ f g) 0 0 = 𝟙 _ := by dsimp -example : map' (mk₂ f g) 1 1 = 𝟙 _ := by dsimp -example : map' (mk₂ f g) 2 2 = 𝟙 _ := by dsimp - -example : map' (mk₃ f g h) 0 1 = f := by dsimp -example : map' (mk₃ f g h) 1 2 = g := by dsimp -example : map' (mk₃ f g h) 2 3 = h := by dsimp -example : map' (mk₃ f g h) 0 3 = f ≫ g ≫ h := by dsimp -example : (mk₃ f g h).hom = f ≫ g ≫ h := by dsimp -example : map' (mk₃ f g h) 0 2 = f ≫ g := by dsimp -example : map' (mk₃ f g h) 1 3 = g ≫ h := by dsimp +example : map' (mk₂ f g) 0 1 = f := by with_unfolding_all rfl +example : map' (mk₂ f g) 1 2 = g := by with_unfolding_all rfl +example : map' (mk₂ f g) 0 2 = f ≫ g := by with_unfolding_all rfl +example : (mk₂ f g).hom = f ≫ g := by with_unfolding_all rfl +example : map' (mk₂ f g) 0 0 = 𝟙 _ := by with_unfolding_all rfl +example : map' (mk₂ f g) 1 1 = 𝟙 _ := by with_unfolding_all rfl +example : map' (mk₂ f g) 2 2 = 𝟙 _ := by with_unfolding_all rfl + +example : map' (mk₃ f g h) 0 1 = f := by with_unfolding_all rfl +example : map' (mk₃ f g h) 1 2 = g := by with_unfolding_all rfl +example : map' (mk₃ f g h) 2 3 = h := by with_unfolding_all rfl +example : map' (mk₃ f g h) 0 3 = f ≫ g ≫ h := by with_unfolding_all rfl +example : (mk₃ f g h).hom = f ≫ g ≫ h := by with_unfolding_all rfl +example : map' (mk₃ f g h) 0 2 = f ≫ g := by with_unfolding_all rfl +example : map' (mk₃ f g h) 1 3 = g ≫ h := by with_unfolding_all rfl end @@ -624,6 +640,8 @@ def isoMk₂ {f g : ComposableArrows C 2} comp_id, app₀.hom_inv_id_assoc]) (by rw [← cancel_epi app₁.hom, ← reassoc_of% w₁, app₂.hom_inv_id, comp_id, app₁.hom_inv_id_assoc]) + hom_inv_id := by apply hom_ext₂ <;> (with_unfolding_all dsimp; simp) + inv_hom_id := by apply hom_ext₂ <;> (with_unfolding_all dsimp; simp) lemma isIso_iff₂ {F G : ComposableArrows C 2} (f : F ⟶ G) : IsIso f ↔ IsIso (f.app 0) ∧ IsIso (f.app 1) ∧ IsIso (f.app 2) := by @@ -636,6 +654,7 @@ lemma ext₂ {f g : ComposableArrows C 2} (w₁ : f.map' 1 2 = eqToHom h₁ ≫ g.map' 1 2 ≫ eqToHom h₂.symm) : f = g := ext_succ h₀ (ext₁ h₁ h₂ w₁) w₀ +set_option backward.isDefEq.respectTransparency false in lemma mk₂_surjective (X : ComposableArrows C 2) : ∃ (X₀ X₁ X₂ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂), X = mk₂ f₀ f₁ := ⟨_, _, _, X.map' 0 1, X.map' 1 2, ext₂ rfl rfl rfl (by simp) (by simp)⟩ @@ -713,6 +732,7 @@ lemma ext₃ {f g : ComposableArrows C 3} (w₂ : f.map' 2 3 = eqToHom h₂ ≫ g.map' 2 3 ≫ eqToHom h₃.symm) : f = g := ext_succ h₀ (ext₂ h₁ h₂ h₃ w₁ w₂) w₀ +set_option backward.isDefEq.respectTransparency false in lemma mk₃_surjective (X : ComposableArrows C 3) : ∃ (X₀ X₁ X₂ X₃ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃), X = mk₃ f₀ f₁ f₂ := ⟨_, _, _, _, X.map' 0 1, X.map' 1 2, X.map' 2 3, @@ -792,6 +812,7 @@ lemma ext₄ {f g : ComposableArrows C 4} f = g := ext_succ h₀ (ext₃ h₁ h₂ h₃ h₄ w₁ w₂ w₃) w₀ +set_option backward.isDefEq.respectTransparency false in lemma mk₄_surjective (X : ComposableArrows C 4) : ∃ (X₀ X₁ X₂ X₃ X₄ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃) (f₃ : X₃ ⟶ X₄), X = mk₄ f₀ f₁ f₂ f₃ := @@ -874,6 +895,7 @@ lemma ext₅ {f g : ComposableArrows C 5} f = g := ext_succ h₀ (ext₄ h₁ h₂ h₃ h₄ h₅ w₁ w₂ w₃ w₄) w₀ +set_option backward.isDefEq.respectTransparency false in lemma mk₅_surjective (X : ComposableArrows C 5) : ∃ (X₀ X₁ X₂ X₃ X₄ X₅ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃) (f₃ : X₃ ⟶ X₄) (f₄ : X₄ ⟶ X₅), X = mk₅ f₀ f₁ f₂ f₃ f₄ := @@ -950,6 +972,7 @@ def Functor.mapComposableArrows : ComposableArrows C n ⥤ ComposableArrows D n := (whiskeringRight _ _ _).obj G +set_option backward.isDefEq.respectTransparency false in /-- The isomorphism between `(G.mapComposableArrows 1).obj (.mk₁ f)` and `.mk₁ (G.map f)`. -/ @[simps!] @@ -957,6 +980,7 @@ def Functor.mapComposableArrowsObjMk₁Iso {X Y : C} (f : X ⟶ Y) : (G.mapComposableArrows 1).obj (.mk₁ f) ≅ .mk₁ (G.map f) := isoMk₁ (Iso.refl _) (Iso.refl _) +set_option backward.isDefEq.respectTransparency false in /-- The isomorphism between `(G.mapComposableArrows 2).obj (.mk₂ f g)` and `.mk₂ (G.map f) (G.map g)`. -/ @[simps!] diff --git a/Mathlib/CategoryTheory/ComposableArrows/One.lean b/Mathlib/CategoryTheory/ComposableArrows/One.lean index ec776f21ef10e1..32059e67a467d5 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/One.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/One.lean @@ -31,6 +31,7 @@ def functorArrows (i j n : ℕ) (hij : i ≤ j := by lia) (hj : j ≤ n := by li obj S := mk₁ (S.map' i j) map {S S'} φ := homMk₁ (φ.app _) (φ.app _) (φ.naturality _) +set_option backward.isDefEq.respectTransparency false in /-- The natural transformation `functorArrows C i j n ⟶ functorArrows C i' j' n` when `i ≤ i'` and `j ≤ j'`. -/ @[simps] @@ -40,7 +41,13 @@ def mapFunctorArrows (i j i' j' n : ℕ) (_ : j' ≤ n := by lia) : functorArrows C i j n ⟶ functorArrows C i' j' n where app S := homMk₁ (S.map' i i') (S.map' j j') - (by simp [← Functor.map_comp]) + (by change S.map' i j ≫ S.map' j j' = S.map' i i' ≫ S.map' i' j'; simp [← Functor.map_comp]) + naturality {X Y} f := by + apply hom_ext₁ + · change f.app ⟨i, _⟩ ≫ Y.map' i i' = X.map' i i' ≫ f.app ⟨i', _⟩ + simp [← NatTrans.naturality] + · change f.app ⟨j, _⟩ ≫ Y.map' j j' = X.map' j j' ≫ f.app ⟨j', _⟩ + simp [← NatTrans.naturality] end ComposableArrows diff --git a/Mathlib/CategoryTheory/ComposableArrows/Three.lean b/Mathlib/CategoryTheory/ComposableArrows/Three.lean index 8a16c3bc3de166..22122c2124f276 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Three.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Three.lean @@ -35,6 +35,7 @@ variable {C : Type u} [Category.{v} C] {i j k l : C} (f₁ : i ⟶ j) (f₂ : j ⟶ k) (f₃ : k ⟶ l) (f₁₂ : i ⟶ k) (f₂₃ : j ⟶ l) +set_option backward.isDefEq.respectTransparency false in /-- The morphism `mk₂ f₁ f₂ ⟶ mk₂ f₁ f₂₃` when `f₂ ≫ f₃ = f₂₃`. -/ def threeδ₃Toδ₂ (h₂₃ : f₂ ≫ f₃ = f₂₃ := by cat_disch) : mk₂ f₁ f₂ ⟶ mk₂ f₁ f₂₃ := diff --git a/Mathlib/CategoryTheory/ComposableArrows/Two.lean b/Mathlib/CategoryTheory/ComposableArrows/Two.lean index 698a59be84e46d..7fc2379f5d5581 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Two.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Two.lean @@ -31,11 +31,13 @@ section variable {C : Type*} [Category* C] {i j k : C} (f : i ⟶ j) (g : j ⟶ k) (fg : i ⟶ k) +set_option backward.isDefEq.respectTransparency false in /-- The morphism `mk₁ f ⟶ mk₁ fg` when `f ≫ g = fg` for some morphism `g`. -/ def twoδ₂Toδ₁ (h : f ≫ g = fg := by cat_disch) : mk₁ f ⟶ mk₁ fg := homMk₁ (𝟙 _) g +set_option backward.isDefEq.respectTransparency false in /-- The morphism `mk₁ fg ⟶ mk₁ g` when `f ≫ g = fg` for some morphism `f`. -/ def twoδ₁Toδ₀ (h : f ≫ g = fg := by cat_disch) : mk₁ fg ⟶ mk₁ g := @@ -45,27 +47,29 @@ variable (h : f ≫ g = fg) @[simp] lemma twoδ₂Toδ₁_app_zero : - (twoδ₂Toδ₁ f g fg h).app 0 = 𝟙 _ := rfl + (twoδ₂Toδ₁ f g fg h).app 0 = 𝟙 _ := by with_unfolding_all rfl @[simp] lemma twoδ₂Toδ₁_app_one : - (twoδ₂Toδ₁ f g fg h).app 1 = g := rfl + (twoδ₂Toδ₁ f g fg h).app 1 = g := by with_unfolding_all rfl @[simp] lemma twoδ₁Toδ₀_app_zero : - (twoδ₁Toδ₀ f g fg h).app 0 = f := rfl + (twoδ₁Toδ₀ f g fg h).app 0 = f := by with_unfolding_all rfl @[simp] lemma twoδ₁Toδ₀_app_one : - (twoδ₁Toδ₀ f g fg h).app 1 = 𝟙 _ := rfl + (twoδ₁Toδ₀ f g fg h).app 1 = 𝟙 _ := by with_unfolding_all rfl +set_option backward.isDefEq.respectTransparency false in instance [IsIso g] : IsIso (twoδ₂Toδ₁ f g fg h) := by - rw [isIso_iff₁] - constructor <;> dsimp <;> infer_instance + rw [isIso_iff₁, twoδ₂Toδ₁_app_zero, twoδ₂Toδ₁_app_one] + exact ⟨inferInstance, ‹_›⟩ +set_option backward.isDefEq.respectTransparency false in instance [IsIso f] : IsIso (twoδ₁Toδ₀ f g fg h) := by - rw [isIso_iff₁] - constructor <;> dsimp <;> infer_instance + rw [isIso_iff₁, twoδ₁Toδ₀_app_zero, twoδ₁Toδ₀_app_one] + exact ⟨‹_›, inferInstance⟩ end diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean index 42fb69b209c099..fb855ffc12155f 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean @@ -227,7 +227,9 @@ def parallelPair (f g : X ⟶ Y) : WalkingParallelPair ⥤ C where | right => g -- `sorry` can cope with this, but it's too slow: map_comp := by - rintro _ _ _ ⟨⟩ g <;> cases g <;> simp + rintro _ _ _ ⟨⟩ g <;> cases g <;> + dsimp only [CategoryStruct.comp, CategoryStruct.id, WalkingParallelPairHom.comp] <;> + first | rfl | simp @[simp] theorem parallelPair_obj_zero (f g : X ⟶ Y) : (parallelPair f g).obj zero = X := rfl diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean index 6eab05ecb90c7b..7906be4f02c84b 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean @@ -541,7 +541,9 @@ def ofι {J : MulticospanShape.{w, w'}} (I : MulticospanIndex J C) | WalkingMulticospan.right b => ι (J.fst b) ≫ I.fst b naturality := by rintro (_ | _) (_ | _) (_ | _ | _) <;> - dsimp <;> simp only [Category.id_comp, Category.comp_id] + simp only [WalkingMulticospan.Hom.id_eq_id, + Functor.map_id, Functor.const_obj_map, Category.comp_id] <;> + dsimp <;> simp only [Category.id_comp] apply w } @[simp] @@ -659,10 +661,18 @@ def ofPiFork | WalkingMulticospan.right _ => a.ι ≫ I.fstPiMapOfIsLimit c hd ≫ d.proj _ π.naturality := by rintro (_ | _) (_ | _) (_ | _ | _) - · simp - · simp + -- left.left.id + · simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id, + Functor.const_obj_map, Category.comp_id] + exact Category.id_comp _ + -- left.right.fst + · dsimp; simp [MulticospanIndex.fstPiMapOfIsLimit_proj] + -- left.right.snd · dsimp; rw [a.condition_assoc]; simp - · simp + -- right.right.id + · simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id, + Functor.const_obj_map, Category.comp_id] + exact Category.id_comp _ @[simp] theorem ofPiFork_ι (a : Fork (I.fstPiMapOfIsLimit c hd) (I.sndPiMapOfIsLimit c hd)) (i) : diff --git a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean index 264d9b44912b90..065c4cffb89189 100644 --- a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean +++ b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean @@ -193,6 +193,15 @@ def normalizeIsoApp' : | tensor X Y, n => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' X n) Y ≪≫ normalizeIsoApp' _ _ +-- Equation lemmas for `normalizeIsoApp'` matching `⊗`/`𝟙_` instead of `tensor`/`unit`. +-- Needed because `canUnfoldAtMatcher` no longer unfolds class projections in match discriminants. +@[simp] theorem normalizeIsoApp'_tensor (X Y : F C) (n : NormalMonoidalObject C) : + normalizeIsoApp' C (X ⊗ Y) n = + (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' C X n) Y ≪≫ + normalizeIsoApp' C Y _ := rfl +@[simp] theorem normalizeIsoApp'_unit (n : NormalMonoidalObject C) : + normalizeIsoApp' C (𝟙_ (F C)) n = ρ_ _ := rfl + theorem normalizeIsoApp_eq : ∀ (X : F C) (n : N C), normalizeIsoApp C X n = normalizeIsoApp' C X n.as | of _, _ => rfl @@ -252,18 +261,18 @@ theorem normalize_naturality (n : NormalMonoidalObject C) {X Y : F C} (f : X ⟶ case comp f g ihf ihg => simp [ihg, reassoc_of% (ihf _)] case whiskerLeft X' X Y f ih => intro n - dsimp only [normalizeObj_tensor, normalizeIsoApp', tensor_eq_tensor, Iso.trans_hom, + simp only [normalizeObj_tensor, normalizeIsoApp'_tensor, Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom, Function.comp_apply, inclusion_obj] rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih] simp case whiskerRight X Y h η' ih => intro n - dsimp only [normalizeObj_tensor, normalizeIsoApp', tensor_eq_tensor, Iso.trans_hom, + simp only [normalizeObj_tensor, normalizeIsoApp'_tensor, Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom, Function.comp_apply, inclusion_obj] rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih] have := dcongr_arg (fun x => (normalizeIsoApp' C η' x).hom) (normalizeObj_congr n h) simp [this] - all_goals simp + all_goals simp [normalizeIsoApp'_tensor, normalizeIsoApp'_unit] end diff --git a/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean b/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean index f8304807efa444..0d8a00a6f814a9 100644 --- a/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean +++ b/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean @@ -106,8 +106,11 @@ def multicospanMap {P Q : C₀ᵒᵖ ⥤ A} (f : P ⟶ Q) : | WalkingMulticospan.left i => f.app _ | WalkingMulticospan.right j => f.app _ naturality := by - rintro (i₁ | j₁) (i₂ | j₂) (_ | _) - all_goals simp + rintro (i₁ | j₁) (i₂ | j₂) (_ | _) <;> + simp only [multicospanIndex, + MulticospanIndex.multicospan, + Category.id_comp, Category.comp_id, + f.naturality] /-- The natural isomorphism between the diagrams attached to `data : F.PreOneHypercoverDenseData X` that are induced by isomorphisms in `C₀ᵒᵖ ⥤ A`. -/ diff --git a/Mathlib/CategoryTheory/Sites/Hypercover/One.lean b/Mathlib/CategoryTheory/Sites/Hypercover/One.lean index b8c287e46da5ef..45b018cc96f8bb 100644 --- a/Mathlib/CategoryTheory/Sites/Hypercover/One.lean +++ b/Mathlib/CategoryTheory/Sites/Hypercover/One.lean @@ -748,11 +748,15 @@ def Hom.mapMulticospan {E : PreOneHypercover.{w} S} {F : PreOneHypercover.{w'} S | .id _ => .id _ | .fst i => WalkingMulticospan.Hom.fst (J := F.multicospanShape) (f.s₁' i) | .snd i => WalkingMulticospan.Hom.snd (J := F.multicospanShape) (f.s₁' i) - map_id := by simp + map_id + | .left _ => rfl + | .right _ => rfl map_comp - | .id _, _ => by simp - | .fst _, .id _ => by simp - | .snd _, .id _ => by simp + | .id _, _ => by simp only [WalkingMulticospan.Hom.id_eq_id, Category.id_comp] + | .fst _, .id _ => by + simp only [WalkingMulticospan.Hom.id_eq_id, Category.comp_id] + | .snd _, .id _ => by + simp only [WalkingMulticospan.Hom.id_eq_id, Category.comp_id] set_option backward.isDefEq.respectTransparency false in /-- Isomorphic pre-`1`-hypercovers have equivalent multifork index categories. -/ diff --git a/Mathlib/CategoryTheory/Sites/Whiskering.lean b/Mathlib/CategoryTheory/Sites/Whiskering.lean index 83b51123e28606..53f3a3b072250b 100644 --- a/Mathlib/CategoryTheory/Sites/Whiskering.lean +++ b/Mathlib/CategoryTheory/Sites/Whiskering.lean @@ -116,8 +116,10 @@ def multicospanComp : (S.index (P ⋙ F)).multicospan ≅ (S.index P).multicospa | WalkingMulticospan.left _ => Iso.refl _ | WalkingMulticospan.right _ => Iso.refl _) (by - rintro (a | b) (a | b) (f | f | f) - all_goals cat_disch) + rintro (a | b) (a | b) (f | f | f) <;> + simp only [WalkingMulticospan.Hom.id_eq_id, Iso.refl_hom, Category.id_comp, + Category.comp_id, Functor.map_id] <;> + dsimp [CategoryStruct.comp] <;> simp) /-- Mapping the multifork associated to a cover `S : J.Cover X` and a presheaf `P` with respect to a functor `F` is isomorphic (upto a natural isomorphism of the underlying functors) diff --git a/Mathlib/Computability/RegularExpressions.lean b/Mathlib/Computability/RegularExpressions.lean index f1f698c89062b7..dd7036974a93e9 100644 --- a/Mathlib/Computability/RegularExpressions.lean +++ b/Mathlib/Computability/RegularExpressions.lean @@ -137,6 +137,13 @@ def matchEpsilon : RegularExpression α → Bool | P * Q => P.matchEpsilon && Q.matchEpsilon | star _P => true +@[simp] +theorem matchEpsilon_zero : matchEpsilon (0 : RegularExpression α) = false := by + change matchEpsilon zero = false; rfl + +theorem matchEpsilon_one : matchEpsilon (1 : RegularExpression α) = true := by + change matchEpsilon epsilon = true; rfl + section DecidableEq variable [DecidableEq α] @@ -182,10 +189,10 @@ def rmatch : RegularExpression α → List α → Bool @[simp] theorem zero_rmatch (x : List α) : rmatch 0 x = false := by - induction x <;> simp [rmatch, matchEpsilon, *] + induction x <;> simp [rmatch, matchEpsilon_zero, *] theorem one_rmatch_iff (x : List α) : rmatch 1 x ↔ x = [] := by - induction x <;> simp [rmatch, matchEpsilon, *] + induction x <;> simp [rmatch, matchEpsilon_one, *] theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by rcases x with - | ⟨_, x⟩ diff --git a/Mathlib/Computability/TuringMachine/ToPartrec.lean b/Mathlib/Computability/TuringMachine/ToPartrec.lean index 7ac1eb9c5932a7..5440109fbb4d7a 100644 --- a/Mathlib/Computability/TuringMachine/ToPartrec.lean +++ b/Mathlib/Computability/TuringMachine/ToPartrec.lean @@ -789,7 +789,8 @@ theorem pred_ok (q₁ q₂ s v) (c d : List Γ') : ∃ s', simp only [trList, trNat.eq_1, trNum, Nat.cast_succ, Num.add_one, Num.succ, List.tail_cons, List.headI_cons] rcases (n : Num) with - | a - · simp only [trPosNum, Num.succ', List.singleton_append, List.nil_append] + · simp only [show (1 : PosNum) = PosNum.one from rfl, + trPosNum, Num.succ', List.singleton_append, List.nil_append] refine TransGen.head rfl ?_ rw [tr]; simp only [pop', TM2.stepAux] convert unrev_ok using 2 diff --git a/Mathlib/Data/List/Permutation.lean b/Mathlib/Data/List/Permutation.lean index 324cfbf78b5b3f..fd384a7bbab131 100644 --- a/Mathlib/Data/List/Permutation.lean +++ b/Mathlib/Data/List/Permutation.lean @@ -278,7 +278,7 @@ theorem length_permutationsAux : refine permutationsAux.rec (by simp) ?_ intro t ts is IH1 IH2 have IH2 : length (permutationsAux is nil) + 1 = is.length ! := by simpa using IH2 - simp only [factorial, Nat.mul_comm, add_eq] at IH1 + simp only [List.length_cons, factorial, Nat.mul_comm, add_eq] at IH1 rw [permutationsAux_cons, length_foldr_permutationsAux2' _ _ _ _ _ fun l m => (perm_of_mem_permutations m).length_eq, permutations, length, length, IH2, Nat.succ_add, Nat.factorial_succ, Nat.mul_comm (_ + 1), diff --git a/Mathlib/Data/Nat/Bitwise.lean b/Mathlib/Data/Nat/Bitwise.lean index 6d984e98f7c0d7..06d2fef267ecb8 100644 --- a/Mathlib/Data/Nat/Bitwise.lean +++ b/Mathlib/Data/Nat/Bitwise.lean @@ -356,17 +356,22 @@ theorem xor_range (n : ℕ) : (List.range (n + 1)).foldl (· ^^^ ·) 0 = rw [List.range_succ, List.foldl_append, ih, ← Fin.ofNat_add, List.foldl_cons, List.foldl_nil] match h : Fin.ofNat 4 n with | 0 => - rw [Fin.zero_add, ← xor_one_of_even <| even_iff.mpr ?_, xor_xor_cancel_left] + rw [Fin.zero_add] + simp only [OfNat.ofNat] + rw [← xor_one_of_even <| even_iff.mpr ?_, xor_xor_cancel_left] rw [← @mod_mod_of_dvd _ 4 _ <| by simp, ← Fin.val_ofNat 4, h] rfl | 1 => + simp only [OfNat.ofNat, Fin.ofNat, Nat.reduceMod, Fin.add_def] rw [Nat.xor_comm] refine xor_one_of_even <| even_iff.mpr ?_ rw [add_mod, ← @mod_mod_of_dvd _ 4 n <| by simp, ← Fin.val_ofNat 4, h] rfl | 2 => + simp only [OfNat.ofNat, Fin.ofNat, Nat.reduceMod, Fin.add_def] apply Nat.xor_self | 3 => + simp only [OfNat.ofNat, Fin.ofNat, Nat.reduceMod, Fin.add_def] apply zero_xor lemma shiftLeft_lt {x n m : ℕ} (h : x < 2 ^ n) : x <<< m < 2 ^ (n + m) := by diff --git a/Mathlib/Data/Num/Lemmas.lean b/Mathlib/Data/Num/Lemmas.lean index e509b2f4ebf402..899b09807a44c4 100644 --- a/Mathlib/Data/Num/Lemmas.lean +++ b/Mathlib/Data/Num/Lemmas.lean @@ -210,7 +210,7 @@ theorem ofNat'_bit (b n) : ofNat' (Nat.bit b n) = cond b Num.bit1 Num.bit0 (ofNa Nat.binaryRec_eq _ _ (.inl rfl) @[simp] -theorem ofNat'_one : Num.ofNat' 1 = 1 := by simp [Num.ofNat', Num.bit1] +theorem ofNat'_one : Num.ofNat' 1 = 1 := by decide theorem bit1_succ : ∀ n : Num, n.bit1.succ = n.succ.bit0 | 0 => rfl diff --git a/Mathlib/Data/Num/ZNum.lean b/Mathlib/Data/Num/ZNum.lean index 1b72fb0c3fea1d..d80dc8453d95c2 100644 --- a/Mathlib/Data/Num/ZNum.lean +++ b/Mathlib/Data/Num/ZNum.lean @@ -110,7 +110,7 @@ theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = (n : α) @[simp, norm_cast] theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = ((n : α) + n) + 1 - | 0 => by simp [ZNum.bit1] + | 0 => by change ((ZNum.zero).bit1 : α) = _; simp [ZNum.bit1] | pos p => by rw [ZNum.bit1, cast_pos, cast_pos]; rfl | neg p => by rw [ZNum.bit1, cast_neg, cast_neg] @@ -312,9 +312,7 @@ theorem ofInt'_neg : ∀ n : ℤ, ofInt' (-n) = -ofInt' n | (n + 1 : ℕ) => show Num.toZNumNeg _ = -Num.toZNum _ by rw [Num.zneg_toZNum] theorem of_to_int' : ∀ n : ZNum, ZNum.ofInt' n = n - | 0 => by - dsimp [ofInt', cast_zero] - simp only [Num.ofNat'_zero, Num.toZNum] + | 0 => rfl | pos a => by rw [cast_pos, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; rfl | neg a => by rw [cast_neg, ofInt'_neg, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; rfl @@ -575,7 +573,7 @@ protected theorem div_zero (n : Num) : n / 0 = 0 := show n.div 0 = 0 by cases n · rfl - · simp [Num.div] + · change (Num.pos _).div Num.zero = 0; simp [Num.div] @[simp, norm_cast] theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d @@ -589,7 +587,7 @@ protected theorem mod_zero (n : Num) : n % 0 = n := show n.mod 0 = n by cases n · rfl - · simp [Num.mod] + · change (Num.pos _).mod Num.zero = Num.pos _; simp [Num.mod] @[simp, norm_cast] theorem mod_to_nat : ∀ n d, ((n % d : Num) : ℕ) = n % d diff --git a/Mathlib/Data/Sign/Defs.lean b/Mathlib/Data/Sign/Defs.lean index dd542a5dbcf3f1..dfb28da0cb85e9 100644 --- a/Mathlib/Data/Sign/Defs.lean +++ b/Mathlib/Data/Sign/Defs.lean @@ -130,9 +130,9 @@ def fin3Equiv : SignType ≃* Fin 3 where left_inv a := by cases a <;> rfl right_inv a := match a with - | ⟨0, _⟩ => by simp - | ⟨1, _⟩ => by simp - | ⟨2, _⟩ => by simp + | ⟨0, _⟩ => by decide +revert + | ⟨1, _⟩ => by decide +revert + | ⟨2, _⟩ => by decide +revert map_mul' a b := by cases a <;> cases b <;> rfl diff --git a/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean b/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean index cf3de1bd7c6146..dfe13fa75c649a 100644 --- a/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean +++ b/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean @@ -162,7 +162,7 @@ theorem DenseRange.zpow_of_ergodic_mul_left [OpensMeasurableSpace G] ∃ V : Set G, 1 ∈ V ∧ IsOpen V ∧ ∀ x ∈ V, ∀ y ∈ V, ∀ m : ℤ, g ^ m ≠ a * x / y := by rw [← mem_compl_iff, ← interior_compl, mem_interior_iff_mem_nhds] at h have : Tendsto (fun (x, y) ↦ a * x / y) (𝓝 1) (𝓝 a) := - Continuous.tendsto' (by fun_prop) _ _ (by simp) + Continuous.tendsto' (by fun_prop) _ _ (by simp [One.one]) rw [nhds_prod_eq] at this simpa [(nhds_basis_opens (1 : G)).prod_self.mem_iff, prod_subset_iff, and_assoc] using this h set s := ⋃ m : ℤ, g ^ m • V diff --git a/Mathlib/ModelTheory/Semantics.lean b/Mathlib/ModelTheory/Semantics.lean index bb1ec0f9e3e375..36f5a3fceb96e5 100644 --- a/Mathlib/ModelTheory/Semantics.lean +++ b/Mathlib/ModelTheory/Semantics.lean @@ -272,7 +272,7 @@ theorem realize_top : (⊤ : L.BoundedFormula α l).Realize v xs ↔ True := by @[simp] theorem realize_inf : (φ ⊓ ψ).Realize v xs ↔ φ.Realize v xs ∧ ψ.Realize v xs := by - simp [Realize] + simp [Realize, Min.min] @[simp] theorem realize_foldr_inf (l : List (L.BoundedFormula α n)) (v : α → M) (xs : Fin n → M) : diff --git a/Mathlib/NumberTheory/Zsqrtd/Basic.lean b/Mathlib/NumberTheory/Zsqrtd/Basic.lean index 25a68986289d3b..438b621e676dfe 100644 --- a/Mathlib/NumberTheory/Zsqrtd/Basic.lean +++ b/Mathlib/NumberTheory/Zsqrtd/Basic.lean @@ -639,10 +639,22 @@ open Int in theorem le_arch (a : ℤ√d) : ∃ n : ℕ, a ≤ n := by obtain ⟨x, y, (h : a ≤ ⟨x, y⟩)⟩ : ∃ x y : ℕ, Nonneg (⟨x, y⟩ + -a) := match -a with - | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by trivial⟩ - | ⟨Int.ofNat x, -[y+1]⟩ => ⟨0, y + 1, by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg]⟩ - | ⟨-[x+1], Int.ofNat y⟩ => ⟨x + 1, 0, by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg]⟩ - | ⟨-[x+1], -[y+1]⟩ => ⟨x + 1, y + 1, by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg]⟩ + | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by + change Nonneg ⟨_, _⟩; simp [Nonneg, Nonnegg]⟩ + | ⟨Int.ofNat x, -[y+1]⟩ => ⟨0, y + 1, by + simp only [Nonneg, Nonnegg, Nat.cast_zero, ofNat_eq_natCast, zero_add, + Nat.cast_add, Nat.cast_one, negSucc_eq, neg_add_rev, reduceNeg, + add_assoc, add_neg_cancel_left, add_neg_cancel] + trivial⟩ + | ⟨-[x+1], Int.ofNat y⟩ => ⟨x + 1, 0, by + simp only [Nonneg, Nonnegg, Nat.cast_add, Nat.cast_one, negSucc_eq, + neg_add_rev, reduceNeg, add_assoc, add_neg_cancel_left, add_neg_cancel, + Nat.cast_zero, ofNat_eq_natCast, zero_add] + trivial⟩ + | ⟨-[x+1], -[y+1]⟩ => ⟨x + 1, y + 1, by + simp only [Nonneg, Nonnegg, Nat.cast_add, Nat.cast_one, negSucc_eq, + neg_add_rev, reduceNeg, add_assoc, add_neg_cancel_left, add_neg_cancel] + trivial⟩ refine ⟨x + d * y, h.trans ?_⟩ change Nonneg ⟨↑x + d * y - ↑x, 0 - ↑y⟩ rcases y with - | y diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean index 930937a54a7d5b..d2915658b18e7b 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean @@ -122,7 +122,9 @@ theorem count_some (hp : Irreducible p) (s : Multiset _) : @[simp] theorem count_zero (hp : Irreducible p) : count p (0 : FactorSet α) = 0 := by - simp only [count, dif_pos hp, bcount, Multiset.count_zero] + simp only [count, dif_pos hp, bcount] + change Multiset.count _ 0 = 0 + simp only [Multiset.count_zero] theorem count_reducible (hp : ¬Irreducible p) : count p = 0 := dif_neg hp diff --git a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean index 162e0f42544bc5..0d4050e3116d44 100644 --- a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean +++ b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean @@ -1317,7 +1317,7 @@ variable (A B) in def mapPosSubmonoid : posSubmonoid A →* posSubmonoid B where toFun := fun ⟨a,ha⟩ => ⟨algebraMap _ _ a, by simpa only [posSubmonoid_def, ← (algebraMap A B).map_zero, vlt_iff_vlt] using ha⟩ - map_one' := by simp + map_one' := by simp [One.one] map_mul' := by simp variable (A) in diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index 1db13c525f0771..3387a58a2c0926 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -54,6 +54,9 @@ instance : Zero ONote := theorem zero_def : zero = 0 := rfl +-- With matchwhnf changes, Zero.zero doesn't unfold in match discriminants. +theorem zero_zero_eq : (Zero.zero : ONote) = zero := rfl + instance : Inhabited ONote := ⟨0⟩ @@ -61,6 +64,8 @@ instance : Inhabited ONote := instance : One ONote := ⟨oadd 0 1 0⟩ +theorem one_one_eq : (One.one : ONote) = oadd 0 1 0 := rfl + /-- Notation for ω -/ def omega : ONote := oadd 1 1 0 @@ -70,6 +75,7 @@ noncomputable def repr : ONote → Ordinal.{0} | 0 => 0 | oadd e n a => ω ^ repr e * n + repr a @[simp] theorem repr_zero : repr 0 = 0 := rfl +@[simp] theorem repr_zero' : repr zero = 0 := rfl attribute [simp] repr.eq_1 repr.eq_2 set_option backward.privateInPublic true in @@ -134,6 +140,11 @@ instance : WellFoundedRelation ONote := instance (priority := low) nat (n : ℕ) : OfNat ONote n where ofNat := ofNat n +-- Unfold the OfNat class projection for ONote to the concrete `ofNat` function. +-- Needed because class projections no longer unfold in match discriminants. +theorem ofNat_unfold (n : ℕ) : @OfNat.ofNat ONote n (nat n) = ofNat n := rfl + + @[simp 1200] theorem ofNat_one : ofNat 1 = 1 := rfl @[simp] theorem repr_ofNat (n : ℕ) : repr (ofNat n) = n := by cases n <;> simp @@ -431,15 +442,16 @@ theorem repr_add : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ + o₂) = rep conv at nf => simp [HAdd.hAdd, Add.add] conv in _ + o => simp [HAdd.hAdd, Add.add] rcases h : add a o with - | ⟨e', n', a'⟩ <;> - simp only [add, addAux, h'.symm, h, add_assoc, repr] at nf h₁ ⊢ + simp only [add, addAux, h'.symm, h, add_assoc, repr, repr_zero] at nf h₁ ⊢ have := h₁.fst; haveI := nf.fst; have ee := cmp_compares e e' cases he : cmp e e' <;> simp only [he, Ordering.compares_gt, Ordering.compares_lt, Ordering.compares_eq, repr, gt_iff_lt, PNat.add_coe, Nat.cast_add] at ee ⊢ · rw [← add_assoc, @add_of_omega0_opow_le _ (repr e') (ω ^ repr e' * (n' : ℕ))] · have := (h₁.below_of_lt ee).repr_lt - unfold repr at this - cases he' : e' <;> simp only [he', zero_def, opow_zero, repr, gt_iff_lt] at this ⊢ <;> - exact lt_of_le_of_lt le_self_add this + simp only [repr] at this + cases he' : e' <;> + simp only [he', zero_def, opow_zero, repr, repr_zero, gt_iff_lt] at this ⊢ <;> + exact lt_of_le_of_lt le_self_add this · simpa using (mul_le_mul_iff_right₀ <| opow_pos (repr e') omega0_pos).2 (Nat.cast_le.2 n'.pos) · rw [ee, ← add_assoc, ← mul_add] @@ -555,8 +567,9 @@ theorem repr_mul : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ * o₂) = rep simpa using (mul_le_mul_iff_right₀ <| opow_pos _ omega0_pos).2 (Nat.cast_le.2 n₁.2) by_cases e0 : e₂ = 0 · obtain ⟨x, xe⟩ := Nat.exists_eq_succ_of_ne_zero n₂.ne_zero - simp only [Mul.mul, mul, e0, ↓reduceIte, repr, PNat.mul_coe, natCast_mul, opow_zero, one_mul] - simp only [xe, h₂.zero_of_zero e0, repr, add_zero] + simp only [Mul.mul, mul, e0, ↓reduceIte, repr, repr_zero, PNat.mul_coe, natCast_mul, + opow_zero, one_mul] + simp only [xe, h₂.zero_of_zero e0, repr_zero, add_zero] rw [natCast_succ x, add_mul_succ _ ao, mul_assoc] · simp only [repr] haveI := h₁.fst @@ -696,7 +709,8 @@ instance nf_scale (x) [NF x] (o) [NF o] : NF (scale x o) := by @[simp] theorem repr_scale (x) [NF x] (o) [NF o] : repr (scale x o) = ω ^ repr x * repr o := by - simp only [scale_eq_mul, repr_mul, repr, PNat.one_coe, Nat.cast_one, mul_one, add_zero] + simp only [scale_eq_mul, repr_mul, repr, repr_zero, PNat.one_coe, Nat.cast_one, mul_one, + add_zero] theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by rcases e : split' o with ⟨a, n⟩ @@ -743,11 +757,19 @@ instance nf_opow (o₁ o₂) [NF o₁] [NF o₂] : NF (o₁ ^ o₂) := by haveI := (nf_repr_split' e₂).1 obtain - | ⟨a0, n, a'⟩ := a · rcases m with - | m - · by_cases o₂ = 0 <;> simp only [(· ^ ·), Pow.pow, opow, opowAux2, *] <;> decide - · by_cases m = 0 - · simp only [(· ^ ·), Pow.pow, opow, opowAux2, *, zero_def] + · by_cases h : o₂ = 0 + · subst h + simp only [(· ^ ·), Pow.pow, opow, opowAux2, e₁, OfNat.ofNat, Zero.zero, One.one] + decide + · have h' : o₂ ≠ zero := fun he => h (he ▸ zero_def ▸ rfl) + simp only [(· ^ ·), Pow.pow, opow, opowAux2, e₁, OfNat.ofNat, Zero.zero, One.one, + h', ite_false] + exact NF.zero + · by_cases h : m = 0 + · simp only [(· ^ ·), Pow.pow, opow, opowAux2, OfNat.ofNat, Zero.zero, One.one, *] decide - · simp only [(· ^ ·), Pow.pow, opow, opowAux2, *] + · simp only [(· ^ ·), Pow.pow, opow, opowAux2, OfNat.ofNat, Zero.zero, *] + change NF (oadd _ _ 0) infer_instance · simp only [(· ^ ·), Pow.pow, opow, opowAux2, e₁, split_eq_scale_split' e₂, mulNat_eq_mul] have := na.fst @@ -809,10 +831,11 @@ theorem repr_opow_aux₂ {a0 a'} [N0 : NF a0] [Na' : NF a'] (m : ℕ) (d : ω = (α' + m) ^ (succ ↑k : Ordinal) at IH have RR : R' = ω0 ^ (k : Ordinal) * (α' * m) + R := by by_cases h : m = 0 - · simp only [R, R', h, ONote.ofNat, Nat.cast_zero, ONote.repr, mul_zero, - ONote.opowAux, add_zero] - · simp only [α', ω0, R, R', ONote.repr_scale, ONote.repr, ONote.mulNat_eq_mul, ONote.opowAux, - ONote.repr_ofNat, ONote.repr_mul, ONote.repr_add, Ordinal.opow_mul, ONote.zero_add] + · simp only [R, R', h, ONote.ofNat, Nat.cast_zero, ONote.repr_zero, + mul_zero, ONote.opowAux, add_zero] + · simp only [α', ω0, R, R', ONote.repr_scale, ONote.repr, + ONote.mulNat_eq_mul, ONote.opowAux, ONote.repr_ofNat, ONote.repr_mul, ONote.repr_add, + Ordinal.opow_mul, ONote.zero_add] have α0 : 0 < α' := by simpa [lt_def, repr] using oadd_pos a0 n a' have ω00 : 0 < ω0 ^ (k : Ordinal) := opow_pos _ (opow_pos _ omega0_pos) have Rl : R < ω ^ (repr a0 * succ ↑k) := by @@ -879,14 +902,20 @@ theorem repr_opow (o₁ o₂) [NF o₁] [NF o₂] : repr (o₁ ^ o₂) = repr o obtain ⟨N₁, r₁⟩ := nf_repr_split e₁ obtain - | ⟨a0, n, a'⟩ := a · rcases m with - | m - · by_cases h : o₂ = 0 <;> simp [opow_def, opowAux2, e₁, h, r₁] - have := mt repr_inj.1 h - rw [zero_opow this] + · have hzero : (0 : ONote) = zero := rfl + by_cases h : o₂ = 0 + · subst h; simp [-zero_def, opow_def, opowAux2, e₁, r₁, hzero] + · have h' := mt repr_inj.1 h + have hne : o₂ ≠ zero := fun he => h (he ▸ rfl) + simp [-zero_def, opow_def, opowAux2, e₁, r₁, hne, hzero] + exact (zero_opow h').symm · rcases e₂ : split' o₂ with ⟨b', k⟩ obtain ⟨_, r₂⟩ := nf_repr_split' e₂ by_cases h : m = 0 - · simp [opowAux2, opow_def, e₁, h, r₁, r₂] - simp only [opow_def, opowAux2, e₁, r₁, e₂, r₂, repr, + · simp only [opowAux2, opow_def, e₁, h, r₁, r₂, OfNat.ofNat, Zero.zero, One.one, + repr] + simp [opow_add, opow_mul] + simp only [opow_def, opowAux2, e₁, r₁, e₂, r₂, repr, repr_zero, Nat.cast_succ, _root_.zero_add, add_zero] rw [opow_add, opow_mul, opow_omega0] @@ -905,10 +934,10 @@ theorem repr_opow (o₁ o₂) [NF o₁] [NF o₂] : repr (o₁ ^ o₂) = repr o simp only [opow_def, e₁, r₁, split_eq_scale_split' e₂, opowAux2, repr] rcases k with - | k · simp [r₂, opow_mul, repr_opow_aux₁ a00 al aa, add_assoc] - · simp [r₂, opow_add, opow_mul, mul_assoc, add_assoc] + · simp [r₂, opow_add, opow_mul, mul_assoc, add_assoc, repr_one] rw [repr_opow_aux₁ a00 al aa, scale_opowAux] - simp only [repr_mul, repr_scale, repr, opow_zero, PNat.val_ofNat, Nat.cast_one, mul_one, - add_zero, opow_one, opow_mul] + simp only [repr_mul, repr_scale, repr_one, + Nat.cast_one, opow_one, opow_mul] rw [← mul_add, ← add_assoc ((ω : Ordinal.{0}) ^ repr a0 * (n : ℕ))] congr 1 rw [← pow_succ, ← opow_natCast, ← opow_natCast] @@ -998,8 +1027,8 @@ theorem fundamentalSequence_has_prop (o) : FundamentalSequenceProp o (fundamenta have := PNat.natPred_add_one m; rw [e'] at this; exact PNat.coe_inj.1 this.symm]) <;> (try rw [show m = (m' + 1).succPNat by rw [← e', ← PNat.coe_inj, Nat.succPNat_coe, ← Nat.add_one, PNat.natPred_add_one]]) <;> - simp only [repr, iha, ihb, opow_lt_opow_iff_right one_lt_omega0, add_lt_add_iff_left, - add_zero, lt_add_iff_pos_right, lt_def, mul_one, Nat.cast_zero, + simp only [repr, repr_zero, iha, ihb, opow_lt_opow_iff_right one_lt_omega0, + add_lt_add_iff_left, add_zero, lt_add_iff_pos_right, lt_def, mul_one, Nat.cast_zero, Nat.cast_succ, Nat.succPNat_coe, opow_succ, opow_zero, mul_add_one, PNat.one_coe, _root_.zero_add, zero_def] · constructor @@ -1021,7 +1050,7 @@ theorem fundamentalSequence_has_prop (o) : FundamentalSequenceProp o (fundamenta gcongr apply natCast_lt_omega0 · refine fun H => H.fst.oadd _ (NF.below_of_lt' ?_ (@NF.oadd_zero _ _ (iha.2 H.fst))) - rw [repr, ← zero_def, repr, add_zero, iha.1, opow_succ] + rw [repr, repr_zero, add_zero, iha.1, opow_succ] gcongr apply natCast_lt_omega0 · rcases iha with ⟨h1, h2, h3⟩ @@ -1035,7 +1064,7 @@ theorem fundamentalSequence_has_prop (o) : FundamentalSequenceProp o (fundamenta exists_lt_add (exists_lt_omega0_opow' one_lt_omega0 h1 h3)⟩ obtain ⟨h4, h5, h6⟩ := h2 i refine ⟨h4, h5, fun H => H.fst.oadd _ (NF.below_of_lt' ?_ (@NF.oadd_zero _ _ (h6 H.fst)))⟩ - rwa [repr, ← zero_def, repr, add_zero, PNat.one_coe, Nat.cast_one, mul_one, + rwa [repr, repr_zero, add_zero, PNat.one_coe, Nat.cast_one, mul_one, opow_lt_opow_iff_right one_lt_omega0] · refine ⟨?_, fun H ↦ H.fst.oadd _ (NF.below_of_lt' ?_ (ihb.2 H.snd))⟩ · rw [repr, ihb.1, succ_eq_add_one, succ_eq_add_one, ← add_assoc, repr] diff --git a/Mathlib/Tactic/NormNum/PowMod.lean b/Mathlib/Tactic/NormNum/PowMod.lean index 1c139b5727f947..ce48e704cc8e97 100644 --- a/Mathlib/Tactic/NormNum/PowMod.lean +++ b/Mathlib/Tactic/NormNum/PowMod.lean @@ -54,10 +54,10 @@ theorem IsNatPowModT.bit0 : ⟨fun h1 => by simp only [two_mul, Nat.pow_eq, pow_add, ← h1, Nat.mul_eq]; exact Nat.mul_mod ..⟩ theorem natPow_zero_natMod_zero : Nat.mod (Nat.pow a (nat_lit 0)) (nat_lit 0) = nat_lit 1 := by - simp [Nat.mod, Nat.modCore] + simp [Nat.mod, Nat.modCore, OfNat.ofNat, One.one] theorem natPow_zero_natMod_one : Nat.mod (Nat.pow a (nat_lit 0)) (nat_lit 1) = nat_lit 0 := by - simp [Nat.mod, Nat.modCore_eq] + simp [Nat.mod, Nat.modCore, OfNat.ofNat, One.one, Nat.modCore.go] theorem natPow_zero_natMod_succ_succ : Nat.mod (Nat.pow a (nat_lit 0)) (Nat.succ (Nat.succ m)) = nat_lit 1 := by diff --git a/lake-manifest.json b/lake-manifest.json index ca0e4c0d66b879..4536c34dc7af3b 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "bf597c77bf9b8e66720d724928207f5911533113", + "rev": "a985c160afc3d49773f1ad02d0d73a021d5dee41", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "v4.30.0-rc1", + "inputRev": "lean-pr-testing-13363", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 5f11ec894a69ad..6af4aae0ea2070 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "v4.30.0-rc1" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13363" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" diff --git a/lean-toolchain b/lean-toolchain index 54caac41bddf21..5d0967670ed6d5 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-07 +leanprover/lean4-pr-releases:pr-release-13363-c9741df From 737564ce1816a1cf6a40f7b259567818bf93fa6d Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Wed, 15 Apr 2026 16:13:12 +0000 Subject: [PATCH 073/116] fix lint errors from lean4#13363 adaptation - Add doc string to `WithZero.withZeroSup` - Add `nolint simpNF` to auto-generated equation lemmas for `RegularExpression.matches'` and `RegularExpression.map` - Add `nolint simpNF` to `orderLHom_leSymb` --- Mathlib/Algebra/Order/GroupWithZero/Canonical.lean | 1 + Mathlib/Computability/RegularExpressions.lean | 4 ++++ Mathlib/ModelTheory/Order.lean | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean index 70f2e9204885c3..a02972a34948f3 100644 --- a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean +++ b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean @@ -419,6 +419,7 @@ end PartialOrder section Lattice +/-- Supremum for `WithZero α`, defined via `Option.merge`. -/ def withZeroSup [Max α] : WithZero α → WithZero α → WithZero α := Option.merge (· ⊔ ·) diff --git a/Mathlib/Computability/RegularExpressions.lean b/Mathlib/Computability/RegularExpressions.lean index dd7036974a93e9..584129a46cbce2 100644 --- a/Mathlib/Computability/RegularExpressions.lean +++ b/Mathlib/Computability/RegularExpressions.lean @@ -103,6 +103,8 @@ def matches' : RegularExpression α → Language α | P * Q => P.matches' * Q.matches' | star P => P.matches'∗ +attribute [nolint simpNF] matches'.eq_1 matches'.eq_2 + theorem matches'_zero : (0 : RegularExpression α).matches' = 0 := rfl @@ -338,6 +340,8 @@ def map (f : α → β) : RegularExpression α → RegularExpression β | R * S => map f R * map f S | star R => star (map f R) +attribute [nolint simpNF] map.eq_1 map.eq_2 + @[simp] protected theorem map_pow (f : α → β) (P : RegularExpression α) : ∀ n : ℕ, map f (P ^ n) = map f P ^ n diff --git a/Mathlib/ModelTheory/Order.lean b/Mathlib/ModelTheory/Order.lean index e3569f3c63ae5c..13a155999c6ec2 100644 --- a/Mathlib/ModelTheory/Order.lean +++ b/Mathlib/ModelTheory/Order.lean @@ -135,7 +135,7 @@ language. -/ @[simps] def orderLHom : Language.order →ᴸ L where onRelation | _, .le => leSymb -@[simp] +@[simp, nolint simpNF] theorem orderLHom_leSymb : (orderLHom L).onRelation leSymb = (leSymb : L.Relations 2) := rfl From 9e7eebd31d71e2faaf8c58aaa13da435a5595805 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 16 Apr 2026 08:02:46 +0000 Subject: [PATCH 074/116] fixes --- Mathlib/Analysis/Distribution/Distribution.lean | 2 +- Mathlib/CategoryTheory/Types/Basic.lean | 2 +- Mathlib/RingTheory/Perfection.lean | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Mathlib/Analysis/Distribution/Distribution.lean b/Mathlib/Analysis/Distribution/Distribution.lean index 931ea029f07803..c392c764bd5753 100644 --- a/Mathlib/Analysis/Distribution/Distribution.lean +++ b/Mathlib/Analysis/Distribution/Distribution.lean @@ -192,7 +192,7 @@ end mapCLM section DiracDelta /-- The Dirac delta distribution. This is zero if `x` does not belong to `Ω`. -/ -def delta (x : E) : 𝓓'^{n}(Ω, ℝ) where +noncomputable def delta (x : E) : 𝓓'^{n}(Ω, ℝ) where toFun f := f x map_add' _ _ := rfl map_smul' _ _ := rfl diff --git a/Mathlib/CategoryTheory/Types/Basic.lean b/Mathlib/CategoryTheory/Types/Basic.lean index 8701000d99dc29..5de3f5b72f7cb6 100644 --- a/Mathlib/CategoryTheory/Types/Basic.lean +++ b/Mathlib/CategoryTheory/Types/Basic.lean @@ -315,7 +315,7 @@ Write this as `uliftFunctor.{5, 2}` to get `Type 2 ⥤ Type 5`. @[pp_with_univ, simps obj map] def uliftFunctor : Type u ⥤ Type max u v where obj X := ULift.{v} X - map {X} {_} f := fun x : ULift.{v} X => ULift.up (f x.down) + map {X} {_} f := fun x : ULift.{v} X => ULift.up.{v} (f x.down) @[simp] theorem uliftFunctor_obj {X : Type u} : uliftFunctor.{v}.obj X = ULift.{v} X := diff --git a/Mathlib/RingTheory/Perfection.lean b/Mathlib/RingTheory/Perfection.lean index 4a4117cdd01125..b705efb5863b4c 100644 --- a/Mathlib/RingTheory/Perfection.lean +++ b/Mathlib/RingTheory/Perfection.lean @@ -838,6 +838,8 @@ namespace Tilt noncomputable instance [Fact p.Prime] [hvp : Fact (v p ≠ 1)] : Field (Tilt K v O hv p) := haveI := Fact.mk <| mt hv.one_of_isUnit <| (map_natCast (algebraMap O K) p).symm ▸ hvp.1 haveI := PreTilt.isDomain K v O hv p + #adaptation_note /-- This `letI` was not needed prior to nightly-2026-04-15. -/ + letI : CommRing (PreTilt O p) := inferInstance inferInstanceAs <| Field (FractionRing _) end Tilt From 8ba95847a2694c66068b94275efe201a1fcde041 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 16 Apr 2026 08:05:17 +0000 Subject: [PATCH 075/116] fix --- Mathlib/CategoryTheory/Types/Basic.lean | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/Types/Basic.lean b/Mathlib/CategoryTheory/Types/Basic.lean index 5de3f5b72f7cb6..ea2397b985dca9 100644 --- a/Mathlib/CategoryTheory/Types/Basic.lean +++ b/Mathlib/CategoryTheory/Types/Basic.lean @@ -315,16 +315,7 @@ Write this as `uliftFunctor.{5, 2}` to get `Type 2 ⥤ Type 5`. @[pp_with_univ, simps obj map] def uliftFunctor : Type u ⥤ Type max u v where obj X := ULift.{v} X - map {X} {_} f := fun x : ULift.{v} X => ULift.up.{v} (f x.down) - -@[simp] -theorem uliftFunctor_obj {X : Type u} : uliftFunctor.{v}.obj X = ULift.{v} X := - rfl - -@[simp] -theorem uliftFunctor_map {X Y : Type u} (f : X ⟶ Y) (x : ULift.{v} X) : - uliftFunctor.map f x = ULift.up (f x.down) := - rfl + map {X} {_} f := TypeCat.ofHom fun x : ULift.{v} X => ULift.up.{v} (f x.down) /-- `uliftFunctor : Type u ⥤ Type max u v` is fully faithful. -/ def fullyFaithfulULiftFunctor : (uliftFunctor.{v, u}).FullyFaithful where From f9ae5cc6f301a0a0e6091e8e5c9c3d501b9812f8 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 16 Apr 2026 09:28:08 +0000 Subject: [PATCH 076/116] fixes --- Mathlib/Algebra/Category/ModuleCat/Presheaf/Monoidal.lean | 2 +- Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean | 4 ++-- Mathlib/CategoryTheory/Sites/Sieves.lean | 2 +- Mathlib/RingTheory/Flat/Rank.lean | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Mathlib/Algebra/Category/ModuleCat/Presheaf/Monoidal.lean b/Mathlib/Algebra/Category/ModuleCat/Presheaf/Monoidal.lean index e593c19088e76d..4778e592b7948a 100644 --- a/Mathlib/Algebra/Category/ModuleCat/Presheaf/Monoidal.lean +++ b/Mathlib/Algebra/Category/ModuleCat/Presheaf/Monoidal.lean @@ -141,7 +141,7 @@ noncomputable instance monoidalCategory : open BraidedCategory -instance symmetricCategory : +noncomputable instance symmetricCategory : SymmetricCategory (PresheafOfModules.{u} (R ⋙ forget₂ _ _)) where braiding M₁ M₂ := isoMk (fun X ↦ braiding (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X)) diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean index 70e0fbfb413bf6..a7c651c699abb9 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean @@ -94,7 +94,7 @@ lemma horn_obj_eq_univ {n : ℕ} (i : Fin (n + 1)) (m : ℕ) (h : m + 1 < n := b Finset.card_singleton, add_le_add_iff_right] at this have : n ≤ m + 1 := by simpa using this.trans Finset.card_image_le lia - have : ∃ j, ¬j = i ∧ ∀ (i : Fin (m + 1)), ¬(stdSimplex.objEquiv.symm.{u} f) i = j := + have : ∃ j, ¬j = i ∧ ∀ (i : Fin (m + 1)), ¬(stdSimplex.objEquiv.{u}.symm f) i = j := ⟨j, hij, fun k hk ↦ hj ⟨k, hk⟩⟩ simpa [horn_eq_iSup] using this @@ -140,7 +140,7 @@ lemma face_le_horn_iff {n : ℕ} (S : Finset (Fin (n + 2))) (j : Fin (n + 2)) : lemma objEquiv_symm_notMem_horn_of_isIso {n : ℕ} (i : Fin (n + 1)) {d : SimplexCategory} (f : d ⟶ ⦋n⦌) [IsIso f] : - stdSimplex.objEquiv.symm.{u} f ∉ Λ[n, i].obj (op d) := by + stdSimplex.objEquiv.{u}.symm f ∉ Λ[n, i].obj (op d) := by rw [mem_horn_iff, ne_eq, not_not] ext i simpa using Or.inr ⟨inv f i, by simp [stdSimplex.coe_asOrderHom_objEquiv_symm.{u}]⟩ diff --git a/Mathlib/CategoryTheory/Sites/Sieves.lean b/Mathlib/CategoryTheory/Sites/Sieves.lean index a6fb9bc171af42..5715339400c477 100644 --- a/Mathlib/CategoryTheory/Sites/Sieves.lean +++ b/Mathlib/CategoryTheory/Sites/Sieves.lean @@ -1263,7 +1263,7 @@ def uliftFunctorInclusion (S : Sieve X) : @[simps] def toUliftFunctor (S : Sieve X) {Y : C} (f : Y ⟶ X) (hf : S f) : uliftYoneda.{w}.obj Y ⟶ Sieve.uliftFunctor.{w} S where - app Z g := ⟨g.down ≫ f, S.downward_closed hf g.down⟩ + app Z := TypeCat.ofHom fun g ↦ ⟨g.down ≫ f, S.downward_closed hf g.down⟩ theorem uliftNatTransOfLe_comm {S T : Sieve X} (h : S ≤ T) : uliftNatTransOfLe.{w} h ≫ uliftFunctorInclusion.{w} _ = uliftFunctorInclusion.{w} _ := diff --git a/Mathlib/RingTheory/Flat/Rank.lean b/Mathlib/RingTheory/Flat/Rank.lean index a7a380d3a50fdb..7f5eae009c9a13 100644 --- a/Mathlib/RingTheory/Flat/Rank.lean +++ b/Mathlib/RingTheory/Flat/Rank.lean @@ -36,6 +36,7 @@ attribute [local instance] Module.free_of_flat_of_isLocalRing variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] [Module.Flat R S] [Module.Finite R S] +set_option backward.isDefEq.respectTransparency false in lemma PrimeSpectrum.rankAtStalk_pos_iff_mem_range_comap (p : PrimeSpectrum R) : 0 < Module.rankAtStalk (R := R) S p ↔ p ∈ Set.range (PrimeSpectrum.comap (algebraMap R S)) := by rw [Module.rankAtStalk_eq, Module.finrank_pos_iff, p.nontrivial_iff_mem_rangeComap] From cecf37bdace26a422cf4eb0059fb7f0d410969b6 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Thu, 16 Apr 2026 09:31:37 +0000 Subject: [PATCH 077/116] chore: bump to nightly-2026-04-16 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index b74ced19101876..844e3659d22483 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-15 +leanprover/lean4:nightly-2026-04-16 From 6d92cce23161c25a65ff235d4fda70454b8d2e0e Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 17 Apr 2026 03:21:32 +0000 Subject: [PATCH 078/116] fix tests --- MathlibTest/DocPrime.lean | 2 ++ MathlibTest/LintStyle.lean | 1 + MathlibTest/ToDual.lean | 1 + 3 files changed, 4 insertions(+) diff --git a/MathlibTest/DocPrime.lean b/MathlibTest/DocPrime.lean index 7411651cca5259..5666bf74599ca9 100644 --- a/MathlibTest/DocPrime.lean +++ b/MathlibTest/DocPrime.lean @@ -67,6 +67,7 @@ Declarations whose name ends with a `'` are expected to contain an explanation f Note: This linter can be disabled with `set_option linter.docPrime false` -/ #guard_msgs in +set_option linter.nonClassInstance false in instance inst_no_doc' : True := .intro /-- @@ -91,6 +92,7 @@ def def_no_doc' : True := .intro namespace Foo' example : True := .intro +set_option linter.nonClassInstance false in instance : True := .intro end Foo' diff --git a/MathlibTest/LintStyle.lean b/MathlibTest/LintStyle.lean index 4e9351942fc5c0..a68b244a5dae34 100644 --- a/MathlibTest/LintStyle.lean +++ b/MathlibTest/LintStyle.lean @@ -284,6 +284,7 @@ warning: Please use '<|' instead of '$' for the pipe operator. Note: This linter can be disabled with `set_option linter.style.dollarSyntax false` -/ #guard_msgs in +set_option linter.impossibleInstance false in instance (f g : Nat → Nat) : Inhabited Nat where default := by · have := 0 diff --git a/MathlibTest/ToDual.lean b/MathlibTest/ToDual.lean index b9bb47f4ad4a2b..f87fb53395228c 100644 --- a/MathlibTest/ToDual.lean +++ b/MathlibTest/ToDual.lean @@ -32,6 +32,7 @@ structure Lattice (α : Type) extends SemilatticeInf α, SemilatticeSup α attribute [to_dual existing] Lattice.toSemilatticeInf -- we can reorder arguments of arguments in `SemilatticeInf.mk` +set_option linter.impossibleInstance false in @[to_dual] instance [Min α] (le_inf : ∀ a b c : α, a ≤ b → a ≤ c → a ≤ b ⊓ c) : SemilatticeInf α where le_inf From c33286bef8c14a6fce87ea5fdd7f2bd196a30577 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 17 Apr 2026 19:04:23 +1000 Subject: [PATCH 079/116] fix upstreamed import --- Mathlib/Order/Bounded.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/Order/Bounded.lean b/Mathlib/Order/Bounded.lean index dddc3d771498da..6ab52893a60e3b 100644 --- a/Mathlib/Order/Bounded.lean +++ b/Mathlib/Order/Bounded.lean @@ -5,7 +5,6 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.Tactic.Linter.DeprecatedModule public import Mathlib.Order.RelClasses public import Mathlib.Order.Interval.Set.Basic public import Mathlib.Order.Bounds.Defs From 32b824d8467cd67fba0bc954cfbd48f17e85bd88 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Fri, 17 Apr 2026 09:30:49 +0000 Subject: [PATCH 080/116] chore: bump to nightly-2026-04-17 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 844e3659d22483..474b1d259a11e1 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-16 +leanprover/lean4:nightly-2026-04-17 From bba4e0716004d5583247ab95fc436e817087e83a Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 17 Apr 2026 22:22:42 +1000 Subject: [PATCH 081/116] set_option --- Mathlib/RingTheory/Flat/Rank.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/RingTheory/Flat/Rank.lean b/Mathlib/RingTheory/Flat/Rank.lean index a7a380d3a50fdb..7f5eae009c9a13 100644 --- a/Mathlib/RingTheory/Flat/Rank.lean +++ b/Mathlib/RingTheory/Flat/Rank.lean @@ -36,6 +36,7 @@ attribute [local instance] Module.free_of_flat_of_isLocalRing variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] [Module.Flat R S] [Module.Finite R S] +set_option backward.isDefEq.respectTransparency false in lemma PrimeSpectrum.rankAtStalk_pos_iff_mem_range_comap (p : PrimeSpectrum R) : 0 < Module.rankAtStalk (R := R) S p ↔ p ∈ Set.range (PrimeSpectrum.comap (algebraMap R S)) := by rw [Module.rankAtStalk_eq, Module.finrank_pos_iff, p.nontrivial_iff_mem_rangeComap] From 1ebf1cc214eaf71301eda927899371e287ac7475 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Fri, 17 Apr 2026 14:08:15 +0000 Subject: [PATCH 082/116] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/13441 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 208a334e436ab5..733e9888345ccd 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "918975dee951eb4b2338607c5277a4e5835834f3", + "rev": "c33bb8643da2d08d284be01d942da42f982faaa0", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13441", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index babb657761237b..1b97e37a1ac36d 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-13441" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.97" diff --git a/lean-toolchain b/lean-toolchain index 844e3659d22483..a725dbebcf9a80 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-16 +leanprover/lean4-pr-releases:pr-release-13441-72e3ae9 From b098eb1ee2286c8bd86d7038954085f4f3493bc8 Mon Sep 17 00:00:00 2001 From: Wojciech Rozowski Date: Fri, 17 Apr 2026 14:22:07 +0000 Subject: [PATCH 083/116] chore: adaptations for leanprover/lean4#13389 --- Mathlib/GroupTheory/Abelianization/Defs.lean | 2 - Mathlib/GroupTheory/FreeAbelianGroup.lean | 2 - Mathlib/Topology/MetricSpace/Gluing.lean | 2 - MathlibTest/DocPrime.lean | 9 +++-- MathlibTest/LintStyle.lean | 4 +- MathlibTest/ToDual.lean | 4 +- MathlibTest/globalAttributeIn.lean | 39 ++++++++------------ 7 files changed, 24 insertions(+), 38 deletions(-) diff --git a/Mathlib/GroupTheory/Abelianization/Defs.lean b/Mathlib/GroupTheory/Abelianization/Defs.lean index 950c5ca84135b7..ef2b4d1b467194 100644 --- a/Mathlib/GroupTheory/Abelianization/Defs.lean +++ b/Mathlib/GroupTheory/Abelianization/Defs.lean @@ -40,8 +40,6 @@ def Abelianization : Type u := namespace Abelianization -attribute [local instance] QuotientGroup.leftRel - instance commGroup : CommGroup (Abelianization G) where __ := QuotientGroup.Quotient.group _ mul_comm x y := Quotient.inductionOn₂ x y fun a b ↦ Quotient.sound' <| diff --git a/Mathlib/GroupTheory/FreeAbelianGroup.lean b/Mathlib/GroupTheory/FreeAbelianGroup.lean index 86c2d955ee513e..bc7ab476fce41b 100644 --- a/Mathlib/GroupTheory/FreeAbelianGroup.lean +++ b/Mathlib/GroupTheory/FreeAbelianGroup.lean @@ -172,8 +172,6 @@ instance [Nonempty α] : Nontrivial (FreeAbelianGroup α) where end -attribute [local instance] QuotientGroup.leftRel - @[elab_as_elim] protected theorem induction_on {motive : FreeAbelianGroup α → Prop} (z : FreeAbelianGroup α) (zero : motive 0) diff --git a/Mathlib/Topology/MetricSpace/Gluing.lean b/Mathlib/Topology/MetricSpace/Gluing.lean index 843aeb1d0dc9ef..0c3d873c6adce0 100644 --- a/Mathlib/Topology/MetricSpace/Gluing.lean +++ b/Mathlib/Topology/MetricSpace/Gluing.lean @@ -592,8 +592,6 @@ def inductivePremetric (I : ∀ n, Isometry (f n)) : PseudoMetricSpace (Σ n, X _ = inductiveLimitDist f x y + inductiveLimitDist f y z := by rw [inductiveLimitDist_eq_dist I x y m hx hy, inductiveLimitDist_eq_dist I y z m hy hz] -attribute [local instance] inductivePremetric - /-- The type giving the inductive limit in a metric space context. -/ def InductiveLimit (I : ∀ n, Isometry (f n)) : Type _ := @SeparationQuotient _ (inductivePremetric I).toUniformSpace.toTopologicalSpace diff --git a/MathlibTest/DocPrime.lean b/MathlibTest/DocPrime.lean index 5666bf74599ca9..bc217c8686bc65 100644 --- a/MathlibTest/DocPrime.lean +++ b/MathlibTest/DocPrime.lean @@ -60,6 +60,9 @@ Note: This linter can be disabled with `set_option linter.docPrime false` @[simp] theorem thm_with_attr_no_doc' : True := .intro +class Dummy where + field : True + /-- warning: `inst_no_doc'` is missing a doc-string, please add one. Declarations whose name ends with a `'` are expected to contain an explanation for the presence of a `'` in their doc-string. This may consist of discussion of the difference relative to the unprimed version, or an explanation as to why no better naming scheme is possible. @@ -67,8 +70,7 @@ Declarations whose name ends with a `'` are expected to contain an explanation f Note: This linter can be disabled with `set_option linter.docPrime false` -/ #guard_msgs in -set_option linter.nonClassInstance false in -instance inst_no_doc' : True := .intro +instance inst_no_doc' : Dummy := ⟨.intro⟩ /-- warning: `abbrev_no_doc'` is missing a doc-string, please add one. @@ -92,7 +94,6 @@ def def_no_doc' : True := .intro namespace Foo' example : True := .intro -set_option linter.nonClassInstance false in -instance : True := .intro +instance : Dummy := ⟨.intro⟩ end Foo' diff --git a/MathlibTest/LintStyle.lean b/MathlibTest/LintStyle.lean index a68b244a5dae34..e6cd6fb7f83b58 100644 --- a/MathlibTest/LintStyle.lean +++ b/MathlibTest/LintStyle.lean @@ -284,8 +284,8 @@ warning: Please use '<|' instead of '$' for the pipe operator. Note: This linter can be disabled with `set_option linter.style.dollarSyntax false` -/ #guard_msgs in -set_option linter.impossibleInstance false in -instance (f g : Nat → Nat) : Inhabited Nat where +@[reducible] +def test (f g : Nat → Nat) : Inhabited Nat where default := by · have := 0 · have : Nat := f $ g $ 0 diff --git a/MathlibTest/ToDual.lean b/MathlibTest/ToDual.lean index f87fb53395228c..6b9b943762830d 100644 --- a/MathlibTest/ToDual.lean +++ b/MathlibTest/ToDual.lean @@ -33,8 +33,8 @@ attribute [to_dual existing] Lattice.toSemilatticeInf -- we can reorder arguments of arguments in `SemilatticeInf.mk` set_option linter.impossibleInstance false in -@[to_dual] -instance [Min α] (le_inf : ∀ a b c : α, a ≤ b → a ≤ c → a ≤ b ⊓ c) : SemilatticeInf α where +@[to_dual, reducible] +def le_inf_test [Min α] (le_inf : ∀ a b c : α, a ≤ b → a ≤ c → a ≤ b ⊓ c) : SemilatticeInf α where le_inf -- we can reorder arguments of arguments of arguments in `SemilatticeInf.casesOn` diff --git a/MathlibTest/globalAttributeIn.lean b/MathlibTest/globalAttributeIn.lean index 56ced2d39e8426..1c124f2b4d4ed0 100644 --- a/MathlibTest/globalAttributeIn.lean +++ b/MathlibTest/globalAttributeIn.lean @@ -8,28 +8,30 @@ import Mathlib.Tactic.Linter.GlobalAttributeIn /-! Tests for the `globalAttributeIn` linter. -/ --- After https://github.com/leanprover/lean4/pull/12263, --- we need to add `instance_reducible` before we can add `instance` to `Int.add`. -set_option allowUnsafeReducibility true in -attribute [instance_reducible] Int.add +-- Since lean4#13223 applying a global attribute using ... `in` ... is an error + +class Dummy where + field : True + +@[reducible] def dummyInst : Dummy := ⟨True.intro⟩ /-- -error: Despite the `in`, the attribute instance 1100 is added globally to Int.add +error: Despite the `in`, the attribute instance 1100 is added globally to dummyInst please remove the `in` or make this a `local instance 1100` -/ #guard_msgs in set_option autoImplicit false in -attribute [instance 1100] Int.add in +attribute [instance 1100] dummyInst in set_option autoImplicit false in instance : Inhabited Int where default := 0 /-- -error: Despite the `in`, the attribute instance is added globally to Int.add +error: Despite the `in`, the attribute instance is added globally to dummyInst please remove the `in` or make this a `local instance` -/ #guard_msgs in -attribute [instance] Int.add in +attribute [instance] dummyInst in instance : Inhabited Int where default := 0 @@ -58,42 +60,31 @@ please remove the `in` or make this a `local ext` -/ #guard_msgs in set_option warning.simp.varHead false in -attribute [simp, local simp, ext, scoped instance, -simp, -ext] foo in +attribute [simp, local simp, ext, -simp, -ext] foo in def bar := False #guard_msgs in -- `local instance` is allowed with `in` -attribute [local instance] Int.add in +attribute [local instance] dummyInst in instance : Inhabited Int where default := 0 #guard_msgs in -- `local instance priority` is allowed with `in` -attribute [local instance 42] Int.add in +attribute [local instance 42] dummyInst in instance : Inhabited Int where default := 0 #guard_msgs in -- `scoped instance` is allowed with `in` -attribute [scoped instance] Int.add in +attribute [scoped instance] dummyInst in instance : Inhabited Int where default := 0 #guard_msgs in -- `scoped instance priority` is allowed with `in` -attribute [scoped instance 42] Int.add in +attribute [scoped instance 42] dummyInst in instance : Inhabited Int where default := 0 end X - --- Omitting the `in` is also fine. - -attribute [local instance 42] X.foo - --- Global instance without the `in` are also left alone. -attribute [instance 20000] X.foo - -namespace X - -attribute [scoped instance 0] foo From a450fa064ebfe9a474d5fd2f5113b095e71bbc6c Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 18 Apr 2026 08:18:58 +1000 Subject: [PATCH 084/116] fixes --- Mathlib/CategoryTheory/Sites/Sieves.lean | 2 +- MathlibTest/DocPrime.lean | 7 +++++-- MathlibTest/LintStyle.lean | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Sites/Sieves.lean b/Mathlib/CategoryTheory/Sites/Sieves.lean index 84c4db3b3add33..aaa29a83dcfec3 100644 --- a/Mathlib/CategoryTheory/Sites/Sieves.lean +++ b/Mathlib/CategoryTheory/Sites/Sieves.lean @@ -1263,7 +1263,7 @@ def uliftFunctorInclusion (S : Sieve X) : @[simps] def toUliftFunctor (S : Sieve X) {Y : C} (f : Y ⟶ X) (hf : S f) : uliftYoneda.{w}.obj Y ⟶ Sieve.uliftFunctor.{w} S where - app Z g := TypeCat.ofHom fun g ↦ ⟨g.down ≫ f, S.downward_closed hf g.down⟩ + app Z := TypeCat.ofHom fun g ↦ ⟨g.down ≫ f, S.downward_closed hf g.down⟩ theorem uliftNatTransOfLe_comm {S T : Sieve X} (h : S ≤ T) : uliftNatTransOfLe.{w} h ≫ uliftFunctorInclusion.{w} _ = uliftFunctorInclusion.{w} _ := diff --git a/MathlibTest/DocPrime.lean b/MathlibTest/DocPrime.lean index 7411651cca5259..bc217c8686bc65 100644 --- a/MathlibTest/DocPrime.lean +++ b/MathlibTest/DocPrime.lean @@ -60,6 +60,9 @@ Note: This linter can be disabled with `set_option linter.docPrime false` @[simp] theorem thm_with_attr_no_doc' : True := .intro +class Dummy where + field : True + /-- warning: `inst_no_doc'` is missing a doc-string, please add one. Declarations whose name ends with a `'` are expected to contain an explanation for the presence of a `'` in their doc-string. This may consist of discussion of the difference relative to the unprimed version, or an explanation as to why no better naming scheme is possible. @@ -67,7 +70,7 @@ Declarations whose name ends with a `'` are expected to contain an explanation f Note: This linter can be disabled with `set_option linter.docPrime false` -/ #guard_msgs in -instance inst_no_doc' : True := .intro +instance inst_no_doc' : Dummy := ⟨.intro⟩ /-- warning: `abbrev_no_doc'` is missing a doc-string, please add one. @@ -91,6 +94,6 @@ def def_no_doc' : True := .intro namespace Foo' example : True := .intro -instance : True := .intro +instance : Dummy := ⟨.intro⟩ end Foo' diff --git a/MathlibTest/LintStyle.lean b/MathlibTest/LintStyle.lean index 4e9351942fc5c0..e6cd6fb7f83b58 100644 --- a/MathlibTest/LintStyle.lean +++ b/MathlibTest/LintStyle.lean @@ -284,7 +284,8 @@ warning: Please use '<|' instead of '$' for the pipe operator. Note: This linter can be disabled with `set_option linter.style.dollarSyntax false` -/ #guard_msgs in -instance (f g : Nat → Nat) : Inhabited Nat where +@[reducible] +def test (f g : Nat → Nat) : Inhabited Nat where default := by · have := 0 · have : Nat := f $ g $ 0 From e479388d393de50704b991888f076be362d259ef Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 18 Apr 2026 08:20:28 +1000 Subject: [PATCH 085/116] fixes --- Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean | 4 ++-- MathlibTest/ToDual.lean | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean index 70e0fbfb413bf6..a7c651c699abb9 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean @@ -94,7 +94,7 @@ lemma horn_obj_eq_univ {n : ℕ} (i : Fin (n + 1)) (m : ℕ) (h : m + 1 < n := b Finset.card_singleton, add_le_add_iff_right] at this have : n ≤ m + 1 := by simpa using this.trans Finset.card_image_le lia - have : ∃ j, ¬j = i ∧ ∀ (i : Fin (m + 1)), ¬(stdSimplex.objEquiv.symm.{u} f) i = j := + have : ∃ j, ¬j = i ∧ ∀ (i : Fin (m + 1)), ¬(stdSimplex.objEquiv.{u}.symm f) i = j := ⟨j, hij, fun k hk ↦ hj ⟨k, hk⟩⟩ simpa [horn_eq_iSup] using this @@ -140,7 +140,7 @@ lemma face_le_horn_iff {n : ℕ} (S : Finset (Fin (n + 2))) (j : Fin (n + 2)) : lemma objEquiv_symm_notMem_horn_of_isIso {n : ℕ} (i : Fin (n + 1)) {d : SimplexCategory} (f : d ⟶ ⦋n⦌) [IsIso f] : - stdSimplex.objEquiv.symm.{u} f ∉ Λ[n, i].obj (op d) := by + stdSimplex.objEquiv.{u}.symm f ∉ Λ[n, i].obj (op d) := by rw [mem_horn_iff, ne_eq, not_not] ext i simpa using Or.inr ⟨inv f i, by simp [stdSimplex.coe_asOrderHom_objEquiv_symm.{u}]⟩ diff --git a/MathlibTest/ToDual.lean b/MathlibTest/ToDual.lean index b9bb47f4ad4a2b..d3139be878fdc1 100644 --- a/MathlibTest/ToDual.lean +++ b/MathlibTest/ToDual.lean @@ -31,6 +31,7 @@ structure Lattice (α : Type) extends SemilatticeInf α, SemilatticeSup α attribute [to_dual existing] Lattice.toSemilatticeInf +set_option linter.impossibleInstance false in -- we can reorder arguments of arguments in `SemilatticeInf.mk` @[to_dual] instance [Min α] (le_inf : ∀ a b c : α, a ≤ b → a ≤ c → a ≤ b ⊓ c) : SemilatticeInf α where From d33ab3c2f6868cec700797a06ded94870a2facc5 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 18 Apr 2026 08:33:12 +1000 Subject: [PATCH 086/116] fixes --- MathlibTest/ToDual.lean | 1 - lake-manifest.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/MathlibTest/ToDual.lean b/MathlibTest/ToDual.lean index d3139be878fdc1..b9bb47f4ad4a2b 100644 --- a/MathlibTest/ToDual.lean +++ b/MathlibTest/ToDual.lean @@ -31,7 +31,6 @@ structure Lattice (α : Type) extends SemilatticeInf α, SemilatticeSup α attribute [to_dual existing] Lattice.toSemilatticeInf -set_option linter.impossibleInstance false in -- we can reorder arguments of arguments in `SemilatticeInf.mk` @[to_dual] instance [Min α] (le_inf : ∀ a b c : α, a ≤ b → a ≤ c → a ≤ b ⊓ c) : SemilatticeInf α where diff --git a/lake-manifest.json b/lake-manifest.json index a368a0a46ff776..96cf216690b058 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "3b89330c9c0ccaeed89cf99b2cd292722e3495c9", + "rev": "4b591181697264394a76288a163fd1d47621c96e", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "nightly-testing", From 4f40f6e9ea040b62de44119404d38ef214b7efda Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 18 Apr 2026 09:15:56 +1000 Subject: [PATCH 087/116] fix Init filter in MinImports --- Mathlib/Tactic/Linter/MinImports.lean | 4 ++-- Mathlib/Tactic/MinImports.lean | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Mathlib/Tactic/Linter/MinImports.lean b/Mathlib/Tactic/Linter/MinImports.lean index ae2a42c439c518..ddfbb78c56a2a2 100644 --- a/Mathlib/Tactic/Linter/MinImports.lean +++ b/Mathlib/Tactic/Linter/MinImports.lean @@ -125,7 +125,7 @@ def minImportsLinter : Linter where run := withSetOptionIn fun stx ↦ do -- when the linter reaches the end of the file or `#exit`, it gives a report if #[``Parser.Command.eoi, ``Lean.Parser.Command.exit].contains stx.getKind then let explicitImportsInFile : NameSet := - .ofArray ((env.imports.map (·.module)).erase `Init) + .ofArray ((env.imports.map (·.module)).filter (!isInitImport ·)) let newImps := importsSoFar \ explicitImportsInFile let currentlyUnneededImports := explicitImportsInFile \ importsSoFar -- we read the current file, to do a custom parsing of the imports: @@ -146,7 +146,7 @@ def minImportsLinter : Linter where run := withSetOptionIn fun stx ↦ do logWarningAt ((impMods.raw.find? (·.isOfKind `import)).getD default) m!"-- missing imports\n{"\n".intercalate withImport.toList}" let id ← getId stx - let newImports := getIrredundantImports env (← getAllImports stx id) + let newImports := (getIrredundantImports env (← getAllImports stx id)).filter (!isInitImport ·) let tot := (newImports.append importsSoFar) let redundant := env.findRedundantImports tot.toArray let currImports := tot \ redundant diff --git a/Mathlib/Tactic/MinImports.lean b/Mathlib/Tactic/MinImports.lean index 9d5f781fece6ed..732ae93bb3ddda 100644 --- a/Mathlib/Tactic/MinImports.lean +++ b/Mathlib/Tactic/MinImports.lean @@ -64,6 +64,13 @@ open Lean Elab Command namespace Mathlib.Command.MinImports +/-- Returns `true` if `n` is `Init` or a descendant of `Init`. These imports are always available +in ordinary Mathlib files, so they are omitted from user-facing `#min_imports` output. -/ +partial def isInitImport : Name → Bool + | `Init => true + | .str p _ => isInitImport p + | _ => false + /-- `getSyntaxNodeKinds stx` takes a `Syntax` input `stx` and returns the `NameSet` of all the `SyntaxNodeKinds` and all the identifiers contained in `stx`. -/ partial @@ -251,7 +258,7 @@ It is used to provide the internally generated name for "nameless" `instance`s. -/ def minImpsCore (stx id : Syntax) : CommandElabM Unit := do let tot := getIrredundantImports (← getEnv) (← getAllImports stx id) - let fileNames := tot.toArray.qsort Name.lt + let fileNames := (tot.toArray.filter (!isInitImport ·)).qsort Name.lt logInfoAt (← getRef) m!"{"\n".intercalate (fileNames.map (s!"public import {·}")).toList}" /-- `#min_imports in cmd` scans the syntax `cmd` and the declaration obtained by elaborating `cmd` From 5b25c4e4eec9efe42ad274ea04e38566ce0f6bd1 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sat, 18 Apr 2026 23:11:30 +0000 Subject: [PATCH 088/116] fix test --- MathlibTest/ToDual.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/MathlibTest/ToDual.lean b/MathlibTest/ToDual.lean index 6b9b943762830d..f7958b84b06ade 100644 --- a/MathlibTest/ToDual.lean +++ b/MathlibTest/ToDual.lean @@ -32,7 +32,6 @@ structure Lattice (α : Type) extends SemilatticeInf α, SemilatticeSup α attribute [to_dual existing] Lattice.toSemilatticeInf -- we can reorder arguments of arguments in `SemilatticeInf.mk` -set_option linter.impossibleInstance false in @[to_dual, reducible] def le_inf_test [Min α] (le_inf : ∀ a b c : α, a ≤ b → a ≤ c → a ≤ b ⊓ c) : SemilatticeInf α where le_inf From 6723fdb82b64238061a7962d9d25487c3264828b Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sun, 19 Apr 2026 03:11:55 +0000 Subject: [PATCH 089/116] add set_options --- Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean | 1 + Mathlib/Algebra/Homology/DerivedCategory/Basic.lean | 2 ++ Mathlib/Algebra/Lie/Free.lean | 3 +++ Mathlib/Algebra/Lie/NonUnitalNonAssocAlgebra.lean | 2 ++ Mathlib/Analysis/CStarAlgebra/Matrix.lean | 1 + Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean | 1 + Mathlib/CategoryTheory/Pi/Basic.lean | 2 ++ Mathlib/CategoryTheory/Shift/Adjunction.lean | 1 + Mathlib/CategoryTheory/Shift/Twist.lean | 1 + Mathlib/CategoryTheory/Triangulated/Adjunction.lean | 1 + Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean | 1 + Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean | 1 + Mathlib/Geometry/Manifold/MFDeriv/Basic.lean | 3 +++ Mathlib/Geometry/Manifold/MFDeriv/FDeriv.lean | 1 + Mathlib/Geometry/Manifold/Riemannian/Basic.lean | 7 +++++++ Mathlib/Geometry/Manifold/VectorField/LieBracket.lean | 1 + 16 files changed, 29 insertions(+) diff --git a/Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean b/Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean index 28bdc737819ec3..4acec705b10a28 100644 --- a/Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean +++ b/Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean @@ -153,6 +153,7 @@ lemma prod_filter_not_mul_prod_filter (s : Finset ι) (p : ι → Prop) [Decidab (∏ x ∈ s with ¬p x, f x) * ∏ x ∈ s with p x, f x = ∏ x ∈ s, f x := by rw [mul_comm, prod_filter_mul_prod_filter_not] +set_option backward.isDefEq.respectTransparency false in @[to_additive] theorem prod_filter_xor (p q : ι → Prop) [DecidablePred p] [DecidablePred q] : (∏ x ∈ s with (Xor' (p x) (q x)), f x) = diff --git a/Mathlib/Algebra/Homology/DerivedCategory/Basic.lean b/Mathlib/Algebra/Homology/DerivedCategory/Basic.lean index 5113b5c5311b34..9826c7a0af2fa4 100644 --- a/Mathlib/Algebra/Homology/DerivedCategory/Basic.lean +++ b/Mathlib/Algebra/Homology/DerivedCategory/Basic.lean @@ -94,6 +94,7 @@ variable {C} /-- The localization functor `CochainComplex C ℤ ⥤ DerivedCategory C`. -/ def Q : CochainComplex C ℤ ⥤ DerivedCategory C := HomologicalComplexUpToQuasiIso.Q +set_option backward.isDefEq.respectTransparency false in instance : (Q (C := C)).IsLocalization (HomologicalComplex.quasiIso C (ComplexShape.up ℤ)) := by dsimp only [Q, DerivedCategory] @@ -114,6 +115,7 @@ variable (C) def quotientCompQhIso : HomotopyCategory.quotient C (ComplexShape.up ℤ) ⋙ Qh ≅ Q := HomologicalComplexUpToQuasiIso.quotientCompQhIso C (ComplexShape.up ℤ) +set_option backward.isDefEq.respectTransparency false in instance : Qh.IsLocalization (HomotopyCategory.quasiIso C (ComplexShape.up ℤ)) := by dsimp [Qh, DerivedCategory] infer_instance diff --git a/Mathlib/Algebra/Lie/Free.lean b/Mathlib/Algebra/Lie/Free.lean index a57c27ee357639..d92c65136e24f6 100644 --- a/Mathlib/Algebra/Lie/Free.lean +++ b/Mathlib/Algebra/Lie/Free.lean @@ -181,6 +181,7 @@ def of : X → FreeLieAlgebra R X := fun x => Quot.mk _ (lib.of R x) variable {L : Type w} [LieRing L] [LieAlgebra R L] +set_option backward.isDefEq.respectTransparency false in /-- An auxiliary definition used to construct the equivalence `lift` below. -/ def liftAux (f : X → CommutatorRing L) := lib.lift R f @@ -197,6 +198,7 @@ theorem liftAux_map_mul (f : X → L) (a b : lib R X) : liftAux R f (a * b) = ⁅liftAux R f a, liftAux R f b⁆ := map_mul _ a b +set_option backward.isDefEq.respectTransparency false in theorem liftAux_spec (f : X → L) (a b : lib R X) (h : FreeLieAlgebra.Rel R X a b) : liftAux R f a = liftAux R f b := by induction h with @@ -208,6 +210,7 @@ theorem liftAux_spec (f : X → L) (a b : lib R X) (h : FreeLieAlgebra.Rel R X a | mul_left c' _ h₂ => simp only [liftAux_map_mul, h₂] | mul_right c' _ h₂ => simp only [liftAux_map_mul, h₂] +set_option backward.isDefEq.respectTransparency false in /-- The quotient map as a `NonUnitalAlgHom`. -/ def mk : lib R X →ₙₐ[R] CommutatorRing (FreeLieAlgebra R X) where toFun := Quot.mk (Rel R X) diff --git a/Mathlib/Algebra/Lie/NonUnitalNonAssocAlgebra.lean b/Mathlib/Algebra/Lie/NonUnitalNonAssocAlgebra.lean index 3adc22863c3d97..34a498271a86f8 100644 --- a/Mathlib/Algebra/Lie/NonUnitalNonAssocAlgebra.lean +++ b/Mathlib/Algebra/Lie/NonUnitalNonAssocAlgebra.lean @@ -78,6 +78,7 @@ namespace LieHom variable {R L} variable {L₂ : Type w} [LieRing L₂] [LieAlgebra R L₂] +set_option backward.isDefEq.respectTransparency false in /-- Regarding the `LieRing` of a `LieAlgebra` as a `NonUnitalNonAssocRing`, we can regard a `LieHom` as a `NonUnitalAlgHom`. -/ @[simps] @@ -87,6 +88,7 @@ def toNonUnitalAlgHom (f : L →ₗ⁅R⁆ L₂) : CommutatorRing L →ₙₐ[R] map_zero' := f.toLinearMap.map_zero map_mul' := f.map_lie } +set_option backward.isDefEq.respectTransparency false in theorem toNonUnitalAlgHom_injective : Function.Injective (toNonUnitalAlgHom : _ → CommutatorRing L →ₙₐ[R] CommutatorRing L₂) := fun _ _ h => ext <| NonUnitalAlgHom.congr_fun h diff --git a/Mathlib/Analysis/CStarAlgebra/Matrix.lean b/Mathlib/Analysis/CStarAlgebra/Matrix.lean index 7d4a867e9e28da..49b0f9da83c61f 100644 --- a/Mathlib/Analysis/CStarAlgebra/Matrix.lean +++ b/Mathlib/Analysis/CStarAlgebra/Matrix.lean @@ -152,6 +152,7 @@ def l2OpNormedRingAux : NormedRing (Matrix n n 𝕜) := open Bornology Filter open scoped Topology Uniformity +set_option backward.isDefEq.respectTransparency false in /-- The metric on `Matrix m n 𝕜` arising from the operator norm given by the identification with (continuous) linear maps of `EuclideanSpace`. -/ @[instance_reducible] diff --git a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean index 264d9b44912b90..006e7944cc975b 100644 --- a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean +++ b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean @@ -135,6 +135,7 @@ section variable (C) +set_option backward.isDefEq.respectTransparency false in /-- Our normalization procedure works by first defining a functor `F C ⥤ (N C ⥤ N C)` (which turns out to be very easy), and then obtain a functor `F C ⥤ N C` by plugging in the normal object `𝟙_ C`. -/ diff --git a/Mathlib/CategoryTheory/Pi/Basic.lean b/Mathlib/CategoryTheory/Pi/Basic.lean index e606d46769205b..77c561baf3be22 100644 --- a/Mathlib/CategoryTheory/Pi/Basic.lean +++ b/Mathlib/CategoryTheory/Pi/Basic.lean @@ -102,6 +102,7 @@ def comapComp (f : K → J) (g : J → I) : comap C g ⋙ comap (C ∘ g) f ≅ { app := fun X b => 𝟙 (X (g (f b))) naturality := fun X Y f' => by simp only [comap, Function.comp]; funext; simp } +set_option backward.isDefEq.respectTransparency false in /-- The natural isomorphism between pulling back then evaluating, and just evaluating. -/ @[simps!] def comapEvalIsoEval (h : J → I) (j : J) : comap C h ⋙ eval (C ∘ h) j ≅ eval C (h j) := @@ -117,6 +118,7 @@ instance sumElimCategory : ∀ s : I ⊕ J, Category.{v₁} (Sum.elim C D s) | Sum.inl i => inferInstanceAs <| Category (C i) | Sum.inr j => inferInstanceAs <| Category (D j) +set_option backward.isDefEq.respectTransparency false in /-- The bifunctor combining an `I`-indexed family of objects with a `J`-indexed family of objects to obtain an `I ⊕ J`-indexed family of objects. -/ diff --git a/Mathlib/CategoryTheory/Shift/Adjunction.lean b/Mathlib/CategoryTheory/Shift/Adjunction.lean index 82a687d760a59e..8aec9c19e83b7b 100644 --- a/Mathlib/CategoryTheory/Shift/Adjunction.lean +++ b/Mathlib/CategoryTheory/Shift/Adjunction.lean @@ -612,6 +612,7 @@ this constructs the unique compatible `CommShift` structure on `E.functor`. noncomputable def commShiftFunctor [E.inverse.CommShift A] : E.functor.CommShift A := E.symm.toAdjunction.rightAdjointCommShift A +set_option backward.isDefEq.respectTransparency false in lemma commShift_of_inverse [E.inverse.CommShift A] : letI := E.commShiftFunctor A E.CommShift A := by diff --git a/Mathlib/CategoryTheory/Shift/Twist.lean b/Mathlib/CategoryTheory/Shift/Twist.lean index b76fea481b7617..e8a8b8707e01fb 100644 --- a/Mathlib/CategoryTheory/Shift/Twist.lean +++ b/Mathlib/CategoryTheory/Shift/Twist.lean @@ -92,6 +92,7 @@ identify to the shift functors on `C`. -/ noncomputable def shiftIso (m : A) : shiftFunctor t.Category m ≅ shiftFunctor C m := Iso.refl _ +set_option backward.isDefEq.respectTransparency false in lemma shiftFunctor_map {X Y : t.Category} (f : X ⟶ Y) (m : A) : (shiftFunctor t.Category m).map f = (t.shiftIso m).hom.app X ≫ (shiftFunctor C m).map f ≫ (t.shiftIso m).inv.app Y := by diff --git a/Mathlib/CategoryTheory/Triangulated/Adjunction.lean b/Mathlib/CategoryTheory/Triangulated/Adjunction.lean index e72a464aa967cc..c675701114d640 100644 --- a/Mathlib/CategoryTheory/Triangulated/Adjunction.lean +++ b/Mathlib/CategoryTheory/Triangulated/Adjunction.lean @@ -201,6 +201,7 @@ instance [h : E.inverse.IsTriangulated] : E.symm.functor.IsTriangulated := h lemma mk' (h : E.functor.IsTriangulated) : E.IsTriangulated where rightAdjoint_isTriangulated := E.toAdjunction.isTriangulated_rightAdjoint +set_option backward.isDefEq.respectTransparency false in /-- Constructor for `Equivalence.IsTriangulated`. -/ lemma mk'' (h : E.inverse.IsTriangulated) : E.IsTriangulated where leftAdjoint_isTriangulated := (mk' E.symm h).rightAdjoint_isTriangulated diff --git a/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean b/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean index 3f74a28e62c4fa..2104609b186b26 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean @@ -344,6 +344,7 @@ private lemma sum_ne_add_mod_eq_sub_one {c : ℕ} : rw [Nat.add_mod_mod, ← add_assoc, ← one_add_mul, show 1 + (r - 1) = r by lia, Nat.mul_add_mod_self_left] +set_option backward.isDefEq.respectTransparency false in lemma card_edgeFinset_turanGraph_add : #(turanGraph (n + r) r).edgeFinset = #(turanGraph n r).edgeFinset + n * (r - 1) + r.choose 2 := by diff --git a/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean b/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean index f973a3e23f437b..3adba4db1939fb 100644 --- a/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean +++ b/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean @@ -57,6 +57,7 @@ variable {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold I 1 M] {γ γ' : ℝ → M} {v : (x : M) → TangentSpace I x} {s s' : Set ℝ} (t₀ : ℝ) {x₀ : M} +set_option backward.isDefEq.respectTransparency false in /-- Existence of local integral curves for a $C^1$ vector field at interior points of a `C^1` manifold. -/ theorem exists_isMIntegralCurveAt_of_contMDiffAt [CompleteSpace E] diff --git a/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean b/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean index d38f6ab791ac74..d2a74b421108ca 100644 --- a/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean +++ b/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean @@ -514,6 +514,7 @@ theorem writtenInExtChartAt_comp (h : ContinuousWithinAt f s x) : variable {f' f₀' f₁' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)} {g' : TangentSpace I' (f x) →L[𝕜] TangentSpace I'' (g (f x))} +set_option backward.isDefEq.respectTransparency false in /-- `UniqueMDiffWithinAt` achieves its goal: it implies the uniqueness of the derivative. -/ protected nonrec theorem UniqueMDiffWithinAt.eq (U : UniqueMDiffWithinAt I s x) (h : HasMFDerivWithinAt I I' f s x f') (h₁ : HasMFDerivWithinAt I I' f s x f₁') : f' = f₁' := by @@ -717,6 +718,7 @@ lemma mfderivWithin_of_isOpen (hs : IsOpen s) (hx : x ∈ s) : mfderivWithin I I' f s x = mfderiv I I' f x := mfderivWithin_of_mem_nhds (hs.mem_nhds hx) +set_option backward.isDefEq.respectTransparency false in theorem hasMFDerivWithinAt_insert {y : M} : HasMFDerivWithinAt I I' f (insert y s) x f' ↔ HasMFDerivWithinAt I I' f s x f' := by have : T1Space M := I.t1Space M @@ -1115,6 +1117,7 @@ theorem mfderiv_congr {f' : M → M'} (h : f = f') : variable (x) +set_option backward.isDefEq.respectTransparency false in theorem HasMFDerivWithinAt.comp (hg : HasMFDerivWithinAt I' I'' g u (f x) g') (hf : HasMFDerivWithinAt I I' f s x f') (hst : s ⊆ f ⁻¹' u) : HasMFDerivWithinAt I I'' (g ∘ f) s x (g'.comp f') := by diff --git a/Mathlib/Geometry/Manifold/MFDeriv/FDeriv.lean b/Mathlib/Geometry/Manifold/MFDeriv/FDeriv.lean index 0226b4ec77ac3d..fb7321bf9001b9 100644 --- a/Mathlib/Geometry/Manifold/MFDeriv/FDeriv.lean +++ b/Mathlib/Geometry/Manifold/MFDeriv/FDeriv.lean @@ -50,6 +50,7 @@ the simpNF linter complains about this being `@[simp]`. -/ theorem writtenInExtChartAt_model_space : writtenInExtChartAt 𝓘(𝕜, E) 𝓘(𝕜, E') x f = f := rfl +set_option backward.isDefEq.respectTransparency false in theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} : HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x := by simpa only [HasMFDerivWithinAt, and_iff_right_iff_imp, mfld_simps] using diff --git a/Mathlib/Geometry/Manifold/Riemannian/Basic.lean b/Mathlib/Geometry/Manifold/Riemannian/Basic.lean index f3b1a21af91a0e..f2a06a9857450f 100644 --- a/Mathlib/Geometry/Manifold/Riemannian/Basic.lean +++ b/Mathlib/Geometry/Manifold/Riemannian/Basic.lean @@ -238,6 +238,7 @@ attribute [local instance] normedSpaceTangentSpaceVectorSpace variable (I) +set_option backward.isDefEq.respectTransparency false in lemma eventually_norm_mfderiv_extChartAt_lt (x : M) : ∃ C > 0, ∀ᶠ y in 𝓝 x, ‖mfderiv% (extChartAt I x) y‖ < C := by rcases eventually_norm_trivializationAt_lt E (fun (x : M) ↦ TangentSpace I x) x @@ -247,6 +248,7 @@ lemma eventually_norm_mfderiv_extChartAt_lt (x : M) : filter_upwards [hC, hx] with y hy h'y rwa [← TangentBundle.continuousLinearMapAt_trivializationAt h'y] +set_option backward.isDefEq.respectTransparency false in lemma eventually_enorm_mfderiv_extChartAt_lt (x : M) : ∃ C > (0 : ℝ≥0), ∀ᶠ y in 𝓝 x, ‖mfderiv% (extChartAt I x) y‖ₑ < C := by rcases eventually_norm_mfderiv_extChartAt_lt I x with ⟨C, C_pos, hC⟩ @@ -257,6 +259,7 @@ lemma eventually_enorm_mfderiv_extChartAt_lt (x : M) : simp only [enorm, nnnorm] exact_mod_cast hy +set_option backward.isDefEq.respectTransparency false in lemma eventually_norm_mfderivWithin_symm_extChartAt_comp_lt (x : M) : ∃ C > 0, ∀ᶠ y in 𝓝 x, ‖mfderiv[range I] (extChartAt I x).symm (extChartAt I x y)‖ < C := by rcases eventually_norm_symmL_trivializationAt_lt E (fun (x : M) ↦ TangentSpace I x) x @@ -269,6 +272,7 @@ lemma eventually_norm_mfderivWithin_symm_extChartAt_comp_lt (x : M) : (extChartAt I x).left_inv (by simpa using h'y) convert hy using 3 <;> congr +set_option backward.isDefEq.respectTransparency false in lemma eventually_norm_mfderivWithin_symm_extChartAt_lt (x : M) : ∃ C > 0, ∀ᶠ y in 𝓝[range I] (extChartAt I x x), ‖mfderiv[range I] (extChartAt I x).symm y‖ < C := by @@ -283,6 +287,7 @@ lemma eventually_norm_mfderivWithin_symm_extChartAt_lt (x : M) : simp only [preimage_setOf_eq, mem_setOf_eq] at hy convert hy +set_option backward.isDefEq.respectTransparency false in lemma eventually_enorm_mfderivWithin_symm_extChartAt_lt (x : M) : ∃ C > (0 : ℝ≥0), ∀ᶠ y in 𝓝[range I] (extChartAt I x x), ‖mfderiv[range I] (extChartAt I x).symm y‖ₑ < C := by @@ -294,6 +299,7 @@ lemma eventually_enorm_mfderivWithin_symm_extChartAt_lt (x : M) : simp only [enorm, nnnorm] exact_mod_cast hy +set_option backward.isDefEq.respectTransparency false in /-- Around any point `x`, the Riemannian distance between two points is controlled by the distance in the extended chart. In other words, the extended chart is locally Lipschitz. -/ lemma eventually_riemannianEDist_le_edist_extChartAt (x : M) : @@ -378,6 +384,7 @@ lemma eventually_riemannianEDist_lt (x : M) {c : ℝ≥0∞} (hc : 0 < c) : · exact Or.inl (mod_cast C_pos.ne') · simp +set_option backward.isDefEq.respectTransparency false in /-- Any neighborhood of `x` contains all the points which are close enough to `x` for the Riemannian distance, `ℝ≥0` version. -/ lemma setOf_riemannianEDist_lt_subset_nhds [RegularSpace M] {x : M} {s : Set M} (hs : s ∈ 𝓝 x) : diff --git a/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean b/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean index 601b1cf94125de..aacb1b22da23c5 100644 --- a/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean +++ b/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean @@ -207,6 +207,7 @@ theorem mlieBracketWithin_eventually_congr_set (h : s =ᶠ[𝓝 x] t) : mlieBracketWithin I V W s =ᶠ[𝓝 x] mlieBracketWithin I V W t := mlieBracketWithin_eventually_congr_set' x <| h.filter_mono inf_le_left +set_option backward.isDefEq.respectTransparency false in theorem _root_.Filter.EventuallyEq.mlieBracketWithin_vectorField_eq (hV : V₁ =ᶠ[𝓝[s] x] V) (hxV : V₁ x = V x) (hW : W₁ =ᶠ[𝓝[s] x] W) (hxW : W₁ x = W x) : mlieBracketWithin I V₁ W₁ s x = mlieBracketWithin I V W s x := by From 4c45d0e081543d13f714a1c4c7511b5ec12cc1bb Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Sun, 19 Apr 2026 09:22:25 +0000 Subject: [PATCH 090/116] chore: bump to nightly-2026-04-19 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 474b1d259a11e1..1883470497275d 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-17 +leanprover/lean4:nightly-2026-04-19 From eaa4c1f5f5dae95eae9121a7367d849d9d521bd8 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Mon, 20 Apr 2026 09:49:18 +0000 Subject: [PATCH 091/116] chore: bump to nightly-2026-04-20 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 1883470497275d..f4ad0908656808 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-19 +leanprover/lean4:nightly-2026-04-20 From 9d91c9df28cc24f6ac0fe33ffefd02cf1ba7470b Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 21 Apr 2026 01:53:39 +0000 Subject: [PATCH 092/116] fix bad merge --- Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean b/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean index 3fde74fdd517d6..6d0c444536dbd5 100644 --- a/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean +++ b/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean @@ -344,7 +344,6 @@ instance instNonUnitalSemiring [Fintype n] [NonUnitalSemiring A] : NonUnitalSemiring (CStarMatrix n n A) := inferInstanceAs <| NonUnitalSemiring (Matrix n n A) -set_option backward.inferInstanceAs.wrap false in instance instNonAssocSemiring [Fintype n] [DecidableEq n] [NonAssocSemiring A] : NonAssocSemiring (CStarMatrix n n A) := inferInstanceAs <| NonAssocSemiring (Matrix n n A) @@ -353,17 +352,14 @@ instance instNonUnitalRing [Fintype n] [NonUnitalRing A] : NonUnitalRing (CStarMatrix n n A) := inferInstanceAs <| NonUnitalRing (Matrix n n A) -set_option backward.inferInstanceAs.wrap false in instance instNonAssocRing [Fintype n] [DecidableEq n] [NonAssocRing A] : NonAssocRing (CStarMatrix n n A) := inferInstanceAs <| NonAssocRing (Matrix n n A) -set_option backward.inferInstanceAs.wrap false in instance instSemiring [Fintype n] [DecidableEq n] [Semiring A] : Semiring (CStarMatrix n n A) := inferInstanceAs <| Semiring (Matrix n n A) -set_option backward.inferInstanceAs.wrap false in instance instRing [Fintype n] [DecidableEq n] [Ring A] : Ring (CStarMatrix n n A) := inferInstanceAs <| Ring (Matrix n n A) From 67244f5852012269befab8549db4653a4eced0a4 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 21 Apr 2026 01:55:56 +0000 Subject: [PATCH 093/116] fix #guard_msgs output --- MathlibTest/GCongr/GCongr.lean | 2 +- MathlibTest/GRewrite.lean | 4 ++-- MathlibTest/Linarith/Basic.lean | 1 - MathlibTest/congr.lean | 1 - MathlibTest/conv_widget.lean | 9 +++------ 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/MathlibTest/GCongr/GCongr.lean b/MathlibTest/GCongr/GCongr.lean index 3cb0b28ac3808b..bc179f0ac16bc5 100644 --- a/MathlibTest/GCongr/GCongr.lean +++ b/MathlibTest/GCongr/GCongr.lean @@ -48,7 +48,7 @@ a b c d : ℕ h : b~d ⊢ a~a -case a.a +case a a b c d : ℕ h : b~d ⊢ c~c diff --git a/MathlibTest/GRewrite.lean b/MathlibTest/GRewrite.lean index 02d182d02c77eb..2b448a18bb9595 100644 --- a/MathlibTest/GRewrite.lean +++ b/MathlibTest/GRewrite.lean @@ -215,7 +215,7 @@ the inequality goes in the wrong direction). -/ /-- error: Tactic `grewrite` failed: could not discharge x ≤ y using x ≥ y -case h₁.hbc +case hbc x y b : ℚ h : x ≥ y ⊢ x ≤ y @@ -257,7 +257,7 @@ example {Prime : ℕ → Prop} {a a' : ℕ} (h₁ : Prime (a + 1)) (h₂ : a = a /-- error: Tactic `grewrite` failed: could not discharge b ≤ a using a ≤ b -case h₂.hbc +case hbc a b c : ℚ h₁ : a ≤ b h₂ : 0 ≤ c diff --git a/MathlibTest/Linarith/Basic.lean b/MathlibTest/Linarith/Basic.lean index cd2a2ff1e417f4..eab07a23d41037 100644 --- a/MathlibTest/Linarith/Basic.lean +++ b/MathlibTest/Linarith/Basic.lean @@ -728,7 +728,6 @@ example (x : ℤ) : 0 ≤ x * wrapped x := by nlinarith def tightlyWrapped (z : ℤ) : ℤ := z /-- error: linarith failed to find a contradiction -case h x : ℤ a✝ : x * tightlyWrapped x < 0 ⊢ False diff --git a/MathlibTest/congr.lean b/MathlibTest/congr.lean index 6059cfc331d35a..2a464de012202e 100644 --- a/MathlibTest/congr.lean +++ b/MathlibTest/congr.lean @@ -332,7 +332,6 @@ example (inst1 : BEq α) [LawfulBEq α] (inst2 : BEq α) [LawfulBEq α] (xs : Li /-- error: unsolved goals -case h.e'_2 α : Type inst1 : BEq α inst✝¹ : LawfulBEq α diff --git a/MathlibTest/conv_widget.lean b/MathlibTest/conv_widget.lean index aa96c24b73c7a0..0a3c1f34fa301a 100644 --- a/MathlibTest/conv_widget.lean +++ b/MathlibTest/conv_widget.lean @@ -83,8 +83,7 @@ conv => enter [1, x, 5] skip --- -trace: case h -x : False +trace: x : False | true -/ #guard_msgs in @@ -115,8 +114,7 @@ conv => enter [1, 0, x, 1] skip --- -trace: case h -x : Unit +trace: x : Unit | false -/ #guard_msgs in @@ -384,8 +382,7 @@ conv => enter [1, 0, x0, x1, x2, 2] skip --- -trace: case h.h.h -x0 x1 x2 : Bool → Nat +trace: x0 x1 x2 : Bool → Nat | x2 true -/ #guard_msgs in From eac921f2b623b0ad1f9aa248c9d5d6985b256ecf Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Wed, 22 Apr 2026 09:28:01 +0000 Subject: [PATCH 094/116] chore: bump to nightly-2026-04-22 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index f4ad0908656808..2e20467ac1e8ba 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-20 +leanprover/lean4:nightly-2026-04-22 From 2d5b4c4daf29dcb3226b2e2c567b5a8bb087d74e Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Thu, 23 Apr 2026 09:34:29 +0000 Subject: [PATCH 095/116] chore: bump to nightly-2026-04-23 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 2e20467ac1e8ba..cc7ac4d9d55b08 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-22 +leanprover/lean4:nightly-2026-04-23 From ec099242102ff35030e117d30b04e6ee6615b854 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 09:34:19 +1000 Subject: [PATCH 096/116] cleanup --- .../Order/GroupWithZero/Canonical.lean | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean index a02972a34948f3..9cfd8a95d6e0de 100644 --- a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean +++ b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean @@ -423,26 +423,18 @@ section Lattice def withZeroSup [Max α] : WithZero α → WithZero α → WithZero α := Option.merge (· ⊔ ·) -theorem withZeroSup_zero_zero [Max α] : (withZeroSup (0 : WithZero α) 0) = 0 := rfl -theorem withZeroSup_coe_zero [Max α] (a : α) : (withZeroSup (↑a : WithZero α) 0) = ↑a := rfl -theorem withZeroSup_zero_coe [Max α] (b : α) : (withZeroSup (0 : WithZero α) ↑b) = ↑b := rfl -theorem withZeroSup_coe_coe [Max α] (a b : α) : +@[simp] theorem withZeroSup_zero_zero [Max α] : (withZeroSup (0 : WithZero α) 0) = 0 := rfl +@[simp] theorem withZeroSup_coe_zero [Max α] (a : α) : (withZeroSup (↑a : WithZero α) 0) = ↑a := rfl +@[simp] theorem withZeroSup_zero_coe [Max α] (b : α) : (withZeroSup (0 : WithZero α) ↑b) = ↑b := rfl +@[simp] theorem withZeroSup_coe_coe [Max α] (a b : α) : (withZeroSup (↑a : WithZero α) ↑b) = ↑(a ⊔ b) := rfl instance semilatticeSup [SemilatticeSup α] : SemilatticeSup (WithZero α) where sup := withZeroSup - le_sup_left x y := by - cases x <;> cases y <;> - simp [withZeroSup_zero_zero, withZeroSup_coe_zero, withZeroSup_zero_coe, - withZeroSup_coe_coe, WithZero.coe_le_coe, le_sup_left, WithZero.zero_le] - le_sup_right x y := by - cases x <;> cases y <;> - simp [withZeroSup_zero_zero, withZeroSup_coe_zero, withZeroSup_zero_coe, - withZeroSup_coe_coe, WithZero.coe_le_coe, le_sup_right, WithZero.zero_le] + le_sup_left x y := by cases x <;> cases y <;> simp + le_sup_right x y := by cases x <;> cases y <;> simp sup_le x y z := by - cases x <;> cases y <;> cases z <;> - simp [withZeroSup_zero_zero, withZeroSup_coe_zero, withZeroSup_zero_coe, - withZeroSup_coe_coe, WithZero.coe_le_coe, WithZero.zero_le] + cases x <;> cases y <;> cases z <;> simp simpa using sup_le theorem coe_sup [SemilatticeSup α] (a b : α) : ((a ⊔ b : α) : WithZero α) = (a : WithZero α) ⊔ b := From f0689d0419bf886b82155a1720673eac355524c0 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 09:39:53 +1000 Subject: [PATCH 097/116] revert an unnecessary change --- Mathlib/CategoryTheory/Bicategory/Coherence.lean | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Bicategory/Coherence.lean b/Mathlib/CategoryTheory/Bicategory/Coherence.lean index 5b0ce3b8eeb957..519fce411589f7 100644 --- a/Mathlib/CategoryTheory/Bicategory/Coherence.lean +++ b/Mathlib/CategoryTheory/Bicategory/Coherence.lean @@ -182,8 +182,7 @@ theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f simp -- p ≠ nil required! See the docstring of `normalizeAux`. | whisker_left _ _ ih => - simp only [normalizeIso_comp, normalizeAux_comp, quot_whisker_left, - Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom] + dsimp rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih] simp | whisker_right h η' ih => @@ -192,8 +191,6 @@ theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f have := dcongr_arg (fun x => (normalizeIso x h).hom) (normalizeAux_congr p (Quot.mk _ η')) dsimp at this; simp [this] | _ => - simp only [normalizeIso_comp, normalizeIso_id, normalizeAux_comp, normalizeAux_id, - Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom] simp -- Not `@[simp]` because it is not in `simp`-normal form. From a6de9c2382a0703d2ebc5454692d9d4cb1958bb2 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 09:53:29 +1000 Subject: [PATCH 098/116] revert unnecessary changes --- Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean | 6 +++--- .../Sites/DenseSubsite/OneHypercoverDense.lean | 5 +---- Mathlib/CategoryTheory/Sites/Hypercover/One.lean | 8 +++----- Mathlib/Data/Nat/Bitwise.lean | 13 +++---------- Mathlib/NumberTheory/Zsqrtd/Basic.lean | 3 +-- 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean index 065c4cffb89189..c8801b556a8a11 100644 --- a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean +++ b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean @@ -261,18 +261,18 @@ theorem normalize_naturality (n : NormalMonoidalObject C) {X Y : F C} (f : X ⟶ case comp f g ihf ihg => simp [ihg, reassoc_of% (ihf _)] case whiskerLeft X' X Y f ih => intro n - simp only [normalizeObj_tensor, normalizeIsoApp'_tensor, Iso.trans_hom, + dsimp only [normalizeObj_tensor, normalizeIsoApp'_tensor, Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom, Function.comp_apply, inclusion_obj] rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih] simp case whiskerRight X Y h η' ih => intro n - simp only [normalizeObj_tensor, normalizeIsoApp'_tensor, Iso.trans_hom, + dsimp only [normalizeObj_tensor, normalizeIsoApp'_tensor, Iso.trans_hom, Iso.symm_hom, whiskerRightIso_hom, Function.comp_apply, inclusion_obj] rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih] have := dcongr_arg (fun x => (normalizeIsoApp' C η' x).hom) (normalizeObj_congr n h) simp [this] - all_goals simp [normalizeIsoApp'_tensor, normalizeIsoApp'_unit] + all_goals simp end diff --git a/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean b/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean index 0d8a00a6f814a9..d9110e17b9eee1 100644 --- a/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean +++ b/Mathlib/CategoryTheory/Sites/DenseSubsite/OneHypercoverDense.lean @@ -107,10 +107,7 @@ def multicospanMap {P Q : C₀ᵒᵖ ⥤ A} (f : P ⟶ Q) : | WalkingMulticospan.right j => f.app _ naturality := by rintro (i₁ | j₁) (i₂ | j₂) (_ | _) <;> - simp only [multicospanIndex, - MulticospanIndex.multicospan, - Category.id_comp, Category.comp_id, - f.naturality] + simp [MulticospanIndex.multicospan] /-- The natural isomorphism between the diagrams attached to `data : F.PreOneHypercoverDenseData X` that are induced by isomorphisms in `C₀ᵒᵖ ⥤ A`. -/ diff --git a/Mathlib/CategoryTheory/Sites/Hypercover/One.lean b/Mathlib/CategoryTheory/Sites/Hypercover/One.lean index 45b018cc96f8bb..6d3b53aa6ecd28 100644 --- a/Mathlib/CategoryTheory/Sites/Hypercover/One.lean +++ b/Mathlib/CategoryTheory/Sites/Hypercover/One.lean @@ -752,11 +752,9 @@ def Hom.mapMulticospan {E : PreOneHypercover.{w} S} {F : PreOneHypercover.{w'} S | .left _ => rfl | .right _ => rfl map_comp - | .id _, _ => by simp only [WalkingMulticospan.Hom.id_eq_id, Category.id_comp] - | .fst _, .id _ => by - simp only [WalkingMulticospan.Hom.id_eq_id, Category.comp_id] - | .snd _, .id _ => by - simp only [WalkingMulticospan.Hom.id_eq_id, Category.comp_id] + | .id _, _ => by simp + | .fst _, .id _ => by simp + | .snd _, .id _ => by simp set_option backward.isDefEq.respectTransparency false in /-- Isomorphic pre-`1`-hypercovers have equivalent multifork index categories. -/ diff --git a/Mathlib/Data/Nat/Bitwise.lean b/Mathlib/Data/Nat/Bitwise.lean index 06d2fef267ecb8..af49dc84185225 100644 --- a/Mathlib/Data/Nat/Bitwise.lean +++ b/Mathlib/Data/Nat/Bitwise.lean @@ -356,23 +356,16 @@ theorem xor_range (n : ℕ) : (List.range (n + 1)).foldl (· ^^^ ·) 0 = rw [List.range_succ, List.foldl_append, ih, ← Fin.ofNat_add, List.foldl_cons, List.foldl_nil] match h : Fin.ofNat 4 n with | 0 => - rw [Fin.zero_add] - simp only [OfNat.ofNat] - rw [← xor_one_of_even <| even_iff.mpr ?_, xor_xor_cancel_left] + rw [Fin.zero_add, ← xor_one_of_even <| even_iff.mpr ?_, xor_xor_cancel_left] rw [← @mod_mod_of_dvd _ 4 _ <| by simp, ← Fin.val_ofNat 4, h] rfl | 1 => - simp only [OfNat.ofNat, Fin.ofNat, Nat.reduceMod, Fin.add_def] rw [Nat.xor_comm] refine xor_one_of_even <| even_iff.mpr ?_ rw [add_mod, ← @mod_mod_of_dvd _ 4 n <| by simp, ← Fin.val_ofNat 4, h] rfl - | 2 => - simp only [OfNat.ofNat, Fin.ofNat, Nat.reduceMod, Fin.add_def] - apply Nat.xor_self - | 3 => - simp only [OfNat.ofNat, Fin.ofNat, Nat.reduceMod, Fin.add_def] - apply zero_xor + | 2 => apply Nat.xor_self + | 3 => apply zero_xor lemma shiftLeft_lt {x n m : ℕ} (h : x < 2 ^ n) : x <<< m < 2 ^ (n + m) := by simp only [Nat.pow_add, shiftLeft_eq, Nat.mul_lt_mul_right (Nat.two_pow_pos _), h] diff --git a/Mathlib/NumberTheory/Zsqrtd/Basic.lean b/Mathlib/NumberTheory/Zsqrtd/Basic.lean index 438b621e676dfe..90d67a8af5a566 100644 --- a/Mathlib/NumberTheory/Zsqrtd/Basic.lean +++ b/Mathlib/NumberTheory/Zsqrtd/Basic.lean @@ -639,8 +639,7 @@ open Int in theorem le_arch (a : ℤ√d) : ∃ n : ℕ, a ≤ n := by obtain ⟨x, y, (h : a ≤ ⟨x, y⟩)⟩ : ∃ x y : ℕ, Nonneg (⟨x, y⟩ + -a) := match -a with - | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by - change Nonneg ⟨_, _⟩; simp [Nonneg, Nonnegg]⟩ + | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by trivial⟩ | ⟨Int.ofNat x, -[y+1]⟩ => ⟨0, y + 1, by simp only [Nonneg, Nonnegg, Nat.cast_zero, ofNat_eq_natCast, zero_add, Nat.cast_add, Nat.cast_one, negSucc_eq, neg_add_rev, reduceNeg, From c619ce1777f5d1b133bc80c4f7f023baca0e45cd Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 10:17:24 +1000 Subject: [PATCH 099/116] add adaptation notes --- Mathlib/Algebra/Group/Defs.lean | 10 ++++++ Mathlib/Algebra/Homology/ExactSequence.lean | 11 ++++++ .../Algebra/Homology/HomologicalComplex.lean | 9 +++++ .../Algebra/Homology/HomologySequence.lean | 13 ++++++- .../Homology/SpectralObject/Cycles.lean | 3 +- Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 10 ++++++ .../ComposableArrows/Basic.lean | 21 ++++++++++++ .../CategoryTheory/ComposableArrows/One.lean | 10 ++++++ .../CategoryTheory/ComposableArrows/Two.lean | 20 +++++++++++ .../Limits/Shapes/Equalizers.lean | 9 +++++ .../Limits/Shapes/Multiequalizer.lean | 30 +++++++++++++--- Mathlib/CategoryTheory/Sites/Whiskering.lean | 10 ++++++ Mathlib/Data/Num/ZNum.lean | 34 +++++++++++++++++-- Mathlib/NumberTheory/Zsqrtd/Basic.lean | 9 +++++ .../UniqueFactorizationDomain/FactorSet.lean | 9 +++++ Mathlib/SetTheory/Ordinal/Notation.lean | 34 +++++++++++++++++++ 16 files changed, 231 insertions(+), 11 deletions(-) diff --git a/Mathlib/Algebra/Group/Defs.lean b/Mathlib/Algebra/Group/Defs.lean index 355684cbc3ad54..dfc9b2606622d7 100644 --- a/Mathlib/Algebra/Group/Defs.lean +++ b/Mathlib/Algebra/Group/Defs.lean @@ -15,6 +15,7 @@ public import Mathlib.Tactic.MkIffOfInductiveProp public import Mathlib.Tactic.OfNat public import Mathlib.Data.Nat.Notation public import Mathlib.Tactic.Simps.Basic +public import Mathlib.Tactic.AdaptationNote /-! # Typeclasses for (semi)groups and monoids @@ -525,6 +526,15 @@ theorem npowRec'_two_mul {M : Type*} [Semigroup M] [One M] (k : ℕ) (m : M) : | 0 => rfl | 1 => simp [npowRec'] | k + 2 => + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + simp [npowRec', ← mul_assoc, ← ih] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ rw [show 2 * (k + 2) = k + k + 4 from by omega] simp only [npowRec'] rw [← ih (k + 1) (by omega), show 2 * (k + 1) = k + k + 2 from by omega] diff --git a/Mathlib/Algebra/Homology/ExactSequence.lean b/Mathlib/Algebra/Homology/ExactSequence.lean index 51c41c0a0910a9..704996756e86b7 100644 --- a/Mathlib/Algebra/Homology/ExactSequence.lean +++ b/Mathlib/Algebra/Homology/ExactSequence.lean @@ -222,6 +222,17 @@ lemma isComplex₂_mk (S : ComposableArrows C 2) (w : S.map' 0 1 ≫ S.map' 1 2 S.IsComplex := S.isComplex₂_iff.2 w +#adaptation_note /-- Proof repaired after leanprover/lean4#13363. +The proof used to be just +``` +isComplex₂_mk _ (by simp [-Fin.reduceFinMk]) +``` +(with a comment noting that `Fin.reduceFinMk` had to be disabled so that `Precompose.map_one_succ` +applied; see https://github.com/leanprover-community/mathlib4/issues/27382). +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ set_option backward.isDefEq.respectTransparency false in lemma _root_.CategoryTheory.ShortComplex.isComplex_toComposableArrows (S : ShortComplex C) : S.toComposableArrows.IsComplex := diff --git a/Mathlib/Algebra/Homology/HomologicalComplex.lean b/Mathlib/Algebra/Homology/HomologicalComplex.lean index 8b825ee6542844..13b9f5e8ef0973 100644 --- a/Mathlib/Algebra/Homology/HomologicalComplex.lean +++ b/Mathlib/Algebra/Homology/HomologicalComplex.lean @@ -729,6 +729,15 @@ lemma mkAux_eq_shortComplex_mk_d_comp_d (n : ℕ) : ShortComplex.mk _ _ ((mk X₀ X₁ X₂ d₀ d₁ s succ).d_comp_d (n + 2) (n + 1) n) := by change ShortComplex.mk _ _ (mkAux X₀ X₁ X₂ d₀ d₁ s succ n).zero = _ dsimp [mk, of, mkAux] + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + simp + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ simp only [show n + 2 = n + 1 + 1 from rfl, ↓reduceDIte] congr 1 <;> exact (Category.id_comp _).symm diff --git a/Mathlib/Algebra/Homology/HomologySequence.lean b/Mathlib/Algebra/Homology/HomologySequence.lean index ddeb6d2fa343d6..4b4459ebb2b4b7 100644 --- a/Mathlib/Algebra/Homology/HomologySequence.lean +++ b/Mathlib/Algebra/Homology/HomologySequence.lean @@ -161,7 +161,18 @@ noncomputable def composableArrows₃Functor [CategoryWithHomology C] : (homologyMap φ j) (by set_option backward.isDefEq.respectTransparency false in simp) (by set_option backward.isDefEq.respectTransparency false in simp [-Fin.reduceFinMk]) - (by change K.homologyπ j ≫ homologyMap φ j = cyclesMap φ j ≫ L.homologyπ j; simp) + (#adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + by simp [-Fin.reduceFinMk] + ``` + (`Fin.reduceFinMk` was disabled so that `Precomp.obj_succ` would fire; see + https://github.com/leanprover-community/mathlib4/issues/27382). + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ + by change K.homologyπ j ≫ homologyMap φ j = cyclesMap φ j ≫ L.homologyπ j; simp) end HomologySequence diff --git a/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean b/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean index e4b56e648dafe9..6fb8b18a9afa3d 100644 --- a/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean +++ b/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean @@ -313,8 +313,7 @@ lemma toCycles_cyclesMap (α : mk₂ f g ⟶ mk₂ f' g') (β : mk₁ fg ⟶ mk · dsimp rw [hβ₀] exact naturality' α 0 1 - · dsimp - simp [hβ₁] + · simp [hβ₁] /-- The map `H^n(f) ⟶ H^n(f ≫ g)` factors through `opZ^n(f, g)`. -/ noncomputable def fromOpcycles (n : ℤ) : diff --git a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean index d1715122993869..90ad2d99dedc59 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean @@ -209,6 +209,16 @@ theorem contDiffWithinAt_infty : theorem ContDiffWithinAt.continuousWithinAt (h : ContDiffWithinAt 𝕜 n f s x) : ContinuousWithinAt f s x := by have := h.of_le (zero_le _) + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The next two lines of this proof were previously just + ``` + simp only [ContDiffWithinAt, nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, + CharP.cast_eq_zero] at this + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ change ∀ m : ℕ, (m : ℕ∞) ≤ 0 → _ at this simp only [nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, CharP.cast_eq_zero] at this rcases this with ⟨u, hu, p, H⟩ diff --git a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean index 1de7bb8fa31cac..74f1da8ee84ca2 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean @@ -225,6 +225,13 @@ lemma hom_ext₀ {F G : ComposableArrows C 0} {φ φ' : F ⟶ G} fin_cases i exact h +#adaptation_note /-- After leanprover/lean4#13363, the `hom_inv_id` and `inv_hom_id` fields +needed to be supplied explicitly. Previously they were not necessary, and were proved by the +`auto_param`. +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ /-- Constructor for isomorphisms in `ComposableArrows C 0`. -/ @[simps!] def isoMk₀ {F G : ComposableArrows C 0} (e : F.obj' 0 ≅ G.obj' 0) : F ≅ G where @@ -267,6 +274,13 @@ lemma hom_ext₁ {F G : ComposableArrows C 1} {φ φ' : F ⟶ G} | 0 => exact h₀ | 1 => exact h₁ +#adaptation_note /-- After leanprover/lean4#13363, the `hom_inv_id` and `inv_hom_id` fields +needed to be supplied explicitly. Previously they were not necessary, and were proved by the +`auto_param`. +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ /-- Constructor for isomorphisms in `ComposableArrows C 1`. -/ @[simps!] def isoMk₁ {F G : ComposableArrows C 1} @@ -628,6 +642,13 @@ lemma hom_ext₂ {f g : ComposableArrows C 2} {φ φ' : f ⟶ g} φ = φ' := hom_ext_succ h₀ (hom_ext₁ h₁ h₂) +#adaptation_note /-- After leanprover/lean4#13363, the `hom_inv_id` and `inv_hom_id` fields +needed to be supplied explicitly. Previously they were not necessary, and were proved by the +`auto_param`. +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ /-- Constructor for isomorphisms in `ComposableArrows C 2`. -/ @[simps] def isoMk₂ {f g : ComposableArrows C 2} diff --git a/Mathlib/CategoryTheory/ComposableArrows/One.lean b/Mathlib/CategoryTheory/ComposableArrows/One.lean index 32059e67a467d5..2c85966bf45de7 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/One.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/One.lean @@ -31,6 +31,16 @@ def functorArrows (i j n : ℕ) (hij : i ≤ j := by lia) (hj : j ≤ n := by li obj S := mk₁ (S.map' i j) map {S S'} φ := homMk₁ (φ.app _) (φ.app _) (φ.naturality _) +#adaptation_note /-- Proof repaired after leanprover/lean4#13363. +The `app` subproof used to be just +``` +(by simp [← Functor.map_comp]) +``` +and the `naturality` field was not necessary, and was proved by the `auto_param`. +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ set_option backward.isDefEq.respectTransparency false in /-- The natural transformation `functorArrows C i j n ⟶ functorArrows C i' j' n` when `i ≤ i'` and `j ≤ j'`. -/ diff --git a/Mathlib/CategoryTheory/ComposableArrows/Two.lean b/Mathlib/CategoryTheory/ComposableArrows/Two.lean index 7fc2379f5d5581..cba42ce30bd5ae 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Two.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Two.lean @@ -61,11 +61,31 @@ lemma twoδ₁Toδ₀_app_zero : lemma twoδ₁Toδ₀_app_one : (twoδ₁Toδ₀ f g fg h).app 1 = 𝟙 _ := by with_unfolding_all rfl +#adaptation_note /-- Proof repaired after leanprover/lean4#13363. +The proof body used to be just +``` +rw [isIso_iff₁] +constructor <;> dsimp <;> infer_instance +``` +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ set_option backward.isDefEq.respectTransparency false in instance [IsIso g] : IsIso (twoδ₂Toδ₁ f g fg h) := by rw [isIso_iff₁, twoδ₂Toδ₁_app_zero, twoδ₂Toδ₁_app_one] exact ⟨inferInstance, ‹_›⟩ +#adaptation_note /-- Proof repaired after leanprover/lean4#13363. +The proof body used to be just +``` +rw [isIso_iff₁] +constructor <;> dsimp <;> infer_instance +``` +The replacement proof is a short-term fix, and we request that the authors/maintainers of +this file review the proof, and either approve it by removing this adaptation note, revise +the proof or the prerequisites appropriately, or minimize a problem in lean4 that still +needs addressing. -/ set_option backward.isDefEq.respectTransparency false in instance [IsIso f] : IsIso (twoδ₁Toδ₀ f g fg h) := by rw [isIso_iff₁, twoδ₁Toδ₀_app_zero, twoδ₁Toδ₀_app_one] diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean index fb855ffc12155f..5f4fe226ff646c 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean @@ -227,6 +227,15 @@ def parallelPair (f g : X ⟶ Y) : WalkingParallelPair ⥤ C where | right => g -- `sorry` can cope with this, but it's too slow: map_comp := by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to be + ``` + rintro _ _ _ ⟨⟩ g <;> cases g <;> simp + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ rintro _ _ _ ⟨⟩ g <;> cases g <;> dsimp only [CategoryStruct.comp, CategoryStruct.id, WalkingParallelPairHom.comp] <;> first | rfl | simp diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean index 7906be4f02c84b..7ab28b9b13664d 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean @@ -540,6 +540,17 @@ def ofι {J : MulticospanShape.{w, w'}} (I : MulticospanIndex J C) | WalkingMulticospan.left _ => ι _ | WalkingMulticospan.right b => ι (J.fst b) ≫ I.fst b naturality := by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + rintro (_ | _) (_ | _) (_ | _ | _) <;> + dsimp <;> simp only [Category.id_comp, Category.comp_id] + apply w + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ rintro (_ | _) (_ | _) (_ | _ | _) <;> simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id, Functor.const_obj_map, Category.comp_id] <;> @@ -660,16 +671,25 @@ def ofPiFork | WalkingMulticospan.left _ => a.ι ≫ c.proj _ | WalkingMulticospan.right _ => a.ι ≫ I.fstPiMapOfIsLimit c hd ≫ d.proj _ π.naturality := by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + rintro (_ | _) (_ | _) (_ | _ | _) + · simp + · simp + · dsimp; rw [a.condition_assoc]; simp + · simp + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ rintro (_ | _) (_ | _) (_ | _ | _) - -- left.left.id · simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id, Functor.const_obj_map, Category.comp_id] exact Category.id_comp _ - -- left.right.fst - · dsimp; simp [MulticospanIndex.fstPiMapOfIsLimit_proj] - -- left.right.snd + · simp · dsimp; rw [a.condition_assoc]; simp - -- right.right.id · simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id, Functor.const_obj_map, Category.comp_id] exact Category.id_comp _ diff --git a/Mathlib/CategoryTheory/Sites/Whiskering.lean b/Mathlib/CategoryTheory/Sites/Whiskering.lean index 53f3a3b072250b..2d09f8cb1252f7 100644 --- a/Mathlib/CategoryTheory/Sites/Whiskering.lean +++ b/Mathlib/CategoryTheory/Sites/Whiskering.lean @@ -116,6 +116,16 @@ def multicospanComp : (S.index (P ⋙ F)).multicospan ≅ (S.index P).multicospa | WalkingMulticospan.left _ => Iso.refl _ | WalkingMulticospan.right _ => Iso.refl _) (by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The body of this `by` block was previously + ``` + rintro (a | b) (a | b) (f | f | f) + all_goals cat_disch + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ rintro (a | b) (a | b) (f | f | f) <;> simp only [WalkingMulticospan.Hom.id_eq_id, Iso.refl_hom, Category.id_comp, Category.comp_id, Functor.map_id] <;> diff --git a/Mathlib/Data/Num/ZNum.lean b/Mathlib/Data/Num/ZNum.lean index d80dc8453d95c2..00f7678bfd45e3 100644 --- a/Mathlib/Data/Num/ZNum.lean +++ b/Mathlib/Data/Num/ZNum.lean @@ -110,7 +110,17 @@ theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = (n : α) @[simp, norm_cast] theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = ((n : α) + n) + 1 - | 0 => by change ((ZNum.zero).bit1 : α) = _; simp [ZNum.bit1] + | 0 => by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + simp [ZNum.bit1] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ + change ((ZNum.zero).bit1 : α) = _; simp [ZNum.bit1] | pos p => by rw [ZNum.bit1, cast_pos, cast_pos]; rfl | neg p => by rw [ZNum.bit1, cast_neg, cast_neg] @@ -573,7 +583,16 @@ protected theorem div_zero (n : Num) : n / 0 = 0 := show n.div 0 = 0 by cases n · rfl - · change (Num.pos _).div Num.zero = 0; simp [Num.div] + · #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + simp [Num.div] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ + change (Num.pos _).div Num.zero = 0; simp [Num.div] @[simp, norm_cast] theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d @@ -587,7 +606,16 @@ protected theorem mod_zero (n : Num) : n % 0 = n := show n.mod 0 = n by cases n · rfl - · change (Num.pos _).mod Num.zero = Num.pos _; simp [Num.mod] + · #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof used to finish from this point as + ``` + simp [Num.mod] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ + change (Num.pos _).mod Num.zero = Num.pos _; simp [Num.mod] @[simp, norm_cast] theorem mod_to_nat : ∀ n d, ((n % d : Num) : ℕ) = n % d diff --git a/Mathlib/NumberTheory/Zsqrtd/Basic.lean b/Mathlib/NumberTheory/Zsqrtd/Basic.lean index 90d67a8af5a566..f955bb00389cea 100644 --- a/Mathlib/NumberTheory/Zsqrtd/Basic.lean +++ b/Mathlib/NumberTheory/Zsqrtd/Basic.lean @@ -637,6 +637,15 @@ instance preorder : Preorder (ℤ√d) where open Int in -- TODO add an `Archimedean (ℤ√d)` instance and drop this lemma theorem le_arch (a : ℤ√d) : ∃ n : ℕ, a ≤ n := by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The last three `by` subproofs inside the following match arms used to be each + ``` + by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ obtain ⟨x, y, (h : a ≤ ⟨x, y⟩)⟩ : ∃ x y : ℕ, Nonneg (⟨x, y⟩ + -a) := match -a with | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by trivial⟩ diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean index d2915658b18e7b..9f09138c08f505 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean @@ -122,6 +122,15 @@ theorem count_some (hp : Irreducible p) (s : Multiset _) : @[simp] theorem count_zero (hp : Irreducible p) : count p (0 : FactorSet α) = 0 := by + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The proof body used to be just + ``` + simp only [count, dif_pos hp, bcount, Multiset.count_zero] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ simp only [count, dif_pos hp, bcount] change Multiset.count _ 0 = 0 simp only [Multiset.count_zero] diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index 3387a58a2c0926..30a3f1b0031c74 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -756,6 +756,21 @@ instance nf_opow (o₁ o₂) [NF o₁] [NF o₂] : NF (o₁ ^ o₂) := by rcases e₂ : split' o₂ with ⟨b', k⟩ haveI := (nf_repr_split' e₂).1 obtain - | ⟨a0, n, a'⟩ := a + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The next branch was previously + ``` + · rcases m with - | m + · by_cases o₂ = 0 <;> simp only [(· ^ ·), Pow.pow, opow, opowAux2, *] <;> decide + · by_cases m = 0 + · simp only [(· ^ ·), Pow.pow, opow, opowAux2, *, zero_def] + decide + · simp only [(· ^ ·), Pow.pow, opow, opowAux2, *] + infer_instance + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ · rcases m with - | m · by_cases h : o₂ = 0 · subst h @@ -901,6 +916,25 @@ theorem repr_opow (o₁ o₂) [NF o₁] [NF o₂] : repr (o₁ ^ o₂) = repr o rcases e₁ : split o₁ with ⟨a, m⟩ obtain ⟨N₁, r₁⟩ := nf_repr_split e₁ obtain - | ⟨a0, n, a'⟩ := a + #adaptation_note /-- Proof repaired after leanprover/lean4#13363. + The next block was previously + ``` + · rcases m with - | m + · by_cases h : o₂ = 0 <;> simp [opow_def, opowAux2, e₁, h, r₁] + have := mt repr_inj.1 h + rw [zero_opow this] + · rcases e₂ : split' o₂ with ⟨b', k⟩ + obtain ⟨_, r₂⟩ := nf_repr_split' e₂ + by_cases h : m = 0 + · simp [opowAux2, opow_def, e₁, h, r₁, r₂] + simp only [opow_def, opowAux2, e₁, r₁, e₂, r₂, repr, + Nat.cast_succ, _root_.zero_add, + add_zero] + ``` + The replacement proof is a short-term fix, and we request that the authors/maintainers of + this file review the proof, and either approve it by removing this adaptation note, revise + the proof or the prerequisites appropriately, or minimize a problem in lean4 that still + needs addressing. -/ · rcases m with - | m · have hzero : (0 : ONote) = zero := rfl by_cases h : o₂ = 0 From 4ab73180a21d7a10e06690b4038d757fa00b1697 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 10:22:21 +1000 Subject: [PATCH 100/116] minor fixes, whitespace and PR links --- Mathlib/CategoryTheory/Bicategory/Coherence.lean | 7 +++---- Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean | 3 ++- Mathlib/SetTheory/Ordinal/Notation.lean | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/Bicategory/Coherence.lean b/Mathlib/CategoryTheory/Bicategory/Coherence.lean index 519fce411589f7..db4063a746e10a 100644 --- a/Mathlib/CategoryTheory/Bicategory/Coherence.lean +++ b/Mathlib/CategoryTheory/Bicategory/Coherence.lean @@ -135,8 +135,8 @@ def normalizeIso {a : B} : -- Equation lemmas for `normalizeIso`/`normalizeAux` matching `≫`/`𝟙` -- (i.e., `CategoryStruct.comp`/`CategoryStruct.id` for `FreeBicategory`) instead of --- `Hom.comp`/`Hom.id`. Needed because `canUnfoldAtMatcher` no longer unfolds class --- projections in match discriminants. +-- `Hom.comp`/`Hom.id`. Needed because after leanprover/lean4#13363, `canUnfoldAtMatcher` +-- no longer unfolds class projections in match discriminants. @[simp] theorem normalizeAux_comp {a : B} {b c d : FreeBicategory B} (p : Path a b) (f : b ⟶ c) (g : c ⟶ d) : normalizeAux p (f ≫ g) = normalizeAux (normalizeAux p f) g := rfl @@ -190,8 +190,7 @@ theorem normalize_naturality {a b c : B} (p : Path a b) {f g : Hom b c} (η : f rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih, comp_whiskerRight] have := dcongr_arg (fun x => (normalizeIso x h).hom) (normalizeAux_congr p (Quot.mk _ η')) dsimp at this; simp [this] - | _ => - simp + | _ => simp -- Not `@[simp]` because it is not in `simp`-normal form. theorem normalizeAux_nil_comp {a b c : B} (f : Hom a b) (g : Hom b c) : diff --git a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean index c8801b556a8a11..f9b27a7ac659dd 100644 --- a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean +++ b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean @@ -194,7 +194,8 @@ def normalizeIsoApp' : (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' X n) Y ≪≫ normalizeIsoApp' _ _ -- Equation lemmas for `normalizeIsoApp'` matching `⊗`/`𝟙_` instead of `tensor`/`unit`. --- Needed because `canUnfoldAtMatcher` no longer unfolds class projections in match discriminants. +-- Needed because after leanprover/lean4#13363, `canUnfoldAtMatcher` no longer unfolds class +-- projections in match discriminants. @[simp] theorem normalizeIsoApp'_tensor (X Y : F C) (n : NormalMonoidalObject C) : normalizeIsoApp' C (X ⊗ Y) n = (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' C X n) Y ≪≫ diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index 30a3f1b0031c74..d5f2526900c181 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -54,7 +54,8 @@ instance : Zero ONote := theorem zero_def : zero = 0 := rfl --- With matchwhnf changes, Zero.zero doesn't unfold in match discriminants. +-- After leanprover/lean4#13363 (matchwhnf changes), `Zero.zero` doesn't unfold in match +-- discriminants. theorem zero_zero_eq : (Zero.zero : ONote) = zero := rfl instance : Inhabited ONote := @@ -141,7 +142,8 @@ instance (priority := low) nat (n : ℕ) : OfNat ONote n where ofNat := ofNat n -- Unfold the OfNat class projection for ONote to the concrete `ofNat` function. --- Needed because class projections no longer unfold in match discriminants. +-- Needed because after leanprover/lean4#13363, class projections no longer unfold in match +-- discriminants. theorem ofNat_unfold (n : ℕ) : @OfNat.ofNat ONote n (nat n) = ofNat n := rfl From a1669dc00ef57cccadeb1f5b1c7d821598555a18 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 03:50:13 +0000 Subject: [PATCH 101/116] two improvements --- Mathlib/Algebra/Group/Defs.lean | 14 +------------- Mathlib/Algebra/Homology/ExactSequence.lean | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/Mathlib/Algebra/Group/Defs.lean b/Mathlib/Algebra/Group/Defs.lean index dfc9b2606622d7..0d97e8680b5918 100644 --- a/Mathlib/Algebra/Group/Defs.lean +++ b/Mathlib/Algebra/Group/Defs.lean @@ -526,19 +526,7 @@ theorem npowRec'_two_mul {M : Type*} [Semigroup M] [One M] (k : ℕ) (m : M) : | 0 => rfl | 1 => simp [npowRec'] | k + 2 => - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to finish from this point as - ``` - simp [npowRec', ← mul_assoc, ← ih] - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - rw [show 2 * (k + 2) = k + k + 4 from by omega] - simp only [npowRec'] - rw [← ih (k + 1) (by omega), show 2 * (k + 1) = k + k + 2 from by omega] - simp only [npowRec', ← mul_assoc] + simp [npowRec', ← mul_assoc, ← ih, Nat.mul_succ] @[to_additive] theorem npowRec'_mul_comm {M : Type*} [Semigroup M] [One M] {k : ℕ} (k0 : k ≠ 0) (m : M) : diff --git a/Mathlib/Algebra/Homology/ExactSequence.lean b/Mathlib/Algebra/Homology/ExactSequence.lean index 704996756e86b7..fb389ad5148ba1 100644 --- a/Mathlib/Algebra/Homology/ExactSequence.lean +++ b/Mathlib/Algebra/Homology/ExactSequence.lean @@ -222,21 +222,9 @@ lemma isComplex₂_mk (S : ComposableArrows C 2) (w : S.map' 0 1 ≫ S.map' 1 2 S.IsComplex := S.isComplex₂_iff.2 w -#adaptation_note /-- Proof repaired after leanprover/lean4#13363. -The proof used to be just -``` -isComplex₂_mk _ (by simp [-Fin.reduceFinMk]) -``` -(with a comment noting that `Fin.reduceFinMk` had to be disabled so that `Precompose.map_one_succ` -applied; see https://github.com/leanprover-community/mathlib4/issues/27382). -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ -set_option backward.isDefEq.respectTransparency false in lemma _root_.CategoryTheory.ShortComplex.isComplex_toComposableArrows (S : ShortComplex C) : S.toComposableArrows.IsComplex := - isComplex₂_mk _ (by change S.f ≫ S.g = 0; simp [S.zero]) + isComplex₂_mk _ S.zero lemma exact₂_iff (S : ComposableArrows C 2) (hS : S.IsComplex) : S.Exact ↔ (S.sc' hS 0 1 2).Exact := by From ad19764058b334a9eed994764e8ef110d2fb23ce Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 24 Apr 2026 05:01:55 +0000 Subject: [PATCH 102/116] improvements --- .../Algebra/Homology/HomologySequence.lean | 17 ++------- .../ComposableArrows/Basic.lean | 37 ------------------- .../CategoryTheory/ComposableArrows/One.lean | 20 +--------- .../CategoryTheory/ComposableArrows/Two.lean | 28 ++------------ Mathlib/Data/Num/ZNum.lean | 32 ++-------------- .../UniqueFactorizationDomain/FactorSet.lean | 4 +- 6 files changed, 12 insertions(+), 126 deletions(-) diff --git a/Mathlib/Algebra/Homology/HomologySequence.lean b/Mathlib/Algebra/Homology/HomologySequence.lean index 4b4459ebb2b4b7..40cef6fb601dd7 100644 --- a/Mathlib/Algebra/Homology/HomologySequence.lean +++ b/Mathlib/Algebra/Homology/HomologySequence.lean @@ -159,20 +159,9 @@ noncomputable def composableArrows₃Functor [CategoryWithHomology C] : obj K := composableArrows₃ K i j map {K L} φ := ComposableArrows.homMk₃ (homologyMap φ i) (opcyclesMap φ i) (cyclesMap φ j) (homologyMap φ j) - (by set_option backward.isDefEq.respectTransparency false in simp) - (by set_option backward.isDefEq.respectTransparency false in simp [-Fin.reduceFinMk]) - (#adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to finish from this point as - ``` - by simp [-Fin.reduceFinMk] - ``` - (`Fin.reduceFinMk` was disabled so that `Precomp.obj_succ` would fire; see - https://github.com/leanprover-community/mathlib4/issues/27382). - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - by change K.homologyπ j ≫ homologyMap φ j = cyclesMap φ j ≫ L.homologyπ j; simp) + (by simp) + (by simp [-Fin.reduceFinMk]) + (by simp [-Fin.reduceFinMk]) end HomologySequence diff --git a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean index 74f1da8ee84ca2..19d72fd6fa25a3 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean @@ -225,20 +225,11 @@ lemma hom_ext₀ {F G : ComposableArrows C 0} {φ φ' : F ⟶ G} fin_cases i exact h -#adaptation_note /-- After leanprover/lean4#13363, the `hom_inv_id` and `inv_hom_id` fields -needed to be supplied explicitly. Previously they were not necessary, and were proved by the -`auto_param`. -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ /-- Constructor for isomorphisms in `ComposableArrows C 0`. -/ @[simps!] def isoMk₀ {F G : ComposableArrows C 0} (e : F.obj' 0 ≅ G.obj' 0) : F ≅ G where hom := homMk₀ e.hom inv := homMk₀ e.inv - hom_inv_id := by apply hom_ext₀; with_unfolding_all exact e.hom_inv_id - inv_hom_id := by apply hom_ext₀; with_unfolding_all exact e.inv_hom_id lemma isIso_iff₀ {F G : ComposableArrows C 0} (f : F ⟶ G) : IsIso f ↔ IsIso (f.app 0) := by @@ -274,13 +265,6 @@ lemma hom_ext₁ {F G : ComposableArrows C 1} {φ φ' : F ⟶ G} | 0 => exact h₀ | 1 => exact h₁ -#adaptation_note /-- After leanprover/lean4#13363, the `hom_inv_id` and `inv_hom_id` fields -needed to be supplied explicitly. Previously they were not necessary, and were proved by the -`auto_param`. -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ /-- Constructor for isomorphisms in `ComposableArrows C 1`. -/ @[simps!] def isoMk₁ {F G : ComposableArrows C 1} @@ -291,18 +275,6 @@ def isoMk₁ {F G : ComposableArrows C 1} inv := homMk₁ left.inv right.inv (by rw [← cancel_mono right.hom, assoc, assoc, w, right.inv_hom_id, left.inv_hom_id_assoc] apply comp_id) - hom_inv_id := by - apply hom_ext₁ - · change left.hom ≫ left.inv = 𝟙 _ - simp - · change right.hom ≫ right.inv = 𝟙 _ - simp - inv_hom_id := by - apply hom_ext₁ - · change left.inv ≫ left.hom = 𝟙 _ - simp - · change right.inv ≫ right.hom = 𝟙 _ - simp lemma map'_eq_hom₁ (F : ComposableArrows C 1) : F.map' 0 1 = F.hom := rfl @@ -642,13 +614,6 @@ lemma hom_ext₂ {f g : ComposableArrows C 2} {φ φ' : f ⟶ g} φ = φ' := hom_ext_succ h₀ (hom_ext₁ h₁ h₂) -#adaptation_note /-- After leanprover/lean4#13363, the `hom_inv_id` and `inv_hom_id` fields -needed to be supplied explicitly. Previously they were not necessary, and were proved by the -`auto_param`. -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ /-- Constructor for isomorphisms in `ComposableArrows C 2`. -/ @[simps] def isoMk₂ {f g : ComposableArrows C 2} @@ -661,8 +626,6 @@ def isoMk₂ {f g : ComposableArrows C 2} comp_id, app₀.hom_inv_id_assoc]) (by rw [← cancel_epi app₁.hom, ← reassoc_of% w₁, app₂.hom_inv_id, comp_id, app₁.hom_inv_id_assoc]) - hom_inv_id := by apply hom_ext₂ <;> (with_unfolding_all dsimp; simp) - inv_hom_id := by apply hom_ext₂ <;> (with_unfolding_all dsimp; simp) lemma isIso_iff₂ {F G : ComposableArrows C 2} (f : F ⟶ G) : IsIso f ↔ IsIso (f.app 0) ∧ IsIso (f.app 1) ∧ IsIso (f.app 2) := by diff --git a/Mathlib/CategoryTheory/ComposableArrows/One.lean b/Mathlib/CategoryTheory/ComposableArrows/One.lean index 2c85966bf45de7..06fb0e4e1f9d8e 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/One.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/One.lean @@ -31,17 +31,6 @@ def functorArrows (i j n : ℕ) (hij : i ≤ j := by lia) (hj : j ≤ n := by li obj S := mk₁ (S.map' i j) map {S S'} φ := homMk₁ (φ.app _) (φ.app _) (φ.naturality _) -#adaptation_note /-- Proof repaired after leanprover/lean4#13363. -The `app` subproof used to be just -``` -(by simp [← Functor.map_comp]) -``` -and the `naturality` field was not necessary, and was proved by the `auto_param`. -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ -set_option backward.isDefEq.respectTransparency false in /-- The natural transformation `functorArrows C i j n ⟶ functorArrows C i' j' n` when `i ≤ i'` and `j ≤ j'`. -/ @[simps] @@ -50,14 +39,7 @@ def mapFunctorArrows (i j i' j' n : ℕ) (_ : i ≤ i' := by lia) (_ : j ≤ j' := by lia) (_ : j' ≤ n := by lia) : functorArrows C i j n ⟶ functorArrows C i' j' n where - app S := homMk₁ (S.map' i i') (S.map' j j') - (by change S.map' i j ≫ S.map' j j' = S.map' i i' ≫ S.map' i' j'; simp [← Functor.map_comp]) - naturality {X Y} f := by - apply hom_ext₁ - · change f.app ⟨i, _⟩ ≫ Y.map' i i' = X.map' i i' ≫ f.app ⟨i', _⟩ - simp [← NatTrans.naturality] - · change f.app ⟨j, _⟩ ≫ Y.map' j j' = X.map' j j' ≫ f.app ⟨j', _⟩ - simp [← NatTrans.naturality] + app S := homMk₁ (S.map' i i') (S.map' j j') (by simp [← Functor.map_comp]) end ComposableArrows diff --git a/Mathlib/CategoryTheory/ComposableArrows/Two.lean b/Mathlib/CategoryTheory/ComposableArrows/Two.lean index cba42ce30bd5ae..f2fe7c5af9a61a 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Two.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Two.lean @@ -61,35 +61,13 @@ lemma twoδ₁Toδ₀_app_zero : lemma twoδ₁Toδ₀_app_one : (twoδ₁Toδ₀ f g fg h).app 1 = 𝟙 _ := by with_unfolding_all rfl -#adaptation_note /-- Proof repaired after leanprover/lean4#13363. -The proof body used to be just -``` -rw [isIso_iff₁] -constructor <;> dsimp <;> infer_instance -``` -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ -set_option backward.isDefEq.respectTransparency false in instance [IsIso g] : IsIso (twoδ₂Toδ₁ f g fg h) := by rw [isIso_iff₁, twoδ₂Toδ₁_app_zero, twoδ₂Toδ₁_app_one] - exact ⟨inferInstance, ‹_›⟩ - -#adaptation_note /-- Proof repaired after leanprover/lean4#13363. -The proof body used to be just -``` -rw [isIso_iff₁] -constructor <;> dsimp <;> infer_instance -``` -The replacement proof is a short-term fix, and we request that the authors/maintainers of -this file review the proof, and either approve it by removing this adaptation note, revise -the proof or the prerequisites appropriately, or minimize a problem in lean4 that still -needs addressing. -/ -set_option backward.isDefEq.respectTransparency false in + exact ⟨IsIso.id _, ‹_›⟩ + instance [IsIso f] : IsIso (twoδ₁Toδ₀ f g fg h) := by rw [isIso_iff₁, twoδ₁Toδ₀_app_zero, twoδ₁Toδ₀_app_one] - exact ⟨‹_›, inferInstance⟩ + exact ⟨‹_›, IsIso.id _⟩ end diff --git a/Mathlib/Data/Num/ZNum.lean b/Mathlib/Data/Num/ZNum.lean index 00f7678bfd45e3..ef4748f2f3f213 100644 --- a/Mathlib/Data/Num/ZNum.lean +++ b/Mathlib/Data/Num/ZNum.lean @@ -579,20 +579,8 @@ end PosNum namespace Num @[simp] -protected theorem div_zero (n : Num) : n / 0 = 0 := - show n.div 0 = 0 by - cases n - · rfl - · #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to finish from this point as - ``` - simp [Num.div] - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - change (Num.pos _).div Num.zero = 0; simp [Num.div] +protected theorem div_zero (n : Num) : n / 0 = 0 := by + cases n <;> rfl @[simp, norm_cast] theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d @@ -602,20 +590,8 @@ theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d | pos _, pos _ => PosNum.div'_to_nat _ _ @[simp] -protected theorem mod_zero (n : Num) : n % 0 = n := - show n.mod 0 = n by - cases n - · rfl - · #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to finish from this point as - ``` - simp [Num.mod] - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - change (Num.pos _).mod Num.zero = Num.pos _; simp [Num.mod] +protected theorem mod_zero (n : Num) : n % 0 = n := by + cases n <;> rfl @[simp, norm_cast] theorem mod_to_nat : ∀ n d, ((n % d : Num) : ℕ) = n % d diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean index 9f09138c08f505..c79324fe4245d3 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean @@ -131,9 +131,7 @@ theorem count_zero (hp : Irreducible p) : count p (0 : FactorSet α) = 0 := by this file review the proof, and either approve it by removing this adaptation note, revise the proof or the prerequisites appropriately, or minimize a problem in lean4 that still needs addressing. -/ - simp only [count, dif_pos hp, bcount] - change Multiset.count _ 0 = 0 - simp only [Multiset.count_zero] + rw [show (0 : FactorSet α) = WithTop.some 0 from rfl, count_some hp, Multiset.count_zero] theorem count_reducible (hp : ¬Irreducible p) : count p = 0 := dif_neg hp From 68199737b4ba122aad70fb657ce907b1d410a673 Mon Sep 17 00:00:00 2001 From: Julia Markus Himmel <2065352+TwoFX@users.noreply.github.com> Date: Fri, 24 Apr 2026 06:13:14 +0000 Subject: [PATCH 103/116] slightly improve the proof in Limits/Shapes/Equalizers.lean --- .../Limits/Shapes/Equalizers.lean | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean index 5f4fe226ff646c..da95042c544f03 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean @@ -225,20 +225,14 @@ def parallelPair (f g : X ⟶ Y) : WalkingParallelPair ⥤ C where | WalkingParallelPairHom.id _ => 𝟙 _ | left => f | right => g - -- `sorry` can cope with this, but it's too slow: map_comp := by - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to be - ``` - rintro _ _ _ ⟨⟩ g <;> cases g <;> simp - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - rintro _ _ _ ⟨⟩ g <;> cases g <;> - dsimp only [CategoryStruct.comp, CategoryStruct.id, WalkingParallelPairHom.comp] <;> - first | rfl | simp + rintro _ _ _ ⟨⟩ ⟨⟩ + · simp + · simp + · simp + · simp + · simp only [walkingParallelPairHom_id, Category.comp_id] + rw [← walkingParallelPairHom_id] @[simp] theorem parallelPair_obj_zero (f g : X ⟶ Y) : (parallelPair f g).obj zero = X := rfl From 7f2aed1a42430b43de6003269c227e154b05da27 Mon Sep 17 00:00:00 2001 From: Julia Markus Himmel <2065352+TwoFX@users.noreply.github.com> Date: Fri, 24 Apr 2026 07:16:16 +0000 Subject: [PATCH 104/116] More --- .../Limits/Shapes/Equalizers.lean | 56 +++++++++++++------ .../Monoidal/Free/Coherence.lean | 11 ++-- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean index da95042c544f03..a040c0bc5dc46b 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean @@ -210,29 +210,49 @@ theorem walkingParallelPairOpEquiv_counitIso_inv_app_op_one : walkingParallelPairOpEquiv.counitIso.inv.app (op one) = 𝟙 (op one) := rfl -variable {C : Type u} [Category.{v} C] +variable {C : Type u} variable {X Y : C} +namespace parallelPair + +/-- Implementation of `parallelPair`, do not use directly. -/ +@[instance_reducible] +def parallelPairObj (X Y : C) (x : WalkingParallelPair) : C := + match x with + | zero => X + | one => Y + +@[simp] theorem parallelPairObj_zero : parallelPairObj X Y zero = X := rfl +@[simp] theorem parallelPairObj_one : parallelPairObj X Y one = Y := rfl + +variable [Category.{v} C] + +/-- Implementation of `parallelPair`, do not use directly. -/ +def parallelPairHom (f g : X ⟶ Y) {x y : WalkingParallelPair} (h : x ⟶ y) : + parallelPairObj X Y x ⟶ parallelPairObj X Y y := + match h with + | .id _ => 𝟙 _ + | .left => f + | .right => g + +@[simp] theorem parallelPairHom_id {f g : X ⟶ Y} {x : WalkingParallelPair} : + parallelPairHom f g (𝟙 x) = 𝟙 (parallelPairObj X Y x) := (rfl) +@[simp] theorem parallelPairHom_left {f g : X ⟶ Y} : + parallelPairHom f g .left = f := (rfl) +@[simp] theorem parallelPairHom_right {f g : X ⟶ Y} : + parallelPairHom f g .right = g := (rfl) + +end parallelPair + +variable [Category.{v} C] + +open parallelPair in /-- `parallelPair f g` is the diagram in `C` consisting of the two morphisms `f` and `g` with common domain and codomain. -/ def parallelPair (f g : X ⟶ Y) : WalkingParallelPair ⥤ C where - obj x := - match x with - | zero => X - | one => Y - map h := - match h with - | WalkingParallelPairHom.id _ => 𝟙 _ - | left => f - | right => g - map_comp := by - rintro _ _ _ ⟨⟩ ⟨⟩ - · simp - · simp - · simp - · simp - · simp only [walkingParallelPairHom_id, Category.comp_id] - rw [← walkingParallelPairHom_id] + obj x := parallelPairObj X Y x + map h := parallelPairHom f g h + map_comp := by rintro _ _ _ ⟨⟩ ⟨⟩ <;> simp @[simp] theorem parallelPair_obj_zero (f g : X ⟶ Y) : (parallelPair f g).obj zero = X := rfl diff --git a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean index f9b27a7ac659dd..ec909dcde0eb17 100644 --- a/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean +++ b/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean @@ -105,6 +105,10 @@ theorem normalizeObj_tensor (X Y : F C) (n : NormalMonoidalObject C) : /-- Auxiliary definition for `normalize`. -/ def normalizeObj' (X : F C) : N C ⥤ N C := Discrete.functor fun n ↦ ⟨normalizeObj X n⟩ +@[simp] +theorem as_obj_normalizeObj' (X : F C) (n : N C) : + ((normalizeObj' X).obj n).as = normalizeObj X n.as := rfl + section open Hom @@ -185,7 +189,6 @@ def normalizeIsoApp : /-- Almost non-definitionally equal to `normalizeIsoApp`, but has a better definitional property in the proof of `normalize_naturality`. -/ -@[simp] def normalizeIsoApp' : ∀ (X : F C) (n : NormalMonoidalObject C), inclusionObj n ⊗ X ≅ inclusionObj (normalizeObj X n) | of _, _ => Iso.refl _ @@ -193,9 +196,6 @@ def normalizeIsoApp' : | tensor X Y, n => (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' X n) Y ≪≫ normalizeIsoApp' _ _ --- Equation lemmas for `normalizeIsoApp'` matching `⊗`/`𝟙_` instead of `tensor`/`unit`. --- Needed because after leanprover/lean4#13363, `canUnfoldAtMatcher` no longer unfolds class --- projections in match discriminants. @[simp] theorem normalizeIsoApp'_tensor (X Y : F C) (n : NormalMonoidalObject C) : normalizeIsoApp' C (X ⊗ Y) n = (α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' C X n) Y ≪≫ @@ -211,7 +211,7 @@ theorem normalizeIsoApp_eq : rw [normalizeIsoApp, normalizeIsoApp'] rw [normalizeIsoApp_eq X n] rw [normalizeIsoApp_eq Y ⟨normalizeObj X n.as⟩] - rfl + simp @[simp] theorem normalizeIsoApp_tensor (X Y : F C) (n : N C) : @@ -277,7 +277,6 @@ theorem normalize_naturality (n : NormalMonoidalObject C) {X Y : F C} (f : X ⟶ end -set_option backward.isDefEq.respectTransparency false in /-- The isomorphism between `n ⊗ X` and `normalize X n` is natural (in both `X` and `n`, but naturality in `n` is trivial and was "proved" in `normalizeIsoAux`). This is the real heart of our proof of the coherence theorem. -/ From ea11aab85ca409d7c8eab083b00cbec31a7cf17b Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Fri, 24 Apr 2026 09:37:55 +0000 Subject: [PATCH 105/116] chore: bump to nightly-2026-04-24 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index cc7ac4d9d55b08..53aa4bd0f71edd 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-23 +leanprover/lean4:nightly-2026-04-24 From b5c35d6177dda121533c92896ea62707a816efab Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Fri, 24 Apr 2026 09:41:20 +0000 Subject: [PATCH 106/116] adapt to lean4#13363: canUnfoldAtMatcher allowlist changes Adapt proofs to lean4#13363 which replaces the transparency bump from `.reducible` to `.instances` in `whnfMatcher` with an explicit allowlist in `canUnfoldAtMatcher`. Class projections like `CategoryStruct.comp`, `CategoryStruct.id`, `Stream.next?`, `Min.min` etc. are no longer auto-unfolded in match discriminants and need explicit unfolding in proofs. Co-Authored-By: Claude Opus 4.6 --- Mathlib/Algebra/Homology/ExactSequence.lean | 4 +- .../Algebra/Homology/HomologicalComplex.lean | 10 ----- .../Algebra/Homology/HomologySequence.lean | 6 +-- .../Homology/SpectralObject/Basic.lean | 1 - .../Homology/SpectralObject/Cycles.lean | 3 +- .../Order/GroupWithZero/Canonical.lean | 21 ++++------ Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean | 2 +- .../EllipticCurve/Affine/Point.lean | 13 +++---- Mathlib/AlgebraicTopology/MooreComplex.lean | 5 +-- .../SimplicialSet/Nerve.lean | 4 +- Mathlib/Analysis/Calculus/ContDiff/Defs.lean | 14 +------ .../ComposableArrows/Basic.lean | 38 ++++++++----------- .../CategoryTheory/ComposableArrows/One.lean | 3 +- .../ComposableArrows/Three.lean | 1 - .../CategoryTheory/ComposableArrows/Two.lean | 18 ++++----- Mathlib/Computability/RegularExpressions.lean | 15 +------- .../TuringMachine/ToPartrec.lean | 3 +- Mathlib/Data/Nat/Bitwise.lean | 6 ++- Mathlib/Data/Num/Lemmas.lean | 2 +- Mathlib/Data/Num/ZNum.lean | 30 +++++++-------- Mathlib/Data/Sign/Defs.lean | 6 +-- .../Dynamics/Ergodic/Action/OfMinimal.lean | 2 +- Mathlib/NumberTheory/Zsqrtd/Basic.lean | 26 ++----------- .../UniqueFactorizationDomain/FactorSet.lean | 9 ----- .../Valuation/ValuativeRel/Basic.lean | 2 +- Mathlib/SetTheory/Ordinal/Notation.lean | 10 ++--- Mathlib/Tactic/NormNum/PowMod.lean | 4 +- 27 files changed, 86 insertions(+), 172 deletions(-) diff --git a/Mathlib/Algebra/Homology/ExactSequence.lean b/Mathlib/Algebra/Homology/ExactSequence.lean index fb389ad5148ba1..4d45263e13d941 100644 --- a/Mathlib/Algebra/Homology/ExactSequence.lean +++ b/Mathlib/Algebra/Homology/ExactSequence.lean @@ -222,9 +222,11 @@ lemma isComplex₂_mk (S : ComposableArrows C 2) (w : S.map' 0 1 ≫ S.map' 1 2 S.IsComplex := S.isComplex₂_iff.2 w +set_option backward.isDefEq.respectTransparency false in lemma _root_.CategoryTheory.ShortComplex.isComplex_toComposableArrows (S : ShortComplex C) : S.toComposableArrows.IsComplex := - isComplex₂_mk _ S.zero + -- Disable `Fin.reduceFinMk` because otherwise `Precompose.map_one_succ` does not apply. (https://github.com/leanprover-community/mathlib4/issues/27382) + isComplex₂_mk _ (by simp [-Fin.reduceFinMk]) lemma exact₂_iff (S : ComposableArrows C 2) (hS : S.IsComplex) : S.Exact ↔ (S.sc' hS 0 1 2).Exact := by diff --git a/Mathlib/Algebra/Homology/HomologicalComplex.lean b/Mathlib/Algebra/Homology/HomologicalComplex.lean index 13b9f5e8ef0973..d5929a25584828 100644 --- a/Mathlib/Algebra/Homology/HomologicalComplex.lean +++ b/Mathlib/Algebra/Homology/HomologicalComplex.lean @@ -729,17 +729,7 @@ lemma mkAux_eq_shortComplex_mk_d_comp_d (n : ℕ) : ShortComplex.mk _ _ ((mk X₀ X₁ X₂ d₀ d₁ s succ).d_comp_d (n + 2) (n + 1) n) := by change ShortComplex.mk _ _ (mkAux X₀ X₁ X₂ d₀ d₁ s succ n).zero = _ dsimp [mk, of, mkAux] - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to finish from this point as - ``` simp - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - simp only [show n + 2 = n + 1 + 1 from rfl, ↓reduceDIte] - congr 1 <;> exact (Category.id_comp _).symm /-- The isomorphism from `(mk X₀ X₁ X₂ d₀ d₁ s succ).X (n + 3)` that is given by the inductive construction. -/ diff --git a/Mathlib/Algebra/Homology/HomologySequence.lean b/Mathlib/Algebra/Homology/HomologySequence.lean index 40cef6fb601dd7..62f02c8c68efbe 100644 --- a/Mathlib/Algebra/Homology/HomologySequence.lean +++ b/Mathlib/Algebra/Homology/HomologySequence.lean @@ -158,10 +158,8 @@ noncomputable def composableArrows₃Functor [CategoryWithHomology C] : HomologicalComplex C c ⥤ ComposableArrows C 3 where obj K := composableArrows₃ K i j map {K L} φ := ComposableArrows.homMk₃ (homologyMap φ i) (opcyclesMap φ i) (cyclesMap φ j) - (homologyMap φ j) - (by simp) - (by simp [-Fin.reduceFinMk]) - (by simp [-Fin.reduceFinMk]) + -- Disable `Fin.reduceFinMk`, otherwise `Precomp.obj_succ` does not fire. (https://github.com/leanprover-community/mathlib4/issues/27382) + (homologyMap φ j) (by simp) (by simp [-Fin.reduceFinMk]) (by simp [-Fin.reduceFinMk]) end HomologySequence diff --git a/Mathlib/Algebra/Homology/SpectralObject/Basic.lean b/Mathlib/Algebra/Homology/SpectralObject/Basic.lean index af2a251831aa40..78369c2d7b5773 100644 --- a/Mathlib/Algebra/Homology/SpectralObject/Basic.lean +++ b/Mathlib/Algebra/Homology/SpectralObject/Basic.lean @@ -183,7 +183,6 @@ attribute [reassoc, simp] comp_hom lemma isZero_H_map_mk₁_of_isIso (n : ℤ) {i₀ i₁ : ι} (f : i₀ ⟶ i₁) [IsIso f] : IsZero ((X.H n).obj (mk₁ f)) := by let φ := twoδ₂Toδ₁ f (inv f) (𝟙 i₀) (by simp) ≫ twoδ₁Toδ₀ f (inv f) (𝟙 i₀) - set_option backward.isDefEq.respectTransparency false in have : IsIso φ := by rw [isIso_iff₁] constructor <;> dsimp [φ] <;> infer_instance diff --git a/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean b/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean index 6fb8b18a9afa3d..273281c1b83419 100644 --- a/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean +++ b/Mathlib/Algebra/Homology/SpectralObject/Cycles.lean @@ -313,7 +313,8 @@ lemma toCycles_cyclesMap (α : mk₂ f g ⟶ mk₂ f' g') (β : mk₁ fg ⟶ mk · dsimp rw [hβ₀] exact naturality' α 0 1 - · simp [hβ₁] + · dsimp + rw [hβ₁, Category.comp_id, Category.id_comp] /-- The map `H^n(f) ⟶ H^n(f ≫ g)` factors through `opZ^n(f, g)`. -/ noncomputable def fromOpcycles (n : ℤ) : diff --git a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean index 9cfd8a95d6e0de..9cd9d955bb9d22 100644 --- a/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean +++ b/Mathlib/Algebra/Order/GroupWithZero/Canonical.lean @@ -419,23 +419,16 @@ end PartialOrder section Lattice -/-- Supremum for `WithZero α`, defined via `Option.merge`. -/ -def withZeroSup [Max α] : WithZero α → WithZero α → WithZero α := - Option.merge (· ⊔ ·) - -@[simp] theorem withZeroSup_zero_zero [Max α] : (withZeroSup (0 : WithZero α) 0) = 0 := rfl -@[simp] theorem withZeroSup_coe_zero [Max α] (a : α) : (withZeroSup (↑a : WithZero α) 0) = ↑a := rfl -@[simp] theorem withZeroSup_zero_coe [Max α] (b : α) : (withZeroSup (0 : WithZero α) ↑b) = ↑b := rfl -@[simp] theorem withZeroSup_coe_coe [Max α] (a b : α) : - (withZeroSup (↑a : WithZero α) ↑b) = ↑(a ⊔ b) := rfl - instance semilatticeSup [SemilatticeSup α] : SemilatticeSup (WithZero α) where - sup := withZeroSup + sup + -- note this is `Option.merge`, but with the right defeq when unfolding + | 0, 0 => 0 + | (a : α), 0 => a + | 0, (b : α) => b + | (a : α), (b : α) => ↑(a ⊔ b) le_sup_left x y := by cases x <;> cases y <;> simp le_sup_right x y := by cases x <;> cases y <;> simp - sup_le x y z := by - cases x <;> cases y <;> cases z <;> simp - simpa using sup_le + sup_le x y z := by cases x <;> cases y <;> cases z <;> simp; simpa using sup_le theorem coe_sup [SemilatticeSup α] (a b : α) : ((a ⊔ b : α) : WithZero α) = (a : WithZero α) ⊔ b := rfl diff --git a/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean b/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean index 4e82eb271011a3..8199498397b672 100644 --- a/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean +++ b/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean @@ -324,7 +324,7 @@ theorem one_def : (1 : SkewMonoidAlgebra k G) = single 1 1 := rfl @[simp] theorem coeff_one_one : coeff (1 : SkewMonoidAlgebra k G) 1 = 1 := by - simp only [coeff, One.one, toFinsupp_single, Finsupp.single_eq_same] + simp only [coeff, toFinsupp_single, Finsupp.single_eq_same] theorem coeff_one {a : G} [Decidable (a = 1)] : (1 : SkewMonoidAlgebra k G).coeff a = if a = 1 then 1 else 0 := by diff --git a/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean b/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean index 020d6d845dc986..07376bf4e749af 100644 --- a/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean +++ b/Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean @@ -722,13 +722,12 @@ the class of the non-zero fractional ideal `⟨X - x, Y - y⟩` in the ideal cla @[simps] noncomputable def toClass : W.Point →+ Additive (ClassGroup W.CoordinateRing) where toFun P := match P with - | zero => 0 + | 0 => 0 | some _ _ h => ClassGroup.mk <| CoordinateRing.XYIdeal' h map_zero' := rfl map_add' := by rintro (_ | ⟨x₁, y₁, h₁⟩) (_ | ⟨x₂, y₂, h₂⟩) any_goals simp only [← zero_def, zero_add, add_zero] - any_goals rfl by_cases hxy : x₁ = x₂ ∧ y₁ = W.negY x₂ y₂ · simp only [hxy.left, hxy.right, add_of_Y_eq rfl rfl] exact (CoordinateRing.mk_XYIdeal'_neg_mul h₂).symm @@ -794,7 +793,7 @@ variable [Algebra R S] [Algebra R F] [Algebra S F] [IsScalarTower R S F] [Algebr where `W` is defined over a subring of a ring `S`, and `F` and `K` are field extensions of `S`. -/ noncomputable def map : W'⟮F⟯ →+ W'⟮K⟯ where toFun P := match P with - | zero => 0 + | 0 => 0 | some _ _ h => some _ _ <| (baseChange_nonsingular _ _ f.injective).mpr h map_zero' := rfl map_add' := by @@ -802,7 +801,7 @@ noncomputable def map : W'⟮F⟯ →+ W'⟮K⟯ where any_goals rfl by_cases hxy : x₁ = x₂ ∧ y₁ = (W'.baseChange F).toAffine.negY x₂ y₂ · rw [add_of_Y_eq hxy.left hxy.right, - add_of_Y_eq (congr_arg _ hxy.left) <| by rw [hxy.right, baseChange_negY]]; rfl + add_of_Y_eq (congr_arg _ hxy.left) <| by rw [hxy.right, baseChange_negY]] · simpa only [add_some hxy, ← baseChange_addX, ← baseChange_addY, ← baseChange_slope] using (add_some fun h ↦ hxy ⟨f.injective h.1, f.injective (W'.baseChange_negY f .. ▸ h).2⟩).symm @@ -878,9 +877,9 @@ lemma xRep_neg (P : W'.Point) : (-P).xRep = P.xRep := by lemma eq_or_eq_neg_of_xRep_eq_xRep {P Q : W.Point} (h : P.xRep = Q.xRep) : P = Q ∨ P = -Q := by match P, Q with - | zero, zero => exact .inl rfl - | zero, some .. => simp [xRep] at h - | some .., zero => simp [xRep] at h + | 0, 0 => exact .inl rfl + | 0, some .. => simp [xRep] at h + | some .., 0 => simp [xRep] at h | some x₁ .., some x₂ .. => simp only [xRep, Matrix.vecCons_inj, and_true] at h exact X_eq_iff.mp h diff --git a/Mathlib/AlgebraicTopology/MooreComplex.lean b/Mathlib/AlgebraicTopology/MooreComplex.lean index efd1d5a4c93103..6c9c9dccd7e163 100644 --- a/Mathlib/AlgebraicTopology/MooreComplex.lean +++ b/Mathlib/AlgebraicTopology/MooreComplex.lean @@ -135,10 +135,7 @@ def map (f : X ⟶ Y) : obj X ⟶ obj Y := erw [kernelSubobject_arrow_comp_assoc] rw [zero_comp, comp_zero])) fun n => by - cases n <;> - simp only [Nat.reduceAdd, objX_add_one, objX_zero, objD, Fin.isValue, - factorThru_arrow_assoc, Category.assoc] <;> - cat_disch + cases n <;> dsimp [objD, objX] <;> cat_disch end NormalizedMooreComplex diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean index 0eed2ca162fcb9..883e7061c5ce09 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Nerve.lean @@ -61,8 +61,7 @@ lemma nerveMap_app_mk₀ (x : C) : lemma nerveMap_app_mk₁ {x y : C} (f : x ⟶ y) : (nerveMap F).app (op ⦋1⦌) (ComposableArrows.mk₁ f) = ComposableArrows.mk₁ (F.map f) := - ComposableArrows.ext₁ (by with_unfolding_all rfl) (by with_unfolding_all rfl) - (by simp [nerveMap_app]) + ComposableArrows.ext₁ rfl rfl (by simp [nerveMap_app]) end @@ -102,7 +101,6 @@ lemma σ_obj {n : ℕ} (i : Fin (n + 1)) (x : ComposableArrows C n) (j : Fin (n lemma δ₀_eq {x : ComposableArrows C (n + 1)} : (nerve C).δ (0 : Fin (n + 2)) x = x.δ₀ := rfl -set_option backward.isDefEq.respectTransparency false in lemma σ₀_mk₀_eq (x : C) : (nerve C).σ (0 : Fin 1) (.mk₀ x) = .mk₁ (𝟙 x) := ComposableArrows.ext₁ rfl rfl (by simp; rfl) diff --git a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean index 90ad2d99dedc59..2dc3422652b351 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean @@ -209,18 +209,8 @@ theorem contDiffWithinAt_infty : theorem ContDiffWithinAt.continuousWithinAt (h : ContDiffWithinAt 𝕜 n f s x) : ContinuousWithinAt f s x := by have := h.of_le (zero_le _) - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The next two lines of this proof were previously just - ``` - simp only [ContDiffWithinAt, nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, - CharP.cast_eq_zero] at this - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - change ∀ m : ℕ, (m : ℕ∞) ≤ 0 → _ at this - simp only [nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, CharP.cast_eq_zero] at this + simp only [ContDiffWithinAt, nonpos_iff_eq_zero, Nat.cast_eq_zero, forall_eq, CharP.cast_eq_zero] + at this rcases this with ⟨u, hu, p, H⟩ rw [mem_nhdsWithin_insert] at hu exact (H.continuousOn.continuousWithinAt hu.1).mono_of_mem_nhdsWithin hu.2 diff --git a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean index 19d72fd6fa25a3..faeae0816484c6 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Basic.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Basic.lean @@ -303,12 +303,10 @@ lemma mk₁_comp_eqToHom {X₀ X₁ X₁' : C} (f : X₀ ⟶ X₁) (h : X₁ = X ComposableArrows.mk₁ (f ≫ eqToHom h) = ComposableArrows.mk₁ f := by cat_disch -set_option backward.isDefEq.respectTransparency false in lemma mk₁_hom (X : ComposableArrows C 1) : mk₁ X.hom = X := ext₁ rfl rfl (by simp) -set_option backward.isDefEq.respectTransparency false in /-- The bijection between `ComposableArrows C 1` and `Arrow C`. -/ @[simps] def arrowEquiv : ComposableArrows C 1 ≃ Arrow C where @@ -438,21 +436,21 @@ variable {X₀ X₁ X₂ X₃ X₄ : C} (f : X₀ ⟶ X₁) (g : X₁ ⟶ X₂) /-! These examples are meant to test the good definitional properties of `precomp`, and that `dsimp` can see through. -/ -example : map' (mk₂ f g) 0 1 = f := by with_unfolding_all rfl -example : map' (mk₂ f g) 1 2 = g := by with_unfolding_all rfl -example : map' (mk₂ f g) 0 2 = f ≫ g := by with_unfolding_all rfl -example : (mk₂ f g).hom = f ≫ g := by with_unfolding_all rfl -example : map' (mk₂ f g) 0 0 = 𝟙 _ := by with_unfolding_all rfl -example : map' (mk₂ f g) 1 1 = 𝟙 _ := by with_unfolding_all rfl -example : map' (mk₂ f g) 2 2 = 𝟙 _ := by with_unfolding_all rfl - -example : map' (mk₃ f g h) 0 1 = f := by with_unfolding_all rfl -example : map' (mk₃ f g h) 1 2 = g := by with_unfolding_all rfl -example : map' (mk₃ f g h) 2 3 = h := by with_unfolding_all rfl -example : map' (mk₃ f g h) 0 3 = f ≫ g ≫ h := by with_unfolding_all rfl -example : (mk₃ f g h).hom = f ≫ g ≫ h := by with_unfolding_all rfl -example : map' (mk₃ f g h) 0 2 = f ≫ g := by with_unfolding_all rfl -example : map' (mk₃ f g h) 1 3 = g ≫ h := by with_unfolding_all rfl +example : map' (mk₂ f g) 0 1 = f := by dsimp +example : map' (mk₂ f g) 1 2 = g := by dsimp +example : map' (mk₂ f g) 0 2 = f ≫ g := by dsimp +example : (mk₂ f g).hom = f ≫ g := by dsimp +example : map' (mk₂ f g) 0 0 = 𝟙 _ := by dsimp +example : map' (mk₂ f g) 1 1 = 𝟙 _ := by dsimp +example : map' (mk₂ f g) 2 2 = 𝟙 _ := by dsimp + +example : map' (mk₃ f g h) 0 1 = f := by dsimp +example : map' (mk₃ f g h) 1 2 = g := by dsimp +example : map' (mk₃ f g h) 2 3 = h := by dsimp +example : map' (mk₃ f g h) 0 3 = f ≫ g ≫ h := by dsimp +example : (mk₃ f g h).hom = f ≫ g ≫ h := by dsimp +example : map' (mk₃ f g h) 0 2 = f ≫ g := by dsimp +example : map' (mk₃ f g h) 1 3 = g ≫ h := by dsimp end @@ -638,7 +636,6 @@ lemma ext₂ {f g : ComposableArrows C 2} (w₁ : f.map' 1 2 = eqToHom h₁ ≫ g.map' 1 2 ≫ eqToHom h₂.symm) : f = g := ext_succ h₀ (ext₁ h₁ h₂ w₁) w₀ -set_option backward.isDefEq.respectTransparency false in lemma mk₂_surjective (X : ComposableArrows C 2) : ∃ (X₀ X₁ X₂ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂), X = mk₂ f₀ f₁ := ⟨_, _, _, X.map' 0 1, X.map' 1 2, ext₂ rfl rfl rfl (by simp) (by simp)⟩ @@ -716,7 +713,6 @@ lemma ext₃ {f g : ComposableArrows C 3} (w₂ : f.map' 2 3 = eqToHom h₂ ≫ g.map' 2 3 ≫ eqToHom h₃.symm) : f = g := ext_succ h₀ (ext₂ h₁ h₂ h₃ w₁ w₂) w₀ -set_option backward.isDefEq.respectTransparency false in lemma mk₃_surjective (X : ComposableArrows C 3) : ∃ (X₀ X₁ X₂ X₃ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃), X = mk₃ f₀ f₁ f₂ := ⟨_, _, _, _, X.map' 0 1, X.map' 1 2, X.map' 2 3, @@ -796,7 +792,6 @@ lemma ext₄ {f g : ComposableArrows C 4} f = g := ext_succ h₀ (ext₃ h₁ h₂ h₃ h₄ w₁ w₂ w₃) w₀ -set_option backward.isDefEq.respectTransparency false in lemma mk₄_surjective (X : ComposableArrows C 4) : ∃ (X₀ X₁ X₂ X₃ X₄ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃) (f₃ : X₃ ⟶ X₄), X = mk₄ f₀ f₁ f₂ f₃ := @@ -879,7 +874,6 @@ lemma ext₅ {f g : ComposableArrows C 5} f = g := ext_succ h₀ (ext₄ h₁ h₂ h₃ h₄ h₅ w₁ w₂ w₃ w₄) w₀ -set_option backward.isDefEq.respectTransparency false in lemma mk₅_surjective (X : ComposableArrows C 5) : ∃ (X₀ X₁ X₂ X₃ X₄ X₅ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃) (f₃ : X₃ ⟶ X₄) (f₄ : X₄ ⟶ X₅), X = mk₅ f₀ f₁ f₂ f₃ f₄ := @@ -956,7 +950,6 @@ def Functor.mapComposableArrows : ComposableArrows C n ⥤ ComposableArrows D n := (whiskeringRight _ _ _).obj G -set_option backward.isDefEq.respectTransparency false in /-- The isomorphism between `(G.mapComposableArrows 1).obj (.mk₁ f)` and `.mk₁ (G.map f)`. -/ @[simps!] @@ -964,7 +957,6 @@ def Functor.mapComposableArrowsObjMk₁Iso {X Y : C} (f : X ⟶ Y) : (G.mapComposableArrows 1).obj (.mk₁ f) ≅ .mk₁ (G.map f) := isoMk₁ (Iso.refl _) (Iso.refl _) -set_option backward.isDefEq.respectTransparency false in /-- The isomorphism between `(G.mapComposableArrows 2).obj (.mk₂ f g)` and `.mk₂ (G.map f) (G.map g)`. -/ @[simps!] diff --git a/Mathlib/CategoryTheory/ComposableArrows/One.lean b/Mathlib/CategoryTheory/ComposableArrows/One.lean index 06fb0e4e1f9d8e..ec776f21ef10e1 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/One.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/One.lean @@ -39,7 +39,8 @@ def mapFunctorArrows (i j i' j' n : ℕ) (_ : i ≤ i' := by lia) (_ : j ≤ j' := by lia) (_ : j' ≤ n := by lia) : functorArrows C i j n ⟶ functorArrows C i' j' n where - app S := homMk₁ (S.map' i i') (S.map' j j') (by simp [← Functor.map_comp]) + app S := homMk₁ (S.map' i i') (S.map' j j') + (by simp [← Functor.map_comp]) end ComposableArrows diff --git a/Mathlib/CategoryTheory/ComposableArrows/Three.lean b/Mathlib/CategoryTheory/ComposableArrows/Three.lean index 22122c2124f276..8a16c3bc3de166 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Three.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Three.lean @@ -35,7 +35,6 @@ variable {C : Type u} [Category.{v} C] {i j k l : C} (f₁ : i ⟶ j) (f₂ : j ⟶ k) (f₃ : k ⟶ l) (f₁₂ : i ⟶ k) (f₂₃ : j ⟶ l) -set_option backward.isDefEq.respectTransparency false in /-- The morphism `mk₂ f₁ f₂ ⟶ mk₂ f₁ f₂₃` when `f₂ ≫ f₃ = f₂₃`. -/ def threeδ₃Toδ₂ (h₂₃ : f₂ ≫ f₃ = f₂₃ := by cat_disch) : mk₂ f₁ f₂ ⟶ mk₂ f₁ f₂₃ := diff --git a/Mathlib/CategoryTheory/ComposableArrows/Two.lean b/Mathlib/CategoryTheory/ComposableArrows/Two.lean index f2fe7c5af9a61a..698a59be84e46d 100644 --- a/Mathlib/CategoryTheory/ComposableArrows/Two.lean +++ b/Mathlib/CategoryTheory/ComposableArrows/Two.lean @@ -31,13 +31,11 @@ section variable {C : Type*} [Category* C] {i j k : C} (f : i ⟶ j) (g : j ⟶ k) (fg : i ⟶ k) -set_option backward.isDefEq.respectTransparency false in /-- The morphism `mk₁ f ⟶ mk₁ fg` when `f ≫ g = fg` for some morphism `g`. -/ def twoδ₂Toδ₁ (h : f ≫ g = fg := by cat_disch) : mk₁ f ⟶ mk₁ fg := homMk₁ (𝟙 _) g -set_option backward.isDefEq.respectTransparency false in /-- The morphism `mk₁ fg ⟶ mk₁ g` when `f ≫ g = fg` for some morphism `f`. -/ def twoδ₁Toδ₀ (h : f ≫ g = fg := by cat_disch) : mk₁ fg ⟶ mk₁ g := @@ -47,27 +45,27 @@ variable (h : f ≫ g = fg) @[simp] lemma twoδ₂Toδ₁_app_zero : - (twoδ₂Toδ₁ f g fg h).app 0 = 𝟙 _ := by with_unfolding_all rfl + (twoδ₂Toδ₁ f g fg h).app 0 = 𝟙 _ := rfl @[simp] lemma twoδ₂Toδ₁_app_one : - (twoδ₂Toδ₁ f g fg h).app 1 = g := by with_unfolding_all rfl + (twoδ₂Toδ₁ f g fg h).app 1 = g := rfl @[simp] lemma twoδ₁Toδ₀_app_zero : - (twoδ₁Toδ₀ f g fg h).app 0 = f := by with_unfolding_all rfl + (twoδ₁Toδ₀ f g fg h).app 0 = f := rfl @[simp] lemma twoδ₁Toδ₀_app_one : - (twoδ₁Toδ₀ f g fg h).app 1 = 𝟙 _ := by with_unfolding_all rfl + (twoδ₁Toδ₀ f g fg h).app 1 = 𝟙 _ := rfl instance [IsIso g] : IsIso (twoδ₂Toδ₁ f g fg h) := by - rw [isIso_iff₁, twoδ₂Toδ₁_app_zero, twoδ₂Toδ₁_app_one] - exact ⟨IsIso.id _, ‹_›⟩ + rw [isIso_iff₁] + constructor <;> dsimp <;> infer_instance instance [IsIso f] : IsIso (twoδ₁Toδ₀ f g fg h) := by - rw [isIso_iff₁, twoδ₁Toδ₀_app_zero, twoδ₁Toδ₀_app_one] - exact ⟨‹_›, IsIso.id _⟩ + rw [isIso_iff₁] + constructor <;> dsimp <;> infer_instance end diff --git a/Mathlib/Computability/RegularExpressions.lean b/Mathlib/Computability/RegularExpressions.lean index 584129a46cbce2..f1f698c89062b7 100644 --- a/Mathlib/Computability/RegularExpressions.lean +++ b/Mathlib/Computability/RegularExpressions.lean @@ -103,8 +103,6 @@ def matches' : RegularExpression α → Language α | P * Q => P.matches' * Q.matches' | star P => P.matches'∗ -attribute [nolint simpNF] matches'.eq_1 matches'.eq_2 - theorem matches'_zero : (0 : RegularExpression α).matches' = 0 := rfl @@ -139,13 +137,6 @@ def matchEpsilon : RegularExpression α → Bool | P * Q => P.matchEpsilon && Q.matchEpsilon | star _P => true -@[simp] -theorem matchEpsilon_zero : matchEpsilon (0 : RegularExpression α) = false := by - change matchEpsilon zero = false; rfl - -theorem matchEpsilon_one : matchEpsilon (1 : RegularExpression α) = true := by - change matchEpsilon epsilon = true; rfl - section DecidableEq variable [DecidableEq α] @@ -191,10 +182,10 @@ def rmatch : RegularExpression α → List α → Bool @[simp] theorem zero_rmatch (x : List α) : rmatch 0 x = false := by - induction x <;> simp [rmatch, matchEpsilon_zero, *] + induction x <;> simp [rmatch, matchEpsilon, *] theorem one_rmatch_iff (x : List α) : rmatch 1 x ↔ x = [] := by - induction x <;> simp [rmatch, matchEpsilon_one, *] + induction x <;> simp [rmatch, matchEpsilon, *] theorem char_rmatch_iff (a : α) (x : List α) : rmatch (char a) x ↔ x = [a] := by rcases x with - | ⟨_, x⟩ @@ -340,8 +331,6 @@ def map (f : α → β) : RegularExpression α → RegularExpression β | R * S => map f R * map f S | star R => star (map f R) -attribute [nolint simpNF] map.eq_1 map.eq_2 - @[simp] protected theorem map_pow (f : α → β) (P : RegularExpression α) : ∀ n : ℕ, map f (P ^ n) = map f P ^ n diff --git a/Mathlib/Computability/TuringMachine/ToPartrec.lean b/Mathlib/Computability/TuringMachine/ToPartrec.lean index 5440109fbb4d7a..7ac1eb9c5932a7 100644 --- a/Mathlib/Computability/TuringMachine/ToPartrec.lean +++ b/Mathlib/Computability/TuringMachine/ToPartrec.lean @@ -789,8 +789,7 @@ theorem pred_ok (q₁ q₂ s v) (c d : List Γ') : ∃ s', simp only [trList, trNat.eq_1, trNum, Nat.cast_succ, Num.add_one, Num.succ, List.tail_cons, List.headI_cons] rcases (n : Num) with - | a - · simp only [show (1 : PosNum) = PosNum.one from rfl, - trPosNum, Num.succ', List.singleton_append, List.nil_append] + · simp only [trPosNum, Num.succ', List.singleton_append, List.nil_append] refine TransGen.head rfl ?_ rw [tr]; simp only [pop', TM2.stepAux] convert unrev_ok using 2 diff --git a/Mathlib/Data/Nat/Bitwise.lean b/Mathlib/Data/Nat/Bitwise.lean index af49dc84185225..6d984e98f7c0d7 100644 --- a/Mathlib/Data/Nat/Bitwise.lean +++ b/Mathlib/Data/Nat/Bitwise.lean @@ -364,8 +364,10 @@ theorem xor_range (n : ℕ) : (List.range (n + 1)).foldl (· ^^^ ·) 0 = refine xor_one_of_even <| even_iff.mpr ?_ rw [add_mod, ← @mod_mod_of_dvd _ 4 n <| by simp, ← Fin.val_ofNat 4, h] rfl - | 2 => apply Nat.xor_self - | 3 => apply zero_xor + | 2 => + apply Nat.xor_self + | 3 => + apply zero_xor lemma shiftLeft_lt {x n m : ℕ} (h : x < 2 ^ n) : x <<< m < 2 ^ (n + m) := by simp only [Nat.pow_add, shiftLeft_eq, Nat.mul_lt_mul_right (Nat.two_pow_pos _), h] diff --git a/Mathlib/Data/Num/Lemmas.lean b/Mathlib/Data/Num/Lemmas.lean index 899b09807a44c4..e509b2f4ebf402 100644 --- a/Mathlib/Data/Num/Lemmas.lean +++ b/Mathlib/Data/Num/Lemmas.lean @@ -210,7 +210,7 @@ theorem ofNat'_bit (b n) : ofNat' (Nat.bit b n) = cond b Num.bit1 Num.bit0 (ofNa Nat.binaryRec_eq _ _ (.inl rfl) @[simp] -theorem ofNat'_one : Num.ofNat' 1 = 1 := by decide +theorem ofNat'_one : Num.ofNat' 1 = 1 := by simp [Num.ofNat', Num.bit1] theorem bit1_succ : ∀ n : Num, n.bit1.succ = n.succ.bit0 | 0 => rfl diff --git a/Mathlib/Data/Num/ZNum.lean b/Mathlib/Data/Num/ZNum.lean index ef4748f2f3f213..1b72fb0c3fea1d 100644 --- a/Mathlib/Data/Num/ZNum.lean +++ b/Mathlib/Data/Num/ZNum.lean @@ -110,17 +110,7 @@ theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = (n : α) @[simp, norm_cast] theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = ((n : α) + n) + 1 - | 0 => by - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof used to finish from this point as - ``` - simp [ZNum.bit1] - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - change ((ZNum.zero).bit1 : α) = _; simp [ZNum.bit1] + | 0 => by simp [ZNum.bit1] | pos p => by rw [ZNum.bit1, cast_pos, cast_pos]; rfl | neg p => by rw [ZNum.bit1, cast_neg, cast_neg] @@ -322,7 +312,9 @@ theorem ofInt'_neg : ∀ n : ℤ, ofInt' (-n) = -ofInt' n | (n + 1 : ℕ) => show Num.toZNumNeg _ = -Num.toZNum _ by rw [Num.zneg_toZNum] theorem of_to_int' : ∀ n : ZNum, ZNum.ofInt' n = n - | 0 => rfl + | 0 => by + dsimp [ofInt', cast_zero] + simp only [Num.ofNat'_zero, Num.toZNum] | pos a => by rw [cast_pos, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; rfl | neg a => by rw [cast_neg, ofInt'_neg, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; rfl @@ -579,8 +571,11 @@ end PosNum namespace Num @[simp] -protected theorem div_zero (n : Num) : n / 0 = 0 := by - cases n <;> rfl +protected theorem div_zero (n : Num) : n / 0 = 0 := + show n.div 0 = 0 by + cases n + · rfl + · simp [Num.div] @[simp, norm_cast] theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d @@ -590,8 +585,11 @@ theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d | pos _, pos _ => PosNum.div'_to_nat _ _ @[simp] -protected theorem mod_zero (n : Num) : n % 0 = n := by - cases n <;> rfl +protected theorem mod_zero (n : Num) : n % 0 = n := + show n.mod 0 = n by + cases n + · rfl + · simp [Num.mod] @[simp, norm_cast] theorem mod_to_nat : ∀ n d, ((n % d : Num) : ℕ) = n % d diff --git a/Mathlib/Data/Sign/Defs.lean b/Mathlib/Data/Sign/Defs.lean index dfb28da0cb85e9..dd542a5dbcf3f1 100644 --- a/Mathlib/Data/Sign/Defs.lean +++ b/Mathlib/Data/Sign/Defs.lean @@ -130,9 +130,9 @@ def fin3Equiv : SignType ≃* Fin 3 where left_inv a := by cases a <;> rfl right_inv a := match a with - | ⟨0, _⟩ => by decide +revert - | ⟨1, _⟩ => by decide +revert - | ⟨2, _⟩ => by decide +revert + | ⟨0, _⟩ => by simp + | ⟨1, _⟩ => by simp + | ⟨2, _⟩ => by simp map_mul' a b := by cases a <;> cases b <;> rfl diff --git a/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean b/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean index dfe13fa75c649a..cf3de1bd7c6146 100644 --- a/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean +++ b/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean @@ -162,7 +162,7 @@ theorem DenseRange.zpow_of_ergodic_mul_left [OpensMeasurableSpace G] ∃ V : Set G, 1 ∈ V ∧ IsOpen V ∧ ∀ x ∈ V, ∀ y ∈ V, ∀ m : ℤ, g ^ m ≠ a * x / y := by rw [← mem_compl_iff, ← interior_compl, mem_interior_iff_mem_nhds] at h have : Tendsto (fun (x, y) ↦ a * x / y) (𝓝 1) (𝓝 a) := - Continuous.tendsto' (by fun_prop) _ _ (by simp [One.one]) + Continuous.tendsto' (by fun_prop) _ _ (by simp) rw [nhds_prod_eq] at this simpa [(nhds_basis_opens (1 : G)).prod_self.mem_iff, prod_subset_iff, and_assoc] using this h set s := ⋃ m : ℤ, g ^ m • V diff --git a/Mathlib/NumberTheory/Zsqrtd/Basic.lean b/Mathlib/NumberTheory/Zsqrtd/Basic.lean index f955bb00389cea..25a68986289d3b 100644 --- a/Mathlib/NumberTheory/Zsqrtd/Basic.lean +++ b/Mathlib/NumberTheory/Zsqrtd/Basic.lean @@ -637,32 +637,12 @@ instance preorder : Preorder (ℤ√d) where open Int in -- TODO add an `Archimedean (ℤ√d)` instance and drop this lemma theorem le_arch (a : ℤ√d) : ∃ n : ℕ, a ≤ n := by - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The last three `by` subproofs inside the following match arms used to be each - ``` - by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg] - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ obtain ⟨x, y, (h : a ≤ ⟨x, y⟩)⟩ : ∃ x y : ℕ, Nonneg (⟨x, y⟩ + -a) := match -a with | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by trivial⟩ - | ⟨Int.ofNat x, -[y+1]⟩ => ⟨0, y + 1, by - simp only [Nonneg, Nonnegg, Nat.cast_zero, ofNat_eq_natCast, zero_add, - Nat.cast_add, Nat.cast_one, negSucc_eq, neg_add_rev, reduceNeg, - add_assoc, add_neg_cancel_left, add_neg_cancel] - trivial⟩ - | ⟨-[x+1], Int.ofNat y⟩ => ⟨x + 1, 0, by - simp only [Nonneg, Nonnegg, Nat.cast_add, Nat.cast_one, negSucc_eq, - neg_add_rev, reduceNeg, add_assoc, add_neg_cancel_left, add_neg_cancel, - Nat.cast_zero, ofNat_eq_natCast, zero_add] - trivial⟩ - | ⟨-[x+1], -[y+1]⟩ => ⟨x + 1, y + 1, by - simp only [Nonneg, Nonnegg, Nat.cast_add, Nat.cast_one, negSucc_eq, - neg_add_rev, reduceNeg, add_assoc, add_neg_cancel_left, add_neg_cancel] - trivial⟩ + | ⟨Int.ofNat x, -[y+1]⟩ => ⟨0, y + 1, by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg]⟩ + | ⟨-[x+1], Int.ofNat y⟩ => ⟨x + 1, 0, by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg]⟩ + | ⟨-[x+1], -[y+1]⟩ => ⟨x + 1, y + 1, by simp [Int.negSucc_eq, add_assoc, Nonneg, Nonnegg]⟩ refine ⟨x + d * y, h.trans ?_⟩ change Nonneg ⟨↑x + d * y - ↑x, 0 - ↑y⟩ rcases y with - | y diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean index c79324fe4245d3..930937a54a7d5b 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean @@ -122,16 +122,7 @@ theorem count_some (hp : Irreducible p) (s : Multiset _) : @[simp] theorem count_zero (hp : Irreducible p) : count p (0 : FactorSet α) = 0 := by - #adaptation_note /-- Proof repaired after leanprover/lean4#13363. - The proof body used to be just - ``` simp only [count, dif_pos hp, bcount, Multiset.count_zero] - ``` - The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ - rw [show (0 : FactorSet α) = WithTop.some 0 from rfl, count_some hp, Multiset.count_zero] theorem count_reducible (hp : ¬Irreducible p) : count p = 0 := dif_neg hp diff --git a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean index 0d4050e3116d44..162e0f42544bc5 100644 --- a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean +++ b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean @@ -1317,7 +1317,7 @@ variable (A B) in def mapPosSubmonoid : posSubmonoid A →* posSubmonoid B where toFun := fun ⟨a,ha⟩ => ⟨algebraMap _ _ a, by simpa only [posSubmonoid_def, ← (algebraMap A B).map_zero, vlt_iff_vlt] using ha⟩ - map_one' := by simp [One.one] + map_one' := by simp map_mul' := by simp variable (A) in diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index d5f2526900c181..a22188b043cfcc 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -444,7 +444,7 @@ theorem repr_add : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ + o₂) = rep conv at nf => simp [HAdd.hAdd, Add.add] conv in _ + o => simp [HAdd.hAdd, Add.add] rcases h : add a o with - | ⟨e', n', a'⟩ <;> - simp only [add, addAux, h'.symm, h, add_assoc, repr, repr_zero] at nf h₁ ⊢ + simp only [add, addAux, h'.symm, h, add_assoc, repr] at nf h₁ ⊢ have := h₁.fst; haveI := nf.fst; have ee := cmp_compares e e' cases he : cmp e e' <;> simp only [he, Ordering.compares_gt, Ordering.compares_lt, Ordering.compares_eq, repr, gt_iff_lt, PNat.add_coe, Nat.cast_add] at ee ⊢ @@ -711,8 +711,7 @@ instance nf_scale (x) [NF x] (o) [NF o] : NF (scale x o) := by @[simp] theorem repr_scale (x) [NF x] (o) [NF o] : repr (scale x o) = ω ^ repr x * repr o := by - simp only [scale_eq_mul, repr_mul, repr, repr_zero, PNat.one_coe, Nat.cast_one, mul_one, - add_zero] + simp only [scale_eq_mul, repr_mul, repr, PNat.one_coe, Nat.cast_one, mul_one, add_zero] theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by rcases e : split' o with ⟨a, n⟩ @@ -951,9 +950,8 @@ theorem repr_opow (o₁ o₂) [NF o₁] [NF o₂] : repr (o₁ ^ o₂) = repr o · simp only [opowAux2, opow_def, e₁, h, r₁, r₂, OfNat.ofNat, Zero.zero, One.one, repr] simp [opow_add, opow_mul] - simp only [opow_def, opowAux2, e₁, r₁, e₂, r₂, repr, repr_zero, - Nat.cast_succ, _root_.zero_add, - add_zero] + simp only [opow_def, opowAux2, e₁, r₁, e₂, r₂, repr, + Nat.cast_succ, _root_.zero_add, add_zero] rw [opow_add, opow_mul, opow_omega0] · simp · simpa [Nat.one_le_iff_ne_zero] diff --git a/Mathlib/Tactic/NormNum/PowMod.lean b/Mathlib/Tactic/NormNum/PowMod.lean index ce48e704cc8e97..1c139b5727f947 100644 --- a/Mathlib/Tactic/NormNum/PowMod.lean +++ b/Mathlib/Tactic/NormNum/PowMod.lean @@ -54,10 +54,10 @@ theorem IsNatPowModT.bit0 : ⟨fun h1 => by simp only [two_mul, Nat.pow_eq, pow_add, ← h1, Nat.mul_eq]; exact Nat.mul_mod ..⟩ theorem natPow_zero_natMod_zero : Nat.mod (Nat.pow a (nat_lit 0)) (nat_lit 0) = nat_lit 1 := by - simp [Nat.mod, Nat.modCore, OfNat.ofNat, One.one] + simp [Nat.mod, Nat.modCore] theorem natPow_zero_natMod_one : Nat.mod (Nat.pow a (nat_lit 0)) (nat_lit 1) = nat_lit 0 := by - simp [Nat.mod, Nat.modCore, OfNat.ofNat, One.one, Nat.modCore.go] + simp [Nat.mod, Nat.modCore_eq] theorem natPow_zero_natMod_succ_succ : Nat.mod (Nat.pow a (nat_lit 0)) (Nat.succ (Nat.succ m)) = nat_lit 1 := by From 354733ed73d06c2d9056514bd007b45a6c739254 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Fri, 24 Apr 2026 09:46:05 +0000 Subject: [PATCH 107/116] chore: remove unused helper lemmas from Ordinal/Notation adaptation Remove `zero_zero_eq`, `one_one_eq`, `repr_zero'`, and `ofNat_unfold` which were added during the lean4#13363 adaptation but are not used in any proofs. Co-Authored-By: Claude Opus 4.6 --- Mathlib/SetTheory/Ordinal/Notation.lean | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index a22188b043cfcc..a413462b514256 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -54,10 +54,6 @@ instance : Zero ONote := theorem zero_def : zero = 0 := rfl --- After leanprover/lean4#13363 (matchwhnf changes), `Zero.zero` doesn't unfold in match --- discriminants. -theorem zero_zero_eq : (Zero.zero : ONote) = zero := rfl - instance : Inhabited ONote := ⟨0⟩ @@ -65,7 +61,6 @@ instance : Inhabited ONote := instance : One ONote := ⟨oadd 0 1 0⟩ -theorem one_one_eq : (One.one : ONote) = oadd 0 1 0 := rfl /-- Notation for ω -/ def omega : ONote := @@ -76,7 +71,6 @@ noncomputable def repr : ONote → Ordinal.{0} | 0 => 0 | oadd e n a => ω ^ repr e * n + repr a @[simp] theorem repr_zero : repr 0 = 0 := rfl -@[simp] theorem repr_zero' : repr zero = 0 := rfl attribute [simp] repr.eq_1 repr.eq_2 set_option backward.privateInPublic true in @@ -141,12 +135,6 @@ instance : WellFoundedRelation ONote := instance (priority := low) nat (n : ℕ) : OfNat ONote n where ofNat := ofNat n --- Unfold the OfNat class projection for ONote to the concrete `ofNat` function. --- Needed because after leanprover/lean4#13363, class projections no longer unfold in match --- discriminants. -theorem ofNat_unfold (n : ℕ) : @OfNat.ofNat ONote n (nat n) = ofNat n := rfl - - @[simp 1200] theorem ofNat_one : ofNat 1 = 1 := rfl @[simp] theorem repr_ofNat (n : ℕ) : repr (ofNat n) = n := by cases n <;> simp From 227f9b914e8b96a4d49c6d40c68d960fe076d30a Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Fri, 24 Apr 2026 10:06:01 +0000 Subject: [PATCH 108/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13363 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 4536c34dc7af3b..1f840ea98c5954 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "a985c160afc3d49773f1ad02d0d73a021d5dee41", + "rev": "f3823b2e1a4cefeaf97972598d29ab79460437ac", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13363", diff --git a/lean-toolchain b/lean-toolchain index 5d0967670ed6d5..bea6f9aa0fade6 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13363-c9741df +leanprover/lean4-pr-releases:pr-release-13363-aabbf7d From 335001c3c7f26548ef41442906c9ea5d354a97c9 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Fri, 24 Apr 2026 12:06:32 +0000 Subject: [PATCH 109/116] adapt Limits/Shapes/ConcreteCategory to lean4#13363 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use `WalkingMulticospan.Hom.id_eq_id` and `Functor.map_id` to reduce stuck matches on `𝟙` in WalkingMulticospan naturality proofs. Co-Authored-By: Claude Opus 4.6 --- Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean b/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean index 6747ce7cb7c1c5..43b0d7cc35f8fb 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean @@ -296,11 +296,11 @@ def multiequalizerEquivAux {J : MulticospanShape.{w, w'}} (I : MulticospanIndex | WalkingMulticospan.right b => I.fst b (x.1 _) property := by rintro (a | b) (a' | b') (f | f | f) - · simp + · simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id]; rfl · rfl · dsimp exact (x.2 b').symm - · simp } + · simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id]; rfl } left_inv := by intro x; ext (a | b) · rfl From ad1873b01a87a90fc744ecceb00562a9849a0ebb Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Fri, 24 Apr 2026 12:21:06 +0000 Subject: [PATCH 110/116] Bump batteries --- lake-manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 407d82bed08915..4663751f0f7c4e 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "e0306a8b97d88a3c97bbe4fa0bd4dae970f8b521", + "rev": "f14c956856fde4ffe716f177cd22070fcd800739", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-13363", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", From 21286e9ed1d3cb25c81c2d942d049aacc47175b3 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Fri, 24 Apr 2026 12:54:32 +0000 Subject: [PATCH 111/116] Update lean-toolchain for https://github.com/leanprover/lean4/pull/13363 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 4663751f0f7c4e..534ad17df012d8 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "f14c956856fde4ffe716f177cd22070fcd800739", + "rev": "bb114bb3ee77b1e3f9bec5d03f13c04daee4a059", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-13363", diff --git a/lean-toolchain b/lean-toolchain index bea6f9aa0fade6..8108152980e94d 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-13363-aabbf7d +leanprover/lean4-pr-releases:pr-release-13363-fa59586 From 18ebfaebe8c4b60e32506ed52a16261a9e9a7f78 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Sat, 25 Apr 2026 09:18:28 +0000 Subject: [PATCH 112/116] chore: bump to nightly-2026-04-25 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 53aa4bd0f71edd..0b70422e52df19 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-24 +leanprover/lean4:nightly-2026-04-25 From c22b6cccb2987a043cefceaf6c3f5ea8ed5e9948 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Sun, 26 Apr 2026 05:58:05 +0000 Subject: [PATCH 113/116] satisfy linter --- Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean | 8 ++++---- Mathlib/CategoryTheory/Sites/Whiskering.lean | 6 +++--- Mathlib/SetTheory/Ordinal/Notation.lean | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean index 7ab28b9b13664d..1e74989fbe0043 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean @@ -548,9 +548,9 @@ def ofι {J : MulticospanShape.{w, w'}} (I : MulticospanIndex J C) apply w ``` The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ + this file review the proof, and either approve it by removing this note, + revise the proof or the prerequisites appropriately, or minimize a problem in lean4 that + still needs addressing. -/ rintro (_ | _) (_ | _) (_ | _ | _) <;> simp only [WalkingMulticospan.Hom.id_eq_id, Functor.map_id, Functor.const_obj_map, Category.comp_id] <;> @@ -681,7 +681,7 @@ def ofPiFork · simp ``` The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise + this file review the proof, and either approve it by removing this note, revise the proof or the prerequisites appropriately, or minimize a problem in lean4 that still needs addressing. -/ rintro (_ | _) (_ | _) (_ | _ | _) diff --git a/Mathlib/CategoryTheory/Sites/Whiskering.lean b/Mathlib/CategoryTheory/Sites/Whiskering.lean index 35ef9888c79d3a..fe31d6e83c88a3 100644 --- a/Mathlib/CategoryTheory/Sites/Whiskering.lean +++ b/Mathlib/CategoryTheory/Sites/Whiskering.lean @@ -124,9 +124,9 @@ def multicospanComp : (S.index (P ⋙ F)).multicospan ≅ (S.index P).multicospa all_goals cat_disch ``` The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise - the proof or the prerequisites appropriately, or minimize a problem in lean4 that still - needs addressing. -/ + this file review the proof, and either approve it by removing this note, + revise the proof or the prerequisites appropriately, or minimize a problem in lean4 that + still needs addressing. -/ rintro (a | b) (a | b) (f | f | f) <;> simp only [WalkingMulticospan.Hom.id_eq_id, Iso.refl_hom, Category.id_comp, Category.comp_id, Functor.map_id] <;> diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index a413462b514256..e55c70018672e0 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -757,7 +757,7 @@ instance nf_opow (o₁ o₂) [NF o₁] [NF o₂] : NF (o₁ ^ o₂) := by infer_instance ``` The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise + this file review the proof, and either approve it by removing this note, revise the proof or the prerequisites appropriately, or minimize a problem in lean4 that still needs addressing. -/ · rcases m with - | m @@ -921,7 +921,7 @@ theorem repr_opow (o₁ o₂) [NF o₁] [NF o₂] : repr (o₁ ^ o₂) = repr o add_zero] ``` The replacement proof is a short-term fix, and we request that the authors/maintainers of - this file review the proof, and either approve it by removing this adaptation note, revise + this file review the proof, and either approve it by removing this note, revise the proof or the prerequisites appropriately, or minimize a problem in lean4 that still needs addressing. -/ · rcases m with - | m From 9fc131cbe6d30f682c7fb8d9dfa953e0aef5aef9 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Mon, 27 Apr 2026 10:37:55 +0000 Subject: [PATCH 114/116] chore: bump to nightly-2026-04-27 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 0b70422e52df19..fc7a4e4137e3ef 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-04-25 +leanprover/lean4:nightly-2026-04-27 From 0d79925e6ede62347987d57b68856baee0294a32 Mon Sep 17 00:00:00 2001 From: Kim Morrison <477956+kim-em@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:16:37 +1000 Subject: [PATCH 115/116] Apply suggestion from @kim-em --- Mathlib/Algebra/Group/Defs.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/Algebra/Group/Defs.lean b/Mathlib/Algebra/Group/Defs.lean index c9903d9af62d78..784656966179ed 100644 --- a/Mathlib/Algebra/Group/Defs.lean +++ b/Mathlib/Algebra/Group/Defs.lean @@ -15,7 +15,6 @@ public import Mathlib.Tactic.MkIffOfInductiveProp public import Mathlib.Tactic.OfNat public import Mathlib.Data.Nat.Notation public import Mathlib.Tactic.Simps.Basic -public import Mathlib.Tactic.AdaptationNote /-! # Typeclasses for (semi)groups and monoids From 0c408083148466fcfbad502bf88411655ff23239 Mon Sep 17 00:00:00 2001 From: Kim Morrison <477956+kim-em@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:18:01 +1000 Subject: [PATCH 116/116] Apply suggestion from @kim-em --- Mathlib/SetTheory/Ordinal/Notation.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/SetTheory/Ordinal/Notation.lean b/Mathlib/SetTheory/Ordinal/Notation.lean index e55c70018672e0..3e391bb77327dd 100644 --- a/Mathlib/SetTheory/Ordinal/Notation.lean +++ b/Mathlib/SetTheory/Ordinal/Notation.lean @@ -61,7 +61,6 @@ instance : Inhabited ONote := instance : One ONote := ⟨oadd 0 1 0⟩ - /-- Notation for ω -/ def omega : ONote := oadd 1 1 0