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

Commit 25c34e0

Browse files
committed
refactor(linear_algebra,algebra/algebra): generalize linear_map.smul_right (#5967)
* the new `linear_map.smul_right` generalizes both the old `linear_map.smul_right` and the old `linear_map.smul_algebra_right`; * add `smul_comm_class` for `linear_map`s.
1 parent fc7daa3 commit 25c34e0

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

src/algebra/algebra/basic.lean

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,10 +1366,6 @@ end semimodule
13661366
end restrict_scalars
13671367

13681368
namespace linear_map
1369-
section extend_scalars
1370-
/-! When `V` is an `R`-module and `W` is an `S`-module, where `S` is an algebra over `R`, then
1371-
the collection of `R`-linear maps from `V` to `W` admits an `S`-module structure, given by
1372-
multiplication in the target. -/
13731369

13741370
variables (R : Type*) [comm_semiring R] (S : Type*) [semiring S] [algebra R S]
13751371
(V : Type*) [add_comm_monoid V] [semimodule R V]
@@ -1379,16 +1375,4 @@ instance is_scalar_tower_extend_scalars :
13791375
is_scalar_tower R S (V →ₗ[R] W) :=
13801376
{ smul_assoc := λ r s f, by simp only [(•), coe_mk, smul_assoc] }
13811377

1382-
variables {R S V W}
1383-
1384-
/-- When `f` is a linear map taking values in `S`, then `λb, f b • x` is a linear map. -/
1385-
def smul_algebra_right (f : V →ₗ[R] S) (x : W) : V →ₗ[R] W :=
1386-
{ to_fun := λb, f b • x,
1387-
map_add' := by simp [add_smul],
1388-
map_smul' := λ b y, by { simp [algebra.smul_def, ← smul_smul], } }
1389-
1390-
@[simp] theorem smul_algebra_right_apply (f : V →ₗ[R] S) (x : W) (c : V) :
1391-
smul_algebra_right f x c = f c • x := rfl
1392-
1393-
end extend_scalars
13941378
end linear_map

src/analysis/normed_space/operator_norm.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ instance normed_space_extend_scalars : normed_space 𝕜' (E →L[𝕜] F') :=
764764
/-- When `f` is a continuous linear map taking values in `S`, then `λb, f b • x` is a
765765
continuous linear map. -/
766766
def smul_algebra_right (f : E →L[𝕜] 𝕜') (x : F') : E →L[𝕜] F' :=
767-
{ cont := by continuity!, .. f.to_linear_map.smul_algebra_right x }
767+
{ cont := by continuity!, .. f.to_linear_map.smul_right x }
768768

769769
@[simp] theorem smul_algebra_right_apply (f : E →L[𝕜] 𝕜') (x : F') (c : E) :
770770
smul_algebra_right f x c = f c • x := rfl

src/linear_algebra/basic.lean

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,20 @@ lemma sum_apply (t : finset ι) (f : ι → M →ₗ[R] M₂) (b : M) :
187187
(∑ d in t, f d) b = ∑ d in t, f d b :=
188188
(t.sum_hom (λ g : M →ₗ[R] M₂, g b)).symm
189189

190-
/-- `λb, f b • x` is a linear map. -/
191-
def smul_right (f : M₂ →ₗ[R] R) (x : M) : M₂ →ₗ[R] M :=
192-
⟨λb, f b • x, by simp [add_smul], by simp [smul_smul]⟩.
190+
section smul_right
193191

194-
@[simp] theorem smul_right_apply (f : M₂ →ₗ[R] R) (x : M) (c : M₂) :
195-
(smul_right f x : M₂ → M) c = f c • x := rfl
192+
variables {S : Type*} [semiring S] [semimodule R S] [semimodule S M] [is_scalar_tower R S M]
193+
194+
/-- When `f` is an `R`-linear map taking values in `S`, then `λb, f b • x` is an `R`-linear map. -/
195+
def smul_right (f : M₂ →ₗ[R] S) (x : M) : M₂ →ₗ[R] M :=
196+
{ to_fun := λb, f b • x,
197+
map_add' := λ x y, by rw [f.map_add, add_smul],
198+
map_smul' := λ b y, by rw [f.map_smul, smul_assoc] }
199+
200+
@[simp] theorem smul_right_apply (f : M₂ →ₗ[R] S) (x : M) (c : M₂) :
201+
smul_right f x c = f c • x := rfl
202+
203+
end smul_right
196204

197205
instance : has_one (M →ₗ[R] M) := ⟨linear_map.id⟩
198206
instance : has_mul (M →ₗ[R] M) := ⟨linear_map.comp⟩
@@ -373,6 +381,11 @@ instance : has_scalar S (M →ₗ[R] M₂) :=
373381

374382
@[simp] lemma smul_apply (a : S) (x : M) : (a • f) x = a • f x := rfl
375383

384+
instance {T : Type*} [monoid T] [distrib_mul_action T M₂] [smul_comm_class R T M₂]
385+
[smul_comm_class S T M₂] :
386+
smul_comm_class S T (M →ₗ[R] M₂) :=
387+
⟨λ a b f, ext $ λ x, smul_comm _ _ _⟩
388+
376389
instance : distrib_mul_action S (M →ₗ[R] M₂) :=
377390
{ one_smul := λ f, ext $ λ _, one_smul _ _,
378391
mul_smul := λ c c' f, ext $ λ _, mul_smul _ _ _,

src/linear_algebra/finsupp.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ variables (α) {α' : Type*} (M) {M' : Type*} (R)
380380

381381
/-- Interprets (l : α →₀ R) as linear combination of the elements in the family (v : α → M) and
382382
evaluates this linear combination. -/
383-
protected def total : (α →₀ R) →ₗ M := finsupp.lsum (λ i, linear_map.id.smul_right (v i))
383+
protected def total : (α →₀ R) →ₗ[R] M := finsupp.lsum (λ i, linear_map.id.smul_right (v i))
384384

385385
variables {α M v}
386386

0 commit comments

Comments
 (0)