File size: 9,581 Bytes
b797a5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
187
188
189
190
191
192
193
194
195
196
197
198
import Mathlib
import OAI.NumberTheory.PiExponent.Geometry.WeightedCurveDegree
import OAI.NumberTheory.PiExponent.Jets.IntrinsicLength

namespace OAI

open scoped BigOperators nonZeroDivisors
open IsLocalRing IsDiscreteValuationRing

namespace PiExponent.CurveLocalOrder

theorem length_quotient_span_eq_addVal
    {A : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    {a : A} (ha : a ≠ 0) :
    Module.length A (A ⧸ Ideal.span {a}) = IsDiscreteValuationRing.addVal A a := by
  obtain ⟨ϖ, hϖ⟩ := IsDiscreteValuationRing.exists_irreducible A
  obtain ⟨n, u, rfl⟩ := IsDiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  rw [IsDiscreteValuationRing.addVal_def' u hϖ]
  rw [Ideal.span_singleton_mul_left_unit u.isUnit,
    ← Ideal.span_singleton_pow, ← hϖ.maximalIdeal_eq]
  exact IsDiscreteValuationRing.length_quotient_pow_maximalIdeal A n

def enatToIntegerOrder : ℕ∞ →+ WithTop ℤ where
  toFun := ENat.map (fun n : ℕ => (n : ℤ))
  map_zero' := by simp
  map_add' a b := ENat.map_add (Nat.castAddMonoidHom ℤ) a b

@[simp] theorem enatToIntegerOrder_top : enatToIntegerOrder ⊤ = ⊤ := rfl

@[simp] theorem enatToIntegerOrder_natCast (n : ℕ) :
    enatToIntegerOrder n = (n : WithTop ℤ) := rfl

@[simp] theorem enatToIntegerOrder_eq_top_iff (n : ℕ∞) :
    enatToIntegerOrder n = ⊤ ↔ n = ⊤ := ENat.map_eq_top_iff

theorem enatToIntegerOrder_monotone : Monotone enatToIntegerOrder := by
  apply ENat.monotone_map_iff.mpr
  intro m n h
  change (m : ℤ) ≤ (n : ℤ)
  exact_mod_cast h

noncomputable def localAddValuation
    (A : Type*) [CommRing A] [IsDomain A] [IsDiscreteValuationRing A] :
    AddValuation A (WithTop ℤ) :=
  (IsDiscreteValuationRing.addVal A).map enatToIntegerOrder
    enatToIntegerOrder_top enatToIntegerOrder_monotone

@[simp] theorem localAddValuation_apply
    {A : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A] (a : A) :
    localAddValuation A a = enatToIntegerOrder (IsDiscreteValuationRing.addVal A a) := rfl

@[simp] theorem localAddValuation_eq_top_iff
    {A : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A] (a : A) :
    localAddValuation A a = ⊤ ↔ a = 0 := by
  rw [localAddValuation_apply, enatToIntegerOrder_eq_top_iff,
    IsDiscreteValuationRing.addVal_eq_top_iff]

theorem nonZeroDivisors_le_primeCompl
    (A : Type*) [CommRing A] [IsDomain A] [IsDiscreteValuationRing A] :
    nonZeroDivisors A ≤ (localAddValuation A).toValuation.supp.primeCompl := by
  intro a ha
  change localAddValuation A a ≠ ⊤
  rw [ne_eq, localAddValuation_eq_top_iff]
  exact mem_nonZeroDivisors_iff_ne_zero.mp ha

noncomputable def fractionAddValuation
    (A K : Type*) [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    [Field K] [Algebra A K] [IsFractionRing A K] : AddValuation K (WithTop ℤ) :=
  AddValuation.ofValuation
    ((localAddValuation A).toValuation.extendToLocalization
      (nonZeroDivisors_le_primeCompl A) K)

@[simp] theorem fractionAddValuation_algebraMap
    {A K : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    [Field K] [Algebra A K] [IsFractionRing A K] (a : A) :
    fractionAddValuation A K (algebraMap A K a) = localAddValuation A a := by
  exact Valuation.extendToLocalization_apply_map_apply
    (localAddValuation A).toValuation (nonZeroDivisors_le_primeCompl A) K a

theorem fraction_order_eq_principal_colength
    {A K : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    [Field K] [Algebra A K] [IsFractionRing A K] {a : A} (ha : a ≠ 0) :
    fractionAddValuation A K (algebraMap A K a) =
      enatToIntegerOrder (Module.length A (A ⧸ Ideal.span {a})) := by
  rw [fractionAddValuation_algebraMap, localAddValuation_apply,
    length_quotient_span_eq_addVal ha]

theorem principal_colength_ne_top
    {A : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    {a : A} (ha : a ≠ 0) : Module.length A (A ⧸ Ideal.span {a}) ≠ ⊤ := by
  rw [length_quotient_span_eq_addVal ha]
  exact IsDiscreteValuationRing.addVal_eq_top_iff.not.mpr ha

theorem integerOrder_field_image_eq_length
    {A K : Type*} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    [Field K] [Algebra A K] [IsFractionRing A K] {a : A} (ha : a ≠ 0) :
    WeightedCurveDegree.integerOrder (fractionAddValuation A K)
      (Units.mk0 (algebraMap A K a) ((map_ne_zero_iff _ (IsFractionRing.injective A K)).mpr ha)) =
        ((Module.length A (A ⧸ Ideal.span {a})).toNat : ℤ) := by
  apply WithTop.coe_injective
  rw [WeightedCurveDegree.coe_integerOrder]
  change fractionAddValuation A K (algebraMap A K a) = _
  rw [fraction_order_eq_principal_colength ha]
  obtain ⟨n, hn⟩ := ENat.ne_top_iff_exists.mp (principal_colength_ne_top ha)
  rw [← hn]
  simp

theorem atPrime_principal_colength
    {S : Type*} [CommRing S] [IsDedekindDomain S]
    (q : IsDedekindDomain.HeightOneSpectrum S) {a : S} (ha : a ≠ 0) :
    let A := Localization.AtPrime q.asIdeal
    letI : IsDiscreteValuationRing A :=
      IsLocalization.AtPrime.isDiscreteValuationRing_of_dedekind_domain S q.ne_bot A
    Module.length A (A ⧸ Ideal.span {algebraMap S A a}) =
      IsDiscreteValuationRing.addVal A (algebraMap S A a) := by
  dsimp only
  let : IsDiscreteValuationRing (Localization.AtPrime q.asIdeal) :=
    IsLocalization.AtPrime.isDiscreteValuationRing_of_dedekind_domain S q.ne_bot _
  apply length_quotient_span_eq_addVal
  exact (map_ne_zero_iff _ (IsLocalization.injective
    (Localization.AtPrime q.asIdeal) q.asIdeal.primeCompl_le_nonZeroDivisors)).mpr ha

theorem ramificationIdx_eq_local_order
    {R S : Type*} [CommRing R] [CommRing S] [IsDedekindDomain S]
    [Algebra R S] (t : R) (q : Ideal S) [q.IsPrime]
    [q.LiesOver (Ideal.span {t})] (hq : q ≠ ⊥)
    (ht : algebraMap R (Localization.AtPrime q) t ≠ 0) :
    letI : IsDiscreteValuationRing (Localization.AtPrime q) :=
      IsLocalization.AtPrime.isDiscreteValuationRing_of_dedekind_domain S hq _
    q.ramificationIdx R =
      (IsDiscreteValuationRing.addVal (Localization.AtPrime q)
        (algebraMap R (Localization.AtPrime q) t)).toNat := by
  let : IsDiscreteValuationRing (Localization.AtPrime q) :=
    IsLocalization.AtPrime.isDiscreteValuationRing_of_dedekind_domain S hq _
  rw [Ideal.ramificationIdx_eq (Ideal.span {t}) q,
    Ideal.map_span, Set.image_singleton, length_quotient_span_eq_addVal ht]

theorem finite_over_coefficient_field_of_finite_length
    {F A M : Type*} [Field F] [CommRing A] [Algebra F A] [IsLocalRing A]
    [AddCommGroup M] [Module A M] [Module F M] [IsScalarTower F A M]
    (ε : A →+* F) (hε : ∀ c : F, ε (algebraMap F A c) = c)
    (hM : IsFiniteLength A M) : Module.Finite F M := by
  have hlength := PiExponentJets.W24.length_eq_coefficient_length ε hε hM
  have hF : IsFiniteLength F M := Module.length_ne_top_iff.mp (by
    rw [← hlength]
    exact Module.length_ne_top_iff.mpr hM)
  let : IsNoetherian F M := (isFiniteLength_iff_isNoetherian_isArtinian.mp hF).1
  infer_instance

theorem principal_quotient_finite_over_coefficient_field
    {F A : Type*} [Field F] [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    [Algebra F A] (ε : A →+* F) (hε : ∀ c : F, ε (algebraMap F A c) = c)
    {a : A} (ha : a ≠ 0) : Module.Finite F (A ⧸ Ideal.span {a}) := by
  exact finite_over_coefficient_field_of_finite_length ε hε
    (Module.length_ne_top_iff.mp (principal_colength_ne_top ha))

theorem principal_quotient_finrank_eq_order
    {F A : Type*} [Field F] [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    [Algebra F A] (ε : A →+* F) (hε : ∀ c : F, ε (algebraMap F A c) = c)
    {a : A} (ha : a ≠ 0) :
    (Module.finrank F (A ⧸ Ideal.span {a}) : ℕ∞) = IsDiscreteValuationRing.addVal A a := by
  let := principal_quotient_finite_over_coefficient_field ε hε ha
  rw [← PiExponentJets.W24.module_length_eq_finrank_of_augmentation ε hε]
  exact length_quotient_span_eq_addVal ha

noncomputable def residueCoefficientEquiv
    (F A : Type*) [Field F] [IsAlgClosed F] [CommRing A] [Algebra F A]
    [IsLocalRing A] [Algebra.IsIntegral F (IsLocalRing.ResidueField A)] :
    F ≃ₐ[F] IsLocalRing.ResidueField A :=
  AlgEquiv.ofBijective (Algebra.ofId F (IsLocalRing.ResidueField A))
    IsAlgClosed.algebraMap_bijective_of_isIntegral

noncomputable def residueAugmentation
    (F A : Type*) [Field F] [IsAlgClosed F] [CommRing A] [Algebra F A]
    [IsLocalRing A] [Algebra.IsIntegral F (IsLocalRing.ResidueField A)] : A →+* F :=
  (residueCoefficientEquiv F A).symm.toRingHom.comp (IsLocalRing.residue A)

@[simp] theorem residueAugmentation_algebraMap
    (F A : Type*) [Field F] [IsAlgClosed F] [CommRing A] [Algebra F A]
    [IsLocalRing A] [Algebra.IsIntegral F (IsLocalRing.ResidueField A)] (c : F) :
    residueAugmentation F A (algebraMap F A c) = c := by
  change (residueCoefficientEquiv F A).symm
    (algebraMap A (IsLocalRing.ResidueField A) (algebraMap F A c)) = c
  rw [← IsScalarTower.algebraMap_apply F A (IsLocalRing.ResidueField A)]
  exact (residueCoefficientEquiv F A).symm.commutes c

theorem principal_quotient_finrank_eq_order_of_algClosed
    {F A : Type*} [Field F] [IsAlgClosed F] [CommRing A] [IsDomain A]
    [IsDiscreteValuationRing A] [Algebra F A]
    [Algebra.IsIntegral F (IsLocalRing.ResidueField A)] {a : A} (ha : a ≠ 0) :
    (Module.finrank F (A ⧸ Ideal.span {a}) : ℕ∞) = IsDiscreteValuationRing.addVal A a :=
  principal_quotient_finrank_eq_order (residueAugmentation F A)
    (residueAugmentation_algebraMap F A) ha

end PiExponent.CurveLocalOrder

end OAI