@@ -13,7 +13,7 @@ universes u v w x
13
13
variables {α : Type u} {β : Type v} {γ : Type w} {δ : Type x}
14
14
15
15
/-- Typeclass for types with a scalar multiplication operation, denoted `•` (`\bu`) -/
16
- class has_scalar (α : out_param $ Type u) (γ : Type v) := (smul : α → γ → γ)
16
+ class has_scalar (α : Type u) (γ : Type v) := (smul : α → γ → γ)
17
17
18
18
infixr ` • `:73 := has_scalar.smul
19
19
@@ -22,25 +22,26 @@ infixr ` • `:73 := has_scalar.smul
22
22
connected by a "scalar multiplication" operation `r • x : β`
23
23
(where `r : α` and `x : β`) with some natural associativity and
24
24
distributivity axioms similar to those on a ring. -/
25
- class semimodule (α : out_param $ Type u) (β : Type v) [out_param $ semiring α]
25
+ class semimodule (α : Type u) (β : Type v) [semiring α]
26
26
[add_comm_monoid β] extends has_scalar α β :=
27
- (smul_add : ∀r (x y : β), r • (x + y) = r • x + r • y)
28
- (add_smul : ∀r s (x : β), (r + s) • x = r • x + s • x)
29
- (mul_smul : ∀r s (x : β), (r * s) • x = r • s • x)
27
+ (smul_add : ∀(r : α) (x y : β), r • (x + y) = r • x + r • y)
28
+ (add_smul : ∀( r s : α) (x : β), (r + s) • x = r • x + s • x)
29
+ (mul_smul : ∀( r s : α) (x : β), (r * s) • x = r • s • x)
30
30
(one_smul : ∀x : β, (1 : α) • x = x)
31
31
(zero_smul : ∀x : β, (0 : α) • x = 0 )
32
- (smul_zero {} : ∀r , r • (0 : β) = 0 )
32
+ (smul_zero {} : ∀(r : α) , r • (0 : β) = 0 )
33
33
34
34
section semimodule
35
- variables { R:semiring α} [add_comm_monoid β] [semimodule α β] (r s : α) (x y : β)
35
+ variables [ R:semiring α] [add_comm_monoid β] [semimodule α β] (r s : α) (x y : β)
36
36
include R
37
37
38
38
theorem smul_add : r • (x + y) = r • x + r • y := semimodule.smul_add r x y
39
39
theorem add_smul : (r + s) • x = r • x + s • x := semimodule.add_smul r s x
40
40
theorem mul_smul : (r * s) • x = r • s • x := semimodule.mul_smul r s x
41
- @[simp] theorem one_smul : (1 : α) • x = x := semimodule.one_smul x
42
- @[simp] theorem zero_smul : (0 : α) • x = 0 := semimodule.zero_smul x
43
41
@[simp] theorem smul_zero : r • (0 : β) = 0 := semimodule.smul_zero r
42
+ variables (α)
43
+ @[simp] theorem one_smul : (1 : α) • x = x := semimodule.one_smul α x
44
+ @[simp] theorem zero_smul : (0 : α) • x = 0 := semimodule.zero_smul α x
44
45
45
46
lemma smul_smul : r • s • x = (r * s) • x := (mul_smul _ _ _).symm
46
47
@@ -54,36 +55,36 @@ end semimodule
54
55
connected by a "scalar multiplication" operation `r • x : β`
55
56
(where `r : α` and `x : β`) with some natural associativity and
56
57
distributivity axioms similar to those on a ring. -/
57
- class module (α : out_param $ Type u) (β : Type v) [out_param $ ring α]
58
- [add_comm_group β] extends semimodule α β
58
+ class module (α : Type u) (β : Type v) [ring α] [add_comm_group β] extends semimodule α β
59
59
60
60
structure module.core (α β) [ring α] [add_comm_group β] extends has_scalar α β :=
61
- (smul_add : ∀r (x y : β), r • (x + y) = r • x + r • y)
62
- (add_smul : ∀r s (x : β), (r + s) • x = r • x + s • x)
63
- (mul_smul : ∀r s (x : β), (r * s) • x = r • s • x)
61
+ (smul_add : ∀(r : α) (x y : β), r • (x + y) = r • x + r • y)
62
+ (add_smul : ∀( r s : α) (x : β), (r + s) • x = r • x + s • x)
63
+ (mul_smul : ∀( r s : α) (x : β), (r * s) • x = r • s • x)
64
64
(one_smul : ∀x : β, (1 : α) • x = x)
65
65
66
66
def module.of_core {α β} [ring α] [add_comm_group β] (M : module.core α β) : module α β :=
67
67
by letI := M.to_has_scalar; exact
68
68
{ zero_smul := λ x,
69
- have (0 : α) • x + 0 • x = 0 • x + 0 , by rw ← M.add_smul; simp,
69
+ have (0 : α) • x + ( 0 : α) • x = ( 0 : α) • x + 0 , by rw ← M.add_smul; simp,
70
70
add_left_cancel this ,
71
71
smul_zero := λ r,
72
72
have r • (0 :β) + r • 0 = r • 0 + 0 , by rw ← M.smul_add; simp,
73
73
add_left_cancel this ,
74
74
..M }
75
75
76
76
section module
77
- variables {R:ring α} [add_comm_group β] [module α β] {r s : α} {x y : β}
78
- include R
77
+ variables [ring α] [add_comm_group β] [module α β] (r s : α) (x y : β)
79
78
80
79
@[simp] theorem neg_smul : -r • x = - (r • x) :=
81
80
eq_neg_of_add_eq_zero (by rw [← add_smul, add_left_neg, zero_smul])
82
81
82
+ variables (α)
83
83
theorem neg_one_smul (x : β) : (-1 : α) • x = -x := by simp
84
+ variables {α}
84
85
85
86
@[simp] theorem smul_neg : r • (-x) = -(r • x) :=
86
- by rw [← neg_one_smul x , ← mul_smul, mul_neg_one, neg_smul]
87
+ by rw [← neg_one_smul α , ← mul_smul, mul_neg_one, neg_smul]
87
88
88
89
theorem smul_sub (r : α) (x y : β) : r • (x - y) = r • x - r • y :=
89
90
by simp [smul_add]; rw smul_neg
@@ -107,48 +108,49 @@ instance semiring.to_semimodule [r : semiring α] : semimodule α α :=
107
108
instance ring.to_module [r : ring α] : module α α :=
108
109
{ ..semiring.to_semimodule }
109
110
110
- class is_linear_map { α : Type u} {β : Type v} {γ : Type w}
111
+ class is_linear_map ( α : Type u) {β : Type v} {γ : Type w}
111
112
[ring α] [add_comm_group β] [add_comm_group γ] [module α β] [module α γ]
112
113
(f : β → γ) : Prop :=
113
114
(add : ∀x y, f (x + y) = f x + f y)
114
- (smul : ∀c x, f (c • x) = c • f x)
115
+ (smul : ∀(c : α) x, f (c • x) = c • f x)
115
116
116
- structure linear_map { α : Type u} (β : Type v) (γ : Type w)
117
+ structure linear_map ( α : Type u) (β : Type v) (γ : Type w)
117
118
[ring α] [add_comm_group β] [add_comm_group γ] [module α β] [module α γ] :=
118
119
(to_fun : β → γ)
119
120
(add : ∀x y, to_fun (x + y) = to_fun x + to_fun y)
120
- (smul : ∀c x, to_fun (c • x) = c • to_fun x)
121
+ (smul : ∀(c : α) x, to_fun (c • x) = c • to_fun x)
121
122
122
- infixr ` →ₗ `:25 := linear_map
123
+ infixr ` →ₗ `:25 := linear_map _
124
+ notation β ` →ₗ[`:25 α `] ` γ := linear_map α β γ
123
125
124
126
namespace linear_map
125
127
126
128
variables [ring α] [add_comm_group β] [add_comm_group γ] [add_comm_group δ]
127
129
variables [module α β] [module α γ] [module α δ]
128
- variables (f g : β →ₗ γ)
130
+ variables (f g : β →ₗ[α] γ)
129
131
include α
130
132
131
- instance : has_coe_to_fun (β →ₗ γ) := ⟨_, to_fun⟩
133
+ instance : has_coe_to_fun (β →ₗ[α] γ) := ⟨_, to_fun⟩
132
134
133
- theorem is_linear : is_linear_map f := {..f}
135
+ theorem is_linear : is_linear_map α f := {..f}
134
136
135
- @[extensionality] theorem ext {f g : β →ₗ γ} (H : ∀ x, f x = g x) : f = g :=
137
+ @[extensionality] theorem ext {f g : β →ₗ[α] γ} (H : ∀ x, f x = g x) : f = g :=
136
138
by cases f; cases g; congr'; exact funext H
137
139
138
- theorem ext_iff {f g : β →ₗ γ} : f = g ↔ ∀ x, f x = g x :=
140
+ theorem ext_iff {f g : β →ₗ[α] γ} : f = g ↔ ∀ x, f x = g x :=
139
141
⟨by rintro rfl; simp, ext⟩
140
142
141
143
@[simp] lemma map_add (x y : β) : f (x + y) = f x + f y := f.add x y
142
144
143
145
@[simp] lemma map_smul (c : α) (x : β) : f (c • x) = c • f x := f.smul c x
144
146
145
147
@[simp] lemma map_zero : f 0 = 0 :=
146
- by rw [← zero_smul, map_smul f 0 0 , zero_smul]
148
+ by rw [← zero_smul α , map_smul f 0 0 , zero_smul]
147
149
148
150
instance : is_add_group_hom f := ⟨map_add f⟩
149
151
150
152
@[simp] lemma map_neg (x : β) : f (- x) = - f x :=
151
- by rw [← neg_one_smul, map_smul, neg_one_smul]
153
+ by rw [← neg_one_smul α , map_smul, neg_one_smul]
152
154
153
155
@[simp] lemma map_sub (x y : β) : f (x - y) = f x - f y :=
154
156
by simp [map_neg, map_add]
@@ -157,11 +159,11 @@ by simp [map_neg, map_add]
157
159
f (t.sum g) = t.sum (λi, f (g i)) :=
158
160
(finset.sum_hom f).symm
159
161
160
- def comp (f : γ →ₗ δ) (g : β →ₗ γ) : β →ₗ δ := ⟨f ∘ g, by simp, by simp⟩
162
+ def comp (f : γ →ₗ[α] δ) (g : β →ₗ[α] γ) : β →ₗ[α] δ := ⟨f ∘ g, by simp, by simp⟩
161
163
162
- @[simp] lemma comp_apply (f : γ →ₗ δ) (g : β →ₗ γ) (x : β) : f.comp g x = f (g x) := rfl
164
+ @[simp] lemma comp_apply (f : γ →ₗ[α] δ) (g : β →ₗ[α] γ) (x : β) : f.comp g x = f (g x) := rfl
163
165
164
- def id : linear_map β β := ⟨id, by simp, by simp⟩
166
+ def id : β →ₗ[α] β := ⟨id, by simp, by simp⟩
165
167
166
168
@[simp] lemma id_apply (x : β) : @id α β _ _ _ x = x := rfl
167
169
@@ -172,29 +174,28 @@ variables [ring α] [add_comm_group β] [add_comm_group γ]
172
174
variables [module α β] [module α γ]
173
175
include α
174
176
175
- def mk' (f : β → γ) (H : is_linear_map f) : β →ₗ γ := {to_fun := f, ..H}
177
+ def mk' (f : β → γ) (H : is_linear_map α f) : β →ₗ γ := {to_fun := f, ..H}
176
178
177
- @[simp] theorem mk'_apply {f : β → γ} (H : is_linear_map f) (x : β) :
179
+ @[simp] theorem mk'_apply {f : β → γ} (H : is_linear_map α f) (x : β) :
178
180
mk' f H x = f x := rfl
179
181
180
182
end is_linear_map
181
183
182
184
/-- A submodule of a module is one which is closed under vector operations.
183
185
This is a sufficient condition for the subset of vectors in the submodule
184
186
to themselves form a module. -/
185
- structure submodule (α : Type u) (β : Type v) {R: ring α}
187
+ structure submodule (α : Type u) (β : Type v) [ ring α]
186
188
[add_comm_group β] [module α β] : Type v :=
187
189
(carrier : set β)
188
190
(zero : (0 :β) ∈ carrier)
189
191
(add : ∀ {x y}, x ∈ carrier → y ∈ carrier → x + y ∈ carrier)
190
- (smul : ∀ c {x}, x ∈ carrier → c • x ∈ carrier)
192
+ (smul : ∀ (c:α) {x}, x ∈ carrier → c • x ∈ carrier)
191
193
192
194
namespace submodule
193
- variables {R: ring α} [add_comm_group β] [add_comm_group γ]
195
+ variables [ ring α] [add_comm_group β] [add_comm_group γ]
194
196
variables [module α β] [module α γ]
195
197
variables (p p' : submodule α β)
196
198
variables {r : α} {x y : β}
197
- include R
198
199
199
200
instance : has_coe (submodule α β) (set β) := ⟨submodule.carrier⟩
200
201
instance : has_mem β (submodule α β) := ⟨λ x p, x ∈ (p : set β)⟩
@@ -215,7 +216,7 @@ lemma add_mem (h₁ : x ∈ p) (h₂ : y ∈ p) : x + y ∈ p := p.add h₁ h₂
215
216
216
217
lemma smul_mem (r : α) (h : x ∈ p) : r • x ∈ p := p.smul r h
217
218
218
- lemma neg_mem (hx : x ∈ p) : -x ∈ p := by rw ← neg_one_smul x ; exact p.smul_mem _ hx
219
+ lemma neg_mem (hx : x ∈ p) : -x ∈ p := by rw ← neg_one_smul α ; exact p.smul_mem _ hx
219
220
220
221
lemma sub_mem (hx : x ∈ p) (hy : y ∈ p) : x - y ∈ p := p.add_mem hx (p.neg_mem hy)
221
222
@@ -252,7 +253,7 @@ instance : module α p :=
252
253
by refine {smul := (•), ..};
253
254
{ intros, apply set_coe.ext, simp [smul_add, add_smul, mul_smul] }
254
255
255
- protected def subtype : p →ₗ β :=
256
+ protected def subtype : p →ₗ[α] β :=
256
257
by refine {to_fun := coe, ..}; simp [coe_smul]
257
258
258
259
@[simp] theorem subtype_apply (x : p) : p.subtype x = x := rfl
@@ -287,8 +288,7 @@ end ideal
287
288
This is the traditional generalization of spaces like `ℝ^n`, which have a natural
288
289
addition operation and a way to multiply them by real numbers, but no multiplication
289
290
operation between vectors. -/
290
- class vector_space (α : out_param $ Type u) (β : Type v)
291
- [out_param $ discrete_field α] [add_comm_group β] extends module α β
291
+ class vector_space (α : Type u) (β : Type v) [discrete_field α] [add_comm_group β] extends module α β
292
292
293
293
/-- Subspace of a vector space. Defined to equal `submodule`. -/
294
294
@[reducible] def subspace (α : Type u) (β : Type v)
0 commit comments