Stafford38/Geometry/DivisorialVisibleFrameCore.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.RingTheory.SimpleRing.Principal
3 public import Mathlib.RingTheory.RegularLocalRing.Defs
4 public import Mathlib.RingTheory.Kaehler.Basic
5 public import Mathlib.RingTheory.Valuation.LocalSubring
6 public import Mathlib.RingTheory.Valuation.ValuationSubring
7 public import Stafford38.Geometry.NormalizationHeightOne
8 
9 @[expose] public section
10 
11 /-!
12 # Divisorial visible-frame construction core
13 
14 This file packages the already checked valuation, DVR, Kähler, and
15 transcendence stages and states the assembly interface used by the dedicated
16 normalization, residue-algebraicity, and coefficient-field modules.
17 -/
18 
19 open IsLocalRing Polynomial
20 open Stafford38.Geometry.NormalizationHeightOne
21 
22 noncomputable section
23 
24 universe u v
25 
26 namespace Stafford38.Geometry.LaneC
27 
28 variable {k K : Type u} [Field k] [Field K] [Algebra k K]
29 
30 def coeffHom (E : IntermediateField k K) (V : ValuationSubring K)
31     (hEV : ∀ z : E, (z : K) ∈ V.toSubring) : E →+* V.toSubring :=
32   RingHom.codRestrict (IntermediateField.val E).toRingHom V.toSubring hEV
33 
34 def groundHom (E : IntermediateField k K) (V : ValuationSubring K)
35     (hEV : ∀ z : E, (z : K) ∈ V.toSubring) : k →+* V.toSubring :=
36   (coeffHom E V hEV).comp (algebraMap k E)
37 
38 def DivisorialVisibleFrameExistence : Prop :=
39   ∀ (k K : Type u) [Field k] [CharZero k] [Field K] [Algebra k K]
40     (r : ℕ) (y : Fin r → K) (i : Fin r),
41     IntermediateField.adjoin k (Set.range y) = ⊤ →
42     Transcendental k (y i) →
43     ∃ (E : IntermediateField k K) (V : ValuationSubring K)
44       (hEV : ∀ z : E, (z : K) ∈ V.toSubring)
45       (hVdvr : IsDiscreteValuationRing V.toSubring)
46       (hxV : y i ∈ V.toSubring),
47       letI : IsLocalRing V.toSubring := hVdvr.toIsLocalRing
48       letI : Algebra E V.toSubring := (coeffHom E V hEV).toAlgebra
49       letI : Algebra k V.toSubring := (groundHom E V hEV).toAlgebra
50       Transcendental E (y i) ∧
51       (⟨y i, hxV⟩ : V.toSubring) ∈ maximalIdeal V.toSubring ∧
52       Module.Finite E (ResidueField V.toSubring) ∧
53       Module.Finite V.toSubring (Ω[V.toSubring⁄k]) ∧
54       (∀ (s : K) (q : Fin (r + 1) → V.toSubring),
55         (∀ a, (q a : K) = s * Fin.cases 1 y a) →
56         (∃ j, q j = 1) → ¬ IsUnit (q 0) →
57         Algebra.IsAlgebraic
58           (IntermediateField.adjoin k
59             (Set.range fun j : Fin r ↦ residue V.toSubring (q (Fin.succ j))) :
60             IntermediateField k (ResidueField V.toSubring))
61           (ResidueField V.toSubring))
62 
63 /-! The concrete localization model used by the place stage. -/
64 
65 def placeSubalgebra (A : Subalgebra k K) [IsFractionRing A K]
66     (p : Ideal A) [p.IsPrime] : Subalgebra A K :=
67   Localization.subalgebra.ofField K p.primeCompl p.primeCompl_le_nonZeroDivisors
68 
69 def placeValuationSubring (A : Subalgebra k K) [IsFractionRing A K]
70     (p : Ideal A) [p.IsPrime]
71     (h : ∀ z : K, z ∈ (placeSubalgebra A p).toSubring ∨
72       z⁻¹ ∈ (placeSubalgebra A p).toSubring) : ValuationSubring K :=
73   ValuationSubring.ofSubring (placeSubalgebra A p).toSubring h
74 
75 local instance valuationSubringToSubringIsLocal (V : ValuationSubring K) :
76     IsLocalRing V.toSubring :=
77   ValuationSubring.isLocalRing V
78 
79 local instance placeSubalgebraAtPrime (A : Subalgebra k K) [IsFractionRing A K]
80     (p : Ideal A) [p.IsPrime] :
81     IsLocalization.AtPrime (placeSubalgebra A p) p := by
82   unfold placeSubalgebra
83   infer_instance
84 
85 local instance placeSubalgebraIsLocal (A : Subalgebra k K) [IsFractionRing A K]
86     (p : Ideal A) [p.IsPrime] : IsLocalRing (placeSubalgebra A p).toSubring := by
87   change IsLocalRing (placeSubalgebra A p)
88   exact IsLocalization.AtPrime.isLocalRing (placeSubalgebra A p) p
89 
90 local instance placeSubalgebraIsLocal' (A : Subalgebra k K) [IsFractionRing A K]
91     (p : Ideal A) [p.IsPrime] : IsLocalRing (placeSubalgebra A p) :=
92   IsLocalization.AtPrime.isLocalRing (placeSubalgebra A p) p
93 
94 theorem ofField_mem_algebraMap (A : Subalgebra k K) [IsFractionRing A K]
95     (p : Ideal A) [p.IsPrime]
96     (a : A) :
97     (a : K) ∈ (placeSubalgebra A p).toSubring := by
98   change (a : K) ∈ placeSubalgebra A p
99   exact (placeSubalgebra A p).algebraMap_mem a
100 
101 theorem ofField_mem_algebraMap_v (A : Subalgebra k K) [IsFractionRing A K]
102     (p : Ideal A) [p.IsPrime]
103     (h : ∀ z : K, z ∈ (placeSubalgebra A p).toSubring ∨
104       z⁻¹ ∈ (placeSubalgebra A p).toSubring) (a : A) :
105     (a : K) ∈ (placeValuationSubring A p h).toSubring := by
106   exact ofField_mem_algebraMap A p a
107 
108 theorem ofField_mem_maximalIdeal_iff (A : Subalgebra k K) [IsFractionRing A K]
109     (p : Ideal A) [p.IsPrime]
110     (a : A) :
111     (⟨(a : K), ofField_mem_algebraMap A p a⟩ : (placeSubalgebra A p).toSubring) ∈
112         maximalIdeal (placeSubalgebra A p).toSubring ↔ a ∈ p := by
113   change algebraMap A (placeSubalgebra A p) a ∈
114       maximalIdeal (placeSubalgebra A p) ↔ a ∈ p
115   exact IsLocalization.AtPrime.to_map_mem_maximal_iff
116     (placeSubalgebra A p) p a (h := placeSubalgebraIsLocal A p)
117 
118 theorem ofField_mem_maximalIdeal_iff_v (A : Subalgebra k K) [IsFractionRing A K]
119     (p : Ideal A) [p.IsPrime]
120     (h : ∀ z : K, z ∈ (placeSubalgebra A p).toSubring ∨
121       z⁻¹ ∈ (placeSubalgebra A p).toSubring) (a : A) :
122     (⟨(a : K), ofField_mem_algebraMap_v A p h a⟩ :
123       (placeValuationSubring A p h).toSubring) ∈
124         maximalIdeal (placeValuationSubring A p h).toSubring ↔ a ∈ p := by
125   change algebraMap A (placeSubalgebra A p) a ∈
126       maximalIdeal (placeSubalgebra A p) ↔ a ∈ p
127   exact IsLocalization.AtPrime.to_map_mem_maximal_iff
128     (placeSubalgebra A p) p a (h := placeSubalgebraIsLocal A p)
129 
130 theorem ofField_residue_surjective (A : Subalgebra k K) [IsFractionRing A K]
131     (p : Ideal A) [p.IsPrime]
132     (z : ResidueField (placeSubalgebra A p).toSubring) :
133     ∃ (a b : A), b ∉ p ∧
134       z = residue (placeSubalgebra A p).toSubring
135         ⟨(a : K), ofField_mem_algebraMap A p a⟩ /
136         residue (placeSubalgebra A p).toSubring
137           ⟨(b : K), ofField_mem_algebraMap A p b⟩ := by
138   obtain ⟨x, rfl⟩ := residue_surjective (R := (placeSubalgebra A p).toSubring) z
139   change ∃ (a b : A), b ∉ p ∧
140     residue (placeSubalgebra A p).toSubring x =
141       residue (placeSubalgebra A p).toSubring
142           ⟨(a : K), ofField_mem_algebraMap A p a⟩ /
143         residue (placeSubalgebra A p).toSubring
144           ⟨(b : K), ofField_mem_algebraMap A p b⟩
145   have hx : (x : K) ∈ placeSubalgebra A p := x.property
146   simp only [placeSubalgebra, Localization.subalgebra.ofField] at hx
147   obtain ⟨a, b, hb, hab⟩ := hx
148   refine ⟨a, b, ?_, ?_⟩
149   · exact hb
150   · have hbinv : (algebraMap A K b)⁻¹ ∈ placeSubalgebra A p := by
151       simp only [placeSubalgebra, Localization.subalgebra.ofField]
152       exact ⟨1, b, hb, by simp⟩
153     let binv : (placeSubalgebra A p).toSubring :=
154       ⟨(algebraMap A K b)⁻¹, hbinv⟩
155     have hxb : x = algebraMap A (placeSubalgebra A p) a * binv := by
156       apply Subtype.ext
157       simpa [binv] using hab
158     have hbA0 : b ≠ 0 := fun hbzero ↦ hb (hbzero ▸ p.zero_mem)
159     have hb0 : algebraMap A K b ≠ 0 := by
160       intro hbzero
161       apply hbA0
162       apply Subtype.ext
163       exact hbzero
164     have hbmul : binv * algebraMap A (placeSubalgebra A p) b = 1 := by
165       apply Subtype.ext
166       exact inv_mul_cancel₀ hb0
167     have hresinv : residue (placeSubalgebra A p).toSubring binv =
168         (residue (placeSubalgebra A p).toSubring
169           (algebraMap A (placeSubalgebra A p) b))⁻¹ := by
170       apply eq_inv_of_mul_eq_one_left
171       rw [← map_mul, hbmul, map_one]
172     calc
173       residue (placeSubalgebra A p).toSubring x =
174           residue (placeSubalgebra A p).toSubring
175             (algebraMap A (placeSubalgebra A p) a * binv) := by rw [hxb]
176       _ = residue (placeSubalgebra A p).toSubring
177             ⟨(a : K), ofField_mem_algebraMap A p a⟩ /
178           residue (placeSubalgebra A p).toSubring
179             ⟨(b : K), ofField_mem_algebraMap A p b⟩ := by
180         rw [map_mul, hresinv, div_eq_mul_inv]
181         rfl
182 
183 theorem ofField_residue_surjective_v (A : Subalgebra k K) [IsFractionRing A K]
184     (p : Ideal A) [p.IsPrime]
185     (h : ∀ z : K, z ∈ (placeSubalgebra A p).toSubring ∨
186       z⁻¹ ∈ (placeSubalgebra A p).toSubring)
187     (z : ResidueField (placeValuationSubring A p h).toSubring) :
188     ∃ (a b : A), b ∉ p ∧
189       z = residue (placeValuationSubring A p h).toSubring
190         ⟨(a : K), ofField_mem_algebraMap_v A p h a⟩ /
191         residue (placeValuationSubring A p h).toSubring
192           ⟨(b : K), ofField_mem_algebraMap_v A p h b⟩ := by
193   exact ofField_residue_surjective A p z
194 
195 theorem ofField_glue (A : Subalgebra k K) [IsFractionRing A K]
196     (p : Ideal A) [p.IsPrime]
197     (h : ∀ z : K, z ∈ (placeSubalgebra A p).toSubring ∨
198       z⁻¹ ∈ (placeSubalgebra A p).toSubring) :
199     (∀ a : A, (a : K) ∈ (placeValuationSubring A p h).toSubring) ∧
200     (∀ a : A, (⟨a, ofField_mem_algebraMap_v A p h a⟩ :
201       (placeValuationSubring A p h).toSubring) ∈
202         maximalIdeal (placeValuationSubring A p h).toSubring ↔ a ∈ p) ∧
203     (∀ z : ResidueField (placeValuationSubring A p h).toSubring,
204       ∃ (a b : A), b ∉ p ∧
205         z = residue (placeValuationSubring A p h).toSubring
206           ⟨(a : K), ofField_mem_algebraMap_v A p h a⟩ /
207         residue (placeValuationSubring A p h).toSubring
208           ⟨(b : K), ofField_mem_algebraMap_v A p h b⟩) := by
209   refine ⟨fun a ↦ ofField_mem_algebraMap_v A p h a,
210     fun a ↦ ofField_mem_maximalIdeal_iff_v A p h a,
211     fun z ↦ ofField_residue_surjective_v A p h z⟩
212 
213 /-! Explicitly named implementations of the five checked stages. -/
214 
215 theorem isDiscreteValuationRing_of_isLocalization_atPrime
216     {A : Type*} [CommRing A] [IsDomain A] [IsNoetherianRing A] [IsIntegrallyClosed A]
217     (p : Ideal A) [p.IsPrime] (h : p.height = 1)
218     (S : Type*) [CommRing S] [IsDomain S] [Algebra A S]
219     [IsLocalization.AtPrime S p] : IsDiscreteValuationRing S := by
220   have hpb : p ≠ ⊥ := Ideal.ne_bot_of_height_eq_one h
221   letI : IsLocalRing S := IsLocalization.AtPrime.isLocalRing S p
222   letI : IsNoetherianRing S := IsLocalization.isNoetherianRing p.primeCompl S inferInstance
223   letI : IsIntegrallyClosed S :=
224     isIntegrallyClosed_of_isLocalization S p.primeCompl p.primeCompl_le_nonZeroDivisors
225   have hnf : ¬ IsField S := IsLocalization.AtPrime.not_isField A hpb S
226   have hkd : Ring.KrullDimLE 1 S := by
227     rw [Ring.krullDimLE_iff, IsLocalization.AtPrime.ringKrullDim_eq_height p S, h]
228     norm_num
229   have h3 : IsIntegrallyClosed S ∧ ∃! P : Ideal S, P ≠ ⊥ ∧ P.IsPrime := by
230     refine ⟨inferInstance, IsLocalRing.maximalIdeal _,
231       ⟨IsLocalRing.isField_iff_maximalIdeal_eq.not.mp hnf, inferInstance⟩, ?_⟩
232     rintro P ⟨hPb, hPp⟩
233     exact IsLocalRing.eq_maximalIdeal (hPp.isMaximal_of_ne_bot hPb)
234   exact ((IsDiscreteValuationRing.TFAE S hnf).out 4 1).mp h3
235 
236 theorem stage1_exists_valuationSubring_of_transcendental
237     {k K : Type*} [Field k] [Field K] [Algebra k K] (x : K)
238     (hx : Transcendental k x) :
239     ∃ W : ValuationSubring K, (∀ c : k, algebraMap k K c ∈ W) ∧ x ∈ W ∧ x⁻¹ ∉ W := by
240   classical
241   have hx0 : x ≠ 0 := fun h => hx (h ▸ isAlgebraic_zero)
242   let A : Subring K := (Algebra.adjoin k ({x} : Set K)).toSubring
243   have hxA : x ∈ A := Algebra.subset_adjoin (Set.mem_singleton x)
244   let I : Ideal A := Ideal.span {⟨x, hxA⟩}
245   have hI : I ≠ ⊤ := by
246     intro htop
247     have h1 : (1 : A) ∈ I := htop ▸ Submodule.mem_top
248     rw [Ideal.mem_span_singleton'] at h1
249     obtain ⟨g, hg⟩ := h1
250     have hg' : (g : K) * x = 1 := by
251       have := congrArg Subtype.val hg
252       simpa using this
253     obtain ⟨q, hq⟩ : ∃ q : Polynomial k, Polynomial.aeval x q = (g : K) := by
254       have hmem : (g : K) ∈ Algebra.adjoin k ({x} : Set K) := g.2
255       rw [Algebra.adjoin_singleton_eq_range_aeval] at hmem
256       exact (AlgHom.mem_range _).1 hmem
257     apply hx
258     refine ⟨q * Polynomial.X - 1, ?_, ?_⟩
259     · intro h0
260       have hc := congrArg (fun p : Polynomial k => p.coeff 0) h0
261       simp [Polynomial.mul_coeff_zero] at hc
262     · simp [map_sub, map_mul, hq, hg']
263   obtain ⟨W, hAW, hIW⟩ := Ideal.image_subset_nonunits_valuationSubring I hI
264   have hxW : x ∈ W := hAW hxA
265   refine ⟨W, fun c => hAW (Subalgebra.algebraMap_mem _ c), hxW, ?_⟩
266   intro hinv
267   have hxn : x ∈ W.nonunits := hIW
268     ⟨⟨x, hxA⟩, Ideal.mem_span_singleton_self _, rfl⟩
269   rw [ValuationSubring.mem_nonunits_iff_exists_mem_maximalIdeal] at hxn
270   obtain ⟨hxW', hxm⟩ := hxn
271   rw [IsLocalRing.mem_maximalIdeal, mem_nonunits_iff] at hxm
272   exact hxm (isUnit_iff_exists_inv.2
273     ⟨⟨x⁻¹, hinv⟩, Subtype.ext (mul_inv_cancel₀ hx0)⟩)
274 
275 theorem stage3_exists_height_one_prime_valuation
276     {k K : Type*} [Field k] [Field K] [Algebra k K]
277     (A : Subalgebra k K) [IsNoetherianRing A] [IsIntegrallyClosed A]
278     [IsFractionRing A K] (x : A) (hx0 : x ≠ 0) (hxu : ¬ IsUnit x) :
279     ∃ p : Ideal A, ∃ _ : p.IsPrime, p.height = 1 ∧ x ∈ p ∧
280       ∀ z : K, z ∈ Localization.subalgebra.ofField K p.primeCompl
281         p.primeCompl_le_nonZeroDivisors ∨ z⁻¹ ∈
282         Localization.subalgebra.ofField K p.primeCompl
283           p.primeCompl_le_nonZeroDivisors := by
284   obtain ⟨p, hp, hp1⟩ := exists_height_one_minimal_prime hx0 hxu
285   letI := hp.isPrime
286   refine ⟨p, inferInstance, hp1, hp.1.2 (Ideal.mem_span_singleton_self x), ?_⟩
287   set S := Localization.subalgebra.ofField K p.primeCompl
288     p.primeCompl_le_nonZeroDivisors with hS
289   letI : IsDiscreteValuationRing S :=
290     isDiscreteValuationRing_of_isLocalization_atPrime p hp1 S
291   intro z
292   rcases ValuationRing.isInteger_or_isInteger S z with ⟨s, hs⟩ | ⟨s, hs⟩
293   · left; rw [← hs]; exact s.2
294   · right; rw [← hs]; exact s.2
295 
296 theorem stage6_transcendental_of_mem_maximalIdeal
297     {k K : Type*} [Field k] [Field K] [Algebra k K]
298     (E : IntermediateField k K) (V : ValuationSubring K) [IsLocalRing V.toSubring]
299     (hEV : ∀ z : E, (z : K) ∈ V.toSubring) (x : K) (hx0 : x ≠ 0)
300     (hxV : x ∈ V.toSubring)
301     (hxm : (⟨x, hxV⟩ : V.toSubring) ∈ maximalIdeal V.toSubring) :
302     Transcendental E x := by
303   intro halg
304   have hint : IsIntegral E x := halg.isIntegral
305   set a : E := (minpoly E x).coeff 0 with ha
306   have ha0 : a ≠ 0 := minpoly.coeff_zero_ne_zero hint hx0
307   obtain ⟨q, hq⟩ := X_dvd_sub_C (p := minpoly E x)
308   have h1 : aeval x (minpoly E x - C a) = aeval x (X * q) := by rw [hq]
309   rw [map_sub, minpoly.aeval, aeval_C, zero_sub, map_mul, aeval_X] at h1
310   have hqV : aeval x q ∈ V.toSubring := by
311     rw [aeval_eq_sum_range]
312     refine Subring.sum_mem _ fun n _ ↦ ?_
313     rw [Algebra.smul_def]
314     exact Subring.mul_mem _ (hEV _) (Subring.pow_mem _ hxV n)
315   have haV : algebraMap E K a ∈ V.toSubring := hEV _
316   have hmem : (⟨algebraMap E K a, haV⟩ : V.toSubring) ∈ maximalIdeal V.toSubring := by
317     have : (⟨algebraMap E K a, haV⟩ : V.toSubring) =
318         -((⟨x, hxV⟩ : V.toSubring) * ⟨aeval x q, hqV⟩) := by
319       apply Subtype.ext
320       push_cast
321       exact neg_eq_iff_eq_neg.1 h1
322     rw [this]
323     exact (Submodule.neg_mem_iff _).2 (Ideal.mul_mem_right _ _ hxm)
324   have hu : IsUnit (⟨algebraMap E K a, haV⟩ : V.toSubring) := by
325     refine isUnit_iff_exists_inv.2 ⟨⟨(algebraMap E K a)⁻¹, ?_⟩, Subtype.ext ?_⟩
326     · have h : (algebraMap E K a)⁻¹ = ((a⁻¹ : E) : K) := by
327         first | simp | (rw [IntermediateField.coe_inv]; rfl)
328       rw [h]; exact hEV _
329     · exact mul_inv_cancel₀ ((_root_.map_ne_zero _).2 ha0)
330   exact (mem_nonunits_iff.1 ((IsLocalRing.mem_maximalIdeal _).1 hmem)) hu
331 
332 theorem stage7_kaehler_finite_ofField
333     {k K : Type u} [Field k] [Field K] [Algebra k K]
334     (A : Subalgebra k K) [Algebra.FiniteType k A] [IsFractionRing A K]
335     (p : Ideal A) [p.IsPrime]
336     (hk : ∀ c : k, algebraMap k K c ∈
337       (Localization.subalgebra.ofField K p.primeCompl p.primeCompl_le_nonZeroDivisors).toSubring) :
338     letI : Algebra k
339         (Localization.subalgebra.ofField K p.primeCompl p.primeCompl_le_nonZeroDivisors).toSubring :=
340       ((algebraMap k K).codRestrict _ hk).toAlgebra
341     Module.Finite
342       (Localization.subalgebra.ofField K p.primeCompl p.primeCompl_le_nonZeroDivisors).toSubring
343       (Ω[(Localization.subalgebra.ofField K p.primeCompl p.primeCompl_le_nonZeroDivisors).toSubring⁄k]) := by
344   exact (by
345     set S := Localization.subalgebra.ofField K p.primeCompl
346       p.primeCompl_le_nonZeroDivisors with hS
347     letI inst : Algebra k S.toSubring := ((algebraMap k K).codRestrict _ hk).toAlgebra
348     haveI : Algebra.EssFiniteType A S := Algebra.EssFiniteType.of_isLocalization S p.primeCompl
349     haveI : IsScalarTower k A S := IsScalarTower.of_algebraMap_eq fun c =>
350       Subtype.ext (IsScalarTower.algebraMap_apply k A K c)
351     haveI : Algebra.EssFiniteType k A := Algebra.EssFiniteType.of_finiteType k A
352     haveI h1 : Algebra.EssFiniteType k S := Algebra.EssFiniteType.comp k A S
353     have h2 : inst = (inferInstance : Algebra k S) := by
354       apply Algebra.algebra_ext
355       intro c
356       rfl
357     haveI h3 : Algebra.EssFiniteType k S.toSubring := by
358       rw [h2]
359       exact h1
360     exact KaehlerDifferential.finite k S.toSubring)
361 
362 /-! ## Assembly scaffold
363 
364 The declarations below intentionally expose exactly the three unresolved
365 construction stages.  They are inputs, rather than axioms or placeholders, so a
366 future assembly proof can be checked by supplying S2, S4, and S5 separately.
367 The four other stage fields are already available as the theorems above. -/
368 
369 def Stage2Obligation : Prop :=
370   ∀ {k K : Type u} [Field k] [CharZero k] [Field K] [Algebra k K]
371     {r : ℕ} (y : Fin r → K) (i : Fin r)
372     (hgen : IntermediateField.adjoin k (Set.range y) = ⊤)
373     (hx : Transcendental k (y i)),
374     ∃ (j : Fin (r + 1)) (s : K) (A : Subalgebra k K),
375       s ≠ 0 ∧ (Fin.cases 1 y j : K) * s = 1 ∧
376       (∀ a, (Fin.cases 1 y a : K) * s ∈ A) ∧ y i ∈ A ∧
377       Algebra.FiniteType k A ∧ IsIntegrallyClosedIn A K ∧ IsFractionRing A K ∧
378       (∀ a : A, IsIntegral (Algebra.adjoin k
379         (Set.range (fun a : Fin (r + 1) => (Fin.cases 1 y a : K) * s) ∪ {y i})) (a : K)) ∧
380       (y i)⁻¹ ∉ A
381 
382 def Stage4Obligation : Prop :=
383   ∀ {k K : Type u} [Field k] [Field K] [Algebra k K]
384     (A : Subalgebra k K) (p : Ideal A) [p.IsPrime]
385     (V : ValuationSubring K) [IsLocalRing V.toSubring]
386     [Algebra k V.toSubring] [IsScalarTower k V.toSubring K]
387     (hAV : ∀ a : A, (a : K) ∈ V.toSubring)
388     (hp : ∀ a : A, (⟨a, hAV a⟩ : V.toSubring) ∈ maximalIdeal V.toSubring ↔ a ∈ p)
389     (hsurj : ∀ z : ResidueField V.toSubring, ∃ (a b : A), b ∉ p ∧
390       z = residue V.toSubring ⟨a, hAV a⟩ / residue V.toSubring ⟨b, hAV b⟩)
391     {ι : Type v} (c : ι → K) (hc : ∀ i, c i ∈ A)
392     (hint : ∀ a : A, IsIntegral (Algebra.adjoin k (Set.range c)) (a : K)),
393     Algebra.IsAlgebraic
394       (IntermediateField.adjoin k (Set.range fun i =>
395         residue V.toSubring ⟨c i, hAV ⟨c i, hc i⟩⟩) :
396         IntermediateField k (ResidueField V.toSubring))
397       (ResidueField V.toSubring)
398 
399 def Stage5Obligation : Prop :=
400   ∀ {k K : Type u} [Field k] [Field K] [Algebra k K]
401     (A : Subalgebra k K) [Algebra.FiniteType k A] (p : Ideal A) [p.IsPrime]
402     (V : ValuationSubring K) [IsLocalRing V.toSubring]
403     (hAV : ∀ a : A, (a : K) ∈ V.toSubring)
404     (hp : ∀ a : A, (⟨a, hAV a⟩ : V.toSubring) ∈ maximalIdeal V.toSubring ↔ a ∈ p)
405     (hsurj : ∀ z : ResidueField V.toSubring, ∃ (a b : A), b ∉ p ∧
406       z = residue V.toSubring ⟨a, hAV a⟩ / residue V.toSubring ⟨b, hAV b⟩),
407     ∃ (E : IntermediateField k K) (hEV : ∀ z : E, (z : K) ∈ V.toSubring),
408       letI : Algebra E V.toSubring := (coeffHom E V hEV).toAlgebra
409       Module.Finite E (ResidueField V.toSubring)
410 
411 structure AssemblyScaffold : Prop where
412   stage2 : Stage2Obligation.{u}
413   stage4 : Stage4Obligation.{u, v}
414   stage5 : Stage5Obligation.{u}
415 
416 theorem assembly_scaffold_of_obligations
417     (stage2 : Stage2Obligation.{u}) (stage4 : Stage4Obligation.{u, v})
418     (stage5 : Stage5Obligation.{u}) : AssemblyScaffold.{u, v} :=
419   ⟨stage2, stage4, stage5⟩
420 
421 #print axioms ofField_glue
422 #print axioms isDiscreteValuationRing_of_isLocalization_atPrime
423 #print axioms stage1_exists_valuationSubring_of_transcendental
424 #print axioms stage3_exists_height_one_prime_valuation
425 #print axioms stage6_transcendental_of_mem_maximalIdeal
426 #print axioms stage7_kaehler_finite_ofField
427 #print axioms assembly_scaffold_of_obligations
428 
429 end Stafford38.Geometry.LaneC
430 
431 end
432