Skip to content

Commit 6437a62

Browse files
kim-emjcommelinleanprover-community-mathlib4-botJovanGerb
committed
chore: update batteries dependency (including fixes for batteries#1220) (#25478)
Co-authored-by: Johan Commelin <[email protected]> Co-authored-by: leanprover-community-mathlib4-bot <[email protected]> Co-authored-by: Jovan Gerbscheid <[email protected]>
1 parent e50af85 commit 6437a62

File tree

23 files changed

+67
-48
lines changed

23 files changed

+67
-48
lines changed

Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ theorem prod_pair [DecidableEq ι] {a b : ι} (h : a ≠ b) :
7272

7373
@[to_additive (attr := simp)]
7474
theorem prod_image [DecidableEq ι] {s : Finset κ} {g : κ → ι} :
75-
(∀ x ∈ s, ∀ y ∈ s, g x = g y → x = y) → ∏ x ∈ s.image g, f x = ∏ x ∈ s, f (g x) :=
75+
Set.InjOn g s → ∏ x ∈ s.image g, f x = ∏ x ∈ s, f (g x) :=
7676
fold_image
7777

7878
@[to_additive]

Mathlib/Algebra/BigOperators/Group/Finset/Preimage.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ lemma prod_preimage' (f : ι → κ) [DecidablePred (· ∈ Set.range f)] (s : F
2626
classical
2727
calc
2828
∏ x ∈ preimage s f hf, g (f x) = ∏ x ∈ image f (preimage s f hf), g x :=
29-
Eq.symm <| prod_image <| by simpa only [mem_preimage, Set.InjOn] using hf
29+
Eq.symm <| prod_image <| by simpa [mem_preimage, Set.InjOn] using hf
3030
_ = ∏ x ∈ s with x ∈ Set.range f, g x := by rw [image_preimage]
3131

3232
@[to_additive]

Mathlib/Algebra/BigOperators/Intervals.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ theorem prod_Ico_reflect (f : ℕ → M) (k : ℕ) {m n : ℕ} (h : m ≤ n + 1)
147147
rcases lt_or_le k m with hkm | hkm
148148
· rw [← Nat.Ico_image_const_sub_eq_Ico (this _ hkm)]
149149
refine (prod_image ?_).symm
150-
simp only [mem_Ico]
150+
simp only [mem_Ico, Set.InjOn, mem_coe]
151151
rintro i ⟨_, im⟩ j ⟨_, jm⟩ Hij
152152
rw [← tsub_tsub_cancel_of_le (this _ im), Hij, tsub_tsub_cancel_of_le (this _ jm)]
153153
· have : n + 1 - k ≤ n + 1 - m := by

Mathlib/Algebra/Group/Submonoid/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ theorem disjoint_def' {p₁ p₂ : Submonoid M} :
302302

303303
variable {t : Set M}
304304

305-
@[to_additive (attr := simp)]
305+
@[to_additive] -- this must not be a simp-lemma as the conclusion applies to `hts`, causing loops
306306
lemma closure_sdiff_eq_closure (hts : t ⊆ closure (s \ t)) : closure (s \ t) = closure s := by
307307
refine (closure_mono Set.diff_subset).antisymm <| closure_le.mpr <| fun x hxs ↦ ?_
308308
by_cases hxt : x ∈ t

Mathlib/Algebra/GroupWithZero/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ theorem GroupWithZero.mul_left_injective (h : x ≠ 0) :
262262
Function.Injective fun y => y * x := fun y y' w => by
263263
simpa only [mul_assoc, mul_inv_cancel₀ h, mul_one] using congr_arg (fun y => y * x⁻¹) w
264264

265-
@[simp]
265+
@[simp high] -- should take priority over `IsUnit.mul_inv_cancel_right`
266266
theorem inv_mul_cancel_right₀ (h : b ≠ 0) (a : G₀) : a * b⁻¹ * b = a :=
267267
calc
268268
a * b⁻¹ * b = a * (b⁻¹ * b) := mul_assoc _ _ _
269269
_ = a := by simp [h]
270270

271271

272-
@[simp]
272+
@[simp high] -- should take priority over `IsUnit.mul_inv_cancel_left`
273273
theorem inv_mul_cancel_left₀ (h : a ≠ 0) (b : G₀) : a⁻¹ * (a * b) = b :=
274274
calc
275275
a⁻¹ * (a * b) = a⁻¹ * a * b := (mul_assoc _ _ _).symm

Mathlib/Algebra/GroupWithZero/Defs.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ variable [GroupWithZero G₀] {a : G₀}
205205

206206
@[simp] lemma inv_zero : (0 : G₀)⁻¹ = 0 := GroupWithZero.inv_zero
207207

208-
@[simp]
208+
@[simp high] -- should take priority over `IsUnit.mul_inv_cancel`
209209
lemma mul_inv_cancel₀ (h : a ≠ 0) : a * a⁻¹ = 1 := GroupWithZero.mul_inv_cancel a h
210210

211211
-- See note [lower instance priority]
@@ -232,13 +232,13 @@ section GroupWithZero
232232

233233
variable [GroupWithZero G₀] {a b : G₀}
234234

235-
@[simp]
235+
@[simp high] -- should take priority over `IsUnit.mul_inv_cancel_right`
236236
theorem mul_inv_cancel_right₀ (h : b ≠ 0) (a : G₀) : a * b * b⁻¹ = a :=
237237
calc
238238
a * b * b⁻¹ = a * (b * b⁻¹) := mul_assoc _ _ _
239239
_ = a := by simp [h]
240240

241-
@[simp]
241+
@[simp high] -- should take priority over `IsUnit.mul_inv_cancel_left`
242242
theorem mul_inv_cancel_left₀ (h : a ≠ 0) (b : G₀) : a * (a⁻¹ * b) = b :=
243243
calc
244244
a * (a⁻¹ * b) = a * a⁻¹ * b := (mul_assoc _ _ _).symm

Mathlib/Algebra/GroupWithZero/NeZero.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ theorem inv_ne_zero (h : a ≠ 0) : a⁻¹ ≠ 0 := fun a_eq_0 => by
4848
have := mul_inv_cancel₀ h
4949
simp only [a_eq_0, mul_zero, zero_ne_one] at this
5050

51-
@[simp]
51+
@[simp high] -- should take priority over `IsUnit.inv_mul_cancel`
5252
theorem inv_mul_cancel₀ (h : a ≠ 0) : a⁻¹ * a = 1 :=
5353
calc
5454
a⁻¹ * a = a⁻¹ * a * a⁻¹ * a⁻¹⁻¹ := by simp [inv_ne_zero h]

Mathlib/Algebra/Homology/DifferentialObject.lean

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ abbrev objEqToHom {i j : β} (h : i = j) :
4141
theorem objEqToHom_refl (i : β) : X.objEqToHom (refl i) = 𝟙 _ :=
4242
rfl
4343

44-
@[reassoc (attr := simp)]
44+
-- Removing `@[simp]`, because it is in the opposite direction of `eqToHom_naturality`.
45+
-- Having both causes an infinite loop in the simpNF linter.
46+
@[reassoc]
4547
theorem objEqToHom_d {x y : β} (h : x = y) :
4648
X.objEqToHom h ≫ X.d y = X.d x ≫ X.objEqToHom (by cases h; rfl) := by cases h; simp
4749

4850
@[reassoc (attr := simp)]
4951
theorem d_squared_apply {x : β} : X.d x ≫ X.d _ = 0 := congr_fun X.d_squared _
5052

51-
@[reassoc (attr := simp)]
53+
-- Removing `@[simp]`, because it is in the opposite direction of `eqToHom_naturality`.
54+
-- Having both causes an infinite loop in the simpNF linter.
55+
@[reassoc]
5256
theorem eqToHom_f' {X Y : DifferentialObject ℤ (GradedObjectWithShift b V)} (f : X ⟶ Y) {x y : β}
5357
(h : x = y) : X.objEqToHom h ≫ f.f y = f.f x ≫ Y.objEqToHom h := by cases h; simp
5458

@@ -79,7 +83,7 @@ def dgoToHomologicalComplex :
7983
shape := fun i j w => by dsimp at w; convert dif_neg w
8084
d_comp_d' := fun i j k hij hjk => by
8185
dsimp at hij hjk; substs hij hjk
82-
simp }
86+
simp [objEqToHom_d_assoc] }
8387
map {X Y} f :=
8488
{ f := f.f
8589
comm' := fun i j h => by

Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Formula.lean

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,15 @@ lemma slope_of_Y_eq {x₁ x₂ y₁ y₂ : F} (hx : x₁ = x₂) (hy : y₁ = W.
177177
rw [slope, if_pos hx, if_pos hy]
178178

179179
@[simp]
180+
lemma slope_of_Y_ne' {x₂ y₁ y₂ : F} (hy : ¬y₁ = -y₂ - W.a₁ * x₂ - W.a₃) :
181+
W.slope x₂ x₂ y₁ y₂ =
182+
(3 * x₂ ^ 2 + 2 * W.a₂ * x₂ + W.a₄ - W.a₁ * y₁) / (y₁ - (-y₁ - W.a₁ * x₂ - W.a₃)) := by
183+
simp [slope, hy]
184+
180185
lemma slope_of_Y_ne {x₁ x₂ y₁ y₂ : F} (hx : x₁ = x₂) (hy : y₁ ≠ W.negY x₂ y₂) :
181186
W.slope x₁ x₂ y₁ y₂ =
182187
(3 * x₁ ^ 2 + 2 * W.a₂ * x₁ + W.a₄ - W.a₁ * y₁) / (y₁ - W.negY x₁ y₁) := by
183-
rw [slope, if_pos hx, if_neg hy]
188+
simp_all
184189

185190
@[simp]
186191
lemma slope_of_X_ne {x₁ x₂ y₁ y₂ : F} (hx : x₁ ≠ x₂) :

Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ lemma add_of_Y_eq {x₁ x₂ y₁ y₂ : F} {h₁ : W.Nonsingular x₁ y₁} {h
544544
(hx : x₁ = x₂) (hy : y₁ = W.negY x₂ y₂) : some h₁ + some h₂ = 0 := by
545545
simpa only [add_def, add] using dif_pos ⟨hx, hy⟩
546546

547-
@[simp]
547+
-- Removing `@[simp]`, because `hy` causes a maximum recursion depth error in the simpNF linter.
548548
lemma add_self_of_Y_eq {x₁ y₁ : F} {h₁ : W.Nonsingular x₁ y₁} (hy : y₁ = W.negY x₁ y₁) :
549549
some h₁ + some h₁ = 0 :=
550550
add_of_Y_eq rfl hy

0 commit comments

Comments
 (0)