Stafford38/Paper/Section5/Place.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 
3 public import Stafford38.Geometry.DivisorialVisibleFrameCore
4 public import Stafford38.Geometry.DivisorialVisibleFrameStage4
5 public import Stafford38.Paper.Section5.Valuation
6 
7 @[expose] public section
8 
9 /-!
10 # Lemmas 5.9 and 5.10: a valuation ring and a discrete valuation ring at infinity
11 
12 Section 5.2 of the paper works in the function field `F = Frac(K[x]/𝔭)` with
13 coordinate images `x̄_1, …, x̄_n` and `x̄_0 := 1`.  Here `F` is any field over
14 `k` generated by `x : Fin n → F`; the paper's `x̄_1` is `x i`.
15 
16 Both proofs use the checked stages of the formal construction
17 (`Stafford38.Geometry.LaneC`): Stage 1 is the dominating valuation ring, Stage 2
18 the normalization `A` of `C_0` and Stage 4 the residue algebraicity.  The proof
19 of Lemma 5.10 takes a prime `𝔭_D` minimal over `x̄_1`, of height one by Krull's
20 principal ideal theorem, and shows that `V = A_{𝔭_D}` is a discrete valuation
21 ring as a Noetherian local normal domain of dimension one.
22 -/
23 
24 namespace Stafford38.Paper.Section5
25 
26 open IsLocalRing
27 open Stafford38.Geometry.LaneC
28 open Stafford38.Geometry.NormalizationHeightOne
29 open scoped nonZeroDivisors
30 
31 noncomputable section
32 
33 set_option linter.style.haveILetI false
34 set_option maxHeartbeats 2000000
35 set_option synthInstance.maxHeartbeats 400000
36 
37 universe u
38 
39 local instance valuationSubringToSubringIsLocal {F : Type*} [Field F]
40     (V : ValuationSubring F) : IsLocalRing V.toSubring :=
41   ValuationSubring.isLocalRing V
42 
43 /-- Homogeneous coordinates `(x̄_0, …, x̄_n) = (1, x̄_1, …, x̄_n)`. -/
44 abbrev homogeneousCoordinates {F : Type*} [Field F] {n : ℕ} (x : Fin n → F) :
45     Fin (n + 1) → F :=
46   Fin.cases 1 x
47 
48 /-- **Lemma 5.9.** If `x̄_1` is transcendental over `K`, there are a valuation
49 ring `K ⊆ W ⊊ F` with `x̄_1 ∈ 𝔪_W` and an index `j` with `x̄_i / x̄_j ∈ W` for
50 all `0 ≤ i ≤ n`. -/
51 theorem lemma_5_9 {k F : Type*} [Field k] [Field F] [Algebra k F] {n : ℕ}
52     (x : Fin n → F) (i : Fin n) (htrans : Transcendental k (x i)) :
53     ∃ (W : ValuationSubring F) (j : Fin (n + 1)),
54       (∀ c : k, algebraMap k F c ∈ W) ∧ W ≠ ⊤ ∧
55       (∃ hx : x i ∈ W, (⟨x i, hx⟩ : W.toSubring) ∈ maximalIdeal W.toSubring) ∧
56       homogeneousCoordinates x j ≠ 0 ∧
57       ∀ a, homogeneousCoordinates x a / homogeneousCoordinates x j ∈ W := by
58   classical
59   -- `W` dominates `K[x̄_1]` localized at `x̄_1` (Stacks, Tag 00IA).
60   obtain ⟨W, hkW, hxW, hxinvW⟩ := stage1_exists_valuationSubring_of_transcendental (x i) htrans
61   have hx0 : x i ≠ 0 := fun h ↦ htrans (h ▸ isAlgebraic_zero)
62   -- Definition 5.3(a): `𝔪_W = W ∖ W^×`
63   have hxmax : (⟨x i, hxW⟩ : W.toSubring) ∈ maximalIdeal W.toSubring := by
64     rw [(definition_5_3.2.1 W).2]
65     rintro ⟨u, hu⟩
66     apply hxinvW
67     have hmul : x i * ((u⁻¹ : W.toSubringˣ) : W.toSubring) = 1 := by
68       have := congrArg Subtype.val (Units.mul_inv u)
69       simpa [hu] using this
70     have : (x i)⁻¹ = ((u⁻¹ : W.toSubringˣ) : W.toSubring) :=
71       (eq_inv_of_mul_eq_one_right hmul).symm
72     rw [this]
73     exact ((u⁻¹ : W.toSubringˣ) : W.toSubring).2
74   have hWtop : W ≠ ⊤ := by
75     rintro rfl
76     exact hxinvW (ValuationSubring.mem_top _)
77   -- Among the nonzero `x̄_i` choose one that is maximal for `a ≼ b ↔ x̄_a / x̄_b ∈ W`.
78   let Y := homogeneousCoordinates x
79   let S : Set (Fin (n + 1)) := {a | Y a ≠ 0}
80   have hS : S.Nonempty := ⟨0, by simp [S, Y]⟩
81   letI : LE (Fin (n + 1)) := ⟨fun a b ↦ Y b ≠ 0 ∧ Y a / Y b ∈ W⟩
82   have htr : IsTrans (Fin (n + 1)) LE.le := by
83     constructor
84     intro a b c hab hbc
85     rcases hab with ⟨hb, hab⟩
86     rcases hbc with ⟨hc, hbc⟩
87     refine ⟨hc, ?_⟩
88     have := W.toSubring.mul_mem hab hbc
89     rwa [div_mul_div_cancel₀ hb] at this
90   letI : IsTrans (Fin (n + 1)) LE.le := htr
91   obtain ⟨j, hjS, hjmax⟩ := S.toFinite.exists_maximalFor id S hS
92   refine ⟨W, j, hkW, hWtop, ⟨hxW, hxmax⟩, hjS, fun a ↦ ?_⟩
93   by_cases ha : Y a = 0
94   · change Y a / Y j ∈ W
95     rw [ha, zero_div]
96     exact W.zero_mem
97   -- Definition 5.3(a): `a/b ∈ W` or `b/a ∈ W` for nonzero `a, b`
98   rcases (definition_5_3.1 W.toSubring).2 ⟨W, rfl⟩ (Y a / Y j) (div_ne_zero ha hjS) with h | h
99   · exact h
100   · rw [inv_div] at h
101     exact (hjmax (show a ∈ S from ha) ⟨ha, h⟩).2
102 
103 /-- The discrete valuation ring of Lemma 5.10 together with the construction
104 `V = A_{𝔭_D}` of its proof: `A` is the integral closure in `F` of
105 `C_0 = K[q_0, …, q_n, x̄_1]` and `𝔭_D` is a height-one prime of `A` containing
106 `x̄_1`.  The fields `isDVR`, `q_mem`, `x_mem_p`, `residue_algebraic` and
107 `kaehler_finite` are the conclusions (a)–(c) of the lemma; the clause `R ⊄ V`
108 of (a) is `lemma_5_10_a_not_R_le`. -/
109 structure Lemma510Place (k : Type u) {F : Type u} [Field k] [Field F] [Algebra k F] {n : ℕ}
110     (x : Fin n → F) (i : Fin n) (j : Fin (n + 1)) where
111   A : Subalgebra k F
112   [finiteType : Algebra.FiniteType k A]
113   [fractionRing : IsFractionRing A F]
114   p : Ideal A
115   [isPrime : p.IsPrime]
116   place : ∀ z : F, z ∈ (placeSubalgebra A p).toSubring ∨
117     z⁻¹ ∈ (placeSubalgebra A p).toSubring
118   isDVR : IsDiscreteValuationRing (placeValuationSubring A p place).toSubring
119   q_mem : ∀ a, homogeneousCoordinates x a / homogeneousCoordinates x j ∈ A
120   x_mem : x i ∈ A
121   x_mem_p : (⟨x i, x_mem⟩ : A) ∈ p
122   residue_algebraic :
123     letI : Algebra k (placeValuationSubring A p place).toSubring :=
124       ((algebraMap k F).codRestrict (placeValuationSubring A p place).toSubring
125         (fun c ↦ ofField_mem_algebraMap_v A p place (algebraMap k A c))).toAlgebra
126     Algebra.IsAlgebraic
127       (IntermediateField.adjoin k
128         (Set.range fun a ↦ residue (placeValuationSubring A p place).toSubring
129           ⟨homogeneousCoordinates x a / homogeneousCoordinates x j,
130             ofField_mem_algebraMap_v A p place ⟨_, q_mem a⟩⟩) :
131         IntermediateField k (ResidueField (placeValuationSubring A p place).toSubring))
132       (ResidueField (placeValuationSubring A p place).toSubring)
133   kaehler_finite :
134     letI : Algebra k (placeValuationSubring A p place).toSubring :=
135       ((algebraMap k F).codRestrict (placeValuationSubring A p place).toSubring
136         (fun c ↦ ofField_mem_algebraMap_v A p place (algebraMap k A c))).toAlgebra
137     Module.Finite (placeValuationSubring A p place).toSubring
138       (Ω[(placeValuationSubring A p place).toSubring⁄k])
139 
140 attribute [instance] Lemma510Place.finiteType Lemma510Place.fractionRing Lemma510Place.isPrime
141 
142 /-- The discrete valuation ring `V` of Lemma 5.10. -/
143 abbrev Lemma510Place.V {k F : Type u} [Field k] [Field F] [Algebra k F] {n : ℕ}
144     {x : Fin n → F} {i : Fin n} {j : Fin (n + 1)} (L : Lemma510Place k x i j) :
145     ValuationSubring F :=
146   placeValuationSubring L.A L.p L.place
147 
148 /-- **Lemma 5.10.**  For `q_i = x̄_i / x̄_j` from Lemma 5.9 there is a discrete
149 valuation ring `K ⊆ V ⊊ F` (`Frac V = F` holds for every valuation subring) with
150 (a) `q_i ∈ V` and `x̄_1 ∈ 𝔪_V`, (b) `κ` algebraic over `K(res q_0, …, res q_n)`,
151 (c) `Ω_{V/K}` finitely generated; the conclusions are the fields of
152 `Lemma510Place`, which also records `V = A_{𝔭_D}` from the proof.  The clause
153 `R ⊄ V` of (a) is `lemma_5_10_a_not_R_le`, stated for every valuation ring with
154 `x̄_1 ∈ 𝔪_V`, which is how the proof of Theorem 5.7 uses it. -/
155 theorem lemma_5_10 {k F : Type u} [Field k] [CharZero k] [Field F] [Algebra k F]
156     {n : ℕ} (x : Fin n → F) (i : Fin n)
157     (hgen : IntermediateField.adjoin k (Set.range x) = ⊤)
158     (htrans : Transcendental k (x i))
159     (W : ValuationSubring F) (j : Fin (n + 1))
160     (hkW : ∀ c : k, algebraMap k F c ∈ W)
161     (hxW : ∃ hx : x i ∈ W, (⟨x i, hx⟩ : W.toSubring) ∈ maximalIdeal W.toSubring)
162     (hj : homogeneousCoordinates x j ≠ 0)
163     (hqW : ∀ a, homogeneousCoordinates x a / homogeneousCoordinates x j ∈ W) :
164     Nonempty (Lemma510Place k x i j) := by
165   classical
166   let Y := homogeneousCoordinates x
167   obtain ⟨hxiW, hxmW⟩ := hxW
168   have hy0 : x i ≠ 0 := fun h ↦ htrans (h ▸ isAlgebraic_zero)
169   have hxiInvW : (x i)⁻¹ ∉ W := by
170     intro h
171     rw [(definition_5_3.2.1 W).2] at hxmW
172     apply hxmW
173     refine IsUnit.of_mul_eq_one (⟨(x i)⁻¹, h⟩ : W.toSubring) ?_
174     apply Subtype.ext
175     simp [hy0]
176   let s : F := (Y j)⁻¹
177   have hs : s ≠ 0 := inv_ne_zero hj
178   have hjs : Y j * s = 1 := mul_inv_cancel₀ hj
179   have hYsW : ∀ a, Y a * s ∈ W := fun a ↦ by simpa [s, div_eq_mul_inv] using hqW a
180   -- `C_0 = K[q_0, …, q_n, x̄_1] ⊆ W`, and `A` is its integral closure in `F`.
181   let C₀ : Subalgebra k F :=
182     Algebra.adjoin k (Set.range (fun a : Fin (n + 1) ↦ Y a * s) ∪ {x i})
183   let SW : Subalgebra k F := { W.toSubring with algebraMap_mem' := hkW }
184   have hC₀W : C₀ ≤ SW := by
185     apply Algebra.adjoin_le
186     rintro z (⟨a, rfl⟩ | hz)
187     · exact hYsW a
188     · rw [Set.mem_singleton_iff.mp hz]
189       exact hxiW
190   have htop : IntermediateField.adjoin k
191       (Set.range (fun a : Fin (n + 1) ↦ Y a * s) ∪ {x i}) = ⊤ := by
192     apply top_unique
193     rw [← hgen]
194     apply IntermediateField.adjoin_le_iff.2
195     rintro _ ⟨a, rfl⟩
196     apply IntermediateField.mem_adjoin_iff_div.mpr
197     refine ⟨Y (Fin.succ a) * s, ?_, s, ?_, ?_⟩
198     · exact Algebra.subset_adjoin (R := k) (A := F)
199         (Set.mem_union_left _ (Set.mem_range_self _))
200     · have h0 : Y 0 * s ∈ C₀ := Algebra.subset_adjoin (R := k) (A := F)
201         (Set.mem_union_left _ (Set.mem_range_self (0 : Fin (n + 1))))
202       simpa only [Y, homogeneousCoordinates, Fin.cases_zero, one_mul] using h0
203     · simp only [Y, Fin.cases_succ]
204       exact (eq_div_iff hs).2 rfl
205   letI : IsFractionRing C₀ F := IsFractionRing.of_field C₀ F fun z ↦ by
206     have hz : z ∈ IntermediateField.adjoin k
207         (Set.range (fun a : Fin (n + 1) ↦ Y a * s) ∪ {x i}) := by
208       rw [htop]
209       exact Set.mem_univ z
210     rw [IntermediateField.mem_adjoin_iff_div] at hz
211     rcases hz with ⟨a, ha, b, hb, hab⟩
212     exact ⟨⟨a, ha⟩, ⟨b, hb⟩, hab⟩
213   let A₀ : Subalgebra C₀ F := integralClosure C₀ F
214   let A : Subalgebra k F := A₀.restrictScalars k
215   have hC₀A : C₀ ≤ A := fun z hz ↦ A₀.algebraMap_mem ⟨z, hz⟩
216   -- `W` is integrally closed, so `A ⊆ W` (Atiyah–Macdonald, Prop. 5.18).
217   letI : IsIntegrallyClosedIn W.toSubring F := inferInstanceAs (IsIntegrallyClosedIn W F)
218   have hA₀W : A₀.toSubring ≤ W.toSubring := by
219     change (integralClosure C₀ F).toSubring ≤ W.toSubring
220     apply (Subring.integralClosure_subring_le_iff (S := C₀) (T := W.toSubring)).2
221     exact hC₀W
222   have hyA : x i ∈ A := A₀.algebraMap_mem
223     ⟨x i, Algebra.subset_adjoin (Set.mem_union_right _ (Set.mem_singleton _))⟩
224   have hnormA : ∀ a, Y a * s ∈ A := fun a ↦ A₀.algebraMap_mem
225     ⟨Y a * s, Algebra.subset_adjoin (Set.mem_union_left _ (Set.mem_range_self a))⟩
226   have hinvA : (x i)⁻¹ ∉ A := fun h ↦ hxiInvW (hA₀W h)
227   -- `A` is a finite `C_0`-module (Hartshorne, Thm. I.3.9A).
228   haveI hC₀ft : Algebra.FiniteType k C₀ := Algebra.FiniteType.adjoin_of_finite
229     (Set.Finite.union (Set.finite_range _) (Set.finite_singleton _))
230   let D : Subalgebra C₀ (FractionRing C₀) := integralClosure C₀ (FractionRing C₀)
231   haveI : Module.Finite C₀ D := finite_normalization_of_fg_domain k C₀ D
232   let e : FractionRing C₀ ≃ₐ[C₀] F := IsLocalization.algEquiv C₀⁰ (FractionRing C₀) F
233   haveI : Module.Finite C₀ A₀ := Module.Finite.equiv e.mapIntegralClosure.toLinearEquiv
234   have hsub : A.toSubring = A₀.toSubring := rfl
235   let er : A ≃+* A₀ := RingEquiv.subringCongr hsub
236   letI : Algebra C₀ A := (er.symm.toRingHom.comp (algebraMap C₀ A₀)).toAlgebra
237   let ea : A₀ ≃ₐ[C₀] A := AlgEquiv.ofRingEquiv (f := er.symm) (fun _ ↦ rfl)
238   letI : IsScalarTower k C₀ A := IsScalarTower.of_algebraMap_eq fun _ ↦ by
239     apply Subtype.ext
240     rfl
241   letI : IsScalarTower C₀ A F := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl
242   haveI : Module.Finite C₀ A := Module.Finite.equiv ea.toLinearEquiv
243   haveI hAft : Algebra.FiniteType k A :=
244     Algebra.FiniteType.trans hC₀ft (inferInstance : Algebra.FiniteType C₀ A)
245   have hAic : IsIntegrallyClosedIn A F := by
246     apply Subring.isIntegrallyClosedIn_iff.mpr
247     intro z hz
248     change z ∈ integralClosure C₀ F
249     exact isIntegral_trans (R := C₀) (A := A) z hz
250   letI : IsFractionRing A F := IsFractionRing.of_field A F fun z ↦ by
251     obtain ⟨a, b, hb, hab⟩ := IsFractionRing.div_surjective C₀ z
252     refine ⟨⟨a, hC₀A a.2⟩, ⟨b, hC₀A b.2⟩, ?_⟩
253     change z = (a : F) / (b : F)
254     exact hab.symm
255   have haint : ∀ a : A, IsIntegral C₀ (a : F) := fun a ↦ a.2
256   letI : IsNoetherianRing A := Algebra.FiniteType.isNoetherianRing k A
257   letI : IsIntegrallyClosed A := (isIntegrallyClosed_iff_isIntegrallyClosedIn F).mpr hAic
258   -- `x̄_1` is a nonzero nonunit of `A`; a minimal prime over it has height one (Krull).
259   let xA : A := ⟨x i, hyA⟩
260   have hxA0 : xA ≠ 0 := fun h ↦ hy0 (congrArg Subtype.val h)
261   have hxAu : ¬ IsUnit xA := by
262     intro hu
263     obtain ⟨z, hz⟩ := isUnit_iff_exists_inv.mp hu
264     have hzK : x i * (z : F) = 1 := congrArg Subtype.val hz
265     apply hinvA
266     rw [show (x i)⁻¹ = (z : F) by simpa using congrArg Inv.inv (eq_inv_of_mul_eq_one_left hzK)]
267     exact z.2
268   -- `𝔭_D` is minimal among the primes containing `x̄_1`; by Krull's principal ideal
269   -- theorem `ht 𝔭_D ≤ 1`, and `ht 𝔭_D = 1` because `(0)` is the only prime of height `0`.
270   obtain ⟨p, hpmin⟩ := (Ideal.span {xA}).nonempty_minimalPrimes
271     (by simpa [Ideal.span_singleton_eq_top] using hxAu)
272   letI : p.IsPrime := hpmin.isPrime
273   have hxp : xA ∈ p := hpmin.1.2 (Ideal.mem_span_singleton_self xA)
274   have hpheight : p.height = 1 := by
275     refine le_antisymm (Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes _ _ hpmin) ?_
276     have hpne : p ≠ ⊥ := fun h ↦ hxA0 (by simpa [h] using hxp)
277     rw [Order.one_le_iff_ne_zero]
278     simpa [Ideal.height_eq_zero_iff_eq_bot] using hpne
279   -- `V := A_{𝔭_D}` is a Noetherian local domain.
280   let S := placeSubalgebra A p
281   letI : IsLocalization.AtPrime S p := by
282     unfold S placeSubalgebra
283     infer_instance
284   letI : IsLocalRing S := IsLocalization.AtPrime.isLocalRing S p
285   letI : IsNoetherianRing S := IsLocalization.isNoetherianRing p.primeCompl S inferInstance
286   -- It is normal, as a localization of an integrally closed domain (A–M, Prop. 5.12),
287   letI : IsIntegrallyClosed S :=
288     isIntegrallyClosed_of_isLocalization S p.primeCompl p.primeCompl_le_nonZeroDivisors
289   -- and its dimension is `ht 𝔭_D = 1`.
290   have hdim : ringKrullDim S = 1 := by
291     rw [IsLocalization.AtPrime.ringKrullDim_eq_height p S, hpheight]
292     rfl
293   -- A Noetherian local normal domain of dimension one is a DVR (Matsumura, Thm. 11.2).
294   have hSdvr : IsDiscreteValuationRing S := by
295     have hnf : ¬ IsField S := fun hf ↦ by
296       letI := hf.toField
297       rw [ringKrullDim_eq_zero_of_isField hf] at hdim
298       exact zero_ne_one hdim
299     have h3 : IsIntegrallyClosed S ∧ ∃! P : Ideal S, P ≠ ⊥ ∧ P.IsPrime := by
300       refine ⟨inferInstance, IsLocalRing.maximalIdeal _,
301         ⟨IsLocalRing.isField_iff_maximalIdeal_eq.not.mp hnf, inferInstance⟩, ?_⟩
302       have hkd : Ring.KrullDimLE 1 S := by
303         rw [Ring.krullDimLE_iff, hdim]
304         norm_num
305       rintro P ⟨hPb, hPp⟩
306       exact IsLocalRing.eq_maximalIdeal (hPp.isMaximal_of_ne_bot hPb)
307     exact ((IsDiscreteValuationRing.TFAE S hnf).out 4 1).mp h3
308   -- In particular `V` is a valuation ring of `F`.
309   have hplace : ∀ z : F, z ∈ S.toSubring ∨ z⁻¹ ∈ S.toSubring := by
310     intro z
311     rcases ValuationRing.isInteger_or_isInteger S z with ⟨s, hs⟩ | ⟨s, hs⟩
312     · left; rw [← hs]; exact s.2
313     · right; rw [← hs]; exact s.2
314   let V : ValuationSubring F := placeValuationSubring A p hplace
315   have hAV : ∀ a : A, (a : F) ∈ V.toSubring := fun a ↦ ofField_mem_algebraMap_v A p hplace a
316   have hpV : ∀ a : A, (⟨a, hAV a⟩ : V.toSubring) ∈ maximalIdeal V.toSubring ↔ a ∈ p :=
317     fun a ↦ ofField_mem_maximalIdeal_iff_v A p hplace a
318   have hsurj : ∀ z : ResidueField V.toSubring, ∃ (a b : A), b ∉ p ∧
319       z = residue V.toSubring ⟨a, hAV a⟩ / residue V.toSubring ⟨b, hAV b⟩ :=
320     fun z ↦ ofField_residue_surjective_v A p hplace z
321   have hkV : ∀ c : k, algebraMap k F c ∈ V.toSubring := fun c ↦ by
322     rw [show algebraMap k F c = algebraMap A F (algebraMap k A c) from
323       (IsScalarTower.algebraMap_apply k A F c)]
324     exact hAV (algebraMap k A c)
325   have hqV : ∀ a, Y a / Y j ∈ V.toSubring := fun a ↦ by
326     simpa [s, div_eq_mul_inv] using hAV ⟨Y a * s, hnormA a⟩
327   -- `Frac V = F`, since `A ⊆ V ⊆ F` and `Frac A = F`.
328   have _hfracV : IsFractionRing V.toSubring F := IsFractionRing.of_field V.toSubring F fun z ↦ by
329     obtain ⟨a, b, hb, hab⟩ := IsFractionRing.div_surjective A z
330     exact ⟨⟨a, hAV a⟩, ⟨b, hAV b⟩, hab.symm⟩
331   letI : Algebra k V.toSubring := ((algebraMap k F).codRestrict V.toSubring hkV).toAlgebra
332   letI : IsScalarTower k V.toSubring F := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl
333   have hxV : x i ∈ V.toSubring := hAV xA
334   have hxm : (⟨x i, hxV⟩ : V.toSubring) ∈ maximalIdeal V.toSubring := (hpV xA).2 hxp
335   have hVdvr : IsDiscreteValuationRing V.toSubring := hSdvr
336   have hqA : ∀ a, Y a / Y j ∈ A := fun a ↦ by simpa [s, div_eq_mul_inv] using hnormA a
337   refine ⟨Lemma510Place.mk A p hplace hVdvr hqA hyA hxp ?_ ?_⟩
338   · -- (b) `A/𝔭_D` is integral over the image of `C_0`, whose residues are `res q_i`.
339     let c' : (Fin (n + 1) ⊕ Unit) → F := fun a ↦
340       match a with
341       | Sum.inl b => Y b * s
342       | Sum.inr _ => x i
343     have hc'A : ∀ a, c' a ∈ A := fun a ↦ by
344       cases a with
345       | inl b => exact hnormA b
346       | inr _ => exact hyA
347     have hset : Set.range c' = Set.range (fun a : Fin (n + 1) ↦ Y a * s) ∪ {x i} := by
348       ext z
349       constructor
350       · rintro ⟨a, rfl⟩
351         cases a with
352         | inl b => exact Or.inl ⟨b, rfl⟩
353         | inr u => exact Or.inr (Set.mem_singleton _)
354       · rintro (⟨b, rfl⟩ | hz)
355         · exact ⟨Sum.inl b, rfl⟩
356         · exact ⟨Sum.inr (), (Set.mem_singleton_iff.mp hz).symm⟩
357     have hBig := Stafford38.Geometry.DivisorialVisibleFrameStage4.stage4_residueField_isAlgebraic_of_isIntegral
358       A p V hAV hpV hsurj c' hc'A (fun a ↦ by
359       rw [hset]
360       exact haint a)
361     have hyres : residue V.toSubring (⟨x i, hxV⟩ : V.toSubring) = 0 :=
362       (residue_eq_zero_iff _).2 hxm
363     have hEq : IntermediateField.adjoin k (Set.range fun a ↦
364           residue V.toSubring ⟨c' a, hAV ⟨c' a, hc'A a⟩⟩) =
365         IntermediateField.adjoin k (Set.range fun a ↦
366           residue V.toSubring ⟨Y a / Y j, hqV a⟩) := by
367       have hcoord : ∀ b, (⟨c' (Sum.inl b), hAV ⟨c' (Sum.inl b), hc'A (Sum.inl b)⟩⟩ :
368           V.toSubring) = ⟨Y b / Y j, hqV b⟩ := fun b ↦
369         Subtype.ext (by simp [c', s, div_eq_mul_inv])
370       apply le_antisymm
371       · apply IntermediateField.adjoin_le_iff.mpr
372         rintro _ ⟨a, rfl⟩
373         cases a with
374         | inl b =>
375           dsimp only
376           rw [hcoord b]
377           exact IntermediateField.subset_adjoin k _ ⟨b, rfl⟩
378         | inr _ =>
379           change residue V.toSubring (⟨x i, hxV⟩ : V.toSubring) ∈ _
380           rw [hyres]
381           exact zero_mem _
382       · apply IntermediateField.adjoin_le_iff.mpr
383         rintro _ ⟨b, rfl⟩
384         dsimp only
385         rw [← hcoord b]
386         exact IntermediateField.subset_adjoin k _ ⟨Sum.inl b, rfl⟩
387     rw [← hEq]
388     convert hBig using 3
389   · -- (c) `Ω_{A/K}` is finite and localizes to `Ω_{V/K}` (Hartshorne, Prop. II.8.2A).
390     exact stage7_kaehler_finite_ofField A p hkV
391 
392 /-- **Lemma 5.10(a), `R ⊄ V`.**  For any valuation ring `V` of `F` with
393 `x̄_1 ∈ 𝔪_V`: `x̄_1 ∈ R^×` since `1 = ḡ x̄_1` with `ḡ ∈ R`, while `x̄_1 ∈ 𝔪_V`, so
394 `R ⊄ V`.  The paper derives `1 = ḡ x̄_1` from `Y ∩ H = ∅` by the
395 Nullstellensatz. -/
396 theorem lemma_5_10_a_not_R_le {k F : Type*} [Field k] [Field F] [Algebra k F] {n : ℕ}
397     (x : Fin n → F) (i : Fin n) (V : ValuationSubring F) (hxV : x i ∈ V.toSubring)
398     (hxm : (⟨x i, hxV⟩ : V.toSubring) ∈ maximalIdeal V.toSubring)
399     (hunit : ∃ g ∈ Algebra.adjoin k (Set.range x), x i * g = 1) :
400     ¬ (Algebra.adjoin k (Set.range x)).toSubring ≤ V.toSubring := by
401   obtain ⟨g, hgR, hxg⟩ := hunit
402   have hy0 : x i ≠ 0 := left_ne_zero_of_mul_eq_one hxg
403   have hinvR : (x i)⁻¹ ∈ Algebra.adjoin k (Set.range x) := by
404     rw [← eq_inv_of_mul_eq_one_right hxg]
405     exact hgR
406   intro hRV
407   rw [mem_maximalIdeal, mem_nonunits_iff] at hxm
408   apply hxm
409   refine IsUnit.of_mul_eq_one (⟨(x i)⁻¹, hRV hinvR⟩ : V.toSubring) ?_
410   apply Subtype.ext
411   simp [hy0]
412 
413 #print axioms lemma_5_10
414 #print axioms lemma_5_10_a_not_R_le
415 
416 end
417 
418 end Stafford38.Paper.Section5
419