Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit b31af6d

Browse files
urkuderic-wieser
andcommitted
refactor(algebra/group): move monoid.has_pow etc to algebra.group.defs (#10147)
This way we can state theorems about `pow`/`nsmul` using notation `^` and `•` right away. Also move some `ext` lemmas to a new file and rewrite proofs using properties of `monoid_hom`s. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent 16af388 commit b31af6d

File tree

31 files changed

+368
-399
lines changed

31 files changed

+368
-399
lines changed

src/algebra/algebra/subalgebra.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ S.to_subsemiring.nsmul_mem hx n
107107

108108
theorem zsmul_mem {R : Type u} {A : Type v} [comm_ring R] [ring A]
109109
[algebra R A] (S : subalgebra R A) {x : A} (hx : x ∈ S) : ∀ (n : ℤ), n • x ∈ S
110-
| (n : ℕ) := by { rw [zsmul_coe_nat], exact S.nsmul_mem hx n }
110+
| (n : ℕ) := by { rw [coe_nat_zsmul], exact S.nsmul_mem hx n }
111111
| -[1+ n] := by { rw [zsmul_neg_succ_of_nat], exact S.neg_mem (S.nsmul_mem hx _) }
112112

113113
theorem coe_nat_mem (n : ℕ) : (n : A) ∈ S :=

src/algebra/big_operators/basic.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,11 @@ variables [comm_group β]
12251225
lemma prod_inv_distrib : (∏ x in s, (f x)⁻¹) = (∏ x in s, f x)⁻¹ :=
12261226
(monoid_hom.map_prod (comm_group.inv_monoid_hom : β →* β) f s).symm
12271227

1228+
@[to_additive zsmul_sum]
1229+
lemma prod_zpow (f : α → β) (s : finset α) (n : ℤ) :
1230+
(∏ a in s, f a) ^ n = ∏ a in s, (f a) ^ n :=
1231+
(zpow_group_hom n : β →* β).map_prod f s
1232+
12281233
end comm_group
12291234

12301235
@[simp] theorem card_sigma {σ : α → Type*} (s : finset α) (t : Π a, finset (σ a)) :
@@ -1257,10 +1262,6 @@ theorem card_eq_sum_card_image [decidable_eq β] (f : α → β) (s : finset α)
12571262
s.card = ∑ a in s.image f, (s.filter (λ x, f x = a)).card :=
12581263
card_eq_sum_card_fiberwise (λ _, mem_image_of_mem _)
12591264

1260-
lemma zsmul_sum (α β : Type) [add_comm_group β] {f : α → β} {s : finset α} (z : ℤ) :
1261-
zsmul z (∑ a in s, f a) = ∑ a in s, zsmul z (f a) :=
1262-
add_monoid_hom.map_sum (zsmul_add_group_hom z : β →+ β) f s
1263-
12641265
@[simp] lemma sum_sub_distrib [add_comm_group β] :
12651266
∑ x in s, (f x - g x) = (∑ x in s, f x) - (∑ x in s, g x) :=
12661267
by simpa only [sub_eq_add_neg] using sum_add_distrib.trans (congr_arg _ sum_neg_distrib)

src/algebra/group/commute.lean

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,32 +90,49 @@ end mul_one_class
9090

9191
section monoid
9292

93-
variables {M : Type*} [monoid M]
93+
variables {M : Type*} [monoid M] {a b : M} {u u₁ u₂ : units M}
9494

95-
@[to_additive] theorem units_inv_right {a : M} {u : units M} : commute a u → commute a ↑u⁻¹ :=
95+
@[simp, to_additive]
96+
theorem pow_right (h : commute a b) (n : ℕ) : commute a (b ^ n) := h.pow_right n
97+
@[simp, to_additive]
98+
theorem pow_left (h : commute a b) (n : ℕ) : commute (a ^ n) b := (h.symm.pow_right n).symm
99+
@[simp, to_additive]
100+
theorem pow_pow (h : commute a b) (m n : ℕ) : commute (a ^ m) (b ^ n) :=
101+
(h.pow_left m).pow_right n
102+
103+
@[simp, to_additive]
104+
theorem self_pow (a : M) (n : ℕ) : commute a (a ^ n) := (commute.refl a).pow_right n
105+
@[simp, to_additive]
106+
theorem pow_self (a : M) (n : ℕ) : commute (a ^ n) a := (commute.refl a).pow_left n
107+
@[simp, to_additive]
108+
theorem pow_pow_self (a : M) (m n : ℕ) : commute (a ^ m) (a ^ n) :=
109+
(commute.refl a).pow_pow m n
110+
111+
@[to_additive succ_nsmul'] theorem _root_.pow_succ' (a : M) (n : ℕ) : a ^ (n + 1) = a ^ n * a :=
112+
(pow_succ a n).trans (self_pow _ _)
113+
114+
@[to_additive] theorem units_inv_right : commute a u → commute a ↑u⁻¹ :=
96115
semiconj_by.units_inv_right
97116

98-
@[simp, to_additive] theorem units_inv_right_iff {a : M} {u : units M} :
117+
@[simp, to_additive] theorem units_inv_right_iff :
99118
commute a ↑u⁻¹ ↔ commute a u :=
100119
semiconj_by.units_inv_right_iff
101120

102-
@[to_additive] theorem units_inv_left {u : units M} {a : M} : commute ↑u a → commute ↑u⁻¹ a :=
121+
@[to_additive] theorem units_inv_left : commute ↑u a → commute ↑u⁻¹ a :=
103122
semiconj_by.units_inv_symm_left
104123

105124
@[simp, to_additive]
106-
theorem units_inv_left_iff {u : units M} {a : M}: commute ↑u⁻¹ a ↔ commute ↑u a :=
125+
theorem units_inv_left_iff: commute ↑u⁻¹ a ↔ commute ↑u a :=
107126
semiconj_by.units_inv_symm_left_iff
108127

109-
variables {u₁ u₂ : units M}
110-
111128
@[to_additive]
112129
theorem units_coe : commute u₁ u₂ → commute (u₁ : M) u₂ := semiconj_by.units_coe
113130
@[to_additive]
114131
theorem units_of_coe : commute (u₁ : M) u₂ → commute u₁ u₂ := semiconj_by.units_of_coe
115132
@[simp, to_additive]
116133
theorem units_coe_iff : commute (u₁ : M) u₂ ↔ commute u₁ u₂ := semiconj_by.units_coe_iff
117134

118-
@[to_additive] lemma is_unit_mul_iff {a b : M} (h : commute a b) :
135+
@[to_additive] lemma is_unit_mul_iff (h : commute a b) :
119136
is_unit (a * b) ↔ is_unit a ∧ is_unit b :=
120137
begin
121138
refine ⟨_, λ H, H.1.mul H.2⟩,
@@ -131,7 +148,7 @@ begin
131148
rw [mul_assoc, ← hu, u.inv_mul] }
132149
end
133150

134-
@[simp, to_additive] lemma _root_.is_unit_mul_self_iff {a : M} :
151+
@[simp, to_additive] lemma _root_.is_unit_mul_self_iff :
135152
is_unit (a * a) ↔ is_unit a :=
136153
(commute.refl a).is_unit_mul_iff.trans (and_self _)
137154

0 commit comments

Comments
 (0)