Skip to content

Commit 3e139a3

Browse files
committed
Merge remote-tracking branch 'upstream/master' into reducible-convert
2 parents c12f8f7 + e9da88d commit 3e139a3

67 files changed

Lines changed: 881 additions & 266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/shake.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ jobs:
3535
use-github-cache: false
3636
use-mathlib-cache: true
3737

38-
- name: lake build
39-
run: |
40-
lake build Mathlib Archive Counterexamples
38+
# - name: lake build
39+
# run: |
40+
# lake build Archive Counterexamples
4141

4242
- name: lake shake
4343
id: shake
4444
run: |
45-
lake shake --add-public --keep-implied --keep-prefix --fix --explain Mathlib Archive Counterexamples > explain.txt 2>&1
45+
# Add back Archive and Counterexamples when they've been modulized
46+
lake shake --add-public --keep-implied --keep-prefix --fix --explain Mathlib > explain.txt 2>&1
4647
if git diff --quiet; then
4748
echo "changed=false" >> "$GITHUB_OUTPUT"
4849
else
@@ -143,7 +144,7 @@ jobs:
143144
api-key: ${{ secrets.ZULIP_API_KEY }}
144145
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
145146
organization-url: 'https://leanprover.zulipchat.com'
146-
to: 'nightly-testing'
147+
to: 'nightly-testing-mathlib'
147148
type: 'stream'
148149
topic: 'Mathlib `shake --fix`'
149150
content: |

Archive/Imo/Imo2024Q5.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,7 @@ lemma winningStrategy_play_one_eq_none_or_play_two_eq_none_of_edge_zero (hN : 2
938938
lia
939939
· simp at hm
940940
exact m.notMem_monsterCells_of_fst_eq_zero rfl hm
941-
· simp at h
942-
lia
941+
· simp [eqComm] at h
943942
· dsimp only [Nat.reduceAdd, Nat.reduceDiv, Fin.mk_one] at hm
944943
have h1N : 1 ≤ N := by lia
945944
rw [m.mk_mem_monsterCells_iff_of_le (le_refl _) h1N] at hm

Mathlib.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,7 @@ public import Mathlib.AlgebraicGeometry.AffineSpace
13231323
public import Mathlib.AlgebraicGeometry.AffineTransitionLimit
13241324
public import Mathlib.AlgebraicGeometry.AlgClosed.Basic
13251325
public import Mathlib.AlgebraicGeometry.Artinian
1326+
public import Mathlib.AlgebraicGeometry.Birational.RationalMap
13261327
public import Mathlib.AlgebraicGeometry.ColimitsOver
13271328
public import Mathlib.AlgebraicGeometry.Cover.Directed
13281329
public import Mathlib.AlgebraicGeometry.Cover.MorphismProperty
@@ -1423,7 +1424,6 @@ public import Mathlib.AlgebraicGeometry.Properties
14231424
public import Mathlib.AlgebraicGeometry.PullbackCarrier
14241425
public import Mathlib.AlgebraicGeometry.Pullbacks
14251426
public import Mathlib.AlgebraicGeometry.QuasiAffine
1426-
public import Mathlib.AlgebraicGeometry.RationalMap
14271427
public import Mathlib.AlgebraicGeometry.RelativeGluing
14281428
public import Mathlib.AlgebraicGeometry.ResidueField
14291429
public import Mathlib.AlgebraicGeometry.Restrict
@@ -1817,6 +1817,7 @@ public import Mathlib.Analysis.Complex.Arg
18171817
public import Mathlib.Analysis.Complex.Asymptotics
18181818
public import Mathlib.Analysis.Complex.Basic
18191819
public import Mathlib.Analysis.Complex.BorelCaratheodory
1820+
public import Mathlib.Analysis.Complex.BranchLogRoot
18201821
public import Mathlib.Analysis.Complex.CanonicalDecomposition
18211822
public import Mathlib.Analysis.Complex.Cardinality
18221823
public import Mathlib.Analysis.Complex.CauchyIntegral
@@ -4616,6 +4617,7 @@ public import Mathlib.Geometry.Manifold.VectorBundle.LocalFrame
46164617
public import Mathlib.Geometry.Manifold.VectorBundle.MDifferentiable
46174618
public import Mathlib.Geometry.Manifold.VectorBundle.Pullback
46184619
public import Mathlib.Geometry.Manifold.VectorBundle.Riemannian
4620+
public import Mathlib.Geometry.Manifold.VectorBundle.SmoothSection
46194621
public import Mathlib.Geometry.Manifold.VectorBundle.Tangent
46204622
public import Mathlib.Geometry.Manifold.VectorBundle.Tensoriality
46214623
public import Mathlib.Geometry.Manifold.VectorField.LieBracket
@@ -6608,6 +6610,7 @@ public import Mathlib.RingTheory.LocalRing.Length
66086610
public import Mathlib.RingTheory.LocalRing.LocalSubring
66096611
public import Mathlib.RingTheory.LocalRing.MaximalIdeal.Basic
66106612
public import Mathlib.RingTheory.LocalRing.MaximalIdeal.Defs
6613+
public import Mathlib.RingTheory.LocalRing.MaximalIdeal.Square
66116614
public import Mathlib.RingTheory.LocalRing.Module
66126615
public import Mathlib.RingTheory.LocalRing.NonLocalRing
66136616
public import Mathlib.RingTheory.LocalRing.Quotient

Mathlib/Algebra/EuclideanDomain/Defs.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ class EuclideanDomain (R : Type u) extends CommRing R, Nontrivial R where
9393
/-- An additional constraint on `r`. -/
9494
mul_left_not_lt : ∀ (a) {b}, b ≠ 0 → ¬r (a * b) a
9595

96+
/-
97+
Lean has far more theorems about fields than about Euclidean domains. We thus
98+
lower the priority of `Euclideandomain.toCommRing`, encouraging typeclass inference
99+
to try `Field.toCommRing` first. Without this priority-lowering, typeclass inference
100+
finds the more inefficient path `Field.toEuclideanDomain.toCommRing` by default. This
101+
priority change saves over 500G instructions across mathlib. See
102+
https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/We.20need.20to.20talk.20about.20Euclidean.20Domains/near/594655420
103+
-/
104+
-- see Note [lower instance priority]
105+
attribute [instance 100] EuclideanDomain.toCommRing
106+
96107
namespace EuclideanDomain
97108

98109
variable {R : Type u} [EuclideanDomain R]

Mathlib/Algebra/Exact.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ lemma exact_zero_iff_surjective {M N : Type*} (P : Type*)
289289
[AddCommGroup M] [AddCommGroup N] [AddCommMonoid P] [Module R N] [Module R M]
290290
[Module R P] (f : M →ₗ[R] N) :
291291
Function.Exact f (0 : N →ₗ[R] P) ↔ Function.Surjective f := by
292-
simp [range_eq_top, exact_iff, eq_comm]
292+
simp [range_eq_top, exact_iff, eqComm]
293293

294294
end LinearMap
295295

Mathlib/Algebra/Group/End.lean

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public import Mathlib.Algebra.Group.Units.Equiv
1212
public import Mathlib.Data.Set.Basic
1313
public import Mathlib.Tactic.Common
1414

15+
public import Mathlib.Tactic.Attr.Register
16+
1517
/-!
1618
# Monoids of endomorphisms, groups of automorphisms
1719
@@ -104,12 +106,15 @@ theorem mul_apply (f g : Perm α) (x) : (f * g) x = f (g x) :=
104106
theorem one_apply (x) : (1 : Perm α) x = x :=
105107
rfl
106108

109+
@[pull_end, push_end← ]
107110
theorem one_def : (1 : Perm α) = Equiv.refl α :=
108111
rfl
109112

113+
@[pull_end, push_end← ]
110114
theorem mul_def (f g : Perm α) : f * g = g.trans f :=
111115
rfl
112116

117+
@[pull_end, push_end← ]
113118
theorem inv_def (f : Perm α) : f⁻¹ = f.symm :=
114119
rfl
115120

@@ -121,7 +126,8 @@ theorem inv_def (f : Perm α) : f⁻¹ = f.symm :=
121126

122127
@[norm_cast] lemma coe_pow (f : Perm α) (n : ℕ) : ⇑(f ^ n) = f^[n] := rfl
123128

124-
@[simp] lemma iterate_eq_pow (f : Perm α) (n : ℕ) : f^[n] = ⇑(f ^ n) := rfl
129+
@[pull_end← , push_end]
130+
lemma iterate_eq_pow (f : Perm α) (n : ℕ) : f^[n] = ⇑(f ^ n) := rfl
125131

126132
theorem eq_inv_iff_eq {f : Perm α} {x y : α} : x = f⁻¹ y ↔ f x = y :=
127133
f.eq_symm_apply
@@ -138,44 +144,43 @@ theorem zpow_apply_comm {α : Type*} (σ : Perm α) (m n : ℤ) {x : α} :
138144
The assumption made here is that if you're using the group structure, you want to preserve it after
139145
simp. -/
140146

141-
142-
@[simp]
147+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
143148
theorem trans_one {α : Sort*} {β : Type*} (e : α ≃ β) : e.trans (1 : Perm β) = e :=
144149
Equiv.trans_refl e
145150

146-
@[simp]
151+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
147152
theorem mul_refl (e : Perm α) : e * Equiv.refl α = e :=
148153
Equiv.trans_refl e
149154

150-
@[simp]
155+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
151156
theorem one_symm : (1 : Perm α).symm = 1 :=
152157
rfl
153158

154-
@[simp]
159+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
155160
theorem refl_inv : (Equiv.refl α : Perm α)⁻¹ = 1 :=
156161
rfl
157162

158-
@[simp]
163+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
159164
theorem one_trans {α : Type*} {β : Sort*} (e : α ≃ β) : (1 : Perm α).trans e = e :=
160165
rfl
161166

162-
@[simp]
167+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
163168
theorem refl_mul (e : Perm α) : Equiv.refl α * e = e :=
164169
rfl
165170

166-
@[simp]
171+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
167172
theorem inv_trans_self (e : Perm α) : e⁻¹.trans e = 1 :=
168173
Equiv.symm_trans_self e
169174

170-
@[simp]
175+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
171176
theorem mul_symm (e : Perm α) : e * e.symm = 1 :=
172177
Equiv.symm_trans_self e
173178

174-
@[simp]
179+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
175180
theorem self_trans_inv (e : Perm α) : e.trans e⁻¹ = 1 :=
176181
Equiv.self_trans_symm e
177182

178-
@[simp]
183+
@[deprecated "use `pull_end` simpset instead" (since := "2026-05-13")]
179184
theorem symm_mul (e : Perm α) : e.symm * e = 1 :=
180185
Equiv.self_trans_symm e
181186

Mathlib/Algebra/Group/Pi/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ theorem Pi.update_eq_div_mul_mulSingle [∀ i, Group <| f i] (g : ∀ i : I, f i
300300
ext j
301301
rcases eq_or_ne i j with (rfl | h)
302302
· simp
303-
· simp [Function.update_of_ne h.symm, h]
303+
· simp [h, eqComm]
304304

305305
@[to_additive]
306306
theorem Pi.mulSingle_mul_mulSingle_eq_mulSingle_mul_mulSingle {M : Type*} [CommMonoid M]

Mathlib/Algebra/GroupWithZero/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ theorem mul_eq_zero : a * b = 0 ↔ a = 0 ∨ b = 0 :=
308308
/-- If `α` has no zero divisors, then the product of two elements equals zero iff one of them
309309
equals zero. -/
310310
@[simp]
311-
theorem zero_eq_mul : 0 = a * b ↔ a = 0 ∨ b = 0 := by rw [eq_comm, mul_eq_zero]
311+
theorem zero_eq_mul : 0 = a * b ↔ a = 0 ∨ b = 0 := by simp [eqComm]
312312

313313
/-- If `α` has no zero divisors, then the product of two elements is nonzero iff both of them
314314
are nonzero. -/

Mathlib/Algebra/Module/Submodule/LinearMap.lean

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,33 +206,31 @@ theorem comp_codLift :
206206
end
207207

208208
/-- Restrict domain and codomain of a linear map. -/
209-
def restrict (f : M →ₗ[R] M) {p : Submodule R M} {q : Submodule R M₁} (hf : ∀ x ∈ p, f x ∈ q) :
210-
p →ₗ[R] q :=
209+
def restrict (f : M →ₛₗ[σ₁₂] M) {p : Submodule R M} {q : Submodule R₂ M₂} (hf : ∀ x ∈ p, f x ∈ q) :
210+
p →ₛₗ[σ₁₂] q :=
211211
(f.domRestrict p).codRestrict q <| SetLike.forall.2 hf
212212

213213
@[simp]
214-
theorem restrict_coe_apply (f : M →ₗ[R] M) {p : Submodule R M} {q : Submodule R M₁}
214+
theorem restrict_coe_apply (f : M →ₛₗ[σ₁₂] M) {p : Submodule R M} {q : Submodule R₂ M₂}
215215
(hf : ∀ x ∈ p, f x ∈ q) (x : p) : ↑(f.restrict hf x) = f x :=
216216
rfl
217217

218-
theorem restrict_apply {f : M →ₗ[R] M} {p : Submodule R M} {q : Submodule R M₁}
218+
theorem restrict_apply {f : M →ₛₗ[σ₁₂] M} {p : Submodule R M} {q : Submodule R₂ M₂}
219219
(hf : ∀ x ∈ p, f x ∈ q) (x : p) : f.restrict hf x = ⟨f x, hf x.1 x.2⟩ :=
220220
rfl
221221

222-
lemma restrict_sub {R M M : Type*}
223-
[Ring R] [AddCommGroup M] [AddCommGroup M₁] [Module R M] [Module R M₁]
224-
{p : Submodule R M} {q : Submodule R M₁} {f g : M →ₗ[R] M}
222+
lemma restrict_sub {R R₂ M M : Type*}
223+
[Ring R] [Ring R₂] {σ₁₂ : R →+* R₂} [AddCommGroup M] [AddCommGroup M₂]
224+
[Module R M] [Module R₂ M₂] {p : Submodule R M} {q : Submodule R₂ M₂} {f g : M →ₛₗ[σ₁₂] M}
225225
(hf : MapsTo f p q) (hg : MapsTo g p q)
226226
(hfg : MapsTo (f - g) p q := fun _ hx ↦ q.sub_mem (hf hx) (hg hx)) :
227227
f.restrict hf - g.restrict hg = (f - g).restrict hfg := by
228228
ext; simp
229229

230-
lemma restrict_comp
231-
{M₂ M₃ : Type*} [AddCommMonoid M₂] [AddCommMonoid M₃] [Module R M₂] [Module R M₃]
232-
{p : Submodule R M} {p₂ : Submodule R M₂} {p₃ : Submodule R M₃}
233-
{f : M →ₗ[R] M₂} {g : M₂ →ₗ[R] M₃}
234-
(hf : MapsTo f p p₂) (hg : MapsTo g p₂ p₃) (hfg : MapsTo (g ∘ₗ f) p p₃ := hg.comp hf) :
235-
(g ∘ₗ f).restrict hfg = (g.restrict hg) ∘ₗ (f.restrict hf) :=
230+
lemma restrict_comp {p : Submodule R M} {p₂ : Submodule R₂ M₂} {p₃ : Submodule R₃ M₃}
231+
{f : M →ₛₗ[σ₁₂] M₂} {g : M₂ →ₛₗ[σ₂₃] M₃}
232+
(hf : MapsTo f p p₂) (hg : MapsTo g p₂ p₃) (hfg : MapsTo (g ∘ₛₗ f) p p₃ := hg.comp hf) :
233+
(g ∘ₛₗ f).restrict hfg = (g.restrict hg) ∘ₛₗ (f.restrict hf) :=
236234
rfl
237235

238236
-- TODO Consider defining `Algebra R (p.compatibleMaps p)`, `AlgHom` version of `LinearMap.restrict`
@@ -248,17 +246,17 @@ lemma restrict_commute {f g : M →ₗ[R] M} (h : Commute f g) {p : Submodule R
248246
change (f ∘ₗ g).restrict (hf.comp hg) = (g ∘ₗ f).restrict (hg.comp hf)
249247
congr 1
250248

251-
theorem subtype_comp_restrict {f : M →ₗ[R] M} {p : Submodule R M} {q : Submodule R M₁}
249+
theorem subtype_comp_restrict {f : M →ₛₗ[σ₁₂] M} {p : Submodule R M} {q : Submodule R₂ M₂}
252250
(hf : ∀ x ∈ p, f x ∈ q) : q.subtype.comp (f.restrict hf) = f.domRestrict p :=
253251
rfl
254252

255-
theorem restrict_eq_codRestrict_domRestrict {f : M →ₗ[R] M} {p : Submodule R M}
256-
{q : Submodule R M₁} (hf : ∀ x ∈ p, f x ∈ q) :
253+
theorem restrict_eq_codRestrict_domRestrict {f : M →ₛₗ[σ₁₂] M} {p : Submodule R M}
254+
{q : Submodule R₂ M₂} (hf : ∀ x ∈ p, f x ∈ q) :
257255
f.restrict hf = (f.domRestrict p).codRestrict q fun x => hf x.1 x.2 :=
258256
rfl
259257

260-
theorem restrict_eq_domRestrict_codRestrict {f : M →ₗ[R] M} {p : Submodule R M}
261-
{q : Submodule R M₁} (hf : ∀ x, f x ∈ q) :
258+
theorem restrict_eq_domRestrict_codRestrict {f : M →ₛₗ[σ₁₂] M} {p : Submodule R M}
259+
{q : Submodule R₂ M₂} (hf : ∀ x, f x ∈ q) :
262260
(f.restrict fun x _ => hf x) = (f.codRestrict q hf).domRestrict p :=
263261
rfl
264262

Mathlib/Algebra/MvPolynomial/Nilpotent.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ theorem isUnit_iff : IsUnit P ↔ IsUnit (P.coeff 0) ∧ ∀ i ≠ 0, IsNilpoten
7272
simpa using this.isUnit_add_right_of_commute (h₁.map C) (.all _ _)
7373

7474
instance : IsLocalHom (C : _ →+* MvPolynomial σ R) where
75-
map_nonunit := by classical simp +contextual [isUnit_iff, coeff_C, apply_ite]
75+
map_nonunit := by classical simp +contextual [isUnit_iff, coeff_C]
7676

7777
instance : IsLocalHom (algebraMap R (MvPolynomial σ R)) :=
7878
inferInstanceAs (IsLocalHom C)

0 commit comments

Comments
 (0)