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

Commit 84d27b4

Browse files
committed
refactor(group_theory/group_action/defs): generalize smul_mul_assoc and mul_smul_comm (#7441)
These lemmas did not need a full algebra structure; written this way, it permits usage on `has_scalar (units R) A` given `algebra R A` (in some future PR). For now, the old algebra lemmas are left behind, to minimize the scope of this patch.
1 parent 140e17b commit 84d27b4

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

src/algebra/algebra/basic.lean

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,22 @@ algebra.commutes' r x
167167
theorem left_comm (r : R) (x y : A) : x * (algebra_map R A r * y) = algebra_map R A r * (x * y) :=
168168
by rw [← mul_assoc, ← commutes, mul_assoc]
169169

170-
@[simp] lemma mul_smul_comm (s : R) (x y : A) :
170+
instance _root_.is_scalar_tower.right : is_scalar_tower R A A :=
171+
⟨λ x y z, by rw [smul_eq_mul, smul_eq_mul, smul_def, smul_def, mul_assoc]⟩
172+
173+
/-- This is just a special case of the global `mul_smul_comm` lemma that requires less typeclass
174+
search (and was here first). -/
175+
@[simp] protected lemma mul_smul_comm (s : R) (x y : A) :
171176
x * (s • y) = s • (x * y) :=
177+
-- TODO: set up `is_scalar_tower.smul_comm_class` earlier so that we can actually prove this using
178+
-- `mul_smul_comm s x y`.
172179
by rw [smul_def, smul_def, left_comm]
173180

174-
@[simp] lemma smul_mul_assoc (r : R) (x y : A) :
181+
/-- This is just a special case of the global `smul_mul_assoc` lemma that requires less typeclass
182+
search (and was here first). -/
183+
@[simp] protected lemma smul_mul_assoc (r : R) (x y : A) :
175184
(r • x) * y = r • (x * y) :=
176-
by rw [smul_def, smul_def, mul_assoc]
177-
178-
lemma smul_mul_smul (r s : R) (x y : A) :
179-
(r • x) * (s • y) = (r * s) • (x * y) :=
180-
by rw [algebra.smul_mul_assoc, algebra.mul_smul_comm, smul_smul]
185+
smul_mul_assoc r x y
181186

182187
section
183188
variables {r : R} {a : A}

src/algebra/algebra/tower.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ rfl
132132

133133
variables (R) {S A B}
134134

135-
instance right : is_scalar_tower S A A :=
136-
⟨λ x y z, by rw [smul_eq_mul, smul_eq_mul, algebra.smul_mul_assoc]⟩
137-
138135
instance comap {R S A : Type*} [comm_semiring R] [comm_semiring S] [semiring A]
139136
[algebra R S] [algebra S A] : is_scalar_tower R S (algebra.comap R S A) :=
140137
of_algebra_map_eq $ λ x, rfl

src/group_theory/group_action/defs.lean

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,27 @@ add_decl_doc add_monoid.to_add_action
185185
instance is_scalar_tower.left : is_scalar_tower M M α :=
186186
⟨λ x y z, mul_smul x y z⟩
187187

188+
variables {M}
189+
190+
/-- Note that the `smul_comm_class M α α` typeclass argument is usually satisfied by `algebra M α`.
191+
-/
192+
@[to_additive]
193+
lemma mul_smul_comm [monoid α] (s : M) (x y : α) [smul_comm_class M α α] :
194+
x * (s • y) = s • (x * y) :=
195+
(smul_comm s x y).symm
196+
197+
/-- Note that the `is_scalar_tower M α α` typeclass argument is usually satisfied by `algebra M α`.
198+
-/
199+
lemma smul_mul_assoc [monoid α] (r : M) (x y : α) [is_scalar_tower M α α] :
200+
(r • x) * y = r • (x * y) :=
201+
smul_assoc r x y
202+
203+
/-- Note that the `is_scalar_tower M α α` and `smul_comm_class M α α` typeclass arguments are
204+
usually satisfied by `algebra M α`. -/
205+
lemma smul_mul_smul [monoid α] (r s : M) (x y : α) [is_scalar_tower M α α] [smul_comm_class M α α] :
206+
(r • x) * (s • y) = (r * s) • (x * y) :=
207+
by rw [smul_mul_assoc, mul_smul_comm, smul_smul]
208+
188209
end
189210

190211
namespace mul_action

0 commit comments

Comments
 (0)