Development/AutomorphicArithmetic/DedekindLFunctions/LandauTheorems/LandauDichotomy.lean
1import Development.AutomorphicArithmetic.DedekindLFunctions.LandauZeroFreeCriterion2import Development.AutomorphicArithmetic.DedekindLFunctions.LandauTheorems.LandauFinite34open Complex MeasureTheory Set Filter Topology56noncomputable section78namespace Deduction910theorem eq_ofReal_sub_of_dist_le_of_le_sub_re {w : ℂ} {σ D : ℝ} (h1 : dist w (σ : ℂ) ≤ D) (h2 : D ≤ σ - w.re) :11w = ((σ - D : ℝ) : ℂ) := by12have hD0 : 0 ≤ D := dist_nonneg.trans h113rw [Complex.dist_eq_re_im, Complex.ofReal_re, Complex.ofReal_im] at h114have hq : (w.re - σ) ^ 2 + (w.im - 0) ^ 2 ≤ D ^ 2 := by15have hs := Real.sq_sqrt (by positivity : (0:ℝ) ≤ (w.re - σ) ^ 2 + (w.im - 0) ^ 2)16have h0 := Real.sqrt_nonneg ((w.re - σ) ^ 2 + (w.im - 0) ^ 2)17nlinarith18have him : w.im = 0 := by nlinarith [sq_nonneg w.im]19have hre : w.re = σ - D := by nlinarith [sq_nonneg w.im]20apply Complex.ext21· rw [Complex.ofReal_re]; exact hre22· rw [Complex.ofReal_im]; exact him2324theorem landau_dichotomy {Z : Set ℂ} (hiso : ∀ z : ℂ, 0 < z.re → ∀ᶠ w in 𝓝[≠] z, w ∉ Z) {σ θ : ℝ}25(hle : ∀ ρ ∈ Z, ρ.re < σ) (hθ : 0 < θ) (hθσ : θ < σ) {ρ₀ : ℂ} (h₀ : ρ₀ ∈ Z) (hρ₀ : θ < ρ₀.re) :26(∃ D : ℝ, D ≤ σ - θ ∧ (∀ w ∈ Z, w ∉ Metric.ball (σ : ℂ) D) ∧ ∃ ρ₁ ∈ Z, σ - ρ₁.re < D) ∨27(∃ β : ℝ, (β : ℂ) ∈ Z ∧ θ < β ∧ ∃ r : ℝ, σ - β < r ∧ r ≤ σ - θ ∧28∀ w ∈ Z, w ∈ Metric.ball (σ : ℂ) r → w = β) := by29have hfin : (Z ∩ Metric.closedBall (σ : ℂ) (σ - θ)).Finite :=30landau_finite hiso (by rw [Complex.ofReal_re]; linarith)31set F := Z ∩ Metric.closedBall (σ : ℂ) (σ - θ) with hFdef32rcases F.eq_empty_or_nonempty with hF | hF33· left34refine ⟨σ - θ, le_rfl, ?_, ρ₀, h₀, by linarith⟩35intro w hw hb36have hwF : w ∈ F := ⟨hw, Metric.ball_subset_closedBall hb⟩37rw [hF] at hwF38exact hwF39· obtain ⟨ρs, hρsF, hmin⟩ := Set.exists_min_image F (fun w => dist w (σ : ℂ)) hfin hF40have hdle : dist ρs (σ : ℂ) ≤ σ - θ := Metric.mem_closedBall.mp hρsF.241have hball : ∀ w ∈ Z, w ∉ Metric.ball (σ : ℂ) (dist ρs (σ : ℂ)) := by42intro w hw hb43rw [Metric.mem_ball] at hb44have hwF : w ∈ F := ⟨hw, Metric.mem_closedBall.mpr (by linarith)⟩45have := hmin w hwF46linarith47by_cases hex : ∃ ρ₁ ∈ Z, σ - ρ₁.re < dist ρs (σ : ℂ)48· left49exact ⟨dist ρs (σ : ℂ), hdle, hball, hex⟩50· right