Skip to content

Commit 8174933

Browse files
committed
feat: elements of Dedekind domain approximate elements of valuation ring (leanprover-community#37523)
Algebra part of showing that `R` is dense in `O_v` which is used to show that `R / v` is isomorphic to the residue field of `O_v` and construct the base change isomorphism for finite adeles. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
1 parent 66bbabf commit 8174933

2 files changed

Lines changed: 87 additions & 11 deletions

File tree

Mathlib/Algebra/Order/GroupWithZero/Canonical.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public import Mathlib.Algebra.Order.Group.Units
1616
public import Mathlib.Algebra.Order.GroupWithZero.Unbundled.Basic
1717
public import Mathlib.Algebra.Order.Monoid.OrderDual
1818
public import Mathlib.Algebra.Order.Monoid.TypeTags
19+
public import Mathlib.Data.Int.Basic
1920
public import Mathlib.Data.Set.Function
2021

2122
/-!
@@ -577,6 +578,20 @@ lemma lt_mul_exp_iff_le {x y : ℤᵐ⁰} (hy : y ≠ 0) : x < y * exp 1 ↔ x
577578
lift x to Multiplicative ℤ using hx
578579
rw [← log_le_log, ← log_lt_log] <;> simp [log_mul, Int.lt_add_one_iff]
579580

581+
lemma exists_exp_neg_natCast_lt {x : ℤᵐ⁰} (hx : x ≠ 0) :
582+
∃ (k : ℕ), exp (-(k : ℤ)) < x := by
583+
obtain ⟨y, hnz, hyx⟩ := WithZero.exists_ne_zero_and_lt hx
584+
use (-y.log).toNat
585+
apply lt_of_le_of_lt _ hyx
586+
rw [← WithZero.le_log_iff_exp_le hnz, Int.neg_le_iff]
587+
exact Int.self_le_toNat _
588+
589+
lemma exists_exp_neg_natCast_lt_and_lt {x y : ℤᵐ⁰} (hx : x ≠ 0) (hy : y ≠ 0) :
590+
∃ (k : ℕ), exp (-(k : ℤ)) < x ∧ exp (-(k : ℤ)) < y := by
591+
obtain ⟨z, hz, hzx, hzy⟩ := WithZero.exists_ne_zero_and_le_and_le hx hy
592+
obtain ⟨k, hk⟩ := exists_exp_neg_natCast_lt hz
593+
grind
594+
580595
lemma le_exp_log {x : Gᵐ⁰} :
581596
x ≤ exp (log x) := by
582597
cases x

Mathlib/RingTheory/DedekindDomain/AdicValuation.lean

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
186185
theorem 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. -/
192201
theorem 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)`. -/
253275
theorem intValuation_exists_uniformizer :
254276
∃ π : R, v.intValuation π = WithZero.exp (-1 : ℤ) := by
@@ -470,30 +492,26 @@ instance : IsDedekindDomain (valuationSubringAtPrime K v) :=
470492
instance : 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. -/
475502
theorem 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ᶜ`. -/
484508
lemma 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
515576
Given a Dedekind domain `R` with field of fractions `K` and a maximal ideal `v` of `R`, we define

0 commit comments

Comments
 (0)