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

Commit b9bf921

Browse files
committed
chore(linear_algebra): switch to named constructors for linear_map (#8059)
This makes some ideas I have for future refactors easier, and generally makes things less fragile to changes such as additional fields or reordering of fields. The extra verbosity is not really significant. This conversion is not exhaustive, there may be anonymous constructors elsewhere that I've missed.
1 parent 2a1cabe commit b9bf921

File tree

15 files changed

+98
-75
lines changed

15 files changed

+98
-75
lines changed

src/algebra/module/linear_map.lean

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ initialize_simps_projections linear_map (to_fun → apply)
8686

8787
/-- Identity map as a `linear_map` -/
8888
def id : M →ₗ[R] M :=
89-
⟨id, λ _ _, rfl, λ _ _, rfl⟩
89+
{ to_fun := id, ..distrib_mul_action_hom.id R }
9090

9191
lemma id_apply (x : M) :
9292
@id R M _ _ _ x = x := rfl
@@ -102,7 +102,7 @@ variables (f g : M →ₗ[R] M₂)
102102

103103
@[simp] lemma to_fun_eq_coe : f.to_fun = ⇑f := rfl
104104

105-
theorem is_linear : is_linear_map R f := ⟨f.2, f.3
105+
theorem is_linear : is_linear_map R f := ⟨f.map_add', f.map_smul'
106106

107107
variables {f g}
108108

@@ -226,7 +226,8 @@ variables {module_M : module R M} {module_M₂ : module R M₂}
226226
variables (f : M₂ →ₗ[R] M₃) (g : M →ₗ[R] M₂)
227227

228228
/-- Composition of two linear maps is a linear map -/
229-
def comp : M →ₗ[R] M₃ := ⟨f ∘ g, by simp, by simp⟩
229+
def comp : M →ₗ[R] M₃ :=
230+
{ to_fun := f ∘ g, .. f.to_distrib_mul_action_hom.comp g.to_distrib_mul_action_hom }
230231

231232
lemma comp_apply (x : M) : f.comp g x = f (g x) := rfl
232233

@@ -245,8 +246,9 @@ def inverse [module R M] [module R M₂]
245246
(f : M →ₗ[R] M₂) (g : M₂ → M) (h₁ : left_inverse g f) (h₂ : right_inverse g f) :
246247
M₂ →ₗ[R] M :=
247248
by dsimp [left_inverse, function.right_inverse] at h₁ h₂; exact
248-
⟨g, λ x y, by { rw [← h₁ (g (x + y)), ← h₁ (g x + g y)]; simp [h₂] },
249-
λ a b, by { rw [← h₁ (g (a • b)), ← h₁ (a • g b)]; simp [h₂] }⟩
249+
{ to_fun := g,
250+
map_add' := λ x y, by { rw [← h₁ (g (x + y)), ← h₁ (g x + g y)]; simp [h₂] },
251+
map_smul' := λ a b, by { rw [← h₁ (g (a • b)), ← h₁ (a • g b)]; simp [h₂] } }
250252

251253
end add_comm_monoid
252254

@@ -292,7 +294,8 @@ variables [module R M] [module R M₂]
292294
include R
293295

294296
/-- Convert an `is_linear_map` predicate to a `linear_map` -/
295-
def mk' (f : M → M₂) (H : is_linear_map R f) : M →ₗ M₂ := ⟨f, H.1, H.2
297+
def mk' (f : M → M₂) (H : is_linear_map R f) : M →ₗ M₂ :=
298+
{ to_fun := f, map_add' := H.1, map_smul' := H.2 }
296299

297300
@[simp] theorem mk'_apply {f : M → M₂} (H : is_linear_map R f) (x : M) :
298301
mk' f H x = f x := rfl
@@ -346,7 +349,7 @@ abbreviation module.End (R : Type u) (M : Type v)
346349
/-- Reinterpret an additive homomorphism as a `ℕ`-linear map. -/
347350
def add_monoid_hom.to_nat_linear_map [add_comm_monoid M] [add_comm_monoid M₂] (f : M →+ M₂) :
348351
M →ₗ[ℕ] M₂ :=
349-
f, f.map_add, f.map_nat_module_smul
352+
{ to_fun := f, map_add' := f.map_add, map_smul' := f.map_nat_module_smul }
350353

351354
lemma add_monoid_hom.to_nat_linear_map_injective [add_comm_monoid M] [add_comm_monoid M₂] :
352355
function.injective (@add_monoid_hom.to_nat_linear_map M M₂ _ _) :=
@@ -355,7 +358,7 @@ by { intros f g h, ext, exact linear_map.congr_fun h x }
355358
/-- Reinterpret an additive homomorphism as a `ℤ`-linear map. -/
356359
def add_monoid_hom.to_int_linear_map [add_comm_group M] [add_comm_group M₂] (f : M →+ M₂) :
357360
M →ₗ[ℤ] M₂ :=
358-
f, f.map_add, f.map_int_module_smul
361+
{ to_fun := f, map_add' := f.map_add, map_smul' := f.map_int_module_smul }
359362

360363
lemma add_monoid_hom.to_int_linear_map_injective [add_comm_group M] [add_comm_group M₂] :
361364
function.injective (@add_monoid_hom.to_int_linear_map M M₂ _ _) :=
@@ -505,8 +508,8 @@ rfl
505508

506509
@[simp] theorem trans_apply (c : M) :
507510
(e₁.trans e₂) c = e₂ (e₁ c) := rfl
508-
@[simp] theorem apply_symm_apply (c : M₂) : e (e.symm c) = c := e.6 c
509-
@[simp] theorem symm_apply_apply (b : M) : e.symm (e b) = b := e.5 b
511+
@[simp] theorem apply_symm_apply (c : M₂) : e (e.symm c) = c := e.right_inv c
512+
@[simp] theorem symm_apply_apply (b : M) : e.symm (e b) = b := e.left_inv b
510513
@[simp] lemma symm_trans_apply (c : M₃) : (e₁.trans e₂).symm c = e₁.symm (e₂.symm c) := rfl
511514

512515
@[simp] lemma trans_refl : e.trans (refl R M₂) = e := to_equiv_injective e.to_equiv.trans_refl

src/analysis/normed_space/operator_norm.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def linear_map.mk_continuous_of_exists_bound (h : ∃C, ∀x, ∥f x∥ ≤ C *
8484
lemma continuous_of_linear_of_bound {f : E → F} (h_add : ∀ x y, f (x + y) = f x + f y)
8585
(h_smul : ∀ (c : 𝕜) x, f (c • x) = c • f x) {C : ℝ} (h_bound : ∀ x, ∥f x∥ ≤ C*∥x∥) :
8686
continuous f :=
87-
let φ : E →ₗ[𝕜] F := ⟨f, h_add, h_smul⟩ in φ.continuous_of_bound C h_bound
87+
let φ : E →ₗ[𝕜] F := { to_fun := f, map_add' := h_add, map_smul' := h_smul } in
88+
φ.continuous_of_bound C h_bound
8889

8990
@[simp, norm_cast] lemma linear_map.mk_continuous_coe (C : ℝ) (h : ∀x, ∥f x∥ ≤ C * ∥x∥) :
9091
((f.mk_continuous C h) : E →ₗ[𝕜] F) = f := rfl

src/field_theory/finite/polynomial.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ end
113113
section
114114
variables (K σ)
115115
def evalₗ : mv_polynomial σ K →ₗ[K] (σ → K) → K :=
116-
⟨ λp e, eval e p,
117-
assume p q, (by { ext x, rw ring_hom.map_add, refl, }),
118-
assume a p, funext $ assume e, by rw [smul_eq_C_mul, ring_hom.map_mul, eval_C]; refl
116+
{ to_fun := λ p e, eval e p,
117+
map_add' := λ p q, by { ext x, rw ring_hom.map_add, refl, },
118+
map_smul' := λ a p, by { ext e, rw [smul_eq_C_mul, ring_hom.map_mul, eval_C], refl } }
119119
end
120120

121121
lemma evalₗ_apply (p : mv_polynomial σ K) (e : σ → K) : evalₗ K σ p e = eval e p :=

src/linear_algebra/basic.lean

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ lemma restrict_eq_dom_restrict_cod_restrict
184184
f.restrict (λ x _, hf x) = (f.cod_restrict p hf).dom_restrict p := rfl
185185

186186
/-- 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 }⟩
188189

189190
instance : inhabited (M →ₗ[R] M₂) := ⟨0
190191

@@ -201,7 +202,8 @@ coe_injective.unique
201202

202203
/-- The sum of two linear maps is linear. -/
203204
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] }⟩
205207

206208
@[simp] lemma add_apply (x : M) : (f + g) x = f x + g x := rfl
207209

@@ -366,18 +368,17 @@ variables [semiring R]
366368

367369
/-- The negation of a linear map is linear. -/
368370
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 }
370372

371373
@[simp] lemma neg_apply (x : M) : (- f) x = - f x := rfl
372374

373375
@[simp] lemma comp_neg (g : M₂ →ₗ[R] M₃) : g.comp (- f) = - g.comp f := by { ext, simp }
374376

375377
/-- The negation of a linear map is linear. -/
376378
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] }⟩
381382

382383
@[simp] lemma sub_apply (x : M) : (f - g) x = f x - g x := rfl
383384

@@ -424,8 +425,9 @@ variables {S : Type*} [semiring R] [monoid S]
424425
(f : M →ₗ[R] M₂)
425426

426427
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] }⟩
429431

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

@@ -515,9 +517,9 @@ ext $ assume b, by rw [comp_apply, smul_apply, g.map_smul]; refl
515517
/-- Composition by `f : M₂ → M₃` is a linear map from the space of linear maps `M → M₂`
516518
to the space of linear maps `M₂ → M₃`. -/
517519
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 _ _ }
521523

522524
/-- Applying a linear map at `v : M`, seen as a linear map from `M →ₗ[R] M₂` to `M₂`.
523525
See also `linear_map.applyₗ'` for a version that works with two different semirings.
@@ -1873,17 +1875,18 @@ def map_subtype.order_embedding :
18731875

18741876

18751877
/-- 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 }
18771880

18781881
@[simp] theorem mkq_apply (x : M) : p.mkq x = quotient.mk x := rfl
18791882

18801883
/-- The map from the quotient of `M` by a submodule `p` to `M₂` induced by a linear map `f : M → M₂`
18811884
vanishing on `p`, as a linear map. -/
18821885
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 }
18871890

18881891
@[simp] theorem liftq_apply (f : M →ₗ[R] M₂) {h} (x : M) :
18891892
p.liftq f h (quotient.mk x) = f x := rfl
@@ -2679,7 +2682,7 @@ variables {m n p : Type*}
26792682
/-- Given an `R`-module `M` and a function `m → n` between arbitrary types,
26802683
construct a linear map `(n → M) →ₗ[R] (m → M)` -/
26812684
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 }
26832686

26842687
@[simp] theorem fun_left_apply (f : m → n) (g : n → M) (i : m) : fun_left R M f g i = g (f i) :=
26852688
rfl

src/linear_algebra/dfinsupp.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ include dec_ι
4444

4545
/-- `dfinsupp.mk` as a `linear_map`. -/
4646
def lmk (s : finset ι) : (Π i : (↑s : set ι), M i) →ₗ[R] Π₀ i, M i :=
47-
mk s, λ _ _, mk_add, λ c x, by rw [mk_smul R x]⟩
47+
{ to_fun := mk s, map_add' := λ _ _, mk_add, map_smul' := λ c x, mk_smul R x }
4848

4949
/-- `dfinsupp.single` as a `linear_map` -/
5050
def lsingle (i) : M i →ₗ[R] Π₀ i, M i :=
51-
single i, λ _ _, single_add, λ _ _, single_smul _⟩
51+
{ to_fun := single i, map_smul' := λ r x, single_smul _, .. dfinsupp.single_add_hom _ _ }
5252

5353
/-- Two `R`-linear maps from `Π₀ i, M i` which agree on each `single i x` agree everywhere. -/
5454
lemma lhom_ext ⦃φ ψ : (Π₀ i, M i) →ₗ[R] N⦄

src/linear_algebra/finsupp.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ variables (s : set α)
9191

9292
/-- Interpret `finsupp.subtype_domain s` as a linear map. -/
9393
def lsubtype_domain : (α →₀ M) →ₗ[R] (s →₀ M) :=
94-
⟨subtype_domain (λx, x ∈ s), assume a b, subtype_domain_add, assume c a, ext $ assume a, rfl⟩
94+
{ to_fun := subtype_domain (λx, x ∈ s),
95+
map_add' := λ a b, subtype_domain_add,
96+
map_smul' := λ c a, ext $ λ a, rfl }
9597

9698
lemma lsubtype_domain_apply (f : α →₀ M) :
9799
(lsubtype_domain s : (α →₀ M) →ₗ[R] (s →₀ M)) f = subtype_domain (λx, x ∈ s) f := rfl
@@ -349,7 +351,7 @@ variables {α' : Type*} {α'' : Type*} (M R)
349351

350352
/-- Interpret `finsupp.map_domain` as a linear map. -/
351353
def lmap_domain (f : α → α') : (α →₀ M) →ₗ[R] (α' →₀ M) :=
352-
map_domain f, assume a b, map_domain_add, map_domain_smul
354+
{ to_fun := map_domain f, map_add' := λ a b, map_domain_add, map_smul' := map_domain_smul }
353355

354356
@[simp] theorem lmap_domain_apply (f : α → α') (l : α →₀ M) :
355357
(lmap_domain M R f : (α →₀ M) →ₗ[R] (α' →₀ M)) l = map_domain f l := rfl

src/linear_algebra/linear_pmap.lean

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,25 @@ f.to_fun.map_smul c x
7171
over rings, and requires a proof of `∀ c, c • x = 0 → c • y = 0`. -/
7272
noncomputable def mk_span_singleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
7373
linear_pmap R E F :=
74-
begin
75-
replace H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y,
74+
{ domain := R ∙ x,
75+
to_fun :=
76+
have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y,
7677
{ intros c₁ c₂ h,
7778
rw [← sub_eq_zero, ← sub_smul] at h ⊢,
7879
exact H _ h },
79-
refine ⟨R ∙ x, λ z, _, _, _⟩,
80-
{ exact (classical.some (mem_span_singleton.1 z.prop) • y) },
81-
{ intros z₁ z₂,
82-
rw [← add_smul],
83-
apply H,
84-
simp only [add_smul, sub_smul, classical.some_spec (mem_span_singleton.1 _)],
85-
apply coe_add },
86-
{ intros c z,
87-
rw [smul_smul],
88-
apply H,
89-
simp only [mul_smul, classical.some_spec (mem_span_singleton.1 _)],
90-
apply coe_smul }
91-
end
80+
{ to_fun := λ z, (classical.some (mem_span_singleton.1 z.prop) • y),
81+
map_add' := λ y z, begin
82+
rw [← add_smul],
83+
apply H,
84+
simp only [add_smul, sub_smul, classical.some_spec (mem_span_singleton.1 _)],
85+
apply coe_add
86+
end,
87+
map_smul' := λ c z, begin
88+
rw [smul_smul],
89+
apply H,
90+
simp only [mul_smul, classical.some_spec (mem_span_singleton.1 _)],
91+
apply coe_smul
92+
end } }
9293

9394
@[simp] lemma domain_mk_span_singleton (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
9495
(mk_span_singleton' x y H).domain = R ∙ x := rfl
@@ -213,7 +214,7 @@ begin
213214
simp only [← eq_sub_iff_add_eq] at hxy,
214215
simp only [coe_sub, coe_mk, coe_mk, hxy, ← sub_add, ← sub_sub, sub_self, zero_sub, ← H],
215216
apply neg_add_eq_sub },
216-
refine ⟨fg, _, _⟩, fg_eq⟩,
217+
refine ⟨{ to_fun := fg, .. }, fg_eq⟩,
217218
{ rintros ⟨z₁, hz₁⟩ ⟨z₂, hz₂⟩,
218219
rw [← add_assoc, add_right_comm (f _), ← map_add, add_assoc, ← map_add],
219220
apply fg_eq,
@@ -326,7 +327,7 @@ begin
326327
rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, hqc, hxq, hpq⟩,
327328
refine (hxq.2 _).trans (hpq.2 _).symm,
328329
exacts [of_le hpq.1 y, hxy, rfl] },
329-
refine ⟨f, _, _⟩, _⟩,
330+
refine ⟨{ to_fun := f, .. }, _⟩,
330331
{ intros x y,
331332
rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩,
332333
set x' := of_le hpx.1 ⟨x, (P x).2⟩,

src/linear_algebra/matrix/to_linear_equiv.lean

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ See `matrix.to_linear_equiv'` for this result on `n → R`.
7171
noncomputable def to_linear_equiv [decidable_eq n] (A : matrix n n R) (hA : is_unit A.det) :
7272
M ≃ₗ[R] M :=
7373
begin
74-
refine ⟨to_lin b b A, linear_map.map_add _, linear_map.map_smul _, to_lin b b A⁻¹,
75-
λ x, _, λ x, _⟩;
74+
refine {
75+
to_fun := to_lin b b A,
76+
inv_fun := to_lin b b A⁻¹,
77+
left_inv := λ x, _,
78+
right_inv := λ x, _,
79+
.. to_lin b b A };
7680
simp only [← linear_map.comp_apply, ← matrix.to_lin_mul b b b,
7781
matrix.nonsing_inv_mul _ hA, matrix.mul_nonsing_inv _ hA,
7882
to_lin_one, linear_map.id_apply]
7983
end
84+
8085
lemma ker_to_lin_eq_bot [decidable_eq n] (A : matrix n n R) (hA : is_unit A.det) :
8186
(to_lin b b A).ker = ⊥ :=
8287
ker_eq_bot.mpr (to_linear_equiv b A hA).injective

src/linear_algebra/pi.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ variables [semiring R] [add_comm_monoid M₂] [module R M₂] [add_comm_monoid M
3939
/-- `pi` construction for linear functions. From a family of linear functions it produces a linear
4040
function into a family of modules. -/
4141
def pi (f : Πi, M₂ →ₗ[R] φ i) : M₂ →ₗ[R] (Πi, φ i) :=
42-
⟨λc i, f i c, λ c d, funext $ λ i, (f i).map_add _ _, λ c d, funext $ λ i, (f i).map_smul _ _⟩
42+
{ to_fun := λ c i, f i c,
43+
map_add' := λ c d, funext $ λ i, (f i).map_add _ _,
44+
map_smul' := λ c d, funext $ λ i, (f i).map_smul _ _ }
4345

4446
@[simp] lemma pi_apply (f : Πi, M₂ →ₗ[R] φ i) (c : M₂) (i : ι) :
4547
pi f c i = f i c := rfl
@@ -61,7 +63,7 @@ rfl
6163
Note: known here as `linear_map.proj`, this construction is in other categories called `eval`, for
6264
example `pi.eval_monoid_hom`, `pi.eval_ring_hom`. -/
6365
def proj (i : ι) : (Πi, φ i) →ₗ[R] φ i :=
64-
⟨ λa, a i, assume f g, rfl, assume c f, rfl
66+
{ to_fun := function.eval i, map_add' := λ f g, rfl, map_smul' := λ c f, rfl }
6567

6668
@[simp] lemma coe_proj (i : ι) : ⇑(proj i : (Πi, φ i) →ₗ[R] φ i) = function.eval i := rfl
6769

src/linear_algebra/prod.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ section
4848
variables (R M M₂)
4949

5050
/-- The first projection of a product is a linear map. -/
51-
def fst : M × M₂ →ₗ[R] M := prod.fst, λ x y, rfl, λ x y, rfl
51+
def fst : M × M₂ →ₗ[R] M := { to_fun := prod.fst, map_add' := λ x y, rfl, map_smul' := λ x y, rfl }
5252

5353
/-- The second projection of a product is a linear map. -/
54-
def snd : M × M₂ →ₗ[R] M₂ := prod.snd, λ x y, rfl, λ x y, rfl
54+
def snd : M × M₂ →ₗ[R] M₂ := { to_fun := prod.snd, map_add' := λ x y, rfl, map_smul' := λ x y, rfl }
5555
end
5656

5757
@[simp] theorem fst_apply (x : M × M₂) : fst R M M₂ x = x.1 := rfl

0 commit comments

Comments
 (0)