Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.
Python
doc(Lib/CM/FormalGroup): add docstrings in PrimeNotation
sangxsh2737c338b139
diff --git a/src/Lib/CM/FormalGroup/PrimeNotation.lean b/src/Lib/CM/FormalGroup/PrimeNotation.leanindex cb62beac645..8ece166d9d0 100644--- a/src/Lib/CM/FormalGroup/PrimeNotation.lean+++ b/src/Lib/CM/FormalGroup/PrimeNotation.lean@@ -91,20 +91,25 @@ lemma piPrimeValuation_self (d : ℕ) : piPrimeValuation d d = 1 / 2 := ite_eq_l/-- The valuation `piPrimeValuation d p` at a prime `p ≠ d` is `1`. -/lemma piPrimeValuation_of_ne {d p : ℕ} (hd : p ≠ d) : piPrimeValuation d p = 1 := ite_eq_right hd+/-- The valuation `v(π_p) = piPrimeValuation d p` is positive. -/lemma piPrimeValuation_pos (d p : ℕ) : 0 < piPrimeValuation d p := byunfold piPrimeValuationpositivity+/-- The valuation `v(π_p) = piPrimeValuation d p` is at most `1`. -/lemma piPrimeValuation_le_one (d p : ℕ) : piPrimeValuation d p ≤ 1 := byunfold piPrimeValuationsplit_ifs <;> norm_num+/-- The valuation `v(π_p) = piPrimeValuation d p` is at least `1 / 2`. -/lemma half_le_piPrimeValuation (d p : ℕ) : 1 / 2 ≤ piPrimeValuation d p := bygrind [piPrimeValuation]+/-- The Legendre symbol `chiK d d` of the prime `d` with itself is `0`. -/lemma chiK_self (d : ℕ) [Fact d.Prime] : chiK d d = 0 := bysimpa using chiK_cases d d+/-- If the Legendre symbol `chiK d p` is nonzero, then `p ≠ d`. -/lemma ne_of_chiK_ne_zero {d p : ℕ} [Fact d.Prime] (hp : chiK d p ≠ 0) : p ≠ d :=fun h ↦ hp (by rw [h, chiK_self])@@ -114,19 +119,24 @@ lemma ne_of_chiK_ne_zero {d p : ℕ} [Fact d.Prime] (hp : chiK d p ≠ 0) : pnoncomputable def varpiValuation (d p : ℕ) [Fact d.Prime] : ℝ :=piPrimeValuation d p / (primeNorm d p - 1)+/-- If `p` splits, that is, `chiK d p = 1`, then `ρ_p = varpiValuation d p` is `1 / (p - 1)`. -/lemma varpiValuation_of_split {d p : ℕ} [Fact d.Prime] (h_split : chiK d p = 1) :varpiValuation d p = 1 / (p - 1) := byhave hd : p ≠ d := ne_of_chiK_ne_zero (by simp [h_split])simp [varpiValuation, primeNorm, h_split, piPrimeValuation_of_ne hd]+/-- If `p` is inert, that is, `chiK d p = -1`, then `ρ_p = varpiValuation d p` is+`1 / (p ^ 2 - 1)`. -/lemma varpiValuation_of_inert {d p : ℕ} [Fact d.Prime] (h_inert : chiK d p = -1) :varpiValuation d p = 1 / (p ^ 2 - 1) := byhave hd : p ≠ d := ne_of_chiK_ne_zero (by simp [h_inert])simp [varpiValuation, primeNorm, h_inert, piPrimeValuation_of_ne hd]+/-- At the ramified prime `d`, the number `ρ_d = varpiValuation d d` is `1 / (2 d - 2)`. -/lemma varpiValuation_self (d : ℕ) [Fact d.Prime] : varpiValuation d d = 1 / (2 * d - 2) := bygrind [varpiValuation, piPrimeValuation_self d, chiK_self d]+/-- For primes `d` and `p`, the number `ρ_p = varpiValuation d p` is nonnegative. -/lemma varpiValuation_nonneg (d p : ℕ) [Fact p.Prime] [Fact d.Prime] : 0 ≤ varpiValuation d p :=div_nonneg (piPrimeValuation_pos d p).le (sub_nonneg.2 (mod_cast (one_lt_primeNorm d p).le))@@ -142,6 +152,7 @@ lemma varpiValuation_le_one_div_sub_one (d p : ℕ) [Fact d.Prime] [Fact p.Prime`ℚ(√-d)`. -/noncomputable def gammaPrime (d p : ℕ) [Fact d.Prime] : ℝ := 1 / (p - 1) - varpiValuation d p+/-- If `p` splits, that is, `chiK d p = 1`, then `γ_p = gammaPrime d p` is `0`. -/lemma gammaPrime_of_split {d p : ℕ} [Fact d.Prime] (h_split : chiK d p = 1) :gammaPrime d p = 0 := byrw [gammaPrime, varpiValuation_of_split h_split, sub_self]@@ -153,16 +164,20 @@ lemma gammaPrime_of_inert {d p : ℕ} [Fact d.Prime] [Fact p.Prime] (h_inert : chave h_sq : (p : ℝ) ^ 2 - 1 ≠ 0 := by nlinarithgrind [gammaPrime, varpiValuation_of_inert h_inert]+/-- At the ramified prime `d`, the number `γ_d = gammaPrime d d` is `1 / (2 d - 2)`. -/lemma gammaPrime_self (d : ℕ) [Fact d.Prime] : gammaPrime d d = 1 / (2 * d - 2) := bygrind [gammaPrime, varpiValuation_self d]+/-- For primes `d` and `p`, the number `γ_p = gammaPrime d p` is nonnegative. -/lemma gammaPrime_nonneg (d p : ℕ) [Fact d.Prime] [Fact p.Prime] : 0 ≤ gammaPrime d p :=sub_nonneg.2 (varpiValuation_le_one_div_sub_one d p)+/-- For primes `d` and `p`, the number `γ_p = gammaPrime d p` is at most `1 / (p - 1)`. -/lemma gammaPrime_le_one_div (d p : ℕ) [Fact d.Prime] [Fact p.Prime] :gammaPrime d p ≤ 1 / ((p : ℝ) - 1) :=sub_le_self _ (varpiValuation_nonneg d p)+/-- For primes `d` and `p`, the number `γ_p = gammaPrime d p` is at most `1`. -/lemma gammaPrime_le_one (d p : ℕ) [Fact d.Prime] [Fact p.Prime] : gammaPrime d p ≤ 1 := byhave hp : (2 : ℝ) ≤ p := mod_cast (Fact.out : p.Prime).two_leexact (gammaPrime_le_one_div d p).trans (div_le_one_of_le₀ (by linarith) (by linarith))@@ -180,9 +195,13 @@ def partnerExponents (d p : ℕ) [Fact d.Prime] : Set ℕ := {e : ℕ | p = ddef positivePartnerExponents (d p : ℕ) [Fact d.Prime] : Set ℕ :={e : ℕ | 0 < e ∧ e ∈ partnerExponents d p}+/-- Membership in `I_p° = partnerExponents d p`: `e ∈ I_p°` if and only if `p = d`, or+`chiK d p = -1` and `e` is odd. -/lemma mem_partnerExponents {d p e : ℕ} [Fact d.Prime] :e ∈ partnerExponents d p ↔ p = d ∨ chiK d p = -1 ∧ Odd e := Iff.rfl+/-- Membership in `I_p = positivePartnerExponents d p`: `e ∈ I_p` if and only if `e` is positive+and `e ∈ I_p° = partnerExponents d p`. -/lemma mem_positivePartnerExponents {d p e : ℕ} [Fact d.Prime] :e ∈ positivePartnerExponents d p ↔ 0 < e ∧ e ∈ partnerExponents d p := Iff.rfl@@ -193,19 +212,26 @@ noncomputable instance (d p : ℕ) [Fact d.Prime] :DecidablePred (· ∈ positivePartnerExponents d p) :=fun _ ↦ decidable_of_iff _ mem_positivePartnerExponents.symm+/-- If the set `I_p° = partnerExponents d p` has an element, then `p` does not split, that is,+`chiK d p ≠ 1`. -/lemma chiK_ne_one_of_mem_partnerExponents {d p e : ℕ} [Fact d.Prime](he : e ∈ partnerExponents d p) : chiK d p ≠ 1 := byobtain rfl | ⟨h_inert, -⟩ := he <;> simp [↓chiK_self, *]+/-- If `p` does not split, that is, `chiK d p ≠ 1`, then `1` lies in+`I_p = positivePartnerExponents d p`. -/lemma one_mem_positivePartnerExponents {d p : ℕ} [Fact d.Prime] [Fact p.Prime](hp : chiK d p ≠ 1) : 1 ∈ positivePartnerExponents d p := byobtain ⟨hd, -⟩ | ⟨-, h_split | h_inert⟩ := chiK_cases d p <;>simp_all [mem_positivePartnerExponents, mem_partnerExponents]+/-- If `p` is inert, that is, `chiK d p = -1`, then `I_p° = partnerExponents d p` is the set of+odd numbers. -/lemma partnerExponents_of_inert {d p : ℕ} [Fact d.Prime] (h_inert : chiK d p = -1) :partnerExponents d p = {e : ℕ | Odd e} := bysimp [partnerExponents, h_inert, ne_of_chiK_ne_zero (d := d) (p := p) (by simp [h_inert])]+/-- If `p` splits, that is, `chiK d p = 1`, then `I_p = positivePartnerExponents d p` is empty. -/lemma positivePartnerExponents_of_split {d p : ℕ} [Fact d.Prime] (h_split : chiK d p = 1) :positivePartnerExponents d p = ∅ :=Set.eq_empty_of_forall_notMem fun _ ⟨_, he⟩ ↦ chiK_ne_one_of_mem_partnerExponents he h_split@@ -270,11 +296,14 @@ lemma hasSum_div_pow_positivePartnerExponents (d p : ℕ) [Fact d.Prime] [Fact p/-! ### The norm and the valuation of `π_p` -/+/-- For a prime `d ≡ 7 mod 8`, the number `π_p = piPrime d p` lies in `quadInt d`, the ring of+integers of `ℚ(√-d)` inside `ℂ`. -/lemma piPrime_mem_quadInt (d : ℕ) {p : ℕ} [PrimeSevenModEight d] : piPrime d p ∈ quadInt d := byunfold piPrimesplit_ifsexacts [I_mul_sqrt_mem_quadInt d, natCast_mem _ p]+/-- For a prime `p`, the number `π_p = piPrime d p` is nonzero. -/lemma piPrime_ne_zero (d : ℕ) {p : ℕ} [Fact p.Prime] :piPrime d p ≠ 0 := byhave hp : p ≠ 0 := (Fact.out : p.Prime).ne_zero@@ -312,6 +341,8 @@ lemma norm_piPrime (d : ℕ) {p : ℕ} [PrimeSevenModEight d] [Fact p.Prime] [Pa· rw [piPrime, ite_eq_right hd, map_natCast, norm_p_eq_inv, piPrimeValuation_of_ne hd,Real.rpow_neg_one]+/-- Under the embedding `ιₚ : ℂ →+* ℂ_[p]` given by a `PadicPlace p`, the number `π_p` has+norm less than `1`. -/lemma norm_piPrime_lt_one (d : ℕ) {p : ℕ} [PrimeSevenModEight d] [Fact p.Prime] [PadicPlace p] :‖ιₚ (piPrime d p)‖ < 1 := byrw [norm_piPrime]@@ -337,9 +368,12 @@ place that is given by the instance `PadicPlace p`. -/noncomputable def piPrimeInt (d : ℕ) {p : ℕ} [PrimeSevenModEight d] [Fact p.Prime][PadicPlace p] : valRingCp p := ⟨ιₚ (piPrime d p), (norm_piPrime_lt_one d).le⟩+/-- The image `piPrimeInt d` of `π_p`, viewed in `ℂ_[p]`, is `ιₚ (piPrime d p)`. -/lemma coe_piPrimeInt (d : ℕ) {p : ℕ} [PrimeSevenModEight d] [Fact p.Prime] [PadicPlace p] :(piPrimeInt d : ℂ_[p]) = ιₚ (piPrime d p) := rfl+/-- The norm of the image `piPrimeInt d` of `π_p` in `valRingCp p` is `p ^ (-v(π_p))`, where+`v(π_p) = piPrimeValuation d p`. -/lemma norm_piPrimeInt (d : ℕ) {p : ℕ} [PrimeSevenModEight d] [Fact p.Prime] [PadicPlace p] :‖((piPrimeInt d : valRingCp p) : ℂ_[p])‖ = p ^ (-piPrimeValuation d p) :=norm_piPrime d