Stafford38/Geometry/ValuationCenterDominatesLocalPrime.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.RingTheory.Valuation.LocalSubring
3 public import Mathlib.RingTheory.Localization.AtPrime.Basic
4 
5 @[expose] public section
6 
7 noncomputable section
8 set_option autoImplicit false
9 
10 namespace Stafford38.Geometry
11 
12 /-- If a prime of a subring is the contraction of the maximal ideal of a valuation
13 subring, then the corresponding local ring is dominated by that valuation subring.
14 
15 This is the local algebra step in a center construction: it does not assert that the
16 prime is height one or that the valuation comes from a specified projective model. -/
17 theorem localRing_at_contracted_maximalIdeal_le_valuationSubring
18     {K : Type*} [Field K] (A : Subring K) (V : ValuationSubring K)
19     (hAV : A ≤ V.toSubring) (p : Ideal A) [p.IsPrime]
20     (hcenter : (IsLocalRing.maximalIdeal V.toLocalSubring.toSubring).comap
21       (Subring.inclusion hAV) = p) :
22     LocalSubring.ofPrime A p ≤ V.toLocalSubring := by
23   let i : A →+* V.toLocalSubring.toSubring := Subring.inclusion hAV
24   let W : LocalSubring K := V.toLocalSubring
25   have hcenter' : (IsLocalRing.maximalIdeal W.toSubring).comap i = p := by
26     convert hcenter using 1 <;> rfl
27   have hiK : W.toSubring.subtype.comp i = A.subtype := by
28     ext a
29     rfl
30   have hunit (s : p.primeCompl) : IsUnit (i s.1) := by
31     have hsnotmax : i s.1 ∉ IsLocalRing.maximalIdeal W.toSubring := by
32       intro hs
33       apply s.2
34       have hs' : s.1 ∈ (IsLocalRing.maximalIdeal W.toSubring).comap i :=
35         Ideal.mem_comap.mpr hs
36       rw [hcenter'] at hs'
37       exact hs'
38     exact IsLocalRing.notMem_maximalIdeal.mp hsnotmax
39   let B := Localization.AtPrime p
40   let g : B →+* W.toSubring := IsLocalization.lift
41     (M := p.primeCompl) (S := B) (g := i) hunit
42   have hglocal : IsLocalHom g := by
43     apply (IsLocalRing.local_hom_TFAE g).out 2 1 |>.mp
44     rintro _ ⟨x, hx, rfl⟩
45     obtain ⟨a, s, rfl⟩ := IsLocalization.exists_mk'_eq p.primeCompl x
46     have haB : algebraMap A B a ∈ IsLocalRing.maximalIdeal B :=
47       (IsLocalization.mk'_mem_iff (M := p.primeCompl)).mp hx
48     have hap : a ∈ p :=
49       (IsLocalization.AtPrime.to_map_mem_maximal_iff B p a).mp haB
50     have hai : i a ∈ IsLocalRing.maximalIdeal W.toSubring := by
51       have ha' : a ∈ (IsLocalRing.maximalIdeal W.toSubring).comap i := by
52         rw [hcenter']
53         exact hap
54       exact Ideal.mem_comap.mp ha'
55     rw [IsLocalization.lift_mk']
56     let u : W.toSubringˣ := IsUnit.liftRight
57       (i.toMonoidHom.domRestrict p.primeCompl) hunit s
58     change i a * ↑u⁻¹ ∈ IsLocalRing.maximalIdeal W.toSubring
59     convert (IsLocalRing.maximalIdeal W.toSubring).mul_mem_left (↑u⁻¹) hai using 1
60     rw [mul_comm]
61   let h0 : B →+* K := IsLocalization.lift
62     (M := p.primeCompl) (S := B) (g := A.subtype)
63     (by intro s; exact isUnit_iff_ne_zero.mpr (by
64       intro hz
65       have hsA : s.1 = 0 := Subtype.val_injective hz
66       apply s.2
67       rw [hsA]
68       exact p.zero_mem))
69   have hgK : W.toSubring.subtype.comp g = h0 := by
70     apply IsLocalization.ringHom_ext p.primeCompl
71     ext a
72     simp [g, h0]
73     exact RingHom.congr_fun hiK a
74   let S := LocalSubring.ofPrime A p
75   let e : B ≃ₐ[A] S.toSubring := LocalSubring.ofPrimeEquiv A p
76   have heK : S.toSubring.subtype.comp e.toRingHom = h0 := by
77     apply IsLocalization.ringHom_ext p.primeCompl
78     ext a
79     simp only [RingHom.comp_apply]
80     rw [IsLocalization.lift_eq]
81     have hcomm : e.toRingEquiv.toRingHom (algebraMap A B a) =
82         algebraMap A S.toSubring a := by
83       change e (algebraMap A B a) = algebraMap A S.toSubring a
84       exact e.commutes a
85     rw [hcomm]
86     rfl
87   let j : S.toSubring →+* W.toSubring := g.comp e.symm.toRingHom
88   have hjK : ∀ x : S.toSubring, ((j x : W.toSubring) : K) = (x : K) := by
89     intro x
90     have h := RingHom.congr_fun hgK (e.symm x)
91     have h' := RingHom.congr_fun heK (e.symm x)
92     calc
93       ((j x : W.toSubring) : K) = ((g (e.symm x) : W.toSubring) : K) := rfl
94       _ = h0 (e.symm x) := h
95       _ = (x : K) := by simpa using h'.symm
96   have hS : S.toSubring ≤ W.toSubring := by
97     intro x hx
98     have hx' : ((⟨x, hx⟩ : S.toSubring) : K) ∈ W.toSubring := by
99       rw [← hjK ⟨x, hx⟩]
100       exact (j ⟨x, hx⟩).property
101     exact hx'
102   have heLocal : IsLocalHom e.symm.toRingHom := by
103     refine ⟨fun x hx => ?_⟩
104     have hx' := hx.map e.toRingHom
105     simpa using hx'
106   letI : IsLocalHom g := hglocal
107   letI : IsLocalHom e.symm.toRingHom := heLocal
108   have hjlocal : IsLocalHom j := by
109     dsimp [j]
110     infer_instance
111   have hjEq : j = Subring.inclusion hS := by
112     ext x
113     change ((j x : W.toSubring) : K) = (x : K)
114     exact hjK x
115   rw [LocalSubring.le_def]
116   exact ⟨hS, by rw [← hjEq]; exact hjlocal⟩
117 
118 end Stafford38.Geometry
119