Stafford38/Paper/Section5/Valuation.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 
3 public import Mathlib.RingTheory.DiscreteValuationRing.TFAE
4 public import Mathlib.RingTheory.LaurentSeries
5 public import Mathlib.RingTheory.Valuation.ValuationSubring
6 
7 @[expose] public section
8 
9 /-!
10 # Definition 5.3: valuation rings, discrete valuation rings, formal series
11 
12 The paper's notions are Mathlib's `ValuationSubring`, `IsDiscreteValuationRing`,
13 `PowerSeries` and `LaurentSeries`.  `definition_5_3` states the printed
14 definitions as properties of these: (a) a subring `W ⊆ F` is a valuation ring
15 iff `a ∈ W` or `a⁻¹ ∈ W` for every `a ∈ F^×`, and then `W` is local with
16 `𝔪_W = W ∖ W^×`; (b) a valuation ring `V` is a discrete valuation ring iff it is
17 Noetherian and `V ≠ F`, and then `𝔪_V = (ϖ)` and every `f ∈ F^×` is `ϖ^k u` with a
18 unique `k = ord_V(f) ∈ ℤ` and `u ∈ V^×`; (c) `κ((t))` is the fraction field of
19 `κ[[t]]`.  Lemmas 5.9 and 5.10 use (a) and (b) through `definition_5_3`.
20 -/
21 
22 namespace Stafford38.Paper.Section5
23 
24 open IsLocalRing
25 
26 noncomputable section
27 
28 universe u
29 
30 /-- The local ring structure of a valuation ring `W`, on the subring `W.toSubring`
31 used throughout Section 5.2. -/
32 instance valuationSubring_toSubring_isLocalRing {F : Type*} [Field F] (V : ValuationSubring F) :
33     IsLocalRing V.toSubring :=
34   ValuationSubring.isLocalRing V
35 
36 theorem step_5_3_valuationRing {F : Type*} [Field F] (V : ValuationSubring F) :
37     ValuationRing V.toSubring :=
38   inferInstanceAs (ValuationRing V)
39 
40 /-- A valuation ring equal to `F` is a field. -/
41 theorem step_5_3_isField_iff {F : Type*} [Field F] (V : ValuationSubring F) :
42     IsField V.toSubring ↔ V = ⊤ := by
43   constructor
44   · intro hV
45     rw [eq_top_iff]
46     intro f _
47     rcases V.mem_or_inv_mem f with h | h
48     · exact h
49     · by_cases hf : f = 0
50       · rw [hf]; exact V.zero_mem
51       · obtain ⟨g, hg⟩ := hV.mul_inv_cancel
52           (a := (⟨f⁻¹, h⟩ : V.toSubring)) (fun h0 => inv_ne_zero hf (congrArg Subtype.val h0))
53         have hg' : f⁻¹ * (g : F) = 1 := congrArg Subtype.val hg
54         have : (g : F) = f := by
55           rw [← one_mul (g : F), ← mul_inv_cancel₀ hf, mul_assoc, hg', mul_one]
56         exact this ▸ g.2
57   · rintro rfl
58     refine ⟨⟨0, 1, fun h => zero_ne_one (congrArg Subtype.val h)⟩,
59       fun a b => mul_comm a b, fun {a} ha => ?_⟩
60     refine ⟨⟨(a : F)⁻¹, ValuationSubring.mem_top _⟩, Subtype.ext ?_⟩
61     exact mul_inv_cancel₀ fun h => ha (Subtype.ext h)
62 
63 /-- Uniqueness of `ord_V`: `ϖ^k u = ϖ^l u'` with units `u, u'` forces `k = l`. -/
64 theorem step_5_3_ord_unique {F : Type*} [Field F] (V : ValuationSubring F) {ϖ : V.toSubring}
65     (hϖ : Irreducible ϖ) {k l : ℤ} {u u' : V.toSubringˣ}
66     (h : (ϖ : F) ^ k * ((u : V.toSubring) : F) = (ϖ : F) ^ l * ((u' : V.toSubring) : F)) :
67     k = l := by
68   have hϖ0 : (ϖ : F) ≠ 0 := fun h0 => hϖ.ne_zero (Subtype.ext h0)
69   have hu : ∀ w : V.toSubringˣ, ((w : V.toSubring) : F) ≠ 0 := fun w h0 =>
70     w.ne_zero (Subtype.ext h0)
71   -- `ϖ^m` with `m ≥ 1` is not the image of a unit
72   have key : ∀ (m : ℕ) (w : V.toSubringˣ), (ϖ : F) ^ (m + 1) ≠ ((w : V.toSubring) : F) := by
73     intro m w hw
74     have : ϖ ^ (m + 1) = (w : V.toSubring) := Subtype.ext (by simpa using hw)
75     exact hϖ.not_isUnit ((isUnit_pow_iff (Nat.succ_ne_zero m)).mp (this ▸ w.isUnit))
76   rcases lt_trichotomy k l with hkl | hkl | hkl
77   · exfalso
78     obtain ⟨m, hm⟩ : ∃ m : ℕ, l - k = (m + 1 : ℕ) := ⟨(l - k - 1).toNat, by omega⟩
79     apply key m (u * u'⁻¹)
80     have : (ϖ : F) ^ (l - k) = ((u : V.toSubring) : F) * ((u'⁻¹ : V.toSubringˣ) : V.toSubring) := by
81       have hinv : ((u' : V.toSubring) : F) * ((u'⁻¹ : V.toSubringˣ) : V.toSubring) = 1 := by
82         rw [← Subring.coe_mul, Units.mul_inv]; rfl
83       rw [zpow_sub₀ hϖ0, div_eq_iff (zpow_ne_zero _ hϖ0)]
84       calc (ϖ : F) ^ l = (ϖ : F) ^ l * ((u' : V.toSubring) : F) *
85             ((u'⁻¹ : V.toSubringˣ) : V.toSubring) := by rw [mul_assoc, hinv, mul_one]
86         _ = _ := by rw [← h]; ring
87     rw [hm, zpow_natCast] at this
88     rw [this, Units.val_mul]
89     rfl
90   · exact hkl
91   · exfalso
92     obtain ⟨m, hm⟩ : ∃ m : ℕ, k - l = (m + 1 : ℕ) := ⟨(k - l - 1).toNat, by omega⟩
93     apply key m (u' * u⁻¹)
94     have : (ϖ : F) ^ (k - l) = ((u' : V.toSubring) : F) * ((u⁻¹ : V.toSubringˣ) : V.toSubring) := by
95       have hinv : ((u : V.toSubring) : F) * ((u⁻¹ : V.toSubringˣ) : V.toSubring) = 1 := by
96         rw [← Subring.coe_mul, Units.mul_inv]; rfl
97       rw [zpow_sub₀ hϖ0, div_eq_iff (zpow_ne_zero _ hϖ0)]
98       calc (ϖ : F) ^ k = (ϖ : F) ^ k * ((u : V.toSubring) : F) *
99             ((u⁻¹ : V.toSubringˣ) : V.toSubring) := by rw [mul_assoc, hinv, mul_one]
100         _ = _ := by rw [h]; ring
101     rw [hm, zpow_natCast] at this
102     rw [this, Units.val_mul]
103     rfl
104 
105 /-- Existence of `f = ϖ^k u` in a discrete valuation ring `V ⊆ F`. -/
106 theorem step_5_3_ord_exists {F : Type*} [Field F] (V : ValuationSubring F)
107     [IsDiscreteValuationRing V.toSubring] {ϖ : V.toSubring} (hϖ : Irreducible ϖ)
108     {f : F} (hf : f ≠ 0) :
109     ∃ (k : ℤ) (u : V.toSubringˣ), f = (ϖ : F) ^ k * ((u : V.toSubring) : F) := by
110   rcases V.mem_or_inv_mem f with h | h
111   · obtain ⟨m, u, hu⟩ := IsDiscreteValuationRing.eq_unit_mul_pow_irreducible
112       (x := (⟨f, h⟩ : V.toSubring)) (fun h0 => hf (congrArg Subtype.val h0)) hϖ
113     refine ⟨m, u, ?_⟩
114     have := congrArg Subtype.val hu
115     simp only [Subring.coe_mul, SubmonoidClass.coe_pow] at this
116     rw [zpow_natCast, mul_comm]
117     exact this
118   · obtain ⟨m, u, hu⟩ := IsDiscreteValuationRing.eq_unit_mul_pow_irreducible
119       (x := (⟨f⁻¹, h⟩ : V.toSubring)) (fun h0 => inv_ne_zero hf (congrArg Subtype.val h0)) hϖ
120     refine ⟨-(m : ℤ), u⁻¹, ?_⟩
121     have := congrArg Subtype.val hu
122     simp only [Subring.coe_mul, SubmonoidClass.coe_pow] at this
123     have hinv : ((u : V.toSubring) : F) * ((u⁻¹ : V.toSubringˣ) : V.toSubring) = 1 := by
124       rw [← Subring.coe_mul, Units.mul_inv]; rfl
125     have hϖ0 : (ϖ : F) ≠ 0 := fun h0 => hϖ.ne_zero (Subtype.ext h0)
126     rw [zpow_neg, zpow_natCast]
127     calc f = (f⁻¹)⁻¹ := (inv_inv f).symm
128       _ = ((u : V.toSubring) : F)⁻¹ * ((ϖ : F) ^ m)⁻¹ := by rw [this, mul_inv]
129       _ = _ := by rw [mul_comm, eq_inv_of_mul_eq_one_right hinv]
130 
131 /-- **Definition 5.3.** Let `F` be a field.
132 (a) A subring `W ⊆ F` is a valuation ring of `F` iff `a ∈ W` or `a⁻¹ ∈ W` for
133 every `a ∈ F^×`; it is a local ring with maximal ideal `𝔪_W = W ∖ W^×`.
134 (b) A valuation ring `V` is a discrete valuation ring iff it is Noetherian and
135 `V ≠ F`; then `𝔪_V` is generated by some `ϖ ∈ V`, and every `f ∈ F^×` is
136 `f = ϖ^k u` with `u ∈ V^×` and a unique `k = ord_V(f) ∈ ℤ`.
137 (c) For a field `κ`, `κ((t))` (`LaurentSeries κ`) is the fraction field of
138 `κ[[t]]` (`PowerSeries κ`). -/
139 theorem definition_5_3 {F : Type u} [Field F] :
140     (∀ S : Subring F,
141         (∀ a : F, a ≠ 0 → a ∈ S ∨ a⁻¹ ∈ S) ↔ ∃ W : ValuationSubring F, W.toSubring = S) ∧
142       (∀ W : ValuationSubring F,
143         IsLocalRing W.toSubring ∧ ∀ w : W.toSubring, w ∈ maximalIdeal W.toSubring ↔ ¬ IsUnit w) ∧
144       (∀ V : ValuationSubring F,
145         IsDiscreteValuationRing V.toSubring ↔ IsNoetherianRing V.toSubring ∧ V ≠ ⊤) ∧
146       (∀ V : ValuationSubring F, IsDiscreteValuationRing V.toSubring →
147         ∃ ϖ : V.toSubring, maximalIdeal V.toSubring = Ideal.span {ϖ} ∧
148           ∀ f : F, f ≠ 0 → ∃! k : ℤ, ∃ u : V.toSubringˣ,
149             f = (ϖ : F) ^ k * ((u : V.toSubring) : F)) ∧
150       ∀ (κ : Type u) [Field κ], IsFractionRing (PowerSeries κ) (LaurentSeries κ) := by
151   refine ⟨fun S => ⟨fun h => ?_, ?_⟩, fun W => ⟨inferInstance, fun w => ?_⟩,
152     fun V => ⟨fun hV => ?_, fun ⟨hN, hV⟩ => ?_⟩, fun V hV => ?_, fun κ _ => inferInstance⟩
153   · refine ⟨⟨S, fun a => ?_⟩, rfl⟩
154     by_cases ha : a = 0
155     · exact Or.inl (ha ▸ S.zero_mem)
156     · exact h a ha
157   · rintro ⟨W, rfl⟩ a _
158     exact W.mem_or_inv_mem a
159   · rw [mem_maximalIdeal, mem_nonunits_iff]
160   · refine ⟨inferInstance, fun hVtop => IsDiscreteValuationRing.not_isField V.toSubring ?_⟩
161     exact (step_5_3_isField_iff V).2 hVtop
162   · have hfield : ¬ IsField V.toSubring := fun h => hV ((step_5_3_isField_iff V).1 h)
163     have := step_5_3_valuationRing V
164     exact ((IsDiscreteValuationRing.TFAE V.toSubring hfield).out 1 2).2 this
165   · obtain ⟨ϖ, hϖ⟩ := IsDiscreteValuationRing.exists_irreducible V.toSubring
166     refine ⟨ϖ, hϖ.maximalIdeal_eq, fun f hf => ?_⟩
167     obtain ⟨k, u, hku⟩ := step_5_3_ord_exists V hϖ hf
168     exact ⟨k, ⟨u, hku⟩, fun l ⟨u', hl⟩ => step_5_3_ord_unique V hϖ (hl.symm.trans hku)⟩
169 
170 #print axioms step_5_3_valuationRing
171 #print axioms step_5_3_isField_iff
172 #print axioms step_5_3_ord_unique
173 #print axioms step_5_3_ord_exists
174 #print axioms definition_5_3
175 
176 end
177 
178 end Stafford38.Paper.Section5
179