@@ -184,7 +184,8 @@ lemma restrict_eq_dom_restrict_cod_restrict
184
184
f.restrict (λ x _, hf x) = (f.cod_restrict p hf).dom_restrict p := rfl
185
185
186
186
/-- The constant 0 map is linear. -/
187
- instance : has_zero (M →ₗ[R] M₂) := ⟨⟨λ _, 0 , by simp, by simp⟩⟩
187
+ instance : has_zero (M →ₗ[R] M₂) :=
188
+ ⟨{ to_fun := 0 , map_add' := by simp, map_smul' := by simp }⟩
188
189
189
190
instance : inhabited (M →ₗ[R] M₂) := ⟨0 ⟩
190
191
@@ -201,7 +202,8 @@ coe_injective.unique
201
202
202
203
/-- The sum of two linear maps is linear. -/
203
204
instance : has_add (M →ₗ[R] M₂) :=
204
- ⟨λ f g, ⟨λ b, f b + g b, by simp [add_comm, add_left_comm], by simp [smul_add]⟩⟩
205
+ ⟨λ f g, { to_fun := f + g,
206
+ map_add' := by simp [add_comm, add_left_comm], map_smul' := by simp [smul_add] }⟩
205
207
206
208
@[simp] lemma add_apply (x : M) : (f + g) x = f x + g x := rfl
207
209
@@ -366,18 +368,17 @@ variables [semiring R]
366
368
367
369
/-- The negation of a linear map is linear. -/
368
370
instance : has_neg (M →ₗ[R] M₂) :=
369
- ⟨λ f, ⟨λ b, - f b, by simp [add_comm], by simp⟩ ⟩
371
+ ⟨λ f, { to_fun := -f, map_add' := by simp [add_comm], map_smul' := by simp } ⟩
370
372
371
373
@[simp] lemma neg_apply (x : M) : (- f) x = - f x := rfl
372
374
373
375
@[simp] lemma comp_neg (g : M₂ →ₗ[R] M₃) : g.comp (- f) = - g.comp f := by { ext, simp }
374
376
375
377
/-- The negation of a linear map is linear. -/
376
378
instance : has_sub (M →ₗ[R] M₂) :=
377
- ⟨λ f g,
378
- ⟨λ b, f b - g b,
379
- by { simp only [map_add, sub_eq_add_neg, neg_add], cc },
380
- by { intros, simp only [map_smul, smul_sub] }⟩⟩
379
+ ⟨λ f g, { to_fun := f - g,
380
+ map_add' := λ x y, by simp only [pi.sub_apply, map_add, add_sub_comm],
381
+ map_smul' := λ r x, by simp only [pi.sub_apply, map_smul, smul_sub] }⟩
381
382
382
383
@[simp] lemma sub_apply (x : M) : (f - g) x = f x - g x := rfl
383
384
@@ -424,8 +425,9 @@ variables {S : Type*} [semiring R] [monoid S]
424
425
(f : M →ₗ[R] M₂)
425
426
426
427
instance : has_scalar S (M →ₗ[R] M₂) :=
427
- ⟨λ a f, ⟨λ b, a • f b, λ x y, by rw [f.map_add, smul_add],
428
- λ c x, by simp only [f.map_smul, smul_comm c]⟩⟩
428
+ ⟨λ a f, { to_fun := a • f,
429
+ map_add' := λ x y, by simp only [pi.smul_apply, f.map_add, smul_add],
430
+ map_smul' := λ c x, by simp only [pi.smul_apply, f.map_smul, smul_comm c] }⟩
429
431
430
432
@[simp] lemma smul_apply (a : S) (x : M) : (a • f) x = a • f x := rfl
431
433
@@ -515,9 +517,9 @@ ext $ assume b, by rw [comp_apply, smul_apply, g.map_smul]; refl
515
517
/-- Composition by `f : M₂ → M₃` is a linear map from the space of linear maps `M → M₂`
516
518
to the space of linear maps `M₂ → M₃`. -/
517
519
def comp_right (f : M₂ →ₗ[R] M₃) : (M →ₗ[R] M₂) →ₗ[R] (M →ₗ[R] M₃) :=
518
- ⟨ f.comp,
519
- λ _ _, linear_map.ext $ λ _, f.2 _ _,
520
- λ _ _, linear_map.ext $ λ _, f.3 _ _⟩
520
+ { to_fun := f.comp,
521
+ map_add' := λ _ _, linear_map.ext $ λ _, f.map_add _ _,
522
+ map_smul' := λ _ _, linear_map.ext $ λ _, f.map_smul _ _ }
521
523
522
524
/-- Applying a linear map at `v : M`, seen as a linear map from `M →ₗ[R] M₂` to `M₂`.
523
525
See also `linear_map.applyₗ'` for a version that works with two different semirings.
@@ -1873,17 +1875,18 @@ def map_subtype.order_embedding :
1873
1875
1874
1876
1875
1877
/-- The map from a module `M` to the quotient of `M` by a submodule `p` as a linear map. -/
1876
- def mkq : M →ₗ[R] p.quotient := ⟨quotient.mk, by simp, by simp⟩
1878
+ def mkq : M →ₗ[R] p.quotient :=
1879
+ { to_fun := quotient.mk, map_add' := by simp, map_smul' := by simp }
1877
1880
1878
1881
@[simp] theorem mkq_apply (x : M) : p.mkq x = quotient.mk x := rfl
1879
1882
1880
1883
/-- The map from the quotient of `M` by a submodule `p` to `M₂` induced by a linear map `f : M → M₂`
1881
1884
vanishing on `p`, as a linear map. -/
1882
1885
def liftq (f : M →ₗ[R] M₂) (h : p ≤ f.ker) : p.quotient →ₗ[R] M₂ :=
1883
- ⟨ λ x, _root_.quotient.lift_on' x f $
1884
- λ a b (ab : a - b ∈ p), eq_of_sub_eq_zero $ by simpa using h ab,
1885
- by rintro ⟨x⟩ ⟨y⟩; exact f.map_add x y,
1886
- by rintro a ⟨x⟩; exact f.map_smul a x⟩
1886
+ { to_fun := λ x, _root_.quotient.lift_on' x f $
1887
+ λ a b (ab : a - b ∈ p), eq_of_sub_eq_zero $ by simpa using h ab,
1888
+ map_add' := by rintro ⟨x⟩ ⟨y⟩; exact f.map_add x y,
1889
+ map_smul' := by rintro a ⟨x⟩; exact f.map_smul a x }
1887
1890
1888
1891
@[simp] theorem liftq_apply (f : M →ₗ[R] M₂) {h} (x : M) :
1889
1892
p.liftq f h (quotient.mk x) = f x := rfl
@@ -2679,7 +2682,7 @@ variables {m n p : Type*}
2679
2682
/-- Given an `R`-module `M` and a function `m → n` between arbitrary types,
2680
2683
construct a linear map `(n → M) →ₗ[R] (m → M)` -/
2681
2684
def fun_left (f : m → n) : (n → M) →ₗ[R] (m → M) :=
2682
- mk (∘f) ( λ _ _, rfl) ( λ _ _, rfl)
2685
+ { to_fun := (∘ f), map_add' := λ _ _, rfl, map_smul' := λ _ _, rfl }
2683
2686
2684
2687
@[simp] theorem fun_left_apply (f : m → n) (g : n → M) (i : m) : fun_left R M f g i = g (f i) :=
2685
2688
rfl
0 commit comments