@@ -28,11 +28,11 @@ Most of the proofs come from the properties of `SemiconjBy`.
28
28
-/
29
29
30
30
31
- variable {G : Type *}
31
+ variable {G M S : Type *}
32
32
33
33
/-- Two elements commute if `a * b = b * a`. -/
34
34
@[to_additive "Two elements additively commute if `a + b = b + a`"]
35
- def Commute {S : Type *} [Mul S] (a b : S) : Prop :=
35
+ def Commute [Mul S] (a b : S) : Prop :=
36
36
SemiconjBy a b b
37
37
#align commute Commute
38
38
#align add_commute AddCommute
@@ -41,13 +41,13 @@ def Commute {S : Type*} [Mul S] (a b : S) : Prop :=
41
41
Two elements `a` and `b` commute if `a * b = b * a`.
42
42
-/
43
43
@[to_additive]
44
- theorem commute_iff_eq {S : Type *} [Mul S] (a b : S) : Commute a b ↔ a * b = b * a := Iff.rfl
44
+ theorem commute_iff_eq [Mul S] (a b : S) : Commute a b ↔ a * b = b * a := Iff.rfl
45
45
46
46
namespace Commute
47
47
48
48
section Mul
49
49
50
- variable {S : Type *} [Mul S]
50
+ variable [Mul S]
51
51
52
52
/-- Equality behind `Commute a b`; useful for rewriting. -/
53
53
@[to_additive "Equality behind `AddCommute a b`; useful for rewriting."]
@@ -97,7 +97,7 @@ end Mul
97
97
98
98
section Semigroup
99
99
100
- variable {S : Type *} [Semigroup S] {a b c : S}
100
+ variable [Semigroup S] {a b c : S}
101
101
102
102
/-- If `a` commutes with both `b` and `c`, then it commutes with their product. -/
103
103
@[to_additive (attr := simp)
@@ -140,15 +140,15 @@ protected theorem mul_mul_mul_comm (hbc : Commute b c) (a d : S) :
140
140
end Semigroup
141
141
142
142
@[to_additive]
143
- protected theorem all {S : Type *} [CommMagma S] (a b : S) : Commute a b :=
143
+ protected theorem all [CommMagma S] (a b : S) : Commute a b :=
144
144
mul_comm a b
145
145
#align commute.all Commute.allₓ
146
146
#align add_commute.all AddCommute.allₓ
147
147
-- not sure why this needs an `ₓ`, maybe instance names not aligned?
148
148
149
149
section MulOneClass
150
150
151
- variable {M : Type *} [MulOneClass M]
151
+ variable [MulOneClass M]
152
152
153
153
@[to_additive (attr := simp)]
154
154
theorem one_right (a : M) : Commute a 1 :=
@@ -168,7 +168,7 @@ end MulOneClass
168
168
169
169
section Monoid
170
170
171
- variable {M : Type *} [Monoid M] {a b : M}
171
+ variable [Monoid M] {a b : M}
172
172
173
173
@[to_additive (attr := simp)]
174
174
theorem pow_right (h : Commute a b) (n : ℕ) : Commute a (b ^ n) :=
@@ -216,6 +216,11 @@ theorem pow_pow_self (a : M) (m n : ℕ) : Commute (a ^ m) (a ^ n) :=
216
216
#align add_commute.nsmul_nsmul_self AddCommute.nsmul_nsmul_selfₓ
217
217
-- `MulOneClass.toHasMul` vs. `MulOneClass.toMul`
218
218
219
+ @[to_additive] lemma mul_pow (h : Commute a b) : ∀ n, (a * b) ^ n = a ^ n * b ^ n
220
+ | 0 => by rw [pow_zero, pow_zero, pow_zero, one_mul]
221
+ | n + 1 => by simp only [pow_succ', h.mul_pow n, ← mul_assoc, (h.pow_left n).right_comm]
222
+ #align commute.mul_pow Commute.mul_pow
223
+
219
224
end Monoid
220
225
221
226
section DivisionMonoid
@@ -232,6 +237,13 @@ protected theorem inv (hab : Commute a b) : (a * b)⁻¹ = a⁻¹ * b⁻¹ := by
232
237
#align commute.inv Commute.inv
233
238
#align add_commute.neg AddCommute.neg
234
239
240
+ @[to_additive AddCommute.zsmul_add]
241
+ protected lemma mul_zpow (h : Commute a b) : ∀ n : ℤ, (a * b) ^ n = a ^ n * b ^ n
242
+ | (n : ℕ) => by simp [zpow_natCast, h.mul_pow n]
243
+ | .negSucc n => by simp [h.mul_pow, (h.pow_pow _ _).eq, mul_inv_rev]
244
+ #align commute.mul_zpow Commute.mul_zpow
245
+ #align add_commute.zsmul_add AddCommute.zsmul_add
246
+
235
247
end DivisionMonoid
236
248
237
249
section Group
@@ -253,3 +265,31 @@ theorem mul_inv_cancel_assoc (h : Commute a b) : a * (b * a⁻¹) = b := by
253
265
end Group
254
266
255
267
end Commute
268
+
269
+ set_option linter.deprecated false
270
+
271
+ section Monoid
272
+ variable [Monoid M]
273
+
274
+ @[to_additive bit0_nsmul]
275
+ lemma pow_bit0 (a : M) (n : ℕ) : a ^ bit0 n = a ^ n * a ^ n := pow_add _ _ _
276
+ #align pow_bit0 pow_bit0
277
+ #align bit0_nsmul bit0_nsmul
278
+
279
+ @[to_additive bit1_nsmul]
280
+ lemma pow_bit1 (a : M) (n : ℕ) : a ^ bit1 n = a ^ n * a ^ n * a := by rw [bit1, pow_succ, pow_bit0]
281
+ #align pow_bit1 pow_bit1
282
+ #align bit1_nsmul bit1_nsmul
283
+
284
+ @[to_additive bit0_nsmul']
285
+ lemma pow_bit0' (a : M) (n : ℕ) : a ^ bit0 n = (a * a) ^ n := by
286
+ rw [pow_bit0, (Commute.refl a).mul_pow]
287
+ #align pow_bit0' pow_bit0'
288
+ #align bit0_nsmul' bit0_nsmul'
289
+
290
+ @[to_additive bit1_nsmul']
291
+ lemma pow_bit1' (a : M) (n : ℕ) : a ^ bit1 n = (a * a) ^ n * a := by rw [bit1, pow_succ, pow_bit0']
292
+ #align pow_bit1' pow_bit1'
293
+ #align bit1_nsmul' bit1_nsmul'
294
+
295
+ end Monoid
0 commit comments