@@ -182,12 +182,21 @@ theorem intValuation_def {r : R} :
182182 exp (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : ℤ) :=
183183 rfl
184184
185- open scoped Classical in
186185theorem intValuation_if_neg {r : R} (hr : r ≠ 0 ) :
187186 v.intValuation r = exp
188187 (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : ℤ) :=
189188 intValuationDef_if_neg _ hr
190189
190+ theorem intValuation_eq_exp_neg_multiplicity {r : R} (hr : r ≠ 0 ) :
191+ v.intValuation r = exp (-multiplicity v.asIdeal (Ideal.span {r}) : ℤ) := by
192+ have hsr : Ideal.span {r} ≠ 0 := Submodule.span_singleton_eq_bot.mp.mt hr
193+ have hfm : FiniteMultiplicity v.asIdeal (Ideal.span {r}) :=
194+ FiniteMultiplicity.of_prime_left v.prime hsr
195+ rw [v.intValuation_if_neg hr, exp_inj, neg_inj, Int.natCast_inj, ← ENat.coe_inj,
196+ ← FiniteMultiplicity.emultiplicity_eq_multiplicity hfm,
197+ UniqueFactorizationMonoid.emultiplicity_eq_count_normalizedFactors (irreducible v) hsr,
198+ normalize_eq, Ideal.count_associates_factors_eq hsr v.isPrime v.ne_bot]
199+
191200/-- Nonzero elements have nonzero adic valuation. -/
192201theorem intValuation_ne_zero (x : R) (hx : x ≠ 0 ) : v.intValuation x ≠ 0 := by
193202 rw [v.intValuation_if_neg hx]
@@ -249,6 +258,19 @@ theorem intValuation_le_pow_iff_mem (r : R) (n : ℕ) :
249258 v.intValuation r ≤ exp (-(n : ℤ)) ↔ r ∈ v.asIdeal ^ n := by
250259 rw [intValuation_le_pow_iff_dvd, Ideal.dvd_span_singleton]
251260
261+ theorem intValuation_le_exp_iff_le_emultiplicity {r : R} {n : ℕ} :
262+ v.intValuation r ≤ exp (-(n : ℤ)) ↔ n ≤ emultiplicity v.asIdeal (Ideal.span {r}) := by
263+ rw [intValuation_le_pow_iff_dvd, pow_dvd_iff_le_emultiplicity]
264+
265+ theorem exp_le_intValuation_iff_emultiplicity_le {r : R} {n : ℕ} :
266+ exp (-(n : ℤ)) ≤ v.intValuation r ↔ emultiplicity v.asIdeal (Ideal.span {r}) ≤ n := by
267+ rw [← ENat.lt_coe_add_one_iff, ← ENat.coe_one, ← ENat.coe_add, emultiplicity_lt_iff_not_dvd,
268+ ← intValuation_le_pow_iff_dvd, not_le, Nat.cast_add, Nat.cast_one, neg_add, exp_add,
269+ exp_neg 1 , mul_inv_lt_iff₀ (by simp)]
270+ by_cases hv : v.intValuation r = 0
271+ · simp [hv]
272+ · rw [lt_mul_exp_iff_le hv]
273+
252274/-- There exists `π : R` with `v`-adic valuation `WithZero.exp (-1)`. -/
253275theorem intValuation_exists_uniformizer :
254276 ∃ π : R, v.intValuation π = WithZero.exp (-1 : ℤ) := by
@@ -470,30 +492,26 @@ instance : IsDedekindDomain (valuationSubringAtPrime K v) :=
470492instance : Ring.KrullDimLE 1 (valuationSubringAtPrime K v) :=
471493 Ring.KrullDimLE.mk₁' (fun _ a _ ↦ IsPrime.to_maximal_ideal a)
472494
495+ instance : IsLocalization (v.asIdeal.primeCompl) (valuationSubringAtPrime K v) :=
496+ Localization.subalgebra.isLocalization_ofField K (v.asIdeal.primeCompl) _
497+
498+ end Localization
499+
473500/-- Given `v : HeightOneSpectrum R`, the valuation associated to `v` has the localization of
474501 `R` at `v` as valuation subring. -/
475502theorem valuationSubringAtPrime_eq_valuationSubring :
476503 valuationSubringAtPrime K v = (v.valuation K).valuationSubring :=
477504 ValuationSubring.eq_of_le_of_ne_top _ (valuationSubringAtPrime_le_valuation v)
478505 (by simp only [ne_eq, Valuation.valuationSubring_eq_top_iff, not_not]; infer_instance)
479506
480- end Localization
481-
482- set_option backward.isDefEq.respectTransparency false in
483507/-- All `x : K` can be written as `n / d` or `d / n` with `n : R` and `d ∈ v.asIdealᶜ`. -/
484508lemma exists_primeCompl_mul_eq_or_mul_eq (x : K) :
485509 ∃ (n : R) (d : v.asIdeal.primeCompl), x * (algebraMap R K d) = (algebraMap R K n) ∨
486510 x * (algebraMap R K n) = (algebraMap R K d) := by
487- -- `K` is an algebra over the localization of `R` at `v`.
488- letI : Algebra (Localization v.asIdeal.primeCompl) K :=
489- RingHom.toAlgebra <| Localization.mapToFractionRing K v.asIdeal.primeCompl
490- (Localization v.asIdeal.primeCompl) (Ideal.primeCompl_le_nonZeroDivisors v.asIdeal)
491- have : IsFractionRing (Localization v.asIdeal.primeCompl) K := by
492- apply IsFractionRing.isFractionRing_of_isDomain_of_isLocalization v.asIdeal.primeCompl
493511 -- It's already known that the localization of `R` at `v` is a (discrete) valuation ring, so
494512 -- write `x` or `x⁻¹` as `n / d` with `d ∈ vᶜ`.
495513 obtain (⟨r, hr⟩ | ⟨r, hr⟩) :=
496- ValuationRing.isInteger_or_isInteger (Localization v.asIdeal.primeCompl ) x
514+ ValuationRing.isInteger_or_isInteger (valuationSubringAtPrime K v ) x
497515 <;> obtain ⟨⟨n, d⟩, hnd⟩ := IsLocalization.surj v.asIdeal.primeCompl r
498516 <;> use n, d
499517 <;> apply_fun algebraMap _ K at hnd
@@ -510,6 +528,49 @@ theorem exists_primeCompl_mul_eq_of_integer (x : K) (hv : v.valuation K x ≤ 1)
510528 rw [← (v.intValuation_eq_one_iff_mem_primeCompl d).mpr d.prop,
511529 ← valuation_of_algebraMap (K := K), ← valuation_of_algebraMap (K := K), ← map_mul, hnd]
512530
531+ /-- Given `a, b ∈ A` and `v b ≤ v a` we can find `y : A` such that `y * a` is close to `b` by
532+ the valuation `v`. -/
533+ theorem exists_intValuation_mul_sub_lt {a b : R} (hv : v.intValuation b ≤ v.intValuation a)
534+ (γ : Multiplicative ℤ) : ∃ y, v.intValuation (b - y * a) < γ := by
535+ -- If `a = 0`, then `b = 0`, so we can take `y = 0`.
536+ by_cases ha: a = 0
537+ · subst ha
538+ rw [map_zero, le_zero_iff] at hv
539+ exact ⟨0 , by simp [hv]⟩
540+ · have hvaz := intValuation_ne_zero v a ha
541+ have hγz : WithZero.coe γ ≠ 0 := WithZero.coe_ne_zero
542+ -- Otherwise, find `n : ℕ` such that `exp (-n) < γ` and `exp(-n) < v a`.
543+ obtain ⟨n, hna, hnγ⟩ := exists_exp_neg_natCast_lt_and_lt hvaz hγz
544+ apply Exists.imp (fun _ h ↦ lt_of_le_of_lt h hnγ)
545+ -- `v b ≤ v a`, so `b ∈ v.asIdeal ^ -log (v a)`.
546+ -- From `irreducible_pow_sup_of_ge` we know that
547+ -- `v.asIdeal ^ -log (v a) = v.asIdeal ^ n ⊔ Ideal.span {a}`.
548+ -- So, `∃ z ∈ v.asIdeal ^ n, ∃ (y: R), b = z + y * a`. This gives `z` and `y` such that
549+ -- `b - y * a = z` and `v z ≤ exp (-n)`, as required.
550+ have hvn : emultiplicity v.asIdeal (Ideal.span {a}) ≤ n := by
551+ grw [← exp_le_intValuation_iff_emultiplicity_le, hna]
552+ have hb : b ∈ v.asIdeal ^ multiplicity v.asIdeal (Ideal.span {a}) := by
553+ rwa [← intValuation_le_pow_iff_mem, ← v.intValuation_eq_exp_neg_multiplicity ha]
554+ have hnz : Ideal.span {a} ≠ ⊥ := by rwa [ne_eq, Ideal.span_singleton_eq_bot]
555+ simpa [← Ideal.irreducible_pow_sup_of_ge hnz v.irreducible n hvn, Submodule.mem_sup,
556+ ← eq_sub_iff_add_eq, ← intValuation_le_pow_iff_mem, Ideal.mem_span_singleton'] using hb
557+
558+ /-- Given `x ∈ 𝒪[K]` we can find `a : A` such that `a` is close to `x` by the valuation `v`. -/
559+ theorem exists_valuation_sub_lt_of_integer {x : K} (hv : v.valuation K x ≤ 1 )
560+ (γ : (ℤᵐ⁰)ˣ) : ∃a, v.valuation K (algebraMap R K a - x) < γ := by
561+ -- Write `x = n / d`, with `v d = 1`.
562+ obtain ⟨n, ⟨d, hd⟩, hnd⟩ := exists_primeCompl_mul_eq_of_integer v x hv
563+ rw [← intValuation_eq_one_iff_mem_primeCompl] at hd
564+ have hd' : v.intValuation n ≤ v.intValuation d := by grw [v.intValuation_le_one n, hd]
565+ -- Get `a` such that `v (n - a * d) < γ` from the previous theorem.
566+ obtain ⟨a, hval⟩ := exists_intValuation_mul_sub_lt v hd' (WithZero.unitsWithZeroEquiv γ)
567+ rw [unitsWithZeroEquiv_apply, coe_unzero] at hval
568+ use a
569+ -- `v d = 1`, so `v (a - x) = v (x - a) = v (x - a) * v d = v (n - a * d) < γ`.
570+ suffices h : v.valuation K (algebraMap R K a - x) = v.intValuation (n - a * d) by rwa [h]
571+ rw [← valuation_of_algebraMap (K := K), Algebra.cast, map_sub _ n, map_mul, ← hnd, ← sub_mul,
572+ map_mul, valuation_of_algebraMap, hd, mul_one, Valuation.map_sub_swap]
573+
513574/-! ### Completions with respect to adic valuations
514575
515576Given a Dedekind domain `R` with field of fractions `K` and a maximal ideal `v` of `R`, we define
0 commit comments