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

Commit 0df6f77

Browse files
committed
style(linear_algebra/tensor_product): rename of -> tmul and ⊗ₛ -> ⊗ₜ; some cleanup in free_abelian_group
1 parent 40ef7a2 commit 0df6f77

File tree

2 files changed

+67
-66
lines changed

2 files changed

+67
-66
lines changed

group_theory/free_abelian_group.lean

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2018 Kenny Lau. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau
55
6-
Free abelian groups as abelianizatin of free groups.
6+
Free abelian groups as abelianization of free groups.
77
-/
88

99
import group_theory.free_group
@@ -29,57 +29,47 @@ abelianization.of $ free_group.of x
2929
instance : has_coe α (free_abelian_group α) :=
3030
⟨of⟩
3131

32-
theorem coe_def (x : α) : (x : free_abelian_group α) = of x :=
33-
rfl
34-
35-
section to_comm_group
32+
def to_add_comm_group {β : Type v} [add_comm_group β] (f : α → β) (x : free_abelian_group α) : β :=
33+
@abelianization.to_comm_group _ _ (multiplicative β) _ (@free_group.to_group _ (multiplicative β) _ f) _ x
3634

35+
namespace to_add_comm_group
3736
variables {β : Type v} [add_comm_group β] (f : α → β)
37+
open free_abelian_group
3838

39-
def to_add_comm_group (x : free_abelian_group α) : β :=
40-
@abelianization.to_comm_group _ _ (multiplicative β) _ (@free_group.to_group _ (multiplicative β) _ f) _ x
41-
42-
def to_add_comm_group.is_add_group_hom :
43-
is_add_group_hom (to_add_comm_group f) :=
39+
protected lemma is_add_group_hom : is_add_group_hom (to_add_comm_group f) :=
4440
⟨λ x y, @is_group_hom.mul _ (multiplicative β) _ _ _ (abelianization.to_comm_group.is_group_hom _) x y⟩
4541

4642
local attribute [instance] to_add_comm_group.is_add_group_hom
4743

48-
@[simp] lemma to_add_comm_group.add (x y : free_abelian_group α) :
44+
@[simp] protected lemma add (x y : free_abelian_group α) :
4945
to_add_comm_group f (x + y) = to_add_comm_group f x + to_add_comm_group f y :=
5046
is_add_group_hom.add _ _ _
5147

52-
@[simp] lemma to_add_comm_group.neg (x : free_abelian_group α) :
53-
to_add_comm_group f (-x) = -to_add_comm_group f x :=
48+
@[simp] protected lemma neg (x : free_abelian_group α) : to_add_comm_group f (-x) = -to_add_comm_group f x :=
5449
is_add_group_hom.neg _ _
5550

56-
@[simp] lemma to_add_comm_group.sub (x y : free_abelian_group α) :
51+
@[simp] protected lemma sub (x y : free_abelian_group α) :
5752
to_add_comm_group f (x - y) = to_add_comm_group f x - to_add_comm_group f y :=
5853
by simp
5954

60-
@[simp] lemma to_add_comm_group.zero :
61-
to_add_comm_group f 0 = 0 :=
55+
@[simp] protected lemma zero : to_add_comm_group f 0 = 0 :=
6256
is_add_group_hom.zero _
6357

64-
@[simp] lemma to_add_comm_group.of (x : α) :
65-
to_add_comm_group f (of x) = f x :=
58+
@[simp] protected lemma of (x : α) : to_add_comm_group f (of x) = f x :=
6659
by unfold of; unfold to_add_comm_group; simp
6760

68-
@[simp] lemma to_add_comm_group.coe (x : α) :
69-
to_add_comm_group f ↑x = f x :=
61+
@[simp] protected lemma coe (x : α) : to_add_comm_group f ↑x = f x :=
7062
to_add_comm_group.of f x
7163

72-
theorem to_add_comm_group.unique
73-
(g : free_abelian_group α → β) [is_add_group_hom g]
64+
protected theorem unique (g : free_abelian_group α → β) [is_add_group_hom g]
7465
(hg : ∀ x, g (of x) = f x) {x} :
7566
g x = to_add_comm_group f x :=
7667
@abelianization.to_comm_group.unique (free_group α) _ (multiplicative β) _ _ _ g
7768
⟨λ x y, @is_add_group_hom.add (additive $ abelianization (free_group α)) _ _ _ _ _ x y⟩ (λ x,
7869
@free_group.to_group.unique α (multiplicative β) _ _ (g ∘ abelianization.of)
7970
⟨λ m n, is_add_group_hom.add g (abelianization.of m) (abelianization.of n)⟩ hg _) _
8071

81-
theorem to_add_comm_group.ext
82-
(g h : free_abelian_group α → β)
72+
protected theorem ext (g h : free_abelian_group α → β)
8373
[is_add_group_hom g] [is_add_group_hom h]
8474
(H : ∀ x, g (of x) = h (of x)) {x} :
8575
g x = h x :=
@@ -93,7 +83,7 @@ def UMP : (α → β) ≃ { f : free_abelian_group α → β // is_add_group_hom
9383
right_inv := λ f, subtype.eq $ funext $ λ x, eq.symm $ by letI := f.2; from
9484
to_add_comm_group.unique _ _ (λ _, rfl) }
9585

96-
end to_comm_group
86+
end to_add_comm_group
9787

9888
local attribute [instance] quotient_group.left_rel normal_subgroup.to_is_subgroup
9989

linear_algebra/tensor_product.lean

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -102,41 +102,40 @@ instance quotient.mk.is_add_group_hom :
102102
quotient.mk :=
103103
quotient_add_group.is_add_group_hom _
104104

105-
section of
105+
section tmul
106106
variables {M N}
107107

108-
def of (m : M) (n : N) : M ⊗ N :=
109-
quotient_add_group.mk $ free_abelian_group.of (m, n)
108+
def tmul (m : M) (n : N) : M ⊗ N := quotient_add_group.mk $ free_abelian_group.of (m, n)
110109

111-
infix ` ⊗ `:100 := of
110+
infix ` ⊗ `:100 := tmul
112111

113-
lemma of.add_left (m₁ m₂ : M) (n : N) : (m₁ + m₂) ⊗ n = m₁ ⊗ n + m₂ ⊗ n :=
112+
lemma tmul.add_left (m₁ m₂ : M) (n : N) : (m₁ + m₂) ⊗ n = m₁ ⊗ n + m₂ ⊗ n :=
114113
eq.symm $ sub_eq_zero.1 $ eq.symm $ quotient.sound $
115114
group.in_closure.basic $ or.inl $ ⟨m₁, m₂, n, rfl⟩
116115

117-
lemma of.add_right (m : M) (n₁ n₂ : N) : m ⊗ (n₁ + n₂) = m ⊗ n₁ + m ⊗ n₂ :=
116+
lemma tmul.add_right (m : M) (n₁ n₂ : N) : m ⊗ (n₁ + n₂) = m ⊗ n₁ + m ⊗ n₂ :=
118117
eq.symm $ sub_eq_zero.1 $ eq.symm $ quotient.sound $
119118
group.in_closure.basic $ or.inr $ or.inl $ ⟨m, n₁, n₂, rfl⟩
120119

121-
lemma of.smul (r : R) (m : M) (n : N) : (r • m) ⊗ n = m ⊗ (r • n) :=
120+
lemma tmul.smul (r : R) (m : M) (n : N) : (r • m) ⊗ n = m ⊗ (r • n) :=
122121
sub_eq_zero.1 $ eq.symm $ quotient.sound $
123122
group.in_closure.basic $ or.inr $ or.inr $ ⟨r, m, n, rfl⟩
124123

125-
end of
124+
end tmul
126125

127126
local attribute [instance] free_abelian_group.to_add_comm_group.is_add_group_hom
128127
local attribute [instance] quotient_add_group.is_add_group_hom_quotient_lift
129128

130129
@[reducible] def smul.aux (r : R) (x : free_abelian_group (M × N)) : M ⊗ N :=
131-
free_abelian_group.to_add_comm_group (λ (y : M × N), (r • y.1) ⊗ (y.2)) x
130+
free_abelian_group.to_add_comm_group (λ (y : M × N), (r • y.1) ⊗ (y.2)) x
132131

133132
@[reducible] def smul (r : R) : M ⊗ N → M ⊗ N :=
134133
quotient_add_group.lift _ (smul.aux M N r)
135134
begin
136135
assume x hx,
137136
induction hx with _ hx _ _ ih _ _ _ _ ih1 ih2,
138137
{ rcases hx with ⟨m₁, m₂, n, rfl⟩ | ⟨m, n₁, n₂, rfl⟩ | ⟨q, m, n, rfl⟩;
139-
simp [smul.aux, -sub_eq_add_neg, sub_self, of.add_left, of.add_right, of.smul,
138+
simp [smul.aux, -sub_eq_add_neg, sub_self, tmul.add_left, tmul.add_right, tmul.smul,
140139
smul_add, smul_smul, mul_comm] },
141140
{ refl },
142141
{ change smul.aux M N r (-_) = 0,
@@ -164,8 +163,8 @@ instance : module R (M ⊗ N) :=
164163
refine @free_abelian_group.to_add_comm_group.unique _ _ _ _ _ ⟨λ p q, _⟩ _ z,
165164
{ simp [tensor_product.smul_add] },
166165
rintro ⟨m, n⟩,
167-
show (r • m) ⊗ n + (s • m) ⊗ n = ((r + s) • m) ⊗ n,
168-
simp [add_smul, of.add_left]
166+
show (r • m) ⊗ n + (s • m) ⊗ n = ((r + s) • m) ⊗ n,
167+
simp [add_smul, tmul.add_left]
169168
end,
170169
mul_smul := begin
171170
intros r s x,
@@ -176,29 +175,29 @@ instance : module R (M ⊗ N) :=
176175
⟨λ p q, _⟩ _ z,
177176
{ simp [tensor_product.smul_add] },
178177
rintro ⟨m, n⟩,
179-
simp [smul, smul.aux, mul_smul, of]
178+
simp [smul, smul.aux, mul_smul, tmul]
180179
end,
181180
one_smul := λ x, quotient.induction_on x $ λ _,
182181
eq.symm $ free_abelian_group.to_add_comm_group.unique _ _ $ λ ⟨p, q⟩,
183182
by rw [one_smul]; refl,
184183
.. tensor_product.add_comm_group M N }
185184

186-
theorem bilinear : is_bilinear_map (@of R _ M N _ _) :=
187-
{ add_left := of.add_left,
188-
add_right := of.add_right,
185+
theorem bilinear : is_bilinear_map (@tmul R _ M N _ _) :=
186+
{ add_left := tmul.add_left,
187+
add_right := tmul.add_right,
189188
smul_left := λ r x y, rfl,
190-
smul_right := assume r m n, (of.smul r m n).symm }
189+
smul_right := assume r m n, (tmul.smul r m n).symm }
191190

192-
@[simp] lemma add_of (m₁ m₂ : M) (n : N) : (m₁ + m₂) ⊗ n = m₁ ⊗ n + m₂ ⊗ n :=
191+
@[simp] lemma add_tmul (m₁ m₂ : M) (n : N) : (m₁ + m₂) ⊗ n = m₁ ⊗ n + m₂ ⊗ n :=
193192
(bilinear M N).add_left m₁ m₂ n
194193

195-
@[simp] lemma of_add (m : M) (n₁ n₂ : N) : m ⊗ (n₁ + n₂) = m ⊗ n₁ + m ⊗ n₂ :=
194+
@[simp] lemma tmul_add (m : M) (n₁ n₂ : N) : m ⊗ (n₁ + n₂) = m ⊗ n₁ + m ⊗ n₂ :=
196195
(bilinear M N).add_right m n₁ n₂
197196

198-
@[simp] lemma smul_of (r : R) (x : M) (y : N) : (r • x) ⊗ y = r • (x ⊗ y) :=
197+
@[simp] lemma smul_tmul (r : R) (x : M) (y : N) : (r • x) ⊗ y = r • (x ⊗ y) :=
199198
rfl
200199

201-
@[simp] lemma of_smul (r : R) (x : M) (y : N) : x ⊗ (r • y) = r • (x ⊗ y) :=
200+
@[simp] lemma tmul_smul (r : R) (x : M) (y : N) : x ⊗ (r • y) = r • (x ⊗ y) :=
202201
(bilinear M N).smul_right r x y
203202

204203
end module
@@ -211,11 +210,11 @@ protected theorem induction_on
211210
{C : M ⊗ N → Prop}
212211
(z : M ⊗ N)
213212
(C0 : C 0)
214-
(C1 : ∀ x y, C $ x ⊗ y)
213+
(C1 : ∀ x y, C $ x ⊗ y)
215214
(Cp : ∀ x y, C x → C y → C (x + y)) : C z :=
216215
quotient.induction_on z $ λ x, free_abelian_group.induction_on x
217216
C0 (λ ⟨p, q⟩, C1 p q)
218-
(λ ⟨p, q⟩ _, show C (-(p ⊗ q)), by rw ← (bilinear M N).neg_left; from C1 (-p) q)
217+
(λ ⟨p, q⟩ _, show C (-(p ⊗ q)), by rw ← (bilinear M N).neg_left; from C1 (-p) q)
219218
(λ _ _, Cp _ _)
220219

221220
section UMP
@@ -254,7 +253,7 @@ free_abelian_group.to_add_comm_group.add _ _ _
254253
= r • to_module f hf x :=
255254
tensor_product.induction_on x smul_zero.symm
256255
(λ p q, by rw [← (bilinear M N).smul_left];
257-
simp [to_module, of, hf.smul_left])
256+
simp [to_module, tmul, hf.smul_left])
258257
(λ p q ih1 ih2, by simp [@smul_add _ _ _ _ r p q,
259258
to_module.add, ih1, ih2, smul_add])
260259

@@ -263,12 +262,12 @@ def to_module.linear :
263262
{ add := to_module.add hf,
264263
smul := to_module.smul hf }
265264

266-
@[simp] lemma to_module.of (x y) :
267-
to_module f hf (x ⊗ y) = f x y :=
268-
by simp [to_module, of]
265+
@[simp] lemma to_module.tmul (x y) :
266+
to_module f hf (x ⊗ y) = f x y :=
267+
by simp [to_module, tmul]
269268

270269
theorem to_module.unique {g : M ⊗ N → P}
271-
(hg : is_linear_map g) (H : ∀ x y, g (x ⊗ y) = f x y)
270+
(hg : is_linear_map g) (H : ∀ x y, g (x ⊗ y) = f x y)
272271
(z : M ⊗ N) : g z = to_module f hf z :=
273272
begin
274273
apply quotient_add_group.induction_on' z,
@@ -282,7 +281,7 @@ omit hf
282281

283282
theorem to_module.ext {g h : M ⊗ N → P}
284283
(hg : is_linear_map g) (hh : is_linear_map h)
285-
(H : ∀ x y, g (x ⊗ y) = h (x ⊗ y))
284+
(H : ∀ x y, g (x ⊗ y) = h (x ⊗ y))
286285
(z : M ⊗ N) : g z = h z :=
287286
begin
288287
apply quotient_add_group.induction_on' z,
@@ -301,10 +300,10 @@ end
301300
def to_module.equiv : { f : M → N → P // is_bilinear_map f }
302301
≃ linear_map (M ⊗ N) P :=
303302
{ to_fun := λ f, ⟨to_module f.1 f.2, to_module.linear f.2⟩,
304-
inv_fun := λ f, ⟨λ m n, f (m ⊗ n),
303+
inv_fun := λ f, ⟨λ m n, f (m ⊗ n),
305304
is_bilinear_map.comp (bilinear M N) f.2⟩,
306305
left_inv := λ f, subtype.eq $ funext $ λ x, funext $ λ y,
307-
to_module.of f.2 _ _,
306+
to_module.tmul f.2 _ _,
308307
right_inv := λ f, subtype.eq $ eq.symm $ funext $ λ z,
309308
to_module.unique _ f.2 (λ x y, rfl) _ }
310309

@@ -313,11 +312,11 @@ end UMP
313312
protected def id : R ⊗ M ≃ₗ M :=
314313
{ to_fun := @to_module _ _ _ _ _ _ _ _ (λ c x, c • x) $
315314
by refine {..}; intros; simp [smul_add, add_smul, smul_smul, mul_comm, mul_left_comm],
316-
inv_fun := λ x, 1 x,
315+
inv_fun := λ x, 1 x,
317316
left_inv := λ z, by refine to_module.ext
318317
(((bilinear R M).linear_right 1).comp $ to_module.linear _)
319318
is_linear_map.id (λ c x, _) z;
320-
simp; rw [← smul_of, smul_eq_mul, mul_one],
319+
simp; rw [← smul_tmul, smul_eq_mul, mul_one],
321320
right_inv := λ z, by simp,
322321
linear_fun := to_module.linear _ }
323322

@@ -334,7 +333,7 @@ protected def comm : M ⊗ N ≃ₗ N ⊗ M :=
334333

335334
protected def assoc : (M ⊗ N) ⊗ P ≃ₗ M ⊗ (N ⊗ P) :=
336335
{ to_fun := begin
337-
refine to_module (λ mn p, to_module (λ m n, m ⊗ (n ⊗ p)) _ mn) _;
336+
refine to_module (λ mn p, to_module (λ m n, m ⊗ (n ⊗ p)) _ mn) _;
338337
constructor; intros; simp,
339338
{ symmetry,
340339
refine to_module.unique _
@@ -346,7 +345,7 @@ protected def assoc : (M ⊗ N) ⊗ P ≃ₗ M ⊗ (N ⊗ P) :=
346345
intros; simp }
347346
end,
348347
inv_fun := begin
349-
refine to_module (λ m, to_module (λ n p, (m ⊗ n) ⊗ p) _) _;
348+
refine to_module (λ m, to_module (λ n p, (m ⊗ n) ⊗ p) _) _;
350349
constructor; intros; simp,
351350
{ symmetry,
352351
refine to_module.unique _
@@ -357,14 +356,26 @@ protected def assoc : (M ⊗ N) ⊗ P ≃ₗ M ⊗ (N ⊗ P) :=
357356
(is_linear_map.map_smul_right (to_module.linear _)) _ _,
358357
intros; simp }
359358
end,
360-
left_inv := λ z, by refine to_module.ext ((to_module.linear _).comp (to_module.linear _)) is_linear_map.id (λ mn p, _) z;
361-
simp;
362-
refine to_module.ext ((to_module.linear _).comp (to_module.linear _)) ((bilinear _ _).linear_left p) (λ m n, _) mn;
359+
left_inv :=
360+
begin
361+
intro z,
362+
refine to_module.ext ((to_module.linear _).comp
363+
(to_module.linear _)) is_linear_map.id (λ mn p, _) z,
363364
simp,
364-
right_inv := λ z, by refine to_module.ext ((to_module.linear _).comp (to_module.linear _)) is_linear_map.id (λ m np, _) z;
365-
simp;
366-
refine to_module.ext ((to_module.linear _).comp (to_module.linear _)) ((bilinear _ _).linear_right m) (λ n p, _) np;
365+
refine to_module.ext ((to_module.linear _).comp
366+
(to_module.linear _)) ((bilinear _ _).linear_left p) (λ m n, _) mn,
367+
simp
368+
end,
369+
right_inv :=
370+
begin
371+
intro z,
372+
refine to_module.ext ((to_module.linear _).comp
373+
(to_module.linear _)) is_linear_map.id (λ m np, _) z,
367374
simp,
375+
refine to_module.ext ((to_module.linear _).comp
376+
(to_module.linear _)) ((bilinear _ _).linear_right m) (λ n p, _) np,
377+
simp
378+
end,
368379
linear_fun := to_module.linear _ }
369380

370381
end tensor_product

0 commit comments

Comments
 (0)