-
Notifications
You must be signed in to change notification settings - Fork 298
/
hahn_series.lean
1628 lines (1361 loc) · 58.6 KB
/
hahn_series.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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/-
Copyright (c) 2021 Aaron Anderson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Aaron Anderson
-/
import order.well_founded_set
import algebra.big_operators.finprod
import ring_theory.valuation.basic
import algebra.module.pi
import ring_theory.power_series.basic
/-!
# Hahn Series
If `Γ` is ordered and `R` has zero, then `hahn_series Γ 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 `hahn_series Γ R`, with the most studied case being when `Γ` is
a linearly ordered abelian group and `R` is a field, in which case `hahn_series Γ R` is a
valued field, with value group `Γ`.
These generalize Laurent series (with value group `ℤ`), and Laurent series are implemented that way
in the file `ring_theory/laurent_series`.
## Main Definitions
* If `Γ` is ordered and `R` has zero, then `hahn_series Γ R` consists of
formal series over `Γ` with coefficients in `R`, whose supports are partially well-ordered.
* If `R` is a (commutative) additive monoid or group, then so is `hahn_series Γ R`.
* If `R` is a (comm_)(semi)ring, then so is `hahn_series Γ R`.
* `hahn_series.add_val Γ R` defines an `add_valuation` on `hahn_series Γ R` when `Γ` is linearly
ordered.
* A `hahn_series.summable_family` is a family of Hahn series such that the union of their supports
is well-founded and only finitely many are nonzero at any given coefficient. They have a formal
sum, `hahn_series.summable_family.hsum`, which can be bundled as a `linear_map` as
`hahn_series.summable_family.lsum`. Note that this is different from `summable` in the valuation
topology, because there are topologically summable families that do not satisfy the axioms of
`hahn_series.summable_family`, and formally summable families whose sums do not converge
topologically.
* Laurent series over `R` are implemented as `hahn_series ℤ R` in the file
`ring_theory/laurent_series`.
## TODO
* Build an API for the variable `X` (defined to be `single 1 1 : hahn_series Γ R`) in analogy to
`X : polynomial R` and `X : power_series R`
## References
- [J. van der Hoeven, *Operators on Generalized Power Series*][van_der_hoeven]
-/
open finset function
open_locale big_operators classical pointwise
noncomputable theory
/-- If `Γ` is linearly ordered and `R` has zero, then `hahn_series Γ R` consists of
formal series over `Γ` with coefficients in `R`, whose supports are well-founded. -/
@[ext]
structure hahn_series (Γ : Type*) (R : Type*) [partial_order Γ] [has_zero R] :=
(coeff : Γ → R)
(is_pwo_support' : (support coeff).is_pwo)
variables {Γ : Type*} {R : Type*}
namespace hahn_series
section zero
variables [partial_order Γ] [has_zero R]
lemma coeff_injective : injective (coeff : hahn_series Γ R → (Γ → R)) := ext
@[simp] lemma coeff_inj {x y : hahn_series Γ R} : x.coeff = y.coeff ↔ x = y :=
coeff_injective.eq_iff
/-- The support of a Hahn series is just the set of indices whose coefficients are nonzero.
Notably, it is well-founded. -/
def support (x : hahn_series Γ R) : set Γ := support x.coeff
@[simp]
lemma is_pwo_support (x : hahn_series Γ R) : x.support.is_pwo := x.is_pwo_support'
@[simp]
lemma is_wf_support (x : hahn_series Γ R) : x.support.is_wf := x.is_pwo_support.is_wf
@[simp]
lemma mem_support (x : hahn_series Γ R) (a : Γ) : a ∈ x.support ↔ x.coeff a ≠ 0 := iff.refl _
instance : has_zero (hahn_series Γ R) :=
⟨{ coeff := 0,
is_pwo_support' := by simp }⟩
instance : inhabited (hahn_series Γ R) := ⟨0⟩
instance [subsingleton R] : subsingleton (hahn_series Γ R) :=
⟨λ a b, a.ext b (subsingleton.elim _ _)⟩
@[simp] lemma zero_coeff {a : Γ} : (0 : hahn_series Γ R).coeff a = 0 := rfl
@[simp] lemma coeff_fun_eq_zero_iff {x : hahn_series Γ R} : x.coeff = 0 ↔ x = 0 :=
coeff_injective.eq_iff' rfl
lemma ne_zero_of_coeff_ne_zero {x : hahn_series Γ R} {g : Γ} (h : x.coeff g ≠ 0) :
x ≠ 0 :=
mt (λ x0, (x0.symm ▸ zero_coeff : x.coeff g = 0)) h
@[simp] lemma support_zero : support (0 : hahn_series Γ R) = ∅ := function.support_zero
@[simp] lemma support_nonempty_iff {x : hahn_series Γ R} : x.support.nonempty ↔ x ≠ 0 :=
by rw [support, support_nonempty_iff, ne.def, coeff_fun_eq_zero_iff]
@[simp] lemma support_eq_empty_iff {x : hahn_series Γ R} : x.support = ∅ ↔ x = 0 :=
support_eq_empty_iff.trans coeff_fun_eq_zero_iff
/-- `single a r` is the Hahn series which has coefficient `r` at `a` and zero otherwise. -/
def single (a : Γ) : zero_hom R (hahn_series Γ R) :=
{ to_fun := λ r, { coeff := pi.single a r,
is_pwo_support' := (set.is_pwo_singleton a).mono pi.support_single_subset },
map_zero' := ext _ _ (pi.single_zero _) }
variables {a b : Γ} {r : R}
@[simp]
theorem single_coeff_same (a : Γ) (r : R) : (single a r).coeff a = r := pi.single_eq_same a r
@[simp]
theorem single_coeff_of_ne (h : b ≠ a) : (single a r).coeff b = 0 := pi.single_eq_of_ne h r
theorem single_coeff : (single a r).coeff b = if (b = a) then r else 0 :=
by { split_ifs with h; simp [h] }
@[simp]
lemma support_single_of_ne (h : r ≠ 0) : support (single a r) = {a} :=
pi.support_single_of_ne h
lemma support_single_subset : support (single a r) ⊆ {a} :=
pi.support_single_subset
lemma eq_of_mem_support_single {b : Γ} (h : b ∈ support (single a r)) : b = a :=
support_single_subset h
@[simp]
lemma single_eq_zero : (single a (0 : R)) = 0 := (single a).map_zero
lemma single_injective (a : Γ) : function.injective (single a : R → hahn_series Γ R) :=
λ r s rs, by rw [← single_coeff_same a r, ← single_coeff_same a s, rs]
lemma single_ne_zero (h : r ≠ 0) : single a r ≠ 0 :=
λ con, h (single_injective a (con.trans single_eq_zero.symm))
instance [nonempty Γ] [nontrivial R] : nontrivial (hahn_series Γ R) :=
⟨begin
obtain ⟨r, s, rs⟩ := exists_pair_ne R,
inhabit Γ,
refine ⟨single (arbitrary Γ) r, single (arbitrary Γ) s, λ con, rs _⟩,
rw [← single_coeff_same (arbitrary Γ) r, con, single_coeff_same],
end⟩
section order
variable [has_zero Γ]
/-- The order of a nonzero Hahn series `x` is a minimal element of `Γ` where `x` has a
nonzero coefficient, the order of 0 is 0. -/
def order (x : hahn_series Γ R) : Γ :=
if h : x = 0 then 0 else x.is_wf_support.min (support_nonempty_iff.2 h)
@[simp]
lemma order_zero : order (0 : hahn_series Γ R) = 0 := dif_pos rfl
lemma order_of_ne {x : hahn_series Γ R} (hx : x ≠ 0) :
order x = x.is_wf_support.min (support_nonempty_iff.2 hx) := dif_neg hx
lemma coeff_order_ne_zero {x : hahn_series Γ R} (hx : x ≠ 0) :
x.coeff x.order ≠ 0 :=
begin
rw order_of_ne hx,
exact x.is_wf_support.min_mem (support_nonempty_iff.2 hx)
end
lemma order_le_of_coeff_ne_zero {Γ} [linear_ordered_cancel_add_comm_monoid Γ]
{x : hahn_series Γ R} {g : Γ} (h : x.coeff g ≠ 0) :
x.order ≤ g :=
le_trans (le_of_eq (order_of_ne (ne_zero_of_coeff_ne_zero h)))
(set.is_wf.min_le _ _ ((mem_support _ _).2 h))
@[simp]
lemma order_single (h : r ≠ 0) : (single a r).order = a :=
(order_of_ne (single_ne_zero h)).trans (support_single_subset ((single a r).is_wf_support.min_mem
(support_nonempty_iff.2 (single_ne_zero h))))
lemma coeff_eq_zero_of_lt_order {x : hahn_series Γ R} {i : Γ} (hi : i < x.order) : x.coeff i = 0 :=
begin
rcases eq_or_ne x 0 with rfl|hx,
{ simp },
contrapose! hi,
rw [←ne.def, ←mem_support] at hi,
rw [order_of_ne hx],
exact set.is_wf.not_lt_min _ _ hi
end
end order
section domain
variables {Γ' : Type*} [partial_order Γ']
/-- Extends the domain of a `hahn_series` by an `order_embedding`. -/
def emb_domain (f : Γ ↪o Γ') : hahn_series Γ R → hahn_series Γ' R :=
λ x, { coeff := λ (b : Γ'),
if h : b ∈ f '' x.support then x.coeff (classical.some h) else 0,
is_pwo_support' := (x.is_pwo_support.image_of_monotone f.monotone).mono (λ b hb, begin
contrapose! hb,
rw [function.mem_support, dif_neg hb, not_not],
end) }
@[simp]
lemma emb_domain_coeff {f : Γ ↪o Γ'} {x : hahn_series Γ R} {a : Γ} :
(emb_domain f x).coeff (f a) = x.coeff a :=
begin
rw emb_domain,
dsimp only,
by_cases ha : a ∈ x.support,
{ rw dif_pos (set.mem_image_of_mem f ha),
exact congr rfl (f.injective (classical.some_spec (set.mem_image_of_mem f ha)).2) },
{ rw [dif_neg, not_not.1 (λ c, ha ((mem_support _ _).2 c))],
contrapose! ha,
obtain ⟨b, hb1, hb2⟩ := (set.mem_image _ _ _).1 ha,
rwa f.injective hb2 at hb1 }
end
@[simp]
lemma emb_domain_mk_coeff {f : Γ → Γ'}
(hfi : function.injective f) (hf : ∀ g g' : Γ, f g ≤ f g' ↔ g ≤ g')
{x : hahn_series Γ R} {a : Γ} :
(emb_domain ⟨⟨f, hfi⟩, hf⟩ x).coeff (f a) = x.coeff a :=
emb_domain_coeff
lemma emb_domain_notin_image_support {f : Γ ↪o Γ'} {x : hahn_series Γ R} {b : Γ'}
(hb : b ∉ f '' x.support) : (emb_domain f x).coeff b = 0 :=
dif_neg hb
lemma support_emb_domain_subset {f : Γ ↪o Γ'} {x : hahn_series Γ R} :
support (emb_domain f x) ⊆ f '' x.support :=
begin
intros g hg,
contrapose! hg,
rw [mem_support, emb_domain_notin_image_support hg, not_not],
end
lemma emb_domain_notin_range {f : Γ ↪o Γ'} {x : hahn_series Γ R} {b : Γ'}
(hb : b ∉ set.range f) : (emb_domain f x).coeff b = 0 :=
emb_domain_notin_image_support (λ con, hb (set.image_subset_range _ _ con))
@[simp]
lemma emb_domain_zero {f : Γ ↪o Γ'} : emb_domain f (0 : hahn_series Γ R) = 0 :=
by { ext, simp [emb_domain_notin_image_support] }
@[simp]
lemma emb_domain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
emb_domain f (single g r) = single (f g) r :=
begin
ext g',
by_cases h : g' = f g,
{ simp [h] },
rw [emb_domain_notin_image_support, single_coeff_of_ne h],
by_cases hr : r = 0,
{ simp [hr] },
rwa [support_single_of_ne hr, set.image_singleton, set.mem_singleton_iff],
end
lemma emb_domain_injective {f : Γ ↪o Γ'} :
function.injective (emb_domain f : hahn_series Γ R → hahn_series Γ' R) :=
λ x y xy, begin
ext g,
rw [ext_iff, function.funext_iff] at xy,
have xyg := xy (f g),
rwa [emb_domain_coeff, emb_domain_coeff] at xyg,
end
end domain
end zero
section addition
variable [partial_order Γ]
section add_monoid
variable [add_monoid R]
instance : has_add (hahn_series Γ R) :=
{ add := λ x y, { coeff := x.coeff + y.coeff,
is_pwo_support' := (x.is_pwo_support.union y.is_pwo_support).mono
(function.support_add _ _) } }
instance : add_monoid (hahn_series Γ R) :=
{ zero := 0,
add := (+),
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]
lemma add_coeff' {x y : hahn_series Γ R} :
(x + y).coeff = x.coeff + y.coeff := rfl
lemma add_coeff {x y : hahn_series Γ R} {a : Γ} :
(x + y).coeff a = x.coeff a + y.coeff a := rfl
lemma support_add_subset {x y : hahn_series Γ R} :
support (x + y) ⊆ support x ∪ support y :=
λ a ha, begin
rw [mem_support, add_coeff] at ha,
rw [set.mem_union, mem_support, mem_support],
contrapose! ha,
rw [ha.1, ha.2, add_zero],
end
lemma min_order_le_order_add {Γ} [linear_ordered_cancel_add_comm_monoid Γ] {x y : hahn_series Γ R}
(hxy : x + y ≠ 0) :
min x.order y.order ≤ (x + y).order :=
begin
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_trans _ (set.is_wf.min_le_min_of_subset support_add_subset),
{ exact x.is_wf_support.union y.is_wf_support },
{ exact set.nonempty.mono (set.subset_union_left _ _) (support_nonempty_iff.2 hx) },
rw set.is_wf.min_union,
end
/-- `single` as an additive monoid/group homomorphism -/
@[simps] def single.add_monoid_hom (a : Γ) : R →+ (hahn_series Γ R) :=
{ map_add' := λ x y, by { ext b, by_cases h : b = a; simp [h] },
..single a }
/-- `coeff g` as an additive monoid/group homomorphism -/
@[simps] def coeff.add_monoid_hom (g : Γ) : (hahn_series Γ R) →+ R :=
{ to_fun := λ f, f.coeff g,
map_zero' := zero_coeff,
map_add' := λ x y, add_coeff }
section domain
variables {Γ' : Type*} [partial_order Γ']
lemma emb_domain_add (f : Γ ↪o Γ') (x y : hahn_series Γ R) :
emb_domain f (x + y) = emb_domain f x + emb_domain f y :=
begin
ext g,
by_cases hg : g ∈ set.range f,
{ obtain ⟨a, rfl⟩ := hg,
simp },
{ simp [emb_domain_notin_range, hg] }
end
end domain
end add_monoid
instance [add_comm_monoid R] : add_comm_monoid (hahn_series Γ R) :=
{ add_comm := λ x y, by { ext, apply add_comm }
.. hahn_series.add_monoid }
section add_group
variable [add_group R]
instance : add_group (hahn_series Γ R) :=
{ neg := λ x, { coeff := λ a, - x.coeff a,
is_pwo_support' := by { rw function.support_neg,
exact x.is_pwo_support }, },
add_left_neg := λ x, by { ext, apply add_left_neg },
.. hahn_series.add_monoid }
@[simp]
lemma neg_coeff' {x : hahn_series Γ R} : (- x).coeff = - x.coeff := rfl
lemma neg_coeff {x : hahn_series Γ R} {a : Γ} : (- x).coeff a = - x.coeff a := rfl
@[simp]
lemma support_neg {x : hahn_series Γ R} : (- x).support = x.support :=
by { ext, simp }
@[simp]
lemma sub_coeff' {x y : hahn_series Γ R} :
(x - y).coeff = x.coeff - y.coeff := by { ext, simp [sub_eq_add_neg] }
lemma sub_coeff {x y : hahn_series Γ R} {a : Γ} :
(x - y).coeff a = x.coeff a - y.coeff a := by simp
end add_group
instance [add_comm_group R] : add_comm_group (hahn_series Γ R) :=
{ .. hahn_series.add_comm_monoid,
.. hahn_series.add_group }
end addition
section distrib_mul_action
variables [partial_order Γ] {V : Type*} [monoid R] [add_monoid V] [distrib_mul_action R V]
instance : has_scalar R (hahn_series Γ V) :=
⟨λ r x, { coeff := r • x.coeff,
is_pwo_support' := x.is_pwo_support.mono (function.support_smul_subset_right r x.coeff) }⟩
@[simp]
lemma smul_coeff {r : R} {x : hahn_series Γ V} {a : Γ} : (r • x).coeff a = r • (x.coeff a) := rfl
instance : distrib_mul_action R (hahn_series Γ V) :=
{ 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] } }
variables {S : Type*} [monoid S] [distrib_mul_action S V]
instance [has_scalar R S] [is_scalar_tower R S V] :
is_scalar_tower R S (hahn_series Γ V) :=
⟨λ r s a, by { ext, simp }⟩
instance [smul_comm_class R S V] :
smul_comm_class R S (hahn_series Γ V) :=
⟨λ r s a, by { ext, simp [smul_comm] }⟩
end distrib_mul_action
section module
variables [partial_order Γ] [semiring R] {V : Type*} [add_comm_monoid V] [module R V]
instance : module R (hahn_series Γ V) :=
{ zero_smul := λ _, by { ext, simp },
add_smul := λ _ _ _, by { ext, simp [add_smul] },
.. hahn_series.distrib_mul_action }
/-- `single` as a linear map -/
@[simps] def single.linear_map (a : Γ) : R →ₗ[R] (hahn_series Γ R) :=
{ map_smul' := λ r s, by { ext b, by_cases h : b = a; simp [h] },
..single.add_monoid_hom a }
/-- `coeff g` as a linear map -/
@[simps] def coeff.linear_map (g : Γ) : (hahn_series Γ R) →ₗ[R] R :=
{ map_smul' := λ r s, rfl,
..coeff.add_monoid_hom g }
section domain
variables {Γ' : Type*} [partial_order Γ']
lemma emb_domain_smul (f : Γ ↪o Γ') (r : R) (x : hahn_series Γ R) :
emb_domain f (r • x) = r • emb_domain f x :=
begin
ext g,
by_cases hg : g ∈ set.range f,
{ obtain ⟨a, rfl⟩ := hg,
simp },
{ simp [emb_domain_notin_range, hg] }
end
/-- Extending the domain of Hahn series is a linear map. -/
@[simps] def emb_domain_linear_map (f : Γ ↪o Γ') : hahn_series Γ R →ₗ[R] hahn_series Γ' R :=
{ to_fun := emb_domain f, map_add' := emb_domain_add f, map_smul' := emb_domain_smul f }
end domain
end module
section multiplication
variable [ordered_cancel_add_comm_monoid Γ]
instance [has_zero R] [has_one R] : has_one (hahn_series Γ R) :=
⟨single 0 1⟩
@[simp]
lemma one_coeff [has_zero R] [has_one R] {a : Γ} :
(1 : hahn_series Γ R).coeff a = if a = 0 then 1 else 0 := single_coeff
@[simp]
lemma single_zero_one [has_zero R] [has_one R] : (single 0 (1 : R)) = 1 := rfl
@[simp]
lemma support_one [mul_zero_one_class R] [nontrivial R] :
support (1 : hahn_series Γ R) = {0} :=
support_single_of_ne one_ne_zero
@[simp]
lemma order_one [mul_zero_one_class R] :
order (1 : hahn_series Γ R) = 0 :=
begin
cases subsingleton_or_nontrivial R with h h; haveI := h,
{ rw [subsingleton.elim (1 : hahn_series Γ R) 0, order_zero] },
{ exact order_single one_ne_zero }
end
instance [non_unital_non_assoc_semiring R] : has_mul (hahn_series Γ R) :=
{ mul := λ x y, { coeff := λ a,
∑ ij in (add_antidiagonal x.is_pwo_support y.is_pwo_support a),
x.coeff ij.fst * y.coeff ij.snd,
is_pwo_support' := begin
have h : {a : Γ | ∑ (ij : Γ × Γ) in add_antidiagonal x.is_pwo_support
y.is_pwo_support a, x.coeff ij.fst * y.coeff ij.snd ≠ 0} ⊆
{a : Γ | (add_antidiagonal x.is_pwo_support y.is_pwo_support a).nonempty},
{ intros a ha,
contrapose! ha,
simp [not_nonempty_iff_eq_empty.1 ha] },
exact is_pwo_support_add_antidiagonal.mono h,
end, }, }
@[simp]
lemma mul_coeff [non_unital_non_assoc_semiring R] {x y : hahn_series Γ R} {a : Γ} :
(x * y).coeff a = ∑ ij in (add_antidiagonal x.is_pwo_support y.is_pwo_support a),
x.coeff ij.fst * y.coeff ij.snd := rfl
lemma mul_coeff_right' [non_unital_non_assoc_semiring R] {x y : hahn_series Γ R} {a : Γ} {s : set Γ}
(hs : s.is_pwo) (hys : y.support ⊆ s) :
(x * y).coeff a = ∑ ij in (add_antidiagonal x.is_pwo_support hs a),
x.coeff ij.fst * y.coeff ij.snd :=
begin
rw mul_coeff,
apply sum_subset_zero_on_sdiff (add_antidiagonal_mono_right hys) _ (λ _ _, rfl),
intros b hb,
simp only [not_and, not_not, mem_sdiff, mem_add_antidiagonal,
ne.def, set.mem_set_of_eq, mem_support] at hb,
rw [(hb.2 hb.1.1 hb.1.2.1), mul_zero]
end
lemma mul_coeff_left' [non_unital_non_assoc_semiring R] {x y : hahn_series Γ R} {a : Γ} {s : set Γ}
(hs : s.is_pwo) (hxs : x.support ⊆ s) :
(x * y).coeff a = ∑ ij in (add_antidiagonal hs y.is_pwo_support a),
x.coeff ij.fst * y.coeff ij.snd :=
begin
rw mul_coeff,
apply sum_subset_zero_on_sdiff (add_antidiagonal_mono_left hxs) _ (λ _ _, rfl),
intros b hb,
simp only [not_and, not_not, mem_sdiff, mem_add_antidiagonal,
ne.def, set.mem_set_of_eq, mem_support] at hb,
rw [not_not.1 (λ con, hb.1.2.2 (hb.2 hb.1.1 con)), zero_mul],
end
instance [non_unital_non_assoc_semiring R] : distrib (hahn_series Γ R) :=
{ left_distrib := λ x y z, begin
ext a,
have hwf := (y.is_pwo_support.union z.is_pwo_support),
rw [mul_coeff_right' hwf, add_coeff, mul_coeff_right' hwf (set.subset_union_right _ _),
mul_coeff_right' hwf (set.subset_union_left _ _)],
{ simp only [add_coeff, mul_add, sum_add_distrib] },
{ intro b,
simp only [add_coeff, ne.def, set.mem_union_eq, set.mem_set_of_eq, mem_support],
contrapose!,
intro h,
rw [h.1, h.2, add_zero], }
end,
right_distrib := λ x y z, begin
ext a,
have hwf := (x.is_pwo_support.union y.is_pwo_support),
rw [mul_coeff_left' hwf, add_coeff, mul_coeff_left' hwf (set.subset_union_right _ _),
mul_coeff_left' hwf (set.subset_union_left _ _)],
{ simp only [add_coeff, add_mul, sum_add_distrib] },
{ intro b,
simp only [add_coeff, ne.def, set.mem_union_eq, set.mem_set_of_eq, mem_support],
contrapose!,
intro h,
rw [h.1, h.2, add_zero], },
end,
.. hahn_series.has_mul,
.. hahn_series.has_add }
lemma single_mul_coeff_add [non_unital_non_assoc_semiring R] {r : R} {x : hahn_series Γ R} {a : Γ}
{b : Γ} :
((single b r) * x).coeff (a + b) = r * x.coeff a :=
begin
by_cases hr : r = 0,
{ simp [hr] },
simp only [hr, smul_coeff, mul_coeff, support_single_of_ne, ne.def, not_false_iff, smul_eq_mul],
by_cases hx : x.coeff a = 0,
{ simp only [hx, mul_zero],
rw [sum_congr _ (λ _ _, rfl), sum_empty],
ext ⟨a1, a2⟩,
simp only [not_mem_empty, not_and, set.mem_singleton_iff, not_not,
mem_add_antidiagonal, set.mem_set_of_eq, iff_false],
rintro h1 rfl h2,
rw add_comm at h1,
rw ← add_right_cancel h1 at hx,
exact h2 hx, },
transitivity ∑ (ij : Γ × Γ) in {(b, a)}, (single b r).coeff ij.fst * x.coeff ij.snd,
{ apply sum_congr _ (λ _ _, rfl),
ext ⟨a1, a2⟩,
simp only [set.mem_singleton_iff, prod.mk.inj_iff, mem_add_antidiagonal,
mem_singleton, set.mem_set_of_eq],
split,
{ rintro ⟨h1, rfl, h2⟩,
rw add_comm at h1,
refine ⟨rfl, add_right_cancel h1⟩ },
{ rintro ⟨rfl, rfl⟩,
refine ⟨add_comm _ _, _⟩,
simp [hx] } },
{ simp }
end
lemma mul_single_coeff_add [non_unital_non_assoc_semiring R] {r : R} {x : hahn_series Γ R} {a : Γ}
{b : Γ} :
(x * (single b r)).coeff (a + b) = x.coeff a * r :=
begin
by_cases hr : r = 0,
{ simp [hr] },
simp only [hr, smul_coeff, mul_coeff, support_single_of_ne, ne.def, not_false_iff, smul_eq_mul],
by_cases hx : x.coeff a = 0,
{ simp only [hx, zero_mul],
rw [sum_congr _ (λ _ _, rfl), sum_empty],
ext ⟨a1, a2⟩,
simp only [not_mem_empty, not_and, set.mem_singleton_iff, not_not,
mem_add_antidiagonal, set.mem_set_of_eq, iff_false],
rintro h1 h2 rfl,
rw ← add_right_cancel h1 at hx,
exact h2 hx, },
transitivity ∑ (ij : Γ × Γ) in {(a,b)}, x.coeff ij.fst * (single b r).coeff ij.snd,
{ apply sum_congr _ (λ _ _, rfl),
ext ⟨a1, a2⟩,
simp only [set.mem_singleton_iff, prod.mk.inj_iff, mem_add_antidiagonal,
mem_singleton, set.mem_set_of_eq],
split,
{ rintro ⟨h1, h2, rfl⟩,
refine ⟨add_right_cancel h1, rfl⟩ },
{ rintro ⟨rfl, rfl⟩,
simp [hx] } },
{ simp }
end
@[simp]
lemma mul_single_zero_coeff [non_unital_non_assoc_semiring R] {r : R} {x : hahn_series Γ R}
{a : Γ} :
(x * (single 0 r)).coeff a = x.coeff a * r :=
by rw [← add_zero a, mul_single_coeff_add, add_zero]
lemma single_zero_mul_coeff [non_unital_non_assoc_semiring R] {r : R} {x : hahn_series Γ R}
{a : Γ} :
((single 0 r) * x).coeff a = r * x.coeff a :=
by rw [← add_zero a, single_mul_coeff_add, add_zero]
@[simp]
lemma single_zero_mul_eq_smul [semiring R] {r : R} {x : hahn_series Γ R} :
(single 0 r) * x = r • x :=
by { ext, exact single_zero_mul_coeff }
theorem support_mul_subset_add_support [non_unital_non_assoc_semiring R] {x y : hahn_series Γ R} :
support (x * y) ⊆ support x + support y :=
begin
apply set.subset.trans (λ x hx, _) support_add_antidiagonal_subset_add,
{ exact x.is_pwo_support },
{ exact y.is_pwo_support },
contrapose! hx,
simp only [not_nonempty_iff_eq_empty, ne.def, set.mem_set_of_eq] at hx,
simp [hx],
end
lemma mul_coeff_order_add_order {Γ} [linear_ordered_cancel_add_comm_monoid Γ]
[non_unital_non_assoc_semiring R]
(x y : hahn_series Γ R) :
(x * y).coeff (x.order + y.order) = x.coeff x.order * y.coeff y.order :=
begin
by_cases hx : x = 0, { simp [hx], },
by_cases hy : y = 0, { simp [hy], },
rw [order_of_ne hx, order_of_ne hy, mul_coeff, finset.add_antidiagonal_min_add_min,
finset.sum_singleton],
end
private lemma mul_assoc' [non_unital_semiring R] (x y z : hahn_series Γ R) :
x * y * z = x * (y * z) :=
begin
ext b,
rw [mul_coeff_left' (x.is_pwo_support.add y.is_pwo_support) support_mul_subset_add_support,
mul_coeff_right' (y.is_pwo_support.add z.is_pwo_support) support_mul_subset_add_support],
simp only [mul_coeff, add_coeff, sum_mul, mul_sum, sum_sigma'],
refine sum_bij_ne_zero (λ a has ha0, ⟨⟨a.2.1, a.2.2 + a.1.2⟩, ⟨a.2.2, a.1.2⟩⟩) _ _ _ _,
{ rintros ⟨⟨i,j⟩, ⟨k,l⟩⟩ H1 H2,
simp only [true_and, set.image2_add, eq_self_iff_true, mem_add_antidiagonal, ne.def,
set.image_prod, mem_sigma, set.mem_set_of_eq] at H1 H2 ⊢,
obtain ⟨⟨rfl, ⟨H3, nz⟩⟩, ⟨rfl, nx, ny⟩⟩ := H1,
refine ⟨⟨(add_assoc _ _ _).symm, nx, set.add_mem_add ny nz⟩, ny, nz⟩ },
{ rintros ⟨⟨i1,j1⟩, ⟨k1,l1⟩⟩ ⟨⟨i2,j2⟩, ⟨k2,l2⟩⟩ H1 H2 H3 H4 H5,
simp only [set.image2_add, prod.mk.inj_iff, mem_add_antidiagonal, ne.def,
set.image_prod, mem_sigma, set.mem_set_of_eq, heq_iff_eq] at H1 H3 H5,
obtain ⟨⟨rfl, H⟩, rfl, rfl⟩ := H5,
simp only [and_true, prod.mk.inj_iff, eq_self_iff_true, heq_iff_eq],
exact add_right_cancel (H1.1.1.trans H3.1.1.symm) },
{ rintros ⟨⟨i,j⟩, ⟨k,l⟩⟩ H1 H2,
simp only [exists_prop, set.image2_add, prod.mk.inj_iff, mem_add_antidiagonal,
sigma.exists, ne.def, set.image_prod, mem_sigma, set.mem_set_of_eq, heq_iff_eq,
prod.exists] at H1 H2 ⊢,
obtain ⟨⟨rfl, nx, H⟩, rfl, ny, nz⟩ := H1,
exact ⟨i + k, l, i, k, ⟨⟨add_assoc _ _ _, set.add_mem_add nx ny, nz⟩, rfl, nx, ny⟩,
λ con, H2 ((mul_assoc _ _ _).symm.trans con), ⟨rfl, rfl⟩, rfl, rfl⟩ },
{ rintros ⟨⟨i,j⟩, ⟨k,l⟩⟩ H1 H2,
simp [mul_assoc], }
end
instance [non_unital_non_assoc_semiring R] : non_unital_non_assoc_semiring (hahn_series Γ R) :=
{ zero := 0,
add := (+),
mul := (*),
zero_mul := λ _, by { ext, simp },
mul_zero := λ _, by { ext, simp },
.. hahn_series.add_comm_monoid,
.. hahn_series.distrib }
instance [non_unital_semiring R] : non_unital_semiring (hahn_series Γ R) :=
{ zero := 0,
add := (+),
mul := (*),
mul_assoc := mul_assoc',
.. hahn_series.non_unital_non_assoc_semiring }
instance [non_assoc_semiring R] : non_assoc_semiring (hahn_series Γ R) :=
{ zero := 0,
one := 1,
add := (+),
mul := (*),
one_mul := λ x, by { ext, exact single_zero_mul_coeff.trans (one_mul _) },
mul_one := λ x, by { ext, exact mul_single_zero_coeff.trans (mul_one _) },
.. hahn_series.non_unital_non_assoc_semiring }
instance [semiring R] : semiring (hahn_series Γ R) :=
{ zero := 0,
one := 1,
add := (+),
mul := (*),
.. hahn_series.non_assoc_semiring,
.. hahn_series.non_unital_semiring }
instance [comm_semiring R] : comm_semiring (hahn_series Γ R) :=
{ mul_comm := λ x y, begin
ext,
simp_rw [mul_coeff, mul_comm],
refine sum_bij (λ a ha, ⟨a.2, a.1⟩) _ (λ a ha, by simp) _ _,
{ intros a ha,
simp only [mem_add_antidiagonal, ne.def, set.mem_set_of_eq] at ha ⊢,
obtain ⟨h1, h2, h3⟩ := ha,
refine ⟨_, h3, h2⟩,
rw [add_comm, h1], },
{ rintros ⟨a1, a2⟩ ⟨b1, b2⟩ ha hb hab,
rw prod.ext_iff at *,
refine ⟨hab.2, hab.1⟩, },
{ intros a ha,
refine ⟨a.swap, _, by simp⟩,
simp only [prod.fst_swap, mem_add_antidiagonal, prod.snd_swap,
ne.def, set.mem_set_of_eq] at ha ⊢,
exact ⟨(add_comm _ _).trans ha.1, ha.2.2, ha.2.1⟩ }
end,
.. hahn_series.semiring }
instance [ring R] : ring (hahn_series Γ R) :=
{ .. hahn_series.semiring,
.. hahn_series.add_comm_group }
instance [comm_ring R] : comm_ring (hahn_series Γ R) :=
{ .. hahn_series.comm_semiring,
.. hahn_series.ring }
instance {Γ} [linear_ordered_cancel_add_comm_monoid Γ] [non_unital_non_assoc_semiring R]
[no_zero_divisors R] : no_zero_divisors (hahn_series Γ R) :=
{ eq_zero_or_eq_zero_of_mul_eq_zero := λ x y xy, begin
by_cases hx : x = 0,
{ left, exact hx },
right,
contrapose! xy,
rw [hahn_series.ext_iff, function.funext_iff, not_forall],
refine ⟨x.order + y.order, _⟩,
rw [mul_coeff_order_add_order x y, zero_coeff, mul_eq_zero],
simp [coeff_order_ne_zero, hx, xy],
end }
instance {Γ} [linear_ordered_cancel_add_comm_monoid Γ] [ring R] [is_domain R] :
is_domain (hahn_series Γ R) :=
{ .. hahn_series.no_zero_divisors,
.. hahn_series.nontrivial,
.. hahn_series.ring }
@[simp]
lemma order_mul {Γ} [linear_ordered_cancel_add_comm_monoid Γ] [non_unital_non_assoc_semiring R]
[no_zero_divisors R] {x y : hahn_series Γ R} (hx : x ≠ 0) (hy : y ≠ 0) :
(x * y).order = x.order + y.order :=
begin
apply le_antisymm,
{ apply order_le_of_coeff_ne_zero,
rw [mul_coeff_order_add_order x y],
exact mul_ne_zero (coeff_order_ne_zero hx) (coeff_order_ne_zero hy) },
{ rw [order_of_ne hx, order_of_ne hy, order_of_ne (mul_ne_zero hx hy), ← set.is_wf.min_add],
exact set.is_wf.min_le_min_of_subset (support_mul_subset_add_support) },
end
@[simp]
lemma order_pow {Γ} [linear_ordered_cancel_add_comm_monoid Γ] [semiring R] [no_zero_divisors R]
(x : hahn_series Γ R) (n : ℕ) : (x ^ n).order = n • x.order :=
begin
induction n with h IH,
{ simp },
rcases eq_or_ne x 0 with rfl|hx,
{ simp },
rw [pow_succ', order_mul (pow_ne_zero _ hx) hx, succ_nsmul', IH]
end
section non_unital_non_assoc_semiring
variables [non_unital_non_assoc_semiring R]
@[simp]
lemma single_mul_single {a b : Γ} {r s : R} :
single a r * single b s = single (a + b) (r * s) :=
begin
ext x,
by_cases h : x = a + b,
{ rw [h, mul_single_coeff_add],
simp },
{ rw [single_coeff_of_ne h, mul_coeff, sum_eq_zero],
rintros ⟨y1, y2⟩ hy,
obtain ⟨rfl, hy1, hy2⟩ := mem_add_antidiagonal.1 hy,
rw [eq_of_mem_support_single hy1, eq_of_mem_support_single hy2] at h,
exact (h rfl).elim }
end
end non_unital_non_assoc_semiring
section non_assoc_semiring
variables [non_assoc_semiring R]
/-- `C a` is the constant Hahn Series `a`. `C` is provided as a ring homomorphism. -/
@[simps] def C : R →+* (hahn_series Γ R) :=
{ to_fun := single 0,
map_zero' := single_eq_zero,
map_one' := rfl,
map_add' := λ x y, by { ext a, by_cases h : a = 0; simp [h] },
map_mul' := λ x y, by rw [single_mul_single, zero_add] }
@[simp]
lemma C_zero : C (0 : R) = (0 : hahn_series Γ R) := C.map_zero
@[simp]
lemma C_one : C (1 : R) = (1 : hahn_series Γ R) := C.map_one
lemma C_injective : function.injective (C : R → hahn_series Γ R) :=
begin
intros r s rs,
rw [ext_iff, function.funext_iff] at rs,
have h := rs 0,
rwa [C_apply, single_coeff_same, C_apply, single_coeff_same] at h,
end
lemma C_ne_zero {r : R} (h : r ≠ 0) : (C r : hahn_series Γ R) ≠ 0 :=
begin
contrapose! h,
rw ← C_zero at h,
exact C_injective h,
end
lemma order_C {r : R} : order (C r : hahn_series Γ R) = 0 :=
begin
by_cases h : r = 0,
{ rw [h, C_zero, order_zero] },
{ exact order_single h }
end
end non_assoc_semiring
section semiring
variables [semiring R]
lemma C_mul_eq_smul {r : R} {x : hahn_series Γ R} : C r * x = r • x :=
single_zero_mul_eq_smul
end semiring
section domain
variables {Γ' : Type*} [ordered_cancel_add_comm_monoid Γ']
lemma emb_domain_mul [non_unital_non_assoc_semiring R]
(f : Γ ↪o Γ') (hf : ∀ x y, f (x + y) = f x + f y) (x y : hahn_series Γ R) :
emb_domain f (x * y) = emb_domain f x * emb_domain f y :=
begin
ext g,
by_cases hg : g ∈ set.range f,
{ obtain ⟨g, rfl⟩ := hg,
simp only [mul_coeff, emb_domain_coeff],
transitivity ∑ ij in (add_antidiagonal x.is_pwo_support y.is_pwo_support g).map
(function.embedding.prod_map f.to_embedding f.to_embedding),
(emb_domain f x).coeff (ij.1) *
(emb_domain f y).coeff (ij.2),
{ simp },
apply sum_subset,
{ rintro ⟨i, j⟩ hij,
simp only [exists_prop, mem_map, prod.mk.inj_iff,
mem_add_antidiagonal, ne.def, function.embedding.coe_prod_map, mem_support,
prod.exists] at hij,
obtain ⟨i, j, ⟨rfl, hx, hy⟩, rfl, rfl⟩ := hij,
simp [hx, hy, hf], },
{ rintro ⟨_, _⟩ h1 h2,
contrapose! h2,
obtain ⟨i, hi, rfl⟩ := support_emb_domain_subset (ne_zero_and_ne_zero_of_mul h2).1,
obtain ⟨j, hj, rfl⟩ := support_emb_domain_subset (ne_zero_and_ne_zero_of_mul h2).2,
simp only [exists_prop, mem_map, prod.mk.inj_iff,
mem_add_antidiagonal, ne.def, function.embedding.coe_prod_map, mem_support,
prod.exists],
simp only [mem_add_antidiagonal, emb_domain_coeff, ne.def, mem_support, ← hf] at h1,
exact ⟨i, j, ⟨f.injective h1.1, h1.2⟩, rfl⟩, } },
{ rw [emb_domain_notin_range hg, eq_comm],
contrapose! hg,
obtain ⟨_, _, hi, hj, rfl⟩ := support_mul_subset_add_support ((mem_support _ _).2 hg),
obtain ⟨i, hi, rfl⟩ := support_emb_domain_subset hi,
obtain ⟨j, hj, rfl⟩ := support_emb_domain_subset hj,
refine ⟨i + j, hf i j⟩, }
end
lemma emb_domain_one [non_assoc_semiring R] (f : Γ ↪o Γ') (hf : f 0 = 0):
emb_domain f (1 : hahn_series Γ R) = (1 : hahn_series Γ' R) :=
emb_domain_single.trans $ hf.symm ▸ rfl
/-- Extending the domain of Hahn series is a ring homomorphism. -/
@[simps] def emb_domain_ring_hom [non_assoc_semiring R] (f : Γ →+ Γ') (hfi : function.injective f)
(hf : ∀ g g' : Γ, f g ≤ f g' ↔ g ≤ g') :
hahn_series Γ R →+* hahn_series Γ' R :=
{ to_fun := emb_domain ⟨⟨f, hfi⟩, hf⟩,
map_one' := emb_domain_one _ f.map_zero,
map_mul' := emb_domain_mul _ f.map_add,
map_zero' := emb_domain_zero,
map_add' := emb_domain_add _}
lemma emb_domain_ring_hom_C [non_assoc_semiring R] {f : Γ →+ Γ'} {hfi : function.injective f}
{hf : ∀ g g' : Γ, f g ≤ f g' ↔ g ≤ g'} {r : R} :
emb_domain_ring_hom f hfi hf (C r) = C r :=
emb_domain_single.trans (by simp)
end domain
section algebra
variables [comm_semiring R] {A : Type*} [semiring A] [algebra R A]
instance : algebra R (hahn_series Γ A) :=
{ to_ring_hom := C.comp (algebra_map R A),
smul_def' := λ r x, by { ext, simp },
commutes' := λ r x, by { ext, simp only [smul_coeff, single_zero_mul_eq_smul, ring_hom.coe_comp,
ring_hom.to_fun_eq_coe, C_apply, function.comp_app, algebra_map_smul, mul_single_zero_coeff],
rw [← algebra.commutes, algebra.smul_def], }, }
theorem C_eq_algebra_map : C = (algebra_map R (hahn_series Γ R)) := rfl
theorem algebra_map_apply {r : R} :
algebra_map R (hahn_series Γ A) r = C (algebra_map R A r) := rfl
instance [nontrivial Γ] [nontrivial R] : nontrivial (subalgebra R (hahn_series Γ R)) :=
⟨⟨⊥, ⊤, begin
rw [ne.def, set_like.ext_iff, not_forall],
obtain ⟨a, ha⟩ := exists_ne (0 : Γ),
refine ⟨single a 1, _⟩,
simp only [algebra.mem_bot, not_exists, set.mem_range, iff_true, algebra.mem_top],
intros x,
rw [ext_iff, function.funext_iff, not_forall],
refine ⟨a, _⟩,
rw [single_coeff_same, algebra_map_apply, C_apply, single_coeff_of_ne ha],
exact zero_ne_one
end⟩⟩
section domain
variables {Γ' : Type*} [ordered_cancel_add_comm_monoid Γ']
/-- Extending the domain of Hahn series is an algebra homomorphism. -/
@[simps] def emb_domain_alg_hom (f : Γ →+ Γ') (hfi : function.injective f)
(hf : ∀ g g' : Γ, f g ≤ f g' ↔ g ≤ g') :
hahn_series Γ A →ₐ[R] hahn_series Γ' A :=
{ commutes' := λ r, emb_domain_ring_hom_C,
.. emb_domain_ring_hom f hfi hf }
end domain
end algebra
end multiplication
section semiring
variables [semiring R]
/-- The ring `hahn_series ℕ R` is isomorphic to `power_series R`. -/
@[simps] def to_power_series : (hahn_series ℕ R) ≃+* power_series R :=
{ to_fun := λ f, power_series.mk f.coeff,
inv_fun := λ f, ⟨λ n, power_series.coeff R n f, (nat.lt_wf.is_wf _).is_pwo⟩,
left_inv := λ f, by { ext, simp },
right_inv := λ f, by { ext, simp },
map_add' := λ f g, by { ext, simp },
map_mul' := λ f g, begin
ext n,
simp only [power_series.coeff_mul, power_series.coeff_mk, mul_coeff, is_pwo_support],
classical,
refine sum_filter_ne_zero.symm.trans
((sum_congr _ (λ _ _, rfl)).trans sum_filter_ne_zero),
ext m,
simp only [nat.mem_antidiagonal, and.congr_left_iff, mem_add_antidiagonal, ne.def,
and_iff_left_iff_imp, mem_filter, mem_support],
intros h1 h2,
contrapose h1,
rw ← decidable.or_iff_not_and_not at h1,
cases h1; simp [h1]
end }
lemma coeff_to_power_series {f : hahn_series ℕ R} {n : ℕ} :
power_series.coeff R n f.to_power_series = f.coeff n :=
power_series.coeff_mk _ _
lemma coeff_to_power_series_symm {f : power_series R} {n : ℕ} :
(hahn_series.to_power_series.symm f).coeff n = power_series.coeff R n f := rfl