Lean sources / Tests / PadicInt.lean

Non-vacuity in mixed characteristic: the `p`-adic integers

121 lines · 8 public declarations · raw file · declaration index

1/-2Copyright (c) 2026 Asvin G, Claude (Anthropic), GPT-6-Astra (OpenAI). All rights reserved.3Released under Apache 2.0 license as described in the file LICENSE.4Authors: Asvin G, Claude (Anthropic), GPT-6-Astra (OpenAI)5-/6import SurfaceBlowup.Corollaries.RationalForm7import Tests.Regression8import Mathlib.NumberTheory.Padics.ProperSpace9import Mathlib.NumberTheory.Padics.RingHoms10import Mathlib.Topology.MetricSpace.Ultra.Basic11 12/-!13# Non-vacuity in mixed characteristic: the `p`-adic integers14 15`Tests.NonVacuity` shows that the hypotheses of `SurfaceBlowup.main_dvr` are satisfiable in equal16characteristic (`𝔽_q⟦X⟧`). This file does the same in mixed characteristic, for the ring `ℤ_[p]` of17`p`-adic integers with **Mathlib's own topology** (the one induced by the `p`-adic norm): it is a18complete discrete valuation ring with residue field `𝔽_p`, a compact Hausdorff second-countable19topological ring, and its norm topology is the `(p)`-adic one. Equipping it with the Borel20σ-algebra (`padicIntMeasurableSpace`, a local instance: no topology or metric is declared here),21`main_dvr` applies. This is the case of the conjecture of22Bhargava–Cremona–Fisher–Gajović, which is stated over `ℤ_p`.23 24## Main results25 26* `SurfaceBlowup.Tests.isAdic_maximalIdeal_padicInt`: the norm topology on `ℤ_[p]` is `(p)`-adic.27* `SurfaceBlowup.Tests.main_dvr_padicInt`: `main_dvr` for `ℤ_[p]`, with `q = p`.28* `SurfaceBlowup.Tests.universal_type_laws_padicInt`: the monic, cluster and projective29  probabilities over `ℤ_[p]` are the (nonnegative) values at `p` of the three universal rational30  functions.31* `SurfaceBlowup.Tests.monicDensity_padicInt_two_ramified`: a random monic quadratic over `ℤ_[p]`32  is ramified with probability `1 / (p + 1)`, for every prime `p` including `p = 2`.33 34Only `ℤ_[p]` itself is instantiated. For the ring of integers of a ramified finite extension of35`ℚ_[p]`, `main_field_form_ramified` still takes the compact adic topology as a hypothesis; no36instance of it is constructed here.37-/38 39open IsLocalRing Topology40 41namespace SurfaceBlowup.Tests42 43section PadicInt44 45variable (p : ℕ) [hp : Fact p.Prime]46 47/-- The residue field of `ℤ_[p]` is `ZMod p`, hence finite. -/48instance : Finite (ResidueField ℤ_[p]) :=49  .of_equiv (ZMod p) (PadicInt.residueField (p := p)).symm.toEquiv50 51/-- The Borel σ-algebra on `ℤ_[p]`. The pinned Mathlib has no `MeasurableSpace` instance on52`ℤ_[p]`; this one is local to this file, so it cannot clash with an instance added elsewhere. -/53noncomputable local instance padicIntMeasurableSpace : MeasurableSpace ℤ_[p] := borel _54 55/-- The Borel σ-algebra makes `ℤ_[p]` a Borel space. -/56local instance padicIntBorelSpace : BorelSpace ℤ_[p] := ⟨rfl⟩57 58/-- The norm topology on `ℤ_[p]` is the `(p)`-adic topology: the ideal `(p)ⁿ` is the closed ball of59radius `p⁻ⁿ`, which is open because the `p`-adic distance is an ultrametric, and these balls form a60basis of neighbourhoods of `0`. -/61theorem isAdic_maximalIdeal_padicInt : IsAdic (maximalIdeal ℤ_[p]) := by62  rw [PadicInt.maximalIdeal_eq_span_p, isAdic_iff]63  have hball : ∀ n : ℕ, ((Ideal.span {(p : ℤ_[p])} ^ n : Ideal ℤ_[p]) : Set ℤ_[p]) =64      Metric.closedBall (0 : ℤ_[p]) ((p : ℝ) ^ (-(n : ℤ))) := by65    intro n66    ext x67    rw [Ideal.span_singleton_pow, SetLike.mem_coe, ← PadicInt.norm_le_pow_iff_mem_span_pow,68      mem_closedBall_zero_iff]69  refine ⟨fun n => ?_, fun s hs => ?_⟩70  · rw [hball]71    exact IsUltrametricDist.isOpen_closedBall _72      (zpow_ne_zero _ (by exact_mod_cast hp.out.ne_zero))73  · obtain ⟨ε, hε, hεs⟩ := Metric.mem_nhds_iff.mp hs74    obtain ⟨k, hk⟩ := PadicInt.exists_pow_neg_lt p hε75    refine ⟨k, ?_⟩76    rw [hball]77    exact (Metric.closedBall_subset_ball hk).trans hεs78 79/-- The residue field of `ℤ_[p]` has `p` elements. -/80theorem card_residueField_padicInt : Nat.card (ResidueField ℤ_[p]) = p := by81  rw [Nat.card_congr (PadicInt.residueField (p := p)).toEquiv, Nat.card_zmod]82 83/-- **`main_dvr` over `ℤ_[p]`.** With Mathlib's topology on the `p`-adic integers, its Borel84σ-algebra and normalized Haar measure, the type densities of monic polynomials and of primitive85binary forms over `ℤ_[p]` are the universal expressions evaluated at `q = p`. -/86theorem main_dvr_padicInt (n : ℕ) (σ : FactorType) :Theorem 1.187    monicDensity ℤ_[p] n σ = densityValue (monicExpr n σ) p ∧88      projectiveDensity ℤ_[p] n σ = densityValue (projectiveExpr n σ) p := by89  have h := main_dvr ℤ_[p] (isAdic_maximalIdeal_padicInt p) n σ90  rwa [card_residueField_padicInt] at h91 92/-- **Theorem 1.1 over `ℤ_[p]`, in terms of rational functions.** The values at `p` of the93rational functions of `monicExpr n σ`, `clusterExpr n σ`, `projectiveExpr n σ` are nonnegative, and94they are the monic, cluster and projective probabilities of type `σ` over `ℤ_[p]`. -/95theorem universal_type_laws_padicInt (n : ℕ) (σ : FactorType) :Theorem 1.196    (0 ≤ RatFunc.eval (RingHom.id ℚ) (p : ℚ) (monicExpr n σ).rational ∧97      monicDensity ℤ_[p] n σ = ENNReal.ofReal98        ((RatFunc.eval (RingHom.id ℚ) (p : ℚ) (monicExpr n σ).rational : ℚ) : ℝ)) ∧99    (0 ≤ RatFunc.eval (RingHom.id ℚ) (p : ℚ) (clusterExpr n σ).rational ∧100      clusterDensity ℤ_[p] n σ = ENNReal.ofReal101        ((RatFunc.eval (RingHom.id ℚ) (p : ℚ) (clusterExpr n σ).rational : ℚ) : ℝ)) ∧102    (0 ≤ RatFunc.eval (RingHom.id ℚ) (p : ℚ) (projectiveExpr n σ).rational ∧103      projectiveDensity ℤ_[p] n σ = ENNReal.ofReal104        ((RatFunc.eval (RingHom.id ℚ) (p : ℚ) (projectiveExpr n σ).rational : ℚ) : ℝ)) := by105  obtain ⟨A, B, R, rfl, rfl, rfl, -, -, h⟩ := universal_type_laws n σ106  have h' := h ℤ_[p] (isAdic_maximalIdeal_padicInt p)107  rwa [card_residueField_padicInt] at h'108 109/-- A random monic quadratic over `ℤ_[p]` is ramified (type `(2,1)`) with probability110`1 / (p + 1)`, for every prime `p`. -/111theorem monicDensity_padicInt_two_ramified :(1.3)112    monicDensity ℤ_[p] 2 {(2,1)} = ENNReal.ofReal (1 / ((p : ℝ) + 1)) := by113  have h := monicDensity_two_ramified ℤ_[p] (isAdic_maximalIdeal_padicInt p)114  rwa [card_residueField_padicInt] at h115 116end PadicInt117 118end SurfaceBlowup.Tests119 120#print axioms SurfaceBlowup.Tests.main_dvr_padicInt121#print axioms SurfaceBlowup.Tests.universal_type_laws_padicInt