Skip to content

Commit 4ea4a86

Browse files
committed
chore: Rename mul-div cancellation lemmas (#11530)
Lemma names around cancellation of multiplication and division are a mess. This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the `GroupWithZero` lemma name, the `Group` lemma, the `AddGroup` lemma name). | Statement | New name | Old name | |
1 parent cde19d4 commit 4ea4a86

File tree

301 files changed

+729
-680
lines changed

Some content is hidden

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

301 files changed

+729
-680
lines changed

Counterexamples/CanonicallyOrderedCommSemiringTwoMul.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ theorem exists_add_of_le : ∀ a b : L, a ≤ b → ∃ c, b = a + c := by
199199
· exact ⟨0, (add_zero _).symm⟩
200200
· exact
201201
⟨⟨b - a.1, fun H => (tsub_pos_of_lt h).ne' (Prod.mk.inj_iff.1 H).1⟩,
202-
Subtype.ext <| Prod.ext (add_tsub_cancel_of_le h.le).symm (add_sub_cancel'_right _ _).symm⟩
202+
Subtype.ext <| Prod.ext (add_tsub_cancel_of_le h.le).symm (add_sub_cancel _ _).symm⟩
203203
#align counterexample.ex_L.exists_add_of_le Counterexample.ExL.exists_add_of_le
204204

205205
theorem le_self_add : ∀ a b : L, a ≤ a + b := by

Counterexamples/HomogeneousPrimeNotPrime.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ theorem grading.left_inv : Function.LeftInverse (coeLinearMap (grading R)) gradi
134134
cases' zz with a b
135135
unfold grading.decompose
136136
simp only [AddMonoidHom.coe_mk, ZeroHom.coe_mk, map_add, coeLinearMap_of, Prod.mk_add_mk,
137-
add_zero, add_sub_cancel'_right]
137+
add_zero, add_sub_cancel]
138138
#align counterexample.counterexample_not_prime_but_homogeneous_prime.grading.left_inv Counterexample.CounterexampleNotPrimeButHomogeneousPrime.grading.left_inv
139139

140140
instance : GradedAlgebra (grading R) where

Mathlib/Algebra/AddConstMap/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ theorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMap
157157
@[simp]
158158
theorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]
159159
(f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by
160-
conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel]
160+
conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]
161161

162162
@[simp]
163163
theorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]

Mathlib/Algebra/AddTorsor.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G
6464
where
6565
vsub := Sub.sub
6666
vsub_vadd' := sub_add_cancel
67-
vadd_vsub' := add_sub_cancel
67+
vadd_vsub' := add_sub_cancel_right
6868
#align add_group_is_add_torsor addGroupIsAddTorsor
6969

7070
/-- Simplify subtraction for a torsor for an `AddGroup G` over
@@ -253,7 +253,7 @@ theorem vsub_sub_vsub_cancel_left (p₁ p₂ p₃ : P) : p₃ -ᵥ p₂ - (p₃
253253

254254
@[simp]
255255
theorem vadd_vsub_vadd_cancel_left (v : G) (p₁ p₂ : P) : v +ᵥ p₁ -ᵥ (v +ᵥ p₂) = p₁ -ᵥ p₂ := by
256-
rw [vsub_vadd_eq_vsub_sub, vadd_vsub_assoc, add_sub_cancel']
256+
rw [vsub_vadd_eq_vsub_sub, vadd_vsub_assoc, add_sub_cancel_left]
257257
#align vadd_vsub_vadd_cancel_left vadd_vsub_vadd_cancel_left
258258

259259
theorem vsub_vadd_comm (p₁ p₂ p₃ : P) : (p₁ -ᵥ p₂ : G) +ᵥ p₃ = p₃ -ᵥ p₂ +ᵥ p₁ := by

Mathlib/Algebra/BigOperators/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ theorem prod_range_div' {M : Type*} [CommGroup M] (f : ℕ → M) (n : ℕ) :
16321632

16331633
@[to_additive]
16341634
theorem eq_prod_range_div {M : Type*} [CommGroup M] (f : ℕ → M) (n : ℕ) :
1635-
f n = f 0 * ∏ i in range n, f (i + 1) / f i := by rw [prod_range_div, mul_div_cancel'_right]
1635+
f n = f 0 * ∏ i in range n, f (i + 1) / f i := by rw [prod_range_div, mul_div_cancel]
16361636
#align finset.eq_prod_range_div Finset.eq_prod_range_div
16371637
#align finset.eq_sum_range_sub Finset.eq_sum_range_sub
16381638

Mathlib/Algebra/CharZero/Lemmas.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ section
168168

169169
variable {R : Type*} [DivisionRing R] [CharZero R]
170170

171-
@[simp]
172-
theorem half_add_self (a : R) : (a + a) / 2 = a := by rw [← mul_two, mul_div_cancel a two_ne_zero]
171+
@[simp] lemma half_add_self (a : R) : (a + a) / 2 = a := by
172+
rw [← mul_two, mul_div_cancel_right₀ a two_ne_zero]
173173
#align half_add_self half_add_self
174174

175175
@[simp]

Mathlib/Algebra/ContinuedFractions/Computation/CorrectnessTerminating.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ theorem compExactValue_correctness_of_stream_eq_some :
195195
-- because `field_simp` is not as powerful
196196
have hA : (↑⌊1 / ifp_n.fr⌋ * pA + ppA) + pA * f = pA * (1 / ifp_n.fr) + ppA := by
197197
have := congrFun (congrArg HMul.hMul tmp_calc) f
198-
rwa [right_distrib, div_mul_cancel (h := f_ne_zero),
199-
div_mul_cancel (h := f_ne_zero)] at this
198+
rwa [right_distrib, div_mul_cancel (h := f_ne_zero),
199+
div_mul_cancel (h := f_ne_zero)] at this
200200
have hB : (↑⌊1 / ifp_n.fr⌋ * pB + ppB) + pB * f = pB * (1 / ifp_n.fr) + ppB := by
201201
have := congrFun (congrArg HMul.hMul tmp_calc') f
202-
rwa [right_distrib, div_mul_cancel (h := f_ne_zero),
203-
div_mul_cancel (h := f_ne_zero)] at this
202+
rwa [right_distrib, div_mul_cancel (h := f_ne_zero),
203+
div_mul_cancel (h := f_ne_zero)] at this
204204
-- now unfold the recurrence one step and simplify both sides to arrive at the conclusion
205205
dsimp only [conts, pconts, ppconts]
206206
field_simp [compExactValue, continuantsAux_recurrence s_nth_eq ppconts_eq pconts_eq,

Mathlib/Algebra/ContinuedFractions/ConvergentsEquiv.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ theorem succ_nth_convergent_eq_squashGCF_nth_convergent [Field K]
278278
calc
279279
(b * g.h + a) / b = b * g.h / b + a / b := by ring
280280
-- requires `Field`, not `DivisionRing`
281-
_ = g.h + a / b := by rw [mul_div_cancel_left _ b_ne_zero]
281+
_ = g.h + a / b := by rw [mul_div_cancel_left _ b_ne_zero]
282282
| succ n' =>
283283
obtain ⟨⟨pa, pb⟩, s_n'th_eq⟩ : ∃ gp_n', g.s.get? n' = some gp_n' :=
284284
g.s.ge_stable n'.le_succ s_nth_eq
@@ -323,7 +323,7 @@ theorem succ_nth_convergent_eq_squashGCF_nth_convergent [Field K]
323323
(continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
324324
(continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]
325325
symm
326-
simpa only [eq1, eq2, eq3, eq4, mul_div_cancel _ b_ne_zero]
326+
simpa only [eq1, eq2, eq3, eq4, mul_div_cancel_right₀ _ b_ne_zero]
327327
field_simp
328328
congr 1 <;> ring
329329
#align generalized_continued_fraction.succ_nth_convergent_eq_squash_gcf_nth_convergent GeneralizedContinuedFraction.succ_nth_convergent_eq_squashGCF_nth_convergent

Mathlib/Algebra/EuclideanDomain/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ theorem div_add_mod' (m k : R) : m / k * k + m % k = m := by
140140

141141
theorem mod_eq_sub_mul_div {R : Type*} [EuclideanDomain R] (a b : R) : a % b = a - b * (a / b) :=
142142
calc
143-
a % b = b * (a / b) + a % b - b * (a / b) := (add_sub_cancel' _ _).symm
143+
a % b = b * (a / b) + a % b - b * (a / b) := (add_sub_cancel_left _ _).symm
144144
_ = a - b * (a / b) := by rw [div_add_mod]
145145
#align euclidean_domain.mod_eq_sub_mul_div EuclideanDomain.mod_eq_sub_mul_div
146146

Mathlib/Algebra/EuclideanDomain/Instances.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ instance (priority := 100) Field.toEuclideanDomain {K : Type*} [Field K] : Eucli
3737
{ toCommRing := Field.toCommRing
3838
quotient := (· / ·), remainder := fun a b => a - a * b / b, quotient_zero := div_zero,
3939
quotient_mul_add_remainder_eq := fun a b => by
40-
by_cases h : b = 0 <;> simp [h, mul_div_cancel']
40+
by_cases h : b = 0 <;> simp [h, mul_div_cancel]
4141
r := fun a b => a = 0 ∧ b ≠ 0,
4242
r_wellFounded :=
4343
WellFounded.intro fun a =>

0 commit comments

Comments
 (0)