File size: 8,722 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import OAI.ArithmeticGeometry.Models.SpreadingOut.Fg
import OAI.ArithmeticGeometry.Models.SpreadingOut.Affine
import OAI.ArithmeticGeometry.Models.SpreadingOut.SmoothShrink
import Mathlib.RingTheory.Localization.BaseChange
import Mathlib.RingTheory.Smooth.Locus

/-! # Generic Smoothness -/

namespace OAI.ArithmeticGeometry.Models.SpreadingOut.GenericSmoothness.Construction

noncomputable section

/-! Smoothness at points of an affine scheme lying above the generic point. -/

open _root_.CategoryTheory _root_.CategoryTheory.Limits _root_.AlgebraicGeometry
open scoped TensorProduct nonZeroDivisors

universe u

/-- A prime above the generic point has a local ring that is a localization
of the generic fiber. Formal smoothness of that fiber therefore implies
formal smoothness at the original prime. -/
theorem isSmoothAt_of_formallySmooth_generic_fiber
    {R K S : Type u} [CommRing R] [IsDomain R] [Field K] [CommRing S]
    [Algebra R K] [IsFractionRing R K] [Algebra R S]
    [Algebra.FormallySmooth K (K ⊗[R] S)]
    (p : Ideal S) [p.IsPrime]
    (hp : Ideal.comap (algebraMap R S) p = ⊥) : Algebra.IsSmoothAt R p := by
  let G := K ⊗[R] S
  let Sp := Localization.AtPrime p
  let M := Algebra.algebraMapSubmonoid S (nonZeroDivisors R)
  have hM : M ≤ p.primeCompl := by
    rintro _ ⟨r, hr, rfl⟩
    intro h
    have hz : r ∈ Ideal.comap (algebraMap R S) p := h
    rw [hp] at hz
    exact nonZeroDivisors.ne_zero hr hz
  let : Algebra S G := Algebra.TensorProduct.rightAlgebra
  have : IsLocalization M G := inferInstance
  let : Algebra G Sp :=
    IsLocalization.localizationAlgebraOfSubmonoidLe G Sp M p.primeCompl hM
  have : IsScalarTower S G Sp :=
    IsLocalization.localization_isScalarTower_of_submonoid_le G Sp M p.primeCompl hM
  have : IsScalarTower R G Sp := IsScalarTower.to₁₃₄ R S G Sp
  let : Algebra K Sp :=
    ((algebraMap G Sp).comp (algebraMap K G)).toAlgebra
  have : IsScalarTower K G Sp := IsScalarTower.of_algebraMap_eq' rfl
  have : IsScalarTower R K Sp := IsScalarTower.to₁₂₄ R K G Sp
  have : IsLocalization (p.primeCompl.map (algebraMap S G)) Sp :=
    IsLocalization.isLocalization_of_submonoid_le G Sp M p.primeCompl hM
  have : Algebra.FormallySmooth G Sp :=
    Algebra.FormallySmooth.of_isLocalization (p.primeCompl.map (algebraMap S G))
  have : Algebra.FormallySmooth K Sp := Algebra.FormallySmooth.comp K G Sp
  have : Algebra.FormallySmooth R K :=
    Algebra.FormallySmooth.of_isLocalization (nonZeroDivisors R)
  exact Algebra.FormallySmooth.comp R K Sp

/-- Algebraic smoothness at a prime places the corresponding point in the
scheme-theoretic smooth locus. -/
theorem affine_mem_smoothLocus_of_isSmoothAt
    (R S : Type u) [CommRing R] [CommRing S] [Algebra R S]
    [Algebra.FinitePresentation R S]
    (p : PrimeSpectrum S) [Algebra.IsSmoothAt R p.asIdeal] :
    (p : Spec (CommRingCat.of S)) ∈ (Affine.Construction.affineOver R S).hom.smoothLocus := by
  obtain ⟨s, hs, hsm⟩ := Algebra.IsSmoothAt.exists_notMem_smooth R p.asIdeal
  let L := Localization.Away s
  let := hsm
  let v := Spec.map (CommRingCat.ofHom (algebraMap S L))
  let f := (Affine.Construction.affineOver R S).hom
  have : Smooth (v ≫ f) := by
    change Smooth (Spec.map (CommRingCat.ofHom (algebraMap S L)) ≫
      Spec.map (CommRingCat.ofHom (algebraMap R S)))
    rw [← Spec.map_comp]
    apply (HasRingHomProperty.Spec_iff (P := @Smooth)).mpr
    change RingHom.Smooth ((algebraMap S L).comp (algebraMap R S))
    rw [← IsScalarTower.algebraMap_eq R S L]
    exact RingHom.smooth_algebraMap.mpr inferInstance
  have hpr : p ∈ (PrimeSpectrum.basicOpen s : Set (PrimeSpectrum S)) := hs
  rw [← PrimeSpectrum.localization_away_comap_range L s] at hpr
  obtain ⟨q, hq⟩ := hpr
  have hq' : v q = (p : Spec (CommRingCat.of S)) := hq
  have hqsm : (q : Spec (CommRingCat.of L)) ∈ v ⁻¹ᵁ f.smoothLocus := by
    rw [Scheme.Hom.preimage_smoothLocus_eq, Scheme.Hom.smoothLocus_eq_top]
    trivial
  change v q ∈ f.smoothLocus at hqsm
  rw [hq'] at hqsm
  exact hqsm

/-- Smoothness of an affine generic fiber gives smoothness of its tensor algebra. -/
theorem smooth_generic_tensor_of_smooth_pullback
    (R K S : Type u) [CommRing R] [CommRing K] [CommRing S]
    [Algebra R K] [Algebra R S]
    [Smooth (pullback.snd (Affine.Construction.affineOver R S).hom
      (Spec.map (CommRingCat.ofHom (algebraMap R K))))] :
    Algebra.Smooth K (K ⊗[R] S) := by
  let e := Affine.Construction.baseChangeAffineIso R K S
  have : IsIso e.inv.left :=
    inferInstanceAs (IsIso ((Over.forget (Spec (CommRingCat.of K))).map e.inv))
  have hs : Smooth (e.inv.left ≫
      ((Over.pullback (Spec.map (CommRingCat.ofHom (algebraMap R K)))).obj
        (Affine.Construction.affineOver R S)).hom) := by
    change Smooth (e.inv.left ≫ pullback.snd (Affine.Construction.affineOver R S).hom
      (Spec.map (CommRingCat.ofHom (algebraMap R K))))
    infer_instance
  rw [e.inv.w] at hs
  exact RingHom.smooth_algebraMap.mp
    ((HasRingHomProperty.Spec_iff (P := @Smooth)).mp hs)

theorem affine_generic_point_mem_smoothLocus
    (R K S : Type u) [CommRing R] [IsDomain R] [Field K] [CommRing S]
    [Algebra R K] [IsFractionRing R K] [Algebra R S]
    [Algebra.FinitePresentation R S]
    [Smooth (pullback.snd (Affine.Construction.affineOver R S).hom
      (Spec.map (CommRingCat.ofHom (algebraMap R K))))]
    (p : PrimeSpectrum S) (hp : Ideal.comap (algebraMap R S) p.asIdeal = ⊥) :
    (p : Spec (CommRingCat.of S)) ∈ (Affine.Construction.affineOver R S).hom.smoothLocus := by
  have := smooth_generic_tensor_of_smooth_pullback R K S
  have := isSmoothAt_of_formallySmooth_generic_fiber (K := K) p.asIdeal hp
  exact affine_mem_smoothLocus_of_isSmoothAt R S p

/-- Smoothness of the generic fiber implies smoothness at every point lying
above the generic point of an integral affine base. -/
theorem generic_point_mem_smoothLocus
    (R K : Type u) [CommRing R] [IsDomain R] [Field K]
    [Algebra R K] [IsFractionRing R K]
    {X : Scheme.{u}} (f : X ⟶ Spec (CommRingCat.of R))
    [LocallyOfFinitePresentation f]
    [Smooth (pullback.snd f (Spec.map (CommRingCat.ofHom (algebraMap R K))))]
    (x : X) (hx : f x = (show PrimeSpectrum R from ⊥)) : x ∈ f.smoothLocus := by
  let V := X.affineOpenCover
  let i := V.idx x
  obtain ⟨y, hy⟩ := V.covers x
  let g := Spec.map (CommRingCat.ofHom (algebraMap R K))
  have hsm : Smooth (pullback.snd (V.f i ≫ f) g) := by
    rw [← pullbackRightPullbackFstIso_inv_snd_snd f g (V.f i)]
    infer_instance
  obtain ⟨φ, hφ⟩ := Spec.map_surjective (V.f i ≫ f)
  let : Algebra R (V.X i) := φ.hom.toAlgebra
  have hfp : LocallyOfFinitePresentation (Spec.map φ) := by
    rw [hφ]
    infer_instance
  have : Algebra.FinitePresentation R (V.X i) :=
    RingHom.finitePresentation_algebraMap.mp
      ((LocallyOfFinitePresentation.SpecMap_iff _).mp hfp)
  have : Smooth (pullback.snd (Affine.Construction.affineOver R (V.X i)).hom g) := by
    change Smooth (pullback.snd (Spec.map φ) g)
    rw [hφ]
    exact hsm
  let p : PrimeSpectrum (V.X i) := y
  have hp : Ideal.comap (algebraMap R (V.X i)) p.asIdeal = ⊥ := by
    have heq : PrimeSpectrum.comap φ.hom p = (⊥ : PrimeSpectrum R) := by
      change (Spec.map φ) y = (show PrimeSpectrum R from ⊥)
      rw [hφ]
      change f (V.f i y) = _
      rw [hy]
      exact hx
    exact congrArg PrimeSpectrum.asIdeal heq
  have hySm : y ∈ (V.f i ≫ f).smoothLocus := by
    have h := affine_generic_point_mem_smoothLocus R K (V.X i) p hp
    change y ∈ (Spec.map φ).smoothLocus at h
    simpa only [hφ] using h
  have hyPre : y ∈ (V.f i) ⁻¹ᵁ f.smoothLocus := by
    rw [Scheme.Hom.preimage_smoothLocus_eq]
    exact hySm
  change V.f i y ∈ f.smoothLocus at hyPre
  rw [hy] at hyPre
  exact hyPre

/-- A proper model of a smooth generic fiber becomes smooth after removing
finitely many primes. The construction of the proper model remains a separate step. -/
theorem proper_model_with_smooth_generic_fiber_shrinks
    (R K : Type u) [CommRing R] [IsDomain R] [Ring.HasFiniteQuotients R] [Field K]
    [Algebra R K] [IsFractionRing R K]
    {X : Scheme.{u}} (f : X ⟶ Spec (CommRingCat.of R))
    [IsProper f] [LocallyOfFinitePresentation f]
    [Smooth (pullback.snd f (Spec.map (CommRingCat.ofHom (algebraMap R K))))] :
    ∃ U : (Spec (CommRingCat.of R)).Opens,
      ((U : Set (Spec (CommRingCat.of R)))ᶜ).Finite ∧
      (show PrimeSpectrum R from ⊥) ∈ U ∧
      Smooth (f ∣_ U) ∧ IsProper (f ∣_ U) :=
  SmoothShrink.Construction.proper_model_smooth_after_shrinking f (generic_point_mem_smoothLocus R K f)

end

end OAI.ArithmeticGeometry.Models.SpreadingOut.GenericSmoothness.Construction