Stafford38/Geometry/ProjectiveValuationNormalization.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.RingTheory.Localization.Integer
3 public import Mathlib.RingTheory.Valuation.ValuationSubring
4 public import Mathlib.RingTheory.Filtration
5 public import Mathlib.RingTheory.AdicCompletion.Algebra
6 
7 @[expose] public section
8 
9 /-!
10 # Finite projective normalization in a valuation subring
11 
12 A finite nonzero vector over the fraction field of a valuation ring can be
13 scaled into the valuation ring so that one coordinate is exactly one.  The
14 same scalar is used in every coordinate, so all projective ratios and
15 homogeneous equations are preserved.
16 -/
17 
18 namespace Stafford38.Geometry.ProjectiveValuationNormalization
19 
20 noncomputable section
21 
22 universe u v
23 
24 /-- The canonical map from a Noetherian local ring into its proper-ideal
25 adic completion is injective. -/
26 theorem adicCompletion_algebraMap_injective
27     {R : Type u} [CommRing R] [IsNoetherianRing R] [IsLocalRing R]
28     (I : Ideal R) (hI : I ≠ ⊤) :
29     Function.Injective (algebraMap R (AdicCompletion I R)) := by
30   intro x y hxy
31   apply sub_eq_zero.mp
32   have hmem : x - y ∈ ⨅ n : ℕ, I ^ n := by
33     rw [Ideal.mem_iInf]
34     intro n
35     have heval := congrArg
36       (fun z ↦ (AdicCompletion.eval I R n) z) hxy
37     change (I ^ n • ⊤ : Ideal R).mkQ x =
38       (I ^ n • ⊤ : Ideal R).mkQ y at heval
39     simpa using (Submodule.Quotient.eq (I ^ n • ⊤ : Ideal R)).mp heval
40   rw [Ideal.iInf_pow_eq_bot_of_isLocalRing I hI] at hmem
41   exact hmem
42 
43 /-- A finite family in a valuation ring has a member dividing every member. -/
44 theorem exists_index_dvd_all
45     {R : Type u} [CommRing R] [IsDomain R] [ValuationRing R]
46     {ι : Type v} [Fintype ι] [Nonempty ι] (a : ι → R) :
47     ∃ c, ∀ i, a c ∣ a i := by
48   classical
49   let s : Finset (Associates R) :=
50     Finset.univ.image fun i ↦ Associates.mk (a i)
51   have hs : s.Nonempty := by
52     let i : ι := Classical.choice inferInstance
53     exact ⟨Associates.mk (a i), Finset.mem_image.2
54       ⟨i, Finset.mem_univ i, rfl⟩⟩
55   obtain ⟨m, hm, hminimal⟩ := s.exists_minimal hs
56   obtain ⟨c, -, hc⟩ := Finset.mem_image.mp hm
57   refine ⟨c, fun i ↦ Associates.dvd_of_mk_le_mk ?_⟩
58   have hi : Associates.mk (a i) ∈ s :=
59     Finset.mem_image.2 ⟨i, Finset.mem_univ i, rfl⟩
60   rw [hc]
61   by_contra hnot
62   have hnotdvd : ¬a c ∣ a i := by
63     intro h
64     apply hnot
65     rw [← hc]
66     exact Associates.mk_le_mk_of_dvd h
67   have hreverse : Associates.mk (a i) ≤ m := by
68     rw [← hc]
69     exact Associates.mk_le_mk_of_dvd
70       ((ValuationRing.dvd_total (a c) (a i)).resolve_left hnotdvd)
71   exact hnot (hminimal hi hreverse)
72 
73 /-- A finite nonzero projective vector over a field has a common normalized
74 lift to any valuation subring of that field. -/
75 theorem exists_normalized_projective_lift
76     {K : Type u} [Field K] (V : ValuationSubring K)
77     {ι : Type v} [Fintype ι] [Nonempty ι]
78     (f : ι → K) (hf : ∃ i, f i ≠ 0) :
79     ∃ (chart : ι) (q : ι → V) (scale : K),
80       scale ≠ 0 ∧ q chart = 1 ∧
81       ∀ i, (q i : K) = scale * f i := by
82   classical
83   obtain ⟨b, hb⟩ :=
84     IsLocalization.exist_integer_multiples_of_finite
85       (nonZeroDivisors V) f
86   let a : ι → V := fun i ↦ (hb i).choose
87   have ha : ∀ i, algebraMap V K (a i) =
88       algebraMap V K (b : V) * f i := by
89     intro i
90     simpa only [a, Algebra.smul_def] using (hb i).choose_spec
91   obtain ⟨chart, hchart⟩ := exists_index_dvd_all a
92   let q : ι → V := fun i ↦
93     if h : i = chart then 1 else (hchart i).choose
94   have haq : ∀ i, a i = a chart * q i := by
95     intro i
96     by_cases h : i = chart
97     · subst i
98       simp [q]
99     · simpa [q, h] using (hchart i).choose_spec
100   have hb_ne : (b : V) ≠ 0 :=
101     mem_nonZeroDivisors_iff_ne_zero.mp b.property
102   have hbK_ne : algebraMap V K (b : V) ≠ 0 :=
103     (IsFractionRing.injective V K).ne hb_ne
104   have hchart_ne : a chart ≠ 0 := by
105     obtain ⟨i, hi⟩ := hf
106     intro hzero
107     have hai : a i = 0 := by rw [haq i, hzero, zero_mul]
108     have : algebraMap V K (b : V) * f i = 0 := by
109       rw [← ha i, hai, map_zero]
110     exact hi ((mul_eq_zero.mp this).resolve_left hbK_ne)
111   have hchartK_ne : algebraMap V K (a chart) ≠ 0 :=
112     (IsFractionRing.injective V K).ne hchart_ne
113   let scale : K := algebraMap V K (b : V) / algebraMap V K (a chart)
114   refine ⟨chart, q, scale, div_ne_zero hbK_ne hchartK_ne, ?_, ?_⟩
115   · simp [q]
116   · intro i
117     change algebraMap V K (q i) = scale * f i
118     apply mul_left_cancel₀ hchartK_ne
119     change algebraMap V K (a chart) * algebraMap V K (q i) =
120       algebraMap V K (a chart) * (scale * f i)
121     calc
122       algebraMap V K (a chart) * algebraMap V K (q i) =
123           algebraMap V K (a chart * q i) := by rw [map_mul]
124       _ = algebraMap V K (a i) := by rw [← haq i]
125       _ = algebraMap V K (b : V) * f i := ha i
126       _ = algebraMap V K (a chart) * (scale * f i) := by
127         dsimp [scale]
128         calc
129           algebraMap V K (b : V) * f i =
130               (algebraMap V K (a chart) *
131                 (algebraMap V K (a chart))⁻¹) *
132                 (algebraMap V K (b : V) * f i) := by
133                   rw [mul_inv_cancel₀ hchartK_ne, one_mul]
134           _ = algebraMap V K (a chart) *
135                 ((algebraMap V K (b : V) /
136                   algebraMap V K (a chart)) * f i) := by
137                   rw [div_eq_mul_inv]
138                   ring
139 
140 #print axioms exists_index_dvd_all
141 #print axioms exists_normalized_projective_lift
142 #print axioms adicCompletion_algebraMap_injective
143 
144 end
145 
146 end Stafford38.Geometry.ProjectiveValuationNormalization
147