-
Notifications
You must be signed in to change notification settings - Fork 257
/
Addition.lean
291 lines (228 loc) · 8.38 KB
/
Addition.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/-
Copyright (c) 2021 Aaron Anderson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Aaron Anderson
-/
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.RingTheory.HahnSeries.Basic
#align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965"
/-!
# Additive properties of Hahn series
If `Γ` is ordered and `R` has zero, then `HahnSeries Γ R` consists of formal series over `Γ` with
coefficients in `R`, whose supports are partially well-ordered. With further structure on `R` and
`Γ`, we can add further structure on `HahnSeries Γ R`. When `R` has an addition operation,
`HahnSeries Γ R` also has addition by adding coefficients.
## Main Definitions
* If `R` is a (commutative) additive monoid or group, then so is `HahnSeries Γ R`.
## References
- [J. van der Hoeven, *Operators on Generalized Power Series*][van_der_hoeven]
-/
set_option linter.uppercaseLean3 false
open Finset Function
open scoped Classical
noncomputable section
variable {Γ R : Type*}
namespace HahnSeries
section Addition
variable [PartialOrder Γ]
section AddMonoid
variable [AddMonoid R]
instance : Add (HahnSeries Γ R) where
add x y :=
{ coeff := x.coeff + y.coeff
isPWO_support' := (x.isPWO_support.union y.isPWO_support).mono (Function.support_add _ _) }
instance : AddMonoid (HahnSeries Γ R) where
zero := 0
add := (· + ·)
nsmul := nsmulRec
add_assoc x y z := by
ext
apply add_assoc
zero_add x := by
ext
apply zero_add
add_zero x := by
ext
apply add_zero
@[simp]
theorem add_coeff' {x y : HahnSeries Γ R} : (x + y).coeff = x.coeff + y.coeff :=
rfl
#align hahn_series.add_coeff' HahnSeries.add_coeff'
theorem add_coeff {x y : HahnSeries Γ R} {a : Γ} : (x + y).coeff a = x.coeff a + y.coeff a :=
rfl
#align hahn_series.add_coeff HahnSeries.add_coeff
theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y :=
fun a ha => by
rw [mem_support, add_coeff] at ha
rw [Set.mem_union, mem_support, mem_support]
contrapose! ha
rw [ha.1, ha.2, add_zero]
#align hahn_series.support_add_subset HahnSeries.support_add_subset
theorem min_order_le_order_add {Γ} [Zero Γ] [LinearOrder Γ] {x y : HahnSeries Γ R}
(hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
by_cases hx : x = 0; · simp [hx]
by_cases hy : y = 0; · simp [hy]
rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]
refine' le_of_eq_of_le _ (Set.IsWF.min_le_min_of_subset (support_add_subset (x := x) (y := y)))
exact (Set.IsWF.min_union _ _ _ _).symm
#align hahn_series.min_order_le_order_add HahnSeries.min_order_le_order_add
/-- `single` as an additive monoid/group homomorphism -/
@[simps!]
def single.addMonoidHom (a : Γ) : R →+ HahnSeries Γ R :=
{ single a with
map_add' := fun x y => by
ext b
by_cases h : b = a <;> simp [h] }
#align hahn_series.single.add_monoid_hom HahnSeries.single.addMonoidHom
/-- `coeff g` as an additive monoid/group homomorphism -/
@[simps]
def coeff.addMonoidHom (g : Γ) : HahnSeries Γ R →+ R where
toFun f := f.coeff g
map_zero' := zero_coeff
map_add' _ _ := add_coeff
#align hahn_series.coeff.add_monoid_hom HahnSeries.coeff.addMonoidHom
section Domain
variable {Γ' : Type*} [PartialOrder Γ']
theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
embDomain f (x + y) = embDomain f x + embDomain f y := by
ext g
by_cases hg : g ∈ Set.range f
· obtain ⟨a, rfl⟩ := hg
simp
· simp [embDomain_notin_range hg]
#align hahn_series.emb_domain_add HahnSeries.embDomain_add
end Domain
end AddMonoid
instance [AddCommMonoid R] : AddCommMonoid (HahnSeries Γ R) :=
{ inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
add_comm := fun x y => by
ext
apply add_comm }
section AddGroup
variable [AddGroup R]
instance : Neg (HahnSeries Γ R) where
neg x :=
{ coeff := fun a => -x.coeff a
isPWO_support' := by
rw [Function.support_neg]
exact x.isPWO_support }
instance : AddGroup (HahnSeries Γ R) :=
{ inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
zsmul := zsmulRec
add_left_neg := fun x => by
ext
apply add_left_neg }
@[simp]
theorem neg_coeff' {x : HahnSeries Γ R} : (-x).coeff = -x.coeff :=
rfl
#align hahn_series.neg_coeff' HahnSeries.neg_coeff'
theorem neg_coeff {x : HahnSeries Γ R} {a : Γ} : (-x).coeff a = -x.coeff a :=
rfl
#align hahn_series.neg_coeff HahnSeries.neg_coeff
@[simp]
theorem support_neg {x : HahnSeries Γ R} : (-x).support = x.support := by
ext
simp
#align hahn_series.support_neg HahnSeries.support_neg
@[simp]
theorem sub_coeff' {x y : HahnSeries Γ R} : (x - y).coeff = x.coeff - y.coeff := by
ext
simp [sub_eq_add_neg]
#align hahn_series.sub_coeff' HahnSeries.sub_coeff'
theorem sub_coeff {x y : HahnSeries Γ R} {a : Γ} : (x - y).coeff a = x.coeff a - y.coeff a := by
simp
#align hahn_series.sub_coeff HahnSeries.sub_coeff
@[simp]
theorem order_neg [Zero Γ] {f : HahnSeries Γ R} : (-f).order = f.order := by
by_cases hf : f = 0
· simp only [hf, neg_zero]
simp only [order, support_neg, neg_eq_zero]
#align hahn_series.order_neg HahnSeries.order_neg
end AddGroup
instance [AddCommGroup R] : AddCommGroup (HahnSeries Γ R) :=
{ inferInstanceAs (AddCommMonoid (HahnSeries Γ R)),
inferInstanceAs (AddGroup (HahnSeries Γ R)) with }
end Addition
section DistribMulAction
variable [PartialOrder Γ] {V : Type*} [Monoid R] [AddMonoid V] [DistribMulAction R V]
instance : SMul R (HahnSeries Γ V) :=
⟨fun r x =>
{ coeff := r • x.coeff
isPWO_support' := x.isPWO_support.mono (Function.support_const_smul_subset r x.coeff) }⟩
@[simp]
theorem smul_coeff {r : R} {x : HahnSeries Γ V} {a : Γ} : (r • x).coeff a = r • x.coeff a :=
rfl
#align hahn_series.smul_coeff HahnSeries.smul_coeff
instance : DistribMulAction R (HahnSeries Γ V) where
smul := (· • ·)
one_smul _ := by
ext
simp
smul_zero _ := by
ext
simp
smul_add _ _ _ := by
ext
simp [smul_add]
mul_smul _ _ _ := by
ext
simp [mul_smul]
theorem order_smul_not_lt [Zero Γ] (r : R) (x : HahnSeries Γ V) (h : r • x ≠ 0) :
¬ (r • x).order < x.order := by
have hx : x ≠ 0 := right_ne_zero_of_smul h
simp_all only [order, dite_false]
exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right (fun _ => r) x.coeff)
theorem le_order_smul {Γ} [Zero Γ] [LinearOrder Γ] (r : R) (x : HahnSeries Γ V) (h : r • x ≠ 0) :
x.order ≤ (r • x).order := le_of_not_lt (order_smul_not_lt r x h)
variable {S : Type*} [Monoid S] [DistribMulAction S V]
instance [SMul R S] [IsScalarTower R S V] : IsScalarTower R S (HahnSeries Γ V) :=
⟨fun r s a => by
ext
simp⟩
instance [SMulCommClass R S V] : SMulCommClass R S (HahnSeries Γ V) :=
⟨fun r s a => by
ext
simp [smul_comm]⟩
end DistribMulAction
section Module
variable [PartialOrder Γ] [Semiring R] {V : Type*} [AddCommMonoid V] [Module R V]
instance : Module R (HahnSeries Γ V) :=
{ inferInstanceAs (DistribMulAction R (HahnSeries Γ V)) with
zero_smul := fun _ => by
ext
simp
add_smul := fun _ _ _ => by
ext
simp [add_smul] }
/-- `single` as a linear map -/
@[simps]
def single.linearMap (a : Γ) : V →ₗ[R] HahnSeries Γ V :=
{ single.addMonoidHom a with
map_smul' := fun r s => by
ext b
by_cases h : b = a <;> simp [h] }
#align hahn_series.single.linear_map HahnSeries.single.linearMap
/-- `coeff g` as a linear map -/
@[simps]
def coeff.linearMap (g : Γ) : HahnSeries Γ V →ₗ[R] V :=
{ coeff.addMonoidHom g with map_smul' := fun _ _ => rfl }
#align hahn_series.coeff.linear_map HahnSeries.coeff.linearMap
section Domain
variable {Γ' : Type*} [PartialOrder Γ']
theorem embDomain_smul (f : Γ ↪o Γ') (r : R) (x : HahnSeries Γ R) :
embDomain f (r • x) = r • embDomain f x := by
ext g
by_cases hg : g ∈ Set.range f
· obtain ⟨a, rfl⟩ := hg
simp
· simp [embDomain_notin_range hg]
#align hahn_series.emb_domain_smul HahnSeries.embDomain_smul
/-- Extending the domain of Hahn series is a linear map. -/
@[simps]
def embDomainLinearMap (f : Γ ↪o Γ') : HahnSeries Γ R →ₗ[R] HahnSeries Γ' R where
toFun := embDomain f
map_add' := embDomain_add f
map_smul' := embDomain_smul f
#align hahn_series.emb_domain_linear_map HahnSeries.embDomainLinearMap
end Domain
end Module