algebra.group.defsMathlib.Algebra.Group.Defs

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

refactor(*): move all mk_simp_attribute commands to 1 file (#19223)
Diff
@@ -87,10 +87,6 @@ variables {G : Type*}
    to the additive one.
 -/
 
-mk_simp_attribute field_simps "The simpset `field_simps` is used by the tactic `field_simp` to
-reduce an expression in a field to an expression of the form `n / d` where `n` and `d` are
-division-free."
-
 section has_mul
 variables [has_mul G]
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

refactor(algebra/group/defs): use is_left_cancel_mul etc (#17884)

The Lean 4 version is here: leanprover-community/mathlib4#945.

Diff
@@ -133,6 +133,57 @@ class is_cancel_add (G : Type u) [has_add G]
 
 attribute [to_additive] is_cancel_mul
 
+section is_left_cancel_mul
+variables [is_left_cancel_mul G] {a b c : G}
+
+@[to_additive]
+lemma mul_left_cancel : a * b = a * c → b = c :=
+is_left_cancel_mul.mul_left_cancel a b c
+
+@[to_additive]
+lemma mul_left_cancel_iff : a * b = a * c ↔ b = c :=
+⟨mul_left_cancel, congr_arg _⟩
+
+@[to_additive]
+theorem mul_right_injective (a : G) : function.injective ((*) a) :=
+λ b c, mul_left_cancel
+
+@[simp, to_additive]
+theorem mul_right_inj (a : G) {b c : G} : a * b = a * c ↔ b = c :=
+(mul_right_injective a).eq_iff
+
+@[to_additive]
+theorem mul_ne_mul_right (a : G) {b c : G} : a * b ≠ a * c ↔ b ≠ c :=
+(mul_right_injective a).ne_iff
+
+end is_left_cancel_mul
+
+section is_right_cancel_mul
+
+variables [is_right_cancel_mul G] {a b c : G}
+
+@[to_additive]
+lemma mul_right_cancel : a * b = c * b → a = c :=
+is_right_cancel_mul.mul_right_cancel a b c
+
+@[to_additive]
+lemma mul_right_cancel_iff : b * a = c * a ↔ b = c :=
+⟨mul_right_cancel, congr_arg _⟩
+
+@[to_additive]
+theorem mul_left_injective (a : G) : function.injective (λ x, x * a) :=
+λ b c, mul_right_cancel
+
+@[simp, to_additive]
+theorem mul_left_inj (a : G) {b c : G} : b * a = c * a ↔ b = c :=
+(mul_left_injective a).eq_iff
+
+@[to_additive]
+theorem mul_ne_mul_left (a : G) {b c : G} : b * a ≠ c * a ↔ b ≠ c :=
+(mul_left_injective a).ne_iff
+
+end is_right_cancel_mul
+
 end has_mul
 
 /-- A semigroup is a type with an associative `(*)`. -/
@@ -185,11 +236,7 @@ instance comm_semigroup.to_is_commutative : is_commutative G (*) :=
 `is_right_cancel_add G`."]
 lemma comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul (G : Type u) [comm_semigroup G]
   [is_right_cancel_mul G] : is_left_cancel_mul G :=
-{ mul_left_cancel := λ a b c h,
-  begin
-    rw [mul_comm a b, mul_comm a c] at h,
-    exact is_right_cancel_mul.mul_right_cancel _ _ _ h
-  end }
+⟨λ a b c h, mul_right_cancel $ (mul_comm _ _).trans (h.trans $ mul_comm _ _)⟩
 
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_right_cancel_mul G`. -/
@@ -198,11 +245,7 @@ lemma comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul (G : Type u) [com
 `is_left_cancel_add G`."]
 lemma comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul (G : Type u) [comm_semigroup G]
   [is_left_cancel_mul G] : is_right_cancel_mul G :=
-{ mul_right_cancel := λ a b c h,
-  begin
-    rw [mul_comm a b, mul_comm c b] at h,
-    exact is_left_cancel_mul.mul_left_cancel _ _ _ h
-  end }
+⟨λ a b c h, mul_left_cancel $ (mul_comm _ _).trans (h.trans $ mul_comm _ _)⟩
 
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
@@ -210,12 +253,7 @@ lemma comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul (G : Type u) [com
 that satisfies `is_left_cancel_add G` also satisfies `is_cancel_add G`."]
 lemma comm_semigroup.is_left_cancel_mul.to_is_cancel_mul (G : Type u) [comm_semigroup G]
   [is_left_cancel_mul G] : is_cancel_mul G :=
-{ mul_left_cancel := is_left_cancel_mul.mul_left_cancel,
-  mul_right_cancel := λ a b c h,
-  begin
-    rw [mul_comm a b, mul_comm c b] at h,
-    exact is_left_cancel_mul.mul_left_cancel _ _ _ h
-  end }
+{ .. ‹is_left_cancel_mul G›, .. comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul G }
 
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
@@ -223,12 +261,7 @@ lemma comm_semigroup.is_left_cancel_mul.to_is_cancel_mul (G : Type u) [comm_semi
 that satisfies `is_right_cancel_add G` also satisfies `is_cancel_add G`."]
 lemma comm_semigroup.is_right_cancel_mul.to_is_cancel_mul (G : Type u) [comm_semigroup G]
   [is_right_cancel_mul G] : is_cancel_mul G :=
-{ mul_left_cancel := λ a b c h,
-  begin
-    rw [mul_comm a b, mul_comm a c] at h,
-    exact is_right_cancel_mul.mul_right_cancel _ _ _ h
-  end,
-  mul_right_cancel := is_right_cancel_mul.mul_right_cancel }
+{ .. ‹is_right_cancel_mul G›, .. comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul G }
 
 end comm_semigroup
 
@@ -243,37 +276,12 @@ class add_left_cancel_semigroup (G : Type u) extends add_semigroup G :=
 (add_left_cancel : ∀ a b c : G, a + b = a + c → b = c)
 attribute [to_additive add_left_cancel_semigroup] left_cancel_semigroup
 
-section left_cancel_semigroup
-variables [left_cancel_semigroup G] {a b c : G}
-
-@[to_additive]
-lemma mul_left_cancel : a * b = a * c → b = c :=
-left_cancel_semigroup.mul_left_cancel a b c
-
-@[to_additive]
-lemma mul_left_cancel_iff : a * b = a * c ↔ b = c :=
-⟨mul_left_cancel, congr_arg _⟩
-
-@[to_additive]
-theorem mul_right_injective (a : G) : function.injective ((*) a) :=
-λ b c, mul_left_cancel
-
-@[simp, to_additive]
-theorem mul_right_inj (a : G) {b c : G} : a * b = a * c ↔ b = c :=
-(mul_right_injective a).eq_iff
-
-@[to_additive]
-theorem mul_ne_mul_right (a : G) {b c : G} : a * b ≠ a * c ↔ b ≠ c :=
-(mul_right_injective a).ne_iff
-
 /-- Any `left_cancel_semigroup` satisfies `is_left_cancel_mul`. -/
 @[priority 100, to_additive "Any `add_left_cancel_semigroup` satisfies `is_left_cancel_add`."]
 instance left_cancel_semigroup.to_is_left_cancel_mul (G : Type u) [left_cancel_semigroup G] :
   is_left_cancel_mul G :=
 { mul_left_cancel := left_cancel_semigroup.mul_left_cancel }
 
-end left_cancel_semigroup
-
 /-- A `right_cancel_semigroup` is a semigroup such that `a * b = c * b` implies `a = c`. -/
 @[protect_proj, ancestor semigroup, ext]
 class right_cancel_semigroup (G : Type u) extends semigroup G :=
@@ -286,37 +294,12 @@ class add_right_cancel_semigroup (G : Type u) extends add_semigroup G :=
 (add_right_cancel : ∀ a b c : G, a + b = c + b → a = c)
 attribute [to_additive add_right_cancel_semigroup] right_cancel_semigroup
 
-section right_cancel_semigroup
-variables [right_cancel_semigroup G] {a b c : G}
-
-@[to_additive]
-lemma mul_right_cancel : a * b = c * b → a = c :=
-right_cancel_semigroup.mul_right_cancel a b c
-
-@[to_additive]
-lemma mul_right_cancel_iff : b * a = c * a ↔ b = c :=
-⟨mul_right_cancel, congr_arg _⟩
-
-@[to_additive]
-theorem mul_left_injective (a : G) : function.injective (λ x, x * a) :=
-λ b c, mul_right_cancel
-
-@[simp, to_additive]
-theorem mul_left_inj (a : G) {b c : G} : b * a = c * a ↔ b = c :=
-(mul_left_injective a).eq_iff
-
-@[to_additive]
-theorem mul_ne_mul_left (a : G) {b c : G} : b * a ≠ c * a ↔ b ≠ c :=
-(mul_left_injective a).ne_iff
-
 /-- Any `right_cancel_semigroup` satisfies `is_right_cancel_mul`. -/
 @[priority 100, to_additive "Any `add_right_cancel_semigroup` satisfies `is_right_cancel_add`."]
-instance right_cancel_semigroup.to_is_right_cancel_mul (G : Type u)
-  [right_cancel_semigroup G] : is_right_cancel_mul G :=
+instance right_cancel_semigroup.to_is_right_cancel_mul (G : Type u) [right_cancel_semigroup G] :
+  is_right_cancel_mul G :=
 { mul_right_cancel := right_cancel_semigroup.mul_right_cancel }
 
-end right_cancel_semigroup
-
 /-- Typeclass for expressing that a type `M` with multiplication and a one satisfies
 `1 * a = a` and `a * 1 = a` for all `a : M`. -/
 @[ancestor has_one has_mul]
@@ -362,8 +345,6 @@ instance mul_one_class.to_is_right_id : is_right_id M (*) 1 :=
 
 end mul_one_class
 
-
-
 section
 variables {M : Type u}
 
@@ -580,8 +561,7 @@ class cancel_comm_monoid (M : Type u) extends left_cancel_monoid M, comm_monoid
 @[priority 100, to_additive] -- see Note [lower instance priority]
 instance cancel_comm_monoid.to_cancel_monoid (M : Type u) [cancel_comm_monoid M] :
   cancel_monoid M :=
-{ mul_right_cancel := λ a b c h, mul_left_cancel $ by rw [mul_comm, h, mul_comm],
-  .. ‹cancel_comm_monoid M› }
+{ .. ‹cancel_comm_monoid M›, .. comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul M }
 
 /-- Any `cancel_monoid M` satisfies `is_cancel_mul M`. -/
 @[priority 100, to_additive "Any `add_cancel_monoid M` satisfies `is_cancel_add M`."]

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -697,12 +697,12 @@ theorem pow_zero (a : M) : a ^ 0 = 1 :=
 #align zero_nsmul zero_nsmul
 -/
 
-#print pow_succ /-
-@[to_additive succ_nsmul]
-theorem pow_succ (a : M) (n : ℕ) : a ^ (n + 1) = a * a ^ n :=
+#print pow_succ' /-
+@[to_additive succ_nsmul']
+theorem pow_succ' (a : M) (n : ℕ) : a ^ (n + 1) = a * a ^ n :=
   Monoid.npow_succ n a
-#align pow_succ pow_succ
-#align succ_nsmul succ_nsmul
+#align pow_succ pow_succ'
+#align succ_nsmul succ_nsmul'
 -/
 
 end
@@ -857,7 +857,7 @@ attribute [to_additive] zpowRec
 
 section InvolutiveInv
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:339:40: warning: unsupported option extends_priority -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:340:40: warning: unsupported option extends_priority -/
 -- ensure that we don't go via these typeclasses to find `has_inv` on groups and groups with zero
 set_option extends_priority 50
 
@@ -1019,32 +1019,32 @@ theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
 #align zero_zsmul zero_zsmul
 -/
 
-#print zpow_coe_nat /-
-@[simp, norm_cast, to_additive coe_nat_zsmul]
-theorem zpow_coe_nat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
+#print zpow_natCast /-
+@[simp, norm_cast, to_additive natCast_zsmul]
+theorem zpow_natCast (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 =>
     calc
       a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-      _ = a * a ^ n := (congr_arg ((· * ·) a) (zpow_coe_nat n))
-      _ = a ^ (n + 1) := (pow_succ _ _).symm
-#align zpow_coe_nat zpow_coe_nat
-#align coe_nat_zsmul coe_nat_zsmul
+      _ = a * a ^ n := (congr_arg ((· * ·) a) (zpow_natCast n))
+      _ = a ^ (n + 1) := (pow_succ' _ _).symm
+#align zpow_coe_nat zpow_natCast
+#align coe_nat_zsmul natCast_zsmul
 -/
 
-/- warning: zpow_of_nat clashes with zpow_coe_nat -> zpow_coe_nat
-Case conversion may be inaccurate. Consider using '#align zpow_of_nat zpow_coe_natₓ'. -/
-#print zpow_coe_nat /-
-@[to_additive coe_nat_zsmul]
-theorem zpow_coe_nat (a : G) (n : ℕ) : a ^ Int.ofNat n = a ^ n :=
-  zpow_coe_nat a n
-#align zpow_of_nat zpow_coe_nat
-#align coe_nat_zsmul coe_nat_zsmul
+/- warning: zpow_of_nat clashes with zpow_coe_nat -> zpow_natCast
+Case conversion may be inaccurate. Consider using '#align zpow_of_nat zpow_natCastₓ'. -/
+#print zpow_natCast /-
+@[to_additive natCast_zsmul]
+theorem zpow_natCast (a : G) (n : ℕ) : a ^ Int.ofNat n = a ^ n :=
+  zpow_natCast a n
+#align zpow_of_nat zpow_natCast
+#align coe_nat_zsmul natCast_zsmul
 -/
 
 #print zpow_negSucc /-
 @[simp, to_additive]
-theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_coe_nat];
+theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_natCast];
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 #align zsmul_neg_succ_of_nat negSucc_zsmul
@@ -1070,7 +1070,7 @@ end DivInvMonoid
 
 section InvOneClass
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:339:40: warning: unsupported option extends_priority -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:340:40: warning: unsupported option extends_priority -/
 set_option extends_priority 50
 
 #print NegZeroClass /-
Diff
@@ -1019,32 +1019,32 @@ theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
 #align zero_zsmul zero_zsmul
 -/
 
-#print zpow_ofNat /-
+#print zpow_coe_nat /-
 @[simp, norm_cast, to_additive coe_nat_zsmul]
-theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
+theorem zpow_coe_nat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 =>
     calc
       a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-      _ = a * a ^ n := (congr_arg ((· * ·) a) (zpow_ofNat n))
+      _ = a * a ^ n := (congr_arg ((· * ·) a) (zpow_coe_nat n))
       _ = a ^ (n + 1) := (pow_succ _ _).symm
-#align zpow_coe_nat zpow_ofNat
-#align of_nat_zsmul ofNat_zsmul
+#align zpow_coe_nat zpow_coe_nat
+#align coe_nat_zsmul coe_nat_zsmul
 -/
 
-/- warning: zpow_of_nat clashes with zpow_coe_nat -> zpow_ofNat
-Case conversion may be inaccurate. Consider using '#align zpow_of_nat zpow_ofNatₓ'. -/
-#print zpow_ofNat /-
-@[to_additive ofNat_zsmul]
-theorem zpow_ofNat (a : G) (n : ℕ) : a ^ Int.ofNat n = a ^ n :=
-  zpow_ofNat a n
-#align zpow_of_nat zpow_ofNat
-#align of_nat_zsmul ofNat_zsmul
+/- warning: zpow_of_nat clashes with zpow_coe_nat -> zpow_coe_nat
+Case conversion may be inaccurate. Consider using '#align zpow_of_nat zpow_coe_natₓ'. -/
+#print zpow_coe_nat /-
+@[to_additive coe_nat_zsmul]
+theorem zpow_coe_nat (a : G) (n : ℕ) : a ^ Int.ofNat n = a ^ n :=
+  zpow_coe_nat a n
+#align zpow_of_nat zpow_coe_nat
+#align coe_nat_zsmul coe_nat_zsmul
 -/
 
 #print zpow_negSucc /-
 @[simp, to_additive]
-theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_ofNat];
+theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_coe_nat];
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 #align zsmul_neg_succ_of_nat negSucc_zsmul
Diff
@@ -301,7 +301,7 @@ theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
 
 #print Semigroup.to_isAssociative /-
 @[to_additive]
-instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
+instance Semigroup.to_isAssociative : Std.Associative G (· * ·) :=
   ⟨mul_assoc⟩
 #align semigroup.to_is_associative Semigroup.to_isAssociative
 #align add_semigroup.to_is_associative AddSemigroup.to_isAssociative
@@ -341,7 +341,7 @@ theorem mul_comm : ∀ a b : G, a * b = b * a :=
 
 #print CommMagma.to_isCommutative /-
 @[to_additive]
-instance CommMagma.to_isCommutative : IsCommutative G (· * ·) :=
+instance CommMagma.to_isCommutative : Std.Commutative G (· * ·) :=
   ⟨mul_comm⟩
 #align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
 #align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
Diff
@@ -507,16 +507,16 @@ theorem mul_one : ∀ a : M, a * 1 = a :=
 -/
 
 @[to_additive]
-instance MulOneClass.to_isLeftId : IsLeftId M (· * ·) 1 :=
+instance MulOneClass.to_lawfulLeftIdentity : Std.LawfulLeftIdentity M (· * ·) 1 :=
   ⟨MulOneClass.one_hMul⟩
-#align mul_one_class.to_is_left_id MulOneClass.to_isLeftId
-#align add_zero_class.to_is_left_id AddZeroClass.to_isLeftId
+#align mul_one_class.to_is_left_id MulOneClass.to_lawfulLeftIdentityₓ
+#align add_zero_class.to_is_left_id AddZeroClass.to_lawfulLeftIdentityₓ
 
 @[to_additive]
-instance MulOneClass.to_isRightId : IsRightId M (· * ·) 1 :=
+instance MulOneClass.to_lawfulRightIdentity : Std.LawfulRightIdentity M (· * ·) 1 :=
   ⟨MulOneClass.hMul_one⟩
-#align mul_one_class.to_is_right_id MulOneClass.to_isRightId
-#align add_zero_class.to_is_right_id AddZeroClass.to_isRightId
+#align mul_one_class.to_is_right_id MulOneClass.to_lawfulRightIdentityₓ
+#align add_zero_class.to_is_right_id AddZeroClass.to_lawfulRightIdentityₓ
 
 end MulOneClass
 
Diff
@@ -339,60 +339,60 @@ theorem mul_comm : ∀ a b : G, a * b = b * a :=
 #align add_comm add_comm
 -/
 
-#print CommSemigroup.to_isCommutative /-
+#print CommMagma.to_isCommutative /-
 @[to_additive]
-instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
+instance CommMagma.to_isCommutative : IsCommutative G (· * ·) :=
   ⟨mul_comm⟩
-#align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutative
-#align add_comm_semigroup.to_is_commutative AddCommSemigroup.to_isCommutative
+#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
+#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
 -/
 
-#print CommSemigroup.IsRightCancelMul.toIsLeftCancelMul /-
+#print CommMagma.IsRightCancelMul.toIsLeftCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_left_cancel_mul G`. -/
-@[to_additive AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
+@[to_additive AddCommMagma.IsRightCancelAdd.toIsLeftCancelAdd
       "Any\n`add_comm_semigroup G` that satisfies `is_right_cancel_add G` also satisfies\n`is_right_cancel_add G`."]
-theorem CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemigroup G]
+theorem CommMagma.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemigroup G]
     [IsRightCancelMul G] : IsLeftCancelMul G :=
   ⟨fun a b c h => mul_right_cancel <| (mul_comm _ _).trans (h.trans <| mul_comm _ _)⟩
-#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
-#align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
+#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommMagma.IsRightCancelMul.toIsLeftCancelMul
+#align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommMagma.IsRightCancelAdd.toIsLeftCancelAdd
 -/
 
-#print CommSemigroup.IsLeftCancelMul.toIsRightCancelMul /-
+#print CommMagma.IsLeftCancelMul.toIsRightCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_right_cancel_mul G`. -/
-@[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
+@[to_additive AddCommMagma.IsLeftCancelAdd.toIsRightCancelAdd
       "Any\n`add_comm_semigroup G` that satisfies `is_left_cancel_add G` also satisfies\n`is_left_cancel_add G`."]
-theorem CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigroup G]
+theorem CommMagma.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigroup G]
     [IsLeftCancelMul G] : IsRightCancelMul G :=
   ⟨fun a b c h => mul_left_cancel <| (mul_comm _ _).trans (h.trans <| mul_comm _ _)⟩
-#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
-#align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
+#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommMagma.IsLeftCancelMul.toIsRightCancelMul
+#align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommMagma.IsLeftCancelAdd.toIsRightCancelAdd
 -/
 
-#print CommSemigroup.IsLeftCancelMul.toIsCancelMul /-
+#print CommMagma.IsLeftCancelMul.toIsCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
-@[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
+@[to_additive AddCommMagma.IsLeftCancelAdd.toIsCancelAdd
       "Any `add_comm_semigroup G`\nthat satisfies `is_left_cancel_add G` also satisfies `is_cancel_add G`."]
-theorem CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
-    [IsLeftCancelMul G] : IsCancelMul G :=
-  { ‹IsLeftCancelMul G›, CommSemigroup.IsLeftCancelMul.toIsRightCancelMul G with }
-#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
-#align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
+theorem CommMagma.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G] [IsLeftCancelMul G] :
+    IsCancelMul G :=
+  { ‹IsLeftCancelMul G›, CommMagma.IsLeftCancelMul.toIsRightCancelMul G with }
+#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommMagma.IsLeftCancelMul.toIsCancelMul
+#align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommMagma.IsLeftCancelAdd.toIsCancelAdd
 -/
 
-#print CommSemigroup.IsRightCancelMul.toIsCancelMul /-
+#print CommMagma.IsRightCancelMul.toIsCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
-@[to_additive AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
+@[to_additive AddCommMagma.IsRightCancelAdd.toIsCancelAdd
       "Any `add_comm_semigroup G`\nthat satisfies `is_right_cancel_add G` also satisfies `is_cancel_add G`."]
-theorem CommSemigroup.IsRightCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
+theorem CommMagma.IsRightCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
     [IsRightCancelMul G] : IsCancelMul G :=
-  { ‹IsRightCancelMul G›, CommSemigroup.IsRightCancelMul.toIsLeftCancelMul G with }
-#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommSemigroup.IsRightCancelMul.toIsCancelMul
-#align add_comm_semigroup.is_right_cancel_add.to_is_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
+  { ‹IsRightCancelMul G›, CommMagma.IsRightCancelMul.toIsLeftCancelMul G with }
+#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommMagma.IsRightCancelMul.toIsCancelMul
+#align add_comm_semigroup.is_right_cancel_add.to_is_cancel_add AddCommMagma.IsRightCancelAdd.toIsCancelAdd
 -/
 
 end CommSemigroup
@@ -817,7 +817,7 @@ class CancelCommMonoid (M : Type u) extends LeftCancelMonoid M, CommMonoid M
 @[to_additive]
 instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelCommMonoid M] :
     CancelMonoid M :=
-  { ‹CancelCommMonoid M›, CommSemigroup.IsLeftCancelMul.toIsRightCancelMul M with }
+  { ‹CancelCommMonoid M›, CommMagma.IsLeftCancelMul.toIsRightCancelMul M with }
 #align cancel_comm_monoid.to_cancel_monoid CancelCommMonoid.toCancelMonoid
 #align add_cancel_comm_monoid.to_cancel_add_monoid AddCancelCommMonoid.toAddCancelMonoid
 -/
Diff
@@ -662,19 +662,19 @@ class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
 #align add_monoid AddMonoid
 -/
 
-#print Monoid.Pow /-
-instance Monoid.Pow {M : Type _} [Monoid M] : Pow M ℕ :=
+#print Monoid.toNatPow /-
+instance Monoid.toNatPow {M : Type _} [Monoid M] : Pow M ℕ :=
   ⟨fun x n => Monoid.npow n x⟩
-#align monoid.has_pow Monoid.Pow
+#align monoid.has_pow Monoid.toNatPow
 -/
 
-#print AddMonoid.SMul /-
-instance AddMonoid.SMul {M : Type _} [AddMonoid M] : SMul ℕ M :=
+#print AddMonoid.toNatSMul /-
+instance AddMonoid.toNatSMul {M : Type _} [AddMonoid M] : SMul ℕ M :=
   ⟨AddMonoid.nsmul⟩
-#align add_monoid.has_smul_nat AddMonoid.SMul
+#align add_monoid.has_smul_nat AddMonoid.toNatSMul
 -/
 
-attribute [to_additive AddMonoid.SMul] Monoid.Pow
+attribute [to_additive AddMonoid.toNatSMul] Monoid.toNatPow
 
 section
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2014 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 -/
-import Mathbin.Tactic.Basic
-import Mathbin.Logic.Function.Basic
+import Tactic.Basic
+import Logic.Function.Basic
 
 #align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
 
@@ -600,7 +600,7 @@ analysis](https://hal.inria.fr/hal-02463336).
 -/
 
 
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
 /-- `try_refl_tac` solves goals of the form `∀ a b, f a b = g a b`,
 if they hold by definition. -/
 unsafe def try_refl_tac : tactic Unit :=
@@ -857,7 +857,7 @@ attribute [to_additive] zpowRec
 
 section InvolutiveInv
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:334:40: warning: unsupported option extends_priority -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:339:40: warning: unsupported option extends_priority -/
 -- ensure that we don't go via these typeclasses to find `has_inv` on groups and groups with zero
 set_option extends_priority 50
 
@@ -1070,7 +1070,7 @@ end DivInvMonoid
 
 section InvOneClass
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:334:40: warning: unsupported option extends_priority -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:339:40: warning: unsupported option extends_priority -/
 set_option extends_priority 50
 
 #print NegZeroClass /-
Diff
@@ -1063,7 +1063,7 @@ theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
 #align sub_eq_add_neg sub_eq_add_neg
 -/
 
-alias div_eq_mul_inv ← division_def
+alias division_def := div_eq_mul_inv
 #align division_def division_def
 
 end DivInvMonoid
Diff
@@ -129,7 +129,7 @@ def rightMul : G → G → G := fun g : G => fun x : G => x * g
 /-- A mixin for left cancellative multiplication. -/
 @[protect_proj]
 class IsLeftCancelMul (G : Type u) [Mul G] : Prop where
-  mul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
+  hMul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
 #align is_left_cancel_mul IsLeftCancelMul
 -/
 
@@ -137,7 +137,7 @@ class IsLeftCancelMul (G : Type u) [Mul G] : Prop where
 /-- A mixin for right cancellative multiplication. -/
 @[protect_proj]
 class IsRightCancelMul (G : Type u) [Mul G] : Prop where
-  mul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
+  hMul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
 #align is_right_cancel_mul IsRightCancelMul
 -/
 
@@ -183,7 +183,7 @@ variable [IsLeftCancelMul G] {a b c : G}
 #print mul_left_cancel /-
 @[to_additive]
 theorem mul_left_cancel : a * b = a * c → b = c :=
-  IsLeftCancelMul.mul_left_cancel a b c
+  IsLeftCancelMul.hMul_left_cancel a b c
 #align mul_left_cancel mul_left_cancel
 #align add_left_cancel add_left_cancel
 -/
@@ -228,7 +228,7 @@ variable [IsRightCancelMul G] {a b c : G}
 #print mul_right_cancel /-
 @[to_additive]
 theorem mul_right_cancel : a * b = c * b → a = c :=
-  IsRightCancelMul.mul_right_cancel a b c
+  IsRightCancelMul.hMul_right_cancel a b c
 #align mul_right_cancel mul_right_cancel
 #align add_right_cancel add_right_cancel
 -/
@@ -294,7 +294,7 @@ variable [Semigroup G]
 #print mul_assoc /-
 @[no_rsimp, to_additive]
 theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
-  Semigroup.mul_assoc
+  Semigroup.hMul_assoc
 #align mul_assoc mul_assoc
 #align add_assoc add_assoc
 -/
@@ -334,7 +334,7 @@ variable [CommSemigroup G]
 #print mul_comm /-
 @[no_rsimp, to_additive]
 theorem mul_comm : ∀ a b : G, a * b = b * a :=
-  CommSemigroup.mul_comm
+  CommSemigroup.hMul_comm
 #align mul_comm mul_comm
 #align add_comm add_comm
 -/
@@ -401,7 +401,7 @@ end CommSemigroup
 /-- A `left_cancel_semigroup` is a semigroup such that `a * b = a * c` implies `b = c`. -/
 @[protect_proj, ext]
 class LeftCancelSemigroup (G : Type u) extends Semigroup G where
-  mul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
+  hMul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
 #align left_cancel_semigroup LeftCancelSemigroup
 -/
 
@@ -421,7 +421,7 @@ attribute [to_additive AddLeftCancelSemigroup] LeftCancelSemigroup
 @[to_additive "Any `add_left_cancel_semigroup` satisfies `is_left_cancel_add`."]
 instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
     [LeftCancelSemigroup G] : IsLeftCancelMul G
-    where mul_left_cancel := LeftCancelSemigroup.mul_left_cancel
+    where hMul_left_cancel := LeftCancelSemigroup.hMul_left_cancel
 #align left_cancel_semigroup.to_is_left_cancel_mul LeftCancelSemigroup.toIsLeftCancelMul
 #align add_left_cancel_semigroup.to_is_left_cancel_add AddLeftCancelSemigroup.toIsLeftCancelAdd
 -/
@@ -430,7 +430,7 @@ instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
 /-- A `right_cancel_semigroup` is a semigroup such that `a * b = c * b` implies `a = c`. -/
 @[protect_proj, ext]
 class RightCancelSemigroup (G : Type u) extends Semigroup G where
-  mul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
+  hMul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
 #align right_cancel_semigroup RightCancelSemigroup
 -/
 
@@ -450,7 +450,7 @@ attribute [to_additive AddRightCancelSemigroup] RightCancelSemigroup
 @[to_additive "Any `add_right_cancel_semigroup` satisfies `is_right_cancel_add`."]
 instance (priority := 100) RightCancelSemigroup.toIsRightCancelMul (G : Type u)
     [RightCancelSemigroup G] : IsRightCancelMul G
-    where mul_right_cancel := RightCancelSemigroup.mul_right_cancel
+    where hMul_right_cancel := RightCancelSemigroup.hMul_right_cancel
 #align right_cancel_semigroup.to_is_right_cancel_mul RightCancelSemigroup.toIsRightCancelMul
 #align add_right_cancel_semigroup.to_is_right_cancel_add AddRightCancelSemigroup.toIsRightCancelAdd
 -/
@@ -493,7 +493,7 @@ variable {M : Type u} [MulOneClass M]
 #print one_mul /-
 @[ematch, simp, to_additive]
 theorem one_mul : ∀ a : M, 1 * a = a :=
-  MulOneClass.one_mul
+  MulOneClass.one_hMul
 #align one_mul one_mul
 #align zero_add zero_add
 -/
@@ -501,20 +501,20 @@ theorem one_mul : ∀ a : M, 1 * a = a :=
 #print mul_one /-
 @[ematch, simp, to_additive]
 theorem mul_one : ∀ a : M, a * 1 = a :=
-  MulOneClass.mul_one
+  MulOneClass.hMul_one
 #align mul_one mul_one
 #align add_zero add_zero
 -/
 
 @[to_additive]
 instance MulOneClass.to_isLeftId : IsLeftId M (· * ·) 1 :=
-  ⟨MulOneClass.one_mul⟩
+  ⟨MulOneClass.one_hMul⟩
 #align mul_one_class.to_is_left_id MulOneClass.to_isLeftId
 #align add_zero_class.to_is_left_id AddZeroClass.to_isLeftId
 
 @[to_additive]
 instance MulOneClass.to_isRightId : IsRightId M (· * ·) 1 :=
-  ⟨MulOneClass.mul_one⟩
+  ⟨MulOneClass.hMul_one⟩
 #align mul_one_class.to_is_right_id MulOneClass.to_isRightId
 #align add_zero_class.to_is_right_id AddZeroClass.to_isRightId
 
@@ -827,8 +827,8 @@ instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelC
 @[to_additive "Any `add_cancel_monoid M` satisfies `is_cancel_add M`."]
 instance (priority := 100) CancelMonoid.toIsCancelMul (M : Type u) [CancelMonoid M] : IsCancelMul M
     where
-  mul_left_cancel := CancelMonoid.mul_left_cancel
-  mul_right_cancel := CancelMonoid.mul_right_cancel
+  hMul_left_cancel := CancelMonoid.hMul_left_cancel
+  hMul_right_cancel := CancelMonoid.hMul_right_cancel
 #align cancel_monoid.to_is_cancel_mul CancelMonoid.toIsCancelMul
 #align add_cancel_monoid.to_is_cancel_add AddCancelMonoid.toIsCancelAdd
 -/
@@ -944,7 +944,7 @@ explanations on this.
 @[protect_proj]
 class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
   div := fun a b => a * b⁻¹
-  div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
+  div_eq_hMul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
   zpow : ℤ → G → G := zpowRec
   zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
   zpow_succ' : ∀ (n : ℕ) (a : G), zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by intros;
@@ -1058,7 +1058,7 @@ This is a duplicate of `div_inv_monoid.div_eq_mul_inv` ensuring that the types u
 @[to_additive
       "Subtracting an element is the same as adding by its negative.\n\nThis is a duplicate of `sub_neg_monoid.sub_eq_mul_neg` ensuring that the types unfold better."]
 theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
-  DivInvMonoid.div_eq_mul_inv _ _
+  DivInvMonoid.div_eq_hMul_inv _ _
 #align div_eq_mul_inv div_eq_mul_inv
 #align sub_eq_add_neg sub_eq_add_neg
 -/
@@ -1145,7 +1145,7 @@ class DivisionMonoid (G : Type u) extends DivInvMonoid G, InvolutiveInv G where
   mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹
   /- Despite the asymmetry of `inv_eq_of_mul`, the symmetric version is true thanks to the
   involutivity of inversion. -/
-  inv_eq_of_mul (a b : G) : a * b = 1 → a⁻¹ = b
+  inv_eq_of_hMul (a b : G) : a * b = 1 → a⁻¹ = b
 #align division_monoid DivisionMonoid
 #align subtraction_monoid SubtractionMonoid
 -/
@@ -1165,7 +1165,7 @@ theorem mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹ :=
 #print inv_eq_of_mul_eq_one_right /-
 @[to_additive]
 theorem inv_eq_of_mul_eq_one_right : a * b = 1 → a⁻¹ = b :=
-  DivisionMonoid.inv_eq_of_mul _ _
+  DivisionMonoid.inv_eq_of_hMul _ _
 #align inv_eq_of_mul_eq_one_right inv_eq_of_mul_eq_one_right
 #align neg_eq_of_add_eq_zero_right neg_eq_of_add_eq_zero_right
 -/
@@ -1197,7 +1197,7 @@ with a default so that `a / b = a * b⁻¹` holds by definition.
 -/
 @[protect_proj]
 class Group (G : Type u) extends DivInvMonoid G where
-  mul_left_inv : ∀ a : G, a⁻¹ * a = 1
+  hMul_left_inv : ∀ a : G, a⁻¹ * a = 1
 #align group Group
 -/
 
@@ -1235,7 +1235,7 @@ variable [Group G] {a b c : G}
 #print mul_left_inv /-
 @[simp, to_additive]
 theorem mul_left_inv : ∀ a : G, a⁻¹ * a = 1 :=
-  Group.mul_left_inv
+  Group.hMul_left_inv
 #align mul_left_inv mul_left_inv
 #align add_left_neg add_left_neg
 -/
@@ -1303,9 +1303,10 @@ theorem inv_mul_cancel_right (a b : G) : a * b⁻¹ * b = a := by rw [mul_assoc,
 @[to_additive AddGroup.toSubtractionMonoid]
 instance (priority := 100) Group.toDivisionMonoid : DivisionMonoid G :=
   { ‹Group G› with
-    inv_inv := fun a => inv_eq_of_mul (mul_left_inv a)
-    mul_inv_rev := fun a b => inv_eq_of_mul <| by rw [mul_assoc, mul_inv_cancel_left, mul_right_inv]
-    inv_eq_of_mul := fun _ _ => inv_eq_of_mul }
+    inv_inv := fun a => inv_eq_of_hMul (mul_left_inv a)
+    mul_inv_rev := fun a b =>
+      inv_eq_of_hMul <| by rw [mul_assoc, mul_inv_cancel_left, mul_right_inv]
+    inv_eq_of_hMul := fun _ _ => inv_eq_of_hMul }
 #align group.to_division_monoid Group.toDivisionMonoid
 #align add_group.to_subtraction_monoid AddGroup.toSubtractionMonoid
 -/
@@ -1317,8 +1318,8 @@ instance (priority := 100) Group.toCancelMonoid : CancelMonoid G :=
   {
     ‹Group
         G› with
-    mul_right_cancel := fun a b c h => by rw [← mul_inv_cancel_right a b, h, mul_inv_cancel_right]
-    mul_left_cancel := fun a b c h => by rw [← inv_mul_cancel_left a b, h, inv_mul_cancel_left] }
+    hMul_right_cancel := fun a b c h => by rw [← mul_inv_cancel_right a b, h, mul_inv_cancel_right]
+    hMul_left_cancel := fun a b c h => by rw [← inv_mul_cancel_left a b, h, inv_mul_cancel_left] }
 #align group.to_cancel_monoid Group.toCancelMonoid
 -/
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2014 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
-
-! This file was ported from Lean 3 source module algebra.group.defs
-! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Tactic.Basic
 import Mathbin.Logic.Function.Basic
 
+#align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
+
 /-!
 # Typeclasses for (semi)groups and monoids
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 
 ! This file was ported from Lean 3 source module algebra.group.defs
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
+! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -88,15 +88,26 @@ universe u
 
 variable {G : Type _}
 
--- PLEASE REPORT THIS TO MATHPORT DEVS, THIS SHOULD NOT HAPPEN.
--- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
-/--
-    The simpset `field_simps` is used by the tactic `field_simp` to
-    reduce an expression in a field to an expression of the form `n / d` where `n` and `d` are
-    division-free. -/
-  register_simp_attr
-  field_simps
+/- Additive "sister" structures.
+   Example, add_semigroup mirrors semigroup.
+   These structures exist just to help automation.
+   In an alternative design, we could have the binary operation as an
+   extra argument for semigroup, monoid, group, etc. However, the lemmas
+   would be hard to index since they would not contain any constant.
+   For example, mul_assoc would be
 
+   lemma mul_assoc {α : Type u} {op : α → α → α} [semigroup α op] :
+                   ∀ a b c : α, op (op a b) c = op a (op b c) :=
+    semigroup.mul_assoc
+
+   The simplifier cannot effectively use this lemma since the pattern for
+   the left-hand-side would be
+
+        ?op (?op ?a ?b) ?c
+
+   Remark: we use a tactic for transporting theorems from the multiplicative fragment
+   to the additive one.
+-/
 section Mul
 
 variable [Mul G]
Diff
@@ -70,13 +70,10 @@ class SMul (M : Type _) (α : Type _) where
 #align has_vadd VAdd
 -/
 
--- mathport name: «expr +ᵥ »
 infixl:65 " +ᵥ " => VAdd.vadd
 
--- mathport name: «expr -ᵥ »
 infixl:65 " -ᵥ " => VSub.vsub
 
--- mathport name: «expr • »
 infixr:73 " • " => SMul.smul
 
 attribute [to_additive_reorder 1] Pow
@@ -286,17 +283,21 @@ section Semigroup
 
 variable [Semigroup G]
 
+#print mul_assoc /-
 @[no_rsimp, to_additive]
 theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
   Semigroup.mul_assoc
 #align mul_assoc mul_assoc
 #align add_assoc add_assoc
+-/
 
+#print Semigroup.to_isAssociative /-
 @[to_additive]
 instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
   ⟨mul_assoc⟩
 #align semigroup.to_is_associative Semigroup.to_isAssociative
 #align add_semigroup.to_is_associative AddSemigroup.to_isAssociative
+-/
 
 end Semigroup
 
@@ -322,18 +323,23 @@ section CommSemigroup
 
 variable [CommSemigroup G]
 
+#print mul_comm /-
 @[no_rsimp, to_additive]
 theorem mul_comm : ∀ a b : G, a * b = b * a :=
   CommSemigroup.mul_comm
 #align mul_comm mul_comm
 #align add_comm add_comm
+-/
 
+#print CommSemigroup.to_isCommutative /-
 @[to_additive]
 instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
   ⟨mul_comm⟩
 #align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutative
 #align add_comm_semigroup.to_is_commutative AddCommSemigroup.to_isCommutative
+-/
 
+#print CommSemigroup.IsRightCancelMul.toIsLeftCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_left_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
@@ -343,7 +349,9 @@ theorem CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemig
   ⟨fun a b c h => mul_right_cancel <| (mul_comm _ _).trans (h.trans <| mul_comm _ _)⟩
 #align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
 #align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
+-/
 
+#print CommSemigroup.IsLeftCancelMul.toIsRightCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_right_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
@@ -353,7 +361,9 @@ theorem CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemig
   ⟨fun a b c h => mul_left_cancel <| (mul_comm _ _).trans (h.trans <| mul_comm _ _)⟩
 #align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
 #align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
+-/
 
+#print CommSemigroup.IsLeftCancelMul.toIsCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
@@ -363,7 +373,9 @@ theorem CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup
   { ‹IsLeftCancelMul G›, CommSemigroup.IsLeftCancelMul.toIsRightCancelMul G with }
 #align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
 #align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
+-/
 
+#print CommSemigroup.IsRightCancelMul.toIsCancelMul /-
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
@@ -373,6 +385,7 @@ theorem CommSemigroup.IsRightCancelMul.toIsCancelMul (G : Type u) [CommSemigroup
   { ‹IsRightCancelMul G›, CommSemigroup.IsRightCancelMul.toIsLeftCancelMul G with }
 #align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommSemigroup.IsRightCancelMul.toIsCancelMul
 #align add_comm_semigroup.is_right_cancel_add.to_is_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
+-/
 
 end CommSemigroup
 
@@ -395,6 +408,7 @@ class AddLeftCancelSemigroup (G : Type u) extends AddSemigroup G where
 
 attribute [to_additive AddLeftCancelSemigroup] LeftCancelSemigroup
 
+#print LeftCancelSemigroup.toIsLeftCancelMul /-
 /-- Any `left_cancel_semigroup` satisfies `is_left_cancel_mul`. -/
 @[to_additive "Any `add_left_cancel_semigroup` satisfies `is_left_cancel_add`."]
 instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
@@ -402,6 +416,7 @@ instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
     where mul_left_cancel := LeftCancelSemigroup.mul_left_cancel
 #align left_cancel_semigroup.to_is_left_cancel_mul LeftCancelSemigroup.toIsLeftCancelMul
 #align add_left_cancel_semigroup.to_is_left_cancel_add AddLeftCancelSemigroup.toIsLeftCancelAdd
+-/
 
 #print RightCancelSemigroup /-
 /-- A `right_cancel_semigroup` is a semigroup such that `a * b = c * b` implies `a = c`. -/
@@ -422,6 +437,7 @@ class AddRightCancelSemigroup (G : Type u) extends AddSemigroup G where
 
 attribute [to_additive AddRightCancelSemigroup] RightCancelSemigroup
 
+#print RightCancelSemigroup.toIsRightCancelMul /-
 /-- Any `right_cancel_semigroup` satisfies `is_right_cancel_mul`. -/
 @[to_additive "Any `add_right_cancel_semigroup` satisfies `is_right_cancel_add`."]
 instance (priority := 100) RightCancelSemigroup.toIsRightCancelMul (G : Type u)
@@ -429,6 +445,7 @@ instance (priority := 100) RightCancelSemigroup.toIsRightCancelMul (G : Type u)
     where mul_right_cancel := RightCancelSemigroup.mul_right_cancel
 #align right_cancel_semigroup.to_is_right_cancel_mul RightCancelSemigroup.toIsRightCancelMul
 #align add_right_cancel_semigroup.to_is_right_cancel_add AddRightCancelSemigroup.toIsRightCancelAdd
+-/
 
 #print MulOneClass /-
 /-- Typeclass for expressing that a type `M` with multiplication and a one satisfies
@@ -450,6 +467,7 @@ class AddZeroClass (M : Type u) extends Zero M, Add M where
 
 attribute [to_additive] MulOneClass
 
+#print MulOneClass.ext /-
 @[ext, to_additive]
 theorem MulOneClass.ext {M : Type u} : ∀ ⦃m₁ m₂ : MulOneClass M⦄, m₁.mul = m₂.mul → m₁ = m₂ :=
   by
@@ -458,22 +476,27 @@ theorem MulOneClass.ext {M : Type u} : ∀ ⦃m₁ m₂ : MulOneClass M⦄, m₁
   exact (one_mul₂ one₁).symm.trans (mul_one₁ one₂)
 #align mul_one_class.ext MulOneClass.ext
 #align add_zero_class.ext AddZeroClass.ext
+-/
 
 section MulOneClass
 
 variable {M : Type u} [MulOneClass M]
 
+#print one_mul /-
 @[ematch, simp, to_additive]
 theorem one_mul : ∀ a : M, 1 * a = a :=
   MulOneClass.one_mul
 #align one_mul one_mul
 #align zero_add zero_add
+-/
 
+#print mul_one /-
 @[ematch, simp, to_additive]
 theorem mul_one : ∀ a : M, a * 1 = a :=
   MulOneClass.mul_one
 #align mul_one mul_one
 #align add_zero add_zero
+-/
 
 @[to_additive]
 instance MulOneClass.to_isLeftId : IsLeftId M (· * ·) 1 :=
@@ -657,18 +680,22 @@ theorem npow_eq_pow (n : ℕ) (x : M) : Monoid.npow n x = x ^ n :=
 #align nsmul_eq_smul nsmul_eq_smul
 -/
 
+#print pow_zero /-
 -- the attributes are intentionally out of order. `zero_smul` proves `zero_nsmul`.
 @[to_additive zero_nsmul, simp]
 theorem pow_zero (a : M) : a ^ 0 = 1 :=
   Monoid.npow_zero _
 #align pow_zero pow_zero
 #align zero_nsmul zero_nsmul
+-/
 
+#print pow_succ /-
 @[to_additive succ_nsmul]
 theorem pow_succ (a : M) (n : ℕ) : a ^ (n + 1) = a * a ^ n :=
   Monoid.npow_succ n a
 #align pow_succ pow_succ
 #align succ_nsmul succ_nsmul
+-/
 
 end
 
@@ -676,11 +703,13 @@ section Monoid
 
 variable {M : Type u} [Monoid M]
 
+#print left_inv_eq_right_inv /-
 @[to_additive]
 theorem left_inv_eq_right_inv {a b c : M} (hba : b * a = 1) (hac : a * c = 1) : b = c := by
   rw [← one_mul c, ← hba, mul_assoc, hac, mul_one b]
 #align left_inv_eq_right_inv left_inv_eq_right_inv
 #align left_neg_eq_right_neg left_neg_eq_right_neg
+-/
 
 end Monoid
 
@@ -785,6 +814,7 @@ instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelC
 #align add_cancel_comm_monoid.to_cancel_add_monoid AddCancelCommMonoid.toAddCancelMonoid
 -/
 
+#print CancelMonoid.toIsCancelMul /-
 /-- Any `cancel_monoid M` satisfies `is_cancel_mul M`. -/
 @[to_additive "Any `add_cancel_monoid M` satisfies `is_cancel_add M`."]
 instance (priority := 100) CancelMonoid.toIsCancelMul (M : Type u) [CancelMonoid M] : IsCancelMul M
@@ -793,6 +823,7 @@ instance (priority := 100) CancelMonoid.toIsCancelMul (M : Type u) [CancelMonoid
   mul_right_cancel := CancelMonoid.mul_right_cancel
 #align cancel_monoid.to_is_cancel_mul CancelMonoid.toIsCancelMul
 #align add_cancel_monoid.to_is_cancel_add AddCancelMonoid.toIsCancelAdd
+-/
 
 end CancelMonoid
 
@@ -840,11 +871,13 @@ class InvolutiveInv (G : Type _) extends Inv G where
 
 variable [InvolutiveInv G]
 
+#print inv_inv /-
 @[simp, to_additive]
 theorem inv_inv (a : G) : a⁻¹⁻¹ = a :=
   InvolutiveInv.inv_inv _
 #align inv_inv inv_inv
 #align neg_neg neg_neg
+-/
 
 end InvolutiveInv
 
@@ -970,11 +1003,13 @@ theorem zpow_eq_pow (n : ℤ) (x : G) : DivInvMonoid.zpow n x = x ^ n :=
 #align zsmul_eq_smul zsmul_eq_smul
 -/
 
+#print zpow_zero /-
 @[simp, to_additive zero_zsmul]
 theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
   DivInvMonoid.zpow_zero' a
 #align zpow_zero zpow_zero
 #align zero_zsmul zero_zsmul
+-/
 
 #print zpow_ofNat /-
 @[simp, norm_cast, to_additive coe_nat_zsmul]
@@ -999,12 +1034,15 @@ theorem zpow_ofNat (a : G) (n : ℕ) : a ^ Int.ofNat n = a ^ n :=
 #align of_nat_zsmul ofNat_zsmul
 -/
 
+#print zpow_negSucc /-
 @[simp, to_additive]
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_ofNat];
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 #align zsmul_neg_succ_of_nat negSucc_zsmul
+-/
 
+#print div_eq_mul_inv /-
 /-- Dividing by an element is the same as multiplying by its inverse.
 
 This is a duplicate of `div_inv_monoid.div_eq_mul_inv` ensuring that the types unfold better.
@@ -1015,6 +1053,7 @@ theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
   DivInvMonoid.div_eq_mul_inv _ _
 #align div_eq_mul_inv div_eq_mul_inv
 #align sub_eq_add_neg sub_eq_add_neg
+-/
 
 alias div_eq_mul_inv ← division_def
 #align division_def division_def
@@ -1066,11 +1105,13 @@ attribute [to_additive SubNegZeroMonoid.toNegZeroClass] DivInvOneMonoid.toInvOne
 
 variable [InvOneClass G]
 
+#print inv_one /-
 @[simp, to_additive]
 theorem inv_one : (1 : G)⁻¹ = 1 :=
   InvOneClass.inv_one
 #align inv_one inv_one
 #align neg_zero neg_zero
+-/
 
 end InvOneClass
 
@@ -1105,17 +1146,21 @@ section DivisionMonoid
 
 variable [DivisionMonoid G] {a b : G}
 
+#print mul_inv_rev /-
 @[simp, to_additive neg_add_rev]
 theorem mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹ :=
   DivisionMonoid.mul_inv_rev _ _
 #align mul_inv_rev mul_inv_rev
 #align neg_add_rev neg_add_rev
+-/
 
+#print inv_eq_of_mul_eq_one_right /-
 @[to_additive]
 theorem inv_eq_of_mul_eq_one_right : a * b = 1 → a⁻¹ = b :=
   DivisionMonoid.inv_eq_of_mul _ _
 #align inv_eq_of_mul_eq_one_right inv_eq_of_mul_eq_one_right
 #align neg_eq_of_add_eq_zero_right neg_eq_of_add_eq_zero_right
+-/
 
 end DivisionMonoid
 
@@ -1179,56 +1224,72 @@ section Group
 
 variable [Group G] {a b c : G}
 
+#print mul_left_inv /-
 @[simp, to_additive]
 theorem mul_left_inv : ∀ a : G, a⁻¹ * a = 1 :=
   Group.mul_left_inv
 #align mul_left_inv mul_left_inv
 #align add_left_neg add_left_neg
+-/
 
+#print inv_mul_self /-
 @[to_additive]
 theorem inv_mul_self (a : G) : a⁻¹ * a = 1 :=
   mul_left_inv a
 #align inv_mul_self inv_mul_self
 #align neg_add_self neg_add_self
+-/
 
 @[to_additive]
 private theorem inv_eq_of_mul (h : a * b = 1) : a⁻¹ = b :=
   left_inv_eq_right_inv (inv_mul_self a) h
 
+#print mul_right_inv /-
 @[simp, to_additive]
 theorem mul_right_inv (a : G) : a * a⁻¹ = 1 := by
   rw [← mul_left_inv a⁻¹, inv_eq_of_mul (mul_left_inv a)]
 #align mul_right_inv mul_right_inv
 #align add_right_neg add_right_neg
+-/
 
+#print mul_inv_self /-
 @[to_additive]
 theorem mul_inv_self (a : G) : a * a⁻¹ = 1 :=
   mul_right_inv a
 #align mul_inv_self mul_inv_self
 #align add_neg_self add_neg_self
+-/
 
+#print inv_mul_cancel_left /-
 @[simp, to_additive]
 theorem inv_mul_cancel_left (a b : G) : a⁻¹ * (a * b) = b := by
   rw [← mul_assoc, mul_left_inv, one_mul]
 #align inv_mul_cancel_left inv_mul_cancel_left
 #align neg_add_cancel_left neg_add_cancel_left
+-/
 
+#print mul_inv_cancel_left /-
 @[simp, to_additive]
 theorem mul_inv_cancel_left (a b : G) : a * (a⁻¹ * b) = b := by
   rw [← mul_assoc, mul_right_inv, one_mul]
 #align mul_inv_cancel_left mul_inv_cancel_left
 #align add_neg_cancel_left add_neg_cancel_left
+-/
 
+#print mul_inv_cancel_right /-
 @[simp, to_additive]
 theorem mul_inv_cancel_right (a b : G) : a * b * b⁻¹ = a := by
   rw [mul_assoc, mul_right_inv, mul_one]
 #align mul_inv_cancel_right mul_inv_cancel_right
 #align add_neg_cancel_right add_neg_cancel_right
+-/
 
+#print inv_mul_cancel_right /-
 @[simp, to_additive]
 theorem inv_mul_cancel_right (a b : G) : a * b⁻¹ * b = a := by rw [mul_assoc, mul_left_inv, mul_one]
 #align inv_mul_cancel_right inv_mul_cancel_right
 #align neg_add_cancel_right neg_add_cancel_right
+-/
 
 #print Group.toDivisionMonoid /-
 @[to_additive AddGroup.toSubtractionMonoid]
Diff
@@ -569,7 +569,7 @@ analysis](https://hal.inria.fr/hal-02463336).
 -/
 
 
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
 /-- `try_refl_tac` solves goals of the form `∀ a b, f a b = g a b`,
 if they hold by definition. -/
 unsafe def try_refl_tac : tactic Unit :=
@@ -985,7 +985,6 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
       a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
       _ = a * a ^ n := (congr_arg ((· * ·) a) (zpow_ofNat n))
       _ = a ^ (n + 1) := (pow_succ _ _).symm
-      
 #align zpow_coe_nat zpow_ofNat
 #align of_nat_zsmul ofNat_zsmul
 -/
Diff
@@ -91,13 +91,8 @@ universe u
 
 variable {G : Type _}
 
-/- failed to parenthesize: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
-[PrettyPrinter.parenthesize.input] (Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr
-     [(Command.docComment
-       "/--"
-       "The simpset `field_simps` is used by the tactic `field_simp` to\nreduce an expression in a field to an expression of the form `n / d` where `n` and `d` are\ndivision-free. -/")]
-     "register_simp_attr"
-     `field_simps)-/-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
+-- PLEASE REPORT THIS TO MATHPORT DEVS, THIS SHOULD NOT HAPPEN.
+-- failed to format: unknown constant 'Lean.Meta._root_.Lean.Parser.Command.registerSimpAttr'
 /--
     The simpset `field_simps` is used by the tactic `field_simp` to
     reduce an expression in a field to an expression of the form `n / d` where `n` and `d` are
Diff
@@ -620,8 +620,8 @@ to `0 : ℕ`).
 /-- An `add_monoid` is an `add_semigroup` with an element `0` such that `0 + a = a + 0 = a`. -/
 class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
   nsmul : ℕ → M → M := nsmulRec
-  nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros ; rfl
-  nsmul_succ : ∀ (n : ℕ) (x), nsmul n.succ x = x + nsmul n x := by intros ; rfl
+  nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros; rfl
+  nsmul_succ : ∀ (n : ℕ) (x), nsmul n.succ x = x + nsmul n x := by intros; rfl
 #align add_monoid AddMonoid
 -/
 
@@ -630,8 +630,8 @@ class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
 @[to_additive]
 class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
   npow : ℕ → M → M := npowRec
-  npow_zero : ∀ x, npow 0 x = 1 := by intros ; rfl
-  npow_succ : ∀ (n : ℕ) (x), npow n.succ x = x * npow n x := by intros ; rfl
+  npow_zero : ∀ x, npow 0 x = 1 := by intros; rfl
+  npow_succ : ∀ (n : ℕ) (x), npow n.succ x = x * npow n x := by intros; rfl
 #align monoid Monoid
 #align add_monoid AddMonoid
 -/
@@ -908,12 +908,12 @@ explanations on this.
 @[protect_proj]
 class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
   div := fun a b => a * b⁻¹
-  div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros ; rfl
+  div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
   zpow : ℤ → G → G := zpowRec
-  zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros ; rfl
-  zpow_succ' : ∀ (n : ℕ) (a : G), zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by
-    intros ; rfl
-  zpow_neg' : ∀ (n : ℕ) (a : G), zpow -[n+1] a = (zpow n.succ a)⁻¹ := by intros ; rfl
+  zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
+  zpow_succ' : ∀ (n : ℕ) (a : G), zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by intros;
+    rfl
+  zpow_neg' : ∀ (n : ℕ) (a : G), zpow -[n+1] a = (zpow n.succ a)⁻¹ := by intros; rfl
 #align div_inv_monoid DivInvMonoid
 -/
 
@@ -938,12 +938,12 @@ explanations on this.
 @[protect_proj]
 class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
   sub := fun a b => a + -b
-  sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros ; rfl
+  sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros; rfl
   zsmul : ℤ → G → G := zsmulRec
-  zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros ; rfl
+  zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros; rfl
   zsmul_succ' : ∀ (n : ℕ) (a : G), zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
-    intros ; rfl
-  zsmul_neg' : ∀ (n : ℕ) (a : G), zsmul -[n+1] a = -zsmul n.succ a := by intros ; rfl
+    intros; rfl
+  zsmul_neg' : ∀ (n : ℕ) (a : G), zsmul -[n+1] a = -zsmul n.succ a := by intros; rfl
 #align sub_neg_monoid SubNegMonoid
 -/
 
Diff
@@ -291,24 +291,12 @@ section Semigroup
 
 variable [Semigroup G]
 
-/- warning: mul_assoc -> mul_assoc is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G] (a : G) (b : G) (c : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)) a b) c) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)) a (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)) b c))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G] (a : G) (b : G) (c : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) a b) c) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) a (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) b c))
-Case conversion may be inaccurate. Consider using '#align mul_assoc mul_assocₓ'. -/
 @[no_rsimp, to_additive]
 theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
   Semigroup.mul_assoc
 #align mul_assoc mul_assoc
 #align add_assoc add_assoc
 
-/- warning: semigroup.to_is_associative -> Semigroup.to_isAssociative is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3053 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3055 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) x._@.Mathlib.Algebra.Group.Defs._hyg.3053 x._@.Mathlib.Algebra.Group.Defs._hyg.3055)
-Case conversion may be inaccurate. Consider using '#align semigroup.to_is_associative Semigroup.to_isAssociativeₓ'. -/
 @[to_additive]
 instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
   ⟨mul_assoc⟩
@@ -339,36 +327,18 @@ section CommSemigroup
 
 variable [CommSemigroup G]
 
-/- warning: mul_comm -> mul_comm is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) a b) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) b a)
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) a b) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) b a)
-Case conversion may be inaccurate. Consider using '#align mul_comm mul_commₓ'. -/
 @[no_rsimp, to_additive]
 theorem mul_comm : ∀ a b : G, a * b = b * a :=
   CommSemigroup.mul_comm
 #align mul_comm mul_comm
 #align add_comm add_comm
 
-/- warning: comm_semigroup.to_is_commutative -> CommSemigroup.to_isCommutative is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3166 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3168 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) x._@.Mathlib.Algebra.Group.Defs._hyg.3166 x._@.Mathlib.Algebra.Group.Defs._hyg.3168)
-Case conversion may be inaccurate. Consider using '#align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutativeₓ'. -/
 @[to_additive]
 instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
   ⟨mul_comm⟩
 #align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutative
 #align add_comm_semigroup.to_is_commutative AddCommSemigroup.to_isCommutative
 
-/- warning: comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul -> CommSemigroup.IsRightCancelMul.toIsLeftCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsRightCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsLeftCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-but is expected to have type
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsRightCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsLeftCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-Case conversion may be inaccurate. Consider using '#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMulₓ'. -/
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_left_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
@@ -379,12 +349,6 @@ theorem CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemig
 #align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
 #align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
 
-/- warning: comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul -> CommSemigroup.IsLeftCancelMul.toIsRightCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsLeftCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsRightCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-but is expected to have type
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsLeftCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsRightCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-Case conversion may be inaccurate. Consider using '#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMulₓ'. -/
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_right_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
@@ -395,12 +359,6 @@ theorem CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemig
 #align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
 #align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
 
-/- warning: comm_semigroup.is_left_cancel_mul.to_is_cancel_mul -> CommSemigroup.IsLeftCancelMul.toIsCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsLeftCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-but is expected to have type
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsLeftCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-Case conversion may be inaccurate. Consider using '#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMulₓ'. -/
 /-- Any `comm_semigroup G` that satisfies `is_left_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
@@ -411,12 +369,6 @@ theorem CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup
 #align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
 #align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
 
-/- warning: comm_semigroup.is_right_cancel_mul.to_is_cancel_mul -> CommSemigroup.IsRightCancelMul.toIsCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsRightCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-but is expected to have type
-  forall (G : Type.{u1}) [_inst_2 : CommSemigroup.{u1} G] [_inst_3 : IsRightCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))], IsCancelMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_2))
-Case conversion may be inaccurate. Consider using '#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommSemigroup.IsRightCancelMul.toIsCancelMulₓ'. -/
 /-- Any `comm_semigroup G` that satisfies `is_right_cancel_mul G` also satisfies
 `is_cancel_mul G`. -/
 @[to_additive AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
@@ -448,12 +400,6 @@ class AddLeftCancelSemigroup (G : Type u) extends AddSemigroup G where
 
 attribute [to_additive AddLeftCancelSemigroup] LeftCancelSemigroup
 
-/- warning: left_cancel_semigroup.to_is_left_cancel_mul -> LeftCancelSemigroup.toIsLeftCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (G : Type.{u1}) [_inst_1 : LeftCancelSemigroup.{u1} G], IsLeftCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (LeftCancelSemigroup.toSemigroup.{u1} G _inst_1))
-but is expected to have type
-  forall (G : Type.{u1}) [_inst_1 : LeftCancelSemigroup.{u1} G], IsLeftCancelMul.{u1} G (Semigroup.toMul.{u1} G (LeftCancelSemigroup.toSemigroup.{u1} G _inst_1))
-Case conversion may be inaccurate. Consider using '#align left_cancel_semigroup.to_is_left_cancel_mul LeftCancelSemigroup.toIsLeftCancelMulₓ'. -/
 /-- Any `left_cancel_semigroup` satisfies `is_left_cancel_mul`. -/
 @[to_additive "Any `add_left_cancel_semigroup` satisfies `is_left_cancel_add`."]
 instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
@@ -481,12 +427,6 @@ class AddRightCancelSemigroup (G : Type u) extends AddSemigroup G where
 
 attribute [to_additive AddRightCancelSemigroup] RightCancelSemigroup
 
-/- warning: right_cancel_semigroup.to_is_right_cancel_mul -> RightCancelSemigroup.toIsRightCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (G : Type.{u1}) [_inst_1 : RightCancelSemigroup.{u1} G], IsRightCancelMul.{u1} G (Semigroup.toHasMul.{u1} G (RightCancelSemigroup.toSemigroup.{u1} G _inst_1))
-but is expected to have type
-  forall (G : Type.{u1}) [_inst_1 : RightCancelSemigroup.{u1} G], IsRightCancelMul.{u1} G (Semigroup.toMul.{u1} G (RightCancelSemigroup.toSemigroup.{u1} G _inst_1))
-Case conversion may be inaccurate. Consider using '#align right_cancel_semigroup.to_is_right_cancel_mul RightCancelSemigroup.toIsRightCancelMulₓ'. -/
 /-- Any `right_cancel_semigroup` satisfies `is_right_cancel_mul`. -/
 @[to_additive "Any `add_right_cancel_semigroup` satisfies `is_right_cancel_add`."]
 instance (priority := 100) RightCancelSemigroup.toIsRightCancelMul (G : Type u)
@@ -515,12 +455,6 @@ class AddZeroClass (M : Type u) extends Zero M, Add M where
 
 attribute [to_additive] MulOneClass
 
-/- warning: mul_one_class.ext -> MulOneClass.ext is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} {{m₁ : MulOneClass.{u1} M}} {{m₂ : MulOneClass.{u1} M}}, (Eq.{succ u1} (M -> M -> M) (MulOneClass.mul.{u1} M m₁) (MulOneClass.mul.{u1} M m₂)) -> (Eq.{succ u1} (MulOneClass.{u1} M) m₁ m₂)
-but is expected to have type
-  forall {M : Type.{u1}} {{m₁ : MulOneClass.{u1} M}} {{m₂ : MulOneClass.{u1} M}}, (Eq.{succ u1} (M -> M -> M) (Mul.mul.{u1} M (MulOneClass.toMul.{u1} M m₁)) (Mul.mul.{u1} M (MulOneClass.toMul.{u1} M m₂))) -> (Eq.{succ u1} (MulOneClass.{u1} M) m₁ m₂)
-Case conversion may be inaccurate. Consider using '#align mul_one_class.ext MulOneClass.extₓ'. -/
 @[ext, to_additive]
 theorem MulOneClass.ext {M : Type u} : ∀ ⦃m₁ m₂ : MulOneClass M⦄, m₁.mul = m₂.mul → m₁ = m₂ :=
   by
@@ -534,24 +468,12 @@ section MulOneClass
 
 variable {M : Type u} [MulOneClass M]
 
-/- warning: one_mul -> one_mul is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : MulOneClass.{u1} M] (a : M), Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toHasMul.{u1} M _inst_1)) (OfNat.ofNat.{u1} M 1 (OfNat.mk.{u1} M 1 (One.one.{u1} M (MulOneClass.toHasOne.{u1} M _inst_1)))) a) a
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : MulOneClass.{u1} M] (a : M), Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toMul.{u1} M _inst_1)) (OfNat.ofNat.{u1} M 1 (One.toOfNat1.{u1} M (MulOneClass.toOne.{u1} M _inst_1))) a) a
-Case conversion may be inaccurate. Consider using '#align one_mul one_mulₓ'. -/
 @[ematch, simp, to_additive]
 theorem one_mul : ∀ a : M, 1 * a = a :=
   MulOneClass.one_mul
 #align one_mul one_mul
 #align zero_add zero_add
 
-/- warning: mul_one -> mul_one is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : MulOneClass.{u1} M] (a : M), Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toHasMul.{u1} M _inst_1)) a (OfNat.ofNat.{u1} M 1 (OfNat.mk.{u1} M 1 (One.one.{u1} M (MulOneClass.toHasOne.{u1} M _inst_1))))) a
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : MulOneClass.{u1} M] (a : M), Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toMul.{u1} M _inst_1)) a (OfNat.ofNat.{u1} M 1 (One.toOfNat1.{u1} M (MulOneClass.toOne.{u1} M _inst_1)))) a
-Case conversion may be inaccurate. Consider using '#align mul_one mul_oneₓ'. -/
 @[ematch, simp, to_additive]
 theorem mul_one : ∀ a : M, a * 1 = a :=
   MulOneClass.mul_one
@@ -740,12 +662,6 @@ theorem npow_eq_pow (n : ℕ) (x : M) : Monoid.npow n x = x ^ n :=
 #align nsmul_eq_smul nsmul_eq_smul
 -/
 
-/- warning: pow_zero -> pow_zero is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : Monoid.{u1} M] (a : M), Eq.{succ u1} M (HPow.hPow.{u1, 0, u1} M Nat M (instHPow.{u1, 0} M Nat (Monoid.Pow.{u1} M _inst_1)) a (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (OfNat.ofNat.{u1} M 1 (OfNat.mk.{u1} M 1 (One.one.{u1} M (MulOneClass.toHasOne.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1)))))
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : Monoid.{u1} M] (a : M), Eq.{succ u1} M (HPow.hPow.{u1, 0, u1} M Nat M (instHPow.{u1, 0} M Nat (Monoid.Pow.{u1} M _inst_1)) a (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (OfNat.ofNat.{u1} M 1 (One.toOfNat1.{u1} M (Monoid.toOne.{u1} M _inst_1)))
-Case conversion may be inaccurate. Consider using '#align pow_zero pow_zeroₓ'. -/
 -- the attributes are intentionally out of order. `zero_smul` proves `zero_nsmul`.
 @[to_additive zero_nsmul, simp]
 theorem pow_zero (a : M) : a ^ 0 = 1 :=
@@ -753,12 +669,6 @@ theorem pow_zero (a : M) : a ^ 0 = 1 :=
 #align pow_zero pow_zero
 #align zero_nsmul zero_nsmul
 
-/- warning: pow_succ -> pow_succ is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : Monoid.{u1} M] (a : M) (n : Nat), Eq.{succ u1} M (HPow.hPow.{u1, 0, u1} M Nat M (instHPow.{u1, 0} M Nat (Monoid.Pow.{u1} M _inst_1)) a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toHasMul.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1))) a (HPow.hPow.{u1, 0, u1} M Nat M (instHPow.{u1, 0} M Nat (Monoid.Pow.{u1} M _inst_1)) a n))
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : Monoid.{u1} M] (a : M) (n : Nat), Eq.{succ u1} M (HPow.hPow.{u1, 0, u1} M Nat M (instHPow.{u1, 0} M Nat (Monoid.Pow.{u1} M _inst_1)) a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toMul.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1))) a (HPow.hPow.{u1, 0, u1} M Nat M (instHPow.{u1, 0} M Nat (Monoid.Pow.{u1} M _inst_1)) a n))
-Case conversion may be inaccurate. Consider using '#align pow_succ pow_succₓ'. -/
 @[to_additive succ_nsmul]
 theorem pow_succ (a : M) (n : ℕ) : a ^ (n + 1) = a * a ^ n :=
   Monoid.npow_succ n a
@@ -771,12 +681,6 @@ section Monoid
 
 variable {M : Type u} [Monoid M]
 
-/- warning: left_inv_eq_right_inv -> left_inv_eq_right_inv is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : Monoid.{u1} M] {a : M} {b : M} {c : M}, (Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toHasMul.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1))) b a) (OfNat.ofNat.{u1} M 1 (OfNat.mk.{u1} M 1 (One.one.{u1} M (MulOneClass.toHasOne.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1)))))) -> (Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toHasMul.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1))) a c) (OfNat.ofNat.{u1} M 1 (OfNat.mk.{u1} M 1 (One.one.{u1} M (MulOneClass.toHasOne.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1)))))) -> (Eq.{succ u1} M b c)
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : Monoid.{u1} M] {a : M} {b : M} {c : M}, (Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toMul.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1))) b a) (OfNat.ofNat.{u1} M 1 (One.toOfNat1.{u1} M (Monoid.toOne.{u1} M _inst_1)))) -> (Eq.{succ u1} M (HMul.hMul.{u1, u1, u1} M M M (instHMul.{u1} M (MulOneClass.toMul.{u1} M (Monoid.toMulOneClass.{u1} M _inst_1))) a c) (OfNat.ofNat.{u1} M 1 (One.toOfNat1.{u1} M (Monoid.toOne.{u1} M _inst_1)))) -> (Eq.{succ u1} M b c)
-Case conversion may be inaccurate. Consider using '#align left_inv_eq_right_inv left_inv_eq_right_invₓ'. -/
 @[to_additive]
 theorem left_inv_eq_right_inv {a b c : M} (hba : b * a = 1) (hac : a * c = 1) : b = c := by
   rw [← one_mul c, ← hba, mul_assoc, hac, mul_one b]
@@ -886,12 +790,6 @@ instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelC
 #align add_cancel_comm_monoid.to_cancel_add_monoid AddCancelCommMonoid.toAddCancelMonoid
 -/
 
-/- warning: cancel_monoid.to_is_cancel_mul -> CancelMonoid.toIsCancelMul is a dubious translation:
-lean 3 declaration is
-  forall (M : Type.{u1}) [_inst_1 : CancelMonoid.{u1} M], IsCancelMul.{u1} M (MulOneClass.toHasMul.{u1} M (Monoid.toMulOneClass.{u1} M (RightCancelMonoid.toMonoid.{u1} M (CancelMonoid.toRightCancelMonoid.{u1} M _inst_1))))
-but is expected to have type
-  forall (M : Type.{u1}) [_inst_1 : CancelMonoid.{u1} M], IsCancelMul.{u1} M (MulOneClass.toMul.{u1} M (Monoid.toMulOneClass.{u1} M (RightCancelMonoid.toMonoid.{u1} M (CancelMonoid.toRightCancelMonoid.{u1} M _inst_1))))
-Case conversion may be inaccurate. Consider using '#align cancel_monoid.to_is_cancel_mul CancelMonoid.toIsCancelMulₓ'. -/
 /-- Any `cancel_monoid M` satisfies `is_cancel_mul M`. -/
 @[to_additive "Any `add_cancel_monoid M` satisfies `is_cancel_add M`."]
 instance (priority := 100) CancelMonoid.toIsCancelMul (M : Type u) [CancelMonoid M] : IsCancelMul M
@@ -947,12 +845,6 @@ class InvolutiveInv (G : Type _) extends Inv G where
 
 variable [InvolutiveInv G]
 
-/- warning: inv_inv -> inv_inv is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : InvolutiveInv.{u1} G] (a : G), Eq.{succ u1} G (Inv.inv.{u1} G (InvolutiveInv.toHasInv.{u1} G _inst_1) (Inv.inv.{u1} G (InvolutiveInv.toHasInv.{u1} G _inst_1) a)) a
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : InvolutiveInv.{u1} G] (a : G), Eq.{succ u1} G (Inv.inv.{u1} G (InvolutiveInv.toInv.{u1} G _inst_1) (Inv.inv.{u1} G (InvolutiveInv.toInv.{u1} G _inst_1) a)) a
-Case conversion may be inaccurate. Consider using '#align inv_inv inv_invₓ'. -/
 @[simp, to_additive]
 theorem inv_inv (a : G) : a⁻¹⁻¹ = a :=
   InvolutiveInv.inv_inv _
@@ -1083,12 +975,6 @@ theorem zpow_eq_pow (n : ℤ) (x : G) : DivInvMonoid.zpow n x = x ^ n :=
 #align zsmul_eq_smul zsmul_eq_smul
 -/
 
-/- warning: zpow_zero -> zpow_zero is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G), Eq.{succ u1} G (HPow.hPow.{u1, 0, u1} G Int G (instHPow.{u1, 0} G Int (DivInvMonoid.Pow.{u1} G _inst_1)) a (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero)))) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (MulOneClass.toHasOne.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1))))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G), Eq.{succ u1} G (HPow.hPow.{u1, 0, u1} G Int G (instHPow.{u1, 0} G Int (DivInvMonoid.Pow.{u1} G _inst_1)) a (OfNat.ofNat.{0} Int 0 (instOfNatInt 0))) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (Monoid.toOne.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1))))
-Case conversion may be inaccurate. Consider using '#align zpow_zero zpow_zeroₓ'. -/
 @[simp, to_additive zero_zsmul]
 theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
   DivInvMonoid.zpow_zero' a
@@ -1119,24 +1005,12 @@ theorem zpow_ofNat (a : G) (n : ℕ) : a ^ Int.ofNat n = a ^ n :=
 #align of_nat_zsmul ofNat_zsmul
 -/
 
-/- warning: zpow_neg_succ_of_nat -> zpow_negSucc is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (n : Nat), Eq.{succ u1} G (HPow.hPow.{u1, 0, u1} G Int G (instHPow.{u1, 0} G Int (DivInvMonoid.Pow.{u1} G _inst_1)) a (Int.negSucc n)) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G _inst_1) (HPow.hPow.{u1, 0, u1} G Nat G (instHPow.{u1, 0} G Nat (Monoid.Pow.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1))) a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (n : Nat), Eq.{succ u1} G (HPow.hPow.{u1, 0, u1} G Int G (instHPow.{u1, 0} G Int (DivInvMonoid.Pow.{u1} G _inst_1)) a (Int.negSucc n)) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G _inst_1) (HPow.hPow.{u1, 0, u1} G Nat G (instHPow.{u1, 0} G Nat (Monoid.Pow.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1))) a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))
-Case conversion may be inaccurate. Consider using '#align zpow_neg_succ_of_nat zpow_negSuccₓ'. -/
 @[simp, to_additive]
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_ofNat];
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 #align zsmul_neg_succ_of_nat negSucc_zsmul
 
-/- warning: div_eq_mul_inv -> div_eq_mul_inv is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HDiv.hDiv.{u1, u1, u1} G G G (instHDiv.{u1} G (DivInvMonoid.toHasDiv.{u1} G _inst_1)) a b) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1)))) a (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G _inst_1) b))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HDiv.hDiv.{u1, u1, u1} G G G (instHDiv.{u1} G (DivInvMonoid.toDiv.{u1} G _inst_1)) a b) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1)))) a (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G _inst_1) b))
-Case conversion may be inaccurate. Consider using '#align div_eq_mul_inv div_eq_mul_invₓ'. -/
 /-- Dividing by an element is the same as multiplying by its inverse.
 
 This is a duplicate of `div_inv_monoid.div_eq_mul_inv` ensuring that the types unfold better.
@@ -1148,12 +1022,6 @@ theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
 #align div_eq_mul_inv div_eq_mul_inv
 #align sub_eq_add_neg sub_eq_add_neg
 
-/- warning: division_def -> division_def is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HDiv.hDiv.{u1, u1, u1} G G G (instHDiv.{u1} G (DivInvMonoid.toHasDiv.{u1} G _inst_1)) a b) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1)))) a (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G _inst_1) b))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HDiv.hDiv.{u1, u1, u1} G G G (instHDiv.{u1} G (DivInvMonoid.toDiv.{u1} G _inst_1)) a b) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1)))) a (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G _inst_1) b))
-Case conversion may be inaccurate. Consider using '#align division_def division_defₓ'. -/
 alias div_eq_mul_inv ← division_def
 #align division_def division_def
 
@@ -1204,12 +1072,6 @@ attribute [to_additive SubNegZeroMonoid.toNegZeroClass] DivInvOneMonoid.toInvOne
 
 variable [InvOneClass G]
 
-/- warning: inv_one -> inv_one is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : InvOneClass.{u1} G], Eq.{succ u1} G (Inv.inv.{u1} G (InvOneClass.toHasInv.{u1} G _inst_1) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (InvOneClass.toHasOne.{u1} G _inst_1))))) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (InvOneClass.toHasOne.{u1} G _inst_1))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : InvOneClass.{u1} G], Eq.{succ u1} G (Inv.inv.{u1} G (InvOneClass.toInv.{u1} G _inst_1) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (InvOneClass.toOne.{u1} G _inst_1)))) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (InvOneClass.toOne.{u1} G _inst_1)))
-Case conversion may be inaccurate. Consider using '#align inv_one inv_oneₓ'. -/
 @[simp, to_additive]
 theorem inv_one : (1 : G)⁻¹ = 1 :=
   InvOneClass.inv_one
@@ -1249,24 +1111,12 @@ section DivisionMonoid
 
 variable [DivisionMonoid G] {a b : G}
 
-/- warning: mul_inv_rev -> mul_inv_rev is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : DivisionMonoid.{u1} G] (a : G) (b : G), Eq.{succ u1} G (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1))))) a b)) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) b) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) a))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : DivisionMonoid.{u1} G] (a : G) (b : G), Eq.{succ u1} G (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1))))) a b)) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) b) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) a))
-Case conversion may be inaccurate. Consider using '#align mul_inv_rev mul_inv_revₓ'. -/
 @[simp, to_additive neg_add_rev]
 theorem mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹ :=
   DivisionMonoid.mul_inv_rev _ _
 #align mul_inv_rev mul_inv_rev
 #align neg_add_rev neg_add_rev
 
-/- warning: inv_eq_of_mul_eq_one_right -> inv_eq_of_mul_eq_one_right is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : DivisionMonoid.{u1} G] {a : G} {b : G}, (Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1))))) a b) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (MulOneClass.toHasOne.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)))))))) -> (Eq.{succ u1} G (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) a) b)
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : DivisionMonoid.{u1} G] {a : G} {b : G}, (Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1))))) a b) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (Monoid.toOne.{u1} G (DivInvMonoid.toMonoid.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)))))) -> (Eq.{succ u1} G (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (DivisionMonoid.toDivInvMonoid.{u1} G _inst_1)) a) b)
-Case conversion may be inaccurate. Consider using '#align inv_eq_of_mul_eq_one_right inv_eq_of_mul_eq_one_rightₓ'. -/
 @[to_additive]
 theorem inv_eq_of_mul_eq_one_right : a * b = 1 → a⁻¹ = b :=
   DivisionMonoid.inv_eq_of_mul _ _
@@ -1335,24 +1185,12 @@ section Group
 
 variable [Group G] {a b c : G}
 
-/- warning: mul_left_inv -> mul_left_inv is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) a) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (MulOneClass.toHasOne.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) a) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (Monoid.toOne.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align mul_left_inv mul_left_invₓ'. -/
 @[simp, to_additive]
 theorem mul_left_inv : ∀ a : G, a⁻¹ * a = 1 :=
   Group.mul_left_inv
 #align mul_left_inv mul_left_inv
 #align add_left_neg add_left_neg
 
-/- warning: inv_mul_self -> inv_mul_self is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) a) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (MulOneClass.toHasOne.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) a) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (Monoid.toOne.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align inv_mul_self inv_mul_selfₓ'. -/
 @[to_additive]
 theorem inv_mul_self (a : G) : a⁻¹ * a = 1 :=
   mul_left_inv a
@@ -1363,72 +1201,36 @@ theorem inv_mul_self (a : G) : a⁻¹ * a = 1 :=
 private theorem inv_eq_of_mul (h : a * b = 1) : a⁻¹ = b :=
   left_inv_eq_right_inv (inv_mul_self a) h
 
-/- warning: mul_right_inv -> mul_right_inv is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a)) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (MulOneClass.toHasOne.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a)) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (Monoid.toOne.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align mul_right_inv mul_right_invₓ'. -/
 @[simp, to_additive]
 theorem mul_right_inv (a : G) : a * a⁻¹ = 1 := by
   rw [← mul_left_inv a⁻¹, inv_eq_of_mul (mul_left_inv a)]
 #align mul_right_inv mul_right_inv
 #align add_right_neg add_right_neg
 
-/- warning: mul_inv_self -> mul_inv_self is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a)) (OfNat.ofNat.{u1} G 1 (OfNat.mk.{u1} G 1 (One.one.{u1} G (MulOneClass.toHasOne.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))))
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a)) (OfNat.ofNat.{u1} G 1 (One.toOfNat1.{u1} G (Monoid.toOne.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align mul_inv_self mul_inv_selfₓ'. -/
 @[to_additive]
 theorem mul_inv_self (a : G) : a * a⁻¹ = 1 :=
   mul_right_inv a
 #align mul_inv_self mul_inv_self
 #align add_neg_self add_neg_self
 
-/- warning: inv_mul_cancel_left -> inv_mul_cancel_left is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a b)) b
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a b)) b
-Case conversion may be inaccurate. Consider using '#align inv_mul_cancel_left inv_mul_cancel_leftₓ'. -/
 @[simp, to_additive]
 theorem inv_mul_cancel_left (a b : G) : a⁻¹ * (a * b) = b := by
   rw [← mul_assoc, mul_left_inv, one_mul]
 #align inv_mul_cancel_left inv_mul_cancel_left
 #align neg_add_cancel_left neg_add_cancel_left
 
-/- warning: mul_inv_cancel_left -> mul_inv_cancel_left is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) b)) b
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) a) b)) b
-Case conversion may be inaccurate. Consider using '#align mul_inv_cancel_left mul_inv_cancel_leftₓ'. -/
 @[simp, to_additive]
 theorem mul_inv_cancel_left (a b : G) : a * (a⁻¹ * b) = b := by
   rw [← mul_assoc, mul_right_inv, one_mul]
 #align mul_inv_cancel_left mul_inv_cancel_left
 #align add_neg_cancel_left add_neg_cancel_left
 
-/- warning: mul_inv_cancel_right -> mul_inv_cancel_right is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a b) (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) b)) a
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a b) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) b)) a
-Case conversion may be inaccurate. Consider using '#align mul_inv_cancel_right mul_inv_cancel_rightₓ'. -/
 @[simp, to_additive]
 theorem mul_inv_cancel_right (a b : G) : a * b * b⁻¹ = a := by
   rw [mul_assoc, mul_right_inv, mul_one]
 #align mul_inv_cancel_right mul_inv_cancel_right
 #align add_neg_cancel_right add_neg_cancel_right
 
-/- warning: inv_mul_cancel_right -> inv_mul_cancel_right is a dubious translation:
-lean 3 declaration is
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toHasMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (Inv.inv.{u1} G (DivInvMonoid.toHasInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) b)) b) a
-but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Group.{u1} G] (a : G) (b : G), Eq.{succ u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (MulOneClass.toMul.{u1} G (Monoid.toMulOneClass.{u1} G (DivInvMonoid.toMonoid.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1))))) a (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G (Group.toDivInvMonoid.{u1} G _inst_1)) b)) b) a
-Case conversion may be inaccurate. Consider using '#align inv_mul_cancel_right inv_mul_cancel_rightₓ'. -/
 @[simp, to_additive]
 theorem inv_mul_cancel_right (a b : G) : a * b⁻¹ * b = a := by rw [mul_assoc, mul_left_inv, mul_one]
 #align inv_mul_cancel_right inv_mul_cancel_right
Diff
@@ -698,14 +698,8 @@ to `0 : ℕ`).
 /-- An `add_monoid` is an `add_semigroup` with an element `0` such that `0 + a = a + 0 = a`. -/
 class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
   nsmul : ℕ → M → M := nsmulRec
-  nsmul_zero : ∀ x, nsmul 0 x = 0 := by
-    intros
-    rfl
-  nsmul_succ :
-    ∀ (n : ℕ) (x), nsmul n.succ x = x +
-          nsmul n x := by
-    intros
-    rfl
+  nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros ; rfl
+  nsmul_succ : ∀ (n : ℕ) (x), nsmul n.succ x = x + nsmul n x := by intros ; rfl
 #align add_monoid AddMonoid
 -/
 
@@ -714,14 +708,8 @@ class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
 @[to_additive]
 class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
   npow : ℕ → M → M := npowRec
-  npow_zero : ∀ x, npow 0 x = 1 := by
-    intros
-    rfl
-  npow_succ :
-    ∀ (n : ℕ) (x), npow n.succ x = x * npow n
-            x := by
-    intros
-    rfl
+  npow_zero : ∀ x, npow 0 x = 1 := by intros ; rfl
+  npow_succ : ∀ (n : ℕ) (x), npow n.succ x = x * npow n x := by intros ; rfl
 #align monoid Monoid
 #align add_monoid AddMonoid
 -/
@@ -1028,25 +1016,12 @@ explanations on this.
 @[protect_proj]
 class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
   div := fun a b => a * b⁻¹
-  div_eq_mul_inv :
-    ∀ a b : G, a / b = a * b⁻¹ := by
-    intros
-    rfl
+  div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros ; rfl
   zpow : ℤ → G → G := zpowRec
-  zpow_zero' : ∀ a : G, zpow 0 a = 1 := by
-    intros
-    rfl
-  zpow_succ' :
-    ∀ (n : ℕ) (a : G),
-      zpow (Int.ofNat n.succ) a =
-        a * zpow (Int.ofNat n) a := by
-    intros
-    rfl
-  zpow_neg' :
-    ∀ (n : ℕ) (a : G), zpow -[n+1] a =
-        (zpow n.succ a)⁻¹ := by
-    intros
-    rfl
+  zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros ; rfl
+  zpow_succ' : ∀ (n : ℕ) (a : G), zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by
+    intros ; rfl
+  zpow_neg' : ∀ (n : ℕ) (a : G), zpow -[n+1] a = (zpow n.succ a)⁻¹ := by intros ; rfl
 #align div_inv_monoid DivInvMonoid
 -/
 
@@ -1071,25 +1046,12 @@ explanations on this.
 @[protect_proj]
 class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
   sub := fun a b => a + -b
-  sub_eq_add_neg :
-    ∀ a b : G, a - b = a + -b := by
-    intros
-    rfl
+  sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros ; rfl
   zsmul : ℤ → G → G := zsmulRec
-  zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by
-    intros
-    rfl
-  zsmul_succ' :
-    ∀ (n : ℕ) (a : G),
-      zsmul (Int.ofNat n.succ) a =
-        a + zsmul (Int.ofNat n) a := by
-    intros
-    rfl
-  zsmul_neg' :
-    ∀ (n : ℕ) (a : G), zsmul -[n+1] a =
-        -zsmul n.succ a := by
-    intros
-    rfl
+  zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros ; rfl
+  zsmul_succ' : ∀ (n : ℕ) (a : G), zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
+    intros ; rfl
+  zsmul_neg' : ∀ (n : ℕ) (a : G), zsmul -[n+1] a = -zsmul n.succ a := by intros ; rfl
 #align sub_neg_monoid SubNegMonoid
 -/
 
@@ -1164,9 +1126,7 @@ but is expected to have type
   forall {G : Type.{u1}} [_inst_1 : DivInvMonoid.{u1} G] (a : G) (n : Nat), Eq.{succ u1} G (HPow.hPow.{u1, 0, u1} G Int G (instHPow.{u1, 0} G Int (DivInvMonoid.Pow.{u1} G _inst_1)) a (Int.negSucc n)) (Inv.inv.{u1} G (DivInvMonoid.toInv.{u1} G _inst_1) (HPow.hPow.{u1, 0, u1} G Nat G (instHPow.{u1, 0} G Nat (Monoid.Pow.{u1} G (DivInvMonoid.toMonoid.{u1} G _inst_1))) a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))
 Case conversion may be inaccurate. Consider using '#align zpow_neg_succ_of_nat zpow_negSuccₓ'. -/
 @[simp, to_additive]
-theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ :=
-  by
-  rw [← zpow_ofNat]
+theorem zpow_negSucc (a : G) (n : ℕ) : a ^ -[n+1] = (a ^ (n + 1))⁻¹ := by rw [← zpow_ofNat];
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 #align zsmul_neg_succ_of_nat negSucc_zsmul
@@ -1502,10 +1462,7 @@ end Group
 #print Group.toDivInvMonoid_injective /-
 @[to_additive]
 theorem Group.toDivInvMonoid_injective {G : Type _} :
-    Function.Injective (@Group.toDivInvMonoid G) :=
-  by
-  rintro ⟨⟩ ⟨⟩ ⟨⟩
-  rfl
+    Function.Injective (@Group.toDivInvMonoid G) := by rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
 #align group.to_div_inv_monoid_injective Group.toDivInvMonoid_injective
 #align add_group.to_sub_neg_add_monoid_injective AddGroup.toSubNegAddMonoid_injective
 -/
@@ -1530,10 +1487,8 @@ attribute [instance 300] AddCommGroup.toAddCommMonoid
 
 #print CommGroup.toGroup_injective /-
 @[to_additive]
-theorem CommGroup.toGroup_injective {G : Type u} : Function.Injective (@CommGroup.toGroup G) :=
-  by
-  rintro ⟨⟩ ⟨⟩ ⟨⟩
-  rfl
+theorem CommGroup.toGroup_injective {G : Type u} : Function.Injective (@CommGroup.toGroup G) := by
+  rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
 #align comm_group.to_group_injective CommGroup.toGroup_injective
 #align add_comm_group.to_add_group_injective AddCommGroup.toAddGroup_injective
 -/
Diff
@@ -1402,7 +1402,6 @@ theorem inv_mul_self (a : G) : a⁻¹ * a = 1 :=
 @[to_additive]
 private theorem inv_eq_of_mul (h : a * b = 1) : a⁻¹ = b :=
   left_inv_eq_right_inv (inv_mul_self a) h
-#align inv_eq_of_mul inv_eq_of_mul
 
 /- warning: mul_right_inv -> mul_right_inv is a dubious translation:
 lean 3 declaration is
Diff
@@ -307,7 +307,7 @@ theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
 lean 3 declaration is
   forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)))
 but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3044 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3046 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) x._@.Mathlib.Algebra.Group.Defs._hyg.3044 x._@.Mathlib.Algebra.Group.Defs._hyg.3046)
+  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3053 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3055 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) x._@.Mathlib.Algebra.Group.Defs._hyg.3053 x._@.Mathlib.Algebra.Group.Defs._hyg.3055)
 Case conversion may be inaccurate. Consider using '#align semigroup.to_is_associative Semigroup.to_isAssociativeₓ'. -/
 @[to_additive]
 instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
@@ -355,7 +355,7 @@ theorem mul_comm : ∀ a b : G, a * b = b * a :=
 lean 3 declaration is
   forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))))
 but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3157 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3159 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) x._@.Mathlib.Algebra.Group.Defs._hyg.3157 x._@.Mathlib.Algebra.Group.Defs._hyg.3159)
+  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3166 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3168 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) x._@.Mathlib.Algebra.Group.Defs._hyg.3166 x._@.Mathlib.Algebra.Group.Defs._hyg.3168)
 Case conversion may be inaccurate. Consider using '#align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutativeₓ'. -/
 @[to_additive]
 instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
Diff
@@ -1527,7 +1527,7 @@ class AddCommGroup (G : Type u) extends AddGroup G, AddCommMonoid G
 
 attribute [to_additive] CommGroup
 
-attribute [instance] AddCommGroup.toAddCommMonoid
+attribute [instance 300] AddCommGroup.toAddCommMonoid
 
 #print CommGroup.toGroup_injective /-
 @[to_additive]
Diff
@@ -307,7 +307,7 @@ theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
 lean 3 declaration is
   forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G _inst_1)))
 but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3041 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3043 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) x._@.Mathlib.Algebra.Group.Defs._hyg.3041 x._@.Mathlib.Algebra.Group.Defs._hyg.3043)
+  forall {G : Type.{u1}} [_inst_1 : Semigroup.{u1} G], IsAssociative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3044 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3046 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G _inst_1)) x._@.Mathlib.Algebra.Group.Defs._hyg.3044 x._@.Mathlib.Algebra.Group.Defs._hyg.3046)
 Case conversion may be inaccurate. Consider using '#align semigroup.to_is_associative Semigroup.to_isAssociativeₓ'. -/
 @[to_additive]
 instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
@@ -355,7 +355,7 @@ theorem mul_comm : ∀ a b : G, a * b = b * a :=
 lean 3 declaration is
   forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toHasMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))))
 but is expected to have type
-  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3154 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3156 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) x._@.Mathlib.Algebra.Group.Defs._hyg.3154 x._@.Mathlib.Algebra.Group.Defs._hyg.3156)
+  forall {G : Type.{u1}} [_inst_1 : CommSemigroup.{u1} G], IsCommutative.{u1} G (fun (x._@.Mathlib.Algebra.Group.Defs._hyg.3157 : G) (x._@.Mathlib.Algebra.Group.Defs._hyg.3159 : G) => HMul.hMul.{u1, u1, u1} G G G (instHMul.{u1} G (Semigroup.toMul.{u1} G (CommSemigroup.toSemigroup.{u1} G _inst_1))) x._@.Mathlib.Algebra.Group.Defs._hyg.3157 x._@.Mathlib.Algebra.Group.Defs._hyg.3159)
 Case conversion may be inaccurate. Consider using '#align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutativeₓ'. -/
 @[to_additive]
 instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
Diff
@@ -652,7 +652,7 @@ analysis](https://hal.inria.fr/hal-02463336).
 -/
 
 
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
 /-- `try_refl_tac` solves goals of the form `∀ a b, f a b = g a b`,
 if they hold by definition. -/
 unsafe def try_refl_tac : tactic Unit :=
@@ -1140,7 +1140,7 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | n + 1 =>
     calc
       a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-      _ = a * a ^ n := congr_arg ((· * ·) a) (zpow_ofNat n)
+      _ = a * a ^ n := (congr_arg ((· * ·) a) (zpow_ofNat n))
       _ = a ^ (n + 1) := (pow_succ _ _).symm
       
 #align zpow_coe_nat zpow_ofNat

Changes in mathlib4

mathlib3
mathlib4
doc: convert many comments into doc comments (#11940)

All of these changes appear to be oversights to me.

Diff
@@ -1045,7 +1045,7 @@ end InvOneClass
 `-(a + b) = -b + -a` and `a + b = 0 → -a = b`. -/
 class SubtractionMonoid (G : Type u) extends SubNegMonoid G, InvolutiveNeg G where
   protected neg_add_rev (a b : G) : -(a + b) = -b + -a
-  /- Despite the asymmetry of `neg_eq_of_add`, the symmetric version is true thanks to the
+  /-- Despite the asymmetry of `neg_eq_of_add`, the symmetric version is true thanks to the
   involutivity of negation. -/
   protected neg_eq_of_add (a b : G) : a + b = 0 → -a = b
 #align subtraction_monoid SubtractionMonoid
@@ -1057,7 +1057,7 @@ This is the immediate common ancestor of `Group` and `GroupWithZero`. -/
 @[to_additive SubtractionMonoid]
 class DivisionMonoid (G : Type u) extends DivInvMonoid G, InvolutiveInv G where
   protected mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹
-  /- Despite the asymmetry of `inv_eq_of_mul`, the symmetric version is true thanks to the
+  /-- Despite the asymmetry of `inv_eq_of_mul`, the symmetric version is true thanks to the
   involutivity of inversion. -/
   protected inv_eq_of_mul (a b : G) : a * b = 1 → a⁻¹ = b
 #align division_monoid DivisionMonoid
refactor: Use nsmul in zsmul_rec (#862)

It's annoying that zsmulRec uses nsmulRec to define zsmul even when the user already set nsmul explicitly. This PR changes zsmulRec to take nsmul as an argument.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -774,16 +774,16 @@ end CancelMonoid
 
 /-- The fundamental power operation in a group. `zpowRec n a = a*a*...*a` n times, for integer `n`.
 Use instead `a ^ n`, which has better definitional behavior. -/
-def zpowRec {M : Type*} [One M] [Mul M] [Inv M] : ℤ → M → M
-  | Int.ofNat n, a => npowRec n a
-  | Int.negSucc n, a => (npowRec n.succ a)⁻¹
+def zpowRec [One G] [Mul G] [Inv G] (npow : ℕ → G → G := npowRec) : ℤ → G → G
+  | Int.ofNat n, a => npow n a
+  | Int.negSucc n, a => (npow n.succ a)⁻¹
 #align zpow_rec zpowRec
 
 /-- The fundamental scalar multiplication in an additive group. `zpowRec n a = a+a+...+a` n
 times, for integer `n`. Use instead `n • a`, which has better definitional behavior. -/
-def zsmulRec {M : Type*} [Zero M] [Add M] [Neg M] : ℤ → M → M
-  | Int.ofNat n, a => nsmulRec n a
-  | Int.negSucc n, a => -nsmulRec n.succ a
+def zsmulRec [Zero G] [Add G] [Neg G] (nsmul : ℕ → G → G := nsmulRec) : ℤ → G → G
+  | Int.ofNat n, a => nsmul n a
+  | Int.negSucc n, a => -nsmul n.succ a
 #align zsmul_rec zsmulRec
 
 attribute [to_additive existing] zpowRec
@@ -877,7 +877,7 @@ class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
   /-- `a / b := a * b⁻¹` -/
   protected div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
   /-- The power operation: `a ^ n = a * ··· * a`; `a ^ (-n) = a⁻¹ * ··· a⁻¹` (`n` times) -/
-  protected zpow : ℤ → G → G := zpowRec
+  protected zpow : ℤ → G → G := zpowRec npowRec
   /-- `a ^ 0 = 1` -/
   protected zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
   /-- `a ^ (n + 1) = a ^ n * a` -/
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -488,20 +488,18 @@ section
 
 variable {M : Type u}
 
--- use `x * npowRec n x` and not `npowRec n x * x` in the definition to make sure that
--- definitional unfolding of `npowRec` is blocked, to avoid deep recursion issues.
 /-- The fundamental power operation in a monoid. `npowRec n a = a*a*...*a` n times.
 Use instead `a ^ n`, which has better definitional behavior. -/
 def npowRec [One M] [Mul M] : ℕ → M → M
   | 0, _ => 1
-  | n + 1, a => a * npowRec n a
+  | n + 1, a => npowRec n a * a
 #align npow_rec npowRec
 
 /-- The fundamental scalar multiplication in an additive monoid. `nsmulRec n a = a+a+...+a` n
 times. Use instead `n • a`, which has better definitional behavior. -/
 def nsmulRec [Zero M] [Add M] : ℕ → M → M
   | 0, _ => 0
-  | n + 1, a => a + nsmulRec n a
+  | n + 1, a => nsmulRec n a + a
 #align nsmul_rec nsmulRec
 
 attribute [to_additive existing] npowRec
@@ -599,7 +597,7 @@ class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
   /-- Multiplication by `(0 : ℕ)` gives `0`. -/
   protected nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros; rfl
   /-- Multiplication by `(n + 1 : ℕ)` behaves as expected. -/
-  protected nsmul_succ : ∀ (n : ℕ) (x), nsmul (n + 1) x = x + nsmul n x := by intros; rfl
+  protected nsmul_succ : ∀ (n : ℕ) (x), nsmul (n + 1) x = nsmul n x + x := by intros; rfl
 #align add_monoid AddMonoid
 
 attribute [instance 150] AddSemigroup.toAdd
@@ -616,7 +614,7 @@ class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
   /-- Raising to the power `(0 : ℕ)` gives `1`. -/
   protected npow_zero : ∀ x, npow 0 x = 1 := by intros; rfl
   /-- Raising to the power `(n + 1 : ℕ)` behaves as expected. -/
-  protected npow_succ : ∀ (n : ℕ) (x), npow (n + 1) x = x * npow n x := by intros; rfl
+  protected npow_succ : ∀ (n : ℕ) (x), npow (n + 1) x = npow n x * x := by intros; rfl
 #align monoid Monoid
 
 #align monoid.npow_zero' Monoid.npow_zero
@@ -653,10 +651,10 @@ theorem pow_zero (a : M) : a ^ 0 = 1 :=
 #align zero_nsmul zero_nsmul
 
 @[to_additive succ_nsmul]
-theorem pow_succ (a : M) (n : ℕ) : a ^ (n + 1) = a * a ^ n :=
+theorem pow_succ (a : M) (n : ℕ) : a ^ (n + 1) = a ^ n * a :=
   Monoid.npow_succ n a
-#align pow_succ pow_succ
-#align succ_nsmul succ_nsmul
+#align pow_succ' pow_succ
+#align succ_nsmul' succ_nsmul
 
 end
 
@@ -882,8 +880,8 @@ class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
   protected zpow : ℤ → G → G := zpowRec
   /-- `a ^ 0 = 1` -/
   protected zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
-  /-- `a ^ (n + 1) = a * a ^ n` -/
-  protected zpow_succ' (n : ℕ) (a : G) : zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by
+  /-- `a ^ (n + 1) = a ^ n * a` -/
+  protected zpow_succ' (n : ℕ) (a : G) : zpow (Int.ofNat n.succ) a = zpow (Int.ofNat n) a  * a := by
     intros; rfl
   /-- `a ^ -(n + 1) = (a ^ (n + 1))⁻¹` -/
   protected zpow_neg' (n : ℕ) (a : G) : zpow (Int.negSucc n) a = (zpow n.succ a)⁻¹ := by intros; rfl
@@ -925,7 +923,7 @@ class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
   protected zsmul : ℤ → G → G
   protected zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros; rfl
   protected zsmul_succ' (n : ℕ) (a : G) :
-      zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
+      zsmul (Int.ofNat n.succ) a = zsmul (Int.ofNat n) a + a := by
     intros; rfl
   protected zsmul_neg' (n : ℕ) (a : G) : zsmul (Int.negSucc n) a = -zsmul n.succ a := by
     intros; rfl
@@ -962,8 +960,8 @@ variable [DivInvMonoid G] {a b : G}
 theorem zpow_natCast (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 => calc
-    a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-    _ = a * a ^ n := congrArg (a * ·) (zpow_natCast a n)
+    a ^ (↑(n + 1) : ℤ) = a ^ (n : ℤ) * a := DivInvMonoid.zpow_succ' _ _
+    _ = a ^ n * a := congrArg (· * a) (zpow_natCast a n)
     _ = a ^ (n + 1) := (pow_succ _ _).symm
 #align zpow_coe_nat zpow_natCast
 #align zpow_of_nat zpow_natCast
chore: Rename zpow_coe_nat to zpow_natCast (#11528)

... and add a deprecated alias for the old name. This is mostly just me discovering the power of F2

Diff
@@ -958,31 +958,35 @@ variable [DivInvMonoid G] {a b : G}
 #align zpow_zero zpow_zero
 #align zero_zsmul zero_zsmul
 
-@[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
-theorem zpow_coe_nat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
+@[to_additive (attr := simp, norm_cast) natCast_zsmul]
+theorem zpow_natCast (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 => calc
     a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-    _ = a * a ^ n := congrArg (a * ·) (zpow_coe_nat a n)
+    _ = a * a ^ n := congrArg (a * ·) (zpow_natCast a n)
     _ = a ^ (n + 1) := (pow_succ _ _).symm
-#align zpow_coe_nat zpow_coe_nat
-#align zpow_of_nat zpow_coe_nat
-#align coe_nat_zsmul coe_nat_zsmul
-#align of_nat_zsmul coe_nat_zsmul
+#align zpow_coe_nat zpow_natCast
+#align zpow_of_nat zpow_natCast
+#align coe_nat_zsmul natCast_zsmul
+#align of_nat_zsmul natCast_zsmul
+
+-- 2024-03-20
+@[deprecated] alias zpow_coe_nat := zpow_natCast
+@[deprecated] alias coe_nat_zsmul := natCast_zsmul
 
 -- See note [no_index around OfNat.ofNat]
 @[to_additive ofNat_zsmul]
 lemma zpow_ofNat (a : G) (n : ℕ) : a ^ (no_index (OfNat.ofNat n) : ℤ) = a ^ OfNat.ofNat n :=
-  zpow_coe_nat ..
+  zpow_natCast ..
 
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ (Int.negSucc n) = (a ^ (n + 1))⁻¹ := by
-  rw [← zpow_coe_nat]
+  rw [← zpow_natCast]
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 
 theorem negSucc_zsmul {G} [SubNegMonoid G] (a : G) (n : ℕ) :
     Int.negSucc n • a = -((n + 1) • a) := by
-  rw [← coe_nat_zsmul]
+  rw [← natCast_zsmul]
   exact SubNegMonoid.zsmul_neg' n a
 #align zsmul_neg_succ_of_nat negSucc_zsmul
 
refactor: do not allow nsmul and zsmul to default automatically (#6262)

This PR removes the default values for nsmul and zsmul, forcing the user to populate them manually. The previous behavior can be obtained by writing nsmul := nsmulRec and zsmul := zsmulRec, which is now in the docstring for these fields.

The motivation here is to make it more obvious when module diamonds are being introduced, or at least where they might be hiding; you can now simply search for nsmulRec in the source code.

Arguably we should do the same thing for intCast, natCast, pow, and zpow too, but diamonds are less common in those fields, so I'll leave them to a subsequent PR.

Co-authored-by: Matthew Ballard <matt@mrb.email>

Diff
@@ -593,8 +593,9 @@ need right away.
 
 /-- An `AddMonoid` is an `AddSemigroup` with an element `0` such that `0 + a = a + 0 = a`. -/
 class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
-  /-- Multiplication by a natural number. -/
-  protected nsmul : ℕ → M → M := nsmulRec
+  /-- Multiplication by a natural number.
+  Set this to `nsmulRec` unless `Module` diamonds are possible. -/
+  protected nsmul : ℕ → M → M
   /-- Multiplication by `(0 : ℕ)` gives `0`. -/
   protected nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros; rfl
   /-- Multiplication by `(n + 1 : ℕ)` behaves as expected. -/
@@ -919,12 +920,15 @@ explanations on this.
 class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
   protected sub := SubNegMonoid.sub'
   protected sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros; rfl
-  protected zsmul : ℤ → G → G := zsmulRec
+  /-- Multiplication by an integer.
+  Set this to `zsmulRec` unless `Module` diamonds are possible. -/
+  protected zsmul : ℤ → G → G
   protected zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros; rfl
   protected zsmul_succ' (n : ℕ) (a : G) :
       zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
     intros; rfl
-  protected zsmul_neg' (n : ℕ) (a : G) : zsmul (Int.negSucc n) a = -zsmul n.succ a := by intros; rfl
+  protected zsmul_neg' (n : ℕ) (a : G) : zsmul (Int.negSucc n) a = -zsmul n.succ a := by
+    intros; rfl
 #align sub_neg_monoid SubNegMonoid
 
 attribute [to_additive SubNegMonoid] DivInvMonoid
fix: correct statement of zpow_ofNat and ofNat_zsmul (#10969)

Previously these were syntactically identical to the corresponding zpow_coe_nat and coe_nat_zsmul lemmas, now they are about OfNat.ofNat.

Unfortunately, almost every call site uses the ofNat name to refer to Nat.cast, so the downstream proofs had to be adjusted too.

Diff
@@ -954,29 +954,31 @@ variable [DivInvMonoid G] {a b : G}
 #align zpow_zero zpow_zero
 #align zero_zsmul zero_zsmul
 
-@[to_additive (attr := norm_cast) ofNat_zsmul]
-theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
+@[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
+theorem zpow_coe_nat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 => calc
     a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-    _ = a * a ^ n := congrArg (a * ·) (zpow_ofNat a n)
+    _ = a * a ^ n := congrArg (a * ·) (zpow_coe_nat a n)
     _ = a ^ (n + 1) := (pow_succ _ _).symm
-#align zpow_coe_nat zpow_ofNat
-#align zpow_of_nat zpow_ofNat
-#align of_nat_zsmul ofNat_zsmul
-
-@[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
-lemma zpow_coe_nat (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n := zpow_ofNat ..
+#align zpow_coe_nat zpow_coe_nat
+#align zpow_of_nat zpow_coe_nat
 #align coe_nat_zsmul coe_nat_zsmul
+#align of_nat_zsmul coe_nat_zsmul
+
+-- See note [no_index around OfNat.ofNat]
+@[to_additive ofNat_zsmul]
+lemma zpow_ofNat (a : G) (n : ℕ) : a ^ (no_index (OfNat.ofNat n) : ℤ) = a ^ OfNat.ofNat n :=
+  zpow_coe_nat ..
 
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ (Int.negSucc n) = (a ^ (n + 1))⁻¹ := by
-  rw [← zpow_ofNat]
+  rw [← zpow_coe_nat]
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 
 theorem negSucc_zsmul {G} [SubNegMonoid G] (a : G) (n : ℕ) :
     Int.negSucc n • a = -((n + 1) • a) := by
-  rw [← ofNat_zsmul]
+  rw [← coe_nat_zsmul]
   exact SubNegMonoid.zsmul_neg' n a
 #align zsmul_neg_succ_of_nat negSucc_zsmul
 
chore: tidy various files (#10453)
Diff
@@ -290,16 +290,16 @@ theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
 
 end Semigroup
 
-/-- A commutative addition is a type with an addition which commutes-/
+/-- A commutative additive magma is a type with an addition which commutes. -/
 @[ext]
 class AddCommMagma (G : Type u) extends Add G where
-  /-- Addition is commutative in an additive commutative semigroup. -/
+  /-- Addition is commutative in an commutative additive magma. -/
   protected add_comm : ∀ a b : G, a + b = b + a
 
-/-- A commutative multiplication is a type with a multiplication which commutes-/
+/-- A commutative multiplicative magma is a type with a multiplication which commutes. -/
 @[ext]
 class CommMagma (G : Type u) extends Mul G where
-  /-- Multiplication is commutative in a commutative semigroup. -/
+  /-- Multiplication is commutative in a commutative multiplicative magma. -/
   protected mul_comm : ∀ a b : G, a * b = b * a
 
 attribute [to_additive] CommMagma
doc: @[inherit_doc] on notations (#9942)

Make all the notations that unambiguously should inherit the docstring of their definition actually inherit it.

Also write a few docstrings by hand. I only wrote the ones I was competent to write and which I was sure of. Some docstrings come from mathlib3 as they were lost during the early port.

This PR is only intended as a first pass There are many more docstrings to add.

Diff
@@ -82,23 +82,29 @@ attribute [notation_class zsmul Simps.zsmulArgs]  HSMul
 
 /-- Type class for the `+ᵥ` notation. -/
 class VAdd (G : Type u) (P : Type v) where
+  /-- `a +ᵥ b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent,
+  but it is intended to be used for left actions. -/
   vadd : G → P → P
 #align has_vadd VAdd
 
 /-- Type class for the `-ᵥ` notation. -/
 class VSub (G : outParam (Type*)) (P : Type*) where
+  /-- `a -ᵥ b` computes the difference of `a` and `b`. The meaning of this notation is
+  type-dependent, but it is intended to be used for additive torsors. -/
   vsub : P → P → G
 #align has_vsub VSub
 
 /-- Typeclass for types with a scalar multiplication operation, denoted `•` (`\bu`) -/
 @[to_additive (attr := ext)]
 class SMul (M : Type u) (α : Type v) where
+  /-- `a • b` computes the product of `a` and `b`. The meaning of this notation is type-dependent,
+  but it is intended to be used for left actions. -/
   smul : M → α → α
 #align has_smul SMul
 
-infixl:65 " +ᵥ " => HVAdd.hVAdd
-infixl:65 " -ᵥ " => VSub.vsub
-infixr:73 " • " => HSMul.hSMul
+@[inherit_doc] infixl:65 " +ᵥ " => HVAdd.hVAdd
+@[inherit_doc] infixl:65 " -ᵥ " => VSub.vsub
+@[inherit_doc] infixr:73 " • " => HSMul.hSMul
 
 /-!
 We have a macro to make `x • y` notation participate in the expression tree elaborator,
doc: fix typos (#10100)

Fix minor typos in the following files:

  • Mathlib/GroupTheory/GroupAction/Opposite.lean
  • Mathlib/Init/Control/Lawful.lean
  • Mathlib/ModelTheory/ElementarySubstructures.lean
  • Mathlib/Algebra/Group/Defs.lean
  • Mathlib/Algebra/Group/WithOne/Basic.lean
  • Mathlib/Data/Int/Cast/Defs.lean
  • Mathlib/LinearAlgebra/Dimension/Basic.lean
  • Mathlib/NumberTheory/NumberField/CanonicalEmbedding.lean
  • Mathlib/Algebra/Star/StarAlgHom.lean
  • Mathlib/AlgebraicTopology/SimplexCategory.lean
  • Mathlib/CategoryTheory/Abelian/Homology.lean
  • Mathlib/CategoryTheory/Sites/Grothendieck.lean
  • Mathlib/RingTheory/IsTensorProduct.lean
  • Mathlib/AlgebraicTopology/DoldKan/Homotopies.lean
  • Mathlib/AlgebraicTopology/ExtraDegeneracy.lean
  • Mathlib/AlgebraicTopology/Nerve.lean
  • Mathlib/AlgebraicTopology/SplitSimplicialObject.lean
  • Mathlib/Analysis/ConstantSpeed.lean
  • Mathlib/Analysis/Convolution.lean
Diff
@@ -113,7 +113,7 @@ variable [Ring R] [AddCommMonoid M] [Module R M] (r : R) (N : Submodule R M) (m
 ```
 Without the macro, the expression would elaborate as `m + ↑(r • n : ↑N) : M`.
 With the macro, the expression elaborates as `m + r • (↑n : M) : M`.
-To get the first intepretation, one can write `m + (r • n :)`.
+To get the first interpretation, one can write `m + (r • n :)`.
 
 Here is a quick review of the expression tree elaborator:
 1. It builds up an expression tree of all the immediately accessible operations
doc(Algebra/Group/Defs): add note on names SMul, VAdd; typo fix (#9776)

Edited module docstring:

  • Fixed recent accidental damage
  • Added a note about the motivation for the names SMul and VAdd Zulip discussion

Co-authored-by: Richard Copley <rcopley@gmail.com>

Diff
@@ -28,12 +28,15 @@ The file does not contain any lemmas except for
 
 For basic lemmas about these classes see `Algebra.Group.Basic`.
 
-We also introduce notation classes `lul` and `VAdd` for multiplicative and additive
+We also introduce notation classes `SMul` and `VAdd` for multiplicative and additive
 actions and register the following instances:
 
 - `Pow M ℕ`, for monoids `M`, and `Pow G ℤ` for groups `G`;
 - `SMul ℕ M` for additive monoids `M`, and `SMul ℤ G` for additive groups `G`.
 
+`SMul` is typically, but not exclusively, used for scalar multiplication-like operators.
+See the module `Algebra.AddTorsor` for a motivating example for the name `VAdd` (vector addition)`.
+
 ## Notation
 
 - `+`, `-`, `*`, `/`, `^` : the usual arithmetic operations; the underlying functions are
chore: refactor of Algebra/Group/Defs to reduce imports (#9606)

We are not that far from the point that Algebra/Group/Defs depends on nothing significant besides simps and to_additive.

This removes from Mathlib.Algebra.Group.Defs the dependencies on

  • Mathlib.Tactic.Basic (which is a grab-bag of random stuff)
  • Mathlib.Init.Algebra.Classes (which is ancient and half-baked)
  • Mathlib.Logic.Function.Basic (not particularly important, but it is barely used in this file)

The goal is to avoid all unnecessary imports to set up the definitions of basic algebraic structures.

We also separate out Mathlib.Tactic.TypeStar and Mathlib.Tactic.Lemma as prerequisites to Mathlib.Tactic.Basic, but which can be imported separately when the rest of Mathlib.Tactic.Basic is not needed.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -3,11 +3,13 @@ Copyright (c) 2014 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 -/
-import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
-import Mathlib.Logic.Function.Basic
-import Mathlib.Tactic.Basic
 import Mathlib.Init.ZeroOne
+import Mathlib.Tactic.Lemma
+import Mathlib.Tactic.TypeStar
+import Mathlib.Tactic.Simps.Basic
+import Mathlib.Tactic.ToAdditive
+import Mathlib.Util.AssertExists
 
 #align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
 
@@ -221,27 +223,10 @@ theorem mul_left_cancel : a * b = a * c → b = c :=
 
 @[to_additive]
 theorem mul_left_cancel_iff : a * b = a * c ↔ b = c :=
-  ⟨mul_left_cancel, congr_arg _⟩
+  ⟨mul_left_cancel, congrArg _⟩
 #align mul_left_cancel_iff mul_left_cancel_iff
 #align add_left_cancel_iff add_left_cancel_iff
 
-@[to_additive]
-theorem mul_right_injective (a : G) : Injective (a * ·) := fun _ _ ↦ mul_left_cancel
-#align mul_right_injective mul_right_injective
-#align add_right_injective add_right_injective
-
-@[to_additive (attr := simp)]
-theorem mul_right_inj (a : G) {b c : G} : a * b = a * c ↔ b = c :=
-  (mul_right_injective a).eq_iff
-#align mul_right_inj mul_right_inj
-#align add_right_inj add_right_inj
-
-@[to_additive]
-theorem mul_ne_mul_right (a : G) {b c : G} : a * b ≠ a * c ↔ b ≠ c :=
-  (mul_right_injective a).ne_iff
-#align mul_ne_mul_right mul_ne_mul_right
-#align add_ne_add_right add_ne_add_right
-
 end IsLeftCancelMul
 
 section IsRightCancelMul
@@ -256,27 +241,10 @@ theorem mul_right_cancel : a * b = c * b → a = c :=
 
 @[to_additive]
 theorem mul_right_cancel_iff : b * a = c * a ↔ b = c :=
-  ⟨mul_right_cancel, congr_arg (· * a)⟩
+  ⟨mul_right_cancel, congrArg (· * a)⟩
 #align mul_right_cancel_iff mul_right_cancel_iff
 #align add_right_cancel_iff add_right_cancel_iff
 
-@[to_additive]
-theorem mul_left_injective (a : G) : Function.Injective (· * a) := fun _ _ ↦ mul_right_cancel
-#align mul_left_injective mul_left_injective
-#align add_left_injective add_left_injective
-
-@[to_additive (attr := simp)]
-theorem mul_left_inj (a : G) {b c : G} : b * a = c * a ↔ b = c :=
-  (mul_left_injective a).eq_iff
-#align mul_left_inj mul_left_inj
-#align add_left_inj add_left_inj
-
-@[to_additive]
-theorem mul_ne_mul_left (a : G) {b c : G} : b * a ≠ c * a ↔ b ≠ c :=
-  (mul_left_injective a).ne_iff
-#align mul_ne_mul_left mul_ne_mul_left
-#align add_ne_add_left add_ne_add_left
-
 end IsRightCancelMul
 
 end Mul
@@ -311,12 +279,6 @@ theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
 #align mul_assoc mul_assoc
 #align add_assoc add_assoc
 
-@[to_additive]
-instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
-  ⟨mul_assoc⟩
-#align semigroup.to_is_associative Semigroup.to_isAssociative
-#align add_semigroup.to_is_associative AddSemigroup.to_isAssociative
-
 end Semigroup
 
 /-- A commutative addition is a type with an addition which commutes-/
@@ -359,11 +321,6 @@ theorem mul_comm : ∀ a b : G, a * b = b * a := CommMagma.mul_comm
 #align mul_comm mul_comm
 #align add_comm add_comm
 
-@[to_additive]
-instance CommMagma.to_isCommutative : IsCommutative G (· * ·) := ⟨mul_comm⟩
-#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
-#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
-
 /-- Any `CommMagma G` that satisfies `IsRightCancelMul G` also satisfies `IsLeftCancelMul G`. -/
 @[to_additive AddCommMagma.IsRightCancelAdd.toIsLeftCancelAdd "Any `AddCommMagma G` that satisfies
 `IsRightCancelAdd G` also satisfies `IsLeftCancelAdd G`."]
@@ -993,7 +950,7 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 => calc
     a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-    _ = a * a ^ n := congr_arg (a * ·) (zpow_ofNat a n)
+    _ = a * a ^ n := congrArg (a * ·) (zpow_ofNat a n)
     _ = a ^ (n + 1) := (pow_succ _ _).symm
 #align zpow_coe_nat zpow_ofNat
 #align zpow_of_nat zpow_ofNat
@@ -1231,12 +1188,6 @@ instance (priority := 100) Group.toCancelMonoid : CancelMonoid G :=
 
 end Group
 
-@[to_additive]
-theorem Group.toDivInvMonoid_injective {G : Type*} :
-    Function.Injective (@Group.toDivInvMonoid G) := by rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
-#align group.to_div_inv_monoid_injective Group.toDivInvMonoid_injective
-#align add_group.to_sub_neg_add_monoid_injective AddGroup.toSubNegAddMonoid_injective
-
 /-- An additive commutative group is an additive group with commutative `(+)`. -/
 class AddCommGroup (G : Type u) extends AddGroup G, AddCommMonoid G
 #align add_comm_group AddCommGroup
@@ -1248,12 +1199,6 @@ class CommGroup (G : Type u) extends Group G, CommMonoid G
 
 attribute [to_additive existing] CommGroup.toCommMonoid
 
-@[to_additive]
-theorem CommGroup.toGroup_injective {G : Type u} : Function.Injective (@CommGroup.toGroup G) := by
-  rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
-#align comm_group.to_group_injective CommGroup.toGroup_injective
-#align add_comm_group.to_add_group_injective AddCommGroup.toAddGroup_injective
-
 section CommGroup
 
 variable [CommGroup G]
@@ -1318,3 +1263,6 @@ initialize_simps_projections Group
 initialize_simps_projections AddGroup
 initialize_simps_projections CommGroup
 initialize_simps_projections AddCommGroup
+
+assert_not_exists Function.Injective
+assert_not_exists IsCommutative
fix: shake the import tree (#9749)

cherry-picked from #9347

Co-Authored-By: @digama0

Diff
@@ -7,6 +7,7 @@ import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
 import Mathlib.Logic.Function.Basic
 import Mathlib.Tactic.Basic
+import Mathlib.Init.ZeroOne
 
 #align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
 
chore: Move Commute results earlier (#9440)

These lemmas aren't really proved any faster using units, and I will soon need them not to be proved using units.

Part of #9411

Diff
@@ -998,6 +998,10 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
 #align zpow_of_nat zpow_ofNat
 #align of_nat_zsmul ofNat_zsmul
 
+@[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
+lemma zpow_coe_nat (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n := zpow_ofNat ..
+#align coe_nat_zsmul coe_nat_zsmul
+
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ (Int.negSucc n) = (a ^ (n + 1))⁻¹ := by
   rw [← zpow_ofNat]
   exact DivInvMonoid.zpow_neg' n a
@@ -1263,6 +1267,16 @@ instance (priority := 100) CommGroup.toCancelCommMonoid : CancelCommMonoid G :=
 instance (priority := 100) CommGroup.toDivisionCommMonoid : DivisionCommMonoid G :=
   { ‹CommGroup G›, Group.toDivisionMonoid with }
 
+@[to_additive (attr := simp)] lemma inv_mul_cancel_comm (a b : G) : a⁻¹ * b * a = b := by
+  rw [mul_comm, mul_inv_cancel_left]
+#align inv_mul_cancel_comm inv_mul_cancel_comm
+#align neg_add_cancel_comm neg_add_cancel_comm
+
+@[to_additive (attr := simp)] lemma inv_mul_cancel_comm_assoc (a b : G) : a⁻¹ * (b * a) = b := by
+  rw [mul_comm, mul_inv_cancel_right]
+#align inv_mul_cancel_comm_assoc inv_mul_cancel_comm_assoc
+#align neg_add_cancel_comm_assoc neg_add_cancel_comm_assoc
+
 end CommGroup
 
 /-! We initialize all projections for `@[simps]` here, so that we don't have to do it in later
feat: port test/instance_diamonds.lean (#9037)

This reveals that Smul.ext_iff is hard to work with unless we also have a lemma to convert SMul.smul to HSMul.hsMul

Diff
@@ -25,7 +25,7 @@ The file does not contain any lemmas except for
 
 For basic lemmas about these classes see `Algebra.Group.Basic`.
 
-We also introduce notation classes `SMul` and `VAdd` for multiplicative and additive
+We also introduce notation classes `lul` and `VAdd` for multiplicative and additive
 actions and register the following instances:
 
 - `Pow M ℕ`, for monoids `M`, and `Pow G ℤ` for groups `G`;
@@ -139,6 +139,9 @@ attribute [to_additive existing (reorder := 1 2, 4 5) smul] Pow.pow
 instance instHSMul {α β} [SMul α β] : HSMul α β β where
   hSMul := SMul.smul
 
+@[to_additive]
+theorem SMul.smul_eq_hSMul {α β} [SMul α β] : (SMul.smul : α → β → β) = HSMul.hSMul := rfl
+
 attribute [to_additive existing (reorder := 1 2)] instHPow
 
 variable {G : Type*}
chore: Replace (· op ·) a by (a op ·) (#8843)

I used the regex \(\(· (.) ·\) (.)\), replacing with ($2 $1 ·).

Diff
@@ -222,7 +222,7 @@ theorem mul_left_cancel_iff : a * b = a * c ↔ b = c :=
 #align add_left_cancel_iff add_left_cancel_iff
 
 @[to_additive]
-theorem mul_right_injective (a : G) : Function.Injective ((· * ·) a) := fun _ _ ↦ mul_left_cancel
+theorem mul_right_injective (a : G) : Injective (a * ·) := fun _ _ ↦ mul_left_cancel
 #align mul_right_injective mul_right_injective
 #align add_right_injective add_right_injective
 
@@ -989,7 +989,7 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 => calc
     a ^ (↑(n + 1) : ℤ) = a * a ^ (n : ℤ) := DivInvMonoid.zpow_succ' _ _
-    _ = a * a ^ n := congr_arg ((· * ·) a) (zpow_ofNat a n)
+    _ = a * a ^ n := congr_arg (a * ·) (zpow_ofNat a n)
     _ = a ^ (n + 1) := (pow_succ _ _).symm
 #align zpow_coe_nat zpow_ofNat
 #align zpow_of_nat zpow_ofNat
refactor(Algebra/Group/Defs): Separate commutative and associative multiplication (addition) (#7060)

Currently in Mathlib there is no class for magma that are commutative but not associative - Field extends CommRing and DivisionRing, CommRing extends Ring and CommMonoid, CommGroup extends Group and CommMonoid and CommMonoid extends CommSemigroup and Monoid. CommSemigroup currently extends only Semigroup and has mul_comm as a property.

This PR moves mul_comm into a new CommMagma (AddCommMagma) class which extends Mul (Add). CommSemigroup now extends Semigroup and CommMagma.

The rest of Mathlib4 compiles as before, except with the need to increase synthInstance.maxHeartbeats for lift_of_splits.

(Update: The linter is objecting to an unused argument in what seems to be a completely unrelated bit of code (AddEquiv.lpPiLp). Trying a nolint for now.)

Also referenced in https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60add_comm.60.20without.20.60add_assoc.60

Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com> Co-authored-by: Christopher Hoskin <christopher.hoskin@overleaf.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -315,87 +315,86 @@ instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
 
 end Semigroup
 
-/-- A commutative semigroup is a type with an associative commutative `(*)`. -/
+/-- A commutative addition is a type with an addition which commutes-/
+@[ext]
+class AddCommMagma (G : Type u) extends Add G where
+  /-- Addition is commutative in an additive commutative semigroup. -/
+  protected add_comm : ∀ a b : G, a + b = b + a
+
+/-- A commutative multiplication is a type with a multiplication which commutes-/
 @[ext]
-class CommSemigroup (G : Type u) extends Semigroup G where
+class CommMagma (G : Type u) extends Mul G where
   /-- Multiplication is commutative in a commutative semigroup. -/
   protected mul_comm : ∀ a b : G, a * b = b * a
+
+attribute [to_additive] CommMagma
+
+/-- A commutative semigroup is a type with an associative commutative `(*)`. -/
+@[ext]
+class CommSemigroup (G : Type u) extends Semigroup G, CommMagma G where
 #align comm_semigroup CommSemigroup
 #align comm_semigroup.ext_iff CommSemigroup.ext_iff
 #align comm_semigroup.ext CommSemigroup.ext
 
 /-- A commutative additive semigroup is a type with an associative commutative `(+)`. -/
 @[ext]
-class AddCommSemigroup (G : Type u) extends AddSemigroup G where
-  /-- Addition is commutative in an additive commutative semigroup. -/
-  protected add_comm : ∀ a b : G, a + b = b + a
+class AddCommSemigroup (G : Type u) extends AddSemigroup G, AddCommMagma G where
 #align add_comm_semigroup AddCommSemigroup
 #align add_comm_semigroup.ext AddCommSemigroup.ext
 #align add_comm_semigroup.ext_iff AddCommSemigroup.ext_iff
 
 attribute [to_additive] CommSemigroup
+attribute [to_additive existing] CommSemigroup.toCommMagma
 
-section CommSemigroup
+section CommMagma
 
-variable [CommSemigroup G]
+variable [CommMagma G]
 
 @[to_additive]
-theorem mul_comm : ∀ a b : G, a * b = b * a :=
-  CommSemigroup.mul_comm
+theorem mul_comm : ∀ a b : G, a * b = b * a := CommMagma.mul_comm
 #align mul_comm mul_comm
 #align add_comm add_comm
 
 @[to_additive]
-instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
-  ⟨mul_comm⟩
-#align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutative
-#align add_comm_semigroup.to_is_commutative AddCommSemigroup.to_isCommutative
-
-/-- Any `CommSemigroup G` that satisfies `IsRightCancelMul G` also satisfies
-`IsLeftCancelMul G`. -/
-@[to_additive AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd "Any
-`AddCommSemigroup G` that satisfies `IsRightCancelAdd G` also satisfies
-`IsLeftCancelAdd G`."]
-lemma CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemigroup G]
-    [IsRightCancelMul G] : IsLeftCancelMul G :=
+instance CommMagma.to_isCommutative : IsCommutative G (· * ·) := ⟨mul_comm⟩
+#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
+#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
+
+/-- Any `CommMagma G` that satisfies `IsRightCancelMul G` also satisfies `IsLeftCancelMul G`. -/
+@[to_additive AddCommMagma.IsRightCancelAdd.toIsLeftCancelAdd "Any `AddCommMagma G` that satisfies
+`IsRightCancelAdd G` also satisfies `IsLeftCancelAdd G`."]
+lemma CommMagma.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommMagma G] [IsRightCancelMul G] :
+    IsLeftCancelMul G :=
   ⟨fun _ _ _ h => mul_right_cancel <| (mul_comm _ _).trans (h.trans (mul_comm _ _))⟩
-#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
-#align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
-
-/-- Any `CommSemigroup G` that satisfies `IsLeftCancelMul G` also satisfies
-`IsRightCancelMul G`. -/
-@[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd "Any
-`AddCommSemigroup G` that satisfies `IsLeftCancelAdd G` also satisfies
-`IsRightCancelAdd G`."]
-lemma CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigroup G]
-    [IsLeftCancelMul G] : IsRightCancelMul G :=
+#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommMagma.IsRightCancelMul.toIsLeftCancelMul
+#align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommMagma.IsRightCancelAdd.toIsLeftCancelAdd
+
+/-- Any `CommMagma G` that satisfies `IsLeftCancelMul G` also satisfies `IsRightCancelMul G`. -/
+@[to_additive AddCommMagma.IsLeftCancelAdd.toIsRightCancelAdd "Any `AddCommMagma G` that satisfies
+`IsLeftCancelAdd G` also satisfies `IsRightCancelAdd G`."]
+lemma CommMagma.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommMagma G] [IsLeftCancelMul G] :
+    IsRightCancelMul G :=
   ⟨fun _ _ _ h => mul_left_cancel <| (mul_comm _ _).trans (h.trans (mul_comm _ _))⟩
-#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
-#align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
-
-/-- Any `CommSemigroup G` that satisfies `IsLeftCancelMul G` also satisfies
-`IsCancelMul G`. -/
-@[to_additive AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd "Any
-`AddCommSemigroup G` that satisfies `IsLeftCancelAdd G` also satisfies
-`IsCancelAdd G`."]
-lemma CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
-    [IsLeftCancelMul G] : IsCancelMul G :=
-  { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul G with }
-#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
-#align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
-
-/-- Any `CommSemigroup G` that satisfies `IsRightCancelMul G` also satisfies
-`IsCancelMul G`. -/
-@[to_additive AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd "Any
-`AddCommSemigroup G` that satisfies `IsRightCancelAdd G` also satisfies
-`IsCancelAdd G`."]
-lemma CommSemigroup.IsRightCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
-    [IsRightCancelMul G] : IsCancelMul G :=
-  { CommSemigroup.IsRightCancelMul.toIsLeftCancelMul G with }
-#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommSemigroup.IsRightCancelMul.toIsCancelMul
-#align add_comm_semigroup.is_right_cancel_add.to_is_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
-
-end CommSemigroup
+#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommMagma.IsLeftCancelMul.toIsRightCancelMul
+#align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommMagma.IsLeftCancelAdd.toIsRightCancelAdd
+
+/-- Any `CommMagma G` that satisfies `IsLeftCancelMul G` also satisfies `IsCancelMul G`. -/
+@[to_additive AddCommMagma.IsLeftCancelAdd.toIsCancelAdd "Any `AddCommMagma G` that satisfies
+`IsLeftCancelAdd G` also satisfies `IsCancelAdd G`."]
+lemma CommMagma.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommMagma G] [IsLeftCancelMul G] :
+    IsCancelMul G := { CommMagma.IsLeftCancelMul.toIsRightCancelMul G with }
+#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommMagma.IsLeftCancelMul.toIsCancelMul
+#align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommMagma.IsLeftCancelAdd.toIsCancelAdd
+
+/-- Any `CommMagma G` that satisfies `IsRightCancelMul G` also satisfies `IsCancelMul G`. -/
+@[to_additive AddCommMagma.IsRightCancelAdd.toIsCancelAdd "Any `AddCommMagma G` that satisfies
+`IsRightCancelAdd G` also satisfies `IsCancelAdd G`."]
+lemma CommMagma.IsRightCancelMul.toIsCancelMul (G : Type u) [CommMagma G] [IsRightCancelMul G] :
+    IsCancelMul G := { CommMagma.IsRightCancelMul.toIsLeftCancelMul G with }
+#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommMagma.IsRightCancelMul.toIsCancelMul
+#align add_comm_semigroup.is_right_cancel_add.to_is_cancel_add AddCommMagma.IsRightCancelAdd.toIsCancelAdd
+
+end CommMagma
 
 /-- A `LeftCancelSemigroup` is a semigroup such that `a * b = a * c` implies `b = c`. -/
 @[ext]
@@ -789,7 +788,7 @@ attribute [to_additive existing] CancelCommMonoid.toCommMonoid
 @[to_additive]
 instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelCommMonoid M] :
     CancelMonoid M :=
-  { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul M with }
+  { CommMagma.IsLeftCancelMul.toIsRightCancelMul M with }
 #align cancel_comm_monoid.to_cancel_monoid CancelCommMonoid.toCancelMonoid
 #align add_cancel_comm_monoid.to_cancel_add_monoid AddCancelCommMonoid.toAddCancelMonoid
 
feat(Algebra/Group/Hom/Instances): missing instances on AddMonoid.End (#8741)

We already had these instance for AddMonoidHom, but did not copy them across.

This also corrects some instances names, both for cosmetic reasons, and to avoid name clashes.

Diff
@@ -655,15 +655,15 @@ class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
 -- Bug #660
 attribute [to_additive existing] Monoid.toMulOneClass
 
-@[default_instance high] instance Monoid.Pow {M : Type*} [Monoid M] : Pow M ℕ :=
+@[default_instance high] instance Monoid.toNatPow {M : Type*} [Monoid M] : Pow M ℕ :=
   ⟨fun x n ↦ Monoid.npow n x⟩
-#align monoid.has_pow Monoid.Pow
+#align monoid.has_pow Monoid.toNatPow
 
-instance AddMonoid.SMul {M : Type*} [AddMonoid M] : SMul ℕ M :=
+instance AddMonoid.toNatSMul {M : Type*} [AddMonoid M] : SMul ℕ M :=
   ⟨AddMonoid.nsmul⟩
-#align add_monoid.has_smul_nat AddMonoid.SMul
+#align add_monoid.has_smul_nat AddMonoid.toNatSMul
 
-attribute [to_additive existing SMul] Monoid.Pow
+attribute [to_additive existing toNatSMul] Monoid.toNatPow
 
 section
 
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -56,10 +56,18 @@ class HVAdd (α : Type u) (β : Type v) (γ : outParam (Type w)) where
 /--
 The notation typeclass for heterogeneous scalar multiplication.
 This enables the notation `a • b : γ` where `a : α`, `b : β`.
+
+It is assumed to represent a left action in some sense.
+The notation `a • b` is augmented with a macro (below) to have it elaborate as a left action.
+Only the `b` argument participates in the elaboration algorithm: the algorithm uses the type of `b`
+when calculating the type of the surrounding arithmetic expression
+and it tries to insert coercions into `b` to get some `b'`
+such that `a • b'` has the same type as `b'`.
+See the module documentation near the macro for more details.
 -/
 class HSMul (α : Type u) (β : Type v) (γ : outParam (Type w)) where
   /-- `a • b` computes the product of `a` and `b`.
-  The meaning of this notation is type-dependent. -/
+  The meaning of this notation is type-dependent, but it is intended to be used for left actions. -/
   hSMul : α → β → γ
 
 attribute [notation_class  smul Simps.copySecond] HSMul
@@ -86,6 +94,41 @@ infixl:65 " +ᵥ " => HVAdd.hVAdd
 infixl:65 " -ᵥ " => VSub.vsub
 infixr:73 " • " => HSMul.hSMul
 
+/-!
+We have a macro to make `x • y` notation participate in the expression tree elaborator,
+like other arithmetic expressions such as `+`, `*`, `/`, `^`, `=`, inequalities, etc.
+The macro is using the `leftact%` elaborator introduced in
+[this RFC](https://github.com/leanprover/lean4/issues/2854).
+
+As a concrete example of the effect of this macro, consider
+```lean
+variable [Ring R] [AddCommMonoid M] [Module R M] (r : R) (N : Submodule R M) (m : M) (n : N)
+#check m + r • n
+```
+Without the macro, the expression would elaborate as `m + ↑(r • n : ↑N) : M`.
+With the macro, the expression elaborates as `m + r • (↑n : M) : M`.
+To get the first intepretation, one can write `m + (r • n :)`.
+
+Here is a quick review of the expression tree elaborator:
+1. It builds up an expression tree of all the immediately accessible operations
+   that are marked with `binop%`, `unop%`, `leftact%`, `rightact%`, `binrel%`, etc.
+2. It elaborates every leaf term of this tree
+   (without an expected type, so as if it were temporarily wrapped in `(... :)`).
+3. Using the types of each elaborated leaf, it computes a supremum type they can all be
+   coerced to, if such a supremum exists.
+4. It inserts coercions around leaf terms wherever needed.
+
+The hypothesis is that individual expression trees tend to be calculations with respect
+to a single algebraic structure.
+
+Note(kmill): If we were to remove `HSMul` and switch to using `SMul` directly,
+then the expression tree elaborator would not be able to insert coercions within the right operand;
+they would likely appear as `↑(x • y)` rather than `x • ↑y`, unlike other arithmetic operations.
+-/
+
+@[inherit_doc HSMul.hSMul]
+macro_rules | `($x • $y) => `(leftact% HSMul.hSMul $x $y)
+
 attribute [to_additive existing] Mul Div HMul instHMul HDiv instHDiv HSMul
 attribute [to_additive (reorder := 1 2) SMul] Pow
 attribute [to_additive (reorder := 1 2)] HPow
style: cleanup some autoImplicits (#8288)

In some cases adding the arguments manually results in a more obvious argument order anyway

Diff
@@ -40,7 +40,7 @@ actions and register the following instances:
 
 -/
 
-set_option autoImplicit true
+universe u v w
 
 open Function
 
@@ -93,13 +93,11 @@ attribute [to_additive existing (reorder := 1 2, 5 6) hSMul] HPow.hPow
 attribute [to_additive existing (reorder := 1 2, 4 5) smul] Pow.pow
 
 @[to_additive (attr := default_instance)]
-instance instHSMul [SMul α β] : HSMul α β β where
+instance instHSMul {α β} [SMul α β] : HSMul α β β where
   hSMul := SMul.smul
 
 attribute [to_additive existing (reorder := 1 2)] instHPow
 
-universe u
-
 variable {G : Type*}
 
 /-- Class of types that have an inversion operation. -/
chore: remove many Type _ before the colon (#7718)

We have turned to Type* instead of Type _, but many of them remained in mathlib because the straight replacement did not work. In general, having Type _ before the colon is a code smell, though, as it hides which types should be in the same universe and which shouldn't, and is not very robust.

This PR replaces most of the remaining Type _ before the colon (except those in category theory) by Type* or Type u. This has uncovered a few bugs (where declarations were not as polymorphic as they should be).

I had to increase heartbeats at two places when replacing Type _ by Type*, but I think it's worth it as it's really more robust.

Diff
@@ -67,7 +67,7 @@ attribute [notation_class nsmul Simps.nsmulArgs]  HSMul
 attribute [notation_class zsmul Simps.zsmulArgs]  HSMul
 
 /-- Type class for the `+ᵥ` notation. -/
-class VAdd (G : Type*) (P : Type _) where
+class VAdd (G : Type u) (P : Type v) where
   vadd : G → P → P
 #align has_vadd VAdd
 
@@ -78,7 +78,7 @@ class VSub (G : outParam (Type*)) (P : Type*) where
 
 /-- Typeclass for types with a scalar multiplication operation, denoted `•` (`\bu`) -/
 @[to_additive (attr := ext)]
-class SMul (M : Type*) (α : Type _) where
+class SMul (M : Type u) (α : Type v) where
   smul : M → α → α
 #align has_smul SMul
 
chore: exactly 4 spaces in theorems (#7328)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -338,7 +338,7 @@ lemma CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigro
 `AddCommSemigroup G` that satisfies `IsLeftCancelAdd G` also satisfies
 `IsCancelAdd G`."]
 lemma CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
-  [IsLeftCancelMul G] : IsCancelMul G :=
+    [IsLeftCancelMul G] : IsCancelMul G :=
   { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul G with }
 #align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
 #align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
chore: only four spaces for subsequent lines (#7286)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -961,7 +961,7 @@ theorem zpow_negSucc (a : G) (n : ℕ) : a ^ (Int.negSucc n) = (a ^ (n + 1))⁻
 #align zpow_neg_succ_of_nat zpow_negSucc
 
 theorem negSucc_zsmul {G} [SubNegMonoid G] (a : G) (n : ℕ) :
-  Int.negSucc n • a = -((n + 1) • a) := by
+    Int.negSucc n • a = -((n + 1) • a) := by
   rw [← ofNat_zsmul]
   exact SubNegMonoid.zsmul_neg' n a
 #align zsmul_neg_succ_of_nat negSucc_zsmul
chore: cleanup in Mathlib.Init (#6977)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -5,7 +5,8 @@ Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 -/
 import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
-import Mathlib.Tactic.Common
+import Mathlib.Logic.Function.Basic
+import Mathlib.Tactic.Basic
 
 #align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
 
chore: delay import of NeZero until after basic hierarchy (#6970)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -3,7 +3,6 @@ Copyright (c) 2014 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 -/
-
 import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
 import Mathlib.Tactic.Common
chore: ensure Ring/Defs doesn't depend on Group/Basic (#6956)

In the basic algebraic hierarchy, the Defs files should ideally only depend on earlier Defs files, importing as little theory as possible.

This PR makes some rearrangements so Ring.Defs can depend on Group.Defs rather than requiring Group.Basic.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -1058,6 +1058,18 @@ theorem inv_eq_of_mul_eq_one_right : a * b = 1 → a⁻¹ = b :=
 #align inv_eq_of_mul_eq_one_right inv_eq_of_mul_eq_one_right
 #align neg_eq_of_add_eq_zero_right neg_eq_of_add_eq_zero_right
 
+@[to_additive]
+theorem inv_eq_of_mul_eq_one_left (h : a * b = 1) : b⁻¹ = a :=
+  by rw [← inv_eq_of_mul_eq_one_right h, inv_inv]
+#align inv_eq_of_mul_eq_one_left inv_eq_of_mul_eq_one_left
+#align neg_eq_of_add_eq_zero_left neg_eq_of_add_eq_zero_left
+
+@[to_additive]
+theorem eq_inv_of_mul_eq_one_left (h : a * b = 1) : a = b⁻¹ :=
+  (inv_eq_of_mul_eq_one_left h).symm
+#align eq_inv_of_mul_eq_one_left eq_inv_of_mul_eq_one_left
+#align eq_neg_of_add_eq_zero_left eq_neg_of_add_eq_zero_left
+
 end DivisionMonoid
 
 /-- Commutative `SubtractionMonoid`. -/
chore: redundant import (#6957)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -6,7 +6,6 @@ Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 
 import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
-import Mathlib.Logic.Function.Basic
 import Mathlib.Tactic.Common
 
 #align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
chore(Group): protect things like Semigroup.mul_assoc (#6799)
Diff
@@ -241,7 +241,7 @@ end Mul
 @[ext]
 class Semigroup (G : Type u) extends Mul G where
   /-- Multiplication is associative -/
-  mul_assoc : ∀ a b c : G, a * b * c = a * (b * c)
+  protected mul_assoc : ∀ a b c : G, a * b * c = a * (b * c)
 #align semigroup Semigroup
 #align semigroup.ext Semigroup.ext
 #align semigroup.ext_iff Semigroup.ext_iff
@@ -250,7 +250,7 @@ class Semigroup (G : Type u) extends Mul G where
 @[ext]
 class AddSemigroup (G : Type u) extends Add G where
   /-- Addition is associative -/
-  add_assoc : ∀ a b c : G, a + b + c = a + (b + c)
+  protected add_assoc : ∀ a b c : G, a + b + c = a + (b + c)
 #align add_semigroup AddSemigroup
 #align add_semigroup.ext AddSemigroup.ext
 #align add_semigroup.ext_iff AddSemigroup.ext_iff
@@ -279,7 +279,7 @@ end Semigroup
 @[ext]
 class CommSemigroup (G : Type u) extends Semigroup G where
   /-- Multiplication is commutative in a commutative semigroup. -/
-  mul_comm : ∀ a b : G, a * b = b * a
+  protected mul_comm : ∀ a b : G, a * b = b * a
 #align comm_semigroup CommSemigroup
 #align comm_semigroup.ext_iff CommSemigroup.ext_iff
 #align comm_semigroup.ext CommSemigroup.ext
@@ -288,7 +288,7 @@ class CommSemigroup (G : Type u) extends Semigroup G where
 @[ext]
 class AddCommSemigroup (G : Type u) extends AddSemigroup G where
   /-- Addition is commutative in an additive commutative semigroup. -/
-  add_comm : ∀ a b : G, a + b = b + a
+  protected add_comm : ∀ a b : G, a + b = b + a
 #align add_comm_semigroup AddCommSemigroup
 #align add_comm_semigroup.ext AddCommSemigroup.ext
 #align add_comm_semigroup.ext_iff AddCommSemigroup.ext_iff
@@ -360,7 +360,7 @@ end CommSemigroup
 /-- A `LeftCancelSemigroup` is a semigroup such that `a * b = a * c` implies `b = c`. -/
 @[ext]
 class LeftCancelSemigroup (G : Type u) extends Semigroup G where
-  mul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
+  protected mul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
 #align left_cancel_semigroup LeftCancelSemigroup
 #align left_cancel_semigroup.ext_iff LeftCancelSemigroup.ext_iff
 #align left_cancel_semigroup.ext LeftCancelSemigroup.ext
@@ -377,7 +377,7 @@ attribute [instance 75] LeftCancelSemigroup.toSemigroup -- See note [lower cance
 `a + b = a + c` implies `b = c`. -/
 @[ext]
 class AddLeftCancelSemigroup (G : Type u) extends AddSemigroup G where
-  add_left_cancel : ∀ a b c : G, a + b = a + c → b = c
+  protected add_left_cancel : ∀ a b c : G, a + b = a + c → b = c
 #align add_left_cancel_semigroup AddLeftCancelSemigroup
 #align add_left_cancel_semigroup.ext AddLeftCancelSemigroup.ext
 #align add_left_cancel_semigroup.ext_iff AddLeftCancelSemigroup.ext_iff
@@ -398,7 +398,7 @@ instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
 /-- A `RightCancelSemigroup` is a semigroup such that `a * b = c * b` implies `a = c`. -/
 @[ext]
 class RightCancelSemigroup (G : Type u) extends Semigroup G where
-  mul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
+  protected mul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
 #align right_cancel_semigroup RightCancelSemigroup
 #align right_cancel_semigroup.ext_iff RightCancelSemigroup.ext_iff
 #align right_cancel_semigroup.ext RightCancelSemigroup.ext
@@ -409,7 +409,7 @@ attribute [instance 75] RightCancelSemigroup.toSemigroup -- See note [lower canc
 `a + b = c + b` implies `a = c`. -/
 @[ext]
 class AddRightCancelSemigroup (G : Type u) extends AddSemigroup G where
-  add_right_cancel : ∀ a b c : G, a + b = c + b → a = c
+  protected add_right_cancel : ∀ a b c : G, a + b = c + b → a = c
 #align add_right_cancel_semigroup AddRightCancelSemigroup
 #align add_right_cancel_semigroup.ext_iff AddRightCancelSemigroup.ext_iff
 #align add_right_cancel_semigroup.ext AddRightCancelSemigroup.ext
@@ -431,18 +431,18 @@ instance (priority := 100) RightCancelSemigroup.toIsRightCancelMul (G : Type u)
 `1 * a = a` and `a * 1 = a` for all `a : M`. -/
 class MulOneClass (M : Type u) extends One M, Mul M where
   /-- One is a left neutral element for multiplication -/
-  one_mul : ∀ a : M, 1 * a = a
+  protected one_mul : ∀ a : M, 1 * a = a
   /-- One is a right neutral element for multiplication -/
-  mul_one : ∀ a : M, a * 1 = a
+  protected mul_one : ∀ a : M, a * 1 = a
 #align mul_one_class MulOneClass
 
 /-- Typeclass for expressing that a type `M` with addition and a zero satisfies
 `0 + a = a` and `a + 0 = a` for all `a : M`. -/
 class AddZeroClass (M : Type u) extends Zero M, Add M where
   /-- Zero is a left neutral element for addition -/
-  zero_add : ∀ a : M, 0 + a = a
+  protected zero_add : ∀ a : M, 0 + a = a
   /-- Zero is a right neutral element for addition -/
-  add_zero : ∀ a : M, a + 0 = a
+  protected add_zero : ∀ a : M, a + 0 = a
 #align add_zero_class AddZeroClass
 
 attribute [to_additive] MulOneClass
@@ -585,11 +585,11 @@ need right away.
 /-- An `AddMonoid` is an `AddSemigroup` with an element `0` such that `0 + a = a + 0 = a`. -/
 class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
   /-- Multiplication by a natural number. -/
-  nsmul : ℕ → M → M := nsmulRec
+  protected nsmul : ℕ → M → M := nsmulRec
   /-- Multiplication by `(0 : ℕ)` gives `0`. -/
-  nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros; rfl
+  protected nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros; rfl
   /-- Multiplication by `(n + 1 : ℕ)` behaves as expected. -/
-  nsmul_succ : ∀ (n : ℕ) (x), nsmul (n + 1) x = x + nsmul n x := by intros; rfl
+  protected nsmul_succ : ∀ (n : ℕ) (x), nsmul (n + 1) x = x + nsmul n x := by intros; rfl
 #align add_monoid AddMonoid
 
 attribute [instance 150] AddSemigroup.toAdd
@@ -602,11 +602,11 @@ attribute [instance 50] AddZeroClass.toAdd
 @[to_additive]
 class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
   /-- Raising to the power of a natural number. -/
-  npow : ℕ → M → M := npowRec
+  protected npow : ℕ → M → M := npowRec
   /-- Raising to the power `(0 : ℕ)` gives `1`. -/
-  npow_zero : ∀ x, npow 0 x = 1 := by intros; rfl
+  protected npow_zero : ∀ x, npow 0 x = 1 := by intros; rfl
   /-- Raising to the power `(n + 1 : ℕ)` behaves as expected. -/
-  npow_succ : ∀ (n : ℕ) (x), npow (n + 1) x = x * npow n x := by intros; rfl
+  protected npow_succ : ∀ (n : ℕ) (x), npow (n + 1) x = x * npow n x := by intros; rfl
 #align monoid Monoid
 
 #align monoid.npow_zero' Monoid.npow_zero
@@ -784,14 +784,14 @@ section InvolutiveInv
 
 /-- Auxiliary typeclass for types with an involutive `Neg`. -/
 class InvolutiveNeg (A : Type*) extends Neg A where
-  neg_neg : ∀ x : A, - -x = x
+  protected neg_neg : ∀ x : A, - -x = x
 
 #align has_involutive_neg InvolutiveNeg
 
 /-- Auxiliary typeclass for types with an involutive `Inv`. -/
 @[to_additive]
 class InvolutiveInv (G : Type*) extends Inv G where
-  inv_inv : ∀ x : G, x⁻¹⁻¹ = x
+  protected inv_inv : ∀ x : G, x⁻¹⁻¹ = x
 
 #align has_involutive_inv InvolutiveInv
 
@@ -865,18 +865,18 @@ in diamonds. See the definition of `Monoid` and Note [forgetful inheritance] for
 explanations on this.
 -/
 class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
-  div := DivInvMonoid.div'
+  protected div := DivInvMonoid.div'
   /-- `a / b := a * b⁻¹` -/
-  div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
+  protected div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
   /-- The power operation: `a ^ n = a * ··· * a`; `a ^ (-n) = a⁻¹ * ··· a⁻¹` (`n` times) -/
-  zpow : ℤ → G → G := zpowRec
+  protected zpow : ℤ → G → G := zpowRec
   /-- `a ^ 0 = 1` -/
-  zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
+  protected zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
   /-- `a ^ (n + 1) = a * a ^ n` -/
-  zpow_succ' (n : ℕ) (a : G) : zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by
+  protected zpow_succ' (n : ℕ) (a : G) : zpow (Int.ofNat n.succ) a = a * zpow (Int.ofNat n) a := by
     intros; rfl
   /-- `a ^ -(n + 1) = (a ^ (n + 1))⁻¹` -/
-  zpow_neg' (n : ℕ) (a : G) : zpow (Int.negSucc n) a = (zpow n.succ a)⁻¹ := by intros; rfl
+  protected zpow_neg' (n : ℕ) (a : G) : zpow (Int.negSucc n) a = (zpow n.succ a)⁻¹ := by intros; rfl
 #align div_inv_monoid DivInvMonoid
 
 /-- In a class equipped with instances of both `AddMonoid` and `Neg`, this definition records what
@@ -908,13 +908,14 @@ in diamonds. See the definition of `AddMonoid` and Note [forgetful inheritance]
 explanations on this.
 -/
 class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
-  sub := SubNegMonoid.sub'
-  sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros; rfl
-  zsmul : ℤ → G → G := zsmulRec
-  zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros; rfl
-  zsmul_succ' (n : ℕ) (a : G) : zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
+  protected sub := SubNegMonoid.sub'
+  protected sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros; rfl
+  protected zsmul : ℤ → G → G := zsmulRec
+  protected zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros; rfl
+  protected zsmul_succ' (n : ℕ) (a : G) :
+      zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
     intros; rfl
-  zsmul_neg' (n : ℕ) (a : G) : zsmul (Int.negSucc n) a = -zsmul n.succ a := by intros; rfl
+  protected zsmul_neg' (n : ℕ) (a : G) : zsmul (Int.negSucc n) a = -zsmul n.succ a := by intros; rfl
 #align sub_neg_monoid SubNegMonoid
 
 attribute [to_additive SubNegMonoid] DivInvMonoid
@@ -988,7 +989,7 @@ section InvOneClass
 
 /-- Typeclass for expressing that `-0 = 0`. -/
 class NegZeroClass (G : Type*) extends Zero G, Neg G where
-  neg_zero : -(0 : G) = 0
+  protected neg_zero : -(0 : G) = 0
 #align neg_zero_class NegZeroClass
 
 /-- A `SubNegMonoid` where `-0 = 0`. -/
@@ -998,7 +999,7 @@ class SubNegZeroMonoid (G : Type*) extends SubNegMonoid G, NegZeroClass G
 /-- Typeclass for expressing that `1⁻¹ = 1`. -/
 @[to_additive]
 class InvOneClass (G : Type*) extends One G, Inv G where
-  inv_one : (1 : G)⁻¹ = 1
+  protected inv_one : (1 : G)⁻¹ = 1
 #align inv_one_class InvOneClass
 
 /-- A `DivInvMonoid` where `1⁻¹ = 1`. -/
@@ -1022,10 +1023,10 @@ end InvOneClass
 /-- A `SubtractionMonoid` is a `SubNegMonoid` with involutive negation and such that
 `-(a + b) = -b + -a` and `a + b = 0 → -a = b`. -/
 class SubtractionMonoid (G : Type u) extends SubNegMonoid G, InvolutiveNeg G where
-  neg_add_rev (a b : G) : -(a + b) = -b + -a
+  protected neg_add_rev (a b : G) : -(a + b) = -b + -a
   /- Despite the asymmetry of `neg_eq_of_add`, the symmetric version is true thanks to the
   involutivity of negation. -/
-  neg_eq_of_add (a b : G) : a + b = 0 → -a = b
+  protected neg_eq_of_add (a b : G) : a + b = 0 → -a = b
 #align subtraction_monoid SubtractionMonoid
 
 /-- A `DivisionMonoid` is a `DivInvMonoid` with involutive inversion and such that
@@ -1034,10 +1035,10 @@ class SubtractionMonoid (G : Type u) extends SubNegMonoid G, InvolutiveNeg G whe
 This is the immediate common ancestor of `Group` and `GroupWithZero`. -/
 @[to_additive SubtractionMonoid]
 class DivisionMonoid (G : Type u) extends DivInvMonoid G, InvolutiveInv G where
-  mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹
+  protected mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹
   /- Despite the asymmetry of `inv_eq_of_mul`, the symmetric version is true thanks to the
   involutivity of inversion. -/
-  inv_eq_of_mul (a b : G) : a * b = 1 → a⁻¹ = b
+  protected inv_eq_of_mul (a b : G) : a * b = 1 → a⁻¹ = b
 #align division_monoid DivisionMonoid
 
 attribute [to_additive existing] DivisionMonoid.toInvolutiveInv
@@ -1082,7 +1083,7 @@ Use `Group.ofLeftAxioms` or `Group.ofRightAxioms` to define a group structure
 on a type with the minumum proof obligations.
 -/
 class Group (G : Type u) extends DivInvMonoid G where
-  mul_left_inv : ∀ a : G, a⁻¹ * a = 1
+  protected mul_left_inv : ∀ a : G, a⁻¹ * a = 1
 #align group Group
 
 /-- An `AddGroup` is an `AddMonoid` with a unary `-` satisfying `-a + a = 0`.
@@ -1094,7 +1095,7 @@ Use `AddGroup.ofLeftAxioms` or `AddGroup.ofRightAxioms` to define an
 additive group structure on a type with the minumum proof obligations.
 -/
 class AddGroup (A : Type u) extends SubNegMonoid A where
-  add_left_neg : ∀ a : A, -a + a = 0
+  protected add_left_neg : ∀ a : A, -a + a = 0
 #align add_group AddGroup
 
 attribute [to_additive] Group
feat: patch for new alias command (#6172)
Diff
@@ -979,7 +979,7 @@ theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
 #align div_eq_mul_inv div_eq_mul_inv
 #align sub_eq_add_neg sub_eq_add_neg
 
-alias div_eq_mul_inv ← division_def
+alias division_def := div_eq_mul_inv
 #align division_def division_def
 
 end DivInvMonoid
fix: disable autoImplicit globally (#6528)

Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.

The intent of this PR is to make autoImplicit opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true in the few files that rely on it.

That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.

I claim that many of the uses of autoImplicit in these files are accidental; situations such as:

  • Assuming variables are in scope, but pasting the lemma in the wrong section
  • Pasting in a lemma from a scratch file without checking to see if the variable names are consistent with the rest of the file
  • Making a copy-paste error between lemmas and forgetting to add an explicit arguments.

Having set_option autoImplicit false as the default prevents these types of mistake being made in the 90% of files where autoImplicits are not used at all, and causes them to be caught by CI during review.

I think there were various points during the port where we encouraged porters to delete the universes u v lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.

A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18 as the no:dontcare:yes vote ratio.

While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true has been placed locally within a section, rather than at the top of the file.

Diff
@@ -41,6 +41,8 @@ actions and register the following instances:
 
 -/
 
+set_option autoImplicit true
+
 open Function
 
 /--
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -66,18 +66,18 @@ attribute [notation_class nsmul Simps.nsmulArgs]  HSMul
 attribute [notation_class zsmul Simps.zsmulArgs]  HSMul
 
 /-- Type class for the `+ᵥ` notation. -/
-class VAdd (G : Type _) (P : Type _) where
+class VAdd (G : Type*) (P : Type _) where
   vadd : G → P → P
 #align has_vadd VAdd
 
 /-- Type class for the `-ᵥ` notation. -/
-class VSub (G : outParam (Type _)) (P : Type _) where
+class VSub (G : outParam (Type*)) (P : Type*) where
   vsub : P → P → G
 #align has_vsub VSub
 
 /-- Typeclass for types with a scalar multiplication operation, denoted `•` (`\bu`) -/
 @[to_additive (attr := ext)]
-class SMul (M : Type _) (α : Type _) where
+class SMul (M : Type*) (α : Type _) where
   smul : M → α → α
 #align has_smul SMul
 
@@ -99,7 +99,7 @@ attribute [to_additive existing (reorder := 1 2)] instHPow
 
 universe u
 
-variable {G : Type _}
+variable {G : Type*}
 
 /-- Class of types that have an inversion operation. -/
 @[to_additive, notation_class]
@@ -613,11 +613,11 @@ class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
 -- Bug #660
 attribute [to_additive existing] Monoid.toMulOneClass
 
-@[default_instance high] instance Monoid.Pow {M : Type _} [Monoid M] : Pow M ℕ :=
+@[default_instance high] instance Monoid.Pow {M : Type*} [Monoid M] : Pow M ℕ :=
   ⟨fun x n ↦ Monoid.npow n x⟩
 #align monoid.has_pow Monoid.Pow
 
-instance AddMonoid.SMul {M : Type _} [AddMonoid M] : SMul ℕ M :=
+instance AddMonoid.SMul {M : Type*} [AddMonoid M] : SMul ℕ M :=
   ⟨AddMonoid.nsmul⟩
 #align add_monoid.has_smul_nat AddMonoid.SMul
 
@@ -625,7 +625,7 @@ attribute [to_additive existing SMul] Monoid.Pow
 
 section
 
-variable {M : Type _} [Monoid M]
+variable {M : Type*} [Monoid M]
 
 @[to_additive (attr := simp) nsmul_eq_smul]
 theorem npow_eq_pow (n : ℕ) (x : M) : Monoid.npow n x = x ^ n :=
@@ -764,14 +764,14 @@ end CancelMonoid
 
 /-- The fundamental power operation in a group. `zpowRec n a = a*a*...*a` n times, for integer `n`.
 Use instead `a ^ n`, which has better definitional behavior. -/
-def zpowRec {M : Type _} [One M] [Mul M] [Inv M] : ℤ → M → M
+def zpowRec {M : Type*} [One M] [Mul M] [Inv M] : ℤ → M → M
   | Int.ofNat n, a => npowRec n a
   | Int.negSucc n, a => (npowRec n.succ a)⁻¹
 #align zpow_rec zpowRec
 
 /-- The fundamental scalar multiplication in an additive group. `zpowRec n a = a+a+...+a` n
 times, for integer `n`. Use instead `n • a`, which has better definitional behavior. -/
-def zsmulRec {M : Type _} [Zero M] [Add M] [Neg M] : ℤ → M → M
+def zsmulRec {M : Type*} [Zero M] [Add M] [Neg M] : ℤ → M → M
   | Int.ofNat n, a => nsmulRec n a
   | Int.negSucc n, a => -nsmulRec n.succ a
 #align zsmul_rec zsmulRec
@@ -781,14 +781,14 @@ attribute [to_additive existing] zpowRec
 section InvolutiveInv
 
 /-- Auxiliary typeclass for types with an involutive `Neg`. -/
-class InvolutiveNeg (A : Type _) extends Neg A where
+class InvolutiveNeg (A : Type*) extends Neg A where
   neg_neg : ∀ x : A, - -x = x
 
 #align has_involutive_neg InvolutiveNeg
 
 /-- Auxiliary typeclass for types with an involutive `Inv`. -/
 @[to_additive]
-class InvolutiveInv (G : Type _) extends Inv G where
+class InvolutiveInv (G : Type*) extends Inv G where
   inv_inv : ∀ x : G, x⁻¹⁻¹ = x
 
 #align has_involutive_inv InvolutiveInv
@@ -985,23 +985,23 @@ end DivInvMonoid
 section InvOneClass
 
 /-- Typeclass for expressing that `-0 = 0`. -/
-class NegZeroClass (G : Type _) extends Zero G, Neg G where
+class NegZeroClass (G : Type*) extends Zero G, Neg G where
   neg_zero : -(0 : G) = 0
 #align neg_zero_class NegZeroClass
 
 /-- A `SubNegMonoid` where `-0 = 0`. -/
-class SubNegZeroMonoid (G : Type _) extends SubNegMonoid G, NegZeroClass G
+class SubNegZeroMonoid (G : Type*) extends SubNegMonoid G, NegZeroClass G
 #align sub_neg_zero_monoid SubNegZeroMonoid
 
 /-- Typeclass for expressing that `1⁻¹ = 1`. -/
 @[to_additive]
-class InvOneClass (G : Type _) extends One G, Inv G where
+class InvOneClass (G : Type*) extends One G, Inv G where
   inv_one : (1 : G)⁻¹ = 1
 #align inv_one_class InvOneClass
 
 /-- A `DivInvMonoid` where `1⁻¹ = 1`. -/
 @[to_additive SubNegZeroMonoid]
-class DivInvOneMonoid (G : Type _) extends DivInvMonoid G, InvOneClass G
+class DivInvOneMonoid (G : Type*) extends DivInvMonoid G, InvOneClass G
 #align div_inv_one_monoid DivInvOneMonoid
 
 -- FIXME: `to_additive` is not operating on the second parent. (#660)
@@ -1170,7 +1170,7 @@ instance (priority := 100) Group.toCancelMonoid : CancelMonoid G :=
 end Group
 
 @[to_additive]
-theorem Group.toDivInvMonoid_injective {G : Type _} :
+theorem Group.toDivInvMonoid_injective {G : Type*} :
     Function.Injective (@Group.toDivInvMonoid G) := by rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
 #align group.to_div_inv_monoid_injective Group.toDivInvMonoid_injective
 #align add_group.to_sub_neg_add_monoid_injective AddGroup.toSubNegAddMonoid_injective
feat(Group): constructors for minimal group axioms (#6173)

Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>

Diff
@@ -1075,6 +1075,9 @@ attribute [to_additive existing] DivisionCommMonoid.toCommMonoid
 
 There is also a division operation `/` such that `a / b = a * b⁻¹`,
 with a default so that `a / b = a * b⁻¹` holds by definition.
+
+Use `Group.ofLeftAxioms` or `Group.ofRightAxioms` to define a group structure
+on a type with the minumum proof obligations.
 -/
 class Group (G : Type u) extends DivInvMonoid G where
   mul_left_inv : ∀ a : G, a⁻¹ * a = 1
@@ -1084,6 +1087,9 @@ class Group (G : Type u) extends DivInvMonoid G where
 
 There is also a binary operation `-` such that `a - b = a + -b`,
 with a default so that `a - b = a + -b` holds by definition.
+
+Use `AddGroup.ofLeftAxioms` or `AddGroup.ofRightAxioms` to define an
+additive group structure on a type with the minumum proof obligations.
 -/
 class AddGroup (A : Type u) extends SubNegMonoid A where
   add_left_neg : ∀ a : A, -a + a = 0
chore: lower instance priority of CancelMonoid.toMonoid etc (#6145)

This PR lowers the instance priority of inheritance going to cancellative structures, specifically those matching the regular expression (Add)?(Left|Right)?Cancel(Comm)?(Monoid|Semigroup)(WithZero)?.

Most of these cancellative structures either derive from group structures or from (integral) domain structures (including fields). Thus we should be going through the group and semiring hierarchy before going through the cancellative hierarchy. In particular, IsDomain is a mixin depending on Semiring so trying to synthesize an IsDomain instance to satisfy Monoid before even trying Semiring makes no sense.

We came across this issue when adding an extra way to find an IsDomain instance, because this slows down the failing cancellative search path enough to cause timeouts.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Why.20is.20.60simpNF.60.20complaining.20here.3F

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -363,6 +363,14 @@ class LeftCancelSemigroup (G : Type u) extends Semigroup G where
 #align left_cancel_semigroup.ext_iff LeftCancelSemigroup.ext_iff
 #align left_cancel_semigroup.ext LeftCancelSemigroup.ext
 
+library_note "lower cancel priority" /--
+We lower the priority of inheriting from cancellative structures.
+This attemts to avoid expensive checks involving bundling and unbundling with the `IsDomain` class.
+since `IsDomain` already depends on `Semiring`, we can synthesize that one first.
+Zulip discussion: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Why.20is.20.60simpNF.60.20complaining.20here.3F
+-/
+attribute [instance 75] LeftCancelSemigroup.toSemigroup -- See note [lower cancel priority]
+
 /-- An `AddLeftCancelSemigroup` is an additive semigroup such that
 `a + b = a + c` implies `b = c`. -/
 @[ext]
@@ -372,6 +380,8 @@ class AddLeftCancelSemigroup (G : Type u) extends AddSemigroup G where
 #align add_left_cancel_semigroup.ext AddLeftCancelSemigroup.ext
 #align add_left_cancel_semigroup.ext_iff AddLeftCancelSemigroup.ext_iff
 
+attribute [instance 75] AddLeftCancelSemigroup.toAddSemigroup -- See note [lower cancel priority]
+
 attribute [to_additive] LeftCancelSemigroup
 
 /-- Any `LeftCancelSemigroup` satisfies `IsLeftCancelMul`. -/
@@ -391,6 +401,8 @@ class RightCancelSemigroup (G : Type u) extends Semigroup G where
 #align right_cancel_semigroup.ext_iff RightCancelSemigroup.ext_iff
 #align right_cancel_semigroup.ext RightCancelSemigroup.ext
 
+attribute [instance 75] RightCancelSemigroup.toSemigroup -- See note [lower cancel priority]
+
 /-- An `AddRightCancelSemigroup` is an additive semigroup such that
 `a + b = c + b` implies `a = c`. -/
 @[ext]
@@ -400,6 +412,8 @@ class AddRightCancelSemigroup (G : Type u) extends AddSemigroup G where
 #align add_right_cancel_semigroup.ext_iff AddRightCancelSemigroup.ext_iff
 #align add_right_cancel_semigroup.ext AddRightCancelSemigroup.ext
 
+attribute [instance 75] AddRightCancelSemigroup.toAddSemigroup -- See note [lower cancel priority]
+
 attribute [to_additive] RightCancelSemigroup
 
 /-- Any `RightCancelSemigroup` satisfies `IsRightCancelMul`. -/
@@ -665,11 +679,15 @@ is useful to define the sum over the empty set, so `AddLeftCancelSemigroup` is n
 class AddLeftCancelMonoid (M : Type u) extends AddLeftCancelSemigroup M, AddMonoid M
 #align add_left_cancel_monoid AddLeftCancelMonoid
 
+attribute [instance 75] AddLeftCancelMonoid.toAddMonoid -- See note [lower cancel priority]
+
 /-- A monoid in which multiplication is left-cancellative. -/
 @[to_additive]
 class LeftCancelMonoid (M : Type u) extends LeftCancelSemigroup M, Monoid M
 #align left_cancel_monoid LeftCancelMonoid
 
+attribute [instance 75] LeftCancelMonoid.toMonoid -- See note [lower cancel priority]
+
 attribute [to_additive existing] LeftCancelMonoid.toMonoid
 
 end LeftCancelMonoid
@@ -682,11 +700,15 @@ is useful to define the sum over the empty set, so `AddRightCancelSemigroup` is
 class AddRightCancelMonoid (M : Type u) extends AddRightCancelSemigroup M, AddMonoid M
 #align add_right_cancel_monoid AddRightCancelMonoid
 
+attribute [instance 75] AddRightCancelMonoid.toAddMonoid -- See note [lower cancel priority]
+
 /-- A monoid in which multiplication is right-cancellative. -/
 @[to_additive]
 class RightCancelMonoid (M : Type u) extends RightCancelSemigroup M, Monoid M
 #align right_cancel_monoid RightCancelMonoid
 
+attribute [instance 75] RightCancelMonoid.toMonoid -- See note [lower cancel priority]
+
 attribute [to_additive existing] RightCancelMonoid.toMonoid
 
 end RightCancelMonoid
@@ -710,11 +732,15 @@ attribute [to_additive existing] CancelMonoid.toRightCancelMonoid
 class AddCancelCommMonoid (M : Type u) extends AddLeftCancelMonoid M, AddCommMonoid M
 #align add_cancel_comm_monoid AddCancelCommMonoid
 
+attribute [instance 75] AddCancelCommMonoid.toAddCommMonoid -- See note [lower cancel priority]
+
 /-- Commutative version of `CancelMonoid`. -/
 @[to_additive]
 class CancelCommMonoid (M : Type u) extends LeftCancelMonoid M, CommMonoid M
 #align cancel_comm_monoid CancelCommMonoid
 
+attribute [instance 75] CancelCommMonoid.toCommMonoid -- See note [lower cancel priority]
+
 attribute [to_additive existing] CancelCommMonoid.toCommMonoid
 
 -- see Note [lower instance priority]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2014 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
-
-! This file was ported from Lean 3 source module algebra.group.defs
-! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 
 import Mathlib.Init.ZeroOne
@@ -14,6 +9,8 @@ import Mathlib.Init.Data.Int.Basic
 import Mathlib.Logic.Function.Basic
 import Mathlib.Tactic.Common
 
+#align_import algebra.group.defs from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
+
 /-!
 # Typeclasses for (semi)groups and monoids
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -469,7 +469,7 @@ variable {M : Type u}
 -- use `x * npowRec n x` and not `npowRec n x * x` in the definition to make sure that
 -- definitional unfolding of `npowRec` is blocked, to avoid deep recursion issues.
 /-- The fundamental power operation in a monoid. `npowRec n a = a*a*...*a` n times.
-Use instead `a ^ n`,  which has better definitional behavior. -/
+Use instead `a ^ n`, which has better definitional behavior. -/
 def npowRec [One M] [Mul M] : ℕ → M → M
   | 0, _ => 1
   | n + 1, a => a * npowRec n a
@@ -740,7 +740,7 @@ instance (priority := 100) CancelMonoid.toIsCancelMul (M : Type u) [CancelMonoid
 end CancelMonoid
 
 /-- The fundamental power operation in a group. `zpowRec n a = a*a*...*a` n times, for integer `n`.
-Use instead `a ^ n`,  which has better definitional behavior. -/
+Use instead `a ^ n`, which has better definitional behavior. -/
 def zpowRec {M : Type _} [One M] [Mul M] [Inv M] : ℤ → M → M
   | Int.ofNat n, a => npowRec n a
   | Int.negSucc n, a => (npowRec n.succ a)⁻¹
fix: change instance priorities in algebra hierarchy (#5941)

WIP: experiments with changing instance priorities. See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/std4.20.2F.20Lean4.20bump/near/374996945 .

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>

Diff
@@ -579,6 +579,9 @@ class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
   nsmul_succ : ∀ (n : ℕ) (x), nsmul (n + 1) x = x + nsmul n x := by intros; rfl
 #align add_monoid AddMonoid
 
+attribute [instance 150] AddSemigroup.toAdd
+attribute [instance 50] AddZeroClass.toAdd
+
 #align add_monoid.nsmul_zero' AddMonoid.nsmul_zero
 #align add_monoid.nsmul_succ' AddMonoid.nsmul_succ
 
refactor: move all register_simp_attrs to 1 file (#5681)

There are slight differences between mathlib3 and mathlib4 (different set of attributes, different lemmas are in core/std), so I redid the same refactor instead of forward-porting changes.

mathlib3 PR: leanprover-community/mathlib#19223

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 
 ! This file was ported from Lean 3 source module algebra.group.defs
-! leanprover-community/mathlib commit 2e0975f6a25dd3fbfb9e41556a77f075f6269748
+! leanprover-community/mathlib commit 48fb5b5280e7c81672afc9524185ae994553ebf4
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -114,11 +114,6 @@ class Inv (α : Type u) where
 @[inherit_doc]
 postfix:max "⁻¹" => Inv.inv
 
-/-- The simpset `field_simps` is used by the tactic `field_simp` to
-reduce an expression in a field to an expression of the form `n / d` where `n` and `d` are
-division-free. -/
-register_simp_attr field_simps
-
 section Mul
 
 variable [Mul G]
chore: tidy various files (#5233)
Diff
@@ -124,13 +124,13 @@ section Mul
 variable [Mul G]
 
 /-- `leftMul g` denotes left multiplication by `g` -/
-@[to_additive "`left_add g` denotes left addition by `g`"]
+@[to_additive "`leftAdd g` denotes left addition by `g`"]
 def leftMul : G → G → G := fun g : G ↦ fun x : G ↦ g * x
 #align left_mul leftMul
 #align left_add leftAdd
 
 /-- `rightMul g` denotes right multiplication by `g` -/
-@[to_additive "`right_add g` denotes right addition by `g`"]
+@[to_additive "`rightAdd g` denotes right addition by `g`"]
 def rightMul : G → G → G := fun g : G ↦ fun x : G ↦ x * g
 #align right_mul rightMul
 #align right_add rightAdd
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -791,7 +791,7 @@ Those two pairs of made-up classes fulfill slightly different roles.
 `ℤ` action (`zpow` or `zsmul`). Further, it provides a `div` field, matching the forgetful
 inheritance pattern. This is useful to shorten extension clauses of stronger structures (`Group`,
 `GroupWithZero`, `DivisionRing`, `Field`) and for a few structures with a rather weak
-pseudo-inverse (`matrix`).
+pseudo-inverse (`Matrix`).
 
 `DivisionMonoid`/`SubtractionMonoid` is targeted at structures with stronger pseudo-inverses. It
 is an ad hoc collection of axioms that are mainly respected by three things:
@@ -804,7 +804,7 @@ multiplication, except for the fact that it might not be a true inverse (`a / a
 The axioms are pretty arbitrary (many other combinations are equivalent to it), but they are
 independent:
 * Without `DivisionMonoid.div_eq_mul_inv`, you can define `/` arbitrarily.
-* Without `DivisionMonoid.inv_inv`, you can consider `WithTop unit` with `a⁻¹ = ⊤` for all `a`.
+* Without `DivisionMonoid.inv_inv`, you can consider `WithTop Unit` with `a⁻¹ = ⊤` for all `a`.
 * Without `DivisionMonoid.mul_inv_rev`, you can consider `WithTop α` with `a⁻¹ = a` for all `a`
   where `α` non commutative.
 * Without `DivisionMonoid.inv_eq_of_mul`, you can consider any `CommMonoid` with `a⁻¹ = a` for all
feat: add Mathlib.Tactic.Common, and import (#4056)

This makes a mathlib4 version of mathlib3's tactic.basic, now called Mathlib.Tactic.Common, which imports all tactics which do not have significant theory requirements, and then is imported all across the base of the hierarchy.

This ensures that all common tactics are available nearly everywhere in the library, rather than having to be imported one-by-one as you need them.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -12,6 +12,7 @@ Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
 import Mathlib.Logic.Function.Basic
+import Mathlib.Tactic.Common
 
 /-!
 # Typeclasses for (semi)groups and monoids
Revert "feat: add Mathlib.Tactic.Common, and import"

This reverts commit 1ce2f69b.

Diff
@@ -12,7 +12,6 @@ Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
 import Mathlib.Logic.Function.Basic
-import Mathlib.Tactic.Common
 
 /-!
 # Typeclasses for (semi)groups and monoids
feat: add Mathlib.Tactic.Common, and import
Diff
@@ -12,6 +12,7 @@ Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 import Mathlib.Init.ZeroOne
 import Mathlib.Init.Data.Int.Basic
 import Mathlib.Logic.Function.Basic
+import Mathlib.Tactic.Common
 
 /-!
 # Typeclasses for (semi)groups and monoids
perf: improve performance of to_additive (#3632)
  • applyReplacementFun now treats applications f x_1 ... x_n as atomic, and recurses directly into f and x_i (before it recursed on the partial appliations f x_1 ... x_j)
  • I had to reimplement the way to_additive reorders arguments, so at the same time I also made it more flexible. We can now reorder with an arbitrary permutation, and you have to specify this by providing a permutation using cycle notation (e.g. (reorder := 1 2 3, 8 9) means we're permuting the first three arguments and swapping arguments 8 and 9). This implements the first item of #1074.
  • additiveTest now memorizes the test on previously-visited subexpressions. Thanks to @kmill for this suggestion!

The performance on (one of) the slowest declaration(s) to additivize (MonoidLocalization.lift) is summarized below (note: dsimp only refers to adding a single dsimp only tactic in the declaration, which was done in #3580)

original: 27400ms
better applyReplacementFun: 1550ms
better applyReplacementFun + better additiveTest: 176ms

dsimp only: 6710ms
better applyReplacementFun + dsimp only: 425ms
better applyReplacementFun + better additiveTest + dsimp only: 128ms
Diff
@@ -88,16 +88,16 @@ infixl:65 " -ᵥ " => VSub.vsub
 infixr:73 " • " => HSMul.hSMul
 
 attribute [to_additive existing] Mul Div HMul instHMul HDiv instHDiv HSMul
-attribute [to_additive (reorder := 1) SMul] Pow
-attribute [to_additive (reorder := 1)] HPow
-attribute [to_additive existing (reorder := 1 5) hSMul] HPow.hPow
-attribute [to_additive existing (reorder := 1 4) smul] Pow.pow
+attribute [to_additive (reorder := 1 2) SMul] Pow
+attribute [to_additive (reorder := 1 2)] HPow
+attribute [to_additive existing (reorder := 1 2, 5 6) hSMul] HPow.hPow
+attribute [to_additive existing (reorder := 1 2, 4 5) smul] Pow.pow
 
 @[to_additive (attr := default_instance)]
 instance instHSMul [SMul α β] : HSMul α β β where
   hSMul := SMul.smul
 
-attribute [to_additive existing (reorder := 1)] instHPow
+attribute [to_additive existing (reorder := 1 2)] instHPow
 
 universe u
 
feat: support and improve notation_class in simps (#2883)
  • If you write @[simps] for the definition of an AddGroup, it will now generate the correct lemmas for 0, +, nsmul and zsmul using OfNat and heterogenous operations. This is needed for #2609.
    • This is a lot more flexible than the Lean 3 implementation, in order to handle nsmul, zsmul and numerals.
    • It doesn't handle the zpow and npow projections, since their argument order is different than that of HPow.pow (that was likely done for the sake of to_additive, but we can consider to revisit that choice).
  • Also fixes the nvMonoid bug encountered in #2609
    • There was an issue where the wrong projection was chosen, since toDiv is a prefix of toDivInvMonoid
    • Before we were checking if _toDiv is a prefix of your projection with _ prepended (e.g. _toDivInvMonoid), now we are checking whether toDiv_ is a prefix of your projection with _ appended (which doesn't match toDivInvMonoid_).
Diff
@@ -63,6 +63,10 @@ class HSMul (α : Type u) (β : Type v) (γ : outParam (Type w)) where
   The meaning of this notation is type-dependent. -/
   hSMul : α → β → γ
 
+attribute [notation_class  smul Simps.copySecond] HSMul
+attribute [notation_class nsmul Simps.nsmulArgs]  HSMul
+attribute [notation_class zsmul Simps.zsmulArgs]  HSMul
+
 /-- Type class for the `+ᵥ` notation. -/
 class VAdd (G : Type _) (P : Type _) where
   vadd : G → P → P
@@ -100,7 +104,7 @@ universe u
 variable {G : Type _}
 
 /-- Class of types that have an inversion operation. -/
-@[to_additive]
+@[to_additive, notation_class]
 class Inv (α : Type u) where
   /-- Invert an element of α. -/
   inv : α → α
@@ -1175,3 +1179,42 @@ instance (priority := 100) CommGroup.toDivisionCommMonoid : DivisionCommMonoid G
   { ‹CommGroup G›, Group.toDivisionMonoid with }
 
 end CommGroup
+
+/-! We initialize all projections for `@[simps]` here, so that we don't have to do it in later
+files.
+
+Note: the lemmas generated for the `npow`/`zpow` projections will *not* apply to `x ^ y`, since the
+argument order of these projections doesn't match the argument order of `^`.
+The `nsmul`/`zsmul` lemmas will be correct. -/
+initialize_simps_projections Semigroup
+initialize_simps_projections AddSemigroup
+initialize_simps_projections CommSemigroup
+initialize_simps_projections AddCommSemigroup
+initialize_simps_projections LeftCancelSemigroup
+initialize_simps_projections AddLeftCancelSemigroup
+initialize_simps_projections RightCancelSemigroup
+initialize_simps_projections AddRightCancelSemigroup
+initialize_simps_projections Monoid
+initialize_simps_projections AddMonoid
+initialize_simps_projections CommMonoid
+initialize_simps_projections AddCommMonoid
+initialize_simps_projections LeftCancelMonoid
+initialize_simps_projections AddLeftCancelMonoid
+initialize_simps_projections RightCancelMonoid
+initialize_simps_projections AddRightCancelMonoid
+initialize_simps_projections CancelMonoid
+initialize_simps_projections AddCancelMonoid
+initialize_simps_projections CancelCommMonoid
+initialize_simps_projections AddCancelCommMonoid
+initialize_simps_projections DivInvMonoid
+initialize_simps_projections SubNegMonoid
+initialize_simps_projections DivInvOneMonoid
+initialize_simps_projections SubNegZeroMonoid
+initialize_simps_projections DivisionMonoid
+initialize_simps_projections SubtractionMonoid
+initialize_simps_projections DivisionCommMonoid
+initialize_simps_projections SubtractionCommMonoid
+initialize_simps_projections Group
+initialize_simps_projections AddGroup
+initialize_simps_projections CommGroup
+initialize_simps_projections AddCommGroup
chore: don't inline DivInvMonoid default value for Div, for better instance transparency (#1897)

See Zulip. This will make particular DivInvMonoids whose Div field is constructed using the default value (such as ) behave the same way as generic ones, at the instance transparency level, fixing examples such as the following:

import Mathlib.Data.Real.Basic

variable [LinearOrderedField α]

/- `.reducible` transparency works correctly over `ℝ`. -/
example {a b : ℝ} : a / 2 ≤ b / 2 := by
  with_reducible (apply mul_le_mul) -- fails, as desired

/- `.instance` transparency works correctly over a generic field. -/
example {a b : α} : a / 2 ≤ b / 2 := by
  with_reducible_and_instances (apply mul_le_mul) -- fails, as desired

/- `.instance` transparency does not work correctly over `ℝ`. -/
example {a b : ℝ} : a / 2 ≤ b / 2 := by
  with_reducible_and_instances (apply mul_le_mul) -- succeeds, wanted it not to
  all_goals sorry
Diff
@@ -809,6 +809,14 @@ As a consequence, a few natural structures do not fit in this framework. For exa
 respects everything except for the fact that `(0 * ∞)⁻¹ = 0⁻¹ = ∞` while `∞⁻¹ * 0⁻¹ = 0 * ∞ = 0`.
 -/
 
+/-- In a class equipped with instances of both `Monoid` and `Inv`, this definition records what the
+default definition for `Div` would be: `a * b⁻¹`.  This is later provided as the default value for
+the `Div` instance in `DivInvMonoid`.
+
+We keep it as a separate definition rather than inlining it in `DivInvMonoid` so that the `Div`
+field of individual `DivInvMonoid`s constructed using that default value will not be unfolded at
+`.instance` transparency. -/
+def DivInvMonoid.div' {G : Type u} [Monoid G] [Inv G] (a b : G) : G := a * b⁻¹
 
 /-- A `DivInvMonoid` is a `Monoid` with operations `/` and `⁻¹` satisfying
 `div_eq_mul_inv : ∀ a b, a / b = a * b⁻¹`.
@@ -829,7 +837,7 @@ in diamonds. See the definition of `Monoid` and Note [forgetful inheritance] for
 explanations on this.
 -/
 class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
-  div a b := a * b⁻¹
+  div := DivInvMonoid.div'
   /-- `a / b := a * b⁻¹` -/
   div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
   /-- The power operation: `a ^ n = a * ··· * a`; `a ^ (-n) = a⁻¹ * ··· a⁻¹` (`n` times) -/
@@ -843,6 +851,17 @@ class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
   zpow_neg' (n : ℕ) (a : G) : zpow (Int.negSucc n) a = (zpow n.succ a)⁻¹ := by intros; rfl
 #align div_inv_monoid DivInvMonoid
 
+/-- In a class equipped with instances of both `AddMonoid` and `Neg`, this definition records what
+the default definition for `Sub` would be: `a + -b`.  This is later provided as the default value
+for the `Sub` instance in `SubNegMonoid`.
+
+We keep it as a separate definition rather than inlining it in `SubNegMonoid` so that the `Sub`
+field of individual `SubNegMonoid`s constructed using that default value will not be unfolded at
+`.instance` transparency. -/
+def SubNegMonoid.sub' {G : Type u} [AddMonoid G] [Neg G] (a b : G) : G := a + -b
+
+attribute [to_additive existing SubNegMonoid.sub'] DivInvMonoid.div'
+
 /-- A `SubNegMonoid` is an `AddMonoid` with unary `-` and binary `-` operations
 satisfying `sub_eq_add_neg : ∀ a b, a - b = a + -b`.
 
@@ -861,7 +880,7 @@ in diamonds. See the definition of `AddMonoid` and Note [forgetful inheritance]
 explanations on this.
 -/
 class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
-  sub a b := a + -b
+  sub := SubNegMonoid.sub'
   sub_eq_add_neg : ∀ a b : G, a - b = a + -b := by intros; rfl
   zsmul : ℤ → G → G := zsmulRec
   zsmul_zero' : ∀ a : G, zsmul 0 a = 0 := by intros; rfl
feat: add to_additive linter checking whether additive decl exists (#1881)
  • Force the user to specify whether the additive declaration already exists.
  • Will raise a linter error if the user specified it wrongly
  • Requested on Zulip
Diff
@@ -83,17 +83,17 @@ infixl:65 " +ᵥ " => HVAdd.hVAdd
 infixl:65 " -ᵥ " => VSub.vsub
 infixr:73 " • " => HSMul.hSMul
 
-attribute [to_additive] Mul Div HMul instHMul HDiv instHDiv HSMul
+attribute [to_additive existing] Mul Div HMul instHMul HDiv instHDiv HSMul
 attribute [to_additive (reorder := 1) SMul] Pow
 attribute [to_additive (reorder := 1)] HPow
-attribute [to_additive (reorder := 1 5) hSMul] HPow.hPow
-attribute [to_additive (reorder := 1 4) smul] Pow.pow
+attribute [to_additive existing (reorder := 1 5) hSMul] HPow.hPow
+attribute [to_additive existing (reorder := 1 4) smul] Pow.pow
 
 @[to_additive (attr := default_instance)]
 instance instHSMul [SMul α β] : HSMul α β β where
   hSMul := SMul.smul
 
-attribute [to_additive (reorder := 1)] instHPow
+attribute [to_additive existing (reorder := 1)] instHPow
 
 universe u
 
@@ -482,7 +482,7 @@ def nsmulRec [Zero M] [Add M] : ℕ → M → M
   | n + 1, a => a + nsmulRec n a
 #align nsmul_rec nsmulRec
 
-attribute [to_additive] npowRec
+attribute [to_additive existing] npowRec
 
 end
 
@@ -597,7 +597,7 @@ class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
 #align monoid.npow_succ' Monoid.npow_succ
 
 -- Bug #660
-attribute [to_additive] Monoid.toMulOneClass
+attribute [to_additive existing] Monoid.toMulOneClass
 
 @[default_instance high] instance Monoid.Pow {M : Type _} [Monoid M] : Pow M ℕ :=
   ⟨fun x n ↦ Monoid.npow n x⟩
@@ -607,7 +607,7 @@ instance AddMonoid.SMul {M : Type _} [AddMonoid M] : SMul ℕ M :=
   ⟨AddMonoid.nsmul⟩
 #align add_monoid.has_smul_nat AddMonoid.SMul
 
-attribute [to_additive SMul] Monoid.Pow
+attribute [to_additive existing SMul] Monoid.Pow
 
 section
 
@@ -655,7 +655,7 @@ class AddCommMonoid (M : Type u) extends AddMonoid M, AddCommSemigroup M
 class CommMonoid (M : Type u) extends Monoid M, CommSemigroup M
 #align comm_monoid CommMonoid
 
-attribute [to_additive] CommMonoid.toCommSemigroup
+attribute [to_additive existing] CommMonoid.toCommSemigroup
 
 section LeftCancelMonoid
 
@@ -670,7 +670,7 @@ class AddLeftCancelMonoid (M : Type u) extends AddLeftCancelSemigroup M, AddMono
 class LeftCancelMonoid (M : Type u) extends LeftCancelSemigroup M, Monoid M
 #align left_cancel_monoid LeftCancelMonoid
 
-attribute [to_additive] LeftCancelMonoid.toMonoid
+attribute [to_additive existing] LeftCancelMonoid.toMonoid
 
 end LeftCancelMonoid
 
@@ -687,7 +687,7 @@ class AddRightCancelMonoid (M : Type u) extends AddRightCancelSemigroup M, AddMo
 class RightCancelMonoid (M : Type u) extends RightCancelSemigroup M, Monoid M
 #align right_cancel_monoid RightCancelMonoid
 
-attribute [to_additive] RightCancelMonoid.toMonoid
+attribute [to_additive existing] RightCancelMonoid.toMonoid
 
 end RightCancelMonoid
 
@@ -704,7 +704,7 @@ class AddCancelMonoid (M : Type u) extends AddLeftCancelMonoid M, AddRightCancel
 class CancelMonoid (M : Type u) extends LeftCancelMonoid M, RightCancelMonoid M
 #align cancel_monoid CancelMonoid
 
-attribute [to_additive] CancelMonoid.toRightCancelMonoid
+attribute [to_additive existing] CancelMonoid.toRightCancelMonoid
 
 /-- Commutative version of `AddCancelMonoid`. -/
 class AddCancelCommMonoid (M : Type u) extends AddLeftCancelMonoid M, AddCommMonoid M
@@ -715,7 +715,7 @@ class AddCancelCommMonoid (M : Type u) extends AddLeftCancelMonoid M, AddCommMon
 class CancelCommMonoid (M : Type u) extends LeftCancelMonoid M, CommMonoid M
 #align cancel_comm_monoid CancelCommMonoid
 
-attribute [to_additive] CancelCommMonoid.toCommMonoid
+attribute [to_additive existing] CancelCommMonoid.toCommMonoid
 
 -- see Note [lower instance priority]
 @[to_additive]
@@ -750,7 +750,7 @@ def zsmulRec {M : Type _} [Zero M] [Add M] [Neg M] : ℤ → M → M
   | Int.negSucc n, a => -nsmulRec n.succ a
 #align zsmul_rec zsmulRec
 
-attribute [to_additive] zpowRec
+attribute [to_additive existing] zpowRec
 
 section InvolutiveInv
 
@@ -880,7 +880,7 @@ instance SubNegMonoid.SMulInt {M} [SubNegMonoid M] : SMul ℤ M :=
   ⟨SubNegMonoid.zsmul⟩
 #align sub_neg_monoid.has_smul_int SubNegMonoid.SMulInt
 
-attribute [to_additive SubNegMonoid.SMulInt] DivInvMonoid.Pow
+attribute [to_additive existing SubNegMonoid.SMulInt] DivInvMonoid.Pow
 
 section DivInvMonoid
 
@@ -919,7 +919,7 @@ theorem negSucc_zsmul {G} [SubNegMonoid G] (a : G) (n : ℕ) :
   exact SubNegMonoid.zsmul_neg' n a
 #align zsmul_neg_succ_of_nat negSucc_zsmul
 
-attribute [to_additive (attr := simp) negSucc_zsmul] zpow_negSucc
+attribute [to_additive existing (attr := simp) negSucc_zsmul] zpow_negSucc
 
 /-- Dividing by an element is the same as multiplying by its inverse.
 
@@ -960,7 +960,7 @@ class DivInvOneMonoid (G : Type _) extends DivInvMonoid G, InvOneClass G
 #align div_inv_one_monoid DivInvOneMonoid
 
 -- FIXME: `to_additive` is not operating on the second parent. (#660)
-attribute [to_additive] DivInvOneMonoid.toInvOneClass
+attribute [to_additive existing] DivInvOneMonoid.toInvOneClass
 
 variable [InvOneClass G]
 
@@ -993,7 +993,7 @@ class DivisionMonoid (G : Type u) extends DivInvMonoid G, InvolutiveInv G where
   inv_eq_of_mul (a b : G) : a * b = 1 → a⁻¹ = b
 #align division_monoid DivisionMonoid
 
-attribute [to_additive] DivisionMonoid.toInvolutiveInv
+attribute [to_additive existing] DivisionMonoid.toInvolutiveInv
 
 section DivisionMonoid
 
@@ -1024,7 +1024,7 @@ This is the immediate common ancestor of `CommGroup` and `CommGroupWithZero`. -/
 class DivisionCommMonoid (G : Type u) extends DivisionMonoid G, CommMonoid G
 #align division_comm_monoid DivisionCommMonoid
 
-attribute [to_additive] DivisionCommMonoid.toCommMonoid
+attribute [to_additive existing] DivisionCommMonoid.toCommMonoid
 
 /-- A `Group` is a `Monoid` with an operation `⁻¹` satisfying `a⁻¹ * a = 1`.
 
@@ -1133,7 +1133,7 @@ class AddCommGroup (G : Type u) extends AddGroup G, AddCommMonoid G
 class CommGroup (G : Type u) extends Group G, CommMonoid G
 #align comm_group CommGroup
 
-attribute [to_additive] CommGroup.toCommMonoid
+attribute [to_additive existing] CommGroup.toCommMonoid
 
 @[to_additive]
 theorem CommGroup.toGroup_injective {G : Type u} : Function.Injective (@CommGroup.toGroup G) := by
chore: update SHA of already forward-ported files (#2181)

Update some SHAs of files that changed in mathlib3.

These 17 files need mainly only updated SHA as they've been only touched by backports or already have been forward-ported.

The relevant changes are:

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
 
 ! This file was ported from Lean 3 source module algebra.group.defs
-! leanprover-community/mathlib commit 41cf0cc2f528dd40a8f2db167ea4fb37b8fde7f3
+! leanprover-community/mathlib commit 2e0975f6a25dd3fbfb9e41556a77f075f6269748
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -121,10 +121,14 @@ variable [Mul G]
 /-- `leftMul g` denotes left multiplication by `g` -/
 @[to_additive "`left_add g` denotes left addition by `g`"]
 def leftMul : G → G → G := fun g : G ↦ fun x : G ↦ g * x
+#align left_mul leftMul
+#align left_add leftAdd
 
 /-- `rightMul g` denotes right multiplication by `g` -/
 @[to_additive "`right_add g` denotes right addition by `g`"]
 def rightMul : G → G → G := fun g : G ↦ fun x : G ↦ x * g
+#align right_mul rightMul
+#align right_add rightAdd
 
 /-- A mixin for left cancellative multiplication. -/
 class IsLeftCancelMul (G : Type u) [Mul G] : Prop where
@@ -136,11 +140,15 @@ class IsRightCancelMul (G : Type u) [Mul G] : Prop where
   protected mul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
 /-- A mixin for cancellative multiplication. -/
 class IsCancelMul (G : Type u) [Mul G] extends IsLeftCancelMul G, IsRightCancelMul G : Prop
+#align is_cancel_mul IsCancelMul
+#align is_right_cancel_mul IsRightCancelMul
+#align is_left_cancel_mul IsLeftCancelMul
 
 /-- A mixin for left cancellative addition. -/
 class IsLeftCancelAdd (G : Type u) [Add G] : Prop where
   /-- Addition is left cancellative. -/
   protected add_left_cancel : ∀ a b c : G, a + b = a + c → b = c
+#align is_left_cancel_add IsLeftCancelAdd
 
 attribute [to_additive IsLeftCancelAdd] IsLeftCancelMul
 
@@ -148,11 +156,13 @@ attribute [to_additive IsLeftCancelAdd] IsLeftCancelMul
 class IsRightCancelAdd (G : Type u) [Add G] : Prop where
   /-- Addition is right cancellative. -/
   protected add_right_cancel : ∀ a b c : G, a + b = c + b → a = c
+#align is_right_cancel_add IsRightCancelAdd
 
 attribute [to_additive IsRightCancelAdd] IsRightCancelMul
 
 /-- A mixin for cancellative addition. -/
 class IsCancelAdd (G : Type u) [Add G] extends IsLeftCancelAdd G, IsRightCancelAdd G : Prop
+#align is_cancel_add IsCancelAdd
 
 attribute [to_additive IsCancelAdd] IsCancelMul
 
@@ -163,21 +173,31 @@ variable [IsLeftCancelMul G] {a b c : G}
 @[to_additive]
 theorem mul_left_cancel : a * b = a * c → b = c :=
   IsLeftCancelMul.mul_left_cancel a b c
+#align mul_left_cancel mul_left_cancel
+#align add_left_cancel add_left_cancel
 
 @[to_additive]
 theorem mul_left_cancel_iff : a * b = a * c ↔ b = c :=
   ⟨mul_left_cancel, congr_arg _⟩
+#align mul_left_cancel_iff mul_left_cancel_iff
+#align add_left_cancel_iff add_left_cancel_iff
 
 @[to_additive]
 theorem mul_right_injective (a : G) : Function.Injective ((· * ·) a) := fun _ _ ↦ mul_left_cancel
+#align mul_right_injective mul_right_injective
+#align add_right_injective add_right_injective
 
 @[to_additive (attr := simp)]
 theorem mul_right_inj (a : G) {b c : G} : a * b = a * c ↔ b = c :=
   (mul_right_injective a).eq_iff
+#align mul_right_inj mul_right_inj
+#align add_right_inj add_right_inj
 
 @[to_additive]
 theorem mul_ne_mul_right (a : G) {b c : G} : a * b ≠ a * c ↔ b ≠ c :=
   (mul_right_injective a).ne_iff
+#align mul_ne_mul_right mul_ne_mul_right
+#align add_ne_add_right add_ne_add_right
 
 end IsLeftCancelMul
 
@@ -188,21 +208,31 @@ variable [IsRightCancelMul G] {a b c : G}
 @[to_additive]
 theorem mul_right_cancel : a * b = c * b → a = c :=
   IsRightCancelMul.mul_right_cancel a b c
+#align mul_right_cancel mul_right_cancel
+#align add_right_cancel add_right_cancel
 
 @[to_additive]
 theorem mul_right_cancel_iff : b * a = c * a ↔ b = c :=
   ⟨mul_right_cancel, congr_arg (· * a)⟩
+#align mul_right_cancel_iff mul_right_cancel_iff
+#align add_right_cancel_iff add_right_cancel_iff
 
 @[to_additive]
 theorem mul_left_injective (a : G) : Function.Injective (· * a) := fun _ _ ↦ mul_right_cancel
+#align mul_left_injective mul_left_injective
+#align add_left_injective add_left_injective
 
 @[to_additive (attr := simp)]
 theorem mul_left_inj (a : G) {b c : G} : b * a = c * a ↔ b = c :=
   (mul_left_injective a).eq_iff
+#align mul_left_inj mul_left_inj
+#align add_left_inj add_left_inj
 
 @[to_additive]
 theorem mul_ne_mul_left (a : G) {b c : G} : b * a ≠ c * a ↔ b ≠ c :=
   (mul_left_injective a).ne_iff
+#align mul_ne_mul_left mul_ne_mul_left
+#align add_ne_add_left add_ne_add_left
 
 end IsRightCancelMul
 
@@ -213,12 +243,18 @@ end Mul
 class Semigroup (G : Type u) extends Mul G where
   /-- Multiplication is associative -/
   mul_assoc : ∀ a b c : G, a * b * c = a * (b * c)
+#align semigroup Semigroup
+#align semigroup.ext Semigroup.ext
+#align semigroup.ext_iff Semigroup.ext_iff
 
 /-- An additive semigroup is a type with an associative `(+)`. -/
 @[ext]
 class AddSemigroup (G : Type u) extends Add G where
   /-- Addition is associative -/
   add_assoc : ∀ a b c : G, a + b + c = a + (b + c)
+#align add_semigroup AddSemigroup
+#align add_semigroup.ext AddSemigroup.ext
+#align add_semigroup.ext_iff AddSemigroup.ext_iff
 
 attribute [to_additive] Semigroup
 
@@ -229,6 +265,8 @@ variable [Semigroup G]
 @[to_additive]
 theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
   Semigroup.mul_assoc
+#align mul_assoc mul_assoc
+#align add_assoc add_assoc
 
 @[to_additive]
 instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
@@ -243,12 +281,18 @@ end Semigroup
 class CommSemigroup (G : Type u) extends Semigroup G where
   /-- Multiplication is commutative in a commutative semigroup. -/
   mul_comm : ∀ a b : G, a * b = b * a
+#align comm_semigroup CommSemigroup
+#align comm_semigroup.ext_iff CommSemigroup.ext_iff
+#align comm_semigroup.ext CommSemigroup.ext
 
 /-- A commutative additive semigroup is a type with an associative commutative `(+)`. -/
 @[ext]
 class AddCommSemigroup (G : Type u) extends AddSemigroup G where
   /-- Addition is commutative in an additive commutative semigroup. -/
   add_comm : ∀ a b : G, a + b = b + a
+#align add_comm_semigroup AddCommSemigroup
+#align add_comm_semigroup.ext AddCommSemigroup.ext
+#align add_comm_semigroup.ext_iff AddCommSemigroup.ext_iff
 
 attribute [to_additive] CommSemigroup
 
@@ -259,6 +303,8 @@ variable [CommSemigroup G]
 @[to_additive]
 theorem mul_comm : ∀ a b : G, a * b = b * a :=
   CommSemigroup.mul_comm
+#align mul_comm mul_comm
+#align add_comm add_comm
 
 @[to_additive]
 instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
@@ -316,12 +362,18 @@ end CommSemigroup
 @[ext]
 class LeftCancelSemigroup (G : Type u) extends Semigroup G where
   mul_left_cancel : ∀ a b c : G, a * b = a * c → b = c
+#align left_cancel_semigroup LeftCancelSemigroup
+#align left_cancel_semigroup.ext_iff LeftCancelSemigroup.ext_iff
+#align left_cancel_semigroup.ext LeftCancelSemigroup.ext
 
 /-- An `AddLeftCancelSemigroup` is an additive semigroup such that
 `a + b = a + c` implies `b = c`. -/
 @[ext]
 class AddLeftCancelSemigroup (G : Type u) extends AddSemigroup G where
   add_left_cancel : ∀ a b c : G, a + b = a + c → b = c
+#align add_left_cancel_semigroup AddLeftCancelSemigroup
+#align add_left_cancel_semigroup.ext AddLeftCancelSemigroup.ext
+#align add_left_cancel_semigroup.ext_iff AddLeftCancelSemigroup.ext_iff
 
 attribute [to_additive] LeftCancelSemigroup
 
@@ -338,12 +390,18 @@ instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
 @[ext]
 class RightCancelSemigroup (G : Type u) extends Semigroup G where
   mul_right_cancel : ∀ a b c : G, a * b = c * b → a = c
+#align right_cancel_semigroup RightCancelSemigroup
+#align right_cancel_semigroup.ext_iff RightCancelSemigroup.ext_iff
+#align right_cancel_semigroup.ext RightCancelSemigroup.ext
 
 /-- An `AddRightCancelSemigroup` is an additive semigroup such that
 `a + b = c + b` implies `a = c`. -/
 @[ext]
 class AddRightCancelSemigroup (G : Type u) extends AddSemigroup G where
   add_right_cancel : ∀ a b c : G, a + b = c + b → a = c
+#align add_right_cancel_semigroup AddRightCancelSemigroup
+#align add_right_cancel_semigroup.ext_iff AddRightCancelSemigroup.ext_iff
+#align add_right_cancel_semigroup.ext AddRightCancelSemigroup.ext
 
 attribute [to_additive] RightCancelSemigroup
 
@@ -363,6 +421,7 @@ class MulOneClass (M : Type u) extends One M, Mul M where
   one_mul : ∀ a : M, 1 * a = a
   /-- One is a right neutral element for multiplication -/
   mul_one : ∀ a : M, a * 1 = a
+#align mul_one_class MulOneClass
 
 /-- Typeclass for expressing that a type `M` with addition and a zero satisfies
 `0 + a = a` and `a + 0 = a` for all `a : M`. -/
@@ -371,6 +430,7 @@ class AddZeroClass (M : Type u) extends Zero M, Add M where
   zero_add : ∀ a : M, 0 + a = a
   /-- Zero is a right neutral element for addition -/
   add_zero : ∀ a : M, a + 0 = a
+#align add_zero_class AddZeroClass
 
 attribute [to_additive] MulOneClass
 
@@ -381,6 +441,8 @@ theorem MulOneClass.ext {M : Type u} : ∀ ⦃m₁ m₂ : MulOneClass M⦄, m₁
   -- congr
   suffices one₁ = one₂ by cases this; rfl
   exact (one_mul₂ one₁).symm.trans (mul_one₁ one₂)
+#align mul_one_class.ext MulOneClass.ext
+#align add_zero_class.ext AddZeroClass.ext
 
 section MulOneClass
 
@@ -389,10 +451,14 @@ variable {M : Type u} [MulOneClass M]
 @[to_additive (attr := simp)]
 theorem one_mul : ∀ a : M, 1 * a = a :=
   MulOneClass.one_mul
+#align one_mul one_mul
+#align zero_add zero_add
 
 @[to_additive (attr := simp)]
 theorem mul_one : ∀ a : M, a * 1 = a :=
   MulOneClass.mul_one
+#align mul_one mul_one
+#align add_zero add_zero
 
 end MulOneClass
 
@@ -407,12 +473,14 @@ Use instead `a ^ n`,  which has better definitional behavior. -/
 def npowRec [One M] [Mul M] : ℕ → M → M
   | 0, _ => 1
   | n + 1, a => a * npowRec n a
+#align npow_rec npowRec
 
 /-- The fundamental scalar multiplication in an additive monoid. `nsmulRec n a = a+a+...+a` n
 times. Use instead `n • a`, which has better definitional behavior. -/
 def nsmulRec [Zero M] [Add M] : ℕ → M → M
   | 0, _ => 0
   | n + 1, a => a + nsmulRec n a
+#align nsmul_rec nsmulRec
 
 attribute [to_additive] npowRec
 
@@ -509,6 +577,7 @@ class AddMonoid (M : Type u) extends AddSemigroup M, AddZeroClass M where
   nsmul_zero : ∀ x, nsmul 0 x = 0 := by intros; rfl
   /-- Multiplication by `(n + 1 : ℕ)` behaves as expected. -/
   nsmul_succ : ∀ (n : ℕ) (x), nsmul (n + 1) x = x + nsmul n x := by intros; rfl
+#align add_monoid AddMonoid
 
 #align add_monoid.nsmul_zero' AddMonoid.nsmul_zero
 #align add_monoid.nsmul_succ' AddMonoid.nsmul_succ
@@ -522,6 +591,7 @@ class Monoid (M : Type u) extends Semigroup M, MulOneClass M where
   npow_zero : ∀ x, npow 0 x = 1 := by intros; rfl
   /-- Raising to the power `(n + 1 : ℕ)` behaves as expected. -/
   npow_succ : ∀ (n : ℕ) (x), npow (n + 1) x = x * npow n x := by intros; rfl
+#align monoid Monoid
 
 #align monoid.npow_zero' Monoid.npow_zero
 #align monoid.npow_succ' Monoid.npow_succ
@@ -546,15 +616,21 @@ variable {M : Type _} [Monoid M]
 @[to_additive (attr := simp) nsmul_eq_smul]
 theorem npow_eq_pow (n : ℕ) (x : M) : Monoid.npow n x = x ^ n :=
   rfl
+#align npow_eq_pow npow_eq_pow
+#align nsmul_eq_smul nsmul_eq_smul
 
 -- the attributes are intentionally out of order. `zero_smul` proves `zero_nsmul`.
 @[to_additive zero_nsmul, simp]
 theorem pow_zero (a : M) : a ^ 0 = 1 :=
   Monoid.npow_zero _
+#align pow_zero pow_zero
+#align zero_nsmul zero_nsmul
 
 @[to_additive succ_nsmul]
 theorem pow_succ (a : M) (n : ℕ) : a ^ (n + 1) = a * a ^ n :=
   Monoid.npow_succ n a
+#align pow_succ pow_succ
+#align succ_nsmul succ_nsmul
 
 end
 
@@ -565,15 +641,19 @@ variable {M : Type u} [Monoid M]
 @[to_additive]
 theorem left_inv_eq_right_inv {a b c : M} (hba : b * a = 1) (hac : a * c = 1) : b = c := by
   rw [← one_mul c, ← hba, mul_assoc, hac, mul_one b]
+#align left_inv_eq_right_inv left_inv_eq_right_inv
+#align left_neg_eq_right_neg left_neg_eq_right_neg
 
 end Monoid
 
 /-- An additive commutative monoid is an additive monoid with commutative `(+)`. -/
 class AddCommMonoid (M : Type u) extends AddMonoid M, AddCommSemigroup M
+#align add_comm_monoid AddCommMonoid
 
 /-- A commutative monoid is a monoid with commutative `(*)`. -/
 @[to_additive]
 class CommMonoid (M : Type u) extends Monoid M, CommSemigroup M
+#align comm_monoid CommMonoid
 
 attribute [to_additive] CommMonoid.toCommSemigroup
 
@@ -583,10 +663,12 @@ section LeftCancelMonoid
 Main examples are `ℕ` and groups. This is the right typeclass for many sum lemmas, as having a zero
 is useful to define the sum over the empty set, so `AddLeftCancelSemigroup` is not enough. -/
 class AddLeftCancelMonoid (M : Type u) extends AddLeftCancelSemigroup M, AddMonoid M
+#align add_left_cancel_monoid AddLeftCancelMonoid
 
 /-- A monoid in which multiplication is left-cancellative. -/
 @[to_additive]
 class LeftCancelMonoid (M : Type u) extends LeftCancelSemigroup M, Monoid M
+#align left_cancel_monoid LeftCancelMonoid
 
 attribute [to_additive] LeftCancelMonoid.toMonoid
 
@@ -598,10 +680,12 @@ section RightCancelMonoid
 Main examples are `ℕ` and groups. This is the right typeclass for many sum lemmas, as having a zero
 is useful to define the sum over the empty set, so `AddRightCancelSemigroup` is not enough. -/
 class AddRightCancelMonoid (M : Type u) extends AddRightCancelSemigroup M, AddMonoid M
+#align add_right_cancel_monoid AddRightCancelMonoid
 
 /-- A monoid in which multiplication is right-cancellative. -/
 @[to_additive]
 class RightCancelMonoid (M : Type u) extends RightCancelSemigroup M, Monoid M
+#align right_cancel_monoid RightCancelMonoid
 
 attribute [to_additive] RightCancelMonoid.toMonoid
 
@@ -613,19 +697,23 @@ section CancelMonoid
 Main examples are `ℕ` and groups. This is the right typeclass for many sum lemmas, as having a zero
 is useful to define the sum over the empty set, so `AddRightCancelMonoid` is not enough. -/
 class AddCancelMonoid (M : Type u) extends AddLeftCancelMonoid M, AddRightCancelMonoid M
+#align add_cancel_monoid AddCancelMonoid
 
 /-- A monoid in which multiplication is cancellative. -/
 @[to_additive]
 class CancelMonoid (M : Type u) extends LeftCancelMonoid M, RightCancelMonoid M
+#align cancel_monoid CancelMonoid
 
 attribute [to_additive] CancelMonoid.toRightCancelMonoid
 
 /-- Commutative version of `AddCancelMonoid`. -/
 class AddCancelCommMonoid (M : Type u) extends AddLeftCancelMonoid M, AddCommMonoid M
+#align add_cancel_comm_monoid AddCancelCommMonoid
 
 /-- Commutative version of `CancelMonoid`. -/
 @[to_additive]
 class CancelCommMonoid (M : Type u) extends LeftCancelMonoid M, CommMonoid M
+#align cancel_comm_monoid CancelCommMonoid
 
 attribute [to_additive] CancelCommMonoid.toCommMonoid
 
@@ -653,12 +741,14 @@ Use instead `a ^ n`,  which has better definitional behavior. -/
 def zpowRec {M : Type _} [One M] [Mul M] [Inv M] : ℤ → M → M
   | Int.ofNat n, a => npowRec n a
   | Int.negSucc n, a => (npowRec n.succ a)⁻¹
+#align zpow_rec zpowRec
 
 /-- The fundamental scalar multiplication in an additive group. `zpowRec n a = a+a+...+a` n
 times, for integer `n`. Use instead `n • a`, which has better definitional behavior. -/
 def zsmulRec {M : Type _} [Zero M] [Add M] [Neg M] : ℤ → M → M
   | Int.ofNat n, a => nsmulRec n a
   | Int.negSucc n, a => -nsmulRec n.succ a
+#align zsmul_rec zsmulRec
 
 attribute [to_additive] zpowRec
 
@@ -682,6 +772,8 @@ variable [InvolutiveInv G]
 @[to_additive (attr := simp)]
 theorem inv_inv (a : G) : a⁻¹⁻¹ = a :=
   InvolutiveInv.inv_inv _
+#align inv_inv inv_inv
+#align neg_neg neg_neg
 
 end InvolutiveInv
 
@@ -749,6 +841,7 @@ class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
     intros; rfl
   /-- `a ^ -(n + 1) = (a ^ (n + 1))⁻¹` -/
   zpow_neg' (n : ℕ) (a : G) : zpow (Int.negSucc n) a = (zpow n.succ a)⁻¹ := by intros; rfl
+#align div_inv_monoid DivInvMonoid
 
 /-- A `SubNegMonoid` is an `AddMonoid` with unary `-` and binary `-` operations
 satisfying `sub_eq_add_neg : ∀ a b, a - b = a + -b`.
@@ -775,6 +868,7 @@ class SubNegMonoid (G : Type u) extends AddMonoid G, Neg G, Sub G where
   zsmul_succ' (n : ℕ) (a : G) : zsmul (Int.ofNat n.succ) a = a + zsmul (Int.ofNat n) a := by
     intros; rfl
   zsmul_neg' (n : ℕ) (a : G) : zsmul (Int.negSucc n) a = -zsmul n.succ a := by intros; rfl
+#align sub_neg_monoid SubNegMonoid
 
 attribute [to_additive SubNegMonoid] DivInvMonoid
 
@@ -795,9 +889,13 @@ variable [DivInvMonoid G] {a b : G}
 @[to_additive (attr := simp) zsmul_eq_smul] theorem zpow_eq_pow (n : ℤ) (x : G) :
     DivInvMonoid.zpow n x = x ^ n :=
   rfl
+#align zsmul_eq_smul zsmul_eq_smul
+#align zpow_eq_pow zpow_eq_pow
 
 @[to_additive (attr := simp) zero_zsmul] theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
   DivInvMonoid.zpow_zero' a
+#align zpow_zero zpow_zero
+#align zero_zsmul zero_zsmul
 
 @[to_additive (attr := norm_cast) ofNat_zsmul]
 theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
@@ -831,8 +929,11 @@ This is a duplicate of `DivInvMonoid.div_eq_mul_inv` ensuring that the types unf
 This is a duplicate of `SubNegMonoid.sub_eq_mul_neg` ensuring that the types unfold better."]
 theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
   DivInvMonoid.div_eq_mul_inv _ _
+#align div_eq_mul_inv div_eq_mul_inv
+#align sub_eq_add_neg sub_eq_add_neg
 
 alias div_eq_mul_inv ← division_def
+#align division_def division_def
 
 end DivInvMonoid
 
@@ -841,18 +942,22 @@ section InvOneClass
 /-- Typeclass for expressing that `-0 = 0`. -/
 class NegZeroClass (G : Type _) extends Zero G, Neg G where
   neg_zero : -(0 : G) = 0
+#align neg_zero_class NegZeroClass
 
 /-- A `SubNegMonoid` where `-0 = 0`. -/
 class SubNegZeroMonoid (G : Type _) extends SubNegMonoid G, NegZeroClass G
+#align sub_neg_zero_monoid SubNegZeroMonoid
 
 /-- Typeclass for expressing that `1⁻¹ = 1`. -/
 @[to_additive]
 class InvOneClass (G : Type _) extends One G, Inv G where
   inv_one : (1 : G)⁻¹ = 1
+#align inv_one_class InvOneClass
 
 /-- A `DivInvMonoid` where `1⁻¹ = 1`. -/
 @[to_additive SubNegZeroMonoid]
 class DivInvOneMonoid (G : Type _) extends DivInvMonoid G, InvOneClass G
+#align div_inv_one_monoid DivInvOneMonoid
 
 -- FIXME: `to_additive` is not operating on the second parent. (#660)
 attribute [to_additive] DivInvOneMonoid.toInvOneClass
@@ -862,6 +967,8 @@ variable [InvOneClass G]
 @[to_additive (attr := simp)]
 theorem inv_one : (1 : G)⁻¹ = 1 :=
   InvOneClass.inv_one
+#align inv_one inv_one
+#align neg_zero neg_zero
 
 end InvOneClass
 
@@ -872,6 +979,7 @@ class SubtractionMonoid (G : Type u) extends SubNegMonoid G, InvolutiveNeg G whe
   /- Despite the asymmetry of `neg_eq_of_add`, the symmetric version is true thanks to the
   involutivity of negation. -/
   neg_eq_of_add (a b : G) : a + b = 0 → -a = b
+#align subtraction_monoid SubtractionMonoid
 
 /-- A `DivisionMonoid` is a `DivInvMonoid` with involutive inversion and such that
 `(a * b)⁻¹ = b⁻¹ * a⁻¹` and `a * b = 1 → a⁻¹ = b`.
@@ -883,6 +991,7 @@ class DivisionMonoid (G : Type u) extends DivInvMonoid G, InvolutiveInv G where
   /- Despite the asymmetry of `inv_eq_of_mul`, the symmetric version is true thanks to the
   involutivity of inversion. -/
   inv_eq_of_mul (a b : G) : a * b = 1 → a⁻¹ = b
+#align division_monoid DivisionMonoid
 
 attribute [to_additive] DivisionMonoid.toInvolutiveInv
 
@@ -893,21 +1002,27 @@ variable [DivisionMonoid G] {a b : G}
 @[to_additive (attr := simp) neg_add_rev]
 theorem mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹ :=
   DivisionMonoid.mul_inv_rev _ _
+#align mul_inv_rev mul_inv_rev
+#align neg_add_rev neg_add_rev
 
 @[to_additive]
 theorem inv_eq_of_mul_eq_one_right : a * b = 1 → a⁻¹ = b :=
   DivisionMonoid.inv_eq_of_mul _ _
+#align inv_eq_of_mul_eq_one_right inv_eq_of_mul_eq_one_right
+#align neg_eq_of_add_eq_zero_right neg_eq_of_add_eq_zero_right
 
 end DivisionMonoid
 
 /-- Commutative `SubtractionMonoid`. -/
 class SubtractionCommMonoid (G : Type u) extends SubtractionMonoid G, AddCommMonoid G
+#align subtraction_comm_monoid SubtractionCommMonoid
 
 /-- Commutative `DivisionMonoid`.
 
 This is the immediate common ancestor of `CommGroup` and `CommGroupWithZero`. -/
 @[to_additive SubtractionCommMonoid]
 class DivisionCommMonoid (G : Type u) extends DivisionMonoid G, CommMonoid G
+#align division_comm_monoid DivisionCommMonoid
 
 attribute [to_additive] DivisionCommMonoid.toCommMonoid
 
@@ -918,6 +1033,7 @@ with a default so that `a / b = a * b⁻¹` holds by definition.
 -/
 class Group (G : Type u) extends DivInvMonoid G where
   mul_left_inv : ∀ a : G, a⁻¹ * a = 1
+#align group Group
 
 /-- An `AddGroup` is an `AddMonoid` with a unary `-` satisfying `-a + a = 0`.
 
@@ -926,6 +1042,7 @@ with a default so that `a - b = a + -b` holds by definition.
 -/
 class AddGroup (A : Type u) extends SubNegMonoid A where
   add_left_neg : ∀ a : A, -a + a = 0
+#align add_group AddGroup
 
 attribute [to_additive] Group
 
@@ -936,10 +1053,14 @@ variable [Group G] {a b c : G}
 @[to_additive (attr := simp)]
 theorem mul_left_inv : ∀ a : G, a⁻¹ * a = 1 :=
   Group.mul_left_inv
+#align mul_left_inv mul_left_inv
+#align add_left_neg add_left_neg
 
 @[to_additive]
 theorem inv_mul_self (a : G) : a⁻¹ * a = 1 :=
   mul_left_inv a
+#align inv_mul_self inv_mul_self
+#align neg_add_self neg_add_self
 
 @[to_additive]
 private theorem inv_eq_of_mul (h : a * b = 1) : a⁻¹ = b :=
@@ -948,26 +1069,38 @@ private theorem inv_eq_of_mul (h : a * b = 1) : a⁻¹ = b :=
 @[to_additive (attr := simp)]
 theorem mul_right_inv (a : G) : a * a⁻¹ = 1 :=
   by rw [← mul_left_inv a⁻¹, inv_eq_of_mul (mul_left_inv a)]
+#align mul_right_inv mul_right_inv
+#align add_right_neg add_right_neg
 
 @[to_additive]
 theorem mul_inv_self (a : G) : a * a⁻¹ = 1 :=
   mul_right_inv a
+#align mul_inv_self mul_inv_self
+#align add_neg_self add_neg_self
 
 @[to_additive (attr := simp)]
 theorem inv_mul_cancel_left (a b : G) : a⁻¹ * (a * b) = b :=
   by rw [← mul_assoc, mul_left_inv, one_mul]
+#align inv_mul_cancel_left inv_mul_cancel_left
+#align neg_add_cancel_left neg_add_cancel_left
 
 @[to_additive (attr := simp)]
 theorem mul_inv_cancel_left (a b : G) : a * (a⁻¹ * b) = b :=
   by rw [← mul_assoc, mul_right_inv, one_mul]
+#align mul_inv_cancel_left mul_inv_cancel_left
+#align add_neg_cancel_left add_neg_cancel_left
 
 @[to_additive (attr := simp)]
 theorem mul_inv_cancel_right (a b : G) : a * b * b⁻¹ = a :=
   by rw [mul_assoc, mul_right_inv, mul_one]
+#align mul_inv_cancel_right mul_inv_cancel_right
+#align add_neg_cancel_right add_neg_cancel_right
 
 @[to_additive (attr := simp)]
 theorem inv_mul_cancel_right (a b : G) : a * b⁻¹ * b = a :=
   by rw [mul_assoc, mul_left_inv, mul_one]
+#align inv_mul_cancel_right inv_mul_cancel_right
+#align neg_add_cancel_right neg_add_cancel_right
 
 @[to_additive AddGroup.toSubtractionMonoid]
 instance (priority := 100) Group.toDivisionMonoid : DivisionMonoid G :=
@@ -993,10 +1126,12 @@ theorem Group.toDivInvMonoid_injective {G : Type _} :
 
 /-- An additive commutative group is an additive group with commutative `(+)`. -/
 class AddCommGroup (G : Type u) extends AddGroup G, AddCommMonoid G
+#align add_comm_group AddCommGroup
 
 /-- A commutative group is a group with commutative `(*)`. -/
 @[to_additive]
 class CommGroup (G : Type u) extends Group G, CommMonoid G
+#align comm_group CommGroup
 
 attribute [to_additive] CommGroup.toCommMonoid
 
chore: add #align statements for to_additive decls (#1816)

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>

Diff
@@ -234,6 +234,7 @@ theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c) :=
 instance Semigroup.to_isAssociative : IsAssociative G (· * ·) :=
   ⟨mul_assoc⟩
 #align semigroup.to_is_associative Semigroup.to_isAssociative
+#align add_semigroup.to_is_associative AddSemigroup.to_isAssociative
 
 end Semigroup
 
@@ -263,6 +264,7 @@ theorem mul_comm : ∀ a b : G, a * b = b * a :=
 instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
   ⟨mul_comm⟩
 #align comm_semigroup.to_is_commutative CommSemigroup.to_isCommutative
+#align add_comm_semigroup.to_is_commutative AddCommSemigroup.to_isCommutative
 
 /-- Any `CommSemigroup G` that satisfies `IsRightCancelMul G` also satisfies
 `IsLeftCancelMul G`. -/
@@ -273,6 +275,7 @@ lemma CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemigro
     [IsRightCancelMul G] : IsLeftCancelMul G :=
   ⟨fun _ _ _ h => mul_right_cancel <| (mul_comm _ _).trans (h.trans (mul_comm _ _))⟩
 #align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
+#align add_comm_semigroup.is_right_cancel_add.to_is_left_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsLeftCancelAdd
 
 /-- Any `CommSemigroup G` that satisfies `IsLeftCancelMul G` also satisfies
 `IsRightCancelMul G`. -/
@@ -283,6 +286,7 @@ lemma CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigro
     [IsLeftCancelMul G] : IsRightCancelMul G :=
   ⟨fun _ _ _ h => mul_left_cancel <| (mul_comm _ _).trans (h.trans (mul_comm _ _))⟩
 #align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
+#align add_comm_semigroup.is_left_cancel_add.to_is_right_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsRightCancelAdd
 
 /-- Any `CommSemigroup G` that satisfies `IsLeftCancelMul G` also satisfies
 `IsCancelMul G`. -/
@@ -293,6 +297,7 @@ lemma CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
   [IsLeftCancelMul G] : IsCancelMul G :=
   { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul G with }
 #align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
+#align add_comm_semigroup.is_left_cancel_add.to_is_cancel_add AddCommSemigroup.IsLeftCancelAdd.toIsCancelAdd
 
 /-- Any `CommSemigroup G` that satisfies `IsRightCancelMul G` also satisfies
 `IsCancelMul G`. -/
@@ -303,6 +308,7 @@ lemma CommSemigroup.IsRightCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G
     [IsRightCancelMul G] : IsCancelMul G :=
   { CommSemigroup.IsRightCancelMul.toIsLeftCancelMul G with }
 #align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommSemigroup.IsRightCancelMul.toIsCancelMul
+#align add_comm_semigroup.is_right_cancel_add.to_is_cancel_add AddCommSemigroup.IsRightCancelAdd.toIsCancelAdd
 
 end CommSemigroup
 
@@ -326,6 +332,7 @@ instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
     [LeftCancelSemigroup G] : IsLeftCancelMul G :=
   { mul_left_cancel := LeftCancelSemigroup.mul_left_cancel }
 #align left_cancel_semigroup.to_is_left_cancel_mul LeftCancelSemigroup.toIsLeftCancelMul
+#align add_left_cancel_semigroup.to_is_left_cancel_add AddLeftCancelSemigroup.toIsLeftCancelAdd
 
 /-- A `RightCancelSemigroup` is a semigroup such that `a * b = c * b` implies `a = c`. -/
 @[ext]
@@ -347,6 +354,7 @@ instance (priority := 100) RightCancelSemigroup.toIsRightCancelMul (G : Type u)
     [RightCancelSemigroup G] : IsRightCancelMul G :=
   { mul_right_cancel := RightCancelSemigroup.mul_right_cancel }
 #align right_cancel_semigroup.to_is_right_cancel_mul RightCancelSemigroup.toIsRightCancelMul
+#align add_right_cancel_semigroup.to_is_right_cancel_add AddRightCancelSemigroup.toIsRightCancelAdd
 
 /-- Typeclass for expressing that a type `M` with multiplication and a one satisfies
 `1 * a = a` and `a * 1 = a` for all `a : M`. -/
@@ -627,6 +635,7 @@ instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelC
     CancelMonoid M :=
   { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul M with }
 #align cancel_comm_monoid.to_cancel_monoid CancelCommMonoid.toCancelMonoid
+#align add_cancel_comm_monoid.to_cancel_add_monoid AddCancelCommMonoid.toAddCancelMonoid
 
 /-- Any `CancelMonoid G` satisfies `IsCancelMul G`. -/
 @[to_additive toIsCancelAdd "Any `AddCancelMonoid G` satisfies `IsCancelAdd G`."]
@@ -799,6 +808,7 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
     _ = a ^ (n + 1) := (pow_succ _ _).symm
 #align zpow_coe_nat zpow_ofNat
 #align zpow_of_nat zpow_ofNat
+#align of_nat_zsmul ofNat_zsmul
 
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ (Int.negSucc n) = (a ^ (n + 1))⁻¹ := by
   rw [← zpow_ofNat]
@@ -979,6 +989,7 @@ end Group
 theorem Group.toDivInvMonoid_injective {G : Type _} :
     Function.Injective (@Group.toDivInvMonoid G) := by rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
 #align group.to_div_inv_monoid_injective Group.toDivInvMonoid_injective
+#align add_group.to_sub_neg_add_monoid_injective AddGroup.toSubNegAddMonoid_injective
 
 /-- An additive commutative group is an additive group with commutative `(+)`. -/
 class AddCommGroup (G : Type u) extends AddGroup G, AddCommMonoid G
@@ -993,6 +1004,7 @@ attribute [to_additive] CommGroup.toCommMonoid
 theorem CommGroup.toGroup_injective {G : Type u} : Function.Injective (@CommGroup.toGroup G) := by
   rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
 #align comm_group.to_group_injective CommGroup.toGroup_injective
+#align add_comm_group.to_add_group_injective AddCommGroup.toAddGroup_injective
 
 section CommGroup
 
fix: to_additive translates pow to nsmul (#1502)
  • I tried translating it to smul in #715, but that was a bad decision
  • It is possible that some lemmas that want to be called smul now use nsmul. This doesn't raise an error unless they are aligned or explicitly used elsewhere.
  • Rename some lemmas from smul to nsmul.
  • Zulip

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -84,9 +84,10 @@ infixl:65 " -ᵥ " => VSub.vsub
 infixr:73 " • " => HSMul.hSMul
 
 attribute [to_additive] Mul Div HMul instHMul HDiv instHDiv HSMul
-attribute [to_additive (reorder := 1)] Pow HPow
-attribute [to_additive (reorder := 1 5)] HPow.hPow
-attribute [to_additive (reorder := 1 4)] Pow.pow
+attribute [to_additive (reorder := 1) SMul] Pow
+attribute [to_additive (reorder := 1)] HPow
+attribute [to_additive (reorder := 1 5) hSMul] HPow.hPow
+attribute [to_additive (reorder := 1 4) smul] Pow.pow
 
 @[to_additive (attr := default_instance)]
 instance instHSMul [SMul α β] : HSMul α β β where
@@ -528,13 +529,13 @@ instance AddMonoid.SMul {M : Type _} [AddMonoid M] : SMul ℕ M :=
   ⟨AddMonoid.nsmul⟩
 #align add_monoid.has_smul_nat AddMonoid.SMul
 
-attribute [to_additive] Monoid.Pow
+attribute [to_additive SMul] Monoid.Pow
 
 section
 
 variable {M : Type _} [Monoid M]
 
-@[to_additive (attr := simp)]
+@[to_additive (attr := simp) nsmul_eq_smul]
 theorem npow_eq_pow (n : ℕ) (x : M) : Monoid.npow n x = x ^ n :=
   rfl
 
@@ -782,7 +783,7 @@ section DivInvMonoid
 
 variable [DivInvMonoid G] {a b : G}
 
-@[to_additive (attr := simp)] theorem zpow_eq_pow (n : ℤ) (x : G) :
+@[to_additive (attr := simp) zsmul_eq_smul] theorem zpow_eq_pow (n : ℤ) (x : G) :
     DivInvMonoid.zpow n x = x ^ n :=
   rfl
 
chore: fix most phantom #aligns (#1794)
Diff
@@ -774,7 +774,7 @@ instance DivInvMonoid.Pow {M} [DivInvMonoid M] : Pow M ℤ :=
 
 instance SubNegMonoid.SMulInt {M} [SubNegMonoid M] : SMul ℤ M :=
   ⟨SubNegMonoid.zsmul⟩
-#align sub_neg_moonoid.has_smul_int SubNegMonoid.SMulInt
+#align sub_neg_monoid.has_smul_int SubNegMonoid.SMulInt
 
 attribute [to_additive SubNegMonoid.SMulInt] DivInvMonoid.Pow
 
chore: the style linter shouldn't complain about long #align lines (#1643)
Diff
@@ -271,8 +271,7 @@ instance CommSemigroup.to_isCommutative : IsCommutative G (· * ·) :=
 lemma CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemigroup G]
     [IsRightCancelMul G] : IsLeftCancelMul G :=
   ⟨fun _ _ _ h => mul_right_cancel <| (mul_comm _ _).trans (h.trans (mul_comm _ _))⟩
-#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul
-  CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
+#align comm_semigroup.is_right_cancel_mul.to_is_left_cancel_mul CommSemigroup.IsRightCancelMul.toIsLeftCancelMul
 
 /-- Any `CommSemigroup G` that satisfies `IsLeftCancelMul G` also satisfies
 `IsRightCancelMul G`. -/
@@ -282,8 +281,7 @@ lemma CommSemigroup.IsRightCancelMul.toIsLeftCancelMul (G : Type u) [CommSemigro
 lemma CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigroup G]
     [IsLeftCancelMul G] : IsRightCancelMul G :=
   ⟨fun _ _ _ h => mul_left_cancel <| (mul_comm _ _).trans (h.trans (mul_comm _ _))⟩
-#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul
-  CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
+#align comm_semigroup.is_left_cancel_mul.to_is_right_cancel_mul CommSemigroup.IsLeftCancelMul.toIsRightCancelMul
 
 /-- Any `CommSemigroup G` that satisfies `IsLeftCancelMul G` also satisfies
 `IsCancelMul G`. -/
@@ -293,8 +291,7 @@ lemma CommSemigroup.IsLeftCancelMul.toIsRightCancelMul (G : Type u) [CommSemigro
 lemma CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
   [IsLeftCancelMul G] : IsCancelMul G :=
   { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul G with }
-#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul
-  CommSemigroup.IsLeftCancelMul.toIsCancelMul
+#align comm_semigroup.is_left_cancel_mul.to_is_cancel_mul CommSemigroup.IsLeftCancelMul.toIsCancelMul
 
 /-- Any `CommSemigroup G` that satisfies `IsRightCancelMul G` also satisfies
 `IsCancelMul G`. -/
@@ -304,8 +301,7 @@ lemma CommSemigroup.IsLeftCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
 lemma CommSemigroup.IsRightCancelMul.toIsCancelMul (G : Type u) [CommSemigroup G]
     [IsRightCancelMul G] : IsCancelMul G :=
   { CommSemigroup.IsRightCancelMul.toIsLeftCancelMul G with }
-#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul
-  CommSemigroup.IsRightCancelMul.toIsCancelMul
+#align comm_semigroup.is_right_cancel_mul.to_is_cancel_mul CommSemigroup.IsRightCancelMul.toIsCancelMul
 
 end CommSemigroup
 
@@ -328,8 +324,7 @@ attribute [to_additive] LeftCancelSemigroup
 instance (priority := 100) LeftCancelSemigroup.toIsLeftCancelMul (G : Type u)
     [LeftCancelSemigroup G] : IsLeftCancelMul G :=
   { mul_left_cancel := LeftCancelSemigroup.mul_left_cancel }
-#align left_cancel_semigroup.to_is_left_cancel_mul
-  LeftCancelSemigroup.toIsLeftCancelMul
+#align left_cancel_semigroup.to_is_left_cancel_mul LeftCancelSemigroup.toIsLeftCancelMul
 
 /-- A `RightCancelSemigroup` is a semigroup such that `a * b = c * b` implies `a = c`. -/
 @[ext]
feat: port Algebra.BigOperators.Multiset.Basic (#1526)

Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>

Diff
@@ -626,7 +626,7 @@ class CancelCommMonoid (M : Type u) extends LeftCancelMonoid M, CommMonoid M
 attribute [to_additive] CancelCommMonoid.toCommMonoid
 
 -- see Note [lower instance priority]
-@[to_additive CancelCommMonoid.toAddCancelMonoid]
+@[to_additive]
 instance (priority := 100) CancelCommMonoid.toCancelMonoid (M : Type u) [CancelCommMonoid M] :
     CancelMonoid M :=
   { CommSemigroup.IsLeftCancelMul.toIsRightCancelMul M with }
Diff
@@ -79,21 +79,21 @@ class SMul (M : Type _) (α : Type _) where
   smul : M → α → α
 #align has_smul SMul
 
-instance instHVAdd [VAdd α β] : HVAdd α β β where
-  hVAdd := VAdd.vadd
-
-instance instHSMul [SMul α β] : HSMul α β β where
-  hSMul := SMul.smul
-
 infixl:65 " +ᵥ " => HVAdd.hVAdd
 infixl:65 " -ᵥ " => VSub.vsub
 infixr:73 " • " => HSMul.hSMul
 
-attribute [to_additive] Mul Div HMul instHMul HDiv instHDiv instHSMul HSMul
-attribute [to_additive (reorder := 1)] Pow instHPow HPow
+attribute [to_additive] Mul Div HMul instHMul HDiv instHDiv HSMul
+attribute [to_additive (reorder := 1)] Pow HPow
 attribute [to_additive (reorder := 1 5)] HPow.hPow
 attribute [to_additive (reorder := 1 4)] Pow.pow
 
+@[to_additive (attr := default_instance)]
+instance instHSMul [SMul α β] : HSMul α β β where
+  hSMul := SMul.smul
+
+attribute [to_additive (reorder := 1)] instHPow
+
 universe u
 
 variable {G : Type _}
feat: improve the way to_additive deals with attributes (#1314)
  • The new syntax for any attributes that need to be copied by to_additive is @[to_additive (attrs := simp, ext, simps)]
  • Adds the auxiliary declarations generated by the simp and simps attributes to the to_additive-dictionary.
  • Future issue: Does not yet translate auxiliary declarations for other attributes (including custom simp-attributes). In particular it's possible that norm_cast might generate some auxiliary declarations.
  • Fixes #950
  • Fixes #953
  • Fixes #1149
  • This moves the interaction between to_additive and simps from the Simps file to the toAdditive file for uniformity.
  • Make the same changes to @[reassoc]

Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -74,7 +74,7 @@ class VSub (G : outParam (Type _)) (P : Type _) where
 #align has_vsub VSub
 
 /-- Typeclass for types with a scalar multiplication operation, denoted `•` (`\bu`) -/
-@[ext, to_additive]
+@[to_additive (attr := ext)]
 class SMul (M : Type _) (α : Type _) where
   smul : M → α → α
 #align has_smul SMul
@@ -170,7 +170,7 @@ theorem mul_left_cancel_iff : a * b = a * c ↔ b = c :=
 @[to_additive]
 theorem mul_right_injective (a : G) : Function.Injective ((· * ·) a) := fun _ _ ↦ mul_left_cancel
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_right_inj (a : G) {b c : G} : a * b = a * c ↔ b = c :=
   (mul_right_injective a).eq_iff
 
@@ -195,7 +195,7 @@ theorem mul_right_cancel_iff : b * a = c * a ↔ b = c :=
 @[to_additive]
 theorem mul_left_injective (a : G) : Function.Injective (· * a) := fun _ _ ↦ mul_right_cancel
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_left_inj (a : G) {b c : G} : b * a = c * a ↔ b = c :=
   (mul_left_injective a).eq_iff
 
@@ -370,7 +370,7 @@ class AddZeroClass (M : Type u) extends Zero M, Add M where
 
 attribute [to_additive] MulOneClass
 
-@[ext, to_additive]
+@[to_additive (attr := ext)]
 theorem MulOneClass.ext {M : Type u} : ∀ ⦃m₁ m₂ : MulOneClass M⦄, m₁.mul = m₂.mul → m₁ = m₂ := by
   rintro @⟨⟨one₁⟩, ⟨mul₁⟩, one_mul₁, mul_one₁⟩ @⟨⟨one₂⟩, ⟨mul₂⟩, one_mul₂, mul_one₂⟩ ⟨rfl⟩
   -- FIXME (See https://github.com/leanprover/lean4/issues/1711)
@@ -382,11 +382,11 @@ section MulOneClass
 
 variable {M : Type u} [MulOneClass M]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem one_mul : ∀ a : M, 1 * a = a :=
   MulOneClass.one_mul
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_one : ∀ a : M, a * 1 = a :=
   MulOneClass.mul_one
 
@@ -539,7 +539,7 @@ section
 
 variable {M : Type _} [Monoid M]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem npow_eq_pow (n : ℕ) (x : M) : Monoid.npow n x = x ^ n :=
   rfl
 
@@ -674,7 +674,7 @@ class InvolutiveInv (G : Type _) extends Inv G where
 
 variable [InvolutiveInv G]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem inv_inv (a : G) : a⁻¹⁻¹ = a :=
   InvolutiveInv.inv_inv _
 
@@ -787,14 +787,14 @@ section DivInvMonoid
 
 variable [DivInvMonoid G] {a b : G}
 
-@[simp, to_additive] theorem zpow_eq_pow (n : ℤ) (x : G) :
+@[to_additive (attr := simp)] theorem zpow_eq_pow (n : ℤ) (x : G) :
     DivInvMonoid.zpow n x = x ^ n :=
   rfl
 
-@[simp, to_additive zero_zsmul] theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
+@[to_additive (attr := simp) zero_zsmul] theorem zpow_zero (a : G) : a ^ (0 : ℤ) = 1 :=
   DivInvMonoid.zpow_zero' a
 
-@[norm_cast, to_additive ofNat_zsmul]
+@[to_additive (attr := norm_cast) ofNat_zsmul]
 theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
   | 0 => (zpow_zero _).trans (pow_zero _).symm
   | n + 1 => calc
@@ -804,20 +804,18 @@ theorem zpow_ofNat (a : G) : ∀ n : ℕ, a ^ (n : ℤ) = a ^ n
 #align zpow_coe_nat zpow_ofNat
 #align zpow_of_nat zpow_ofNat
 
-@[simp]
 theorem zpow_negSucc (a : G) (n : ℕ) : a ^ (Int.negSucc n) = (a ^ (n + 1))⁻¹ := by
   rw [← zpow_ofNat]
   exact DivInvMonoid.zpow_neg' n a
 #align zpow_neg_succ_of_nat zpow_negSucc
 
-@[simp]
 theorem negSucc_zsmul {G} [SubNegMonoid G] (a : G) (n : ℕ) :
   Int.negSucc n • a = -((n + 1) • a) := by
   rw [← ofNat_zsmul]
   exact SubNegMonoid.zsmul_neg' n a
 #align zsmul_neg_succ_of_nat negSucc_zsmul
 
-attribute [to_additive negSucc_zsmul] zpow_negSucc
+attribute [to_additive (attr := simp) negSucc_zsmul] zpow_negSucc
 
 /-- Dividing by an element is the same as multiplying by its inverse.
 
@@ -855,7 +853,7 @@ attribute [to_additive] DivInvOneMonoid.toInvOneClass
 
 variable [InvOneClass G]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem inv_one : (1 : G)⁻¹ = 1 :=
   InvOneClass.inv_one
 
@@ -886,7 +884,7 @@ section DivisionMonoid
 
 variable [DivisionMonoid G] {a b : G}
 
-@[simp, to_additive neg_add_rev]
+@[to_additive (attr := simp) neg_add_rev]
 theorem mul_inv_rev (a b : G) : (a * b)⁻¹ = b⁻¹ * a⁻¹ :=
   DivisionMonoid.mul_inv_rev _ _
 
@@ -929,7 +927,7 @@ section Group
 
 variable [Group G] {a b c : G}
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_left_inv : ∀ a : G, a⁻¹ * a = 1 :=
   Group.mul_left_inv
 
@@ -941,7 +939,7 @@ theorem inv_mul_self (a : G) : a⁻¹ * a = 1 :=
 private theorem inv_eq_of_mul (h : a * b = 1) : a⁻¹ = b :=
   left_inv_eq_right_inv (inv_mul_self a) h
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_right_inv (a : G) : a * a⁻¹ = 1 :=
   by rw [← mul_left_inv a⁻¹, inv_eq_of_mul (mul_left_inv a)]
 
@@ -949,19 +947,19 @@ theorem mul_right_inv (a : G) : a * a⁻¹ = 1 :=
 theorem mul_inv_self (a : G) : a * a⁻¹ = 1 :=
   mul_right_inv a
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem inv_mul_cancel_left (a b : G) : a⁻¹ * (a * b) = b :=
   by rw [← mul_assoc, mul_left_inv, one_mul]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_inv_cancel_left (a b : G) : a * (a⁻¹ * b) = b :=
   by rw [← mul_assoc, mul_right_inv, one_mul]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem mul_inv_cancel_right (a b : G) : a * b * b⁻¹ = a :=
   by rw [mul_assoc, mul_right_inv, mul_one]
 
-@[simp, to_additive]
+@[to_additive (attr := simp)]
 theorem inv_mul_cancel_right (a b : G) : a * b⁻¹ * b = a :=
   by rw [mul_assoc, mul_left_inv, mul_one]
 
chore: Algebra.Group fix smul align (#1435)
Diff
@@ -77,7 +77,7 @@ class VSub (G : outParam (Type _)) (P : Type _) where
 @[ext, to_additive]
 class SMul (M : Type _) (α : Type _) where
   smul : M → α → α
-#align has_scalar SMul
+#align has_smul SMul
 
 instance instHVAdd [VAdd α β] : HVAdd α β β where
   hVAdd := VAdd.vadd
fix: to_additive relevant argument configuration (#1332)

This fixes the first error in #1238

Diff
@@ -90,8 +90,6 @@ infixl:65 " -ᵥ " => VSub.vsub
 infixr:73 " • " => HSMul.hSMul
 
 attribute [to_additive] Mul Div HMul instHMul HDiv instHDiv instHSMul HSMul
-attribute [to_additive_relevant_arg 3] HMul HAdd HPow HSMul
-attribute [to_additive_relevant_arg 3] HAdd.hAdd HMul.hMul HPow.hPow HSMul.hSMul
 attribute [to_additive (reorder := 1)] Pow instHPow HPow
 attribute [to_additive (reorder := 1 5)] HPow.hPow
 attribute [to_additive (reorder := 1 4)] Pow.pow
chore: fix more casing errors per naming scheme (#1232)

I've avoided anything under Tactic or test.

In correcting the names, I found Option.isNone_iff_eq_none duplicated between Std and Mathlib, so the Mathlib one has been removed.

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -419,18 +419,18 @@ end
 library_note "forgetful inheritance"/--
 Suppose that one can put two mathematical structures on a type, a rich one `R` and a poor one
 `P`, and that one can deduce the poor structure from the rich structure through a map `F` (called a
-forgetful functor) (think `R = metric_space` and `P = topological_space`). A possible
+forgetful functor) (think `R = MetricSpace` and `P = TopologicalSpace`). A possible
 implementation would be to have a type class `rich` containing a field `R`, a type class `poor`
 containing a field `P`, and an instance from `rich` to `poor`. However, this creates diamond
 problems, and a better approach is to let `rich` extend `poor` and have a field saying that
 `F R = P`.
 
-To illustrate this, consider the pair `metric_space` / `topological_space`. Consider the topology
+To illustrate this, consider the pair `MetricSpace` / `TopologicalSpace`. Consider the topology
 on a product of two metric spaces. With the first approach, it could be obtained by going first from
 each metric space to its topology, and then taking the product topology. But it could also be
 obtained by considering the product metric space (with its sup distance) and then the topology
 coming from this distance. These would be the same topology, but not definitionally, which means
-that from the point of view of Lean's kernel, there would be two different `topological_space`
+that from the point of view of Lean's kernel, there would be two different `TopologicalSpace`
 instances on the product. This is not compatible with the way instances are designed and used:
 there should be at most one instance of a kind on each type. This approach has created an instance
 diamond that does not commute definitionally.
@@ -448,8 +448,8 @@ product space, and would create exponential complexity when working with product
 such complicated spaces, that are avoided by bundling things carefully as above.
 
 Note that this description of this specific case of the product of metric spaces is oversimplified
-compared to mathlib, as there is an intermediate typeclass between `metric_space` and
-`topological_space` called `uniform_space`. The above scheme is used at both levels, embedding a
+compared to mathlib, as there is an intermediate typeclass between `MetricSpace` and
+`TopologicalSpace` called `UniformSpace`. The above scheme is used at both levels, embedding a
 topology in the uniform space structure, and a uniform structure in the metric space structure.
 
 Note also that, when `P` is a proposition, there is no such issue as any two proofs of `P` are
@@ -460,7 +460,7 @@ creating a rich structure if one doesn't want to do something special about them
 in the definition of metric spaces, default tactics fill the uniform space fields if they are
 not given explicitly. One can also have a helper function creating the rich structure from a
 structure with fewer fields, where the helper function fills the remaining fields. See for instance
-`uniform_space.of_core` or `real_inner_product.of_core`.
+`UniformSpace.ofCore` or `RealInnerProduct.ofCore`.
 
 For more details on this question, called the forgetful inheritance pattern, see [Competing
 inheritance paths in dependent type theory: a case study in functional
@@ -474,8 +474,8 @@ analysis](https://hal.inria.fr/hal-02463336).
 An `AddMonoid` has a natural `ℕ`-action, defined by `n • a = a + ... + a`, that we want to declare
 as an instance as it makes it possible to use the language of linear algebra. However, there are
 often other natural `ℕ`-actions. For instance, for any semiring `R`, the space of polynomials
-`polynomial R` has a natural `R`-action defined by multiplication on the coefficients. This means
-that `polynomial ℕ` would have two natural `ℕ`-actions, which are equal but not defeq. The same
+`Polynomial R` has a natural `R`-action defined by multiplication on the coefficients. This means
+that `Polynomial ℕ` would have two natural `ℕ`-actions, which are equal but not defeq. The same
 goes for linear maps, tensor products, and so on (and even for `ℕ` itself).
 
 To solve this issue, we embed an `ℕ`-action in the definition of an `AddMonoid` (which is by
@@ -483,9 +483,9 @@ default equal to the naive action `a + ... + a`, but can be adjusted when needed
 a `SMul ℕ α` instance using this action. See Note [forgetful inheritance] for more
 explanations on this pattern.
 
-For example, when we define `polynomial R`, then we declare the `ℕ`-action to be by multiplication
+For example, when we define `Polynomial R`, then we declare the `ℕ`-action to be by multiplication
 on each coefficient (using the `ℕ`-action on `R` that comes from the fact that `R` is
-an `AddMonoid`). In this way, the two natural `SMul ℕ (polynomial ℕ)` instances are defeq.
+an `AddMonoid`). In this way, the two natural `SMul ℕ (Polynomial ℕ)` instances are defeq.
 
 The tactic `to_additive` transfers definitions and results from multiplicative monoids to additive
 monoids. To work, it has to map fields to fields. This means that we should also add corresponding
chore: fix casing per naming scheme (#1183)

Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2, add_monoid_hom --> AddMonoidHom

Remove \n from to_additive docstrings that were inserted by mathport.

Move files and directories with Gcd and Smul to GCD and SMul

Diff
@@ -697,20 +697,20 @@ pseudo-inverse (`matrix`).
 is an ad hoc collection of axioms that are mainly respected by three things:
 * Groups
 * Groups with zero
-* The pointwise monoids `set α`, `finset α`, `filter α`
+* The pointwise monoids `Set α`, `Finset α`, `Filter α`
 
 It acts as a middle ground for structures with an inversion operator that plays well with
 multiplication, except for the fact that it might not be a true inverse (`a / a ≠ 1` in general).
 The axioms are pretty arbitrary (many other combinations are equivalent to it), but they are
 independent:
 * Without `DivisionMonoid.div_eq_mul_inv`, you can define `/` arbitrarily.
-* Without `DivisionMonoid.inv_inv`, you can consider `with_top unit` with `a⁻¹ = ⊤` for all `a`.
-* Without `DivisionMonoid.mul_inv_rev`, you can consider `with_top α` with `a⁻¹ = a` for all `a`
+* Without `DivisionMonoid.inv_inv`, you can consider `WithTop unit` with `a⁻¹ = ⊤` for all `a`.
+* Without `DivisionMonoid.mul_inv_rev`, you can consider `WithTop α` with `a⁻¹ = a` for all `a`
   where `α` non commutative.
 * Without `DivisionMonoid.inv_eq_of_mul`, you can consider any `CommMonoid` with `a⁻¹ = a` for all
   `a`.
 
-As a consequence, a few natural structures do not fit in this framework. For example, `ennreal`
+As a consequence, a few natural structures do not fit in this framework. For example, `ENNReal`
 respects everything except for the fact that `(0 * ∞)⁻¹ = 0⁻¹ = ∞` while `∞⁻¹ * 0⁻¹ = 0 * ∞ = 0`.
 -/
 
@@ -826,7 +826,7 @@ attribute [to_additive negSucc_zsmul] zpow_negSucc
 This is a duplicate of `DivInvMonoid.div_eq_mul_inv` ensuring that the types unfold better.
 -/
 @[to_additive "Subtracting an element is the same as adding by its negative.
-This is a duplicate of `sub_neg_monoid.sub_eq_mul_neg` ensuring that the types unfold better."]
+This is a duplicate of `SubNegMonoid.sub_eq_mul_neg` ensuring that the types unfold better."]
 theorem div_eq_mul_inv (a b : G) : a / b = a * b⁻¹ :=
   DivInvMonoid.div_eq_mul_inv _ _
 
@@ -848,7 +848,7 @@ class SubNegZeroMonoid (G : Type _) extends SubNegMonoid G, NegZeroClass G
 class InvOneClass (G : Type _) extends One G, Inv G where
   inv_one : (1 : G)⁻¹ = 1
 
-/-- A `div_inv_monoid` where `1⁻¹ = 1`. -/
+/-- A `DivInvMonoid` where `1⁻¹ = 1`. -/
 @[to_additive SubNegZeroMonoid]
 class DivInvOneMonoid (G : Type _) extends DivInvMonoid G, InvOneClass G
 
chore: tidy various files (#1145)
Diff
@@ -903,13 +903,13 @@ class SubtractionCommMonoid (G : Type u) extends SubtractionMonoid G, AddCommMon
 
 /-- Commutative `DivisionMonoid`.
 
-This is the immediate common ancestor of `comm_group` and `CommGroupWithZero`. -/
+This is the immediate common ancestor of `CommGroup` and `CommGroupWithZero`. -/
 @[to_additive SubtractionCommMonoid]
 class DivisionCommMonoid (G : Type u) extends DivisionMonoid G, CommMonoid G
 
 attribute [to_additive] DivisionCommMonoid.toCommMonoid
 
-/-- A `group` is a `monoid` with an operation `⁻¹` satisfying `a⁻¹ * a = 1`.
+/-- A `Group` is a `Monoid` with an operation `⁻¹` satisfying `a⁻¹ * a = 1`.
 
 There is also a division operation `/` such that `a / b = a * b⁻¹`,
 with a default so that `a / b = a * b⁻¹` holds by definition.
chore: add source headers to ported theory files (#1094)

The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md

Diff
@@ -2,6 +2,11 @@
 Copyright (c) 2014 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
+
+! This file was ported from Lean 3 source module algebra.group.defs
+! leanprover-community/mathlib commit 41cf0cc2f528dd40a8f2db167ea4fb37b8fde7f3
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
 -/
 
 import Mathlib.Init.ZeroOne

Dependencies

1 files ported (100.0%)
926 lines ported (100.0%)

All dependencies are ported!