diff --git a/StrongPNT/Erdos970.lean b/StrongPNT/Erdos970.lean new file mode 100644 index 0000000..2427743 --- /dev/null +++ b/StrongPNT/Erdos970.lean @@ -0,0 +1 @@ +import StrongPNT.Erdos970.PNT5_Strong diff --git a/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean b/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean new file mode 100644 index 0000000..c54399a --- /dev/null +++ b/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean @@ -0,0 +1,5460 @@ +import Mathlib + +namespace Erdos970 + + +lemma lem_2logOlog : (fun t : ℝ => 2 * Real.log t) =O[Filter.atTop] (fun t : ℝ => Real.log t) := Asymptotics.isBigO_const_mul_self 2 Real.log Filter.atTop + +lemma lem_logt22logt (t : ℝ) (_ht : t ≥ 2) : Real.log (t ^ 2) = 2 * Real.log t := by + exact Real.log_pow t 2 + +lemma lem_log2tlogt2 (t : ℝ) (ht : t ≥ 2) : Real.log (2 * t) ≤ Real.log (t ^ 2) := by + apply Real.log_le_log + · + linarith + · + + have h1 : t * (t - 2) ≥ 0 := by + apply mul_nonneg + · linarith + · linarith + + linarith [h1] + +lemma lem_log22log (t : ℝ) (ht : t ≥ 2) : Real.log (2 * t) ≤ 2 * Real.log t := by + rw [← lem_logt22logt t ht] + exact lem_log2tlogt2 t ht + +lemma lem_exprule (n : ℕ) (hn : n ≥ 1) (α β : ℂ) : (n : ℂ) ^ (α + β) = (n : ℂ) ^ α * (n : ℂ) ^ β := by + apply Complex.cpow_add + + rw [Nat.cast_ne_zero] + + rw [← Nat.one_le_iff_ne_zero] + exact hn + +lemma lem_realbw (b : ℝ) (w : ℂ) : (b * w).re = b * w.re := by + exact Complex.re_ofReal_mul b w + +lemma lem_sumReal {f : ℕ+ → ℂ} (hf : Summable f) : (∑' n : ℕ+, f n).re = ∑' n : ℕ+, (f n).re := by + exact Complex.re_tsum hf + +lemma lem_Euler (a : ℝ) : Complex.exp (a * Complex.I) = Real.cos a + Real.sin a * Complex.I := by + rw [Complex.exp_mul_I] + rw [← Complex.ofReal_cos, ← Complex.ofReal_sin] + +lemma lem_Reecos (a : ℝ) : (Complex.exp (a * Complex.I)).re = Real.cos a := by + rw [lem_Euler] + rw [Complex.add_re] + rw [Complex.ofReal_re] + rw [Complex.re_ofReal_mul] + rw [Complex.I_re] + simp + +lemma lem_explog (n : ℕ) (hn : n ≥ 1) : (n : ℝ) = Real.exp (Real.log (n : ℝ)) := by + rw [Real.exp_log] + + rw [Nat.cast_pos] + + have h1 : n ≠ 0 := by + rw [← Nat.one_le_iff_ne_zero] + exact hn + rw [Nat.pos_iff_ne_zero] + exact h1 + +lemma lem_coseven (a : ℝ) : Real.cos (-a) = Real.cos a := by + exact Real.cos_neg a + +lemma lem_coseveny (n : ℕ) (_hn : n ≥ 1) (y : ℝ) : Real.cos (-y * Real.log (n : ℝ)) = Real.cos (y * Real.log (n : ℝ)) := by + rw [neg_mul] + exact lem_coseven (y * Real.log (n : ℝ)) + +lemma lem_niyelog (n : ℕ) (hn : n ≥ 1) (y : ℝ) : (n : ℂ) ^ (-y * Complex.I) = Complex.exp (-y * Complex.I * Real.log (n : ℝ)) := by + + have h1 : (n : ℂ) ≠ 0 := by + rw [Nat.cast_ne_zero] + rw [← Nat.one_le_iff_ne_zero] + exact hn + + rw [Complex.cpow_def_of_ne_zero h1] + + rw [← Complex.natCast_log] + + ring_nf + +lemma lem_eacosalog (n : ℕ) (_hn : n ≥ 1) (y : ℝ) : (Complex.exp (-y * Complex.I * Real.log (n : ℝ))).re = Real.cos (-y * Real.log (n : ℝ)) := by + + let a := -y * Real.log (n : ℝ) + + have h : -y * Complex.I * Real.log (n : ℝ) = a * Complex.I := by + simp [a, mul_assoc, mul_comm Complex.I] + rw [h] + + exact lem_Reecos a + +lemma lem_eacosalog2 (n : ℕ) (hn : n ≥ 1) (y : ℝ) : ((n : ℂ) ^ (-y * Complex.I)).re = Real.cos (-y * Real.log (n : ℝ)) := by + rw [lem_niyelog n hn y] + exact lem_eacosalog n hn y + +lemma lem_eacosalog3 (n : ℕ) (hn : n ≥ 1) (y : ℝ) : ((n : ℂ) ^ (-y * Complex.I)).re = Real.cos (y * Real.log (n : ℝ)) := by + rw [lem_eacosalog2 n hn y] + exact lem_coseveny n hn y + +lemma lem_cos2t (θ : ℝ) : Real.cos (2 * θ) = 2 * Real.cos θ ^ 2 - 1 := by + exact Real.cos_two_mul θ + +lemma lem_cos2t2 (θ : ℝ) : 2 * Real.cos θ ^ 2 = 1 + Real.cos (2 * θ) := by + rw [lem_cos2t] + ring + +lemma lem_cosSquare (θ : ℝ) : 2 * (1 + Real.cos θ)^2 = 2 + 4 * Real.cos θ + 2 * Real.cos θ^2 := by + ring + +lemma lem_cos2cos341 (θ : ℝ) : 2 * (1 + Real.cos θ) ^ 2 = 3 + 4 * Real.cos θ + Real.cos (2 * θ) := by + rw [lem_cosSquare] + rw [lem_cos2t2] + ring + +lemma lem_SquarePos (y : ℝ) : 0 ≤ y ^ 2 := by + exact sq_nonneg y + +lemma lem_SquarePos2 (y : ℝ) : 0 ≤ 2 * y ^ 2 := by + apply mul_nonneg + · norm_num + · exact lem_SquarePos y + +lemma lem_SquarePoscos (θ : ℝ) : 0 ≤ 2 * (1 + Real.cos θ) ^ 2 := by + exact lem_SquarePos2 (1 + Real.cos θ) + +lemma lem_postrig (θ : ℝ) : 0 ≤ 3 + 4 * Real.cos θ + Real.cos (2 * θ) := by + rw [← lem_cos2cos341] + exact lem_SquarePoscos θ + +lemma lem_postriglogn (n : ℕ) (_hn : n ≥ 1) (t : ℝ) : 0 ≤ 3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ)) := by + rw [mul_assoc] + exact lem_postrig (t * Real.log (n : ℝ)) + +lemma lem_seriesPos {r_n : ℕ+ → ℝ} {r : ℝ} (h_hasSum : HasSum r_n r) (h_nonneg : ∀ n : ℕ+, r_n n ≥ 0) : r ≥ 0 := by + + have h_eq : ∑' n, r_n n = r := HasSum.tsum_eq h_hasSum + + have h_tsum_nonneg : ∑' n, r_n n ≥ 0 := tsum_nonneg h_nonneg + + rw [← h_eq] + exact h_tsum_nonneg + +lemma real_part_of_diff (M : ℝ) (w : ℂ) : (2 * M - w).re = 2 * M - w.re := by + simp [Complex.sub_re] + +lemma real_part_of_diffz (M : ℝ) (f_z : ℂ) : (2 * M - f_z).re = 2 * M - f_z.re := real_part_of_diff M f_z + +lemma inequality_reversal (x M : ℝ) (hxM : x ≤ M) : 2 * M - x ≥ M := by linarith + +lemma real_part_lower_bound (w : ℂ) (M : ℝ) (_hM : M > 0) (h : w.re ≤ M) : 2 * M - w.re ≥ M := by apply inequality_reversal w.re M h + +lemma real_part_lower_bound2 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w).re ≥ M := by rw [real_part_of_diffz]; exact real_part_lower_bound w M hM h + +lemma real_part_lower_bound3 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w).re > 0 := by + rw [real_part_of_diffz] + apply lt_of_le_of_lt' + apply real_part_lower_bound + exact hM + exact h + exact hM + +lemma nonzero_if_real_part_positive (w : ℂ) (hw_re_pos : w.re > 0) : w ≠ 0 := by + by_contra h + rw [h] at hw_re_pos + exact lt_irrefl 0 hw_re_pos + +lemma lem_real_part_lower_bound4 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w) ≠ 0 := by + apply nonzero_if_real_part_positive + exact real_part_lower_bound3 w M hM h + +lemma lem_abspos (z : ℂ) : z ≠ 0 → norm z > 0 := by + intro h_ne_zero + apply Real.sqrt_pos.mpr + exact Complex.normSq_pos.mpr h_ne_zero + +lemma lem_real_part_lower_bound5 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : norm (2 * M - w) > 0 := by + apply lem_abspos + exact lem_real_part_lower_bound4 w M hM h + +lemma lem_wReIm (w : ℂ) : w = w.re + Complex.I * w.im := by + apply Complex.ext + simp + simp + +lemma lem_modaib (a b : ℝ) : norm (a + Complex.I * b) ^ 2 = a ^ 2 + b ^ 2 := by rw [Complex.sq_norm, Complex.normSq_apply]; simp; ring + +lemma lem_modcaib (a b c : ℝ) : norm (c - a - Complex.I * b) ^ 2 = (c - a) ^ 2 + b ^ 2 := by + rw [Complex.sq_norm, Complex.normSq_apply] + simp + ring + +lemma lem_diffmods (a b c : ℝ) : +norm (c - a - Complex.I * b) ^ 2 - norm (a + Complex.I * b) ^ 2 = (c - a) ^ 2 - a ^ 2 := by + rw [lem_modcaib, lem_modaib] + ring + +lemma lem_casq (a c : ℝ) : (c - a) ^ 2 = a ^ 2 - 2 * a * c + c ^ 2 := by linarith + +lemma lem_casq2 (a c : ℝ) : (c - a) ^ 2 - a ^ 2 = c * (c - 2 * a) := by + ring + +lemma lem_diffmods2 (a b c : ℝ) : norm (c - a - Complex.I * b) ^ 2 - norm (a + Complex.I * b) ^ 2 = c * (c - 2 * a) := by + rw [lem_diffmods] + rw [lem_casq2] + +lemma lem_modulus_sq_ReImw (M : ℝ) (w : ℂ) : norm (2 * M - w) ^ 2 - norm w ^ 2 = 4 * M * (M - w.re) := by + simp_rw [Complex.sq_norm] + simp_rw [Complex.normSq_apply] + simp [Complex.sub_re, Complex.sub_im, Complex.ofReal_re, Complex.ofReal_im] + ring + +lemma lem_modulus_sq_identity (M : ℝ) (w : ℂ) : norm (2 * M - w) ^ 2 - norm w ^ 2 = 4 * M * (M - w.re) := lem_modulus_sq_ReImw M w + +lemma lem_nonnegative_product (M x : ℝ) (hM : M > 0) (hxM : x ≤ M) : 4 * M * (M - x) ≥ 0 := by + have h_four_M_nonneg : 4 * M ≥ 0 := by linarith [hM] + have h_diff_nonneg : M - x ≥ 0 := by linarith [hxM] + apply mul_nonneg h_four_M_nonneg h_diff_nonneg + +lemma lem_nonnegative_product2 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : 4 * M * (M - w.re) ≥ 0 := by + apply lem_nonnegative_product + exact hM + exact hw_re_le_M + +lemma lem_nonnegative_product3 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ^ 2 - norm w ^ 2 ≥ 0 := by + rw [lem_modulus_sq_identity] + apply lem_nonnegative_product2 + exact hM + exact hw_re_le_M + +lemma lem_nonnegative_product4 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ^ 2 ≥ norm w ^ 2 := by + have h := lem_nonnegative_product3 M w hM hw_re_le_M + linarith + +lemma lem_nonnegative_product5 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ≥ norm w := by + have h_sq_ge : ‖2 * M - w‖ ^ 2 ≥ ‖w‖ ^ 2 := by + apply lem_nonnegative_product4 M w hM hw_re_le_M + rw [ge_iff_le] at h_sq_ge + + apply (sq_le_sq₀ (norm_nonneg w) (norm_nonneg (2 * M - w))).mp + exact h_sq_ge + +lemma lem_nonnegative_product6 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm w ≤ norm (2 * M - w) := by apply lem_nonnegative_product5 M w hM hw_re_le_M + +lemma lem_ineqmultr (a b c : ℝ) (hc : c > 0) (_ha : 0 ≤ a) (hab : a ≤ b) : a / c ≤ b / c := by + apply div_le_div_of_nonneg_right + exact hab + linarith [hc] + +lemma lem_ineqmultrbb (a b : ℝ) (hb : b > 0) (ha : 0 ≤ a) (hab : a ≤ b) : a / b ≤ 1 := by + have h := lem_ineqmultr a b b hb ha hab + rw [div_self (ne_of_gt hb)] at h + exact h + +lemma lem_nonnegative_product7 (M : ℝ) (w : ℂ) (_hM : M > 0) (h_abs_diff_pos : norm (2 * M - w) > 0) (h_abs_le_abs_diff : norm w ≤ norm (2 * M - w)) : norm w / norm (2 * M - w) ≤ 1 := by + + have h_abs_w_nonneg : 0 ≤ ‖w‖ := norm_nonneg w + + apply lem_ineqmultrbb + exact h_abs_diff_pos + exact h_abs_w_nonneg + exact h_abs_le_abs_diff + +lemma lem_nonnegative_product8 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) (h_abs_le_abs_diff : norm w ≤ +norm (2 * M - w)) : norm w / norm (2 * M - w) ≤ 1 := by + apply lem_nonnegative_product7 M w + exact hM + apply lem_real_part_lower_bound5 w M hM hw_re_le_M + exact h_abs_le_abs_diff + +lemma lem_nonnegative_product9 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm w / norm (2 * M - w) ≤ 1 := by + apply lem_nonnegative_product8 + exact hM + exact hw_re_le_M + apply lem_nonnegative_product6 + exact hM + exact hw_re_le_M + +lemma lem_triangle_ineq (N G : ℂ) : norm (N + G) ≤ norm N + norm G := by + exact norm_add_le N G + +lemma lem_triangleineqminus (N F : ℂ) : norm (N - F) ≤ norm N + norm F := by + rw [sub_eq_add_neg] + calc + ‖N + (-F)‖ ≤ ‖N‖ + ‖-F‖ := by apply lem_triangle_ineq + _ = ‖N‖ + ‖F‖ := by rw [norm_neg] + +lemma lem_rtriangle (r : ℝ) (N F : ℂ) (hr : r > 0) : r * norm (N - F) ≤ r * (norm N + norm F) := by + apply mul_le_mul_of_nonneg_left + apply lem_triangleineqminus + linarith + +lemma rtriangle2 (r : ℝ) (N F : ℂ) (hr : r > 0) : r * norm (N - F) ≤ r * norm N + r * norm F := by + have h := lem_rtriangle r N F hr + linarith [h] + +lemma lem_rtriangle3 (r R : ℝ) (N F : ℂ) (hr : r > 0) (_hR : r < R) (h : R * norm F ≤ r * norm (N - F)) : R * norm F ≤ r * norm N + r * norm F := by + calc + R * norm F ≤ r * norm (N - F) := by exact h + _ ≤ r * norm N + r * norm F := by apply rtriangle2 r N F hr + +lemma lem_rtriangle4 (r R : ℝ) (N F : ℂ) (hr : 0 < r) (hR : r < R) (h_hyp : R * norm F ≤ r * norm (N - F)) : (R - r) * norm F ≤ r * norm N := by + have h_result_from_lem3 : R * norm F ≤ r * norm N + r * norm F := by + apply lem_rtriangle3 r R N F hr hR h_hyp + linarith [h_result_from_lem3] + +lemma lem_absposeq (a : ℝ) (ha : a > 0) : |a| = a := by + apply Real.norm_of_nonneg + linarith [ha] + +lemma lem_a2a (a : ℝ) (ha : a > 0) : 2 * a > 0 := by linarith + +lemma lem_absposeq2 (a : ℝ) (ha : a > 0) : |2 * a| = 2 * a := by + apply lem_absposeq + apply lem_a2a + exact ha + +lemma lem_rtriangle5 (r R M : ℝ) (F : ℂ) (hr : 0 < r) (hrR : r < R) (hM : M > 0) + (h_hyp : R * norm F ≤ r * norm (2 * M - F)) : +(R - r) * norm F ≤ 2 * M * r := by + + have h1 : (R - r) * norm F ≤ r * norm (2 * M : ℂ) := + lem_rtriangle4 r R (2 * M : ℂ) F hr hrR h_hyp + + have h2 : norm (2 * M : ℂ) = 2 * M := by + + have h_pos : (2 * M : ℝ) > 0 := by linarith [hM] + + convert Complex.norm_of_nonneg (le_of_lt h_pos) using 1 + + norm_cast + + rw [h2] at h1 + + rw [mul_comm r (2 * M)] at h1 + exact h1 + +lemma lem_RrFpos (r R : ℝ) (F : ℂ) (_hr : 0 < r) (hrR : r < R) : (R - r) * norm F ≥ 0 := by + have h_R_minus_r_nonneg : R - r ≥ 0 := by linarith [hrR] + have h_abs_F_nonneg : 0 ≤ norm F := by apply norm_nonneg + apply mul_nonneg h_R_minus_r_nonneg h_abs_F_nonneg + +lemma lem_rtriangle6 (r R M : ℝ) (F : ℂ) (hr : 0 < r) (hrR : r < R) (_hM : M > 0) + (h_hyp : (R - r) * norm F ≤ 2 * M * r) : +norm F ≤ (2 * M * r) / (R - r) := by + have h_R_minus_r_pos : R - r > 0 := by linarith [hrR] + have h_numerator_nonneg : 0 ≤ (R - r) * ‖F‖ := by apply lem_RrFpos r R F hr hrR + + have h_ineq_with_denominators : ( (R - r) * ‖F‖ ) / (R - r) ≤ (2 * M * r) / (R - r) := by + apply lem_ineqmultr + exact h_R_minus_r_pos + exact h_numerator_nonneg + exact h_hyp + + rw [mul_div_cancel_left₀ (‖F‖) (ne_of_gt h_R_minus_r_pos)] at h_ineq_with_denominators + + exact h_ineq_with_denominators + +lemma lem_rtriangle7 (r R M : ℝ) (F : ℂ) + (hr : 0 < r) (hrR : r < R) (hM : M > 0) + (h_hyp : R * norm F ≤ r * norm (2 * M - F)) : +norm F ≤ (2 * M * r) / (R - r) := by + have h_step1 := lem_rtriangle5 r R M F hr hrR hM h_hyp + apply lem_rtriangle6 r R M F hr hrR hM h_step1 + +def ballDR (R : ℝ) : Set ℂ := Metric.ball (0 : ℂ) R + +lemma analyticAt_to_analyticWithinAt {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} (hf : AnalyticAt ℂ f z) : AnalyticWithinAt ℂ f S z := by + exact hf.analyticWithinAt + +theorem analyticWithinAt_to_analyticAt_aux {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} (_hS : S ∈ nhds z) + (p : FormalMultilinearSeries ℂ ℂ ℂ) (r : ENNReal) (_h_conv_on_inter : r ≤ p.radius) (_hr_pos : 0 < r) + (hasSumt : ∀ {y : ℂ}, z + y ∈ insert z S → y ∈ Metric.eball 0 r → HasSum (fun n => (p n) fun _x => y) (f (z + y))) + (ε : ℝ) (hε_pos : ε > 0) (h_ball_subset_S : Metric.ball z ε ⊆ S) : + let r' := min r (ENNReal.ofReal ε); + ∀ {y : ℂ}, y ∈ Metric.eball 0 r' → HasSum (fun n => (p n) fun _x => y) (f (z + y)) := by + intro r' y hy + apply hasSumt + · + + right + apply h_ball_subset_S + rw [Metric.mem_ball] + + simp + + have : y ∈ Metric.eball 0 (ENNReal.ofReal ε) := by + apply Metric.eball_subset_eball (min_le_right r (ENNReal.ofReal ε)) hy + + have ε_nn : ENNReal.ofReal ε = ↑(ε.toNNReal) := by + simp [ENNReal.ofReal] + rw [ε_nn] at this + rw [@Metric.eball_coe] at this + simpa [Metric.mem_ball, dist_self_add_right, Real.toNNReal_of_nonneg hε_pos.le] + + · + exact Metric.eball_subset_eball (min_le_left r (ENNReal.ofReal ε)) hy + +theorem analyticWithinAt_to_analyticAt {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} + (hS : S ∈ nhds z) (h : AnalyticWithinAt ℂ f S z) : AnalyticAt ℂ f z := by + rcases h with ⟨p, hp⟩ + + use p + + rcases hp with ⟨r, h_conv_on_inter, hr_pos⟩ + + rcases Metric.mem_nhds_iff.mp hS with ⟨ε, hε_pos, h_ball_subset_S⟩ + + let r' := min r (ENNReal.ofReal ε) + use r' + + constructor + + · exact inf_le_of_left_le h_conv_on_inter + + · + exact lt_min hr_pos (ENNReal.ofReal_pos.mpr hε_pos) + rename_i hasSumt + exact analyticWithinAt_to_analyticAt_aux hS p r h_conv_on_inter hr_pos hasSumt ε hε_pos h_ball_subset_S + +lemma lem_not0mono (R : ℝ) (_hR_pos : 0 < R) (_hR_lt_one : R < 1) : + {z : ℂ | norm z ≤ R ∧ z ≠ 0} ⊆ {z : ℂ | z ≠ 0} := by + intro z hz + exact hz.2 + +lemma lem_analmono {T S : Set ℂ} {f : ℂ → ℂ} (hS : AnalyticOn ℂ f S) (hT : T ⊆ S) : + AnalyticOn ℂ f T := by + exact hS.mono hT + +lemma lem_1zanalDR (R : ℝ) (_hR_pos : 0 < R) : + AnalyticOn ℂ (fun z ↦ z⁻¹) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by + + apply AnalyticOn.mono (analyticOn_inv) + + intro z hz + + exact hz.2 + +lemma lem_analprod {T : Set ℂ} {f1 f2 : ℂ → ℂ} (hf1 : AnalyticOn ℂ f1 T) (hf2 : AnalyticOn ℂ f2 T) : + AnalyticOn ℂ (f1 * f2) T := by + exact hf1.mul hf2 + +lemma lem_analprodST {T S : Set ℂ} {f1 f2 : ℂ → ℂ} (hTS : T ⊆ S) (hf1 : AnalyticOn ℂ f1 T) (hf2 : AnalyticOn ℂ f2 S) : + AnalyticOn ℂ (f1 * f2) T := by + exact hf1.mul (hf2.mono hTS) + +lemma lem_analprodTDR (R : ℝ) (f1 f2 : ℂ → ℂ) : + (AnalyticOn ℂ f1 {z : ℂ | norm z ≤ R ∧ z ≠ 0}) → + (AnalyticOn ℂ f2 (Metric.closedBall 0 R)) → + AnalyticOn ℂ (f1 * f2) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by + intro hf1 hf2 + + let T := {z : ℂ | norm z ≤ R ∧ z ≠ 0} + + have hf2_on_T : AnalyticOn ℂ f2 T := by + + apply hf2.mono + intro z hz + + simp [Metric.closedBall, dist_zero_right] + + exact hz.1 + + exact hf1.mul hf2_on_T + +lemma lem_fzzTanal {R : ℝ} (hR_pos : 0 < R) (f : ℂ → ℂ) + (hf : AnalyticOn ℂ f (Metric.closedBall 0 R)) : + AnalyticOn ℂ (fun z ↦ f z / z) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by + + rw [show (fun z ↦ f z / z) = (fun z ↦ f z) * (fun z ↦ z⁻¹) by ext; simp [div_eq_mul_inv]] + + let T := {z : ℂ | norm z ≤ R ∧ z ≠ 0} + + have hf_on_T : AnalyticOn ℂ f T := hf.mono (?_) + + have h_inv_on_T : AnalyticOn ℂ (fun z ↦ z⁻¹) T := lem_1zanalDR R hR_pos + + exact lem_analprod hf_on_T h_inv_on_T + intro z hz + have hT : T = {z | norm z ≤ R ∧ z ≠ 0} := rfl + rw [hT] at hz + simp only [Set.mem_ofPred_eq] at hz + simp only [Metric.mem_closedBall] + simp only [dist_zero_right] + exact hz.1 + +lemma lem_AnalOntoWithin {V : Set ℂ} {h : ℂ → ℂ} (hh : AnalyticOn ℂ h V) (z : ℂ) (hz : z ∈ V) : + AnalyticWithinAt ℂ h V z := by + exact hh z hz + +lemma lem_AnalWithintoOn {R : ℝ} (_hR : 0 < R) (h : ℂ → ℂ) : + (∀ z ∈ Metric.closedBall 0 R, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) → + AnalyticOn ℂ h (Metric.closedBall 0 R) := by + exact fun h => h + +lemma lem_DR0T {R : ℝ} (hR : 0 < R) : + Metric.closedBall 0 R = {0} ∪ {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by + ext z + simp [Metric.closedBall, dist_zero_right] + by_cases hz : z = 0 + · simp [hz, hR.le] + · simp [hz] + +lemma lem_analWWWithin {R : ℝ} (hR_pos : 0 < R) (h : ℂ → ℂ) : + (AnalyticWithinAt ℂ h (Metric.closedBall 0 R) 0) → + (∀ z ∈ {z : ℂ | norm z ≤ R ∧ z ≠ 0}, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) → + (∀ z ∈ Metric.closedBall 0 R, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) := by + intro h0 hT z hz + rw [lem_DR0T hR_pos] at hz + cases' hz with hz hz + · simp at hz + rw [hz] + exact h0 + · exact hT z hz + +lemma lem_analWWithinAtOn (R : ℝ) (hR_pos : 0 < R) (h : ℂ → ℂ) + (h_at_0 : AnalyticWithinAt ℂ h (Metric.closedBall 0 R) 0) + (h_at_T : ∀ z ∈ {z : ℂ | norm z ≤ R ∧ z ≠ 0}, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) : + AnalyticOn ℂ h (Metric.closedBall 0 R) := by + exact lem_analWWWithin hR_pos h h_at_0 h_at_T + +lemma lem_AnalAttoWithin {h : ℂ → ℂ} {s : Set ℂ} (hh : AnalyticAt ℂ h 0) : + AnalyticWithinAt ℂ h s 0 := by + exact hh.analyticWithinAt + +lemma analyticWithinAt_punctured_to_closedBall {R : ℝ} (_hR : 0 < R) {h : ℂ → ℂ} {z : ℂ} (hz : z ∈ {w : ℂ | norm w ≤ R ∧ w ≠ 0}) (h_within : AnalyticWithinAt ℂ h {w : ℂ | norm w ≤ R ∧ w ≠ 0} z) : AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z := by + + apply AnalyticWithinAt.mono_of_mem_nhdsWithin h_within + + have hz_ne_zero : z ≠ 0 := hz.2 + + rw [mem_nhdsWithin_iff_exists_mem_nhds_inter] + + use Metric.ball z (‖z‖ / 2) + + constructor + · + exact Metric.ball_mem_nhds z (half_pos (norm_pos_iff.mpr hz_ne_zero)) + + · + intro w hw + constructor + · + have w_in_closedball : w ∈ Metric.closedBall 0 R := hw.2 + simp only [Metric.mem_closedBall, dist_zero_right] at w_in_closedball + + simp [w_in_closedball] + · + intro hw_eq_zero + have w_in_ball : w ∈ Metric.ball z (‖z‖ / 2) := hw.1 + rw [hw_eq_zero] at w_in_ball + simp only [Metric.mem_ball] at w_in_ball + + rw [dist_comm] at w_in_ball + simp at w_in_ball + have pos_norm : 0 < ‖z‖ := norm_pos_iff.mpr hz_ne_zero + linarith [pos_norm] + +lemma lem_analAtOnOn {R : ℝ} (hR_pos : 0 < R) (h : ℂ → ℂ) : + AnalyticAt ℂ h 0 → + AnalyticOn ℂ h {z : ℂ | norm z ≤ R ∧ z ≠ 0} → + AnalyticOn ℂ h (Metric.closedBall 0 R) := by + intro h_at_0 h_on_punctured + + apply lem_analWWithinAtOn R hR_pos h + + · exact lem_AnalAttoWithin h_at_0 + + · intro z hz + + have h_within_punctured : AnalyticWithinAt ℂ h {w : ℂ | norm w ≤ R ∧ w ≠ 0} z := + lem_AnalOntoWithin h_on_punctured z hz + + exact analyticWithinAt_punctured_to_closedBall hR_pos hz h_within_punctured + +lemma lem_orderne0 (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (hf0 : f 0 = 0) : + analyticOrderAt f 0 ≠ 0 := by exact (AnalyticAt.analyticOrderAt_ne_zero hf).mpr hf0 + +lemma lem_ordernetop (f : ℂ → ℂ) (_hf : AnalyticAt ℂ f 0) (hf_ne_zero : ¬(∀ᶠ z in nhds 0, f z = 0)) : + analyticOrderAt f 0 ≠ ⊤ := by + intro h + rw [analyticOrderAt_eq_top] at h + exact hf_ne_zero h + +lemma lem_ordernatcast (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (n : ℕ) (hn : analyticOrderAt f 0 = n) : + ∃ (g : ℂ → ℂ), AnalyticAt ℂ g 0 ∧ g 0 ≠ 0 ∧ ∀ᶠ (z : ℂ) in nhds 0, f z = z ^ n * g z := by + + rw [AnalyticAt.analyticOrderAt_eq_natCast] at hn + · convert hn + aesop + · exact hf + +lemma lem_ordernatcast1 (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (n : ℕ) (hn : analyticOrderAt f 0 = n) (hn_ne_zero : n ≠ 0) : + ∃ (h : ℂ → ℂ), AnalyticAt ℂ h 0 ∧ ∀ᶠ z in nhds 0, f z = z * h z := by + + rcases lem_ordernatcast f hf n hn with ⟨g, hg_analytic, _, hf_eq_g⟩ + + use fun z ↦ z ^ (n - 1) * g z + constructor + · + exact (analyticAt_id.pow (n - 1)).mul hg_analytic + · + filter_upwards [hf_eq_g] with z h_eq + rw [h_eq] + ring_nf + rw [← pow_succ' z (n - 1), Nat.sub_add_cancel (Nat.pos_of_ne_zero hn_ne_zero)] + +lemma lem_ordernatcast2_old (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (hf0 : f 0 = 0) + (h_not_eventually_zero : ¬ (∀ᶠ z in nhds 0, f z = 0)) : + ∃ (h : ℂ → ℂ), AnalyticAt ℂ h 0 ∧ ∀ᶠ z in nhds 0, f z = z * h z := by + + let n₀ := analyticOrderAt f 0 + + have hn_ne_top : n₀ ≠ ⊤ := lem_ordernetop f hf h_not_eventually_zero + + lift n₀ to ℕ using hn_ne_top with n hn_eq + + have hn_ne_zero : n ≠ 0 := by + intro hn_zero + rw [hn_zero] at hn_eq + + have t := (lem_orderne0 f hf hf0) + have : n₀ = analyticOrderAt f 0 := rfl + rw [←this] at t + exact t (id (Eq.symm hn_eq)) + + exact lem_ordernatcast1 f hf n (by aesop) hn_ne_zero + +lemma lem_ordernatcast2 {R : ℝ} (hR_pos : 0 < R) (f : ℂ → ℂ) (hf0 : f 0 = 0) + (hf : AnalyticOn ℂ f (Metric.closedBall 0 R)) : + AnalyticAt ℂ (fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z) 0 := by + + have hS : Metric.closedBall 0 R ∈ nhds (0 : ℂ) := by + + refine Filter.mem_of_superset (Metric.ball_mem_nhds (0 : ℂ) hR_pos) ?subset + exact Metric.ball_subset_closedBall + have hf_within : AnalyticWithinAt ℂ f (Metric.closedBall 0 R) 0 := hf 0 (by + simp [Metric.mem_closedBall, hR_pos.le]) + have hf_at0 : AnalyticAt ℂ f 0 := analyticWithinAt_to_analyticAt hS hf_within + + let g : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z + + by_cases hEZ : (∀ᶠ z in nhds (0 : ℂ), f z = 0) + · + + have hU : {z : ℂ | f z = 0} ∈ nhds (0 : ℂ) := by simpa only [Filter.Eventually] using hEZ + + have hf_eq_zero : f =ᶠ[nhds (0 : ℂ)] (fun _ : ℂ => 0) := by + refine (Filter.eventuallyEq_iff_exists_mem).2 ?_ + exact ⟨{z | f z = 0}, hU, by intro z hz; simpa [Set.mem_ofPred_eq] using hz⟩ + + have h_fderiv_zero : (fderiv ℂ f 0) = 0 := by + simpa using (Filter.EventuallyEq.fderiv_eq hf_eq_zero) + + have h_g_zero_on_U : ∀ z ∈ {z : ℂ | f z = 0}, g z = 0 := by + intro z hzU + by_cases hz0 : z = 0 + · + simp [g, hz0, h_fderiv_zero] + · + have : f z = 0 := by simpa [Set.mem_ofPred_eq] using hzU + simp [g, hz0, this] + + have h_const0_within : AnalyticWithinAt ℂ (fun _ : ℂ => (0 : ℂ)) {z : ℂ | f z = 0} 0 := + analyticAt_const.analyticWithinAt + have h_g_within : AnalyticWithinAt ℂ g {z : ℂ | f z = 0} 0 := by + + apply h_const0_within.congr + intro z hz + by_cases hz0 : z = 0 + · + simp [g, hz0, h_fderiv_zero] + · + have : f z = 0 := by simpa [Set.mem_ofPred_eq] using hz + simp [g, hz0, this] + + simp [g, h_fderiv_zero] + exact analyticWithinAt_to_analyticAt hU h_g_within + + · + have h_notEZ : ¬ (∀ᶠ z in nhds (0 : ℂ), f z = 0) := hEZ + + rcases lem_ordernatcast2_old f hf_at0 hf0 h_notEZ with ⟨h0, h0_at0, hfac_ev⟩ + + have hV : {z : ℂ | f z = z * h0 z} ∈ nhds (0 : ℂ) := by simpa only [Filter.Eventually] using hfac_ev + have h_eq_nhds : f =ᶠ[nhds (0 : ℂ)] (fun z => z * h0 z) := + (Filter.eventuallyEq_iff_exists_mem).2 ⟨{z : ℂ | f z = z * h0 z}, hV, by + intro z hz; simpa [Set.mem_ofPred_eq] using hz⟩ + + have h_fderiv_prod : fderiv ℂ f 0 = fderiv ℂ (fun z => z * h0 z) 0 := + Filter.EventuallyEq.fderiv_eq h_eq_nhds + + have h_diff_id : DifferentiableAt ℂ (fun z : ℂ => z) 0 := differentiableAt_id + have h_diff_h0 : DifferentiableAt ℂ h0 0 := h0_at0.differentiableAt + + have h_val0 : (fderiv ℂ f 0) 1 = h0 0 := by + + rw [h_fderiv_prod] + rw [fderiv_fun_mul' h_diff_id h_diff_h0] + simp only [add_apply, smul_apply] + rw [fderiv_fun_id] + simp only [ContinuousLinearMap.id_apply] + simp only [zero_smul, zero_add] + simp + + have h_geq_h0_on_V : ∀ z ∈ {z : ℂ | f z = z * h0 z}, g z = h0 z := by + intro z hzU + by_cases hz0 : z = 0 + · + simpa [g, hz0] using h_val0 + · + have : f z = z * h0 z := by simpa [Set.mem_ofPred_eq] using hzU + simp only [g, ite_eq_right hz0, this] + exact mul_div_cancel_left₀ (h0 z) hz0 + + have h0_within : AnalyticWithinAt ℂ h0 {z : ℂ | f z = z * h0 z} 0 := h0_at0.analyticWithinAt + have hg_within : AnalyticWithinAt ℂ g {z : ℂ | f z = z * h0 z} 0 := by + + apply AnalyticWithinAt.congr h0_within + + intro z hz + exact h_geq_h0_on_V z hz + + have h_0_in_V : (0 : ℂ) ∈ {z : ℂ | f z = z * h0 z} := by + simp [hf0] + exact h_geq_h0_on_V 0 h_0_in_V + exact analyticWithinAt_to_analyticAt hV hg_within + +theorem ex (x : ℂ) {r : ℝ} (hr : r > 0) : + closure (Metric.ball x r) = Metric.closedBall x r := by + exact closure_ball x (by linarith [hr]) + +lemma lem_ballDR (R : ℝ) (hR : R > 0) : closure (ballDR R) = Metric.closedBall (0 : ℂ) R := by + unfold ballDR + exact closure_ball 0 (ne_of_gt hR) + +lemma lem_inDR (R : ℝ) (hR : R > 0) (w : ℂ) (hw : w ∈ closure (ballDR R)) : norm w ≤ R := by + rw [lem_ballDR R hR] at hw + rw [Metric.mem_closedBall] at hw + rw [Complex.dist_eq] at hw + simp at hw + exact hw + +lemma lem_notinDR (R : ℝ) (_hR : R > 0) (w : ℂ) (hw : w ∉ ballDR R) : norm w ≥ R := by + + unfold ballDR at hw + + rw [Metric.mem_ball] at hw + + push Not at hw + + rw [Complex.dist_eq] at hw + + simp at hw + exact hw + +lemma lem_legeR (R : ℝ) (_hR : R > 0) (w : ℂ) (hw1 : norm w ≤ R) (hw2 : norm w ≥ R) : norm w = R := by + linarith + +lemma lem_circleDR (R : ℝ) (hR : R > 0) (w : ℂ) (hw1 : w ∈ closure (ballDR R)) (hw2 : w ∉ ballDR R) : norm w = R := by + have h1 : norm w ≤ R := lem_inDR R hR w hw1 + have h2 : norm w ≥ R := lem_notinDR R hR w hw2 + exact lem_legeR R hR w h1 h2 + +lemma lem_Rself (R : ℝ) (hR : R > 0) : |R| = R := by + rw [abs_eq_self] + linarith + +lemma lem_Rself2 (R : ℝ) (hR : R > 0) : |R| ≤ R := by + rw [lem_Rself R hR] + +lemma lem_Rself3 (R : ℝ) (hR : R > 0) : (R : ℂ) ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + simp + exact lem_Rself2 R hR + +lemma lem_DRcompact (R : ℝ) (hR : R > 0) : IsCompact (closure (ballDR R)) := by + rw [lem_ballDR R hR] + apply Metric.isCompact_of_isClosed_isBounded + · exact Metric.isClosed_closedBall + · exact Metric.isBounded_closedBall + +lemma lem_ExtrValThm {K : Set ℂ} (hK : IsCompact K) (hK_nonempty : K.Nonempty) (g : K → ℂ) (hg : Continuous g) : +∃ v : K, ∀ z : K, norm (g z) ≤ norm (g v) := by + + have : CompactSpace K := isCompact_iff_compactSpace.mp hK + + have : Nonempty K := hK_nonempty.to_subtype + + let f : K → ℝ := fun z => norm (g z) + + have hf_cont : Continuous f := continuous_norm.comp hg + + obtain ⟨v, hv_mem, hv_max⟩ := IsCompact.exists_isMaxOn isCompact_univ Set.univ_nonempty hf_cont.continuousOn + use v + intro z + exact hv_max (Set.mem_univ z) + +lemma lem_ExtrValThmDR (R : ℝ) (hR : R > 0) (g : closure (ballDR R) → ℂ) (hg : Continuous g) : +∃ v : closure (ballDR R), ∀ z : closure (ballDR R), norm (g z) ≤ norm (g v) := by + + have hK_compact : IsCompact (closure (ballDR R)) := lem_DRcompact R hR + + have hK_nonempty : (closure (ballDR R)).Nonempty := by + rw [lem_ballDR R hR] + rw [Metric.nonempty_closedBall] + linarith + + exact lem_ExtrValThm hK_compact hK_nonempty g hg + +lemma lem_AnalCont {R : ℝ} (_hR : R > 0) (H : ℂ → ℂ) (h_analytic : AnalyticOn ℂ H (closure (ballDR R))) : +Continuous (H ∘ (Subtype.val : closure (ballDR R) → ℂ)) := by + + have h_cont_on : ContinuousOn H (closure (ballDR R)) := AnalyticOn.continuousOn h_analytic + + have h_val_cont : Continuous (Subtype.val : closure (ballDR R) → ℂ) := continuous_subtype_val + + exact ContinuousOn.comp_continuous h_cont_on h_val_cont (fun _ => Subtype.mem _) + +lemma lem_ExtrValThmh {R : ℝ} (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : +∃ u : closure (ballDR R), ∀ z : closure (ballDR R), norm (h u) ≥ norm (h z) := by + + have hg_continuous : Continuous (h ∘ Subtype.val : closure (ballDR R) → ℂ) := + lem_AnalCont hR h h_analytic + + obtain ⟨v, hv⟩ := lem_ExtrValThmDR R hR (h ∘ Subtype.val) hg_continuous + + use v + + intro z + have : norm ((h ∘ Subtype.val) z) ≤ norm ((h ∘ Subtype.val) v) := hv z + + simp [Function.comp] at this + exact this + +lemma lem_MaxModP (R : ℝ) (_hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : ∀ z ∈ closure (ballDR R), norm (h z) = norm (h w) := by + + have h_preconnected : IsPreconnected (ballDR R) := by + unfold ballDR + apply Convex.isPreconnected + exact convex_ball (0 : ℂ) R + + have h_open : IsOpen (ballDR R) := by + unfold ballDR + exact Metric.isOpen_ball + + have h_diff_cont : DiffContOnCl ℂ h (ballDR R) := by + constructor + · + apply AnalyticOn.differentiableOn + exact h_analytic.mono subset_closure + · + exact AnalyticOn.continuousOn h_analytic + + have h_max_on : IsMaxOn (norm ∘ h) (ballDR R) w := by + intro z hz + change ‖h z‖ ≤ ‖h w‖ + exact hw_max z hz + + have h_eq := Complex.norm_eqOn_closure_of_isPreconnected_of_isMaxOn h_preconnected h_open h_diff_cont hw_in_DR h_max_on + + intro z hz + have norm_eq := h_eq hz + simp only [Function.comp_apply, Function.const_apply] at norm_eq + + convert norm_eq + +lemma lem_MaxModR (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : norm (h R) = norm (h w) := by + + have h_const : ∀ z ∈ closure (ballDR R), norm (h z) = norm (h w) := + lem_MaxModP R hR h h_analytic w hw_in_DR hw_max + + have hR_in_closure : (R : ℂ) ∈ closure (ballDR R) := lem_Rself3 R hR + + exact h_const (R : ℂ) hR_in_closure + +lemma lem_MaxModRR (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) + (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : +∀ z ∈ closure (ballDR R), norm (h R) ≥ norm (h z) := by + intro z hz + + have h1 := lem_MaxModP R hR h h_analytic w hw_in_DR hw_max z hz + + have h2 := lem_MaxModR R hR h h_analytic w hw_in_DR hw_max + + rw [h2, h1] + +theorem lem_MaxModv2 (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : +∃ v : closure (ballDR R), norm (v : ℂ) = R ∧ ∀ z : closure (ballDR R), norm (h (v : ℂ)) ≥ norm (h (z : ℂ)) := by + + obtain ⟨u, hu⟩ := lem_ExtrValThmh hR h h_analytic + + if h_case : (u : ℂ) ∈ ballDR R then + + have hR_in_closure : (R : ℂ) ∈ closure (ballDR R) := lem_Rself3 R hR + let v : closure (ballDR R) := ⟨R, hR_in_closure⟩ + use v + constructor + · + + have v_eq : (v : ℂ) = (R : ℂ) := rfl + rw [v_eq] + + have : norm (R : ℂ) = abs R := by + simp [Complex.norm_real] + rw [this, lem_Rself R hR] + · + intro z + + have hw_max : ∀ w ∈ ballDR R, norm (h w) ≤ norm (h (u : ℂ)) := by + intro w hw + + have hw_closure : w ∈ closure (ballDR R) := subset_closure hw + + let w_sub : closure (ballDR R) := ⟨w, hw_closure⟩ + exact hu w_sub + + have h_result := lem_MaxModRR R hR h h_analytic (u : ℂ) h_case hw_max + + have v_eq : (v : ℂ) = (R : ℂ) := rfl + rw [v_eq] + + exact h_result (z : ℂ) (Subtype.mem z) + else + + use u + constructor + · + exact lem_circleDR R hR (u : ℂ) (Subtype.mem u) h_case + · + exact hu + +theorem lem_MaxModv3 (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : +∃ v : ℂ, norm v = R ∧ ∀ z : ℂ, z ∈ closure (ballDR R) → norm (h v) ≥ norm (h z) := by + + obtain ⟨v_sub, hv_abs, hv_max⟩ := lem_MaxModv2 R hR h h_analytic + + let v := (v_sub : ℂ) + use v + constructor + · + exact hv_abs + · + intro z hz + + have hz_sub : z ∈ closure (ballDR R) := hz + let z_sub : closure (ballDR R) := ⟨z, hz_sub⟩ + have := hv_max z_sub + + simp at this + exact this + +lemma lem_MaxModv4 (R B : ℝ) (hR : R > 0) (_hB : B ≥ 0) + (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) + (h_boundary_bound : ∀ z : ℂ, norm z = R → norm (h z) ≤ B) : +∃ v : ℂ, norm v = R ∧ (∀ w : ℂ, w ∈ closure (ballDR R) → norm (h v) ≥ norm (h w)) ∧ norm (h v) ≤ B := by + + obtain ⟨v, hv_abs, hv_max⟩ := lem_MaxModv3 R hR h h_analytic + + use v + constructor + · + exact hv_abs + constructor + · + exact hv_max + · + apply h_boundary_bound + exact hv_abs + +lemma lem_HardMMP (R B : ℝ) (hR : R > 0) (hB : B ≥ 0) + (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) + (h_boundary_bound : ∀ z : ℂ, norm z = R → norm (h z) ≤ B) : +∀ w : ℂ, w ∈ closure (ballDR R) → norm (h w) ≤ B := by + intro w hw + + obtain ⟨v, hv_abs, hv_max, hv_bound⟩ := lem_MaxModv4 R B hR hB h h_analytic h_boundary_bound + + have h1 : norm (h w) ≤ norm (h v) := hv_max w hw + have h2 : norm (h v) ≤ B := hv_bound + + linarith [h1, h2] + +lemma lem_EasyMMP (R B : ℝ) (hR : R > 0) (_hB : B ≥ 0) + (h : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ h (closure (ballDR R))) + (h_closure_bound : ∀ w : ℂ, w ∈ closure (ballDR R) → norm (h w) ≤ B) : +∀ z : ℂ, norm z = R → norm (h z) ≤ B := by + intro z hz + + apply h_closure_bound z + + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + + have : ‖z‖ = R := hz + linarith + +theorem lem_MMP (R B : ℝ) (hR : R > 0) (hB : B ≥ 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : +(∀ z : ℂ, z ∈ closure (ballDR R) → norm (h z) ≤ B) ↔ (∀ z : ℂ, norm z = R → norm (h z) ≤ B) := by + constructor + · + intro h_closure_bound + exact lem_EasyMMP R B hR hB h h_analytic h_closure_bound + · + intro h_boundary_bound + exact lem_HardMMP R B hR hB h h_analytic h_boundary_bound + +lemma lem_denominator_nonzero (R M : ℝ) (_hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : +∀ z : ℂ, z ∈ closure (ballDR R) → (2 * M - f z) ≠ 0 := by + intro z hz + + apply lem_real_part_lower_bound4 (f z) M hM + + exact h_re_bound z hz + +lemma lem_f_vs_2M_minus_f (R M : ℝ) (_hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : +∀ z : ℂ, z ∈ closure (ballDR R) → norm (f z) / norm (2 * M - f z) ≤ 1 := by + intro z hz + + apply lem_nonnegative_product9 M (f z) hM + + exact h_re_bound z hz + +lemma fderiv_factorization_at_zero (R : ℝ) (hR : R > 0) (f h : ℂ → ℂ) + (h_analytic_f : AnalyticOn ℂ f (closure (ballDR R))) + (h_analytic_h : AnalyticOn ℂ h (closure (ballDR R))) + (_h_zero : f 0 = 0) + (h_factor : ∀ z ∈ closure (ballDR R), f z = z * h z) : + (fderiv ℂ f 0) 1 = h 0 := by + + have h_zero_in : (0 : ℂ) ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + simp + linarith [hR] + + have h_diff_on_f : DifferentiableOn ℂ f (closure (ballDR R)) := h_analytic_f.differentiableOn + have h_diff_on_h : DifferentiableOn ℂ h (closure (ballDR R)) := h_analytic_h.differentiableOn + + have h_nhds_mem : closure (ballDR R) ∈ nhds (0 : ℂ) := by + rw [lem_ballDR R hR] + rw [mem_nhds_iff] + use Metric.ball 0 R + constructor + · exact Metric.ball_subset_closedBall + constructor + · exact Metric.isOpen_ball + · rw [Metric.mem_ball] + simp + exact hR + + have h_diff_f : DifferentiableAt ℂ f 0 := h_diff_on_f.differentiableAt h_nhds_mem + have h_diff_h : DifferentiableAt ℂ h 0 := h_diff_on_h.differentiableAt h_nhds_mem + + have h_diff_id : DifferentiableAt ℂ (fun z : ℂ => z) 0 := differentiableAt_id + + have h_eq_nhds : f =ᶠ[nhds 0] (fun z => z * h z) := by + rw [Filter.eventuallyEq_iff_exists_mem] + exact ⟨closure (ballDR R), h_nhds_mem, h_factor⟩ + + have h_fderiv_eq : fderiv ℂ f 0 = fderiv ℂ (fun z => z * h z) 0 := + Filter.EventuallyEq.fderiv_eq h_eq_nhds + + rw [h_fderiv_eq] + rw [fderiv_fun_mul' h_diff_id h_diff_h] + + simp only [add_apply, smul_apply] + rw [fderiv_fun_id] + simp only [ContinuousLinearMap.id_apply] + + simp only [zero_smul, zero_add] + + simp + +lemma lem_removable_singularity (R : ℝ) (hR : R > 0) (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) (h_zero : f 0 = 0) : +AnalyticOn ℂ (fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z) (closure (ballDR R)) := by + + rw [lem_ballDR R hR] at h_analytic ⊢ + + let g : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z + + apply lem_analAtOnOn hR g + + · + + exact lem_ordernatcast2 hR f h_zero h_analytic + + · + + have f_on_closedball : AnalyticOn ℂ f (Metric.closedBall 0 R) := h_analytic + have quotient_analytic : AnalyticOn ℂ (fun z ↦ f z / z) {z : ℂ | ‖z‖ ≤ R ∧ z ≠ 0} := + lem_fzzTanal hR f f_on_closedball + + apply AnalyticOn.congr quotient_analytic + intro z hz + + simp [g, ite_eq_right hz.2] + +lemma lem_quotient_analytic {R : ℝ} (_hR : R > 0) (h1 h2 : ℂ → ℂ) + (h_analytic1 : AnalyticOn ℂ h1 (closure (ballDR R))) + (h_analytic2 : AnalyticOn ℂ h2 (closure (ballDR R))) + (h_nonzero : ∀ z ∈ closure (ballDR R), h2 z ≠ 0) : +AnalyticOn ℂ (fun z ↦ h1 z / h2 z) (closure (ballDR R)) := by + exact AnalyticOn.div h_analytic1 h_analytic2 h_nonzero + +noncomputable def f_M (R M : ℝ) (_hR : R > 0) (_hM : M > 0) + (f : ℂ → ℂ) + (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (_h_zero : f 0 = 0) + (_h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : +ℂ → ℂ := fun z ↦ (if z = 0 then (fderiv ℂ f 0) 1 else f z / z) / (2 * M - f z) + +lemma lem_g_analytic (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : +AnalyticOn ℂ (f_M R M hR hM f h_analytic h_zero h_re_bound) (closure (ballDR R)) := by + + let h₁ : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z + + let h₂ : ℂ → ℂ := fun z ↦ 2 * M - f z + + have h_eq : f_M R M hR hM f h_analytic h_zero h_re_bound = fun z ↦ h₁ z / h₂ z := by + ext z + unfold f_M h₁ h₂ + simp + + rw [h_eq] + + apply lem_quotient_analytic hR + + · exact lem_removable_singularity R hR f h_analytic h_zero + + · have h₂_analytic : AnalyticOn ℂ h₂ (closure (ballDR R)) := by + unfold h₂ + apply AnalyticOn.sub + · exact analyticOn_const + · exact h_analytic + exact h₂_analytic + + · intro z hz + unfold h₂ + exact lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz + +lemma lem_absab (a b : ℂ) (_hb : b ≠ 0) : norm (a / b) = norm a / norm b := by + exact IsAbsoluteValue.abv_div norm a b + +lemma lem_g_on_boundaryz (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (z : ℂ) (hz_in_closure : z ∈ closure (ballDR R)) (hz_nonzero : z ≠ 0) : + norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = +norm (f z / z) / norm (2 * M - f z) := by + + unfold f_M + + simp only [ite_eq_right hz_nonzero] + + have h_nonzero : (2 * M - f z) ≠ 0 := lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz_in_closure + + exact lem_absab (f z / z) (2 * M - f z) h_nonzero + +lemma lem_fzzR (R : ℝ) (hR : R > 0) (z w : ℂ) (hz : norm z = R) : norm (w / z) = norm w / R := by + + have hz_nonzero : z ≠ 0 := by + intro h_eq + rw [h_eq] at hz + simp at hz + linarith [hz, hR] + + rw [lem_absab w z hz_nonzero] + + rw [hz] + +lemma lem_g_on_boundary (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (z : ℂ) (hz_on_boundary : norm z = R) : + norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = +(norm (f z) / R) / norm (2 * M - f z) := by + + have hz_nonzero : z ≠ 0 := by + intro h_eq + rw [h_eq] at hz_on_boundary + simp at hz_on_boundary + linarith [hz_on_boundary, hR] + + have hz_in_closure : z ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + convert le_of_eq hz_on_boundary + + have h1 : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = + norm (f z / z) / norm (2 * M - f z) := + lem_g_on_boundaryz R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure hz_nonzero + + have h2 : norm (f z / z) = norm (f z) / R := + lem_fzzR R hR z (f z) hz_on_boundary + + rw [h1, h2] + +lemma lem_f_vs_2M_minus_fR (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (_h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (z : ℂ) (hz_in_closure : z ∈ closure (ballDR R)) : +(norm (f z) / R) / norm (2 * M - f z) ≤ 1 / R := by + + have h1 : norm (f z) / norm (2 * M - f z) ≤ 1 := + lem_f_vs_2M_minus_f R M hR hM f h_analytic h_re_bound z hz_in_closure + + rw [div_div] + + rw [mul_comm R] + + rw [← div_div] + + exact div_le_div_of_nonneg_right h1 (le_of_lt hR) + +lemma lem_g_boundary_bound0 (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (z : ℂ) (hz_on_boundary : norm z = R) : +norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := by + + have hz_in_closure : z ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + convert le_of_eq hz_on_boundary + + rw [lem_g_on_boundary R M hR hM f h_analytic h_zero h_re_bound z hz_on_boundary] + + exact lem_f_vs_2M_minus_fR R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure + +lemma lem_g_interior_bound (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : +∀ z : ℂ, z ∈ closure (ballDR R) → norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := by + + have hB : (1 / R : ℝ) ≥ 0 := div_nonneg zero_le_one (le_of_lt hR) + + have h_g_analytic : AnalyticOn ℂ (f_M R M hR hM f h_analytic h_zero h_re_bound) (closure (ballDR R)) := + lem_g_analytic R M hR hM f h_analytic h_zero h_re_bound + + apply (lem_MMP R (1 / R) hR hB (f_M R M hR hM f h_analytic h_zero h_re_bound) h_g_analytic).mpr + + intro z hz_boundary + exact lem_g_boundary_bound0 R M hR hM f h_analytic h_zero h_re_bound z hz_boundary + +lemma lem_g_at_r (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) + (z : ℂ) (hz_on_boundary : norm z = r) : + norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = +(norm (f z) / r) / norm (2 * M - f z) := by + + have hz_nonzero : z ≠ 0 := by + intro h_eq + rw [h_eq] at hz_on_boundary + simp at hz_on_boundary + linarith [hz_on_boundary, hr_pos] + + have hz_in_closure : z ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + linarith [hz_on_boundary, hr_lt_R] + + have h1 : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = + norm (f z / z) / norm (2 * M - f z) := + lem_g_on_boundaryz R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure hz_nonzero + + have h2 : norm (f z / z) = norm (f z) / r := + lem_fzzR r hr_pos z (f z) hz_on_boundary + + rw [h1, h2] + +lemma lem_g_at_rR (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) + (z : ℂ) (hz_on_boundary : norm z = r) : +(norm (f z) / r) / norm (2 * M - f z) ≤ 1 / R := by + + have hz_in_closure : z ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + linarith [hz_on_boundary, hr_lt_R] + + have h_bound : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := + lem_g_interior_bound R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure + + have h_eq : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = + (norm (f z) / r) / norm (2 * M - f z) := + lem_g_at_r R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary + + rw [← h_eq] + exact h_bound + +lemma lem_fracs (a b r R : ℝ) (ha : a > 0) (hb : b > 0) (hr : r > 0) (hR : R > 0) +(h_le : (a / r) / b ≤ 1 / R) : R * a ≤ r * b := by + + have h1 : (a / r) / b = a / (r * b) := by + field_simp + rw [h1] at h_le + + have h_pos_rb : 0 < r * b := mul_pos hr hb + rw [div_le_div_iff₀ h_pos_rb hR] at h_le + + simp only [one_mul] at h_le + + linarith + +lemma lem_nonneg_product_with_real_abs (r M : ℝ) (hr : r > 0) (hM : M > 0) : 0 ≤ r * (2 * |M|) := by + + have h_abs_eq : |M| = M := abs_of_pos hM + + rw [h_abs_eq] + + have h_two_M_pos : (2 : ℝ) * M > 0 := by + apply mul_pos + norm_num + exact hM + + apply mul_nonneg + linarith [hr] + linarith [h_two_M_pos] + +lemma lem_f_bound_rearranged (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) + (z : ℂ) (hz_on_boundary : norm z = r) : +R * norm (f z) ≤ r * norm (2 * M - f z) := by + + have hz_in_closure : z ∈ closure (ballDR R) := by + rw [lem_ballDR R hR] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + linarith [hz_on_boundary, hr_lt_R] + + have h_ineq : (norm (f z) / r) / norm (2 * M - f z) ≤ 1 / R := + lem_g_at_rR R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary + + have h_denom_nonzero : (2 * M - f z) ≠ 0 := + lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz_in_closure + + have h_denom_pos : norm (2 * M - f z) > 0 := + lem_abspos (2 * M - f z) h_denom_nonzero + + by_cases h_case : f z = 0 + · + rw [h_case] + simp [mul_zero] + exact lem_nonneg_product_with_real_abs r M hr_pos hM + · + have h_num_pos : norm (f z) > 0 := + lem_abspos (f z) h_case + + exact lem_fracs (norm (f z)) (norm (2 * M - f z)) r R + h_num_pos h_denom_pos hr_pos hR h_ineq + +lemma lem_final_bound_on_circle0 (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) + (z : ℂ) (hz_on_boundary : norm z = r) : +norm (f z) ≤ (2 * r / (R - r)) * M := by + + have h_ineq : R * norm (f z) ≤ r * norm (2 * M - f z) := + lem_f_bound_rearranged R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary + + have h_bound : norm (f z) ≤ (2 * M * r) / (R - r) := + lem_rtriangle7 r R M (f z) hr_pos hr_lt_R hM h_ineq + + have h_rearrange : (2 * M * r) / (R - r) = (2 * r / (R - r)) * M := by + field_simp + + rw [← h_rearrange] + exact h_bound + +lemma lem_final_bound_on_circle (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) + (z : ℂ) (hz_on_boundary : norm z = r) : +norm (f z) ≤ (2 * r / (R - r)) * M := by + exact lem_final_bound_on_circle0 R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary + +lemma lem_BCI (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) + (z : ℂ) (hz_in_ball : norm z ≤ r) : +norm (f z) ≤ (2 * r / (R - r)) * M := by + + let B := (2 * r / (R - r)) * M + + have hB : B ≥ 0 := by + unfold B + apply mul_nonneg + · apply div_nonneg + · apply mul_nonneg + · norm_num + · linarith [hr_pos] + · linarith [hr_lt_R] + · linarith [hM] + + have h_analytic_r : AnalyticOn ℂ f (closure (ballDR r)) := by + apply AnalyticOn.mono h_analytic + + apply closure_mono + unfold ballDR + exact Metric.ball_subset_ball (le_of_lt hr_lt_R) + + have hz_in_closure_r : z ∈ closure (ballDR r) := by + rw [lem_ballDR r hr_pos] + rw [Metric.mem_closedBall] + rw [Complex.dist_eq] + simp + exact hz_in_ball + + have h_boundary : ∀ w : ℂ, norm w = r → norm (f w) ≤ B := by + intro w hw_boundary + exact lem_final_bound_on_circle R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R w hw_boundary + + have h_closure := (lem_MMP r B hr_pos hB f h_analytic_r).mpr h_boundary + + exact h_closure z hz_in_closure_r + +theorem thm_BorelCaratheodoryI (R M : ℝ) (hR : R > 0) (hM : M > 0) + (f : ℂ → ℂ) + (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) + (h_zero : f 0 = 0) + (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) + (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) : +sSup ((norm ∘ f) '' (closure (ballDR r))) ≤ (2 * r / (R - r)) * M := by + + apply Real.sSup_le + · + intro x hx + + obtain ⟨z, hz_in_closure, hx_eq⟩ := hx + rw [← hx_eq] + + have hz_bound : norm z ≤ r := by + rw [lem_ballDR r hr_pos] at hz_in_closure + rw [Metric.mem_closedBall] at hz_in_closure + rw [Complex.dist_eq] at hz_in_closure + simp at hz_in_closure + exact hz_in_closure + + exact lem_BCI R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_bound + · + apply mul_nonneg + · apply div_nonneg + · apply mul_nonneg + · norm_num + · linarith [hr_pos] + · linarith [hr_lt_R] + · linarith [hM] + +def I := Complex.I + +lemma cauchy_formula_deriv {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (_h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : +deriv f z = (1 / (2 * Real.pi * I)) • ∮ w in C(0, r_int), (w - z)⁻¹ ^ 2 • f w := by + + obtain ⟨U', hU'_open, h_subset, hf_diff_U'⟩ := hf_domain + + have hz_in_ball : z ∈ Metric.ball (0 : ℂ) r_int := by + apply Metric.mem_ball.mpr + have h1 : ‖z - 0‖ ≤ r_z := by simpa only [dist_eq_norm] using Metric.mem_closedBall.mp hz + simp only [sub_zero] at h1 + have h2 : ‖z‖ < r_int := lt_of_le_of_lt h1 h_r_z_lt_r_int + rwa [dist_eq_norm, sub_zero] + + set U := Metric.ball (0 : ℂ) R_analytic + + have hc_subset : Metric.closedBall (0 : ℂ) r_int ⊆ U := by + apply Metric.closedBall_subset_ball + exact h_r_int_lt_R_analytic + + have hf_on_U : DifferentiableOn ℂ f U := by + + apply DifferentiableOn.mono hf_diff_U' + calc U = Metric.ball 0 R_analytic := rfl + _ ⊆ Metric.closedBall 0 R_analytic := Metric.ball_subset_closedBall + _ ⊆ U' := h_subset + + have cauchy_eq := Complex.two_pi_I_inv_smul_circleIntegral_sub_sq_inv_smul_of_differentiable + Metric.isOpen_ball hc_subset hf_on_U hz_in_ball + + rw [← cauchy_eq] + + congr 2 + · + simp only [one_div] + + rfl + · + ext w + rw [← inv_pow] + +lemma lem_dw_dt {r_int : ℝ} (t : ℝ) : +deriv (fun t' => r_int * Complex.exp (I * t')) t = I * r_int * Complex.exp (I * t) := by + + rw [deriv_const_mul] + + rw [deriv_cexp] + + rw [deriv_const_mul] + + convert_to r_int * (Complex.exp (I * t) * (I * 1)) = I * r_int * Complex.exp (I * t) + · + rw [← deriv_id] + congr + + ring + + · exact differentiableAt_id + · exact (differentiableAt_const I).mul differentiableAt_id + · exact DifferentiableAt.cexp ((differentiableAt_const I).mul differentiableAt_id) + +lemma circleMap_zero_eq_exp (r : ℝ) (t : ℝ) : circleMap 0 r t = r * Complex.exp (I * t) := by + + rw [circleMap] + + simp only [zero_add] + + congr 2 + rw [mul_comm (t : ℂ) Complex.I] + + rfl + +lemma deriv_ofReal_eq_one (t : ℝ) : deriv Complex.ofReal t = 1 := by + + have h : deriv Complex.ofReal t = Complex.ofReal 1 := by + + rw [show Complex.ofReal = ⇑Complex.ofRealCLM from rfl] + exact ContinuousLinearMap.deriv Complex.ofRealCLM + + rw [h] + simp only [Complex.ofReal_one] + +lemma differentiableAt_ofReal (t : ℝ) : DifferentiableAt ℝ Complex.ofReal t := by + + rw [show Complex.ofReal = ⇑Complex.ofRealCLM from rfl] + + apply ContinuousLinearMap.differentiableAt + +lemma lem_dw_dt_real {r_int : ℝ} (t : ℝ) : +deriv (fun (t' : ℝ) => r_int * Complex.exp (I * t')) t = I * r_int * Complex.exp (I * t) := by + + rw [deriv_const_mul] + + rw [deriv_cexp] + + rw [deriv_const_mul] + + rw [deriv_ofReal_eq_one] + + ring + + · exact differentiableAt_ofReal t + · exact (differentiableAt_const I).mul (differentiableAt_ofReal t) + · exact DifferentiableAt.cexp ((differentiableAt_const I).mul (differentiableAt_ofReal t)) + +lemma deriv_circleMap_zero (r : ℝ) (t : ℝ) : deriv (circleMap 0 r) t = I * r * Complex.exp (I * t) := by + + have h : circleMap 0 r = fun (t' : ℝ) => r * Complex.exp (I * t') := by + ext t' + exact circleMap_zero_eq_exp r t' + + rw [h] + + exact lem_dw_dt_real t + +lemma lem_CIF_deriv_param {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + deriv f z = (1 / (2 * Real.pi * I)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), +(I * r_int * Complex.exp (I * t) * ((r_int * Complex.exp (I * t)) - z)⁻¹ ^ 2) * f (r_int * Complex.exp (I * t))) := by + + rw [cauchy_formula_deriv hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + + rw [circleIntegral_def_Icc] + + rw [smul_eq_mul] + + simp only [circleMap_zero_eq_exp, deriv_circleMap_zero] + + congr 2 + ext t + simp only [smul_eq_mul] + ring + +lemma mul_comm_div_cancel (a b : ℂ) (ha : a ≠ 0) (hb : b ≠ 0) : a * b / (b * a) = 1 := by + + rw [mul_comm b a] + + apply div_self + + exact mul_ne_zero ha hb + +lemma complex_coeff_I_cancel : (1 : ℂ) / (2 * Real.pi * I) * I = 1 / (2 * Real.pi) := by + field_simp [I, Complex.I_ne_zero, Real.pi_pos.ne'] + +lemma factor_I_from_integrand (f : ℂ → ℂ) (r_int : ℝ) (z : ℂ) : + ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I * ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = + I * ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) := by + + have h : ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I * ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = + ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I • (↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t))) := by + congr 1 + ext t + rw [smul_eq_mul] + ring + rw [h] + + rw [MeasureTheory.integral_smul] + + rw [smul_eq_mul] + +lemma integrand_transform_div (f : ℂ → ℂ) (r_int : ℝ) (z : ℂ) (t : ℝ) : + ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = + ↑r_int * Complex.exp (I * ↑t) * f (↑r_int * Complex.exp (I * ↑t)) / (↑r_int * Complex.exp (I * ↑t) - z) ^ 2 := by + + rw [inv_pow] + + rw [← div_eq_mul_inv] + + ring + +lemma lem_CIF_deriv_simplified {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + deriv f z = (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), +(r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) := by + + rw [lem_CIF_deriv_param hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + + rw [factor_I_from_integrand f r_int z] + + rw [← mul_assoc, complex_coeff_I_cancel] + + congr 2 + funext t + rw [integrand_transform_div f r_int z t] + +lemma lem_modulus_of_f_prime0 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + norm (deriv f z) = norm ((1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), +(r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by + + rw [lem_CIF_deriv_simplified hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + +lemma one_div_two_pi_pos : (1 : ℝ) / (2 * Real.pi) > 0 := by + + have h_pi_pos : Real.pi > 0 := Real.pi_pos + + have h_2pi_pos : 2 * Real.pi > 0 := by + apply mul_pos + · norm_num + · exact h_pi_pos + + apply div_pos + · norm_num + · exact h_2pi_pos + +lemma abs_integral_le_integral_abs {a b : ℝ} {g : ℝ → ℂ} (_hab : a ≤ b) : norm (∫ (t : ℝ) in Set.Icc a b, g t) ≤ ∫ (t : ℝ) in Set.Icc a b, norm (g t) := by + + exact MeasureTheory.norm_integral_le_integral_norm g + +lemma abs_ofReal_mul_complex (c : ℝ) (z : ℂ) (hc : c ≥ 0) : norm (↑c * z) = c * norm z := by + + have h1 : norm (↑c * z) = norm (↑c) * norm z := by simp + rw [h1] + + congr 1 + + simp + assumption + +lemma complex_abs_mul (a b : ℂ) : norm (a * b) = norm a * norm b := + Complex.norm_mul a b + +lemma complex_abs_ofReal_nonneg (r : ℝ) (hr : r ≥ 0) : norm (↑r : ℂ) = r := by + + have h1 : norm (↑r * 1) = r * norm (1 : ℂ) := by simp; assumption + + simp only [mul_one] at h1 + have h2 : norm (1 : ℂ) = 1 := by simp + rw [h2] at h1 + simp only [mul_one] at h1 + simp + assumption + +lemma abs_one_div_two_pi_complex : norm (1 / (2 * ↑Real.pi : ℂ)) = 1 / (2 * Real.pi) := by + + have h_eq : (1 / (2 * ↑Real.pi) : ℂ) = ↑(1 / (2 * Real.pi) : ℝ) := by + simp only [Complex.ofReal_div, Complex.ofReal_one, Complex.ofReal_mul, Complex.ofReal_ofNat] + + rw [h_eq] + + have h_nonneg : (1 / (2 * Real.pi) : ℝ) ≥ 0 := by + apply div_nonneg + · norm_num + · apply mul_nonneg + · norm_num + · exact le_of_lt Real.pi_pos + + exact complex_abs_ofReal_nonneg (1 / (2 * Real.pi)) h_nonneg + +lemma lem_integral_modulus_inequality {r_int : ℝ} {z : ℂ} {f : ℂ → ℂ} : +norm ((1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), (r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) ≤ (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by + + rw [complex_abs_mul] + + rw [abs_one_div_two_pi_complex] + + apply mul_le_mul_of_nonneg_left + · + have h_2pi_nonneg : (0 : ℝ) ≤ 2 * Real.pi := by + apply mul_nonneg + · norm_num + · exact le_of_lt Real.pi_pos + exact abs_integral_le_integral_abs h_2pi_nonneg + · exact le_of_lt one_div_two_pi_pos + +lemma lem_modulus_of_f_prime {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + norm (deriv f z) ≤ (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), +norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by + + rw [lem_modulus_of_f_prime0 hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + + exact lem_integral_modulus_inequality + +lemma lem_modulus_of_integrand_product2 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (_hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (_h_r_z_pos : 0 < r_z) + (_h_r_z_lt_r_int : r_z < r_int) + (_h_r_int_lt_R_analytic : r_int < R_analytic) : + norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) = +norm (f (r_int * Complex.exp (I * t))) * norm (r_int * Complex.exp (I * t)) := by + + rw [norm_mul] + +lemma lem_modeit (t : ℝ) : norm (Complex.exp (I * t)) = Real.exp (Complex.re (I * t)) := by + + exact Complex.norm_exp (I * t) + +lemma lem_Reit0 (t : ℝ) : Complex.re (I * t) = 0 := by + + unfold I + + rw [Complex.mul_re] + + rw [Complex.I_re, Complex.I_im, Complex.ofReal_re, Complex.ofReal_im] + + ring + +lemma lem_eReite0 (t : ℝ) : Real.exp (Complex.re (I * t)) = Real.exp 0 := by + + rw [lem_Reit0] + +lemma lem_e01 : Real.exp 0 = 1 := by + exact Real.exp_zero + +lemma lem_eReit1 (t : ℝ) : Real.exp (Complex.re (I * t)) = 1 := by + + rw [lem_eReite0] + + rw [Real.exp_zero] + +lemma lem_modulus_of_e_it_is_one (t : ℝ) : norm (Complex.exp (I * t)) = 1 := by + + rw [lem_modeit] + + rw [lem_Reit0] + + rw [lem_e01] + +lemma lem_modulus_of_ae_it {a t : ℝ} (ha : 0 < a) : norm (a * Complex.exp (I * t)) = a := by + + rw [norm_mul, lem_modulus_of_e_it_is_one, mul_one, Complex.norm_real] + exact abs_of_pos ha + +lemma lem_modulus_of_integrand_product3 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) : +norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) = r_int * norm (f (r_int * Complex.exp (I * t))) := by + + rw [lem_modulus_of_integrand_product2 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] + + have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int + rw [lem_modulus_of_ae_it h_r_int_pos] + + ring + +lemma lem_modulus_of_square (c : ℂ) : norm (c ^ 2) = (norm c) ^ 2 := by + exact Complex.norm_pow c 2 + +lemma lem_modulus_wz (w z : ℂ) : norm ((w - z) ^ 2) = (norm (w - z)) ^ 2 := by + + exact Complex.norm_pow (w - z) 2 + +lemma lem_reverse_triangle (w z : ℂ) : norm w - norm z ≤ norm (w - z) := by + + exact norm_sub_norm_le w z + +lemma lem_reverse_triangle2 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} + (_h_r_z_pos : 0 < r_z) + (_h_r_z_lt_r_int : r_z < r_int) + (_h_r_int_lt_R_analytic : r_int < R_analytic) : +norm (r_int * Complex.exp (I * t)) - norm z ≤ norm (r_int * Complex.exp (I * t) - z) := by + + exact lem_reverse_triangle (r_int * Complex.exp (I * t)) z + +lemma lem_reverse_triangle3 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (_h_r_int_lt_R_analytic : r_int < R_analytic) : +r_int - norm z ≤ norm (r_int * Complex.exp (I * t) - z) := by + + have h_mod : norm (r_int * Complex.exp (I * t)) = r_int := by + have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int + exact lem_modulus_of_ae_it h_r_int_pos + + have h_triangle := lem_reverse_triangle (r_int * Complex.exp (I * t)) z + + rw [h_mod] at h_triangle + exact h_triangle + +lemma lem_zrr1 {R_analytic r_z r_int : ℝ} + (_h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (_h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : +0 < r_int - norm z := by + + have h1 : dist z 0 ≤ r_z := Metric.mem_closedBall.mp hz + + have h2 : dist z 0 = ‖z‖ := by + rw [dist_eq_norm, sub_zero] + + have h3 : ‖z‖ ≤ r_z := by rwa [← h2] + + have h4 : norm z = ‖z‖ := rfl + + have h5 : norm z ≤ r_z := by rwa [h4] + + have h6 : norm z < r_int := lt_of_le_of_lt h5 h_r_z_lt_r_int + + linarith + +lemma lem_zrr2 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hz : z ∈ Metric.closedBall 0 r_z) : +r_int - r_z ≤ norm (r_int * Complex.exp (I * t) - z) := by + + have h1 : norm z ≤ r_z := by + have h_dist : dist z 0 ≤ r_z := Metric.mem_closedBall.mp hz + rw [dist_eq_norm, sub_zero] at h_dist + exact h_dist + + have h2 : r_int - r_z ≤ r_int - norm z := by linarith [h1] + + have h3 := @lem_reverse_triangle3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic + + exact le_trans h2 h3 + +lemma lem_rr11 {r r' : ℝ} (_h_r_pos : 0 < r) (h_r_lt_r_prime : r < r') : r' - r > 0 := by + linarith + +lemma lem_rr12 {r r' : ℝ} (h_r_pos : 0 < r) (h_r_lt_r_prime : r < r') : +(r' - r) ^ 2 > 0 := by + + have h_diff_pos : r' - r > 0 := lem_rr11 h_r_pos h_r_lt_r_prime + + exact sq_pos_of_pos h_diff_pos + +lemma lem_zrr3 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hz : z ∈ Metric.closedBall 0 r_z) : +(r_int - r_z) ^ 2 ≤ norm (r_int * Complex.exp (I * t) - z) ^ 2 := by + + have h_ineq := @lem_zrr2 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h_nonneg_left : 0 ≤ r_int - r_z := by linarith [h_r_z_lt_r_int] + have h_nonneg_right : 0 ≤ norm (r_int * Complex.exp (I * t) - z) := norm_nonneg _ + + have h_sq := mul_self_le_mul_self h_nonneg_left h_ineq + + rw [pow_two, pow_two] + exact h_sq + +lemma lem_zrr4 {R_analytic r_z r_int : ℝ} (t : ℝ) + (_h_r_z_pos : 0 < r_z) + (_h_r_z_lt_r_int : r_z < r_int) + (_h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (_hz : z ∈ Metric.closedBall 0 r_z) : +norm ((r_int * Complex.exp (I * t) - z) ^ 2) = (norm (r_int * Complex.exp (I * t) - z)) ^ 2 := by + + exact lem_modulus_of_square (r_int * Complex.exp (I * t) - z) + +lemma lem_reverse_triangle4 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hz : z ∈ Metric.closedBall 0 r_z) : +0 < norm (r_int * Complex.exp (I * t) - z) := by + + have h1 := lem_zrr1 h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h2 := @lem_reverse_triangle3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic + + exact lt_of_lt_of_le h1 h2 + +lemma lem_wposneq0 (w : ℂ) : norm w > 0 → w ≠ 0 := by + intro h + + by_contra h_eq_zero + + have h_abs_zero : norm w = 0 := by + rw [h_eq_zero] + simp + + rw [h_abs_zero] at h + exact lt_irrefl 0 h + +lemma lem_reverse_triangle5 {R_analytic r_z r_int : ℝ} (t : ℝ) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : +r_int * Complex.exp (I * t) - z ≠ 0 := by + + have h_pos := @lem_reverse_triangle4 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + exact lem_wposneq0 (r_int * Complex.exp (I * t) - z) h_pos + +lemma lem_reverse_triangle6 {R_analytic r_z r_int : ℝ} (t : ℝ) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : +(r_int * Complex.exp (I * t) - z) ^ 2 ≠ 0 := by + + have h_ne_zero := lem_reverse_triangle5 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + exact pow_ne_zero 2 h_ne_zero + +lemma lem_absdiv {a b : ℂ} (_hb : b ≠ 0) : norm (a / b) = norm a / norm b := by + + exact norm_div a b + +lemma lem_modulus_of_integrand_product {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (_hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = +norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / norm ((r_int * Complex.exp (I * t)) - z) ^ 2 := by + + have h_neq_zero : r_int * Complex.exp (I * t) - z ≠ 0 := + lem_reverse_triangle5 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h_sq_neq_zero : (r_int * Complex.exp (I * t) - z) ^ 2 ≠ 0 := by + rw [pow_two] + exact mul_self_ne_zero.mpr h_neq_zero + + rw [lem_absdiv h_sq_neq_zero] + + rw [lem_modulus_wz] + +lemma lem_modulus_of_product {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = +(r_int * norm (f (r_int * Complex.exp (I * t)))) / norm ((r_int * Complex.exp (I * t)) - z) ^ 2 := by + + rw [lem_modulus_of_integrand_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + + rw [lem_modulus_of_integrand_product3 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] + +lemma lem_modulus_of_product2 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = +(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((norm (r_int * Complex.exp (I * t) - z)) ^ 2) := by + + rw [lem_modulus_of_integrand_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + + rw [lem_modulus_of_integrand_product3 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] + +lemma lem_modulus_of_product3 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (_hf : DifferentiableOn ℂ f (Metric.closedBall 0 R_analytic)) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + (r_int * norm (f (r_int * Complex.exp (I * t)))) / ((norm (r_int * Complex.exp (I * t) - z)) ^ 2) ≤ +(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((r_int - r_z) ^ 2) := by + + have h_ineq := @lem_zrr3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h_numer_nonneg : 0 ≤ r_int * norm (f (r_int * Complex.exp (I * t))) := by + apply mul_nonneg + · linarith [h_r_z_pos, h_r_z_lt_r_int] + · exact norm_nonneg _ + + have h_denom1_pos : 0 < (norm (r_int * Complex.exp (I * t) - z)) ^ 2 := by + apply pow_pos + exact lem_reverse_triangle4 h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h_denom2_pos : 0 < (r_int - r_z) ^ 2 := by + exact lem_rr12 h_r_z_pos h_r_z_lt_r_int + + exact div_le_div_of_nonneg_left h_numer_nonneg h_denom2_pos h_ineq + +lemma lem_modulus_of_product4 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : + norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ +(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((r_int - r_z) ^ 2) := by + + rw [lem_modulus_of_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] + + have h_ineq := @lem_zrr3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + apply div_le_div_of_nonneg_left + · + apply mul_nonneg + · linarith [h_r_z_pos, h_r_z_lt_r_int] + · exact norm_nonneg _ + · + apply pow_pos + linarith [h_r_z_lt_r_int] + · + exact h_ineq + +lemma lem_bound_on_f_at_r_prime {M R_analytic r_int : ℝ} + (hM_pos : 0 < M) + (hR_analytic_pos : 0 < R_analytic) + (hr_int_pos : 0 < r_int) + (hr_int_lt_R_analytic : r_int < R_analytic) + (f : ℂ → ℂ) + + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (hf0 : f 0 = 0) + (hRe_f_le_M : ∀ z ∈ Metric.closedBall 0 R_analytic, (f z).re ≤ M) + (t : ℝ) : +norm (f (r_int * Complex.exp (I * t))) ≤ (2 * r_int * M) / (R_analytic - r_int) := by + + obtain ⟨U, hU_open, h_subset, hf_diff_U⟩ := hf_domain + + let z₀ := r_int * Complex.exp (I * t) + + have h_sSup_bound := thm_BorelCaratheodoryI R_analytic M hR_analytic_pos hM_pos f + + (by + + have h_analytic_U : AnalyticOn ℂ f U := hf_diff_U.analyticOn hU_open + + rw [ballDR] + convert h_analytic_U.mono h_subset + + apply closure_ball + linarith + ) + hf0 + (by rwa [lem_ballDR R_analytic hR_analytic_pos]) + r_int hr_int_pos hr_int_lt_R_analytic + + have hz₀_in_ball : z₀ ∈ Metric.closedBall 0 r_int := by + rw [Metric.mem_closedBall] + simp only [dist_eq_norm, sub_zero] + + have h_norm : ‖r_int * Complex.exp (I * t)‖ = r_int := by + rw [norm_mul] + + have h1 : ‖(r_int : ℂ)‖ = r_int := by + rw [Complex.norm_real] + exact abs_of_pos hr_int_pos + + have h2 : ‖Complex.exp (I * ↑t)‖ = 1 := by + + exact lem_modulus_of_e_it_is_one t + rw [h1, h2] + ring + rw [h_norm] + + have hz₀_in_closure : z₀ ∈ closure (ballDR r_int) := by + rw [lem_ballDR r_int hr_int_pos] + exact hz₀_in_ball + + have h_in_image : norm (f z₀) ∈ (norm ∘ f) '' (closure (ballDR r_int)) := by + use z₀, hz₀_in_closure + rfl + + have h_le_sSup : norm (f z₀) ≤ sSup ((norm ∘ f) '' (closure (ballDR r_int))) := by + apply le_csSup + + · use (2 * r_int / (R_analytic - r_int)) * M + intros x hx + obtain ⟨w, hw_in, hx_eq⟩ := hx + rw [← hx_eq] + + have hw_in_closed : w ∈ Metric.closedBall 0 r_int := by + rwa [← lem_ballDR r_int hr_int_pos] + + have hw_in_R : w ∈ Metric.closedBall 0 R_analytic := by + have h_subset : Metric.closedBall (0 : ℂ) r_int ⊆ Metric.closedBall 0 R_analytic := by + apply Metric.closedBall_subset_closedBall + linarith [hr_int_lt_R_analytic] + exact h_subset hw_in_closed + + exact lem_BCI R_analytic M hR_analytic_pos hM_pos f + (by + rw [ballDR] + have h_analytic_U : AnalyticOn ℂ f U := hf_diff_U.analyticOn hU_open + convert h_analytic_U.mono h_subset + apply closure_ball + linarith) + hf0 + (by rwa [lem_ballDR R_analytic hR_analytic_pos]) + r_int hr_int_pos hr_int_lt_R_analytic w + (by aesop) + + · exact h_in_image + + calc norm (f z₀) + ≤ sSup ((norm ∘ f) '' (closure (ballDR r_int))) := h_le_sSup + _ ≤ (2 * r_int / (R_analytic - r_int)) * M := h_sSup_bound + _ = (2 * r_int * M) / (R_analytic - r_int) := by ring + +lemma lem_bound_on_integrand_modulus {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} + (hM_pos : 0 < M) + (hR_analytic_pos : 0 < R_analytic) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (hf0 : f 0 = 0) + (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) + (t : ℝ) : +norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by + + have h1 := lem_modulus_of_product4 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h2 := lem_bound_on_f_at_r_prime hM_pos hR_analytic_pos (lt_trans h_r_z_pos h_r_z_lt_r_int) h_r_int_lt_R_analytic f hf_domain hf0 hRe_f_le_M t + + have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int + have h_denom_nonneg : 0 ≤ (r_int - r_z) ^ 2 := by + apply sq_nonneg + + have h3 : (r_int * norm (f (r_int * Complex.exp (I * t)))) / (r_int - r_z) ^ 2 ≤ + (r_int * (2 * r_int * M / (R_analytic - r_int))) / (r_int - r_z) ^ 2 := by + apply div_le_div_of_nonneg_right _ h_denom_nonneg + apply mul_le_mul_of_nonneg_left h2 + linarith [h_r_int_pos] + + have h4 : (r_int * (2 * r_int * M / (R_analytic - r_int))) / (r_int - r_z) ^ 2 = + (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by + have h_R_sub_r_pos : 0 < R_analytic - r_int := by linarith [h_r_int_lt_R_analytic] + have h_r_sub_r_pos : 0 < r_int - r_z := by linarith [h_r_z_lt_r_int] + field_simp [ne_of_gt h_R_sub_r_pos, ne_of_gt (pow_pos h_r_sub_r_pos 2)] + + rw [h4] at h3 + exact le_trans h1 h3 + +lemma lem_integral_inequality_aux {g : ℝ → ℝ} {C a b : ℝ} (hab : a ≤ b) + (h_integrable : IntervalIntegrable g MeasureTheory.volume a b) + (h_bound : ∀ t ∈ Set.Icc a b, g t ≤ C) : +∫ t in a..b, g t ≤ ∫ _t in a..b, C := by + + have h_const_integrable : IntervalIntegrable (fun _ => C) MeasureTheory.volume a b := + intervalIntegrable_const + + have h_pointwise : ∀ x ∈ Set.Icc a b, g x ≤ (fun _ => C) x := by + intro x hx + simp + exact h_bound x hx + + exact intervalIntegral.integral_mono_on hab h_integrable h_const_integrable h_pointwise + +lemma lem_integral_inequality {g : ℝ → ℝ} {C a b : ℝ} (hab : a ≤ b) + (h_integrable : IntervalIntegrable g MeasureTheory.volume a b) + (h_bound : ∀ t ∈ Set.Icc a b, g t ≤ C) : +∫ t in Set.Icc a b, g t ≤ ∫ _t in Set.Icc a b, C := by + rw [MeasureTheory.integral_Icc_eq_integral_Ioc, MeasureTheory.integral_Icc_eq_integral_Ioc] + rw [← intervalIntegral.integral_of_le hab, ← intervalIntegral.integral_of_le hab] + exact lem_integral_inequality_aux hab h_integrable h_bound + +lemma continuous_real_parameterization (r : ℝ) : Continuous (fun t : ℝ => r * Complex.exp (I * t)) := by + + have h1 : Continuous (fun t : ℝ => (t : ℂ)) := Complex.continuous_ofReal + + have h2 : Continuous (fun z : ℂ => I * z) := by + apply Continuous.mul + · exact continuous_const + · exact continuous_id + + have h3 : Continuous Complex.exp := Complex.continuous_exp + + have h4 : Continuous (fun z : ℂ => (r : ℂ) * z) := by + apply Continuous.mul + · exact continuous_const + · exact continuous_id + + apply Continuous.comp h4 + apply Continuous.comp h3 + apply Continuous.comp h2 + exact h1 + +lemma continuous_f_parameterized {f : ℂ → ℂ} {R r : ℝ} (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R ⊆ U ∧ DifferentiableOn ℂ f U) + (hr_pos : 0 < r) (hr_lt_R : r < R) : Continuous (fun t : ℝ => f (r * Complex.exp (I * t))) := by + + obtain ⟨U', hU'_open, h_subset, hf_diff_U'⟩ := hf_domain + have hf_cont : ContinuousOn f (Metric.closedBall 0 R) := by + + have hf_on_closed : DifferentiableOn ℂ f (Metric.closedBall 0 R) := + hf_diff_U'.mono h_subset + + exact DifferentiableOn.continuousOn hf_on_closed + + have hparam_cont : Continuous (fun t : ℝ => r * Complex.exp (I * t)) := continuous_real_parameterization r + + have hparam_range : ∀ t : ℝ, r * Complex.exp (I * t) ∈ Metric.closedBall 0 R := by + intro t + rw [Metric.mem_closedBall, dist_zero_right] + + change norm (r * Complex.exp (I * t)) ≤ R + rw [lem_modulus_of_ae_it hr_pos] + exact le_of_lt hr_lt_R + + have hcomp_on : ContinuousOn (fun t : ℝ => f (r * Complex.exp (I * t))) Set.univ := by + apply ContinuousOn.comp hf_cont (Continuous.continuousOn hparam_cont) + intro t _ + exact hparam_range t + + exact continuousOn_univ.mp hcomp_on + +lemma continuous_denominator_parameterized (r : ℝ) (z : ℂ) : Continuous (fun t : ℝ => (r * Complex.exp (I * t) - z) ^ 2) := by + + have h1 : Continuous (fun t : ℝ => r * Complex.exp (I * t) - z) := by + + apply Continuous.sub + · + exact continuous_real_parameterization r + · + exact continuous_const + + have h2 : Continuous (fun x : ℂ => x ^ 2) := continuous_pow 2 + + exact Continuous.comp h2 h1 + +lemma interval_integrable_cauchy_integrand {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} {z : ℂ} + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hz : z ∈ Metric.closedBall 0 r_z) : +IntervalIntegrable (fun t => norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) MeasureTheory.volume 0 (2 * Real.pi) := by + + apply Continuous.intervalIntegrable + + apply Continuous.comp continuous_norm + + apply Continuous.div₀ + + · apply Continuous.mul + + · exact continuous_real_parameterization r_int + + · have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int + exact continuous_f_parameterized hf_domain h_r_int_pos h_r_int_lt_R_analytic + + · exact continuous_denominator_parameterized r_int z + + · intro t + exact lem_reverse_triangle6 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + +lemma integral_const_over_interval (C : ℝ) : +∫ _t in Set.Icc 0 (2 * Real.pi), C = (2 * Real.pi) * C := by + + rw [MeasureTheory.integral_Icc_eq_integral_Ioc] + + have h_le : (0 : ℝ) ≤ 2 * Real.pi := by + apply mul_nonneg + · norm_num + · exact Real.pi_pos.le + rw [← intervalIntegral.integral_of_le h_le] + + rw [intervalIntegral.integral_const] + + simp [sub_zero, smul_eq_mul] + +lemma lem_f_prime_bound_by_integral_of_constant {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} + (hM_pos : 0 < M) + (hR_analytic_pos : 0 < R_analytic) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (hf0 : f 0 = 0) + (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : +norm (deriv f z) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by + + have h1 := lem_modulus_of_f_prime hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + set C := (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) + + have h_bound : ∀ t ∈ Set.Icc 0 (2 * Real.pi), + norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ C := by + intro t ht + exact lem_bound_on_integrand_modulus hM_pos hR_analytic_pos h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hf_domain hf0 hRe_f_le_M hz t + + have h_eq : ∀ t, norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = + norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) := by + intro t + congr 2 + ring + + have h_bound_h1 : ∀ t ∈ Set.Icc 0 (2 * Real.pi), + norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ C := by + intro t ht + rw [h_eq] + exact h_bound t ht + + have h_integrable : IntervalIntegrable (fun t => norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) MeasureTheory.volume 0 (2 * Real.pi) := by + + exact interval_integrable_cauchy_integrand hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz + + have h2 := lem_integral_inequality ?_ h_integrable h_bound_h1 + + have h_const_integral : ∫ t in Set.Icc 0 (2 * Real.pi), C = (2 * Real.pi) * C := by + + exact integral_const_over_interval C + + rw [h_const_integral] at h2 + + have h3 : (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), + norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) ≤ + (1 / (2 * Real.pi)) * (2 * Real.pi * C) := by + apply mul_le_mul_of_nonneg_left h2 + apply div_nonneg + · norm_num + · linarith [Real.pi_pos] + + have h4 : (1 / (2 * Real.pi)) * (2 * Real.pi * C) = C := by + have h_pi_ne_zero : (2 : ℝ) * Real.pi ≠ 0 := ne_of_gt (by linarith [Real.pi_pos]) + field_simp [h_pi_ne_zero] + + rw [h4] at h3 + exact le_trans h1 h3 + simp [Real.pi_nonneg] + +lemma lem_integral_of_1 : ∫ (_t : ℝ) in Set.Icc 0 (2 * Real.pi), (1 : ℝ) = 2 * Real.pi := by + + rw [MeasureTheory.integral_Icc_eq_integral_Ioc] + + rw [← intervalIntegral.integral_of_le] + + rw [integral_one] + + simp + + exact mul_nonneg (by norm_num) Real.pi_pos.le + +lemma lem_integral_2 : (1 / (2 * Real.pi)) * (∫ (_t : ℝ) in Set.Icc 0 (2 * Real.pi), (1 : ℝ)) = 1 := by + + rw [lem_integral_of_1] + + field_simp + +lemma lem_f_prime_bound {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} + (hM_pos : 0 < M) + (hR_analytic_pos : 0 < R_analytic) + (h_r_z_pos : 0 < r_z) + (h_r_z_lt_r_int : r_z < r_int) + (h_r_int_lt_R_analytic : r_int < R_analytic) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) + (hf0 : f 0 = 0) + (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : +norm (deriv f z) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by + + exact lem_f_prime_bound_by_integral_of_constant hM_pos hR_analytic_pos h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hf_domain hf0 hRe_f_le_M hz + +lemma lem_r_prime_gt_r {r R : ℝ} + (_h_r_pos : 0 < r) + (h_r_lt_R : r < R) : +r < (r + R) / 2 := by + linarith + +lemma lem_r_prime_lt_R {r R : ℝ} + (_h_r_pos : 0 < r) + (h_r_lt_R : r < R) : +(r + R) / 2 < R := by + + rw [add_div_two_lt_right] + exact h_r_lt_R + +lemma lem_r_prime_is_intermediate {r R : ℝ} + (h_r_pos : 0 < r) + (h_r_lt_R : r < R) : +r < (r + R) / 2 ∧ (r + R) / 2 < R := by + constructor + · + rw [left_lt_add_div_two] + exact h_r_lt_R + · + exact lem_r_prime_lt_R h_r_pos h_r_lt_R + +lemma lem_calc_R_minus_r_prime {r R : ℝ} + (_h_r_pos : 0 < r) + (_h_r_lt_R : r < R) : +R - ((r + R) / 2) = (R - r) / 2 := by + field_simp; ring + +lemma lem_calc_r_prime_minus_r {r R : ℝ} + (_h_r_pos : 0 < r) + (_h_r_lt_R : r < R) : +((r + R) / 2) - r = (R - r) / 2 := by + + field_simp + + ring + +lemma lem_calc_denominator_specific {r R : ℝ} + (h_r_pos : 0 < r) + (h_r_lt_R : r < R) : +(R - ((r + R) / 2)) * (((r + R) / 2) - r) ^ 2 = ((R - r) ^ 3) / 8 := by + + rw [lem_calc_R_minus_r_prime h_r_pos h_r_lt_R] + + have h_calc : ((r + R) / 2) - r = (R - r) / 2 := by + field_simp; ring + + rw [h_calc] + + ring + +lemma lem_calc_numerator_specific {M r R : ℝ} + (_hM_pos : 0 < M) + (_hr_pos : 0 < r) + (_hr_lt_R : r < R) : +2 * (((r + R) / 2) ^ 2) * M = ((R + r) ^ 2 * M) / 2 := by + + ring + +lemma lem_frac_simplify {M r R : ℝ} + (hM_pos : 0 < M) + (hr_pos : 0 < r) + (hr_lt_R : r < R) : + let r_prime := (r + R) / 2 +(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) = (((R + r) ^ 2 * M) / 2) / (((R - r) ^ 3) / 8) := by + + dsimp only + + have h_num := lem_calc_numerator_specific hM_pos hr_pos hr_lt_R + + have h_denom := lem_calc_denominator_specific hr_pos hr_lt_R + + rw [← h_num, ← h_denom] + +lemma lem_frac_simplify2 {M r R : ℝ} + (hM_pos : 0 < M) + (_hr_pos : 0 < r) + (hr_lt_R : r < R) : +((R + r) ^ 2 * M / 2) / ((R - r) ^ 3 / 8) = (4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) := by + + have h_two_ne_zero : (2 : ℝ) ≠ 0 := by norm_num + have h_eight_ne_zero : (8 : ℝ) ≠ 0 := by norm_num + have h_R_minus_r_ne_zero : R - r ≠ 0 := by linarith [hr_lt_R] + have h_R_minus_r_pow_ne_zero : (R - r) ^ 3 ≠ 0 := by + apply pow_ne_zero + exact h_R_minus_r_ne_zero + + field_simp [h_two_ne_zero, h_eight_ne_zero, h_R_minus_r_pow_ne_zero]; ring + +lemma lem_frac_simplify3 {M r R : ℝ} + (hM_pos : 0 < M) + (hr_pos : 0 < r) + (hr_lt_R : r < R) : + let r_prime := (r + R) / 2 +(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) = (4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) := by + + dsimp only + + have h1 := lem_frac_simplify hM_pos hr_pos hr_lt_R + + have h2 := lem_frac_simplify2 hM_pos hr_pos hr_lt_R + + rw [h1, h2] + +lemma lem_ineq_R_plus_r_lt_2R {r R : ℝ} (h_r_lt_R : r < R) : +R + r < 2 * R := by + + rw [two_mul] + + linarith [h_r_lt_R] + +lemma lem_R_plus_r_is_positive {r R : ℝ} + (hr_pos : 0 < r) + (hr_lt_R : r < R) : +0 < R + r := by + + have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R + + exact add_pos hR_pos hr_pos + +lemma lem_2R_is_positive {R : ℝ} (hR_pos : 0 < R) : 0 < 2 * R := by + apply mul_pos + · norm_num + · exact hR_pos + +lemma lem_square_inequality_strict {a b : ℝ} + (h_a_pos : 0 < a) + (h_a_lt_b : a < b) : +a ^ 2 < b ^ 2 := by + + have h_a_nonneg : 0 ≤ a := le_of_lt h_a_pos + + have h_b_pos : 0 < b := lt_trans h_a_pos h_a_lt_b + have h_b_nonneg : 0 ≤ b := le_of_lt h_b_pos + + have h_squares := mul_self_lt_mul_self_iff h_a_nonneg h_b_nonneg + + have h_mult : a * a < b * b := h_squares.mp h_a_lt_b + + rw [← pow_two, ← pow_two] at h_mult + exact h_mult + +lemma lem_ineq_R_plus_r_sq_lt_2R_sq {r R : ℝ} + (hr_pos : 0 < r) + (hr_lt_R : r < R) : +(R + r) ^ 2 < (2 * R) ^ 2 := by + + let a := R + r + let b := 2 * R + + have ha_pos : 0 < a := lem_R_plus_r_is_positive hr_pos hr_lt_R + + have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R + have hb_pos : 0 < b := by + unfold b + exact lem_2R_is_positive hR_pos + + have hab : a < b := by + unfold a b + exact lem_ineq_R_plus_r_lt_2R hr_lt_R + + have : a ^ 2 < b ^ 2 := lem_square_inequality_strict ha_pos hab + + unfold a b at this + exact this + +lemma lem_2R_sq_is_4R_sq {R : ℝ} (_hR_pos : 0 < R) : (2 * R) ^ 2 = 4 * R ^ 2 := by + + ring + +lemma lem_ineq_R_plus_r_sq {r R : ℝ} + (hr_pos : 0 < r) + (hr_lt_R : r < R) : +(R + r) ^ 2 < 4 * R ^ 2 := by + + have h1 := lem_ineq_R_plus_r_lt_2R hr_lt_R + + have h2 := lem_R_plus_r_is_positive hr_pos hr_lt_R + + have h3 := lem_square_inequality_strict h2 h1 + + have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R + have h4 := lem_2R_sq_is_4R_sq hR_pos + rw [h4] at h3 + exact h3 + +lemma lem_ineq_R_plus_r_sqM {M r R : ℝ} + (hM_pos : 0 < M) + (hr_pos : 0 < r) + (hr_lt_R : r < R) : +4 * (R + r) ^ 2 * M < 16 * R ^ 2 * M := by + + have h_ineq := lem_ineq_R_plus_r_sq hr_pos hr_lt_R + + have h_4M_pos : 0 < 4 * M := by + apply mul_pos + · norm_num + · exact hM_pos + + have h_mult := mul_lt_mul_of_pos_right h_ineq h_4M_pos + + nlinarith [h_mult] + +lemma lem_simplify_final_bound {M r R : ℝ} + (hM_pos : 0 < M) + (hr_pos : 0 < r) + (hr_lt_R : r < R) : +(4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) < (16 * R ^ 2 * M) / ((R - r) ^ 3) := by + + have h_num_ineq := lem_ineq_R_plus_r_sqM hM_pos hr_pos hr_lt_R + + have h_denom_pos : 0 < (R - r) ^ 3 := by + apply pow_pos + linarith [hr_lt_R] + + exact div_lt_div_of_pos_right h_num_ineq h_denom_pos + +lemma lem_bound_after_substitution {M r R : ℝ} + (hM_pos : 0 < M) + (hr_pos : 0 < r) + (hr_lt_R : r < R) : + let r_prime := (r + R) / 2 +(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) ≤ (16 * R ^ 2 * M) / ((R - r) ^ 3) := by + + dsimp only + + have h1 := lem_frac_simplify3 hM_pos hr_pos hr_lt_R + + dsimp only at h1 + rw [h1] + + have h2 := lem_simplify_final_bound hM_pos hr_pos hr_lt_R + + exact le_of_lt h2 + +theorem borel_caratheodory_II {f : ℂ → ℂ} {R M r : ℝ} + (hR_pos : 0 < R) + (hM_pos : 0 < M) + (hr_pos : 0 < r) + (hr_lt_R : r < R) + (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R ⊆ U ∧ DifferentiableOn ℂ f U) + (hf0 : f 0 = 0) + (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R, (f w).re ≤ M) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r) : +norm (deriv f z) ≤ (16 * M * R ^ 2) / ((R - r) ^ 3) := by + + set r_prime := (r + R) / 2 + + have h_intermediate := lem_r_prime_is_intermediate hr_pos hr_lt_R + have h_r_lt_r_prime := h_intermediate.1 + have h_r_prime_lt_R := h_intermediate.2 + + have h_bound := lem_f_prime_bound hM_pos hR_pos hr_pos h_r_lt_r_prime h_r_prime_lt_R hf_domain hf0 hRe_f_le_M hz + + have h_final := lem_bound_after_substitution hM_pos hr_pos hr_lt_R + + have h_combined : norm (deriv f z) ≤ (16 * R ^ 2 * M) / ((R - r) ^ 3) := by + exact le_trans h_bound h_final + + convert h_combined using 1 + ring + +open Complex MeasureTheory intervalIntegral +open scoped Interval + +noncomputable def If_taxicab + {r1 R R0: ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + (f : ℂ → ℂ) + (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : + (Metric.closedBall (0 : ℂ) r1) → ℂ := + fun z => + (∫ t in (0 : ℝ)..z.1.re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.1.im, f ((z.1.re : ℂ) + Complex.I * τ)) + +lemma def_If_z_plus_h + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, f (( (z + h).re : ℂ) + Complex.I * τ)) := by + rfl + +lemma def_If_z + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ + = (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) := by + rfl + +lemma def_If_w + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (_hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) := by + simp [If_taxicab] + +lemma continuous_vertical_line (a : ℂ) : + Continuous (fun τ : ℝ => ((a.re : ℂ) + Complex.I * (τ : ℂ))) := by + have hconst : Continuous (fun _ : ℝ => (a.re : ℂ)) := continuous_const + have hmul : Continuous (fun τ : ℝ => (Complex.I : ℂ) * (τ : ℂ)) := + continuous_const.mul Complex.continuous_ofReal + convert hconst.add hmul using 1 + +lemma norm_re_add_I_mul_le_norm (a : ℂ) {τ : ℝ} (hτ : |τ| ≤ |a.im|) : + ‖((a.re : ℂ) + Complex.I * (τ : ℂ))‖ ≤ ‖a‖ := by + + set z1 : ℂ := ((a.re : ℂ) + Complex.I * (τ : ℂ)) with hz1 + + have hsq_z1 : ‖z1‖ ^ 2 = z1.re ^ 2 + z1.im ^ 2 := by + have hx : ‖z1‖ ^ 2 - z1.re ^ 2 = z1.im ^ 2 := Complex.sq_norm_sub_sq_re z1 + have hx' := congrArg (fun t : ℝ => t + z1.re ^ 2) hx + + have : ‖z1‖ ^ 2 = z1.im ^ 2 + z1.re ^ 2 := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hx' + simpa [add_comm] using this + have hsq_a : ‖a‖ ^ 2 = a.re ^ 2 + a.im ^ 2 := by + have hx : ‖a‖ ^ 2 - a.re ^ 2 = a.im ^ 2 := Complex.sq_norm_sub_sq_re a + have hx' := congrArg (fun t : ℝ => t + a.re ^ 2) hx + have : ‖a‖ ^ 2 = a.im ^ 2 + a.re ^ 2 := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hx' + simpa [add_comm] using this + + have hz1_re : z1.re = a.re := by + simp [hz1, mul_comm] + have hz1_im : z1.im = τ := by + simp [hz1, mul_comm] + + have hτ_sq : τ ^ 2 ≤ a.im ^ 2 := by + simpa using (sq_le_sq.mpr hτ) + + have hsq_le : ‖z1‖ ^ 2 ≤ ‖a‖ ^ 2 := by + have : a.re ^ 2 + τ ^ 2 ≤ a.re ^ 2 + a.im ^ 2 := add_le_add_right hτ_sq _ + simpa [hsq_z1, hz1_re, hz1_im, hsq_a] using this + + have hnonneg : 0 ≤ ‖a‖ := norm_nonneg _ + exact le_of_sq_le_sq hsq_le hnonneg + +lemma closedBall_mono_center0 {r1 R : ℝ} (h : r1 ≤ R) : + Metric.closedBall (0 : ℂ) r1 ⊆ Metric.closedBall (0 : ℂ) R := by + intro z hz + have hz' : dist z (0 : ℂ) ≤ r1 := (Metric.mem_closedBall.mp hz) + exact Metric.mem_closedBall.mpr (le_trans hz' h) + +lemma abs_le_abs_of_mem_uIcc_zero {b t : ℝ} (ht : t ∈ Set.uIcc (0 : ℝ) b) : |t| ≤ |b| := by + classical + by_cases hb : 0 ≤ b + · + have ht' : t ∈ Set.Icc (0 : ℝ) b := by + simpa [Set.uIcc_of_le hb] using ht + have ht0 : 0 ≤ t := ht'.1 + have htb : t ≤ b := ht'.2 + have htabs : |t| = t := abs_of_nonneg ht0 + have hbabs : |b| = b := abs_of_nonneg hb + simpa [htabs, hbabs] using htb + · + have ht' : t ∈ Set.Icc b 0 := by + simpa [Set.uIcc_of_not_le hb] using ht + have hb_le : b ≤ 0 := le_trans ht'.1 ht'.2 + have ht_le0 : t ≤ 0 := ht'.2 + have hbabs : |b| = -b := abs_of_nonpos hb_le + have htabs : |t| = -t := abs_of_nonpos ht_le0 + have hneg : -t ≤ -b := neg_le_neg ht'.1 + simpa [htabs, hbabs] using hneg + +lemma vertical_intervalIntegrable_of_mem_ball + {r1 R R0 : ℝ} + (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {a : ℂ} + (ha : a ∈ Metric.closedBall (0 : ℂ) r1) : + IntervalIntegrable (fun τ : ℝ => f (((a.re : ℂ)) + Complex.I * τ)) volume (0 : ℝ) a.im := by + classical + + have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn + + let g : ℝ → ℂ := fun τ => ((a.re : ℂ) + Complex.I * (τ : ℂ)) + + have hg_cont : ContinuousOn g (Set.uIcc (0 : ℝ) a.im) := by + simpa [g] using (continuous_vertical_line a).continuousOn + + have hg_maps : Set.MapsTo g (Set.uIcc (0 : ℝ) a.im) (Metric.closedBall (0 : ℂ) R) := by + intro τ hτ + have hτabs : |τ| ≤ |a.im| := abs_le_abs_of_mem_uIcc_zero hτ + have hnorm_le_a : ‖g τ‖ ≤ ‖a‖ := by + simpa [g] using norm_re_add_I_mul_le_norm a hτabs + have ha_norm : ‖a‖ ≤ r1 := by + have : dist a (0 : ℂ) ≤ r1 := (Metric.mem_closedBall.mp ha) + simpa [dist_eq_norm] using this + have hnorm_le_r1 : ‖g τ‖ ≤ r1 := le_trans hnorm_le_a ha_norm + have hg_mem_r1 : g τ ∈ Metric.closedBall (0 : ℂ) r1 := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hnorm_le_r1 + exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) hg_mem_r1 + + have hcomp : ContinuousOn (fun τ : ℝ => f (g τ)) (Set.uIcc (0 : ℝ) a.im) := by + + convert (ContinuousOn.comp (hg := hf_cont) (hf := hg_cont) (h := hg_maps)) using 1; rfl + + have hInt : IntervalIntegrable (fun τ : ℝ => f (g τ)) volume (0 : ℝ) a.im := + ContinuousOn.intervalIntegrable (u := fun τ : ℝ => f (g τ)) (a := 0) (b := a.im) hcomp + simpa [g] using hInt + +lemma helper_im_of_w (z h : ℂ) : (((((z + h).re : ℂ) + Complex.I * z.im)).im) = z.im := by + simp [Complex.add_im] + +lemma helper_mul_sub_complex (x y : ℂ) : Complex.I * x - Complex.I * y = Complex.I * (x - y) := by + simp [mul_sub] + +lemma helper_re_of_w (z h : ℂ) : (((((z + h).re : ℂ) + Complex.I * z.im)).re) = (z + h).re := by + simp + +lemma diff_If_zh_w + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by + classical + intro w + + let g : ℝ → ℂ := fun τ => f (((z + h).re : ℂ) + Complex.I * τ) + + have hInt1 : IntervalIntegrable g volume (0 : ℝ) ((z + h).im) := by + simpa [g] using + (vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf (a := z + h) hzh) + have hInt2 : IntervalIntegrable g volume (0 : ℝ) (z.im) := by + have hInt2' : + IntervalIntegrable + (fun τ : ℝ => f (((( (((z + h).re : ℂ) + Complex.I * z.im)).re : ℂ)) + Complex.I * τ)) + volume (0 : ℝ) (((((z + h).re : ℂ) + Complex.I * z.im)).im) := + vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf + (a := (((z + h).re : ℂ) + Complex.I * z.im)) hw + simpa [g, helper_re_of_w z h, helper_im_of_w z h] using hInt2' + have hinterval : + ((∫ τ in (0 : ℝ)..(z + h).im, g τ) - ∫ τ in (0 : ℝ)..z.im, g τ) + = ∫ τ in z.im..(z + h).im, g τ := + intervalIntegral.integral_interval_sub_left (μ := volume) (f := g) hInt1 hInt2 + + have h1 : + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ) := by + have hzph := def_If_z_plus_h hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf (z := z) (h := h) hz hzh + simpa [g] using hzph + have h2 : + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ) := by + have hwdef := def_If_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + simpa [g, w] using hwdef + + calc + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + = ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ)) + - ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ)) := by + simp [h1, h2] + _ = (Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ)) + - (Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ)) := by + simp [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] + _ = Complex.I * + ((∫ τ in (0 : ℝ)..(z + h).im, g τ) + - (∫ τ in (0 : ℝ)..z.im, g τ)) := by + simp [helper_mul_sub_complex] + _ = Complex.I * (∫ τ in z.im..(z + h).im, g τ) := by + simpa using congrArg (fun t => Complex.I * t) hinterval + _ = Complex.I * (∫ τ in z.im..(z + h).im, + f (((z + h).re : ℂ) + Complex.I * τ)) := by + simp [g] + +lemma diff_If_w_z_initial_form_vertical + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by + simpa using + (diff_If_zh_w (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw) + +lemma diff_If_w_z_initial_form + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = (∫ t in z.re..w.re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (w.re + Complex.I * τ) - f (z.re + Complex.I * τ))) := by + intro w + + rw [def_If_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw] + rw [def_If_z hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz] + + have hw_re : w.re = (z + h).re := by simp [w] + have hw_im : w.im = z.im := by simp [w] + + have step1 : + ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ))) + - ((∫ t in (0 : ℝ)..z.re, f (t : ℂ)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) + = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) - (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) + + Complex.I * ((∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) + - (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) := by ring + rw [step1] + + have horizontal_integrable_zh : IntervalIntegrable (fun t : ℝ => f (t : ℂ)) volume (0 : ℝ) (z + h).re := by + + apply ContinuousOn.intervalIntegrable + apply ContinuousOn.comp hf.continuousOn Complex.continuous_ofReal.continuousOn + intro t ht + simp [Metric.mem_closedBall, dist_eq_norm, Complex.norm_real] + + have : ‖z + h‖ ≤ r1 := by simp [← dist_zero_right]; exact Metric.mem_closedBall.mp hzh + have : |(z + h).re| ≤ ‖z + h‖ := Complex.abs_re_le_norm (z + h) + have : |t| ≤ |(z + h).re| := abs_le_abs_of_mem_uIcc_zero ht + linarith [le_of_lt hr1_lt_R] + + have horizontal_integrable_z : IntervalIntegrable (fun t : ℝ => f (t : ℂ)) volume (0 : ℝ) z.re := by + apply ContinuousOn.intervalIntegrable + apply ContinuousOn.comp hf.continuousOn Complex.continuous_ofReal.continuousOn + intro t ht + simp [Metric.mem_closedBall, dist_eq_norm, Complex.norm_real] + have : ‖z‖ ≤ r1 := by simp [← dist_zero_right]; exact Metric.mem_closedBall.mp hz + have : |z.re| ≤ ‖z‖ := Complex.abs_re_le_norm z + have : |t| ≤ |z.re| := abs_le_abs_of_mem_uIcc_zero ht + linarith [le_of_lt hr1_lt_R] + + have horizontal_eq : + (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) - (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) + = ∫ t in z.re..(z + h).re, f (t : ℂ) := by + rw [← intervalIntegral.integral_interval_sub_left horizontal_integrable_zh horizontal_integrable_z] + + have vertical_integrable_zh : IntervalIntegrable (fun τ : ℝ => f (((z + h).re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := by + + rw [← hw_re, ← hw_im] + exact vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hw + + have vertical_integrable_z : IntervalIntegrable (fun τ : ℝ => f ((z.re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := + vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz + + have vertical_eq : + (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) + - (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) + = ∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ)) := by + rw [← intervalIntegral.integral_sub vertical_integrable_zh vertical_integrable_z] + + rw [horizontal_eq, vertical_eq, hw_re] + +lemma scalar_mul_integral_sub {a b : ℝ} (c : ℂ) (f g : ℝ → ℂ) + (hf : IntervalIntegrable f volume a b) (hg : IntervalIntegrable g volume a b) : + c * (∫ x in a..b, f x) - c * (∫ x in a..b, g x) = c * (∫ x in a..b, f x - g x) := by + rw [← mul_sub] + rw [← intervalIntegral.integral_sub hf hg] + +lemma algebraic_rearrangement_four_terms (a b c d : ℂ) : + a - b + c - d = 0 → c - d = b - a := by + intro h + + calc c - d + = (a - b + c - d) - (a - b) := by ring + _ = 0 - (a - b) := by rw [h] + _ = -(a - b) := by ring + _ = b - a := by ring + +lemma real_between_as_convex_combination (b₁ b₂ t : ℝ) + (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : + ∃ lam : ℝ, 0 ≤ lam ∧ lam ≤ 1 ∧ t = (1 - lam) * b₁ + lam * b₂ := by + + cases' le_total b₁ b₂ with h₁ h₂ + case inl => + + have ht : b₁ ≤ t ∧ t ≤ b₂ := by + cases' h with h_left h_right + · exact h_left + · + exact ⟨le_trans h₁ h_right.1, le_trans h_right.2 h₁⟩ + + by_cases heq : b₁ = b₂ + · + use 0 + constructor + · norm_num + constructor + · norm_num + · rw [heq] at ht ⊢ + have : t = b₂ := le_antisymm ht.2 ht.1 + rw [this] + ring + · + have hlt : b₁ < b₂ := lt_of_le_of_ne h₁ heq + let lam := (t - b₁) / (b₂ - b₁) + use lam + constructor + · + apply div_nonneg + · linarith [ht.1] + · linarith [hlt] + constructor + · + rw [div_le_iff₀] + · linarith [ht.2] + · linarith [hlt] + · + unfold lam + have h_nonzero : b₂ - b₁ ≠ 0 := ne_of_gt (sub_pos.2 hlt) + field_simp [h_nonzero]; ring + case inr => + + have ht : b₂ ≤ t ∧ t ≤ b₁ := by + cases' h with h_left h_right + · + exact ⟨le_trans h₂ h_left.1, le_trans h_left.2 h₂⟩ + · exact h_right + + by_cases heq : b₁ = b₂ + · + use 0 + constructor + · norm_num + constructor + · norm_num + · rw [← heq] at ht ⊢ + have : t = b₁ := le_antisymm ht.2 ht.1 + rw [this, heq] + ring + · + have hlt : b₂ < b₁ := lt_of_le_of_ne h₂ (Ne.symm heq) + let lam := (b₁ - t) / (b₁ - b₂) + use lam + constructor + · + apply div_nonneg + · linarith [ht.2] + · linarith [hlt] + constructor + · + rw [div_le_iff₀] + · linarith [ht.1] + · linarith [hlt] + · + unfold lam + have h_nonzero : b₁ - b₂ ≠ 0 := ne_of_gt (sub_pos.2 hlt) + field_simp [h_nonzero]; ring + +lemma convex_combination_mem_segment {E : Type*} [AddCommGroup E] [Module ℝ E] (x y : E) (t : ℝ) + (h₀ : 0 ≤ t) (h₁ : t ≤ 1) : + (1 - t) • x + t • y ∈ segment ℝ x y := by + + use (1 - t), t + constructor + · + linarith [h₁] + constructor + · + exact h₀ + constructor + · + ring + · + rfl + +lemma vertical_line_in_segment (a : ℂ) (b₁ b₂ t : ℝ) + (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : + a + Complex.I * t ∈ segment ℝ (a + Complex.I * b₁) (a + Complex.I * b₂) := by + + obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination b₁ b₂ t h + + have h_convex : a + Complex.I * t = (1 - lam) • (a + Complex.I * b₁) + lam • (a + Complex.I * b₂) := by + + simp only [Complex.real_smul] + + rw [h_t_eq] + + simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] + + rw [mul_add] + + ring + + rw [h_convex] + exact convex_combination_mem_segment (a + Complex.I * b₁) (a + Complex.I * b₂) lam h_lam_nonneg h_lam_le_one + +lemma horizontal_line_in_segment (a : ℝ) (b₁ b₂ t : ℝ) + (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : + (t : ℂ) + Complex.I * a ∈ segment ℝ ((b₁ : ℂ) + Complex.I * a) ((b₂ : ℂ) + Complex.I * a) := by + + obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination b₁ b₂ t h + + have h_convex : (t : ℂ) + Complex.I * a + = (1 - lam) • ((b₁ : ℂ) + Complex.I * a) + lam • ((b₂ : ℂ) + Complex.I * a) := by + simp only [Complex.real_smul] + + rw [h_t_eq] + simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] + ring + + simpa [h_convex] using + (convex_combination_mem_segment ((b₁ : ℂ) + Complex.I * a) ((b₂ : ℂ) + Complex.I * a) lam h_lam_nonneg h_lam_le_one) + +lemma intervalIntegrable_of_continuousOn_range (f : ℂ → ℂ) (g : ℝ → ℂ) (a b : ℝ) (S : Set ℂ) + (hf : ContinuousOn f S) (hg : Continuous g) + (hrange : ∀ t ∈ Set.uIcc a b, g t ∈ S) : + IntervalIntegrable (f ∘ g) volume a b := by + + have h_comp : ContinuousOn (f ∘ g) (Set.uIcc a b) := by + apply ContinuousOn.comp hf (hg.continuousOn) hrange + + exact h_comp.intervalIntegrable + +lemma intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball + {r1 R : ℝ} (hr1_lt_R : r1 < R) {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {a : ℂ} {b₁ b₂ : ℝ} + (h₁ : ‖a + Complex.I * b₁‖ ≤ r1) (h₂ : ‖a + Complex.I * b₂‖ ≤ r1) : + IntervalIntegrable (fun t => f (a + Complex.I * t)) volume b₁ b₂ := by + + apply intervalIntegrable_of_continuousOn_range f (fun t => a + Complex.I * ↑t) b₁ b₂ (Metric.closedBall (0 : ℂ) R) + · + exact AnalyticOnNhd.continuousOn hf + · + exact Continuous.add continuous_const (Continuous.mul continuous_const continuous_ofReal) + · + intro t ht + + have h_in_r1 : ‖a + Complex.I * ↑t‖ ≤ r1 := by + + have h_segment : a + Complex.I * ↑t ∈ segment ℝ (a + Complex.I * b₁) (a + Complex.I * b₂) := by + apply vertical_line_in_segment + exact Set.mem_uIcc.mp ht + + have h₁_mem : a + Complex.I * b₁ ∈ Metric.closedBall (0 : ℂ) r1 := by + rwa [Metric.mem_closedBall, dist_zero_right] + have h₂_mem : a + Complex.I * b₂ ∈ Metric.closedBall (0 : ℂ) r1 := by + rwa [Metric.mem_closedBall, dist_zero_right] + + have h_subset := (convex_closedBall (0 : ℂ) r1).segment_subset h₁_mem h₂_mem + have h_in_ball := h_subset h_segment + rwa [Metric.mem_closedBall, dist_zero_right] at h_in_ball + + rw [Metric.mem_closedBall, dist_zero_right] + exact le_trans h_in_r1 (le_of_lt hr1_lt_R) + +lemma cauchy_for_rectangles + {r1 R R0 : ℝ} + (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z w : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hw : w ∈ Metric.closedBall (0 : ℂ) r1) + (hzw : ((w.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1) + (hwz : ((z.re : ℂ) + Complex.I * w.im) ∈ Metric.closedBall (0 : ℂ) r1) : + (∫ x in z.re..w.re, f ((x : ℂ) + Complex.I * (z.im))) + - (∫ x in z.re..w.re, f ((x : ℂ) + Complex.I * (w.im))) + + Complex.I * (∫ y in z.im..w.im, f ((w.re : ℂ) + Complex.I * y)) + - Complex.I * (∫ y in z.im..w.im, f ((z.re : ℂ) + Complex.I * y)) = 0 := by + classical + + have hA : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + + have hz_eq : z = (z.re : ℂ) + Complex.I * z.im := by + exact (lem_wReIm z) + rwa [← hz_eq] + have hC : ((w.re : ℂ) + Complex.I * w.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + + have hw_eq : w = (w.re : ℂ) + Complex.I * w.im := by + exact (lem_wReIm w) + rwa [← hw_eq] + + have h_left_in_ball : ∀ y ∈ Set.uIcc z.im w.im, + ((z.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by + intro y hy + have hseg : (z.re : ℂ) + Complex.I * (y : ℂ) + ∈ segment ℝ ((z.re : ℂ) + Complex.I * z.im) ((z.re : ℂ) + Complex.I * w.im) := by + simpa using vertical_line_in_segment (a := (z.re : ℂ)) (b₁ := z.im) (b₂ := w.im) (t := y) + (h := Set.mem_uIcc.mp hy) + exact (convex_closedBall (0 : ℂ) r1).segment_subset hA hwz hseg + have h_right_in_ball : ∀ y ∈ Set.uIcc z.im w.im, + ((w.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by + intro y hy + have hseg : (w.re : ℂ) + Complex.I * (y : ℂ) + ∈ segment ℝ ((w.re : ℂ) + Complex.I * z.im) ((w.re : ℂ) + Complex.I * w.im) := by + simpa using vertical_line_in_segment (a := (w.re : ℂ)) (b₁ := z.im) (b₂ := w.im) (t := y) + (h := Set.mem_uIcc.mp hy) + exact (convex_closedBall (0 : ℂ) r1).segment_subset hzw hC hseg + have h_point_in_ball : ∀ x ∈ Set.uIcc z.re w.re, ∀ y ∈ Set.uIcc z.im w.im, + ((x : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by + intro x hx y hy + have hL : ((z.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := h_left_in_ball y hy + have hR' : ((w.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := h_right_in_ball y hy + + obtain ⟨lam, hlam0, hlam1, hx_eq⟩ := real_between_as_convex_combination z.re w.re x (Set.mem_uIcc.mp hx) + have hseg_horiz : (x : ℂ) + Complex.I * (y : ℂ) + ∈ segment ℝ ((z.re : ℂ) + Complex.I * (y : ℂ)) ((w.re : ℂ) + Complex.I * (y : ℂ)) := by + + have : (x : ℂ) + Complex.I * (y : ℂ) + = (1 - lam) • ((z.re : ℂ) + Complex.I * (y : ℂ)) + lam • ((w.re : ℂ) + Complex.I * (y : ℂ)) := by + simp only [Complex.real_smul] + + rw [hx_eq] + simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] + ring + simpa [this] using + (convex_combination_mem_segment ((z.re : ℂ) + Complex.I * (y : ℂ)) ((w.re : ℂ) + Complex.I * (y : ℂ)) lam hlam0 hlam1) + exact (convex_closedBall (0 : ℂ) r1).segment_subset hL hR' hseg_horiz + + set S := ([[z.re, w.re]] ×ℂ [[z.im, w.im]]) + have hS_subset_r1 : S ⊆ Metric.closedBall (0 : ℂ) r1 := by + intro p hp + have hx : p.re ∈ [[z.re, w.re]] := hp.1 + have hy : p.im ∈ [[z.im, w.im]] := hp.2 + + have : ((p.re : ℂ) + Complex.I * (p.im : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := + h_point_in_ball p.re hx p.im hy + + have hp_eq : p = (p.re : ℂ) + Complex.I * (p.im : ℂ) := lem_wReIm p + rwa [hp_eq] + have hS_subset_R : S ⊆ Metric.closedBall (0 : ℂ) R := + fun p hp => (closedBall_mono_center0 (le_of_lt hr1_lt_R)) (hS_subset_r1 hp) + + have Hdiff : DifferentiableOn ℂ f S := by + intro p hp + have hpR : p ∈ Metric.closedBall (0 : ℂ) R := hS_subset_R hp + exact (hf p hpR).differentiableAt.differentiableWithinAt + + simpa [smul_eq_mul, mul_comm] using + Complex.integral_boundary_rect_eq_zero_of_differentiableOn f z w Hdiff + +lemma cauchy_for_horizontal_strip + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + (∫ t in z.re..(z + h).re, f (t : ℂ)) + - (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) + + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) + - Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) = 0 := by + + let z₀ : ℂ := (z.re : ℂ) + let w₀ : ℂ := (z + h).re + Complex.I * z.im + + have hz₀ : z₀ ∈ Metric.closedBall (0 : ℂ) r1 := by + have hz_norm : ‖z‖ ≤ r1 := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hz + have hzre_le : ‖(z.re : ℂ)‖ ≤ ‖z‖ := by + rw [Complex.norm_real] + exact Complex.abs_re_le_norm z + have : ‖z₀‖ ≤ r1 := le_trans hzre_le hz_norm + simpa [z₀, Metric.mem_closedBall, dist_eq_norm] using this + have hw₀ : w₀ ∈ Metric.closedBall (0 : ℂ) r1 := hw + + have hzw : ((w₀.re : ℂ) + Complex.I * z₀.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + + have h1 : ((w₀.re : ℂ) + Complex.I * z₀.im) = ((z + h).re : ℂ) := by + simp [w₀, z₀, Complex.ofReal_im, mul_zero, add_zero] + rw [h1] + have h2 : ‖((z + h).re : ℂ)‖ ≤ ‖z + h‖ := by + rw [Complex.norm_real] + exact Complex.abs_re_le_norm (z + h) + have h3 : ‖z + h‖ ≤ r1 := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hzh + simpa [Metric.mem_closedBall, dist_eq_norm] using le_trans h2 h3 + have hwz : ((z₀.re : ℂ) + Complex.I * w₀.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + + have h1 : ((z₀.re : ℂ) + Complex.I * w₀.im) = z := by + simp [z₀, w₀, Complex.ofReal_re] + exact (lem_wReIm z).symm + rw [h1] + exact hz + + have H := cauchy_for_rectangles (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz₀ hw₀ hzw hwz + + rw [(show z₀.re = z.re by simp [z₀])] at H + rw [(show z₀.im = (0 : ℝ) by simp [z₀])] at H + rw [(show w₀.re = (z + h).re by simp [w₀])] at H + rw [(show w₀.im = z.im by simp [w₀])] at H + + convert H using 1 + simp only [Complex.ofReal_zero, mul_zero, add_zero] + +lemma integrability_from_cauchy_horizontal_strip + {r1 R R0 : ℝ} (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) r1) (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + IntervalIntegrable (fun τ => f (((z + h).re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im ∧ + IntervalIntegrable (fun τ => f ((z.re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := by + constructor + · + apply intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball hr1_lt_R hf + · + simp only [Complex.ofReal_zero, mul_zero, add_zero, Complex.norm_real] + rw [Metric.mem_closedBall, dist_zero_right] at hzh + exact le_trans (Complex.abs_re_le_norm (z + h)) hzh + · + rw [Metric.mem_closedBall, dist_zero_right] at hw + exact hw + · + apply intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball hr1_lt_R hf + · + simp only [Complex.ofReal_zero, mul_zero, add_zero, Complex.norm_real] + rw [Metric.mem_closedBall, dist_zero_right] at hz + exact le_trans (Complex.abs_re_le_norm z) hz + · + rw [Metric.mem_closedBall, dist_zero_right] at hz + rw [← lem_wReIm z] + exact hz + +lemma cauchy_rearrangement_step1 + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ))) + = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) - (∫ t in z.re..(z + h).re, f (t : ℂ)) := by + + have H := cauchy_for_horizontal_strip hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + + have integrable := integrability_from_cauchy_horizontal_strip hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + + have rearrange := algebraic_rearrangement_four_terms + (∫ t in z.re..(z + h).re, f (t : ℂ)) + (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) + (Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ))) + (Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) + H + + have vertical_linearity : + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) + - Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) + = Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ))) := by + rw [← mul_sub] + rw [← intervalIntegral.integral_sub integrable.1 integrable.2] + + rw [← vertical_linearity] + exact rearrange + +lemma diff_If_w_z + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ + = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) := by + + have initial_form := diff_If_w_z_initial_form hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + + have rearrange_step := cauchy_rearrangement_step1 hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + + have w_re_eq : (((z + h).re : ℂ) + Complex.I * z.im).re = (z + h).re := by + simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im] + + simp_rw [initial_form, w_re_eq, rearrange_step] + + ring + +lemma If_difference_is_L_path_integral + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) + + Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by + + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + + calc If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ + = (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩) + + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) := by ring + _ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) + + (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) := by + rw [diff_If_zh_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw, + diff_If_w_z hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw] + _ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) + + Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ring + +lemma If_diff_add_sub_identity + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = + (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z) + f z) + + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z) + f z) := by + + have H := + If_difference_is_L_path_integral (hr1_pos) (hr1_lt_R) (hR_lt_R0) (hR0_lt_one) hf hz hzh hw + simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using H + +lemma intervalIntegrable_of_analyticOnNhd_of_horizontal_endpoints_in_smaller_ball + {r1 R : ℝ} (hr1_lt_R : r1 < R) {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {im_part : ℝ} {a b : ℝ} + (h₁ : ‖(a : ℂ) + Complex.I * im_part‖ ≤ r1) (h₂ : ‖(b : ℂ) + Complex.I * im_part‖ ≤ r1) : + IntervalIntegrable (fun t => f ((t : ℂ) + Complex.I * im_part)) volume a b := by + + apply intervalIntegrable_of_continuousOn_range f (fun t => (t : ℂ) + Complex.I * im_part) a b (Metric.closedBall (0 : ℂ) R) + · + exact AnalyticOnNhd.continuousOn hf + · + exact Continuous.add continuous_ofReal continuous_const + · + intro t ht + + have h_in_r1 : ‖(t : ℂ) + Complex.I * im_part‖ ≤ r1 := by + + have h_segment : (t : ℂ) + Complex.I * im_part ∈ segment ℝ ((a : ℂ) + Complex.I * im_part) ((b : ℂ) + Complex.I * im_part) := by + + obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination a b t (Set.mem_uIcc.mp ht) + + have h_convex : (t : ℂ) + Complex.I * im_part = (1 - lam) • ((a : ℂ) + Complex.I * im_part) + lam • ((b : ℂ) + Complex.I * im_part) := by + + simp only [Complex.real_smul] + + rw [h_t_eq] + + simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] + + ring + + rw [h_convex] + exact convex_combination_mem_segment ((a : ℂ) + Complex.I * im_part) ((b : ℂ) + Complex.I * im_part) lam h_lam_nonneg h_lam_le_one + + have h₁_mem : (a : ℂ) + Complex.I * im_part ∈ Metric.closedBall (0 : ℂ) r1 := by + rwa [Metric.mem_closedBall, dist_zero_right] + have h₂_mem : (b : ℂ) + Complex.I * im_part ∈ Metric.closedBall (0 : ℂ) r1 := by + rwa [Metric.mem_closedBall, dist_zero_right] + + have h_subset := (convex_closedBall (0 : ℂ) r1).segment_subset h₁_mem h₂_mem + have h_in_ball := h_subset h_segment + rwa [Metric.mem_closedBall, dist_zero_right] at h_in_ball + + rw [Metric.mem_closedBall, dist_zero_right] + exact le_trans h_in_r1 (le_of_lt hr1_lt_R) + +lemma If_diff_linearity + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = + ((∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + + (∫ _t in z.re..(z + h).re, f z)) + + Complex.I * + ((∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) + + (∫ _τ in z.im..(z + h).im, f z)) := by + + have H := If_diff_add_sub_identity hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + + have hz_norm : ‖z‖ ≤ r1 := by rwa [Metric.mem_closedBall, dist_zero_right] at hz + have hzh_norm : ‖z + h‖ ≤ r1 := by rwa [Metric.mem_closedBall, dist_zero_right] at hzh + have hw_norm : ‖((z + h).re : ℂ) + Complex.I * z.im‖ ≤ r1 := by + rwa [Metric.mem_closedBall, dist_zero_right] at hw + + have h_z_eq : z = (z.re : ℂ) + Complex.I * z.im := lem_wReIm z + have h_zh_eq : z + h = ((z + h).re : ℂ) + Complex.I * (z + h).im := lem_wReIm (z + h) + + have hz_endpoint : ‖(z.re : ℂ) + Complex.I * z.im‖ ≤ r1 := by rwa [← h_z_eq] + have h_horiz_integrable := intervalIntegrable_of_analyticOnNhd_of_horizontal_endpoints_in_smaller_ball + hr1_lt_R hf hz_endpoint hw_norm + + have hzh_endpoint : ‖((z + h).re : ℂ) + Complex.I * (z + h).im‖ ≤ r1 := by rwa [← h_zh_eq] + have h_vert_integrable := intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball + hr1_lt_R hf hw_norm hzh_endpoint + + have h_const_horiz : IntervalIntegrable (fun _ => f z) volume z.re (z + h).re := intervalIntegrable_const + have h_const_vert : IntervalIntegrable (fun _ => f z) volume z.im (z + h).im := intervalIntegrable_const + + have h_diff_horiz : IntervalIntegrable (fun t => f (t + Complex.I * z.im) - f z) volume z.re (z + h).re := + IntervalIntegrable.sub h_horiz_integrable h_const_horiz + + have h_diff_vert : IntervalIntegrable (fun τ => f (((z + h).re : ℂ) + Complex.I * τ) - f z) volume z.im (z + h).im := + IntervalIntegrable.sub h_vert_integrable h_const_vert + + have h1 : ∫ t in z.re..(z + h).re, ((f (t + Complex.I * z.im) - f z) + f z) = + (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + (∫ t in z.re..(z + h).re, f z) := + intervalIntegral.integral_add h_diff_horiz h_const_horiz + + have h2 : ∫ τ in z.im..(z + h).im, ((f (((z + h).re : ℂ) + Complex.I * τ) - f z) + f z) = + (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) + (∫ τ in z.im..(z + h).im, f z) := + intervalIntegral.integral_add h_diff_vert h_const_vert + + rw [H, h1, h2, mul_add] + +lemma integral_of_constant_over_L_path + {r1 R R0 : ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (_hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : + (∫ _t in z.re..(z + h).re, f z) + Complex.I * (∫ _τ in z.im..(z + h).im, f z) + = f z * h := by + + rw [intervalIntegral.integral_const, intervalIntegral.integral_const] + + rw [Complex.add_re, Complex.add_im] + simp only [add_sub_cancel_left] + + rw [Complex.real_smul, Complex.real_smul] + + rw [← mul_assoc] + + rw [← add_mul] + + rw [mul_comm Complex.I (↑h.im)] + + rw [Complex.re_add_im h] + + rw [mul_comm] + +noncomputable def Err + {r1 R R0 : ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + (f : ℂ → ℂ) + (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + (z h : ℂ) : ℂ := + (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) + +lemma CD_eq_fz_h + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : + (∫ _t in z.re..(z + h).re, f z) + Complex.I * (∫ _τ in z.im..(z + h).im, f z) + = f z * h := by + simpa using + integral_of_constant_over_L_path (r1:=r1) (R:=R) (R0:=R0) + hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh + +lemma If_diff_decomposition_final + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = f z * h + + Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h := by + + have H := + If_diff_linearity (hr1_pos) (hr1_lt_R) (hR_lt_R0) (hR0_lt_one) + (f := f) (hf := hf) + (z := z) (h := h) + (hz := hz) (hzh := hzh) (hw := hw) + + let A : ℂ := ∫ t in z.re..(z + h).re, f (t + Complex.I * z.im) - f z + let B : ℂ := ∫ t in z.re..(z + h).re, f z + let C : ℂ := ∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ) - f z + let D : ℂ := ∫ τ in z.im..(z + h).im, f z + + have hH' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = (A + B) + Complex.I * (C + D) := by + simpa [A, B, C, D, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using H + + have hsplit : (A + B) + Complex.I * (C + D) + = (A + Complex.I * C) + (B + Complex.I * D) := by ring + have hH'' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = (A + Complex.I * C) + (B + Complex.I * D) := by + simpa [hsplit] using hH' + + have hBD : (B + Complex.I * D) = f z * h := by + simpa [B, D] using + integral_of_constant_over_L_path (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh + have hH''' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = (A + Complex.I * C) + f z * h := by + simpa [hBD] using hH'' + + have hH4 : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ + - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) + = Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h + f z * h := by + simpa [Err, A, C, add_comm, add_left_comm, add_assoc] using hH''' + + simpa [Err, add_comm, add_left_comm, add_assoc] using hH4 + +noncomputable def S_horiz (z h : ℂ) (f : ℂ → ℂ) : ℝ := + sSup {r | ∃ t ∈ Set.uIcc z.re (z + h).re, + r = ‖f (t + Complex.I * z.im) - f z‖} + +noncomputable def S_vert (z h : ℂ) (f : ℂ → ℂ) : ℝ := + sSup {r | ∃ τ ∈ Set.uIcc z.im (z + h).im, + r = ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖} + +noncomputable def S_max (z h : ℂ) (f : ℂ → ℂ) : ℝ := + max (S_horiz z h f) (S_vert z h f) + +lemma bound_on_Err + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : + ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h‖ + ≤ |h.re| * S_max z h f + |h.im| * S_max z h f := by + + unfold Err + + have hsplit : + ‖(∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ + ≤ ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ + + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ := + norm_add_le _ _ + + have hI : ‖Complex.I‖ = (1 : ℝ) := by simp + have hvertnorm : + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ + = ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ := by + simp [hI, one_mul] + + set SH : Set ℝ := {r | ∃ t ∈ Set.uIcc z.re (z + h).re, + r = ‖f (t + Complex.I * z.im) - f z‖} + have hbdd_SH : BddAbove SH := by + classical + + have hK : IsCompact (Set.uIcc z.re (z + h).re) := isCompact_uIcc + + let γ : ℝ → ℂ := fun t => (t : ℂ) + Complex.I * z.im + have hγ_cont : Continuous γ := by + convert (Complex.continuous_ofReal.add (continuous_const (y := Complex.I * (z.im : ℂ)))) using 1 + have hz_mem : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + simp only [Metric.mem_closedBall, dist_zero_right] + rw [show (z.re : ℂ) + Complex.I * z.im = z.re + z.im * Complex.I by ring] + rw [Complex.re_add_im] + rwa [Metric.mem_closedBall, dist_zero_right] at hz + have hw_mem : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hw + have hseg_subset : + (γ '' Set.uIcc z.re (z + h).re) ⊆ Metric.closedBall (0 : ℂ) r1 := by + intro w hwim + rcases hwim with ⟨t, ht, rfl⟩ + + have hseg : ((t : ℂ) + Complex.I * z.im) + ∈ segment ℝ ((z.re : ℂ) + Complex.I * z.im) + (((z + h).re : ℂ) + Complex.I * z.im) := by + + have := horizontal_line_in_segment (a := z.im) (b₁ := z.re) (b₂ := (z + h).re) + (t := t) (by simpa [Set.mem_uIcc] using ht) + simpa using this + have hz_in : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := hz_mem + have hw_in : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := hw_mem + have hsubset := (convex_closedBall (0 : ℂ) r1).segment_subset hz_in hw_in + have hw' := hsubset hseg + simpa [Metric.mem_closedBall, dist_zero_right] using hw' + have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn + + have hmaps : Set.MapsTo γ (Set.uIcc z.re (z + h).re) (Metric.closedBall (0 : ℂ) R) := by + intro t ht + have himg_r1 : γ t ∈ Metric.closedBall (0 : ℂ) r1 := by + exact hseg_subset (Set.mem_image_of_mem _ ht) + exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) himg_r1 + have hcont_on : ContinuousOn (fun t => f (γ t)) (Set.uIcc z.re (z + h).re) := by + convert (ContinuousOn.comp (hf_cont) (hγ_cont.continuousOn) hmaps) using 1; rfl + + have hψ : Continuous (fun w : ℂ => ‖w - f z‖) := + (continuous_id.sub continuous_const).norm + have hR_cont : ContinuousOn (fun t => ‖f (γ t) - f z‖) (Set.uIcc z.re (z + h).re) := by + + have h_cont_sub : ContinuousOn (fun t => f (γ t) - f z) (Set.uIcc z.re (z + h).re) := + hcont_on.sub continuousOn_const + + exact h_cont_sub.norm + + have himage_compact : IsCompact ((fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re) := + IsCompact.image_of_continuousOn hK hR_cont + + have hSH_eq : SH = (fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re := by + ext r; constructor + · intro hr; rcases hr with ⟨t, ht, rfl⟩; exact ⟨t, ht, rfl⟩ + · intro hr; rcases hr with ⟨t, ht, rfl⟩; exact ⟨t, ht, rfl⟩ + + have : BddAbove ((fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re) := + himage_compact.bddAbove + simpa [hSH_eq] using this + + set SV : Set ℝ := {r | ∃ τ ∈ Set.uIcc z.im (z + h).im, + r = ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖} + have hbdd_SV : BddAbove SV := by + classical + + have hK : IsCompact (Set.uIcc z.im (z + h).im) := isCompact_uIcc + let γv : ℝ → ℂ := fun τ => ((z + h).re : ℂ) + Complex.I * τ + have hγv_cont : Continuous γv := by + have hmul : Continuous (fun τ : ℝ => Complex.I * (τ : ℂ)) := by + exact continuous_const.mul Complex.continuous_ofReal + simp only [γv] + exact continuous_const.add hmul + have hw_mem' : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by + simpa [Metric.mem_closedBall, dist_zero_right] using hw + have hzh_mem : (((z + h).re : ℂ) + Complex.I * (z + h).im) ∈ Metric.closedBall (0 : ℂ) r1 := by + simp only [Metric.mem_closedBall, dist_zero_right] + rw [show ((z + h).re : ℂ) + Complex.I * (z + h).im = (z + h).re + (z + h).im * Complex.I by ring] + rw [Complex.re_add_im] + rwa [Metric.mem_closedBall, dist_zero_right] at hzh + have hseg_subset : + (γv '' Set.uIcc z.im (z + h).im) ⊆ Metric.closedBall (0 : ℂ) r1 := by + intro w hwim; rcases hwim with ⟨τ, hτ, rfl⟩ + have hseg : (((z + h).re : ℂ) + Complex.I * τ) + ∈ segment ℝ (((z + h).re : ℂ) + Complex.I * z.im) + (((z + h).re : ℂ) + Complex.I * (z + h).im) := by + have := vertical_line_in_segment (((z + h).re : ℂ)) (b₁ := z.im) (b₂ := (z + h).im) (t := τ) + (by simpa [Set.mem_uIcc] using hτ) + simpa using this + have hz_in := hw_mem' + have hw_in := hzh_mem + have hsubset := (convex_closedBall (0 : ℂ) r1).segment_subset hz_in hw_in + have hw' := hsubset hseg + simp only [Metric.mem_closedBall, dist_zero_right] at hw' + rwa [Metric.mem_closedBall, dist_zero_right] + have hmaps : Set.MapsTo γv (Set.uIcc z.im (z + h).im) (Metric.closedBall (0 : ℂ) R) := by + intro τ hτ; have : γv τ ∈ Metric.closedBall (0 : ℂ) r1 := hseg_subset (Set.mem_image_of_mem _ hτ) + exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) this + have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn + have hcont_on : ContinuousOn (fun τ => f (γv τ)) (Set.uIcc z.im (z + h).im) := by + convert (ContinuousOn.comp (hf_cont) (hγv_cont.continuousOn) hmaps) using 1; rfl + have hψ : Continuous (fun w : ℂ => ‖w - f z‖) := + (continuous_id.sub continuous_const).norm + have hR_cont : ContinuousOn (fun τ => ‖f (γv τ) - f z‖) (Set.uIcc z.im (z + h).im) := by + have h1 : ContinuousOn (fun τ => f (γv τ) - f z) (Set.uIcc z.im (z + h).im) := by + exact hcont_on.sub continuousOn_const + exact h1.norm + have himage_compact : IsCompact ((fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im) := + IsCompact.image_of_continuousOn hK hR_cont + have hSV_eq : SV = (fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im := by + ext r; constructor + · intro hr; rcases hr with ⟨τ, hτ, rfl⟩; exact ⟨τ, hτ, rfl⟩ + · intro hr; rcases hr with ⟨τ, hτ, rfl⟩; exact ⟨τ, hτ, rfl⟩ + have : BddAbove ((fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im) := + himage_compact.bddAbove + simpa [hSV_eq] using this + + have hC_horiz : ∀ t ∈ Set.uIcc z.re (z + h).re, + ‖(f (t + Complex.I * z.im) - f z)‖ ≤ S_horiz z h f := by + intro t ht + have hx : ‖f (t + Complex.I * z.im) - f z‖ ∈ SH := ⟨t, ht, rfl⟩ + + have : S_horiz z h f = sSup SH := rfl + simpa [this] using (le_csSup hbdd_SH hx) + + have hC_vert : ∀ τ ∈ Set.uIcc z.im (z + h).im, + ‖(f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ≤ S_vert z h f := by + intro τ hτ + have hx : ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖ ∈ SV := ⟨τ, hτ, rfl⟩ + have : S_vert z h f = sSup SV := rfl + simpa [this] using (le_csSup hbdd_SV hx) + + have hH : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ + ≤ |(z + h).re - z.re| * S_horiz z h f := by + + have h_bound : ∀ t, t ∈ [[z.re, (z + h).re]] → ‖f (↑t + Complex.I * ↑z.im) - f z‖ ≤ S_horiz z h f := by + intro t ht; exact hC_horiz t ht + have h_int : ∀ t ∈ Ι z.re (z + h).re, ‖f (↑t + Complex.I * ↑z.im) - f z‖ ≤ S_horiz z h f := by + intro t ht + have ht_uIcc : t ∈ Set.uIcc z.re (z + h).re := by + + exact Set.uIoc_subset_uIcc ht + exact h_bound t ht_uIcc + have := intervalIntegral.norm_integral_le_of_norm_le_const h_int + convert this using 1 + ring + + have hV : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ + ≤ |(z + h).im - z.im| * S_vert z h f := by + have h_bound : ∀ τ, τ ∈ [[z.im, (z + h).im]] → ‖f (↑(z + h).re + Complex.I * ↑τ) - f z‖ ≤ S_vert z h f := by + intro τ hτ; exact hC_vert τ hτ + have h_int : ∀ τ ∈ Ι z.im (z + h).im, ‖f (↑(z + h).re + Complex.I * ↑τ) - f z‖ ≤ S_vert z h f := by + intro τ hτ + have hτ_uIcc : τ ∈ Set.uIcc z.im (z + h).im := by + + exact Set.uIoc_subset_uIcc hτ + exact h_bound τ hτ_uIcc + have := intervalIntegral.norm_integral_le_of_norm_le_const h_int + rwa [mul_comm] at this + + have hre' : (z + h).re - z.re = h.re := by + simp [Complex.add_re] + have him' : (z + h).im - z.im = h.im := by + simp [Complex.add_im] + have hre : |(z + h).re - z.re| = |h.re| := by simp + have him : |(z + h).im - z.im| = |h.im| := by simp + + have hH' : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ + ≤ |h.re| * S_max z h f := by + have : S_horiz z h f ≤ S_max z h f := by exact le_max_left _ _ + + have hH_rewritten : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ≤ |h.re| * S_horiz z h f := by + rwa [hre] at hH + + have h_bound := mul_le_mul_of_nonneg_left this (abs_nonneg (h.re)) + exact le_trans hH_rewritten h_bound + + have hV' : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ + ≤ |h.im| * S_max z h f := by + have : S_vert z h f ≤ S_max z h f := by exact le_max_right _ _ + + have hV_rewritten : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ≤ |h.im| * S_vert z h f := by + rwa [him] at hV + + have h_bound := mul_le_mul_of_nonneg_left this (abs_nonneg (h.im)) + exact le_trans hV_rewritten h_bound + + have := + calc + ‖(∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ + ≤ ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ + + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ := hsplit + _ = ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ + + ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ := by simp + _ ≤ |h.re| * S_max z h f + |h.im| * S_max z h f := add_le_add hH' hV' + + simpa [Err] using this + +lemma S_horiz_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_horiz z h f := by + + unfold S_horiz + apply Real.sSup_nonneg + intro r hr; rcases hr with ⟨t, ht, rfl⟩; exact norm_nonneg _ + +lemma S_max_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_max z h f := by + unfold S_max + have h1 : 0 ≤ S_horiz z h f := S_horiz_nonneg z h f + exact le_trans h1 (le_max_left _ _) + +lemma bound_on_Err_ratio + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) + (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) + (hh : h ≠ 0) : + ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ≤ 2 * S_max z h f := by + + have h_abs_eq : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ = ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ := rfl + + have h1 := bound_on_Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw + + rw [← add_mul] at h1 + + have h_norm_pos : 0 < ‖h‖ := norm_pos_iff.mpr hh + + have h2 : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h‖ / ‖h‖ ≤ + (|h.re| + |h.im|) * S_max z h f / ‖h‖ := by + exact div_le_div_of_nonneg_right h1 (le_of_lt h_norm_pos) + + rw [← norm_div] at h2 + + have h2' : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ≤ + (|h.re| + |h.im|) / ‖h‖ * S_max z h f := by + rw [← div_mul_eq_mul_div] at h2 + exact h2 + + have h3 : |h.re| + |h.im| ≤ 2 * ‖h‖ := by + + calc |h.re| + |h.im| + ≤ ‖h‖ + ‖h‖ := add_le_add (Complex.abs_re_le_norm h) (Complex.abs_im_le_norm h) + _ = 2 * ‖h‖ := by ring + + have h4 : (|h.re| + |h.im|) / ‖h‖ ≤ 2 := by + + rw [div_le_iff₀ h_norm_pos] + exact h3 + + calc ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ + ≤ (|h.re| + |h.im|) / ‖h‖ * S_max z h f := h2' + _ ≤ 2 * S_max z h f := mul_le_mul_of_nonneg_right h4 (S_max_nonneg z h f) +open Filter Topology + +lemma abs_horizontal_diff_eq_abs_real (z : ℂ) (t : ℝ) : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := by + + have h : (t : ℂ) + Complex.I * z.im - z = (t - z.re : ℂ) := by + apply Complex.ext_iff.mpr + constructor + · + simp only [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.mul_re, + Complex.I_re, Complex.I_im, Complex.ofReal_im] + ring + · + simp only [Complex.add_im, Complex.sub_im, Complex.ofReal_im, Complex.mul_im, + Complex.I_re, Complex.I_im, Complex.ofReal_re] + ring + + rw [h] + + rw [← Complex.ofReal_sub] + + rw [Complex.norm_real, Real.norm_eq_abs] + +lemma abs_sub_le_of_mem_uIcc (a b t : ℝ) (ht : t ∈ Set.uIcc a b) : |t - a| ≤ |b - a| ∧ |b - t| ≤ |b - a| := by + + have h1 : a ≤ b ∨ b ≤ a := le_total a b + rcases h1 with hle | hle + · + have ht' : t ∈ Set.Icc a b := by simpa [Set.uIcc_of_le hle] using ht + have h_bounds : a ≤ t ∧ t ≤ b := by simpa using ht' + constructor + · have h_ta : |t - a| = t - a := by simp [abs_of_nonneg (sub_nonneg.mpr h_bounds.left)] + have h_ba : |b - a| = b - a := by simp [abs_of_nonneg (sub_nonneg.mpr hle)] + rw [h_ta, h_ba] + exact sub_le_sub_right h_bounds.right a + · have h_bt : |b - t| = b - t := by simp [abs_of_nonneg (sub_nonneg.mpr h_bounds.right)] + have h_ba : |b - a| = b - a := by simp [abs_of_nonneg (sub_nonneg.mpr hle)] + rw [h_bt, h_ba] + exact sub_le_sub_left h_bounds.left b + · + have ht' : t ∈ Set.Icc b a := by + rw [Set.uIcc_comm] at ht + simpa [Set.uIcc_of_le hle] using ht + have h_bounds : b ≤ t ∧ t ≤ a := by simpa using ht' + constructor + · have h_ta : |t - a| = a - t := by simp [abs_of_nonpos (sub_nonpos.mpr h_bounds.right)] + have h_ba : |b - a| = a - b := by simp [abs_of_nonpos (sub_nonpos.mpr hle)] + rw [h_ta, h_ba] + exact sub_le_sub_left h_bounds.left a + · have h_bt : |b - t| = t - b := by + rw [abs_of_nonpos (sub_nonpos.mpr h_bounds.left)] + ring + have h_ba : |b - a| = a - b := by simp [abs_of_nonpos (sub_nonpos.mpr hle)] + rw [h_bt, h_ba] + exact sub_le_sub_right h_bounds.right b + +lemma sub_ofReal_add_I (a b c d : ℝ) : ((a : ℂ) + Complex.I * b) - ((c : ℂ) + Complex.I * d) = ((a - c : ℝ) : ℂ) + Complex.I * (b - d) := by + apply Complex.ext + · + simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.I_mul_re, Complex.ofReal_im, neg_zero, add_zero] + + rw [← Complex.ofReal_sub, Complex.ofReal_im, neg_zero, add_zero] + · + simp only [Complex.sub_im, Complex.add_im, Complex.ofReal_im, Complex.I_mul_im, Complex.ofReal_re, zero_add] + + rw [← Complex.ofReal_sub, Complex.ofReal_re] + +lemma abs_re_im_bound (a b : ℝ) : ‖(a : ℂ) + Complex.I * b‖ ≤ |a| + |b| := by + + have triangle := lem_triangle_ineq (a : ℂ) (Complex.I * (b : ℂ)) + convert triangle + · + simp [Complex.norm_real, Real.norm_eq_abs] + · + simp [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs] + +lemma norm_ofReal (x : ℝ) : ‖(x : ℂ)‖ = |x| := by + simp [Complex.norm_real, Real.norm_eq_abs] + +lemma norm_I_mul_ofReal (b : ℝ) : ‖Complex.I * (b : ℂ)‖ = |b| := by + simp [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs] + +lemma abs_add_Ile (a b : ℝ) : ‖(a : ℂ) + Complex.I * b‖ ≤ |a| + |b| := by + + have h := Complex.norm_le_abs_re_add_abs_im (a + Complex.I * b) + + have re_eq : (a + Complex.I * b).re = a := by + simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im] + have im_eq : (a + Complex.I * b).im = b := by + simp [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im] + rw [re_eq, im_eq] at h + exact h + +lemma abs_vertical_diff_le_core (z h : ℂ) (τ : ℝ) : ‖((z + h).re - z.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |(z + h).re - z.re| + |τ - z.im| := by + + let a : ℝ := (z + h).re - z.re + let b : ℝ := τ - z.im + + have h_eq : ((z + h).re - z.re : ℝ) + Complex.I * (τ - z.im) = (a : ℂ) + Complex.I * (b : ℂ) := by + simp only [a, b] + + rw [← Complex.ofReal_sub τ z.im] + + rw [h_eq] + have triangle := Complex.norm_le_abs_re_add_abs_im ((a : ℂ) + Complex.I * (b : ℂ)) + + have re_calc : ((a : ℂ) + Complex.I * (b : ℂ)).re = a := by + simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im] + ring + + have im_calc : ((a : ℂ) + Complex.I * (b : ℂ)).im = b := by + simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_im, Complex.ofReal_re] + ring + + rw [re_calc, im_calc] at triangle + simp only [a, b] at triangle + exact triangle + +lemma abs_vertical_core (z h : ℂ) (τ : ℝ) : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |h.re| + |τ - z.im| := by + + have h1 : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |((h.re : ℝ) + Complex.I * (τ - z.im)).re| + |((h.re : ℝ) + Complex.I * (τ - z.im)).im| := by + apply Complex.norm_le_abs_re_add_abs_im + + have h2 : ((h.re : ℝ) + Complex.I * (τ - z.im)).re = h.re := by simp + have h3 : ((h.re : ℝ) + Complex.I * (τ - z.im)).im = τ - z.im := by simp + + rw [h2, h3] at h1 + exact h1 + +lemma S_vert_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_vert z h f := by + unfold S_vert + apply Real.sSup_nonneg + intro r hr; rcases hr with ⟨τ, hτ, rfl⟩; exact norm_nonneg _ + +lemma abs_im_le_norm (z : ℂ) : |z.im| ≤ ‖z‖ := by + exact Complex.abs_im_le_norm z + +lemma mem_closedBall_mono_radius {z : ℂ} {r R : ℝ} (hz : z ∈ Metric.closedBall (0 : ℂ) r) (h : r ≤ R) : z ∈ Metric.closedBall (0 : ℂ) R := by + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using le_trans (by simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz) h + +lemma tendsto_of_nonneg_local_bound {g : ℂ → ℝ} + (h_nonneg : ∀ h, 0 ≤ g h) + (h_loc : ∀ ε > 0, ∃ δ > 0, ∀ h, ‖h‖ < δ → g h ≤ ε) : + Tendsto g (𝓝 (0:ℂ)) (𝓝 (0:ℝ)) := by + rw [Metric.tendsto_nhds_nhds] + intro ε hε + + have hε_half : (0 : ℝ) < ε / 2 := by linarith + obtain ⟨δ, hδ_pos, hδ⟩ := h_loc (ε / 2) hε_half + use δ + exact ⟨hδ_pos, fun h hh_dist => by + rw [Real.dist_eq, sub_zero] + rw [abs_of_nonneg (h_nonneg h)] + have : g h ≤ ε / 2 := hδ h (by rwa [Complex.dist_eq, sub_zero] at hh_dist) + linarith⟩ + +lemma sum_abs_le_two_mul {x y A : ℝ} (hx : |x| ≤ A) (hy : |y| ≤ A) : |x| + |y| ≤ (2:ℝ) * A := by + have := add_le_add hx hy + simpa [two_mul] using this + +lemma two_norm_lt_of_norm_lt_half {h : ℂ} {δ : ℝ} (_hpos : 0 < δ) (hbound : ‖h‖ < δ/2) : (2:ℝ) * ‖h‖ < δ := by + have := mul_lt_mul_of_pos_left hbound (by norm_num : (0:ℝ) < 2) + simpa [two_mul, add_halves] using this + +lemma limit_of_S_is_zero + {r1 R R0 : ℝ} + (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : + Tendsto (fun h => S_max z h f) (𝓝 0) (𝓝 0) := by + + have f_cont_at_z : ContinuousAt f z := by + + have hz_in_R : z ∈ Metric.closedBall (0 : ℂ) R := + mem_closedBall_mono_radius hz (le_of_lt hr1_lt_R) + + exact (hf z hz_in_R).continuousAt + + apply tendsto_of_nonneg_local_bound + · + exact fun h => S_max_nonneg z h f + · + intro ε hε_pos + + rw [Metric.continuousAt_iff] at f_cont_at_z + obtain ⟨δ₁, hδ₁_pos, hf_bound⟩ := f_cont_at_z ε hε_pos + + use δ₁ / 2 + constructor + · exact half_pos hδ₁_pos + · intro h hh_norm + + unfold S_max + apply max_le + + · unfold S_horiz + + apply Real.sSup_le + · + intro r hr + obtain ⟨t, ht, rfl⟩ := hr + + have key_dist : dist ((t : ℂ) + Complex.I * z.im) z < δ₁ := by + + rw [dist_eq] + + have eq_transform : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := abs_horizontal_diff_eq_abs_real z t + simp [eq_transform] + + have t_bound : |t - z.re| ≤ |(z + h).re - z.re| := (abs_sub_le_of_mem_uIcc z.re (z + h).re t ht).1 + have re_diff_le : |(z + h).re - z.re| ≤ ‖h‖ := by + + simpa [Complex.add_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using (Complex.abs_re_le_norm h) + have h_bound : ‖h‖ < δ₁ / 2 := hh_norm + calc |t - z.re| + _ ≤ |(z + h).re - z.re| := t_bound + _ ≤ ‖h‖ := re_diff_le + _ < δ₁ / 2 := h_bound + _ < δ₁ := by linarith + + have f_dist := hf_bound key_dist + + rw [dist_eq] at f_dist + + exact le_of_lt f_dist + · + exact le_of_lt hε_pos + + · unfold S_vert + apply Real.sSup_le + · + intro r hr + obtain ⟨τ, hτ, rfl⟩ := hr + + have key_dist : dist (((z + h).re : ℂ) + Complex.I * τ) z < δ₁ := by + rw [dist_eq] + + have h_eq : (((z + h).re : ℂ) + Complex.I * τ - z) = (h.re : ℝ) + Complex.I * (τ - z.im) := by + apply Complex.ext_iff.mpr + constructor + · simp [Complex.add_re, Complex.sub_re] + · simp [Complex.add_im, Complex.sub_im] + rw [h_eq] + + have τ_bound0 : |τ - z.im| ≤ |(z + h).im - z.im| := (abs_sub_le_of_mem_uIcc z.im (z + h).im τ hτ).1 + have im_diff_eq : |(z + h).im - z.im| = |h.im| := by + simp [Complex.add_im, sub_eq_add_neg, add_assoc] + have τ_bound : |τ - z.im| ≤ |h.im| := by simpa [im_diff_eq] using τ_bound0 + + have vertical_bound : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |h.re| + |τ - z.im| := + abs_vertical_core z h τ + have sum_bound : |h.re| + |τ - z.im| ≤ |h.re| + |h.im| := by + exact add_le_add_right τ_bound _ + have norm_bound := sum_abs_le_two_mul (Complex.abs_re_le_norm h) (Complex.abs_im_le_norm h) + have h_bound : ‖h‖ < δ₁ / 2 := hh_norm + have final_bound := two_norm_lt_of_norm_lt_half hδ₁_pos h_bound + calc ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ + _ ≤ |h.re| + |τ - z.im| := vertical_bound + _ ≤ |h.re| + |h.im| := sum_bound + _ ≤ (2 : ℝ) * ‖h‖ := norm_bound + _ < δ₁ := final_bound + + have f_dist := hf_bound key_dist + rw [dist_eq] at f_dist + + exact le_of_lt f_dist + · + exact le_of_lt hε_pos + +lemma eventually_corner_and_sum_in_closedBall {z : ℂ} {R' : ℝ} + (hz : ‖z‖ < R') : + ∀ᶠ h in 𝓝 (0:ℂ), + (z + h) ∈ Metric.closedBall (0 : ℂ) R' ∧ + (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) R' := by + + have hρ_pos : 0 < R' - ‖z‖ := sub_pos.mpr hz + have h_small : ∀ᶠ h in 𝓝 (0:ℂ), h ∈ Metric.ball (0 : ℂ) (R' - ‖z‖) := + Metric.ball_mem_nhds (0 : ℂ) hρ_pos + refine h_small.mono ?_ + intro h hhball + have hnorm_lt : ‖h‖ < R' - ‖z‖ := by + simpa [Metric.mem_ball, Complex.dist_eq, sub_zero] using hhball + + have hsum_lt : ‖z‖ + ‖h‖ < R' := by + have htemp : ‖z‖ + ‖h‖ < ‖z‖ + (R' - ‖z‖) := add_lt_add_right hnorm_lt _ + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using htemp + have hzph_le : ‖z + h‖ ≤ R' := + le_of_lt (lt_of_le_of_lt (norm_add_le _ _) hsum_lt) + have hzph_mem : (z + h) ∈ Metric.closedBall (0 : ℂ) R' := by + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hzph_le + + let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im + + have tri : ‖w‖ ≤ ‖w - z‖ + ‖z‖ := by + have := norm_add_le (w - z) z + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + + let t : ℝ := (z + h).re + have hwz_eq : w - z = (t : ℂ) + Complex.I * z.im - z := by + simp [w, t, sub_eq_add_neg, add_assoc] + have eq_transform : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := + abs_horizontal_diff_eq_abs_real z t + have t_sub_re : t - z.re = h.re := by + simp [t, Complex.add_re, sub_eq_add_neg, add_assoc] + have hwz_abs2 : ‖w - z‖ = |h.re| := by + simpa [hwz_eq, t_sub_re] using eq_transform + have hwz_le : ‖w - z‖ ≤ ‖h‖ := by + simpa [hwz_abs2] using (Complex.abs_re_le_norm h) + have hw_le'' : ‖w‖ ≤ ‖h‖ + ‖z‖ := by + exact le_trans tri (add_le_add_left hwz_le _) + have hw_lt : ‖w‖ < R' := by + have : ‖h‖ + ‖z‖ < R' := by simpa [add_comm] using hsum_lt + exact lt_of_le_of_lt hw_le'' this + have hw_mem : w ∈ Metric.closedBall (0 : ℂ) R' := by + simpa [w, Metric.mem_closedBall, Complex.dist_eq, sub_zero] using (le_of_lt hw_lt) + exact And.intro hzph_mem hw_mem + +lemma limit_of_Err_ratio_is_zero + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : + Tendsto (fun h => Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h) (𝓝 0) (𝓝 0) := by + + set g : ℂ → ℂ := fun h => Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h + + have hS : Tendsto (fun h => S_max z h f) (𝓝 0) (𝓝 0) := + limit_of_S_is_zero (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz + + have h_upper : Tendsto (fun h => |(2 : ℝ) * S_max z h f|) (𝓝 0) (𝓝 0) := by + have hcont : Continuous fun x : ℝ => |(2 : ℝ) * x| := + (continuous_const.mul continuous_id).abs + have h0 := hcont.tendsto (0 : ℝ) + simpa only [Function.comp_def, mul_zero, abs_zero] using h0.comp hS + + have h_lower_nonneg : ∀ᶠ h in 𝓝 0, 0 ≤ ‖g h‖ := + Filter.Eventually.of_forall (fun _ => by simpa [g] using (norm_nonneg (g _))) + + let δ : ℝ := (R - r1) / 2 + have hδ_pos : 0 < δ := by + have : 0 < R - r1 := sub_pos.mpr hr1_lt_R + simpa [δ] using half_pos this + let R' : ℝ := r1 + δ + have hR'_pos : 0 < R' := by + have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) + simpa [R'] using this + have hR'_lt_R : R' < R := by + have hδlt : δ < R - r1 := by + simpa [δ] using (half_lt_self (sub_pos.mpr hr1_lt_R)) + have : r1 + δ < r1 + (R - r1) := add_lt_add_right hδlt r1 + simpa [R', sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + + have hz_le_r1 : ‖z‖ ≤ r1 := by + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz + have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by + have hr1_le_R' : r1 ≤ R' := by + have : 0 ≤ δ := le_of_lt hδ_pos + simpa [R'] using (le_add_of_nonneg_right this : r1 ≤ r1 + δ) + have : ‖z‖ ≤ R' := le_trans hz_le_r1 hr1_le_R' + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this + + have h_event : ∀ᶠ h in 𝓝 0, ‖g h‖ ≤ |(2 : ℝ) * S_max z h f| := by + + have hcorner := eventually_corner_and_sum_in_closedBall (z:=z) (R':=R') (hz := by + + have : ‖z‖ ≤ r1 := hz_le_r1 + exact lt_of_le_of_lt this (by simpa [R'] using (lt_add_of_pos_right r1 hδ_pos))) + refine hcorner.mono ?_ + intro h hh + have hzh' : z + h ∈ Metric.closedBall (0 : ℂ) R' := hh.1 + have hw' : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) R' := hh.2 + by_cases hh0 : h = 0 + · have : 0 ≤ |(2 : ℝ) * S_max z h f| := abs_nonneg _ + simp [g, hh0, div_zero, norm_zero] + · + have hb := + bound_on_Err_ratio (r1:=R') (R:=R) (R0:=R0) + hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf (z:=z) (h:=h) hz' hzh' hw' hh0 + have hb' : ‖g h‖ ≤ 2 * S_max z h f := by + simpa [g, norm, Err] using hb + exact le_trans hb' (le_abs_self ((2 : ℝ) * S_max z h f)) + + have h_norm_tendsto : Tendsto (fun h => ‖g h‖) (𝓝 0) (𝓝 0) := by + refine Filter.Tendsto.squeeze' tendsto_const_nhds h_upper h_lower_nonneg h_event + + have h_dist_tendsto : Tendsto (fun h => dist (g h) 0) (𝓝 0) (𝓝 0) := by + simpa [dist_eq_norm] using h_norm_tendsto + simpa [g] using (tendsto_iff_dist_tendsto_zero).2 h_dist_tendsto + +open Classical + +noncomputable def If_ext + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : ℂ → ℂ := + fun w => + if h : w ∈ Metric.closedBall (0 : ℂ) r1 then + If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, h⟩ + else + 0 + +lemma If_ext_eq_taxicab_of_mem {r1 R R0 : ℝ} (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {w : ℂ} (hw : w ∈ Metric.closedBall (0 : ℂ) r1) : + If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w + = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := by + classical + simp [If_ext, hw] + +lemma If_taxicab_param_invariance {r1₁ r1₂ R R0 : ℝ} + (hr1₁_pos : 0 < r1₁) (hr1₁_lt_R : r1₁ < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + (hr1₂_pos : 0 < r1₂) (hr1₂_lt_R : r1₂ < R) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {w : ℂ} + (hw₁ : w ∈ Metric.closedBall (0 : ℂ) r1₁) + (hw₂ : w ∈ Metric.closedBall (0 : ℂ) r1₂) : + If_taxicab hr1₁_pos hr1₁_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw₁⟩ + = If_taxicab hr1₂_pos hr1₂_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw₂⟩ := by + + simp [If_taxicab] + +lemma derivWithin_eq_deriv_of_isOpen_mem {s : Set ℂ} (hs : IsOpen s) {f : ℂ → ℂ} {z : ℂ} + (hz : z ∈ s) : derivWithin f s z = deriv f z := by + simpa using (derivWithin_of_isOpen (f := f) (s := s) (x := z) hs hz) + +lemma eventually_decomposition_for_ext + {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + (z : ℂ) (hz : ‖z‖ < R') : + ∀ᶠ h in 𝓝 (0:ℂ), + let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf + g (z + h) - g z = f z * h + Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h := by + + have h_event := eventually_corner_and_sum_in_closedBall (z:=z) (R':=R') hz + refine h_event.mono ?_ + intro h hh + + let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf + + have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by + have : ‖z‖ ≤ R' := le_of_lt hz + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this + + have hgzh : g (z + h) + = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hh.1⟩ := by + simpa [g] using + If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=z + h) hh.1 + have hgz : g z + = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz'⟩ := by + simpa [g] using + If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=z) hz' + + have H := + If_diff_decomposition_final (r1:=R') (R:=R) (R0:=R0) + hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) + (z:=z) (h:=h) + (hz:=hz') (hzh:=hh.1) (hw:=hh.2) + + calc + g (z + h) - g z + = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hh.1⟩ + - If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz'⟩ := by + simp [hgzh, hgz] + _ = f z * h + Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h := by + simpa using H + +lemma tendsto_Err_ratio_radius (R' R R0 : ℝ) (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z : ℂ} (hz : ‖z‖ < R') : + Tendsto (fun h => Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h / h) (𝓝 0) (𝓝 0) := by + + have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by + have : ‖z‖ ≤ R' := le_of_lt hz + simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this + + simpa using + (limit_of_Err_ratio_is_zero (r1:=R') (R:=R) (R0:=R0) + hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf (z:=z) (hz:=hz')) + +lemma If_ext_eq_taxicab_at_sum {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z h : ℂ} + (hzh : z + h ∈ Metric.closedBall (0 : ℂ) R') : + If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (z + h) + = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ := by + simpa using + (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) + hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) (w:=z + h) hzh) + +lemma If_ext_eq_taxicab_at_point {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) + {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) R') : + If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z + = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ := by + simpa using + (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) + hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) (w:=z) hz) + +lemma hasDerivWithinAt_congr_eqOn {f g : ℂ → ℂ} {s : Set ℂ} {z f' : ℂ} + (hEq : Set.EqOn f g s) (hz : z ∈ s) : + HasDerivWithinAt g f' s z → HasDerivWithinAt f f' s z := by + intro hg + have hfg : ∀ x ∈ s, f x = g x := fun x hx => hEq hx + simpa using (HasDerivWithinAt.congr_of_mem (h := hg) (hs := hfg) (hx := hz)) + +lemma differentiableOn_of_hasDerivWithinAt {f : ℂ → ℂ} {s : Set ℂ} {F : ℂ → ℂ} + (h : ∀ z ∈ s, HasDerivWithinAt f (F z) s z) : DifferentiableOn ℂ f s := by + intro z hz + exact (h z hz).differentiableWithinAt + +lemma If_ext_agree_on_smallBall {r1 R' R R0 : ℝ} + (hr1_pos : 0 < r1) (hR'_pos : 0 < R') (hr1_lt_R : r1 < R) (hR'_lt_R : R' < R) (hr1_lt_R' : r1 < R') (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : + Set.EqOn (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) + (If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf) + (Metric.closedBall (0 : ℂ) r1) := by + intro w hw + + have hw' : w ∈ Metric.closedBall (0 : ℂ) R' := + mem_closedBall_mono_radius (z:=w) (r:=r1) (R:=R') hw (le_of_lt hr1_lt_R') + + have hleft : + If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w + = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := by + simpa using + (If_ext_eq_taxicab_of_mem (r1:=r1) (R:=R) (R0:=R0) + hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf (w:=w) hw) + have hright : + If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf w + = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw'⟩ := by + simpa using + (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) + hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=w) hw') + + have hparam := + If_taxicab_param_invariance (r1₁:=r1) (r1₂:=R') (R:=R) (R0:=R0) + hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hR'_pos hR'_lt_R hf (w:=w) hw hw' + + calc + If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w + = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := hleft + _ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw'⟩ := hparam + _ = If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf w := by + simpa using hright.symm + +lemma hasDerivAt_of_local_decomposition' (g : ℂ → ℂ) (z F : ℂ) + (Err_func : ℂ → ℂ) + (hdecomp : ∀ᶠ h in 𝓝 (0:ℂ), g (z + h) - g z = F * h + Err_func h) + (hErr : Tendsto (fun h => Err_func h / h) (𝓝 (0:ℂ)) (𝓝 (0:ℂ))) : + HasDerivAt g F z := by + + have hdecomp_within : ∀ᶠ h in 𝓝[≠] (0:ℂ), g (z + h) - g z = F * h + Err_func h := + (hdecomp.filter_mono (nhdsWithin_le_nhds : 𝓝[≠] (0:ℂ) ≤ 𝓝 (0:ℂ))) + + have h_ne0 : ∀ᶠ h in 𝓝[≠] (0:ℂ), h ≠ 0 := by + filter_upwards [eventually_mem_nhdsWithin (a := (0 : ℂ)) (s := ({0}ᶜ : Set ℂ))] with h hh + simpa only [Set.mem_compl_iff, Set.mem_singleton_iff] using hh + + have h_eq_slope : ∀ᶠ h in 𝓝[≠] (0:ℂ), + h⁻¹ • (g (z + h) - g z) = F + Err_func h / h := by + refine (hdecomp_within.and h_ne0).mono ?_ + intro h hh + rcases hh with ⟨hEq, hne⟩ + + have H0 : h⁻¹ • (g (z + h) - g z) = h⁻¹ • (F * h + Err_func h) := by + simpa using congrArg (fun x => h⁻¹ • x) hEq + + have h1 : h⁻¹ * (F * h) = F := by + have hne' : h ≠ 0 := hne + calc + h⁻¹ * (F * h) = F * (h⁻¹ * h) := by + ac_rfl + _ = F * 1 := by simp [hne'] + _ = F := by simp + have h2 : h⁻¹ * Err_func h = Err_func h / h := by + simp [div_eq_mul_inv, mul_comm] + calc + h⁻¹ • (g (z + h) - g z) + = h⁻¹ • (F * h + Err_func h) := H0 + _ = h⁻¹ * (F * h + Err_func h) := by simp [smul_eq_mul] + _ = h⁻¹ * (F * h) + h⁻¹ * (Err_func h) := by simp [mul_add] + _ = F + Err_func h / h := by simp [h1, h2] + + have hErr_within : Tendsto (fun h => Err_func h / h) (𝓝[≠] (0:ℂ)) (𝓝 (0:ℂ)) := + hErr.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0:ℂ) ≤ 𝓝 (0:ℂ)) + have h_const : Tendsto (fun _ : ℂ => F) (𝓝[≠] (0:ℂ)) (𝓝 F) := tendsto_const_nhds + have h_sum : Tendsto (fun h => F + Err_func h / h) (𝓝[≠] (0:ℂ)) (𝓝 (F + 0)) := + h_const.add hErr_within + have h_target : Tendsto (fun h => h⁻¹ • (g (z + h) - g z)) (𝓝[≠] (0:ℂ)) (𝓝 F) := by + have := (Filter.tendsto_congr' h_eq_slope).2 h_sum + simpa [zero_add] using this + + exact (hasDerivAt_iff_tendsto_slope_zero).2 h_target + +lemma uniqueDiffWithinAt_convex_complex {s : Set ℂ} (hconv : Convex ℝ s) + (hs : (interior s).Nonempty) {x : ℂ} (hx : x ∈ closure s) : + UniqueDiffWithinAt ℂ s x := by + + have hR : UniqueDiffWithinAt ℝ s x := + uniqueDiffWithinAt_convex (E := ℂ) (conv := hconv) (hs := hs) (x := x) (hx := hx) + + have dR : Dense ((Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) : Set ℂ) := by + simpa using (hR.dense_tangentConeAt) + + have h_tc_subset : tangentConeAt ℝ s x ⊆ tangentConeAt ℂ s x := + tangentConeAt_mono_field + + set TC : Set ℂ := tangentConeAt ℂ s x + set Sℂ : Submodule ℂ ℂ := Submodule.span ℂ TC + set Sℝ : Submodule ℝ ℂ := Sℂ.restrictScalars ℝ + have h_span_le : (Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) ≤ Sℝ := by + + refine Submodule.span_le.mpr ?_ + intro v hv + have hv' : v ∈ TC := h_tc_subset hv + have : v ∈ Sℂ := Submodule.subset_span hv' + simpa [Sℝ] using this + + have hsubset_sets : + ((Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) : Set ℂ) + ⊆ ((Sℂ : Submodule ℂ ℂ) : Set ℂ) := by + intro z hz + have hz' : z ∈ Sℝ := h_span_le hz + simpa [Sℝ] using hz' + have dC : Dense ((Sℂ : Submodule ℂ ℂ) : Set ℂ) := dR.mono hsubset_sets + + exact ⟨dC, hx⟩ + +lemma interior_closedBall_nonempty_of_pos {R : ℝ} (hR_pos : 0 < R) : + (interior (Metric.closedBall (0 : ℂ) R)).Nonempty := by + + have h0mem : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by + simpa [Metric.mem_ball, Complex.dist_eq, sub_zero] using hR_pos + + have hsub : Metric.ball (0 : ℂ) R ⊆ interior (Metric.closedBall (0 : ℂ) R) := + Metric.ball_subset_interior_closedBall + + exact ⟨0, hsub h0mem⟩ + +lemma mem_closure_of_mem_closedBall {R : ℝ} {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) R) : + z ∈ closure (Metric.closedBall (0 : ℂ) R) := by + exact subset_closure hz + +lemma uniqueDiffWithinAt_closedBall_complex_of_mem {R : ℝ} {z : ℂ} + (hR_pos : 0 < R) (hz : z ∈ Metric.closedBall (0 : ℂ) R) : + UniqueDiffWithinAt ℂ (Metric.closedBall (0 : ℂ) R) z := +by + + have hconv : Convex ℝ (Metric.closedBall (0 : ℂ) R) := + convex_closedBall (0 : ℂ) R + + have hnonempty : (interior (Metric.closedBall (0 : ℂ) R)).Nonempty := + interior_closedBall_nonempty_of_pos (R := R) hR_pos + + have hz_cl : z ∈ closure (Metric.closedBall (0 : ℂ) R) := + mem_closure_of_mem_closedBall (R := R) (z := z) hz + + exact uniqueDiffWithinAt_convex_complex hconv hnonempty hz_cl + +lemma If_is_differentiable_on + {r1 R R0 : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) + {f : ℂ → ℂ} + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : + DifferentiableOn ℂ (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (Metric.closedBall (0 : ℂ) r1) + ∧ + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + derivWithin (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (Metric.closedBall (0 : ℂ) r1) z = f z := by + set s : Set ℂ := Metric.closedBall (0 : ℂ) r1 + have hHasDerivWithinAt : ∀ z ∈ s, + HasDerivWithinAt (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (f z) s z := by + intro z hz + + let δ : ℝ := (R - r1) / 2 + have hδ_pos : 0 < δ := by + have : 0 < R - r1 := sub_pos.mpr hr1_lt_R + simpa [δ] using half_pos this + let R' : ℝ := r1 + δ + have hR'_pos : 0 < R' := by + have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) + simpa [R'] using this + have hR'_lt_R : R' < R := by + have hδlt : δ < R - r1 := by + have : 0 < R - r1 := sub_pos.mpr hr1_lt_R + simpa [δ] using (half_lt_self this) + have : r1 + δ < r1 + (R - r1) := add_lt_add_right hδlt r1 + simpa [R', sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + have hr1_lt_R' : r1 < R' := by + have : r1 < r1 + δ := by simpa [add_comm, add_left_comm, add_assoc, R', δ] using (lt_of_le_of_lt (le_of_eq rfl) (add_lt_add_right hδ_pos r1)) + simpa [R'] using this + + have hz_le_r1 : ‖z‖ ≤ r1 := by + simpa [s, Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz + have hz_lt_R' : ‖z‖ < R' := lt_of_le_of_lt hz_le_r1 (by simpa [R'] using (lt_add_of_pos_right r1 hδ_pos)) + + let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf + + have hdecomp := eventually_decomposition_for_ext (R':=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf z hz_lt_R' + + have hErr := tendsto_Err_ratio_radius (R':=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf hz_lt_R' + + have hDerivAt_g : HasDerivAt g (f z) z := + hasDerivAt_of_local_decomposition' (g := g) (z := z) (F := f z) + (Err_func := fun h => Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h) + (hdecomp := by + + simpa [g] using hdecomp) + (hErr := by + + simpa using hErr) + + have hWithin_g : HasDerivWithinAt g (f z) s z := hDerivAt_g.hasDerivWithinAt + + have hEq : Set.EqOn (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) + (If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf) + s := + If_ext_agree_on_smallBall (r1:=r1) (R':=R') (R:=R) (R0:=R0) + hr1_pos hR'_pos hr1_lt_R hR'_lt_R hr1_lt_R' hR_lt_R0 hR0_lt_one hf + + exact hasDerivWithinAt_congr_eqOn (f := If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) + (g := g) (s := s) (z := z) (f' := f z) hEq hz hWithin_g + + refine And.intro ?hdiff ?hderiv + · + apply differentiableOn_of_hasDerivWithinAt + intro z hz + exact hHasDerivWithinAt z hz + · + intro z hz + have hUD : UniqueDiffWithinAt ℂ s z := + uniqueDiffWithinAt_closedBall_complex_of_mem (R := r1) hr1_pos (z := z) (hz := by simpa [s] using hz) + have hD := hHasDerivWithinAt z hz + simpa using hD.derivWithin hUD + +open scoped Topology + +theorem AnalyticOnNhd.mono_closedBall {B : ℂ → ℂ} {R : ℝ} (R' : ℝ) + (hB : AnalyticOnNhd ℂ B (Metric.closedBall 0 R)) (hR' : R' < R) : + AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by + + exact hB.mono (Metric.closedBall_subset_closedBall (le_of_lt hR')) + +lemma log_deriv_is_analytic + {r1 R' R : ℝ} + (_hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R')) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z ≠ 0) : + AnalyticOnNhd ℂ (fun z => deriv B z / B z) (Metric.closedBall (0 : ℂ) r1) := by + have step1 : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) r1) := by simp [AnalyticOnNhd.mono_closedBall r1 hB hr1_lt_R'] + have hderiv : AnalyticOnNhd ℂ (deriv B) (Metric.closedBall (0 : ℂ) r1) := by + apply AnalyticOnNhd.deriv step1 + + simpa using AnalyticOnNhd.div hderiv step1 hB_ne_zero + +lemma I_is_antiderivative + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) : + ∃ J : ℂ → ℂ, AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1) ∧ + J 0 = 0 ∧ + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z := by + classical + + have hB_on_R' : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R') := + AnalyticOnNhd.mono_closedBall R' hB hR'_lt_R + have hderiv_on_R' : AnalyticOnNhd ℂ (deriv B) (Metric.closedBall (0 : ℂ) R') := + AnalyticOnNhd.deriv hB_on_R' + let L : ℂ → ℂ := fun z => deriv B z / B z + have hL_on_R' : AnalyticOnNhd ℂ L (Metric.closedBall (0 : ℂ) R') := by + simpa [L] using AnalyticOnNhd.div hderiv_on_R' hB_on_R' hB_ne_zero + + let δ : ℝ := (R' - r1) / 2 + have hδ_pos : 0 < δ := by + have : 0 < R' - r1 := sub_pos.mpr hr1_lt_R' + simpa [δ] using half_pos this + let R_mid : ℝ := r1 + δ + have hR_mid_pos : 0 < R_mid := by + have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) + simpa [R_mid] using this + have hr1_lt_R_mid : r1 < R_mid := by + have : 0 < δ := hδ_pos + simpa [R_mid] using (lt_add_of_pos_right r1 this) + have hR_mid_lt_R' : R_mid < R' := by + have hδlt : δ < R' - r1 := by + simpa [δ] using (half_lt_self (sub_pos.mpr hr1_lt_R')) + have : r1 + δ < r1 + (R' - r1) := add_lt_add_right hδlt r1 + simpa [R_mid, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + + let J : ℂ → ℂ := + If_ext (r1 := R_mid) (R := R') (R0 := R) hR_mid_pos hR_mid_lt_R' hR'_lt_R hR_lt_one L hL_on_R' + + have hIf := + (If_is_differentiable_on (r1 := R_mid) (R := R') (R0 := R) + hR_mid_pos hR_mid_lt_R' hR'_lt_R hR_lt_one (f := L) hL_on_R') + have hDiffOn_mid : DifferentiableOn ℂ J (Metric.closedBall (0 : ℂ) R_mid) := by + simpa [J] using hIf.1 + + have hDiffOn_ball_R_mid : DifferentiableOn ℂ J (Metric.ball (0 : ℂ) R_mid) := + hDiffOn_mid.mono Metric.ball_subset_closedBall + + have hJ_analyticOnNhd : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1) := by + intro z hz + + have hz_le : dist z (0 : ℂ) ≤ r1 := by + simpa [Metric.mem_closedBall] using hz + have hz_lt : dist z (0 : ℂ) < R_mid := lt_of_le_of_lt hz_le hr1_lt_R_mid + have hz_ball : z ∈ Metric.ball (0 : ℂ) R_mid := by simpa [Metric.mem_ball] using hz_lt + + exact (DifferentiableOn.analyticAt (s := Metric.ball (0 : ℂ) R_mid) + (f := J) hDiffOn_ball_R_mid (Metric.isOpen_ball.mem_nhds hz_ball)) + + have h0_in_mid : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R_mid := by + simpa [Metric.mem_closedBall, dist_self] using (le_of_lt hR_mid_pos) + have hJ0 : J 0 = 0 := by + simp [J, If_ext, If_taxicab, h0_in_mid] + + have hderiv_eq : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = L z := by + intro z hz + + have hz_le : dist z (0 : ℂ) ≤ r1 := by simpa [Metric.mem_closedBall] using hz + have hz_lt : dist z (0 : ℂ) < R_mid := lt_of_le_of_lt hz_le hr1_lt_R_mid + have hz_ball : z ∈ Metric.ball (0 : ℂ) R_mid := by simpa [Metric.mem_ball] using hz_lt + have hz_cb_mid : z ∈ Metric.closedBall (0 : ℂ) R_mid := Metric.ball_subset_closedBall hz_ball + + have h_cb_nhds : Metric.closedBall (0 : ℂ) R_mid ∈ 𝓝 z := + Filter.mem_of_superset (Metric.isOpen_ball.mem_nhds hz_ball) Metric.ball_subset_closedBall + + have hDW_eq_L : derivWithin J (Metric.closedBall (0 : ℂ) R_mid) z = L z := by + simpa [J] using hIf.2 z hz_cb_mid + + have hHasWithin : HasDerivWithinAt J (derivWithin J (Metric.closedBall (0 : ℂ) R_mid) z) + (Metric.closedBall (0 : ℂ) R_mid) z := + (hDiffOn_mid z hz_cb_mid).hasDerivWithinAt + have hHasWithinL : HasDerivWithinAt J (L z) (Metric.closedBall (0 : ℂ) R_mid) z := by + simpa [hDW_eq_L] + using hHasWithin + + have hHasDerivAt : HasDerivAt J (L z) z := + HasDerivWithinAt.hasDerivAt hHasWithinL h_cb_nhds + + simpa using hHasDerivAt.deriv + + refine ⟨J, hJ_analyticOnNhd, hJ0, ?_⟩ + intro z hz + simpa [L] using hderiv_eq z hz + +noncomputable def H_auxiliary + {r1 R' R : ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) + {B : ℂ → ℂ} + (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + (J : ℂ → ℂ) : ℂ → ℂ := + fun z => Complex.exp (J z) / B z + +lemma exp_I_at_zero + {r1 R' R : ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) + {B : ℂ → ℂ} + (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + Complex.exp (J 0) = 1 := by + simp [hJ_zero] + +lemma H_at_zero + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 = 1 / B 0 := by + simp [H_auxiliary, hJ_zero] + +lemma log_deriv_id + {r1 R' R : ℝ} + (_hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) + {B : ℂ → ℂ} + (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (_hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z * B z = deriv B z := by + intro z hz + + have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by + have hzR' : dist z (0 : ℂ) ≤ r1 := hz + have hR'_le : r1 ≤ R' := le_of_lt (hr1_lt_R') + have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR'_le + simpa using hzR'' + have hBnz : B z ≠ 0 := hB_ne_zero z hzR + have hJd := hJ_deriv z hz + have hmult := congrArg (fun t => t * B z) hJd + have hR2 : (deriv B z / B z) * B z = deriv B z * B z / B z := by + simpa using (div_mul_eq_mul_div (deriv B z) (B z) (B z)) + have hmult' : deriv J z * B z = deriv B z * B z / B z := by + simpa [hR2] using hmult + have hdiv' : deriv B z * B z / B z = deriv B z := by + field_simp [hBnz] + calc + deriv J z * B z = deriv B z * B z / B z := hmult' + _ = deriv B z := by simpa using hdiv' + +lemma log_deriv_identity + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z * B z - deriv B z = 0 := by + intro z hz + have h_eq := log_deriv_id hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + rw [h_eq] + simp + +lemma H_derivative_quotient_rule + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (_hJ_zero : J 0 = 0) + (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = + (deriv (fun w => Complex.exp (J w)) z * B z - deriv B z * Complex.exp (J z)) / (B z)^2 := by + intro z hz + + have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by + have hzR' : dist z (0 : ℂ) ≤ r1 := hz + have hR_le : r1 ≤ R' := le_of_lt (hr1_lt_R') + have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR_le + simpa using hzR'' + + have hB_nz : B z ≠ 0 := hB_ne_zero z hzR + have hB' : AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by + apply AnalyticOnNhd.mono_closedBall R' hB + assumption + have hB_diff : DifferentiableAt ℂ B z := (hB' z hzR).differentiableAt + have hJ_diff : DifferentiableAt ℂ J z := (hJ z hz).differentiableAt + have hF_diff : DifferentiableAt ℂ (fun w => Complex.exp (J w)) z := hJ_diff.cexp + + have h := deriv_div (hc := hF_diff) (hd := hB_diff) (hx := hB_nz) + unfold H_auxiliary + simpa only [Pi.div_def, mul_comm] using h + +lemma exp_I_derivative_chain_rule + {r1 R' R : ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) + {B : ℂ → ℂ} + (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (_hJ_zero : J 0 = 0) + (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + deriv (fun w => Complex.exp (J w)) z = deriv J z * Complex.exp (J z) := by + intro z hz + have hJ_diff : DifferentiableAt ℂ J z := (hJ z hz).differentiableAt + have hJ_has : HasDerivAt J (deriv J z) z := hJ_diff.hasDerivAt + have hcomp := (Complex.hasDerivAt_exp (J z)).comp z hJ_has + + simpa only [Function.comp_def, mul_comm] using hcomp.deriv + +lemma H_derivative_calc + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = + (deriv J z * B z - deriv B z) * Complex.exp (J z) / (B z)^2 := by + intro z hz + + have hquot := H_derivative_quotient_rule hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + + have hchain := exp_I_derivative_chain_rule hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + + rw [hquot, hchain] + + have h1 : deriv J z * Complex.exp (J z) * B z - deriv B z * Complex.exp (J z) = + Complex.exp (J z) * (deriv J z * B z - deriv B z) := by ring + rw [h1] + + ring + +lemma H_derivative_is_zero + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := by + intro z hz + have hcalc := + H_derivative_calc hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + have hident := + log_deriv_identity hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + simpa [hident] using hcalc + +lemma zero_mem_closedBall_zero_radius {r1 : ℝ} (hr1 : 0 ≤ r1) : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) r1 := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hr1 + +lemma H_deriv_zero_on_closedBall + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := by + simpa using + (H_derivative_is_zero hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv) + +lemma H_auxiliary_differentiableOn_closedBall + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) : + DifferentiableOn ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) := +by + + have hsubset : Metric.closedBall (0 : ℂ) r1 ⊆ Metric.closedBall (0 : ℂ) R := by + intro z hz + have hz' : dist z (0 : ℂ) ≤ r1 := by + simpa [Metric.mem_closedBall] using hz + have hle : r1 ≤ R := le_of_lt (lt_trans hr1_lt_R' hR'_lt_R) + have : dist z (0 : ℂ) ≤ R := le_trans hz' hle + simpa [Metric.mem_closedBall] using this + + have hJ_diff : DifferentiableOn ℂ J (Metric.closedBall (0 : ℂ) r1) := + hJ.differentiableOn + have hB_diff_r1 : DifferentiableOn ℂ B (Metric.closedBall (0 : ℂ) r1) := + (hB.differentiableOn).mono hsubset + + have hExp_diff : DifferentiableOn ℂ Complex.exp (Set.univ : Set ℂ) := + (Complex.differentiable_exp.differentiableOn) + have hExp_comp : DifferentiableOn ℂ (fun z => Complex.exp (J z)) (Metric.closedBall (0 : ℂ) r1) := by + refine hExp_diff.comp hJ_diff ?_ + intro x hx; simp + + have hB_ne_zero_r1 : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z ≠ 0 := by + intro z hz; exact hB_ne_zero z (by + have x : Metric.closedBall 0 r1 ⊆ Metric.closedBall 0 R' := Metric.closedBall_subset_closedBall (le_of_lt hr1_lt_R') + simp + simp at hz + linarith + ) + + have hdiv : DifferentiableOn ℂ (fun z => Complex.exp (J z) / B z) + (Metric.closedBall (0 : ℂ) r1) := + hExp_comp.div hB_diff_r1 hB_ne_zero_r1 + + unfold H_auxiliary + exact hdiv + +lemma hasDerivAt_H_auxiliary_zero_on_closedBall + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + HasDerivAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) 0 z := by + intro z hz + + have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by + have hzR' : dist z (0 : ℂ) ≤ r1 := by + simpa [Metric.mem_closedBall] using hz + have hR_le : r1 ≤ R' := le_of_lt (hr1_lt_R') + have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR_le + simpa [Metric.mem_closedBall] using hzR'' + have hBnz : B z ≠ 0 := hB_ne_zero z (hzR) + + have hJ_anal : AnalyticAt ℂ J z := hJ z hz + have hExp_diff_at_Jz : DifferentiableAt ℂ Complex.exp (J z) := + Complex.differentiableAt_exp + have hc_diff : DifferentiableAt ℂ (fun w => Complex.exp (J w)) z := + hExp_diff_at_Jz.comp z hJ_anal.differentiableAt + + have hB' : AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by + apply AnalyticOnNhd.mono_closedBall R' hB + assumption + have hd_diff : DifferentiableAt ℂ B z := (hB' z hzR).differentiableAt + + have hH_diff : DifferentiableAt ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z := by + unfold H_auxiliary + convert hc_diff.div hd_diff hBnz using 1 + have hH_has : HasDerivAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z) z := + hH_diff.hasDerivAt + have hderiv0 : deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := + H_deriv_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + simpa [hderiv0] using hH_has + +lemma fderivWithin_eq_zero_of_derivWithin_eq_zero {s : Set ℂ} {f : ℂ → ℂ} {x : ℂ} + (_hdiff : DifferentiableWithinAt ℂ f s x) + (hderiv : derivWithin f s x = 0) : + fderivWithin ℂ f s x = 0 := by + rw [← toSpanSingleton_derivWithin, hderiv] + simp + +lemma hasDerivWithinAt_of_hasDerivAt {f : ℂ → ℂ} {s : Set ℂ} {x : ℂ} + (h : HasDerivAt f 0 x) : HasDerivWithinAt f 0 s x := by + simpa using h.hasDerivWithinAt + +lemma uniqueDiffWithinAt_closedBall (r1 : ℝ) {x : ℂ} + (hr1 : 0 < r1) (hx : x ∈ Metric.closedBall (0 : ℂ) r1) : + UniqueDiffWithinAt ℝ (Metric.closedBall (0 : ℂ) r1) x := by + + have hconv : Convex ℝ (Metric.closedBall (0 : ℂ) r1) := by + simpa using (convex_closedBall (0 : ℂ) r1) + + have hinter_eq : interior (Metric.closedBall (0 : ℂ) r1) = Metric.ball (0 : ℂ) r1 := by + simpa using (interior_closedBall (x := (0 : ℂ)) (r := r1) (hr := ne_of_gt hr1)) + have hball_nonempty : (Metric.ball (0 : ℂ) r1).Nonempty := + ⟨0, by simpa [Metric.mem_ball, dist_eq_norm] using hr1⟩ + have hinter : (interior (Metric.closedBall (0 : ℂ) r1)).Nonempty := by + simpa [hinter_eq] using hball_nonempty + + have hx_closure : x ∈ closure (Metric.closedBall (0 : ℂ) r1) := subset_closure hx + + simpa using uniqueDiffWithinAt_convex hconv hinter hx_closure + +lemma H_auxiliary_fderivWithin_zero_on_closedBall + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) z = 0 := +by + intro z hz + + have hHasAt := + hasDerivAt_H_auxiliary_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero + hJ hJ_zero hJ_deriv z hz + have hHasWithin : + HasDerivWithinAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) 0 + (Metric.closedBall (0 : ℂ) r1) z := + hasDerivWithinAt_of_hasDerivAt hHasAt + + have hdiff : DifferentiableWithinAt ℂ + (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) z := + hHasWithin.differentiableWithinAt + + classical + have hderivWithin0 : + derivWithin (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) z = 0 := by + by_cases hUDc : UniqueDiffWithinAt ℂ (Metric.closedBall (0 : ℂ) r1) z + · simpa using hHasWithin.derivWithin hUDc + · simpa using + (derivWithin_zero_of_not_uniqueDiffWithinAt + (𝕜 := ℂ) + (f := H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (s := Metric.closedBall (0 : ℂ) r1) (x := z) hUDc) + + exact fderivWithin_eq_zero_of_derivWithin_eq_zero hdiff hderivWithin0 + +lemma H_is_constant + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z = + H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 := by + intro z hz + + have hs : Convex ℝ (Metric.closedBall (0 : ℂ) r1) := by + simpa using (convex_closedBall (0 : ℂ) r1) + + have hdiff : DifferentiableOn ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) := + H_auxiliary_differentiableOn_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ + + have hfderiv0 : ∀ x ∈ Metric.closedBall (0 : ℂ) r1, + fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) x = 0 := + H_auxiliary_fderivWithin_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv + + have h0mem : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) r1 := + zero_mem_closedBall_zero_radius (le_of_lt hr1_pos) + + have hbound : ∀ x ∈ Metric.closedBall (0 : ℂ) r1, + ‖fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (Metric.closedBall (0 : ℂ) r1) x‖ ≤ 0 := by + intro x hx + simp [hfderiv0 x hx] + have hineq := + Convex.norm_image_sub_le_of_norm_fderivWithin_le (𝕜 := ℂ) + (f := H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) + (s := Metric.closedBall (0 : ℂ) r1) (x := (0 : ℂ)) (y := z) + hdiff hbound hs h0mem hz + have hzero : H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z - + H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 = 0 := by + have : ‖H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z - + H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0‖ ≤ 0 := by + simpa using hineq + simpa [norm_le_zero_iff] using this + simpa [sub_eq_add_neg] using sub_eq_zero.mp hzero + +lemma H_is_one + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z = 1 / B 0 := by + intro z hz + have hconst := H_is_constant hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + have h0 := H_at_zero hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv + simpa [h0] using hconst + +lemma analytic_log_exists + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z = B 0 * Complex.exp (J z) := by + intro z hz + + have hH_const := H_is_one hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + + unfold H_auxiliary at hH_const + + have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by + have hzR' : dist z (0 : ℂ) ≤ r1 := hz + have hR_le : r1 ≤ R := le_of_lt (lt_trans hr1_lt_R' hR'_lt_R) + exact le_trans hzR' (by linarith) + have hBnz : B z ≠ 0 := hB_ne_zero z hzR + have hR_pos : 0 < R := lt_trans (lt_trans hr1_pos hr1_lt_R') hR'_lt_R + have hB0nz : B 0 ≠ 0 := hB_ne_zero 0 (by + simp [Metric.closedBall, dist_zero_right] + exact le_of_lt (by linarith)) + + have heq : Complex.exp (J z) * B 0 = B z := by + field_simp [hBnz, hB0nz] at hH_const + exact hH_const + + rw [← heq, mul_comm] + +lemma modulus_of_exp_I + {r1 R' R : ℝ} + (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) + {B : ℂ → ℂ} + (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (_hJ_zero : J 0 = 0) + (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + norm (Complex.exp (J z)) = Real.exp (Complex.re (J z)) := by + intro z hz + exact Complex.norm_exp (J z) + +lemma modulus_of_B_product_form + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + norm (B z) = norm (B 0) * norm (Complex.exp (J z)) := by + intro z hz + have hBform := analytic_log_exists hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + + simpa [norm_mul] using (congrArg norm hBform) + +lemma modulus_of_exp_log + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + norm (B z) = norm (B 0) * Real.exp (Complex.re (J z)) := by + intro z hz + rw [modulus_of_B_product_form hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz] + rw [modulus_of_exp_I hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz] + +lemma log_modulus_as_sum + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + Real.log (norm (B z)) = + Real.log (norm (B 0)) + Real.log (Real.exp (Complex.re (J z))) := by + intro z hz + + have h_eq := modulus_of_exp_log hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + + rw [h_eq, Real.log_mul] + · + + simp + apply hB_ne_zero + + rw [Metric.mem_closedBall, dist_self] + linarith + · + exact Real.exp_ne_zero _ + +lemma real_log_of_modulus_difference + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) + {J : ℂ → ℂ} + (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) + (hJ_zero : J 0 = 0) + (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1, + Real.log (norm (B z)) - Real.log (norm (B 0)) = Complex.re (J z) := by + intro z hz + + have h_sum := log_modulus_as_sum hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz + + rw [h_sum] + + rw [Real.log_exp] + ring + +theorem log_of_analytic + {r1 R' R : ℝ} + (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) + {B : ℂ → ℂ} + (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) + (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) : + ∃ J_B : ℂ → ℂ, + AnalyticOnNhd ℂ J_B (Metric.closedBall (0 : ℂ) r1) ∧ + J_B 0 = 0 ∧ + (∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J_B z = deriv B z / B z) ∧ + (∀ z ∈ Metric.closedBall (0 : ℂ) r1, + Real.log (norm (B z)) - Real.log (norm (B 0)) = Complex.re (J_B z)) := by + have hB_ne_zero_R' : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0 := hB_ne_zero + obtain ⟨J_B, hJ, hJ0, hJderiv⟩ := + I_is_antiderivative hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero_R' + refine ⟨J_B, hJ, hJ0, hJderiv, ?_⟩ + intro z hz + simpa using + (real_log_of_modulus_difference hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ0 hJderiv z hz) + +end Erdos970 diff --git a/StrongPNT/Erdos970/PNT2_LogDerivative.lean b/StrongPNT/Erdos970/PNT2_LogDerivative.lean new file mode 100644 index 0000000..4d1d6e5 --- /dev/null +++ b/StrongPNT/Erdos970/PNT2_LogDerivative.lean @@ -0,0 +1,3971 @@ +import StrongPNT.Erdos970.PNT1_ComplexAnalysis + +namespace Erdos970 + + +lemma DRinD1 (R : ℝ) (_hR : 0 < R) (hR' : R < 1) : + Metric.closedBall (0 : ℂ) R ⊆ Metric.ball (0 : ℂ) 1 := by + exact Metric.closedBall_subset_ball hR' +def zerosetKfR (R : ℝ) (_hR : 0 < R) (f : ℂ → ℂ) : Set ℂ := + {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ f ρ = 0} +lemma lemKinDR (R : ℝ) (hR : 0 < R) (f : ℂ → ℂ) : + zerosetKfR R hR f ⊆ Metric.closedBall (0 : ℂ) R := by + intro ρ hρ + + rw [zerosetKfR] at hρ + + exact hρ.1 +lemma lemKRinK1 (R : ℝ) (hR : 0 < R) (hR' : R < 1) (f : ℂ → ℂ) : + zerosetKfR R hR f ⊆ {ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0} := by + intro ρ hρ + simp only [zerosetKfR, Set.mem_ofPred_eq] at hρ ⊢ + constructor + · exact DRinD1 R hR hR' hρ.1 + · exact hρ.2 + +lemma lem_bolzano_weierstrass {D : Set ℂ} (hD : IsCompact D) {Z : Set ℂ} (hZ_inf : Z.Infinite) (hZ_sub_D : Z ⊆ D) : + ∃ ρ₀ ∈ D, AccPt ρ₀ (Filter.principal Z) := + Set.Infinite.exists_accPt_of_subset_isCompact hZ_inf hD hZ_sub_D +lemma lem_zeros_have_limit_point (R : ℝ) (hR : 0 < R) (f : ℂ → ℂ) (h_Kf_inf : Set.Infinite (zerosetKfR R hR f)) : + ∃ ρ₀ ∈ Metric.closedBall (0 : ℂ) R, AccPt ρ₀ (Filter.principal (zerosetKfR R hR f)) := by + apply lem_bolzano_weierstrass + · + rw [← lem_ballDR R hR] + exact lem_DRcompact R hR + · exact h_Kf_inf + · exact lemKinDR R hR f + +open Filter Metric Set Bornology Function + +lemma lem_identity_theorem (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) + (ρ₀ : ℂ) (hρ₀_in_D1 : ρ₀ ∈ Metric.ball (0 : ℂ) 1) + (h_acc : AccPt ρ₀ (Filter.principal ({ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0}))) : + EqOn f 0 (Metric.ball (0 : ℂ) 1) := by + + have h_subset : Metric.ball (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1 := Metric.ball_subset_closedBall + + have hf_open : AnalyticOnNhd ℂ f (Metric.ball (0 : ℂ) 1) := AnalyticOnNhd.mono hf h_subset + + have h_conn : IsConnected (Metric.ball (0 : ℂ) 1) := Metric.isConnected_ball (by norm_num : (0 : ℝ) < 1) + have h_preconn : IsPreconnected (Metric.ball (0 : ℂ) 1) := h_conn.isPreconnected + + have h_zeros_subset : {ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0} ⊆ {z | f z = 0} := by + intro z hz + exact hz.2 + + have h_acc_zero : AccPt ρ₀ (Filter.principal ({z | f z = 0})) := by + exact AccPt.mono h_acc (principal_mono.2 h_zeros_subset) + + have h_closure : ρ₀ ∈ closure ({z | f z = 0} \ {ρ₀}) := by + + have h_cluster : ClusterPt ρ₀ (Filter.principal ({z | f z = 0} \ {ρ₀})) := + (accPt_principal_iff_clusterPt).mp h_acc_zero + exact (mem_closure_iff_clusterPt).2 h_cluster + + exact AnalyticOnNhd.eqOn_zero_of_preconnected_of_mem_closure hf_open h_preconn hρ₀_in_D1 h_closure +lemma lem_identity_theoremR (R : ℝ) (hR : 0 < R) (hR' : R < 1) + (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) + (ρ₀ : ℂ) (hρ₀_in_DR : ρ₀ ∈ Metric.closedBall (0 : ℂ) R) + (h_acc : AccPt ρ₀ (Filter.principal ({ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0}))) : + EqOn f 0 (Metric.ball (0 : ℂ) 1) := by + have hρ₀_in_D1 : ρ₀ ∈ Metric.ball (0 : ℂ) 1 := DRinD1 R hR hR' hρ₀_in_DR + exact lem_identity_theorem f hf ρ₀ hρ₀_in_D1 h_acc +lemma lem_identity_theoremKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) + (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) + (h_exists_rho0 : ∃ ρ₀ ∈ Metric.closedBall (0 : ℂ) R, AccPt ρ₀ (Filter.principal (zerosetKfR R hR f))) : + EqOn f 0 (Metric.ball (0 : ℂ) 1) := by + + obtain ⟨ρ₀, hρ₀_in_R, h_acc⟩ := h_exists_rho0 + + apply lem_identity_theoremR R hR hR' f hf ρ₀ hρ₀_in_R + + exact AccPt.mono h_acc (principal_mono.2 (lemKRinK1 R hR hR' f)) +lemma lem_identity_infiniteKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) + (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) + (h_Kf_inf : Set.Infinite (zerosetKfR R hR f)) : + EqOn f 0 (Metric.ball (0 : ℂ) 1) := by + have h_exists_rho0 := lem_zeros_have_limit_point R hR f h_Kf_inf + exact lem_identity_theoremKR R hR hR' f hf h_exists_rho0 +lemma lem_Contra_finiteKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) + (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) + (h_exists_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, f z ≠ 0) : + Set.Finite (zerosetKfR R hR f) := by + + by_contra h_not_finite + + have h_Kf_inf : Set.Infinite (zerosetKfR R hR f) := h_not_finite + + have h_eq_zero := lem_identity_infiniteKR R hR hR' f hf h_Kf_inf + + obtain ⟨z, hz_in_ball, hz_nonzero⟩ := h_exists_nonzero + have h_f_z_zero : f z = 0 := h_eq_zero hz_in_ball + exact hz_nonzero h_f_z_zero + +open Classical + +lemma lem_frho_zero (R R1 : ℝ) + (hR1_pos : 0 < R1) + (_hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + f ρ = 0 := h_rho_in_KfR1.2 + +lemma lem_m_rho_is_nat (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hR_lt_1 : R < 1) : + ∀ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f), + analyticOrderAt f ρ ≠ ⊤ := by + intro ρ h_rho_in_KfR1 + + have hρ_closed_R1 : ρ ∈ Metric.closedBall (0 : ℂ) R1 := h_rho_in_KfR1.1 + + have hR1_le_R : R1 ≤ R := by linarith + have hR1_lt_one : R1 < 1 := by linarith + + have hρ_ball1 : ρ ∈ Metric.ball (0 : ℂ) 1 := by + have hdist_le : dist ρ (0 : ℂ) ≤ R1 := (Metric.mem_closedBall.mp hρ_closed_R1) + have hdist_lt : dist ρ (0 : ℂ) < 1 := by linarith + simpa [Metric.mem_ball] using hdist_lt + + have hf_at_ρ : AnalyticAt ℂ f ρ := by + + have hsubset : Metric.closedBall (0 : ℂ) R1 ⊆ Metric.closedBall (0 : ℂ) 1 := + Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_one) + have hρ_closed1 : ρ ∈ Metric.closedBall (0 : ℂ) 1 := hsubset hρ_closed_R1 + exact h_f_analytic ρ hρ_closed1 + + by_contra htop + + have h_eventually_zero : ∀ᶠ z in nhds ρ, f z = 0 := by + have h_equiv : (analyticOrderAt f ρ = ⊤ ↔ ∀ᶠ z in nhds ρ, f z = 0) := by + simp [analyticOrderAt, hf_at_ρ] + exact h_equiv.mp (by simpa using htop) + + have hf_on_ball : AnalyticOnNhd ℂ f (Metric.ball (0 : ℂ) 1) := by + intro z hz + have hz' : z ∈ Metric.closedBall (0 : ℂ) 1 := + (Metric.ball_subset_closedBall : Metric.ball (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1) hz + exact h_f_analytic z hz' + + have h_preconn : IsPreconnected (Metric.ball (0 : ℂ) 1) := + (Metric.isConnected_ball (by exact (zero_lt_one : (0 : ℝ) < 1))).isPreconnected + + have h_eqOn_zero : Set.EqOn f 0 (Metric.ball (0 : ℂ) 1) := + AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero hf_on_ball h_preconn hρ_ball1 + h_eventually_zero + + have h0_in_ball : (0 : ℂ) ∈ Metric.ball (0 : ℂ) 1 := by + simp [Metric.mem_ball] + have : f 0 = 0 := by + have h := h_eqOn_zero h0_in_ball + simpa [Pi.zero_apply] using h + exact h_f_nonzero_at_zero this + +lemma analyticOrderAt_ge_one_of_zero (f : ℂ → ℂ) (z : ℂ) (hf : AnalyticAt ℂ f z) (hz : f z = 0) (hfinite : analyticOrderAt f z ≠ ⊤) : analyticOrderAt f z ≥ 1 := by + + have h_order_ne_zero : analyticOrderAt f z ≠ 0 := by + intro h_order_zero + + have h_f_ne_zero : f z ≠ 0 := by + rw [← AnalyticAt.analyticOrderAt_eq_zero hf] + exact h_order_zero + + exact h_f_ne_zero hz + + cases' h : analyticOrderAt f z with n + · + + rw [h] at hfinite + exact False.elim (hfinite rfl) + · + + rw [h] at h_order_ne_zero + have n_ne_zero : n ≠ 0 := by + intro n_zero + rw [n_zero, Nat.cast_zero] at h_order_ne_zero + exact h_order_ne_zero rfl + + have n_ge_one : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr n_ne_zero + + exact Nat.cast_le.mpr n_ge_one + +lemma lem_m_rho_ge_1 (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hR_lt_1 : R < 1) : + ∀ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f), + analyticOrderAt f ρ ≥ 1 := by + intro ρ h_rho_in_KfR1 + + have h_f_rho_zero : f ρ = 0 := lem_frho_zero R R1 hR1_pos hR1_lt_R f h_f_analytic ρ h_rho_in_KfR1 + + have h_order_finite : analyticOrderAt f ρ ≠ ⊤ := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 ρ h_rho_in_KfR1 + + have h_f_analytic_at_rho : AnalyticAt ℂ f ρ := by + apply h_f_analytic + + have h_R1_lt_1 : R1 < 1 := by linarith + have h_rho_in_R1 : ρ ∈ Metric.closedBall 0 R1 := h_rho_in_KfR1.1 + exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) h_rho_in_R1 + + exact analyticOrderAt_ge_one_of_zero f ρ h_f_analytic_at_rho h_f_rho_zero h_order_finite + +noncomputable def Cf + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (_hR1_lt_R : R1 < R) + (_hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (z : ℂ) : ℂ := + if hz : z ∈ zerosetKfR R1 (by linarith) f then + h_σ z z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase z), (z - ρ) ^ (analyticOrderAt f ρ).toNat + else + f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat + +lemma lem_analDiv (R : ℝ) (_hR_pos : 0 < R) (_hR_lt_1 : R < 1) (w : ℂ) + (_hw : w ∈ Metric.closedBall (0 : ℂ) R) + (h : ℂ → ℂ) (g : ℂ → ℂ) + (hh : AnalyticAt ℂ h w) (hg : AnalyticAt ℂ g w) (hg_ne : g w ≠ 0) : + AnalyticAt ℂ (fun z => h z / g z) w := by + convert hh.div hg hg_ne using 1 + +lemma lem_denomAnalAt (S : Finset ℂ) (n : ℂ → ℕ) + (_hn_pos : ∀ s ∈ S, 0 < n s) (w : ℂ) (hw : w ∉ S) : + AnalyticAt ℂ (fun z => ∏ s ∈ S, (z - s) ^ (n s)) w ∧ + (∏ s ∈ S, (w - s) ^ (n s)) ≠ 0 := by + constructor + · + + let f : ℂ → ℂ → ℂ := fun s z => (z - s) ^ (n s) + have h_each_analytic : ∀ s ∈ S, AnalyticAt ℂ (f s) w := by + intro s hs + simp only [f] + + have h_sub : AnalyticAt ℂ (fun z => z - s) w := by + exact AnalyticAt.sub analyticAt_id analyticAt_const + + exact h_sub.pow (n s) + have h_prod := Finset.analyticAt_prod S h_each_analytic + convert h_prod using 1 + first | rfl | (ext z; simp [f]) + · + apply Finset.prod_ne_zero_iff.mpr + intro s hs + apply pow_ne_zero + + intro h_eq + + have h_w_eq_s : w = s := by + rwa [← sub_eq_zero] + + rw [h_w_eq_s] at hw + exact hw hs + +lemma lem_ratioAnalAt (w : ℂ) (R R1 : ℝ) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) + (h : ℂ → ℂ) (hh : AnalyticAt ℂ h w) + (S : Finset ℂ) (_hS : ↑S ⊆ Metric.closedBall (0 : ℂ) R1) (n : ℂ → ℕ) + (hn_pos : ∀ s ∈ S, 0 < n s) + (hw : w ∈ Metric.closedBall (0 : ℂ) 1 \ ↑S) : + AnalyticAt ℂ (fun z => h z / ∏ s ∈ S, (z - s) ^ (n s)) w := by + classical + + have hden := lem_denomAnalAt (S := S) (n := n) + (_hn_pos := hn_pos) (w := w) + (hw := by simpa using hw.2) + + exact AnalyticAt.div hh hden.1 hden.2 + +lemma lem_analytic_zero_factor (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + ∃ h_σ : ℂ → ℂ, AnalyticAt ℂ h_σ σ ∧ h_σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ z := by + classical + + have hσ_closed_R1 : σ ∈ Metric.closedBall (0 : ℂ) R1 := hσ.1 + have hR1_le_R : R1 ≤ R := by linarith + have hR1_lt_one : R1 < 1 := by linarith + have hσ_closed1 : σ ∈ Metric.closedBall (0 : ℂ) 1 := + (Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_one)) hσ_closed_R1 + have hfσ : AnalyticAt ℂ f σ := h_f_analytic σ hσ_closed1 + + have h_order_finite : analyticOrderAt f σ ≠ ⊤ := + lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 σ hσ + + rcases (hfσ.analyticOrderAt_ne_top).mp h_order_finite with ⟨g, hgσ, hgσ_ne, h_eq⟩ + + have h_eq' : ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * g z := by + refine h_eq.mono ?_ + intro z hz + simpa [smul_eq_mul, analyticOrderNatAt] using hz + exact ⟨g, hgσ, hgσ_ne, h_eq'⟩ + +lemma lem_Cf_analytic_off_K + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : + AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) z := by + + have h_ratio_analytic : AnalyticAt ℂ (fun w => f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) z := by + apply lem_ratioAnalAt z R R1 hR1_lt_R hR_lt_1 f + + · apply h_f_analytic + exact Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) hz.1 + + · intro ρ hρ + have h_mem : ρ ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hρ + exact h_mem.1 + + · intro s hs + have h_s_in_zeros : s ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hs + have h_order_ge_1 := lem_m_rho_ge_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros + have h_order_finite := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros + + cases' h_cases : analyticOrderAt f s with n + · + rw [h_cases] at h_order_finite + exact False.elim (h_order_finite rfl) + · + have n_ge_1 : n ≥ 1 := by + rw [h_cases] at h_order_ge_1 + exact Nat.cast_le.mp h_order_ge_1 + simp + exact Nat.pos_iff_ne_zero.mpr (ne_of_gt n_ge_1) + + · constructor + · exact Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) hz.1 + · + intro h_z_in_finset + have h_z_in_zeros : z ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp h_z_in_finset + exact hz.2 h_z_in_zeros + + have h_eventually_eq : (fun w => f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) =ᶠ[nhds z] + (fun w => Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ w) := by + + have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 + have h_open : IsOpen (Set.compl (zerosetKfR R1 (by linarith) f)) := h_finite_zeros.isClosed.isOpen_compl + apply Filter.eventually_of_mem (h_open.mem_nhds hz_not_in) + intro w hw_not_in_compl + + have hw_not_in_zeros : w ∉ zerosetKfR R1 (by linarith) f := hw_not_in_compl + + show f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat = + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ w + + rw [Cf, dite_eq_right hw_not_in_zeros] + + exact h_ratio_analytic.congr h_eventually_eq + +lemma lem_Cf_at_sigma_onK + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + ∀ᶠ z in nhds σ, z = σ → + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + h_σ z z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + refine Filter.Eventually.of_forall ?_ + intro z hz + subst hz + simp [Cf, hσ] + +lemma lem_K_isolated + {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} + {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {_h_f_nonzero_at_zero : f 0 ≠ 0} + (σ ρ : ℂ) (_hσ : σ ∈ zerosetKfR R1 (by linarith) f) + (_hρ : ρ ∈ zerosetKfR R1 (by linarith) f) (hne : σ ≠ ρ) : + ∀ᶠ z in nhds σ, z ≠ ρ := eventually_ne_nhds hne + +lemma lem_Cf_at_sigma_offK0 + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + ∀ᶠ z in nhds σ, z ≠ σ → + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z / + ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + + obtain ⟨h_σ_analytic, h_σ_ne_zero, h_f_eq⟩ := h_σ_spec σ hσ + + have h_σ_eventually_nonzero : ∀ᶠ z in nhds σ, h_σ σ z ≠ 0 := by + have h_cont : ContinuousAt (h_σ σ) σ := h_σ_analytic.continuousAt + exact h_cont.eventually_ne h_σ_ne_zero + + have h_f_eventually_nonzero : ∀ᶠ z in nhds σ, z ≠ σ → f z ≠ 0 := by + filter_upwards [h_f_eq, h_σ_eventually_nonzero] with z h_fz_eq h_σz_nonzero + intro hz_ne + rw [h_fz_eq] + apply mul_ne_zero + · apply pow_ne_zero + exact sub_ne_zero.mpr hz_ne + · exact h_σz_nonzero + + have h_eventually_not_in_zeroset : ∀ᶠ z in nhds σ, z ≠ σ → z ∉ zerosetKfR R1 (by linarith) f := by + filter_upwards [h_f_eventually_nonzero] with z h_fz_nonzero + intro hz_ne hz_in_zeroset + exact h_fz_nonzero hz_ne hz_in_zeroset.2 + + filter_upwards [h_f_eq, h_eventually_not_in_zeroset] with z h_fz_eq h_not_in_zeroset + intro hz_ne + + have hz_not_in_K : z ∉ zerosetKfR R1 (by linarith) f := h_not_in_zeroset hz_ne + + unfold Cf + simp [hz_not_in_K, h_fz_eq] + +lemma lem_prod_no_sigma1 + {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} + {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {_h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) (z : ℂ) : + ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat = + (z - σ) ^ (analyticOrderAt f σ).toNat * + ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + classical + have hmem : σ ∈ h_finite_zeros.toFinset := + (Set.Finite.mem_toFinset (hs := h_finite_zeros)).2 hσ + simpa using + (Finset.mul_prod_erase (s := h_finite_zeros.toFinset) + (f := fun ρ => (z - ρ) ^ (analyticOrderAt f ρ).toNat) (a := σ) hmem).symm + +lemma lem_prod_no_sigma2 + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) (z : ℂ) + (hz : z ∉ zerosetKfR R1 (by linarith) f) : + (z - σ) ^ (analyticOrderAt f σ).toNat / + ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat = + 1 / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + + have h_factor := @lem_prod_no_sigma1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ z + rw [h_factor] + + rw [div_mul_eq_div_div] + + have h_nonzero : (z - σ) ^ (analyticOrderAt f σ).toNat ≠ 0 := by + apply pow_ne_zero + intro h_eq + + have h_z_eq_sigma : z = σ := sub_eq_zero.mp h_eq + rw [h_z_eq_sigma] at hz + exact hz hσ + + rw [div_self h_nonzero, one_div] + +lemma lem_Cf_at_sigma_offK + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + ∀ᶠ z in nhds σ, z ≠ σ → + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + + have h_cf_form := @lem_Cf_at_sigma_offK0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ + + filter_upwards [h_cf_form] with z h_cf_z + intro hz_ne_sigma + + rw [h_cf_z hz_ne_sigma] + + have h_prod_decomp := @lem_prod_no_sigma1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ z + + rw [h_prod_decomp] + + apply mul_div_mul_left + + apply pow_ne_zero + exact sub_ne_zero.mpr hz_ne_sigma + +lemma lem_Cf_at_sigma + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + ∀ᶠ z in nhds σ, + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + + have h_on := @lem_Cf_at_sigma_onK R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ + have h_off := @lem_Cf_at_sigma_offK R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ + + filter_upwards [h_on, h_off] with z hz_on hz_off + by_cases h : z = σ + · + have eq_result := hz_on h + + rw [h] at eq_result ⊢ + exact eq_result + · + exact hz_off h + +lemma lem_h_ratio_anal + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (σ : ℂ) (_hσ : σ ∈ zerosetKfR R1 (by linarith) f) + (g : ℂ → ℂ) (hg_analytic : AnalyticAt ℂ g σ) : + AnalyticAt ℂ + (fun z => g z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), + (z - ρ) ^ (analyticOrderAt f ρ).toNat) σ := by + + have hden := lem_denomAnalAt (S := h_finite_zeros.toFinset.erase σ) + (n := fun ρ => (analyticOrderAt f ρ).toNat) + (_hn_pos := by + intro s hs + have h_s_in_zeros : s ∈ zerosetKfR R1 (by linarith) f := by + have h_mem_erase : s ∈ h_finite_zeros.toFinset.erase σ := hs + have h_mem_orig : s ∈ h_finite_zeros.toFinset := Finset.mem_of_mem_erase h_mem_erase + exact h_finite_zeros.mem_toFinset.mp h_mem_orig + have h_order_ge_1 := lem_m_rho_ge_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros + have h_order_finite := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros + cases' h_cases : analyticOrderAt f s with n + · + rw [h_cases] at h_order_finite + exact False.elim (h_order_finite rfl) + · + have n_ge_1 : n ≥ 1 := by + rw [h_cases] at h_order_ge_1 + exact Nat.cast_le.mp h_order_ge_1 + simp + exact Nat.pos_iff_ne_zero.mpr (ne_of_gt n_ge_1)) + (w := σ) + (hw := by + simp [Finset.mem_erase]) + + exact AnalyticAt.div hg_analytic hden.1 hden.2 + +lemma lem_Cf_analytic_at_K + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) σ := by + + have h_eventually_eq := @lem_Cf_at_sigma R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ + + obtain ⟨h_σ_analytic, _, _⟩ := h_σ_spec σ hσ + have h_ratio_analytic := @lem_h_ratio_anal R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ (h_σ σ) h_σ_analytic + + have h_rev_eq : (fun z => h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat) =ᶠ[nhds σ] + (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) := by + filter_upwards [h_eventually_eq] with z h_z + exact h_z.symm + + exact AnalyticAt.congr h_ratio_analytic h_rev_eq + +lemma lem_Cf_is_analytic + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R) : + AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) z := by + + by_cases h_case : z ∈ zerosetKfR R1 (by linarith) f + + case pos => + + exact lem_Cf_analytic_at_K h_finite_zeros h_σ h_σ_spec z h_case + + case neg => + + have hz_in_complement : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f := by + constructor + · exact hz + · exact h_case + exact lem_Cf_analytic_off_K h_finite_zeros h_σ h_σ_spec z hz_in_complement + +lemma lem_f_nonzero_off_K + {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} + {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {_h_f_nonzero_at_zero : f 0 ≠ 0} + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : + f z ≠ 0 := by + exact fun h => hz.2 ⟨hz.1, h⟩ + +lemma lem_Cf_nonzero_off_K + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z ≠ 0 := by + + have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 + + have h_cf_eq : Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + unfold Cf + simp [hz_not_in] + + rw [h_cf_eq] + + apply div_ne_zero + + · apply @lem_f_nonzero_off_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero z hz + + · apply Finset.prod_ne_zero_iff.mpr + intro ρ hρ + + apply pow_ne_zero + + intro h_eq + + have hz_eq_rho : z = ρ := by + rwa [sub_eq_zero] at h_eq + + have hρ_in : ρ ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hρ + rw [hz_eq_rho] at hz_not_in + exact hz_not_in hρ_in + +lemma lem_Cf_nonzero_on_K + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ σ ≠ 0 := by + have hnum : h_σ σ σ ≠ 0 := (h_σ_spec σ hσ).2.1 + have hden : + (∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), + (σ - ρ) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by + refine Finset.prod_ne_zero_iff.mpr ?_ + intro ρ hρmem + have hρ_ne_σ : ρ ≠ σ := (Finset.mem_erase.mp hρmem).1 + have hσ_ne_ρ : σ ≠ ρ := hρ_ne_σ.symm + exact pow_ne_zero _ (sub_ne_zero.mpr hσ_ne_ρ) + have : + h_σ σ σ / + ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), + (σ - ρ) ^ (analyticOrderAt f ρ).toNat ≠ + 0 := by + exact div_ne_zero hnum hden + simpa [Cf, hσ] using this + +lemma lem_Cf_never_zero + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1) : + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z ≠ 0 := by + + by_cases h : z ∈ zerosetKfR R1 (by linarith) f + · + exact lem_Cf_nonzero_on_K h_finite_zeros h_σ h_σ_spec z h + · + have hz_diff : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f := ⟨hz, h⟩ + exact lem_Cf_nonzero_off_K h_finite_zeros h_σ h_σ_spec z hz_diff + +lemma factor_nonzero_outside_domain (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) + (ρ : ℂ) (hρ_bound : ‖ρ‖ ≤ R1) (_hρ_ne_zero : ρ ≠ 0) (z : ℂ) (hz_in_R1 : ‖z‖ ≤ R1) : + (R : ℂ) - star ρ * z / (R : ℂ) ≠ 0 := by + + intro h_eq_zero + have hR_pos : 0 < R := by linarith + + have h_mul_eq_R_sq : star ρ * z = (R : ℂ) ^ 2 := by + have hR_ne_zero : (R : ℂ) ≠ 0 := by + rw [Ne, ← norm_eq_zero] + simp + linarith + + rw [sub_eq_zero] at h_eq_zero + rw [eq_div_iff_mul_eq hR_ne_zero] at h_eq_zero + rw [← pow_two] at h_eq_zero + exact h_eq_zero.symm + + have h_norm_eq : ‖ρ‖ * ‖z‖ = R ^ 2 := by + have h_left : ‖star ρ * z‖ = ‖ρ‖ * ‖z‖ := by + rw [norm_mul, norm_star] + have h_right : ‖(R : ℂ) ^ 2‖ = R ^ 2 := by + rw [Complex.norm_pow, Complex.norm_of_nonneg (le_of_lt hR_pos)] + rw [← h_left, h_mul_eq_R_sq, h_right] + + have h_R_sq_le : R ^ 2 ≤ R1 ^ 2 := by + calc R ^ 2 + = ‖ρ‖ * ‖z‖ := h_norm_eq.symm + _ ≤ R1 * ‖z‖ := mul_le_mul_of_nonneg_right hρ_bound (norm_nonneg z) + _ ≤ R1 * R1 := mul_le_mul_of_nonneg_left hz_in_R1 (le_of_lt hR1_pos) + _ = R1 ^ 2 := by rw [← pow_two] + + have h_R_le_R1 : R ≤ R1 := by + exact le_of_pow_le_pow_left₀ (by norm_num) (le_of_lt hR1_pos) h_R_sq_le + + linarith + +lemma linear_pow_analytic (a b : ℂ) (n : ℕ) (z : ℂ) : + AnalyticAt ℂ (fun w => (a - b * w) ^ n) z := by + + have h_linear : AnalyticAt ℂ (fun w => a - b * w) z := by + + have h_const : AnalyticAt ℂ (fun _ => a) z := analyticAt_const + + have h_mul : AnalyticAt ℂ (fun w => b * w) z := by + have h_id : AnalyticAt ℂ (fun w => w) z := analyticAt_id + convert h_id.const_smul (c := b) using 1 + + exact h_const.sub h_mul + + exact h_linear.fun_pow n + +lemma bl_num_diff + {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {_h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R) : + DifferentiableAt ℂ + (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by + · + have h_analytic : AnalyticAt ℂ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by + + let factor_func : ℂ → ℂ → ℂ := fun ρ w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat + + have h_each_analytic : ∀ ρ ∈ h_finite_zeros.toFinset, AnalyticAt ℂ (factor_func ρ) z := by + intro ρ hρ_mem + simp only [factor_func] + + have h_rewrite : (fun w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) = + (fun w => ((R : ℂ) - (star ρ / (R : ℂ)) * w) ^ (analyticOrderAt f ρ).toNat) := by + ext w + ring + rw [h_rewrite] + + exact linear_pow_analytic (R : ℂ) (star ρ / (R : ℂ)) (analyticOrderAt f ρ).toNat z + + have h_prod_analytic := Finset.analyticAt_prod h_finite_zeros.toFinset h_each_analytic + + convert h_prod_analytic using 1; first | rfl | (ext w; simp [factor_func]) + + exact h_analytic.differentiableAt + +lemma lem_bl_num_nonzero + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : + (∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by + + · refine Finset.prod_ne_zero_iff.mpr ?_ + intro ρ hρ_mem + apply pow_ne_zero + + have hρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := + h_finite_zeros.mem_toFinset.mp hρ_mem + have hρ_bound : ‖ρ‖ ≤ R1 := by + + have : dist ρ 0 ≤ R1 := Metric.mem_closedBall.mp hρ_in_zeros.1 + simp only [dist_zero_right] at this + exact this + have hρ_ne_zero : ρ ≠ 0 := by + intro h_eq_zero + rw [h_eq_zero] at hρ_in_zeros + exact h_f_nonzero_at_zero hρ_in_zeros.2 + have hz_bound : ‖z‖ ≤ R1 := by + have : dist z 0 ≤ R1 := Metric.mem_closedBall.mp hz.1 + simp only [dist_zero_right] at this + exact this + exact factor_nonzero_outside_domain R R1 hR1_pos hR1_lt_R hR_lt_1 ρ hρ_bound hρ_ne_zero z hz_bound + +noncomputable def Bf + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (z : ℂ) : ℂ := + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z * + ∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat + +lemma lem_BfCf + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + f z * (∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) / + (∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat) := by + + have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 + + unfold Bf + + unfold Cf + simp [hz_not_in] + + exact div_mul_eq_mul_div _ _ _ + +lemma lem_Bf_div + {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {_h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : + (∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) / + (∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat) = + ∏ ρ ∈ h_finite_zeros.toFinset, + (((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat / + (z - ρ) ^ (analyticOrderAt f ρ).toNat) := by + rw [Finset.prod_div_distrib] + +lemma lem_Bf_prodpow + {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {_h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : + ∏ ρ ∈ h_finite_zeros.toFinset, + (((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat / + (z - ρ) ^ (analyticOrderAt f ρ).toNat) = + ∏ ρ ∈ h_finite_zeros.toFinset, + (((R : ℂ) - star ρ * z / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat := by + simp only [div_pow] + +lemma lem_Bf_off_K + {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} + {f : ℂ → ℂ} + {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} + {h_f_nonzero_at_zero : f 0 ≠ 0} + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + f z * ∏ ρ ∈ h_finite_zeros.toFinset, + (((R : ℂ) - star ρ * z / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat := by + + rw [lem_BfCf h_finite_zeros h_σ z hz] + + rw [mul_div_assoc] + + congr 1 + + rw [@lem_Bf_div R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros z hz] + + rw [@lem_Bf_prodpow R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros z hz] + +lemma lem_frho_zero_contra + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (_hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (ρ : ℂ) : f ρ ≠ 0 → ρ ∉ zerosetKfR R1 (by linarith) f := by + intro h_f_rho_ne_zero h_rho_in_KfR1 + + have h_f_rho_zero : f ρ = 0 := h_rho_in_KfR1.2 + + exact h_f_rho_ne_zero h_f_rho_zero + +lemma lem_f_is_nonzero (f : ℂ → ℂ) : f 0 ≠ 0 → f ≠ 0 := by + intro h_f_zero_ne_zero h_f_eq_zero + + have h_f_at_zero_eq_zero : f 0 = 0 := by + rw [h_f_eq_zero] + simp + + exact h_f_zero_ne_zero h_f_at_zero_eq_zero + +theorem lem_rho_in_disk_R1 + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (_hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + norm ρ ≤ R1 := by + + have h_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R1 := h_rho_in_KfR1.1 + + rw [Metric.mem_closedBall, Complex.dist_eq] at h_in_ball + simp only [sub_zero] at h_in_ball + exact h_in_ball + +theorem lem_zero_not_in_Kf (R R1 : ℝ) + (hR1_pos : 0 < R1) + (_hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) : + f 0 ≠ 0 → 0 ∉ zerosetKfR R1 (by linarith) f := by + intro h_f_zero_ne_zero h_zero_in_KfR1 + + have h_f_zero_eq_zero : f 0 = 0 := h_zero_in_KfR1.2 + + exact h_f_zero_ne_zero h_f_zero_eq_zero + +lemma lem_rho_ne_zero (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) : + ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ρ ≠ 0 := by + intro ρ h_ρ_in_zeros h_ρ_eq_zero + + rw [h_ρ_eq_zero] at h_ρ_in_zeros + + have h_zero_not_in : 0 ∉ zerosetKfR R1 (by linarith) f := + lem_zero_not_in_Kf R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero + exact h_zero_not_in h_ρ_in_zeros + +lemma lem_mod_pos_iff_ne_zero (z : ℂ) : z ≠ 0 → norm z > 0 := + lem_abspos z + +theorem lem_mod_rho_pos + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) : + ∀ (ρ : ℂ), ρ ∈ zerosetKfR R1 (by linarith) f → norm ρ > 0 := by + intro ρ h_ρ_in_zeros + + have h_ρ_ne_zero : ρ ≠ 0 := + lem_rho_ne_zero R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros + + exact lem_mod_pos_iff_ne_zero ρ h_ρ_ne_zero + +theorem lem_rho_in_disk_R1_repeat (R R1 : ℝ) (hR1_pos : 0 < R1) +(hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + norm ρ ≤ R1 := + lem_rho_in_disk_R1 R R1 hR1_pos hR1_lt_R f ρ h_rho_in_KfR1 + +lemma lem_inv_mono_decr (x y : ℝ) (hx : 0 < x) (hxy : x ≤ y) : 1 / x ≥ 1 / y := by + + have hy : 0 < y := lt_of_lt_of_le hx hxy + + exact one_div_le_one_div_of_le hx hxy + +lemma lem_inv_mod_rho_ge_inv_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) +(hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + 1 / norm ρ ≥ 1 / R1 := by + + have h_abs_ρ_le_R1 : norm ρ ≤ R1 := + lem_rho_in_disk_R1 R R1 hR1_pos hR1_lt_R f ρ h_rho_in_KfR1 + + have h_abs_ρ_pos : norm ρ > 0 := + lem_mod_rho_pos R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 + + have h_R1_pos : R1 > 0 := by + linarith + + exact lem_inv_mono_decr (norm ρ) R1 h_abs_ρ_pos h_abs_ρ_le_R1 + +theorem lem_mul_pos_preserves_ineq (a b c : ℝ) (hab : a ≤ b) (hc : 0 < c) : + a * c ≤ b * c := by + exact mul_le_mul_of_nonneg_right hab (le_of_lt hc) + +theorem lem_R_div_mod_rho_ge_R_div_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) +(hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) (ρ : ℂ) + (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + R / norm ρ ≥ R / R1 := by + + have h_inv_ineq : 1 / norm ρ ≥ 1 / R1 := + lem_inv_mod_rho_ge_inv_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 + + have h_R_div_abs_ρ_eq : R * (1 / norm ρ) = R / norm ρ := by ring + have h_R_div_R1_eq : R * (1 / R1) = R / R1 := by ring + rw [← h_R_div_abs_ρ_eq, ← h_R_div_R1_eq] + exact mul_le_mul_of_nonneg_left h_inv_ineq (by linarith) + +theorem lem_R_div_mod_rho_ge_R_over_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) +(hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) (ρ : ℂ) + (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + R / norm ρ ≥ (R/R1 : ℝ) := by + + have h_ineq1 : R / norm ρ ≥ R / R1 := + lem_R_div_mod_rho_ge_R_div_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 + + linarith + +theorem lem_mod_of_prod2 {ι : Type*} (K : Finset ι) (w : ι → ℂ) : + ‖∏ ρ ∈ K, w ρ‖ = ∏ ρ ∈ K, ‖w ρ‖ := by + classical + refine Finset.induction_on K ?h0 ?hstep + · simp + · intro a s ha ih + + simp [Finset.prod_insert ha, ih] + +lemma lem_mod_Bf_is_prod_mod (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (z : ℂ) + (hz : z ∉ zerosetKfR R1 (by linarith) f) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = + ‖f z‖ * ∏ ρ ∈ h_finite_zeros.toFinset, + ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat‖ := by + + unfold Bf + rw [norm_mul] + + rw [lem_mod_of_prod2] + + have hCf : Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by + unfold Cf + simp only [hz, ↓reduceDIte] + rw [hCf, norm_div] + + rw [lem_mod_of_prod2] + + rw [div_mul_eq_mul_div] + + rw [mul_div_assoc] + + rw [← Finset.prod_div_distrib] + congr 2 + ext ρ + + rw [← norm_div, ← div_pow] + congr 2 + + ring + +lemma lem_abs_pow (w : ℂ) (n : ℕ) : ‖w ^ n‖ = ‖w‖ ^ n := by + simp + +lemma lem_Bmod_pow (R R1 : ℝ) (hR_pos : 0 < R) (hR1 : R1 = 2 * R / 3) (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) + (z : ℂ) : + ‖((((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat)‖ = + (‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖) ^ (analyticOrderAt f ρ).toNat := by + simp + +lemma lem_mod_Bf_prod_mod (R R1 : ℝ) (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (z : ℂ) + (hz : z ∉ zerosetKfR R1 (by linarith) f) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = + ‖f z‖ * ∏ ρ ∈ h_finite_zeros.toFinset, + ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ ^ (analyticOrderAt f ρ).toNat := by + + have h1 := lem_mod_Bf_is_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz + rw [h1] + + congr 2 + ext ρ + rw [lem_abs_pow] + +lemma lem_mod_Bf_at_0 (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = + ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, + ‖((R : ℂ) / (-ρ))‖ ^ (analyticOrderAt f ρ).toNat := by + + have hz0 : 0 ∉ zerosetKfR R1 (by linarith) f := + lem_zero_not_in_Kf R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero + rw [lem_mod_Bf_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec 0 hz0] + + congr 2 + ext ρ + congr 1 + simp only [zero_mul, zero_div, sub_zero, zero_sub] + +lemma lem_mod_div_ (w1 w2 : ℂ) (_hw2_ne_zero : w2 ≠ 0) : ‖w1 / w2‖ = ‖w1‖ / ‖w2‖ := by + simp + +lemma lem_mod_neg (w : ℂ) : ‖-w‖ = ‖w‖ := by + simp + +lemma lem_mod_div_and_neg (R : ℝ) (hR_pos : 0 < R) (ρ : ℂ) (h_rho_ne_zero : ρ ≠ 0) : + ‖(R : ℂ) / (-ρ)‖ = R / ‖ρ‖ := by + + have hden : (-ρ) ≠ 0 := by simpa using neg_ne_zero.mpr h_rho_ne_zero + have hdiv := lem_mod_div_ (R : ℂ) (-ρ) hden + calc + ‖(R : ℂ) / (-ρ)‖ = ‖(R : ℂ)‖ / ‖-ρ‖ := hdiv + _ = ‖(R : ℂ)‖ / ‖ρ‖ := by simp [norm_neg] + _ = |R| / ‖ρ‖ := by simp + _ = R / ‖ρ‖ := by simp [abs_of_pos hR_pos] + +theorem lem_mod_Bf_at_0_eval (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = + ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, + (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by + + rw [lem_mod_Bf_at_0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec] + + congr 1 + + apply Finset.prod_congr rfl + intro ρ hρ + + have h_ρ_ne_zero : ρ ≠ 0 := by + + have h_ρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := by + exact (Set.Finite.mem_toFinset h_finite_zeros).mp hρ + exact lem_rho_ne_zero R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros + + rw [lem_mod_div_and_neg R (by linarith) ρ h_ρ_ne_zero] + +lemma lem_mod_of_pos_real (x : ℝ) (hx : 0 < x) : abs x = x := by + exact abs_of_pos hx + +theorem lem_mod_Bf_at_0_as_ratio (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = + ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, + (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by + exact lem_mod_Bf_at_0_eval R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec + +lemma lem_prod_ineq {ι : Type*} (K : Finset ι) (a b : ι → ℝ) + (h_nonneg : ∀ ρ ∈ K, 0 ≤ a ρ) (h_le : ∀ ρ ∈ K, a ρ ≤ b ρ) : + ∏ ρ ∈ K, a ρ ≤ ∏ ρ ∈ K, b ρ := by + exact Finset.prod_le_prod₀ h_nonneg h_le + +lemma lem_power_ineq (n : ℕ) (c : ℝ) (hc : c > 1) (hn : n ≥ 1) : c ≤ c ^ n := by + cases' n with n + · + omega + · + have h_c_ge_1 : 1 ≤ c := le_of_lt hc + rw [pow_succ] + + have h_c_pow_n_ge_1 : 1 ≤ c ^ n := by exact one_le_pow₀ h_c_ge_1 + calc c = c * 1 := (mul_one c).symm + _ ≤ c * c ^ n := mul_le_mul_of_nonneg_left h_c_pow_n_ge_1 (le_of_lt (lt_trans zero_lt_one hc)) + _ = c ^ n * c := mul_comm (c) (c ^ n) + +lemma lem_power_ineq_1 (n : ℕ) (c : ℝ) (hc : 1 ≤ c) (_hn : 1 ≤ n) : 1 ≤ c ^ n := by + exact one_le_pow₀ hc + +lemma lem_prod_power_ineq {ι : Type*} (K : Finset ι) (c : ι → ℝ) (n : ι → ℕ) + (h_c_ge_1 : ∀ ρ ∈ K, 1 ≤ c ρ) + (h_n_ge_1 : ∀ ρ ∈ K, 1 ≤ n ρ) : + ∏ ρ ∈ K, (c ρ) ^ (n ρ) ≥ 1 := by + classical + induction K using Finset.induction with + | empty => simp + | insert i s h_not_in ih => + rw [Finset.prod_insert h_not_in] + have h_pow_ge_1 : 1 ≤ c i ^ n i := + one_le_pow₀ (h_c_ge_1 i (Finset.mem_insert_self i s)) + have h_prod_ge_1 : 1 ≤ ∏ ρ ∈ s, (c ρ) ^ (n ρ) := by + apply ih + · intro ρ hρ; exact h_c_ge_1 ρ (Finset.mem_insert_of_mem hρ) + · intro ρ hρ; exact h_n_ge_1 ρ (Finset.mem_insert_of_mem hρ) + exact one_le_mul_of_one_le_of_one_le h_pow_ge_1 h_prod_ge_1 + +theorem lem_prod_1 {ι : Type*} {M : Type*} [CommMonoid M] (K : Finset ι) : ∏ _ρ ∈ K, (1 : M) = 1 := by + exact Finset.prod_const_one + +lemma lem_prod_power_ineq1 {ι : Type*} (K : Finset ι) (c : ι → ℝ) (n : ι → ℕ) + (h_c_ge_1 : ∀ ρ ∈ K, 1 ≤ c ρ) (h_n_ge_1 : ∀ ρ ∈ K, 1 ≤ n ρ) : + ∏ ρ ∈ K, (c ρ) ^ (n ρ) ≥ 1 := by + exact lem_prod_power_ineq K c n h_c_ge_1 h_n_ge_1 + +lemma lem_mod_lower_bound_1 (R R1 : ℝ) (hR1_pos : 0 < R1) +(hR1_lt_R : R1 < R) (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (_hR_lt_1 : R < 1) : + ∏ ρ ∈ h_finite_zeros.toFinset, + (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ≥ 1 := by + classical + set K := h_finite_zeros.toFinset + + have h_base_ge_1 : (1 : ℝ) < (R/R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R + have h := + lem_prod_ineq K (fun _ : ℂ => (1 : ℝ)) + (fun ρ : ℂ => (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) + (by intro ρ hρ; norm_num) + (by + intro ρ hρ + simpa using (one_le_pow₀ (by linarith [h_base_ge_1]))) + simpa [K] using h + +theorem lem_mod_Bf_at_0_ge_1 (R R1 : ℝ) (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≥ 1 := by + + have R_over_R1_nonneg : 1 < R / R1 := by exact (one_lt_div hR1_pos).mpr hR1_lt_R + have R_over_R1_nonneg : 0 ≤ R / R1 := by linarith + have h_f_nonzero_at_zero : f 0 ≠ 0 := by + rw [hf0_eq_one]; norm_num + + rw [lem_mod_Bf_at_0_as_ratio R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros] + + rw [hf0_eq_one, norm_one, one_mul] + + have h_prod_ge : ∏ ρ ∈ h_finite_zeros.toFinset, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat ≥ + ∏ ρ ∈ h_finite_zeros.toFinset, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat := by + apply Finset.prod_le_prod₀ + + · intro ρ hρ + apply pow_nonneg + apply R_over_R1_nonneg + + · intro ρ hρ + have h_ρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := by + exact (Set.Finite.mem_toFinset h_finite_zeros).mp hρ + + have h_ratio_ge : R / ‖ρ‖ ≥ (R/R1 : ℝ) := by + + have h_norm_abs_eq : ‖ρ‖ = norm ρ := by rfl + rw [h_norm_abs_eq] + exact lem_R_div_mod_rho_ge_R_over_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros + + have h_3_2_pos : (1 : ℝ) < (R/R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R + have h_3_2_pos : (0 : ℝ) < (R/R1 : ℝ) := by linarith + have h_ratio_pos : (0 : ℝ) ≤ R / ‖ρ‖ := by + linarith [h_ratio_ge] + exact pow_le_pow_left₀ R_over_R1_nonneg h_ratio_ge (analyticOrderAt f ρ).toNat + + have h_3_2_prod_ge_1 : ∏ ρ ∈ h_finite_zeros.toFinset, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ≥ 1 := + lem_mod_lower_bound_1 R R1 hR1_pos hR1_lt_R f h_f_analytic hf0_eq_one h_finite_zeros hR_lt_1 + + exact le_trans h_3_2_prod_ge_1 h_prod_ge + assumption + +lemma lem_linear_factor_analytic (R : ℝ) (_hR_pos : 0 < R) (ρ : ℂ) (z : ℂ) : + AnalyticAt ℂ (fun w => (R : ℂ) - star ρ * w / (R : ℂ)) z := by + + have h_const : AnalyticAt ℂ (fun _ => (R : ℂ)) z := analyticAt_const + + have h_id : AnalyticAt ℂ (fun w => w) z := analyticAt_id + + have h_const_coeff : AnalyticAt ℂ (fun _ => star ρ / (R : ℂ)) z := analyticAt_const + + have h_mul : AnalyticAt ℂ (fun w => star ρ / (R : ℂ) * w) z := + AnalyticAt.fun_mul h_const_coeff h_id + + have h_sub : AnalyticAt ℂ (fun w => (R : ℂ) - star ρ / (R : ℂ) * w) z := + AnalyticAt.fun_sub h_const h_mul + + convert h_sub using 1 + ext w + ring + +lemma lem_pow_analyticAt {g : ℂ → ℂ} (n : ℕ) (w : ℂ) : + AnalyticAt ℂ g w → AnalyticAt ℂ (fun z => (g z) ^ n) w := by + intro hg + exact AnalyticAt.fun_pow hg n + +lemma lem_finset_prod_analyticAt {α : Type*} {S : Finset α} {g : α → ℂ → ℂ} (w : ℂ) : + (∀ a ∈ S, AnalyticAt ℂ (g a) w) → AnalyticAt ℂ (fun z => ∏ a ∈ S, g a z) w := by + intro h + classical + induction S using Finset.induction with + | empty => + + simp only [Finset.prod_empty] + exact analyticAt_const + | insert a s ha ih => + + simp only [Finset.prod_insert ha] + + apply AnalyticAt.fun_mul + · + apply h + exact Finset.mem_insert_self a s + · + apply ih + intro b hb + apply h + exact Finset.mem_insert_of_mem hb + +lemma analyticOrderAt_top_iff_eventually_zero (f : ℂ → ℂ) (z : ℂ) (hf : AnalyticAt ℂ f z) : + analyticOrderAt f z = ⊤ ↔ ∀ᶠ w in nhds z, f w = 0 := by + simp [analyticOrderAt, hf] + +lemma isPreconnected_closedBall (x : ℂ) (r : ℝ) : IsPreconnected (Metric.closedBall x r) := by + + have h_convex : Convex ℝ (Metric.closedBall x r) := convex_closedBall _ _ + + exact h_convex.isPreconnected + +lemma Set.infinite_Icc_of_lt {a b : ℝ} (h : a < b) : (Set.Icc a b).Infinite := by + + intro h_finite + + have h_subset : Set.Ioo a b ⊆ Set.Icc a b := Set.Ioo_subset_Icc_self + + have h_Ioo_finite : (Set.Ioo a b).Finite := h_finite.subset h_subset + + have h_Ioo_infinite : (Set.Ioo a b).Infinite := Set.Ioo_infinite h + + exact h_Ioo_infinite h_Ioo_finite + +lemma infinite_closedBall_of_pos (x : ℂ) (r : ℝ) (hr : 0 < r) : (Metric.closedBall x r).Infinite := by + + let f : ℝ → ℂ := fun t => x + t + + have h_maps_to : Set.MapsTo f (Set.Icc 0 (r/2)) (Metric.closedBall x r) := by + intro t ht + rw [Metric.mem_closedBall] + + have h_eq : f t = x + t := rfl + rw [h_eq, Complex.dist_eq, add_sub_cancel_left] + + have h_norm : ‖(t : ℂ)‖ = |t| := by + exact Complex.norm_real t + rw [h_norm, abs_of_nonneg ht.1] + exact le_trans ht.2 (le_of_lt (half_lt_self hr)) + + have h_inj : Set.InjOn f (Set.Icc 0 (r/2)) := by + intro s hs t ht h_eq + have : x + s = x + t := h_eq + have : (s : ℂ) = (t : ℂ) := add_left_cancel this + exact Complex.ofReal_inj.mp this + + have h_infinite_interval : (Set.Icc (0:ℝ) (r/2)).Infinite := + Set.infinite_Icc_of_lt (half_pos hr) + + have h_infinite_image : (f '' Set.Icc 0 (r/2)).Infinite := + Set.Infinite.image h_inj h_infinite_interval + + have h_subset : f '' Set.Icc 0 (r/2) ⊆ Metric.closedBall x r := + Set.MapsTo.image_subset h_maps_to + + intro h_finite + exact h_infinite_image (h_finite.subset h_subset) + +lemma analyticOrderAt_ne_top_of_finite_zeros_in_ball (f : ℂ → ℂ) (R : ℝ) (hR_pos : 0 < R) + (hf_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) R, AnalyticAt ℂ f z) + (ρ : ℂ) (_hρ_zero : f ρ = 0) (hρ_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R) + (h_finite_zeros : {z ∈ Metric.closedBall (0 : ℂ) R | f z = 0}.Finite) : + analyticOrderAt f ρ ≠ ⊤ := by + + by_contra htop + + have h_eventually_zero : ∀ᶠ z in nhds ρ, f z = 0 := by + rw [← analyticOrderAt_top_iff_eventually_zero f ρ (hf_analytic ρ hρ_in_ball)] + exact htop + + have hf_on_ball : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R) := by + intro z + exact hf_analytic z + + have h_preconn : IsPreconnected (Metric.closedBall (0 : ℂ) R) := + isPreconnected_closedBall (0 : ℂ) R + + have h_eqOn_zero : Set.EqOn f 0 (Metric.closedBall (0 : ℂ) R) := + AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero hf_on_ball h_preconn hρ_in_ball h_eventually_zero + + have h_all_zeros : ∀ z ∈ Metric.closedBall (0 : ℂ) R, f z = 0 := by + intro z hz + have := h_eqOn_zero hz + simpa [Pi.zero_apply] using this + + have h_zero_set_eq : {z ∈ Metric.closedBall (0 : ℂ) R | f z = 0} = Metric.closedBall (0 : ℂ) R := by + ext z + constructor + · intro hz; exact hz.1 + · intro hz; exact ⟨hz, h_all_zeros z hz⟩ + + have h_ball_infinite : (Metric.closedBall (0 : ℂ) R).Infinite := + infinite_closedBall_of_pos (0 : ℂ) R hR_pos + + rw [h_zero_set_eq] at h_finite_zeros + exact h_ball_infinite h_finite_zeros + +theorem lem_Bf_is_analytic (R R1 : ℝ) (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := by + + intro z hz + + have h_blaschke_linear : ∀ ρ ∈ h_finite_zeros.toFinset, + AnalyticAt ℂ (fun w => (R : ℂ) - star ρ * w / (R : ℂ)) z := by + intro ρ hρ + + have h_eq : (fun w : ℂ => (R : ℂ) - star ρ * w / (R : ℂ)) = + (fun w : ℂ => (R : ℂ) + (-(star ρ) / (R : ℂ)) * w) := by + funext w + field_simp + ring + rw [h_eq] + exact analyticAt_const.add (analyticAt_const.mul analyticAt_id) + + have h_powers : ∀ ρ ∈ h_finite_zeros.toFinset, + AnalyticAt ℂ (fun w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro ρ hρ + exact (h_blaschke_linear ρ hρ).fun_pow _ + + have h_product : AnalyticAt ℂ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by + + apply lem_finset_prod_analyticAt z + intro ρ hρ + apply h_powers + exact hρ + + by_cases hz_in : z ∈ zerosetKfR R1 (by linarith) f + · + have h_cf_at_sigma := @lem_Cf_analytic_at_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_in + + exact AnalyticAt.fun_mul h_cf_at_sigma h_product + + · + have hz_in_compl : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f := by + constructor + · exact hz + · exact hz_in + have h_cf_off := @lem_Cf_analytic_off_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_in_compl + exact AnalyticAt.fun_mul h_cf_off h_product + +lemma complex_mul_star_eq_norm_sq (z : ℂ) : z * star z = (‖z‖ ^ 2 : ℂ) := by + + rw [Complex.star_def] + + exact Complex.mul_conj' z + +lemma lem_mod_Bf_eq_mod_f_on_boundary (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z : ℂ, ‖z‖ = R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = ‖f z‖ := by + intro z hz + + have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := by + intro h_in + + have h_norm_le_R1 : ‖z‖ ≤ R1 := by simpa [sub_zero] using (h_in.1 : z ∈ Metric.closedBall (0 : ℂ) R1) + + have h_norm_eq_R : ‖z‖ = R := by simpa using hz + linarith [h_norm_le_R1, h_norm_eq_R, hR1_lt_R] + rw [lem_mod_Bf_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_not_in] + + have h_each_factor_one : ∀ ρ ∈ h_finite_zeros.toFinset, ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ = 1 := by + intro ρ hρ + + have z_ne_rho : z ≠ ρ := by + intro h_eq + have rho_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := (Set.Finite.mem_toFinset h_finite_zeros).mp hρ + have rho_bound : ‖ρ‖ ≤ R1 := by + have h_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R1 := rho_in_zeros.1 + rw [Metric.mem_closedBall, Complex.dist_eq] at h_in_ball + simpa using h_in_ball + have R1_lt_R : R1 < R := by linarith + rw [← h_eq, hz] at rho_bound + linarith [R1_lt_R] + + rw [Complex.norm_div] + + have z_conj_eq : z * star z = (R ^ 2 : ℂ) := by + rw [complex_mul_star_eq_norm_sq z, hz, pow_two] + + have num_rewrite : (R : ℂ) - z * star ρ / (R : ℂ) = ((R : ℂ)^2 - z * star ρ) / (R : ℂ) := by + have hRne : (R : ℂ) ≠ 0 := by exact_mod_cast (hR1_pos.trans hR1_lt_R).ne' + field_simp [hRne] + + rw [num_rewrite, Complex.norm_div] + + have factor_eq : (R : ℂ)^2 - z * star ρ = z * star (z - ρ) := by + rw [← z_conj_eq, star_sub] + ring + + rw [factor_eq, Complex.norm_mul, norm_star, ←hz] + have hRpos : 0 < R := hR1_pos.trans hR1_lt_R + have hnorm_denom : ‖z - ρ‖ ≠ 0 := norm_ne_zero_iff.mpr (sub_ne_zero.mpr z_ne_rho) + simp [hz, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hRpos, hnorm_denom, hRpos.ne'] + + have h_prod_one : ∏ ρ ∈ h_finite_zeros.toFinset, ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ ^ (analyticOrderAt f ρ).toNat = 1 := by + + rw [← Finset.prod_congr rfl (fun ρ hρ => by rw [h_each_factor_one ρ hρ, one_pow])] + rw [Finset.prod_const_one] + + rw [h_prod_one, mul_one] + +lemma lem_Bf_bounded_on_boundary (B R R1 : ℝ) (_hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : + ∀ z : ℂ, ‖z‖ = R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by + + intro z hz + have hz_le : ‖z‖ ≤ R := le_of_eq hz + have h_eq := + lem_mod_Bf_eq_mod_f_on_boundary R R1 (by linarith) hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz + simpa [h_eq] using hf_le_B z hz_le + +lemma norm_eq_radius_of_mem_sphere (w : ℂ) (R : ℝ) (hw : w ∈ Metric.sphere (0 : ℂ) R) : ‖w‖ = R := by + have hdist : dist w (0 : ℂ) = R := by simpa [Metric.sphere] using hw + simpa [Complex.dist_eq, sub_zero] using hdist + +lemma mem_closedBall_of_norm_le {z : ℂ} {R : ℝ} (hz : ‖z‖ ≤ R) : z ∈ Metric.closedBall (0 : ℂ) R := by + have : dist z (0 : ℂ) ≤ R := by simpa [Complex.dist_eq, sub_zero] using hz + simpa [Metric.closedBall] using this + +lemma closure_ball_eq_closedBall_center (R : ℝ) (hR : 0 < R) : + closure (Metric.ball (0 : ℂ) R) = Metric.closedBall (0 : ℂ) R := by + simpa using (closure_ball (x := (0 : ℂ)) (r := R) (ne_of_gt hR)) + +lemma lem_max_mod_principle_for_Bf (B R : ℝ) (hB : 1 < B) (hR_pos : 0 < R) + (fB : ℂ → ℂ) + (h_analytic : AnalyticOnNhd ℂ fB (Metric.closedBall (0 : ℂ) R)) + (h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → ‖fB z‖ ≤ B) : + ∀ z : ℂ, ‖z‖ ≤ R → ‖fB z‖ ≤ B := by + intro z hz + + have hB0 : 0 ≤ B := le_of_lt (lt_trans zero_lt_one hB) + + have h_an_on_closure : AnalyticOn ℂ fB (closure (ballDR R)) := by + simpa [ballDR, closure_ball_eq_closedBall_center R hR_pos] using h_analytic.analyticOn + + have h_le := + lem_HardMMP R B hR_pos hB0 fB h_an_on_closure (by + intro z hzR; exact h_bd_boundary z hzR) + + have hz_cl : z ∈ closure (ballDR R) := by + have hz_closed : z ∈ Metric.closedBall (0 : ℂ) R := mem_closedBall_of_norm_le hz + simpa [ballDR, closure_ball_eq_closedBall_center R hR_pos] using hz_closed + exact h_le z hz_cl + +lemma lem_Bf_bounded_in_disk_from_boundary (B R R1 : ℝ) + (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B) : + ∀ z : ℂ, ‖z‖ ≤ R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by + have hA := lem_Bf_is_analytic R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec + exact lem_max_mod_principle_for_Bf B R hB (by linarith) + (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) hA h_bd_boundary + +lemma lem_Bf_bounded_in_disk_from_f (B R R1 : ℝ) + (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : + ∀ z : ℂ, ‖z‖ ≤ R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by + intro z hz + have h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := + lem_Bf_bounded_on_boundary B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec hf_le_B + exact (lem_Bf_bounded_in_disk_from_boundary B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec h_bd_boundary) z hz + +lemma lem_Bf_at_0_le_M (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≤ B := by + have h := + lem_Bf_bounded_in_disk_from_f B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec hf_le_B + have h0 : ‖(0 : ℂ)‖ ≤ R := by simpa using (le_of_lt (by linarith)) + simpa using h 0 h0 + +lemma lem_combine_bounds_on_Bf0 (B R R1 : ℝ) (_hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (hBf0 : ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≤ B) : + (R / R1 : ℝ) ^ (∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat : ℝ) ≤ B := by + classical + + set K := h_finite_zeros.toFinset + + have hf0_ne0 : f 0 ≠ 0 := by simp [hf0_eq_one] + have hf0_norm : ‖f 0‖ = 1 := by simp [hf0_eq_one] + have h_eval0 := + lem_mod_Bf_at_0_eval R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic hf0_ne0 h_finite_zeros h_σ h_σ_spec + have h_eval_prod : + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ + = ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by + rw [h_eval0, hf0_norm, one_mul] + + have h_base_ge : ∀ ρ ∈ K, R / ‖ρ‖ ≥ (R/R1 : ℝ) := by + intro ρ hρK + have hρ_in : ρ ∈ zerosetKfR R1 (by linarith) f := by simpa [K] using hρK + simpa using + (lem_R_div_mod_rho_ge_R_over_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic hf0_ne0 ρ hρ_in) + + have R_over_R1_nonneg : 0 ≤ R/R1 := by + have : 0 ≤ R := by linarith + apply div_nonneg (by assumption) (le_of_lt hR1_pos) + have h_prod_le : + ∏ ρ ∈ K, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat + ≤ ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by + refine lem_prod_ineq K + (fun ρ => (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) + (fun ρ => (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat) + ?h_nonneg ?h_le + · intro ρ hρK; exact pow_nonneg (R_over_R1_nonneg) _ + · intro ρ hρK + exact pow_le_pow_left₀ (by linarith : (0 : ℝ) ≤ R / R1) (h_base_ge ρ hρK) _ + have h_prod_le_B : + ∏ ρ ∈ K, (R / R1: ℝ) ^ (analyticOrderAt f ρ).toNat ≤ B := by + have h_right : ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat = + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ := by + simp [h_eval_prod] + exact le_trans h_prod_le (by simpa [h_right] using hBf0) + + have h_prod_pow_sum : + (∏ ρ ∈ K, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) + = (R/R1 : ℝ) ^ (∑ ρ ∈ K, (analyticOrderAt f ρ).toNat) := by + simpa using + (Finset.prod_pow_eq_pow_sum K (fun ρ => (analyticOrderAt f ρ).toNat) (R/R1 : ℝ)) + + have h_natPow : (R / R1 : ℝ) ^ (∑ ρ ∈ K, (analyticOrderAt f ρ).toNat) ≤ B := by + simpa [h_prod_pow_sum] using h_prod_le_B + + set S : ℕ := ∑ ρ ∈ K, (analyticOrderAt f ρ).toNat + have h_natPowS : (R / R1 : ℝ) ^ S ≤ B := by simpa [S] using h_natPow + + have h_rpowS : (R / R1 : ℝ) ^ (S : ℝ) ≤ B := by + + simpa [(Real.rpow_natCast (R / R1 : ℝ) S)] using h_natPowS + + have h_cast_sum : (S : ℝ) + = (∑ ρ ∈ K, ((analyticOrderAt f ρ).toNat : ℝ)) := by + simp [S] + + have : (R / R1 : ℝ) ^ (∑ ρ ∈ K, ((analyticOrderAt f ρ).toNat : ℝ)) ≤ B := by + simpa [h_cast_sum] using h_rpowS + simpa [K] using this + +lemma lem_jensen_inequality_form (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : + (R / R1 : ℝ) ^ (∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat : ℝ) ≤ B := by + + have hf0_ne0 : f 0 ≠ 0 := by + rw [hf0_eq_one]; norm_num + + have hBf0 := + lem_Bf_at_0_le_M B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic hf0_ne0 h_finite_zeros h_σ h_σ_spec hf_le_B + + let K := h_finite_zeros.toFinset + have hres := lem_combine_bounds_on_Bf0 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hBf0 + + simpa using hres + +lemma lem_log_mono_inc {x y : ℝ} (hx : 0 < x) (hxy : x ≤ y) : Real.log x ≤ Real.log y := by + exact Real.log_le_log hx hxy + +lemma lem_three_gt_e : (3 : ℝ) > Real.exp 1 := by + have h1 : Real.exp 1 < 2.7182818286 := Real.exp_one_lt_d9 + have h2 : (2.7182818286 : ℝ) < 3 := by norm_num + exact lt_trans h1 h2 + +lemma lem_jensen_log_form (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : + (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) * Real.log (R / R1) ≤ Real.log B := by + + set S : ℝ := ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) + + have hpow_le : (R / R1 : ℝ) ^ S ≤ B := by + simpa [S] using + (lem_jensen_inequality_form B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hf_le_B) + + have hbase_pos : 1 < (R / R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R + have hbase_pos' : 0 < (R / R1 : ℝ) := by + have : 0 < R := by linarith + linarith + + have hxpos : 0 < (R / R1 : ℝ) ^ S := by + simpa [S] using Real.rpow_pos_of_pos hbase_pos' S + + have hlog_le : Real.log ((R / R1 : ℝ) ^ S) ≤ Real.log B := + lem_log_mono_inc hxpos hpow_le + + have hlog_rpow : Real.log ((R / R1 : ℝ) ^ S) = S * Real.log (R / R1) := by + simpa using (Real.log_rpow hbase_pos' S) + + simpa [S, hlog_rpow] using hlog_le + +lemma lem_sum_ineq {ι : Type*} (K : Finset ι) (a b : ι → ℝ) + (h_le : ∀ i ∈ K, a i ≤ b i) : + Finset.sum K a ≤ Finset.sum K b := by + classical + exact Finset.sum_le_sum (by intro i hi; exact h_le i hi) + +lemma ENat_coe_ge_one_iff_nat_ge_one (n : ℕ) : (n : ENat) ≥ 1 ↔ 1 ≤ n := by + + rw [ge_iff_le] + + exact ENat.natCast_le_natCast + +lemma nat_one_le_cast_real (n : ℕ) : 1 ≤ n → (1 : ℝ) ≤ (n : ℝ) := by + intro h + rw [← Nat.cast_one] + exact Nat.cast_le.mpr h + +lemma zerosetKfR_eq_zeros_in_ball (R : ℝ) (hR_pos : 0 < R) (f : ℂ → ℂ) : + zerosetKfR R hR_pos f = {z | z ∈ Metric.closedBall (0 : ℂ) R ∧ f z = 0} := by + rfl + +lemma lem_frho_zero' (R R1 : ℝ) + (hR_pos : 0 < R1) + (_hR1 : R1 < R) + (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : + f ρ = 0 := h_rho_in_KfR1.2 + +lemma lem_sum_m_rho_1 (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (hR_lt_1 : R < 1) : + (h_finite_zeros.toFinset.card : ℝ) ≤ ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) := by + + have h_card_as_sum : (h_finite_zeros.toFinset.card : ℝ) = ∑ ρ ∈ h_finite_zeros.toFinset, (1 : ℝ) := by + simp [Finset.sum_const] + rw [h_card_as_sum] + + apply lem_sum_ineq h_finite_zeros.toFinset (fun _ => (1 : ℝ)) (fun ρ => ((analyticOrderAt f ρ).toNat : ℝ)) + + intro ρ hρ + + have hρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := + (Set.Finite.mem_toFinset h_finite_zeros).mp hρ + have h_f_rho_zero : f ρ = 0 := + lem_frho_zero' R R1 (by linarith) hR1_lt_R f h_f_analytic ρ hρ_in_zeros + + have h_f_analytic_at_rho : AnalyticAt ℂ f ρ := by + apply h_f_analytic + have h_R1_lt_1 : R1 < 1 := by linarith [hR_lt_1] + exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) hρ_in_zeros.1 + + have h_order_finite : analyticOrderAt f ρ ≠ ⊤ := by + have h_R1_pos : 0 < R1 := by linarith [hR1_pos] + apply analyticOrderAt_ne_top_of_finite_zeros_in_ball f R1 h_R1_pos + · intro z hz + apply h_f_analytic + have h_R1_lt_1 : R1 < 1 := by linarith [hR_lt_1] + exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) hz + · exact h_f_rho_zero + · exact hρ_in_zeros.1 + · exact h_finite_zeros + + have h_order_ge_one : analyticOrderAt f ρ ≥ 1 := + analyticOrderAt_ge_one_of_zero f ρ h_f_analytic_at_rho h_f_rho_zero h_order_finite + + have h_toNat_ge_one : 1 ≤ (analyticOrderAt f ρ).toNat := by + cases' h_cases : analyticOrderAt f ρ with n + · rw [h_cases] at h_order_finite; contradiction + · rw [h_cases] at h_order_ge_one + rw [ENat.toNat_natCast] + exact (ENat_coe_ge_one_iff_nat_ge_one n).mp h_order_ge_one + + exact nat_one_le_cast_real _ h_toNat_ge_one + +lemma lem_sum_1_is_card {ι : Type*} (K : Finset ι) : Finset.sum K (fun _ => (1 : ℝ)) = (K.card : ℝ) := by + + rw [Finset.sum_const, nsmul_eq_mul] + simp only [mul_one] + +lemma lem_sum_m_rho_bound (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ≤ (1/Real.log (R/R1)) * Real.log B := by + have h_div_log : (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) * Real.log (R/R1) ≤ Real.log B := by + apply lem_jensen_log_form B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hf_le_B + have log_pos' : R/R1 > 1 := by exact (one_lt_div hR1_pos).mpr hR1_lt_R + have log_pos : Real.log (R/R1) > 0 := by exact Real.log_pos log_pos' + calc + ∑ ρ ∈ h_finite_zeros.toFinset, ↑(analyticOrderAt f ρ).toNat + _ = 1 / Real.log (R / R1) * (Real.log (R / R1) * (∑ ρ ∈ h_finite_zeros.toFinset, ↑(analyticOrderAt f ρ).toNat)) := by + field_simp [ne_of_gt log_pos] + _ ≤ 1 / Real.log (R / R1) * Real.log B := by + gcongr + rw [mul_comm] + exact h_div_log + +lemma lem_sum_1_bound (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + (h_finite_zeros.toFinset.card : ℝ) ≤ (1/Real.log (R/R1)) * Real.log B := by + have h1 := + lem_sum_m_rho_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_finite_zeros hR_lt_1 + have h2 := + lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ hf_le_B h_σ_spec + exact le_trans h1 h2 + +lemma lem_num_zeros_bound (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (hf0_eq_one : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + let S_zeros := zerosetKfR R1 (by linarith) f + have inst_fintype_S_zeros : Fintype ↑S_zeros := h_finite_zeros.fintype + (S_zeros.toFinset.card : ℝ) ≤ (1 / Real.log (R / R1)) * Real.log B := by + intro S_zeros _inst + dsimp [S_zeros] + simpa using + (lem_sum_1_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ hf_le_B h_σ_spec) + +variable {R R1 r B : ℝ} {f : ℂ → ℂ} {h_σ : ℂ → (ℂ → ℂ)} +variable (hr_pos : 0 < r) (hr_lt_R1 : r < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) +variable (hR1_pos : 0 < R1) +variable (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) +variable (h_f_zero : f 0 = 1) +variable (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) +variable (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + +lemma f_zero_ne_zero (h_f_zero : f 0 = 1) : f 0 ≠ 0 := by + rw [h_f_zero]; simp + +lemma Bf_is_analytic_on_disk + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := + let hspec := h_σ_spec + lem_Bf_is_analytic R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) + h_finite_zeros h_σ hspec + +lemma lem_Bf_eq_prod_Cf + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z, Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = + (∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) * + (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z) := by + intro z + rw [Bf] + ring + +lemma lem_num_prod_never_zero_all + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (_hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_h_f_nonzero_at_zero : f 0 ≠ 0) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1, + (∏ ρ ∈ h_finite_zeros.toFinset, + ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by + intro z hz + apply Finset.prod_ne_zero_iff.mpr + intro ρ hρ + apply pow_ne_zero + + have hρ_mem : ρ ∈ zerosetKfR R1 (by linarith) f := by + rwa [Set.Finite.mem_toFinset h_finite_zeros] at hρ + have hρ_bound : ‖ρ‖ ≤ R1 := by + rw [zerosetKfR] at hρ_mem; simp at hρ_mem; exact hρ_mem.1 + have hz_bound : ‖z‖ ≤ R1 := by + rw [Metric.mem_closedBall, dist_zero_right] at hz; exact hz + + have hR_pos : (0 : ℝ) < R := lt_trans hR1_pos hR1_lt_R + + have key_positive : (0 : ℝ) < R - R1 * R1 / R := by + + have h1 : R1 * R1 < R * R := by + apply mul_self_lt_mul_self (le_of_lt hR1_pos) hR1_lt_R + have h2 : R1 * R1 / R < R := by + rw [div_lt_iff₀ hR_pos] + exact h1 + linarith [h2] + + suffices h : (0 : ℝ) < ‖(R : ℂ) - star ρ * z / (R : ℂ)‖ by + exact norm_pos_iff.mp h + + have triangle_ineq : ‖(R : ℂ) - star ρ * z / (R : ℂ)‖ ≥ ‖(R : ℂ)‖ - ‖star ρ * z / (R : ℂ)‖ := + norm_sub_norm_le _ _ + + have R_norm_eq : ‖(R : ℂ)‖ = R := by + rw [Complex.norm_of_nonneg (le_of_lt hR_pos)] + + have product_bound : ‖star ρ * z / (R : ℂ)‖ ≤ R1 * R1 / R := by + rw [norm_div, norm_mul, norm_star, R_norm_eq] + + have mult_bound : ‖ρ‖ * ‖z‖ ≤ R1 * R1 := by + exact mul_le_mul hρ_bound hz_bound (norm_nonneg _) (le_of_lt hR1_pos) + + have : ‖ρ‖ * ‖z‖ / R ≤ R1 * R1 / R := by + exact div_le_div_of_nonneg_right mult_bound (le_of_lt hR_pos) + exact this + + rw [R_norm_eq] at triangle_ineq + linarith [triangle_ineq, product_bound, key_positive] + +lemma Bf_never_zero + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1, Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z ≠ 0 := by + intro z hz + + rw [lem_Bf_eq_prod_Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec] + + apply mul_ne_zero + · + exact lem_num_prod_never_zero_all R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec z hz + · + exact lem_Cf_never_zero h_finite_zeros h_σ h_σ_spec z hz + +lemma Bf0_not_zero + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 := by + apply Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + simp [Metric.mem_closedBall, le_of_lt hR1_pos] + +noncomputable def Lf : ℂ → ℂ := + let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ + Classical.choose (log_of_analytic + (r1 := r) (R' := R1) (R := R) + hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 + (B := B_f) + (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) + (hB_ne_zero := by + intro z hz + have h_num_ne_zero : B_f z ≠ 0 := + Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz + assumption + ) +) + +lemma Lf_is_analytic + (r R R1 : ℝ) + (hr_pos : 0 < r) + (hr_lt_R1 : r < R1) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + AnalyticOnNhd ℂ (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) + (Metric.closedBall (0 : ℂ) r) := by + unfold Lf + exact (Classical.choose_spec (log_of_analytic + (r1 := r) (R' := R1) (R := R) + hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 + (B := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) + (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) + (hB_ne_zero := by + intro z hz + exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz + ) + )).1 + +lemma Lf_at_0_is_0 + (r R R1 : ℝ) + (hr_pos : 0 < r) + (hr_lt_R1 : r < R1) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec 0 = 0 := by + unfold Lf + let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ + let log_exists := log_of_analytic + (r1 := r) (R' := R1) (R := R) + hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 + (B := B_f) + (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) + (hB_ne_zero := by + intro z hz + have h_num_ne_zero : B_f z ≠ 0 := + Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz + assumption + ) + exact (Classical.choose_spec log_exists).2.1 + +lemma lem_BCII {L : ℂ → ℂ} {r M r₁ : ℝ} + (hr_pos : 0 < r) + (hM_pos : 0 < M) + (hr₁_pos : 0 < r₁) + (hr₁_lt_r : r₁ < r) + (hL_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 r ⊆ U ∧ DifferentiableOn ℂ L U) + (hL0 : L 0 = 0) + (hre_L_le_M : ∀ w ∈ Metric.closedBall 0 r, (L w).re ≤ M) + {z : ℂ} (hz : z ∈ Metric.closedBall 0 r₁) : +norm (deriv L z) ≤ (16 * M * r ^ 2) / ((r - r₁) ^ 3) := by + apply borel_caratheodory_II hr_pos hM_pos hr₁_pos hr₁_lt_r hL_domain hL0 hre_L_le_M hz + +lemma re_Lf_as_diff_of_log_mods + (r R R1 : ℝ) + (hr_pos : 0 < r) + (hr_lt_R1 : r < R1) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r, + Complex.re (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z) = + Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) - + Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)) := by + intro z hz + + let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ + have h_Bf_analytic : AnalyticOnNhd ℂ B_f (Metric.closedBall (0 : ℂ) R) := + Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + have h_Bf_ne_zero : ∀ w ∈ Metric.closedBall (0 : ℂ) R1, B_f w ≠ 0 := by + intro w hw + exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec w hw + + have h_log_exists := log_of_analytic hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 h_Bf_analytic h_Bf_ne_zero + have h_choose_spec := Classical.choose_spec h_log_exists + + have h_Lf_def : Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec = Classical.choose h_log_exists := by + unfold Lf + simp only [B_f] + + rw [h_Lf_def] + exact (h_choose_spec.2.2.2 z hz).symm + +lemma log_Bf_le_log_B + (B R R1 : ℝ) + (_hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_Bf_pos : ∀ z, norm z ≤ R1 → + 0 < norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) + (h_Bf_bound : ∀ z, norm z ≤ R1 → + norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z) ≤ B) : + ∀ z, norm z ≤ R1 → + Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ≤ Real.log B := by + intro z hz + apply Real.log_le_log + · exact h_Bf_pos z hz + · exact h_Bf_bound z hz + +lemma log_Bf_le_log_B2 + (B R R1 : ℝ) + (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_Bf_bound : ∀ z, ‖z‖ ≤ R → + ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z‖ ≤ B) : + ∀ z, ‖z‖ ≤ R1 → + Real.log (‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z‖) ≤ Real.log B := by + + apply log_Bf_le_log_B B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + · + intro z hz + have hz_mem : z ∈ Metric.closedBall (0 : ℂ) R1 := by + rw [Metric.mem_closedBall, dist_zero_right] + exact hz + have hBf_ne_zero := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz_mem + exact norm_pos_iff.mpr hBf_ne_zero + · + intro z hz + have hz_le_R : ‖z‖ ≤ R := by linarith [hz, hR1_lt_R] + exact h_Bf_bound z hz_le_R + +lemma log_Bf_le_log_B3 + (B R R1 : ℝ) + (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : + ∀ z, norm z ≤ R1 → + Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ≤ Real.log B := by + + apply log_Bf_le_log_B2 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + + apply lem_Bf_bounded_in_disk_from_f B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec + + exact h_f_bound + +lemma log_Bf0_ge_0 + (R R1 : ℝ) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + 0 ≤ Real.log (‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0‖) := by + + have h_pos : 0 < (1 : ℝ) := by norm_num + have h_Bf_ge_1 : 1 ≤ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0‖ := + lem_mod_Bf_at_0_ge_1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_f_zero h_finite_zeros h_σ h_σ_spec + have h_log_mono := lem_log_mono_inc h_pos h_Bf_ge_1 + rw [Real.log_one] at h_log_mono + exact h_log_mono + +lemma re_Lf_le_log_B + (B r R R1 : ℝ) + (hB : 1 < B) + (hr_pos : 0 < r) + (hr_lt_R1 : r < R1) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : + ∀ z, norm z ≤ r → + Complex.re (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z) ≤ Real.log B := by + intro z hz + + rw [re_Lf_as_diff_of_log_mods r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z] + · + + have hz_apply_BC_to_Lfle_R1 : ‖z‖ ≤ R1 := by linarith [hz, hr_lt_R1] + have h1 := log_Bf_le_log_B3 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec h_f_bound z hz_apply_BC_to_Lfle_R1 + have h2 := log_Bf0_ge_0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + linarith + · + exact Metric.mem_closedBall.mpr (by simpa [dist_zero_right] using hz) + +lemma analyticOnNhd_closedBall_exists_open_differentiableOn {L : ℂ → ℂ} {r : ℝ} + (h : AnalyticOnNhd ℂ L (Metric.closedBall (0 : ℂ) r)) : + ∃ U, IsOpen U ∧ Metric.closedBall (0 : ℂ) r ⊆ U ∧ DifferentiableOn ℂ L U := by + classical + + let I := {x : ℂ // x ∈ Metric.closedBall (0 : ℂ) r} + + have hI : ∀ i : I, ∃ (W : Set ℂ), IsOpen W ∧ (i : ℂ) ∈ W ∧ AnalyticOn ℂ L W := by + intro i + have hAt : AnalyticAt ℂ L (i : ℂ) := h i i.property + + have hWithin : AnalyticWithinAt ℂ L (Set.univ) (i : ℂ) := by + simpa using (hAt.analyticWithinAt : AnalyticWithinAt ℂ L Set.univ (i : ℂ)) + rcases (AnalyticWithinAt.exists_mem_nhdsWithin_analyticOn hWithin) with ⟨U₀, hU₀nhds, hU₀analytic⟩ + have hU₀nhds' : U₀ ∈ nhds (i : ℂ) := by simpa [nhdsWithin_univ] using hU₀nhds + rcases _root_.mem_nhds_iff.mp hU₀nhds' with ⟨W, hWsub, hWopen, hiW⟩ + refine ⟨W, hWopen, hiW, hU₀analytic.mono ?_⟩ + exact hWsub + choose V hVopen hiV hVanalytic using hI + + let U : Set ℂ := ⋃ i : I, V i + have hUopen : IsOpen U := by + simpa [U] using isOpen_iUnion (fun i => hVopen i) + + have hsub : Metric.closedBall (0 : ℂ) r ⊆ U := by + intro x hx + refine Set.mem_iUnion.mpr ?_ + refine ⟨⟨x, hx⟩, ?_⟩ + simpa using hiV ⟨x, hx⟩ + + have hdiffOn : DifferentiableOn ℂ L U := by + intro y hy + rcases Set.mem_iUnion.mp hy with ⟨i, hyi⟩ + have hdi : DifferentiableOn ℂ L (V i) := (hVanalytic i).differentiableOn + have hdiAt : DifferentiableAt ℂ L y := hdi.differentiableAt ((hVopen i).mem_nhds hyi) + exact hdiAt.differentiableWithinAt + exact ⟨U, hUopen, hsub, hdiffOn⟩ + +lemma log_pos_of_one_lt {B : ℝ} (hB : 1 < B) : 0 < Real.log B := by + simpa using Real.log_pos hB + +lemma apply_BC_to_Lf + (B r1 r R R1 : ℝ) + (hB : 1 < B) + (hr1_pos : 0 < r1) + (hr1_lt_r : r1 < r) + (hr_lt_R1 : r < R1) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : + ∀ z, norm z ≤ r1 → + norm (deriv (Lf (lt_trans hr1_pos hr1_lt_r : 0 < r) hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z) ≤ + (16 * Real.log B * r^2) / (r - r1)^3 := by + classical + intro z hz + + have hr_pos : 0 < r := lt_trans hr1_pos hr1_lt_r + + let L := Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec + + have h_analytic_nhd := + Lf_is_analytic r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + + let U : Set ℂ := + { y | ∃ x ∈ Metric.closedBall (0 : ℂ) r, ∃ s : ℝ, 0 < s ∧ y ∈ Metric.ball x s ∧ + AnalyticOnNhd ℂ L (Metric.ball x s) } + have hU_open : IsOpen U := by + refine isOpen_iff_mem_nhds.mpr ?_ + intro y hy + rcases hy with ⟨x, hxCB, s, hs_pos, hyin, hAnaBall⟩ + have hnhds : Metric.ball x s ∈ nhds y := (Metric.isOpen_ball.mem_nhds hyin) + exact Filter.mem_of_superset hnhds (by intro z hz; exact ⟨x, hxCB, s, hs_pos, hz, hAnaBall⟩) + have hCB_subset : Metric.closedBall (0 : ℂ) r ⊆ U := by + intro x hx + have hAt : AnalyticAt ℂ L x := h_analytic_nhd x hx + rcases AnalyticAt.exists_ball_analyticOnNhd hAt with ⟨s, hs_pos, hAnaBall⟩ + have hx_in_ball : x ∈ Metric.ball x s := by + simpa [Metric.mem_ball, dist_self] using hs_pos + exact ⟨x, hx, s, hs_pos, hx_in_ball, hAnaBall⟩ + have hDiffU : DifferentiableOn ℂ L U := by + intro y hy + rcases hy with ⟨x, hxCB, s, hs_pos, hy_in, hAnaBall⟩ + + have hAt : AnalyticAt ℂ L y := hAnaBall y hy_in + exact (AnalyticAt.differentiableAt hAt).differentiableWithinAt + + have hL_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 r ⊆ U ∧ DifferentiableOn ℂ L U := + ⟨U, hU_open, hCB_subset, hDiffU⟩ + + have hL0 : L 0 = 0 := by + simpa [L] using (Lf_at_0_is_0 r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) + + have hre_L_le_M : ∀ w ∈ Metric.closedBall 0 r, (L w).re ≤ Real.log B := by + intro w hw + have hw' : norm w ≤ r := by + simpa [Metric.mem_closedBall, dist_zero_right] using hw + exact re_Lf_le_log_B B r R R1 hB hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec h_f_bound w hw' + + have hz' : z ∈ Metric.closedBall 0 r1 := by + simpa [Metric.mem_closedBall, dist_zero_right] using hz + + have hBC := + lem_BCII hr_pos (Real.log_pos hB) hr1_pos hr1_lt_r hL_domain hL0 hre_L_le_M hz' + + simpa [L] using hBC + +lemma analyticOnNhd_Bf_closedBall (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): + AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := + Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + +lemma helper_Bf_analytic_on_disk (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): + ∀ z ∈ Metric.closedBall (0 : ℂ) R, AnalyticAt ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z := by + intro z hz + have h_analytic_on := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + exact h_analytic_on z hz + +lemma closedBall_R1_subset_R (_hR1_nonneg : 0 ≤ R1) (hR1_lt_R : R1 < R) : Metric.closedBall (0 : ℂ) R1 ⊆ Metric.closedBall (0 : ℂ) R := by + exact (Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_R)) + +lemma logDerivconst {a : ℂ} {g : ℂ → ℂ} (ha : a ≠ 0) : + ∀ z, logDeriv (fun w ↦ a * g w) z = logDeriv g z := by + intro z + exact logDeriv_const_mul z a ha + +lemma oneBneq0 (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 ∧ + (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ ≠ 0 := by + have h0mem : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R1 := by + simpa [Metric.mem_closedBall, dist_zero_right] using le_of_lt hR1_pos + have hB0ne : + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 := by + have h := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + + exact h 0 h0mem + refine And.intro hB0ne ?_ + exact inv_ne_zero hB0ne + +lemma Lf_deriv_is_logBf_deriv (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + logDeriv (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w / + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0) z = + logDeriv (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) z := by + intro z _ + + have h_eq : (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w / + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0) = + (fun w ↦ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ * + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) := by + ext w + rw [div_eq_mul_inv] + ring + rw [h_eq] + + have h0_in_ball : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R1 := by + simp [Metric.mem_closedBall] + exact le_of_lt hR1_pos + have h_Bf0_ne_zero := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec 0 h0_in_ball + + have h_inv_ne_zero : (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ ≠ 0 := + inv_ne_zero h_Bf0_ne_zero + + exact logDerivconst h_inv_ne_zero z + +lemma logDeriv_div_const {a : ℂ} {g : ℂ → ℂ} (ha : a ≠ 0) : ∀ z, logDeriv (fun w ↦ g w / a) z = logDeriv g z := by + intro z + have hfun : (fun w ↦ g w / a) = (fun w ↦ a⁻¹ * g w) := by + funext w + simp [div_eq_mul_inv, mul_comm] + simpa [hfun] using (logDerivconst (a := a⁻¹) (g := g) (inv_ne_zero ha) z) + +lemma deriv_over_fun_is_logDeriv {g : ℂ → ℂ} : ∀ z, deriv g z / g z = logDeriv g z := by + intro z + rfl + +lemma logDerivmul {f g : ℂ → ℂ} {z : ℂ} + (hf : DifferentiableAt ℂ f z) (hg : DifferentiableAt ℂ g z) + (hf_ne : f z ≠ 0) (hg_ne : g z ≠ 0) : + logDeriv (fun w ↦ f w * g w) z = logDeriv f z + logDeriv g z := by + exact logDeriv_mul z hf_ne hg_ne hf hg + +lemma logDerivprod {K : Finset ℂ} {g : ℂ → ℂ → ℂ} {z : ℂ} + (hg_diff : ∀ ρ ∈ K, DifferentiableAt ℂ (g ρ) z) + (hg_ne : ∀ ρ ∈ K, g ρ z ≠ 0) : + logDeriv (fun w ↦ ∏ ρ ∈ K, g ρ w) z = ∑ ρ ∈ K, logDeriv (g ρ) z := by + simpa only [Finset.prod_fn] using logDeriv_prod hg_ne hg_diff + +lemma logDerivdiv {h g : ℂ → ℂ} {z : ℂ} + (hh : DifferentiableAt ℂ h z) (hg : DifferentiableAt ℂ g z) + (hh_ne : h z ≠ 0) (hg_ne : g z ≠ 0) : + logDeriv (fun w ↦ h w / g w) z = logDeriv h z - logDeriv g z := by + exact logDeriv_div z hh_ne hg_ne hh hg + +lemma logDerivfunpow {g : ℂ → ℂ} {z : ℂ} {m : ℕ} + (hg : DifferentiableAt ℂ g z) : + logDeriv (fun w ↦ (g w) ^ m) z = m * logDeriv g z := by + exact logDeriv_fun_pow hg m + +lemma z_minus_rho_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_h_f_zero : f 0 = 1) + (_h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ ρ ∈ zerosetKfR R1 (by linarith) f, + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + z - ρ ≠ 0 ∧ DifferentiableAt ℂ (fun w ↦ w - ρ) z := by + intro ρ hρ z hz + have hz_pair := (Set.mem_sdiff z).1 hz + have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R1 := hz_pair.1 + have hz_notK : z ∉ zerosetKfR R1 (by linarith) f := hz_pair.2 + + have hz_ne_rho : z ≠ ρ := by + intro h_eq + exact hz_notK (by simpa [h_eq] using hρ) + have h_nonzero : z - ρ ≠ 0 := sub_ne_zero.mpr hz_ne_rho + + have hdiff : DifferentiableAt ℂ (fun w => w) z := differentiableAt_fun_id + have hdiff_sub : DifferentiableAt ℂ (fun w => w - ρ) z := hdiff.sub_const ρ + exact ⟨h_nonzero, hdiff_sub⟩ + +lemma blaschke_num_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_h_f_zero : f 0 = 1) + (_h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ ρ ∈ zerosetKfR R1 (by linarith) f, + ∀ z ∈ Metric.closedBall (0 : ℂ) R, + R - (star ρ) * z / R ≠ 0 ∧ DifferentiableAt ℂ (fun w ↦ R - (star ρ) * w / R) z := by + intro ρ hρ z hz + constructor + · intro hzero + have hRne : (R : ℂ) ≠ 0 := by + simpa using (Complex.ofReal_ne_zero.mpr (ne_of_gt (hR1_pos.trans hR1_lt_R))) + + have heq : (R : ℂ) = (star ρ) * z / (R : ℂ) := sub_eq_zero.mp hzero + have hmul := congrArg (fun t : ℂ => t * (R : ℂ)) heq + have heq_mul : (R : ℂ) * (R : ℂ) = (star ρ) * z := by + + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hRne] using hmul + + have hnorm_eq : ‖(R : ℂ)‖ * ‖(R : ℂ)‖ = ‖ρ‖ * ‖z‖ := by + simpa [Complex.norm_mul, Complex.norm_conj] using congrArg (fun t : ℂ => ‖t‖) heq_mul + + have hz_norm_le : ‖z‖ ≤ R := by + have hz' : dist z (0 : ℂ) ≤ R := (Metric.mem_closedBall.mp hz) + simpa [dist_eq_norm] using hz' + have hrho_norm_le : ‖ρ‖ ≤ R1 := by + rcases hρ with ⟨hρ_ball, _hρ_zero⟩ + have : dist ρ (0 : ℂ) ≤ R1 := (Metric.mem_closedBall.mp hρ_ball) + simpa [dist_eq_norm] using this + have hz_nonneg : 0 ≤ ‖z‖ := by simp + have hR1_nonneg : 0 ≤ R1 := le_of_lt hR1_pos + have hle : ‖ρ‖ * ‖z‖ ≤ R1 * R := by + have h1 : ‖ρ‖ * ‖z‖ ≤ R1 * ‖z‖ := mul_le_mul_of_nonneg_right hrho_norm_le hz_nonneg + have h2 : R1 * ‖z‖ ≤ R1 * R := mul_le_mul_of_nonneg_left hz_norm_le hR1_nonneg + exact le_trans h1 h2 + + have hnorm_R : ‖(R : ℂ)‖ = R := by + have h1 : ‖(R : ℂ)‖ = |R| := by simp + simp [abs_of_pos (hR1_pos.trans hR1_lt_R)] + + have : R * R = ‖ρ‖ * ‖z‖ := by simpa [hnorm_R] using hnorm_eq + have hle' : R * R ≤ R1 * R := by simpa [this] using hle + + have hposR : 0 < R := hR1_pos.trans hR1_lt_R + have hposRR : 0 < R * R := by nlinarith [hposR] + have hlt : R1 * R < R * R := by + exact mul_lt_mul_of_pos_right hR1_lt_R hposR + exact (lt_irrefl _ (lt_of_le_of_lt hle' hlt)) + · + have h_const : DifferentiableAt ℂ (fun _ : ℂ => (R : ℂ)) z := by + simp + have h_id : DifferentiableAt ℂ (fun w : ℂ => w) z := by + simp + have h_mul : DifferentiableAt ℂ (fun w : ℂ => (star ρ) * w) z := by + simpa using h_id.const_mul (star ρ) + have h_div : DifferentiableAt ℂ (fun w : ℂ => (star ρ) * w / (R : ℂ)) z := by + simpa [div_eq_mul_inv] using h_mul.mul_const ((R : ℂ)⁻¹) + simpa using h_const.sub h_div + +lemma blaschke_frac_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ ρ ∈ zerosetKfR R1 (by linarith) f, + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + (R - (star ρ) * z / R) / (z - ρ) ≠ 0 ∧ + DifferentiableAt ℂ (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by + intro ρ hρ z hz + + have hden := z_minus_rho_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ z hz + have hden_ne : z - ρ ≠ 0 := hden.1 + have hden_diff : DifferentiableAt ℂ (fun w ↦ w - ρ) z := hden.2 + + have hz_in_small : z ∈ Metric.closedBall (0 : ℂ) R1 ∧ + z ∉ zerosetKfR R1 (by linarith) f := by + simpa [Set.mem_sdiff] using hz + have hz_small : z ∈ Metric.closedBall (0 : ℂ) R1 := hz_in_small.1 + + have hz_dist_le_small : dist z (0 : ℂ) ≤ R1 := by + simpa [Metric.mem_closedBall] using hz_small + have hRle : R ≤ 1 := le_of_lt hR_lt_1 + have hR1_le_R : R1 ≤ R := le_of_lt hR1_lt_R + have hR1_le_1 : R1 ≤ 1 := le_trans hR1_le_R hRle + have hz_ball1 : z ∈ Metric.closedBall (0 : ℂ) 1 := by + have hz_le1 : dist z (0 : ℂ) ≤ 1 := le_trans hz_dist_le_small hR1_le_1 + simpa [Metric.mem_closedBall] using hz_le1 + + have hz_ballR : z ∈ Metric.closedBall (0 : ℂ) R := by + have hz_le_R : dist z (0 : ℂ) ≤ R := le_trans hz_dist_le_small (le_of_lt hR1_lt_R) + simpa [Metric.mem_closedBall] using hz_le_R + have hnum := blaschke_num_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ z hz_ballR + have hnum_ne : R - (star ρ) * z / R ≠ 0 := hnum.1 + have hnum_diff : DifferentiableAt ℂ (fun w ↦ R - (star ρ) * w / R) z := hnum.2 + + refine And.intro ?_ ?_ + · intro h + have h' : (R - (star ρ) * z / R) * (z - ρ)⁻¹ = 0 := by + simpa [div_eq_mul_inv] using h + rcases mul_eq_zero.mp h' with hnum0 | hinv0 + · exact hnum_ne hnum0 + · exact hden_ne (inv_eq_zero.mp hinv0) + · exact hnum_diff.div hden_diff hden_ne + +lemma blaschke_pow_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ ρ ∈ zerosetKfR R1 (by linarith) f, + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 ∧ + DifferentiableAt ℂ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro ρ hρ z hz + have hfrac := + blaschke_frac_diff_nonzero (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros + ρ hρ z hz + rcases hfrac with ⟨hne, hdiff⟩ + constructor + · exact pow_ne_zero _ hne + · convert hdiff.pow ((analyticOrderAt f ρ).toNat) using 1 + +lemma blaschke_prod_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + (∏ ρ ∈ h_finite_zeros.toFinset, ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 ∧ + DifferentiableAt ℂ (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro z hz + classical + constructor + · + have hne_each : ∀ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 := by + intro ρ hρ + have hρ' : ρ ∈ zerosetKfR R1 (by linarith) f := + (h_finite_zeros.mem_toFinset).1 hρ + have hpair := + blaschke_pow_diff_nonzero (R := R) (R1 := R1) (f := f) + hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ' z hz + exact hpair.1 + exact (Finset.prod_ne_zero_iff).2 hne_each + · + have hdiff_each : ∀ ρ ∈ h_finite_zeros.toFinset, + DifferentiableAt ℂ + (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro ρ hρ + have hρ' : ρ ∈ zerosetKfR R1 (by linarith) f := + (h_finite_zeros.mem_toFinset).1 hρ + have hpair := + blaschke_pow_diff_nonzero (R := R) (R1 := R1) (f := f) + hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ' z hz + exact hpair.2 + + have hdiff := + (DifferentiableAt.finsetProd (u := h_finite_zeros.toFinset) + (f := fun ρ => fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) + (x := z) hdiff_each) + have hfun_eq : + (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) + = + (∏ ρ ∈ h_finite_zeros.toFinset, + (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat)) := by + funext w + simp [Finset.prod_apply] + exact hfun_eq.symm ▸ hdiff + +lemma f_diff_nonzero_outside_Kf {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_h_f_zero : f 0 = 1) + (_h_finite_zeros : (zerosetKfR R1 (by linarith ) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + f z ≠ 0 ∧ DifferentiableAt ℂ f z := by + intro z hz + + have hz' : z ∈ Metric.closedBall (0 : ℂ) R1 ∧ + z ∉ zerosetKfR R1 (by linarith) f := by + simpa [Set.mem_sdiff] using hz + have hz_in_R1 : z ∈ Metric.closedBall (0 : ℂ) R1 := hz'.1 + have hz_notin : z ∉ zerosetKfR R1 (by linarith) f := hz'.2 + + have hz_nonzero : f z ≠ 0 := by + intro hfz + exact hz_notin ⟨hz_in_R1, hfz⟩ + + have hR1_lt_1 : R1 < 1 := by linarith + have hsubset1 : + Metric.closedBall (0 : ℂ) R1 ⊆ Metric.ball (0 : ℂ) 1 := + Metric.closedBall_subset_ball hR1_lt_1 + have hz_in_ball1 : z ∈ Metric.ball (0 : ℂ) 1 := hsubset1 hz_in_R1 + have hz_in_1 : z ∈ Metric.closedBall (0 : ℂ) 1 := + Metric.ball_subset_closedBall hz_in_ball1 + have hAna : AnalyticAt ℂ f z := h_f_analytic z hz_in_1 + have hDiff : DifferentiableAt ℂ f z := hAna.differentiableAt + exact ⟨hz_nonzero, hDiff⟩ + +lemma Bf_diff_nonzero_outside_Kf + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z ≠ 0 ∧ + DifferentiableAt ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z := by + intro z hz + + rw [Set.mem_sdiff] at hz + have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R1 := hz.1 + + constructor + · + exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz_ball + + · + + have hz_R : z ∈ Metric.closedBall (0 : ℂ) R := + Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_R) hz_ball + + have h_analytic_on := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec + + have h_analytic_at := h_analytic_on z hz_R + + exact h_analytic_at.differentiableAt + +lemma logDeriv_fprod_is_sum {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + logDeriv (fun w ↦ f w * ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = + logDeriv f z + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro z hz + have hf' := f_diff_nonzero_outside_Kf (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz + rcases hf' with ⟨hf_ne, hf_diff⟩ + have hg' := blaschke_prod_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz + rcases hg' with ⟨hg_ne, hg_diff⟩ + simpa using + (logDerivmul (f:=f) (g:=fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) (z:=z) + hf_diff hg_diff hf_ne hg_ne) + +lemma nhds_avoids_finset {z : ℂ} (K : Finset ℂ) (hz : z ∉ (K : Set ℂ)) : ∀ᶠ w in nhds z, ∀ ρ ∈ K, w ≠ ρ := by + classical + + let U : Set ℂ := ⋂ ρ ∈ K, {w : ℂ | w ≠ ρ} + + have hopen_each : ∀ ρ ∈ K, IsOpen ({w : ℂ | w ≠ ρ} : Set ℂ) := by + intro ρ hρ + have hopen : IsOpen ((({ρ} : Set ℂ)ᶜ : Set ℂ)) := isOpen_compl_singleton + have hEq : ((({ρ} : Set ℂ)ᶜ : Set ℂ)) = {w : ℂ | w ≠ ρ} := by + ext w; simp + simpa [hEq] + using hopen + + have hopenU : IsOpen U := + isOpen_biInter_finset (s := K) (f := fun ρ : ℂ => ({w : ℂ | w ≠ ρ} : Set ℂ)) hopen_each + + have hzU : z ∈ U := by + have hznot : ∀ ρ ∈ K, z ≠ ρ := by + intro ρ hρ h + exact hz (by simpa [h] using hρ) + simpa [U] using hznot + + have hU_mem : U ∈ nhds z := hopenU.mem_nhds hzU + + refine Filter.eventually_of_mem hU_mem ?_ + intro w hw ρ hρ + have hw_all := Set.mem_iInter₂.mp hw + have : w ∈ ({w : ℂ | w ≠ ρ} : Set ℂ) := hw_all ρ hρ + simpa using this + +lemma pow_div_pow_eq_div_pow (a b : ℂ) (n : ℕ) : a^n / b^n = (a / b)^n := by + simpa using (div_pow a b n).symm + +lemma Cf_eventually_eq_f_div_prod {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ : ℂ → (ℂ → ℂ)) + (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : + (fun w ↦ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (by simp [h_f_zero]) h_finite_zeros h_σ w) + =ᶠ[nhds z] + (fun w ↦ f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) := by + classical + rcases hz with ⟨hz_ball, hz_notin⟩ + + set S : Set ℂ := zerosetKfR R1 (by linarith) f + have hS_fin : S.Finite := h_finite_zeros + have hS_closed : IsClosed S := hS_fin.isClosed + have hU_open : IsOpen Sᶜ := hS_closed.isOpen_compl + have hz_memU : z ∈ Sᶜ := by simpa [S] using hz_notin + have hU_mem : Sᶜ ∈ nhds z := hU_open.mem_nhds hz_memU + refine Filter.eventually_of_mem hU_mem ?_ + intro w hw + have hw_notin : w ∉ S := by + + simpa [Set.mem_compl] using hw + + simp [S, Cf, hw_notin] + +lemma eventuallyEq_mul_right_fun {α β} {l : Filter α} [Mul β] + {f g h : α → β} (hfg : f =ᶠ[l] g) : + (fun x => f x * h x) =ᶠ[l] (fun x => g x * h x) := by + filter_upwards [hfg] with x hx + rw [hx] + +lemma inv_prod_complex {ι} (s : Finset ι) (f : ι → ℂ) : (∏ x ∈ s, f x)⁻¹ = ∏ x ∈ s, (f x)⁻¹ := by + classical + simp + +lemma prod_num_mul_inv_den_eq_prod_ratio + (K : Finset ℂ) (N D : ℂ → ℂ) (m : ℂ → ℕ) : + (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ + = ∏ ρ ∈ K, ((N ρ / D ρ) ^ (m ρ)) := by + classical + + have hinv : (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ = ∏ ρ ∈ K, ((D ρ) ^ (m ρ))⁻¹ := by + simp + calc + (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ + = (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, ((D ρ) ^ (m ρ))⁻¹) := by + simp + _ = ∏ ρ ∈ K, ((N ρ) ^ (m ρ) * ((D ρ) ^ (m ρ))⁻¹) := by + simpa using (Finset.prod_mul_distrib (s := K) + (f := fun ρ => (N ρ) ^ (m ρ)) + (g := fun ρ => ((D ρ) ^ (m ρ))⁻¹)).symm + _ = ∏ ρ ∈ K, ((N ρ / D ρ) ^ (m ρ)) := by + apply Finset.prod_congr rfl + intro ρ hρ + + calc + (N ρ) ^ (m ρ) * ((D ρ) ^ (m ρ))⁻¹ + = (N ρ) ^ (m ρ) * ((D ρ)⁻¹) ^ (m ρ) := by + simp + _ = ((N ρ) * (D ρ)⁻¹) ^ (m ρ) := by + simp [mul_pow] + _ = (N ρ / D ρ) ^ (m ρ) := by + simp [div_eq_mul_inv] + +lemma prod_num_mul_inv_den_eq_prod_ratio_fun + (K : Finset ℂ) (N D : ℂ → ℂ → ℂ) (m : ℂ → ℕ) : + (fun w ↦ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹) + = (fun w ↦ ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ))) := by + funext w + classical + have h_inv : + (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ = ∏ ρ ∈ K, ((D ρ w) ^ (m ρ))⁻¹ := by + simp + calc + (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ + = (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, ((D ρ w) ^ (m ρ))⁻¹) := by + rw [h_inv] + _ = ∏ ρ ∈ K, ((N ρ w) ^ (m ρ)) * ((D ρ w) ^ (m ρ))⁻¹ := by + simpa using + (Finset.prod_mul_distrib + (s := K) + (f := fun ρ => (N ρ w) ^ (m ρ)) + (g := fun ρ => ((D ρ w) ^ (m ρ))⁻¹)).symm + _ = ∏ ρ ∈ K, (N ρ w / D ρ w) ^ (m ρ) := by + refine Finset.prod_congr rfl ?_ + intro ρ hρ + have hpow : + (N ρ w / D ρ w) ^ (m ρ) + = ((N ρ w) ^ (m ρ)) * ((D ρ w) ^ (m ρ))⁻¹ := by + simp [div_eq_mul_inv, mul_pow, inv_pow] + simp [hpow] + +lemma div_mul_eq_mul_mul_inv_fun {α} (f A B : α → ℂ) : + (fun w => (f w / A w) * B w) = (fun w => f w * (B w * (A w)⁻¹)) := by + funext w + simp [div_eq_mul_inv, mul_comm, mul_left_comm] + +lemma assoc_fun_mul {α} (f g h : α → ℂ) : (fun w => f w * (g w * h w)) = (fun w => (f w * g w) * h w) := by + funext w + simp [mul_assoc] + +lemma prod_num_mul_inv_den_eq_prod_ratio_fun_mem + (K : Finset ℂ) (N D : ℂ → ℂ → ℂ) (m : ℂ → ℕ) : + (fun w ↦ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹) + = (fun w ↦ ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ))) := by + funext w + classical + calc + (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ + = (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) / (∏ ρ ∈ K, (D ρ w) ^ (m ρ)) := by + simp [div_eq_mul_inv] + _ = ∏ ρ ∈ K, ((N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ)) := by + simp + _ = ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ)) := by + refine Finset.prod_congr rfl ?_ + intro ρ hρ + have hpow_div : + (N ρ w / D ρ w) ^ (m ρ) + = (N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ) := by + calc + (N ρ w / D ρ w) ^ (m ρ) + = (N ρ w * (D ρ w)⁻¹) ^ (m ρ) := by + simp [div_eq_mul_inv] + _ = (N ρ w) ^ (m ρ) * ((D ρ w)⁻¹) ^ (m ρ) := by + simpa using (mul_pow (N ρ w) ((D ρ w)⁻¹) (m ρ)) + _ = (N ρ w) ^ (m ρ) * ((D ρ w) ^ (m ρ))⁻¹ := by + simp + _ = (N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ) := by + simp [div_eq_mul_inv] + simpa using hpow_div.symm + +lemma eventuallyEq_of_eq {α β} {l : Filter α} {f g : α → β} (h : f = g) : f =ᶠ[l] g := by + simp [h] + +lemma logDeriv_congr_of_eventuallyEq {f g : ℂ → ℂ} {z : ℂ} + (hfg : f =ᶠ[nhds z] g) : logDeriv f z = logDeriv g z := by + + have hval : f z = g z := Filter.EventuallyEq.eq_of_nhds hfg + have hderiv_eq_ev : deriv f =ᶠ[nhds z] deriv g := hfg.deriv + have hderiv : deriv f z = deriv g z := Filter.EventuallyEq.eq_of_nhds hderiv_eq_ev + + have hf := deriv_over_fun_is_logDeriv (g := f) z + have hg := deriv_over_fun_is_logDeriv (g := g) z + simp [hf.symm, hg.symm, hval, hderiv] + +lemma logDeriv_Bf_is_sum : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ + zerosetKfR R1 (by linarith) f, + logDeriv (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z = + logDeriv f z + + logDeriv + (fun w ↦ + ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + classical + intro z hz + + set K : Finset ℂ := h_finite_zeros.toFinset + + let A : ℂ → ℂ := fun w => ∏ ρ ∈ K, (w - ρ) ^ (analyticOrderAt f ρ).toNat + let BN : ℂ → ℂ := fun w => ∏ ρ ∈ K, (R - (star ρ) * w / R) ^ (analyticOrderAt f ρ).toNat + let RatProd : ℂ → ℂ := + fun w => ∏ ρ ∈ K, ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat + + set S : Set ℂ := zerosetKfR R1 (by linarith) f + have hS_fin : S.Finite := h_finite_zeros + have hU_open : IsOpen Sᶜ := hS_fin.isClosed.isOpen_compl + have hz_notin : z ∉ S := by + rcases hz with ⟨_, hnotin⟩; exact hnotin + have hzU : z ∈ Sᶜ := by simpa [Set.mem_compl] using hz_notin + have hU_mem : Sᶜ ∈ nhds z := hU_open.mem_nhds hzU + have h_ev : + (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) + =ᶠ[nhds z] + (fun w ↦ f w * RatProd w) := by + refine Filter.eventually_of_mem hU_mem ?_ + intro w hwU + have hw_notin : w ∉ S := by simpa [Set.mem_compl] using hwU + + have hBf_w : + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w + = Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w * BN w := by + simp [Bf, BN, K] + have hCf_w : + Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w + = f w / A w := by + simp [Cf, S, A, K, hw_notin] + + have h_eq1 := div_mul_eq_mul_mul_inv_fun (f := f) (A := A) (B := BN) + have h_eq1_w : (f w / A w) * BN w = f w * (BN w * (A w)⁻¹) := by + simpa using congrArg (fun g : (ℂ → ℂ) => g w) h_eq1 + have h_eq2 := + prod_num_mul_inv_den_eq_prod_ratio_fun_mem + (K := K) + (N := fun ρ w ↦ (R - (star ρ) * w / R)) + (D := fun ρ w ↦ (w - ρ)) + (m := fun ρ ↦ (analyticOrderAt f ρ).toNat) + have h_eq2_w : BN w * (A w)⁻¹ = RatProd w := by + simpa [BN, A, RatProd] using congrArg (fun g : (ℂ → ℂ) => g w) h_eq2 + + calc + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w + = (f w / A w) * BN w := by simpa [hCf_w] using hBf_w + _ = f w * (BN w * (A w)⁻¹) := h_eq1_w + _ = f w * RatProd w := by simp [h_eq2_w] + + have hlog_congr := logDeriv_congr_of_eventuallyEq (f := fun w ↦ + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) + (g := fun w ↦ f w * RatProd w) (z := z) h_ev + + have hsum := + (logDeriv_fprod_is_sum (R:=R) (R1:=R1) (f:=f) + hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz) + simpa [RatProd, K] using hlog_congr.trans hsum + +lemma logDeriv_def_as_frac {f : ℂ → ℂ} {z : ℂ} + (_hf : DifferentiableAt ℂ f z) (_hf_ne : f z ≠ 0) : + logDeriv f z = deriv f z / f z := by + simp [logDeriv] + +theorem ball_containment {r R1 : ℝ} (_hr_pos : 0 < r) (hr_lt_R1 : r < R1) (z : ℂ) (hz : z ∈ Metric.closedBall 0 r) : z ∈ Metric.closedBall 0 R1 := by + simp at * + exact le_trans hz (le_of_lt hr_lt_R1) + +theorem in_r_minus_kf {R1 r : ℝ} {f : ℂ → ℂ} + (hr_pos : 0 < r) + (hr_lt_R1 : r < R1) + (z : ℂ) + (hz : z ∈ Metric.closedBall 0 r \ zerosetKfR R1 (by linarith) f) : + z ∈ Metric.closedBall 0 R1 \ zerosetKfR R1 (by linarith) f := by + obtain ⟨h1, h2⟩ := hz + have : z ∈ Metric.closedBall 0 R1 := by + apply ball_containment hr_pos hr_lt_R1 z h1 + constructor <;> assumption + +lemma Lf_deriv_step1 : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = + deriv f z / f z + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro z hz + + have hz' : z ∈ Metric.closedBall (0 : ℂ) r ∧ z ∉ zerosetKfR R1 (by linarith) f := by + simpa [Set.mem_sdiff] using hz + have hz_ball : z ∈ Metric.closedBall (0 : ℂ) r := hz'.1 + + have hLf := + + (Lf_deriv_is_logBf_deriv hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec + z (in_r_minus_kf hr_pos hr_lt_R1 _ hz)).symm + + have hsum : + logDeriv (fun w ↦ + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) + h_finite_zeros h_σ w) z = + logDeriv f z + + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + have h := + (logDeriv_Bf_is_sum (R := R) (R1 := R1) (r := r) (f := f) (h_σ := h_σ) + hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros) z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) + simpa using h + + obtain ⟨hf_ne, hfdiff⟩ := + f_diff_nonzero_outside_Kf (R := R) (R1 := R1) (f := f) + hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) + have hfrac : logDeriv f z = deriv f z / f z := + logDeriv_def_as_frac (f := f) (z := z) hfdiff hf_ne + + have hLf_eq_logDerivBf : + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = + logDeriv (fun w ↦ + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) + h_finite_zeros h_σ w) z := by + + have hz_in_r : z ∈ Metric.closedBall (0 : ℂ) r := hz_ball + + let B_f : ℂ → ℂ := + fun w => Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w + let log_exists := log_of_analytic + (r1 := r) (R' := R1) (R := R) + hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 + (B := B_f) + (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 + f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) + (hB_ne_zero := by + intro w hw + exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 + f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec w hw) + have hderiv_all : ∀ w ∈ Metric.closedBall (0 : ℂ) r, + deriv (Classical.choose log_exists) w = deriv B_f w / B_f w := + (Classical.choose_spec log_exists).2.2.1 + have hderiv_Lf : + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos + h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z + = deriv B_f z / B_f z := by + + unfold Lf + + simpa using hderiv_all z hz_in_r + + have h_as_log : deriv B_f z / B_f z = logDeriv B_f z := + deriv_over_fun_is_logDeriv (g := B_f) z + + simpa [B_f] using hderiv_Lf.trans h_as_log + + calc + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z + = logDeriv (fun w ↦ + Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) + h_finite_zeros h_σ w) z := hLf_eq_logDerivBf + _ = logDeriv f z + + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := hsum + _ = deriv f z / f z + + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + simp [hfrac] + +lemma logDeriv_prod_is_sum {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = + ∑ ρ ∈ h_finite_zeros.toFinset, logDeriv (fun w ↦ + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro z hz + have hdiff : ∀ ρ ∈ h_finite_zeros.toFinset, + DifferentiableAt ℂ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by + intro ρ hρ + have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := + (h_finite_zeros.mem_toFinset).mp hρ + have h := blaschke_pow_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρmem z hz + exact h.2 + have hne : ∀ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 := by + intro ρ hρ + have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := + (h_finite_zeros.mem_toFinset).mp hρ + have h := blaschke_pow_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρmem z hz + exact h.1 + simpa using + (logDerivprod (K := h_finite_zeros.toFinset) + (g := fun ρ w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) + (z := z) hdiff hne) + +lemma logDeriv_power_is_mul {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + ∀ ρ ∈ h_finite_zeros.toFinset, + logDeriv (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = + (analyticOrderAt f ρ).toNat * logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by + intro z hz ρ hρFin + have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := by + simpa using (h_finite_zeros.mem_toFinset.mp hρFin) + have hfrac := + blaschke_frac_diff_nonzero (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros + ρ hρmem z hz + rcases hfrac with ⟨_hneq, hdiff⟩ + simpa using + (logDerivfunpow (g := fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) (z := z) + (m := (analyticOrderAt f ρ).toNat) hdiff) + +lemma logDeriv_prod_is_sum_mul {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, + ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * + logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by + intro z hz + classical + have hsum := + logDeriv_prod_is_sum (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz + refine hsum.trans ?_ + refine Finset.sum_congr rfl ?_ + intro ρ hρ + exact + logDeriv_power_is_mul (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ρ hρ + +lemma Lf_deriv_step2 : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = + deriv f z / f z + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * + logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by + intro z hz + classical + have h1 := + Lf_deriv_step1 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz + have hsum := + logDeriv_prod_is_sum_mul (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) + have h2 := congrArg (fun t => deriv f z / f z + t) hsum + exact h1.trans h2 + +lemma logDeriv_Blaschke_is_diff {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + ∀ ρ ∈ h_finite_zeros.toFinset, + logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z = + logDeriv (fun w ↦ R - (star ρ) * w / R) z - logDeriv (fun w ↦ w - ρ) z := by + intro z hz ρ hρ + have hρ_set : ρ ∈ zerosetKfR R1 (by linarith) f := by + exact (Set.Finite.mem_toFinset (hs := h_finite_zeros) (a := ρ)).mp hρ + rcases hz with ⟨hz_in, hz_notin⟩ + have hden := z_minus_rho_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros + ρ hρ_set z ⟨hz_in, hz_notin⟩ + rcases hden with ⟨hden_nz, hden_diff⟩ + have hz_le : ‖z‖ ≤ R1 := by + simpa [Metric.closedBall, dist_eq_norm] using hz_in + have hle1 : R1 < 1 := by linarith [hR1_lt_R, hR_lt_1] + have hz_in1 : z ∈ Metric.closedBall (0 : ℂ) 1 := by + have : ‖z‖ ≤ 1 := le_of_lt (hz_le.trans_lt hle1) + simpa [Metric.closedBall, dist_eq_norm] using this + have hz_inR : z ∈ Metric.closedBall (0 : ℂ) R := by + have hz_le_R : ‖z‖ ≤ R := by + calc ‖z‖ ≤ R1 := hz_le + _ ≤ R := le_of_lt hR1_lt_R + simpa [Metric.closedBall, dist_eq_norm] using hz_le_R + have hnum := blaschke_num_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros + ρ hρ_set z hz_inR + rcases hnum with ⟨hnum_nz, hnum_diff⟩ + simpa using + (logDerivdiv (hh := hnum_diff) (hg := hden_diff) (hh_ne := hnum_nz) (hg_ne := hden_nz)) + +lemma logDeriv_linear {a b : ℂ} {z : ℂ} (_ha : a ≠ 0) (_hz : z ≠ -b/a) : + logDeriv (fun w ↦ a * w + b) z = a / (a * z + b) := by + + have h_id : HasDerivAt (fun w : ℂ => w) (1 : ℂ) z := hasDerivAt_id _ + have h_mul' : HasDerivAt (fun w : ℂ => a * w) a z := by + simpa [one_mul] using (h_id.const_mul a) + have h_deriv_mul : deriv (fun w : ℂ => a * w) z = a := h_mul'.deriv + + simp [logDeriv] + +lemma logDeriv_denominator {ρ : ℂ} {z : ℂ} (hz : z ≠ ρ) : + logDeriv (fun w ↦ w - ρ) z = 1 / (z - ρ) := by + have h := + logDeriv_linear (a := (1 : ℂ)) (b := -ρ) (z := z) + (_ha := by simp) + (_hz := by simpa using hz) + simpa [one_mul, sub_eq_add_neg] using h + +lemma logDeriv_numerator_pre {R : ℝ} {ρ : ℂ} {z : ℂ} : + logDeriv (fun w ↦ R - (star ρ) * w / R) z = -(star ρ) / R / (R - (star ρ) * z / R) := by + classical + + let a : ℂ := -(star ρ) / (R : ℂ) + let b : ℂ := (R : ℂ) + have hlin : (fun w : ℂ ↦ (R : ℂ) - (star ρ) * w / (R : ℂ)) = (fun w : ℂ ↦ b + a * w) := by + funext w + + simp [a, b, sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm] + + have hderiv_add : deriv (fun w : ℂ => b + a * w) z = + deriv (fun _ : ℂ => b) z + deriv (fun y : ℂ => a * y) z := by + simp + have hderiv_ab : deriv (fun w : ℂ => b + a * w) z = a := by + simp [deriv_const, mul_comm] + + simp [logDeriv, sub_eq_add_neg, div_eq_mul_inv, + mul_comm, mul_left_comm, mul_assoc, add_comm] + +lemma star_ne_zero_of_ne_zero {ρ : ℂ} (hρ : ρ ≠ 0) : star ρ ≠ 0 := by + + intro h + + have : ρ = 0 := (star_eq_zero).1 h + exact hρ this + +lemma field_identity_general {K : Type*} [Field K] {a b c : K} (ha : a ≠ 0) (hb : b ≠ 0) (_hden : a - c*b/a ≠ 0) : (-(b/a)) / (a - c*b/a) = (1 : K) / (c - a^2/b) := by + + have hmul : (-(a / b) : K) ≠ 0 := by + have hdiv_ne : a / b ≠ 0 := div_ne_zero ha hb + exact neg_ne_zero.mpr hdiv_ne + have hnum : (-(b/a) * (-(a/b))) = (1 : K) := by + calc + (-(b/a) * (-(a/b))) = (b/a) * (a/b) := by simp + _ = (b * a⁻¹) * (a * b⁻¹) := by simp [div_eq_mul_inv] + _ = b * (a⁻¹ * (a * b⁻¹)) := by simp [mul_assoc] + _ = b * ((a⁻¹ * a) * b⁻¹) := by simp [mul_assoc] + _ = b * (1 * b⁻¹) := by simp [ha] + _ = b * b⁻¹ := by simp + _ = 1 := by simp [hb] + have hOne : (b/a) * (a/b) = (1 : K) := by + calc + (b/a) * (a/b) = (b * a⁻¹) * (a * b⁻¹) := by simp [div_eq_mul_inv] + _ = b * (a⁻¹ * (a * b⁻¹)) := by simp [mul_assoc] + _ = b * ((a⁻¹ * a) * b⁻¹) := by simp [mul_assoc] + _ = b * (1 * b⁻¹) := by simp [ha] + _ = b * b⁻¹ := by simp + _ = 1 := by simp [hb] + have haab : a * (a / b) = a^2 / b := by + simp [div_eq_mul_inv, pow_two, mul_assoc] + have hcbab : (c * b / a) * (a / b) = c := by + calc + (c * b / a) * (a / b) = (c * (b / a)) * (a / b) := by simp [div_eq_mul_inv, mul_assoc] + _ = c * ((b / a) * (a / b)) := by simp [mul_assoc] + _ = c * 1 := by simp [hOne] + _ = c := by simp + have hdenom : ((a - c*b/a) * (-(a/b))) = c - a^2 / b := by + calc + ((a - c*b/a) * (-(a/b))) = -((a - c*b/a) * (a / b)) := by simp [mul_neg] + _ = -(a * (a / b) - (c * b / a) * (a / b)) := by simp [sub_mul] + _ = (c * b / a) * (a / b) - a * (a / b) := by simp [neg_sub] + _ = c - a^2 / b := by simp [hcbab, haab] + calc + (-(b/a)) / (a - c*b/a) + = (-(b/a) * (-(a/b))) / ((a - c*b/a) * (-(a/b))) := by + simpa using + (mul_div_mul_right (a := (-(b / a))) (b := (a - c * b / a)) (c := (-(a / b))) hmul).symm + _ = 1 / ((a - c*b/a) * (-(a/b))) := by simp [hnum] + _ = 1 / (c - a^2/b) := by simp [hdenom] + +lemma complex_identity_from_field {R : ℝ} {ρ z : ℂ} (hR : R ≠ 0) (hρ : ρ ≠ 0) (hden : (R:ℂ) - (star ρ) * z / R ≠ 0) : (-(star ρ) / (R:ℂ)) / ((R:ℂ) - (star ρ) * z / R) = (1 : ℂ) / (z - (R:ℂ)^2 / (star ρ)) := by + have ha : (R : ℂ) ≠ 0 := by simpa using (Complex.ofReal_ne_zero.mpr hR) + have hb : star ρ ≠ 0 := star_ne_zero_of_ne_zero hρ + have hden' : (R : ℂ) - z * (star ρ) / (R : ℂ) ≠ 0 := by + simpa [mul_comm, mul_left_comm, mul_assoc, div_eq_mul_inv] using hden + have h := field_identity_general (K := ℂ) (a := (R : ℂ)) (b := star ρ) (c := z) ha hb hden' + simpa [mul_comm, mul_left_comm, mul_assoc, div_eq_mul_inv] using h + +lemma logDeriv_numerator_rearranged {R : ℝ} {ρ z : ℂ} (hR : R ≠ 0) (hrho : ρ ≠ 0) (h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0) : -(star ρ) / R / ((R : ℂ) - (star ρ) * z / R) = 1 / (z - (R : ℂ)^2 / (star ρ)) := by + simpa using (complex_identity_from_field (R:=R) (ρ:=ρ) (z:=z) (hR:=hR) (hρ:=hrho) (hden:=h_denom_ne_zero)) + +lemma logDeriv_numerator {R : ℝ} {ρ : ℂ} {z : ℂ} + (hR : R ≠ 0) + (hrho : ρ ≠ 0) + (h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0): + logDeriv (fun w ↦ R - (star ρ) * w / R) z = 1 / (z - R^2 / (star ρ)) := by + rw [logDeriv_numerator_pre, logDeriv_numerator_rearranged] + <;> assumption + +lemma logDeriv_Blaschke_is_diff_frac {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) (h_f_zero : f 0 = 1) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ ρ ∈ h_finite_zeros.toFinset, + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f , logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z = + 1 / (z - R^2 / (star ρ)) - 1 / (z - ρ) := by + intro ρ hρ z hz + + have h_div := logDeriv_Blaschke_is_diff (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ρ hρ + + have hρ_mem : ρ ∈ zerosetKfR R1 (by linarith) f := by + exact (h_finite_zeros.mem_toFinset).mp hρ + have hρ_ne_zero : ρ ≠ 0 := by + intro h_eq + + have : f 0 = 0 := by simpa [h_eq] using hρ_mem.2 + exact (zero_ne_one : (0 : ℂ) ≠ 1) (this.symm.trans h_f_zero) + have hR_ne_zero : R ≠ 0 := ne_of_gt (hR1_pos.trans hR1_lt_R) + have h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0 := by + + have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R := by + have hle : R1 < R := hR1_lt_R + apply Metric.closedBall_subset_closedBall (le_of_lt hle) + exact hz.1 + have h := blaschke_num_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ_mem z hz_ball + exact h.1 + have h_num := logDeriv_numerator hR_ne_zero hρ_ne_zero h_denom_ne_zero + + have hz_ne_rho : z ≠ ρ := by + intro h_eq + exact hz.2 (by simpa [h_eq] using hρ_mem) + have h_den := logDeriv_denominator hz_ne_rho + + rw [h_div, h_num, h_den] + +lemma Lf_deriv_step3 : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = + deriv f z / f z + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * (1 / (z - R^2 / (star ρ)) - 1 / (z - ρ)) := by + intro z hz + + rw [Lf_deriv_step2 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz] + congr 1 + apply Finset.sum_congr rfl + intro ρ hρ + congr 1 + exact logDeriv_Blaschke_is_diff_frac hR1_pos hR1_lt_R hR_lt_1 h_f_zero h_f_analytic h_finite_zeros ρ hρ z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) + +lemma sum_of_diff {K : Finset ℂ} {a b : ℂ → ℂ} : + ∑ ρ ∈ K, (a ρ - b ρ) = ∑ ρ ∈ K, a ρ - ∑ ρ ∈ K, b ρ := by + simp [Finset.sum_sub_distrib] + +lemma sum_rearranged {R R1 : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (_h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * + (1 / (z - R^2 / (star ρ)) - 1 / (z - ρ)) = + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) - + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) := by + intro z hz + rw [← Finset.sum_sub_distrib] + congr 1 + ext ρ + rw [mul_sub, mul_one_div, mul_one_div] + +lemma Lf_deriv_final_formula : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = + deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) + + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) := by + intro z hz + + rw [Lf_deriv_step3 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz] + + rw [sum_rearranged hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz] + + ring + +lemma rearrange_Lf_deriv : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) = + deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z - + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) := by + intro z hz + + have h_final := Lf_deriv_final_formula hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz + rw [h_final] + ring + +lemma triangle_ineq_sum {w₁ w₂ : ℂ} : + ‖w₁ - w₂‖ ≤ ‖w₁‖ + ‖w₂‖ := by + have h : w₁ - w₂ = w₁ + (-w₂) := sub_eq_add_neg w₁ w₂ + rw [h] + have h₁ : ‖w₁ + (-w₂)‖ ≤ ‖w₁‖ + ‖-w₂‖ := norm_add_le w₁ (-w₂) + have h₂ : ‖-w₂‖ = ‖w₂‖ := norm_neg w₂ + rw [h₂] at h₁; exact h₁ + +lemma target_inequality_setup : + ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, + ‖deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ + ‖deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z‖ + + ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ := by + intro z hz + + have hrearr := rearrange_Lf_deriv hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz + + rw [hrearr] + exact norm_sub_le _ _ + +lemma conj_norm_eq_norm (z : ℂ) : ‖star z‖ = ‖z‖ := by + simp + +lemma norm_div_eq (a b : ℂ) (_hb : b ≠ 0) : ‖a / b‖ = ‖a‖ / ‖b‖ := by + calc + ‖a / b‖ = ‖a * b⁻¹‖ := by simp [div_eq_mul_inv] + _ = ‖a‖ * ‖b⁻¹‖ := norm_mul _ _ + _ = ‖a‖ * ‖b‖⁻¹ := by simp [norm_inv] + _ = ‖a‖ / ‖b‖ := by simp [div_eq_mul_inv] + +lemma norm_Rsq_div_conj (R : ℝ) (ρ : ℂ) (hρ : ρ ≠ 0) : ‖((R^2 : ℂ) / (star ρ))‖ = (R^2 : ℝ) / ‖ρ‖ := by + have hb : star ρ ≠ 0 := by + intro h + have h' := congrArg star h + + have : ρ = 0 := by simpa [star_star] using h' + exact hρ this + have hnormR : ‖(R^2 : ℂ)‖ = (R^2 : ℝ) := by + have h := (RCLike.norm_ofReal (K:=ℂ) (R^2)) + simp + calc + ‖((R^2 : ℂ) / (star ρ))‖ + = ‖(R^2 : ℂ)‖ / ‖star ρ‖ := norm_div_eq _ _ hb + _ = (R^2 : ℝ) / ‖ρ‖ := by + simp [hnormR] + +lemma zerosetKfR_subset_closedBall {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} : + zerosetKfR R1 hR1 f ⊆ Metric.closedBall (0 : ℂ) R1 := by + intro ρ hρ + have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 ∧ f ρ = 0 := by + simpa [zerosetKfR] using hρ + exact hmem.left + +lemma mem_zerosetKfR_ne_zero_of_f0_eq_one {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} + (hf0 : f 0 = 1) {ρ : ℂ} (hρ : ρ ∈ zerosetKfR R1 hR1 f) : ρ ≠ 0 := by + intro hρ0 + have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 ∧ f ρ = 0 := by + simpa [zerosetKfR] using hρ + have hzero : f 0 = 0 := by simpa [hρ0] using hmem.right + have h10 : (1 : ℂ) ≠ 0 := one_ne_zero + exact h10 (by simp [hf0] at hzero) + +lemma norm_sub_ge_norm_sub (x y : ℂ) : ‖x - y‖ ≥ ‖y‖ - ‖x‖ := by + have htri : ‖y‖ ≤ ‖y - x‖ + ‖x‖ := by + simpa [sub_eq_add_neg, add_comm] using norm_add_le (y - x) x + have h' : ‖y‖ - ‖x‖ ≤ ‖y - x‖ := (sub_le_iff_le_add).mpr htri + have hsymm : ‖y - x‖ = ‖x - y‖ := by + simpa [sub_eq_add_neg, add_comm] using (norm_neg (x - y)) + simpa [hsymm] using h' + +lemma mem_zerosetKfR_norm_le {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} {ρ : ℂ} + (hρ : ρ ∈ zerosetKfR R1 hR1 f) : ‖ρ‖ ≤ R1 := by + have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 := + (zerosetKfR_subset_closedBall (R1 := R1) hR1 (f := f)) hρ + have hdist : dist ρ (0 : ℂ) ≤ R1 := by + simpa [Metric.mem_closedBall] using hmem + simpa [dist_eq_norm, sub_zero] using hdist + +lemma lem_sum_bound_step2 {R R1: ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (_hR_lt_1 : R < 1) + (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + (∑ ρ ∈ h_finite_zeros.toFinset, + ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - (R^2 : ℂ) / (star ρ)‖) + ≤ (1/(R^2/R1 - R1)) * + (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) := by + classical + intro z hz + rcases hz with ⟨hzball, _hznotin⟩ + have hz_norm : ‖z‖ ≤ R1 := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hzball + + set S := h_finite_zeros.toFinset + have hS_spec : ∀ {ρ : ℂ}, ρ ∈ S → ρ ∈ zerosetKfR R1 (by linarith) f := by + intro ρ hρ + have hiff := (Set.Finite.mem_toFinset (hs := h_finite_zeros) : ρ ∈ S ↔ ρ ∈ zerosetKfR R1 (by linarith) f) + exact (Iff.mp hiff) hρ + + have hsum_le : + (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - (R^2 : ℂ) / (star ρ)‖) + ≤ ∑ ρ ∈ S, (1/(R^2/R1 - R1)) * ((analyticOrderAt f ρ).toNat : ℝ) := by + refine Finset.sum_le_sum ?termwise + intro ρ hρS + have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := hS_spec hρS + have hρ_ne : ρ ≠ 0 := + mem_zerosetKfR_ne_zero_of_f0_eq_one (R1 := R1) (hR1 := by linarith) + (f := f) h_f_zero hρmem + have hρ_norm : ‖ρ‖ ≤ R1 := mem_zerosetKfR_norm_le (R1 := R1) + (hR1 := by linarith) (f := f) hρmem + have hpt : 1 / ‖z - (R^2 : ℂ) / (star ρ)‖ ≤ 1/(R^2/R1 - R1) := by + + have h_Rsq_norm : ‖((R^2 : ℂ) / (star ρ))‖ = (R^2 : ℝ) / ‖ρ‖ := + norm_Rsq_div_conj R ρ hρ_ne + have h_lower_bound : ‖z - (R^2 : ℂ) / (star ρ)‖ ≥ ‖((R^2 : ℂ) / (star ρ))‖ - ‖z‖ := + norm_sub_ge_norm_sub z ((R^2 : ℂ) / (star ρ)) + + have hρ_pos : 0 < ‖ρ‖ := by + simpa [norm_pos_iff] using hρ_ne + have h_Rsq_bound : R^2/R1 ≤ ‖((R^2 : ℂ) / (star ρ))‖ := by + rw [h_Rsq_norm] + exact div_le_div_of_nonneg_left (sq_nonneg R) hρ_pos hρ_norm + have h_combined : R^2/R1 - R1 ≤ ‖z - (R^2 : ℂ) / (star ρ)‖ := by + calc R^2/R1 - R1 + _ ≤ ‖((R^2 : ℂ) / (star ρ))‖ - R1 := by linarith [h_Rsq_bound] + _ ≤ ‖((R^2 : ℂ) / (star ρ))‖ - ‖z‖ := by linarith [hz_norm] + _ ≤ ‖z - (R^2 : ℂ) / (star ρ)‖ := h_lower_bound + have h_pos_denom : 0 < R^2/R1 - R1 := by + have h_R_pos : 0 < R := by linarith [hR1_pos, hR1_lt_R] + have h_Rsq_pos : 0 < R^2 := sq_pos_of_pos h_R_pos + calc R^2/R1 - R1 + _ = (R^2 - R1*R1)/R1 := by field_simp + _ = (R - R1)*(R + R1)/R1 := by ring + _ > 0 := by + apply div_pos + · apply mul_pos + · linarith [hR1_lt_R] + · linarith [hR1_pos, hR1_lt_R] + · exact hR1_pos + have h_pos_norm : 0 < ‖z - (R^2 : ℂ) / (star ρ)‖ := by + apply lt_of_lt_of_le h_pos_denom h_combined + + have h_reciprocal : 1 / ‖z - (R^2 : ℂ) / (star ρ)‖ ≤ 1 / (R^2/R1 - R1) := by + apply div_le_div_of_nonneg_left + · norm_num + · exact h_pos_denom + · exact h_combined + exact h_reciprocal + have hmnonneg : 0 ≤ ((analyticOrderAt f ρ).toNat : ℝ) := by + exact_mod_cast (Nat.zero_le (analyticOrderAt f ρ).toNat) + have hmul := mul_le_mul_of_nonneg_left hpt hmnonneg + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hmul + + rw [← Finset.mul_sum] at hsum_le + exact hsum_le + +lemma sq_div_sub_pos (a b : ℝ) (ha_pos : 0 < a) (hab : a < b) : 0 < b^2/a - a := by + + rw [sub_pos] + + rw [lt_div_iff₀ ha_pos] + + rw [← pow_two] + + have ha_nonneg : 0 ≤ a := le_of_lt ha_pos + apply pow_lt_pow_left₀ hab ha_nonneg + norm_num + +lemma final_sum_bound {R R1 B : ℝ} {f : ℂ → ℂ} + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (hB : 1 < B) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, + ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ ≤ + 1/((R^2/R1 - R1) * Real.log (R/R1)) * Real.log B := by + intro z hz + + have h_norm_bound := norm_sum_le h_finite_zeros.toFinset (fun ρ => (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))) + + have h_sum_eq : ∑ ρ ∈ h_finite_zeros.toFinset, ‖(analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ = + ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - R^2 / (star ρ)‖ := by + apply Finset.sum_congr rfl + intro ρ hρ + rw [norm_div, Complex.norm_natCast] + + have h_step2 := lem_sum_bound_step2 hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz + + have h_f_nonzero : f 0 ≠ 0 := by rw [h_f_zero]; norm_num + have h_f_bounded_alt : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B := by + intro w hw + exact h_f_bounded w (Metric.mem_closedBall.mpr (by simpa [dist_eq_norm] using hw)) + + have h_exists : ∀ σ : ℂ, ∃ g : ℂ → ℂ, + AnalyticAt ℂ g σ ∧ g σ ≠ 0 ∧ + (σ ∈ zerosetKfR R1 (by linarith) f → + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * g z) := by + intro σ + by_cases hσ : σ ∈ zerosetKfR R1 (by linarith) f + · + have hex := lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero σ hσ + obtain ⟨g, hg_at, hg_ne, h_eq⟩ := hex + exact ⟨g, hg_at, hg_ne, fun _ => h_eq⟩ + · + refine ⟨fun _ => 1, ?_, ?_, ?_⟩ + · exact analyticAt_const + · norm_num + · intro h_contra + contradiction + + let h_σ : ℂ → (ℂ → ℂ) := fun σ => Classical.choose (h_exists σ) + have h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z := by + intro σ hσ + have spec := Classical.choose_spec (h_exists σ) + exact ⟨spec.1, spec.2.1, spec.2.2 hσ⟩ + have h_sum_bound := lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero h_f_zero h_finite_zeros h_σ h_f_bounded_alt h_σ_spec + + have h_pos : 0 < R^2/R1 - R1 := sq_div_sub_pos R1 R hR1_pos hR1_lt_R + have h_ratio_gt_one : 1 < R/R1 := by + rw [one_lt_div_iff] + left + exact ⟨hR1_pos, hR1_lt_R⟩ + have h_log_pos : 0 < Real.log (R/R1) := Real.log_pos h_ratio_gt_one + + calc ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ + ≤ ∑ ρ ∈ h_finite_zeros.toFinset, ‖(analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ := h_norm_bound + _ = ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - R^2 / (star ρ)‖ := h_sum_eq + _ ≤ (1/(R^2/R1 - R1)) * (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) := h_step2 + _ ≤ (1/(R^2/R1 - R1)) * ((1/Real.log (R/R1)) * Real.log B) := by + apply mul_le_mul_of_nonneg_left h_sum_bound (div_nonneg zero_le_one (le_of_lt h_pos)) + _ = 1/((R^2/R1 - R1) * Real.log (R/R1)) * Real.log B := by + field_simp [ne_of_gt h_pos, ne_of_gt h_log_pos] + +lemma final_inequality + (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) + (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : + ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ_spec : + ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, + f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1 \ zerosetKfR R1 (by linarith) f, + + ‖(deriv f z / f z + - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ))‖ + ≤ + 16 * r^2 / ((r - r1)^3) * Real.log B + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) * Real.log B := by + intro z hz + + have hr_pos : 0 < r := by linarith [hr1pos, hr1_lt_r] + have hR1_pos : 0 < R1 := by linarith [hr_pos, hr_lt_R1] + + have hz_in_r : z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f := by + constructor + · apply Metric.closedBall_subset_closedBall (le_of_lt hr1_lt_r) + exact hz.1 + · exact hz.2 + + have hineq := + target_inequality_setup hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz_in_r + + have hz_in_R1 : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f := by + constructor + · apply Metric.closedBall_subset_closedBall + exact le_of_lt (lt_trans hr1_lt_r hr_lt_R1) + exact hz.1 + · exact hz.2 + + have hsum := + final_sum_bound hR1_pos hR1_lt_R hR_lt_1 hB h_f_analytic h_f_zero h_finite_zeros h_f_bounded z hz_in_R1 + + have hz_le_r1 : ‖z‖ ≤ r1 := by simpa [Metric.mem_closedBall, dist_eq_norm] using hz.1 + + have hz_abs : ‖z‖ ≤ r1 := hz_le_r1 + + have h_BC := apply_BC_to_Lf + (B := B) (r1 := r1) (r := r) (R := R) (R1 := R1) + (hB := hB) (hr1_pos := hr1pos) (hr1_lt_r := hr1_lt_r) (hr_lt_R1 := hr_lt_R1) + (hR1_pos := hR1_pos) (hR1_lt_R := hR1_lt_R) (hR_lt_1 := hR_lt_1) + (f := f) (h_f_analytic := h_f_analytic) (h_f_zero := h_f_zero) + (h_finite_zeros := h_finite_zeros) (h_σ := h_σ) (h_σ_spec := h_σ_spec) + (h_f_bound := fun w hw => h_f_bounded w (Metric.mem_closedBall.mpr (by simpa [dist_eq_norm] using hw))) + z hz_abs + + have hLf : ‖deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z‖ ≤ + 16 * r^2 / ((r - r1)^3) * Real.log B := by + + convert h_BC using 1 + + ring + + exact le_trans hineq (add_le_add hLf hsum) + +lemma final_ineq1 + (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) + (hR1_lt_R : R1 < R) (hR : R < 1) + (f : ℂ → ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) + (h_f_zero : f 0 = 1) + (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) + (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) + (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : + ∀ z ∈ Metric.closedBall (0 : ℂ) r1 \ zerosetKfR R1 (by linarith) f, + ‖(deriv f z / f z) - ∑ ρ ∈ h_finite_zeros.toFinset, + (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ + (16 * r^2 / ((r - r1)^3) + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log B := by + intro z hz + + have h_bound : ‖(deriv f z / f z) - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ + 16 * r^2 / ((r - r1)^3) * Real.log B + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) * Real.log B := by + apply final_inequality <;> assumption + + rw [← add_mul] at h_bound + exact h_bound + +end Erdos970 diff --git a/StrongPNT/Erdos970/PNT3_RiemannZeta.lean b/StrongPNT/Erdos970/PNT3_RiemannZeta.lean new file mode 100644 index 0000000..0ab91b1 --- /dev/null +++ b/StrongPNT/Erdos970/PNT3_RiemannZeta.lean @@ -0,0 +1,4546 @@ +import StrongPNT.Erdos970.PNT2_LogDerivative + +namespace Erdos970 + + +open scoped BigOperators Topology +abbrev ℙ := Nat.Primes + +lemma p_s_abs_1 (p : ℙ) (s : ℂ) (hs : 1 < s.re) : norm (((p : ℕ) : ℂ) ^ (-s : ℂ)) < 1 := by + + have hx1 : 1 < ((p : ℕ) : ℝ) := by + have h2 : (2 : ℝ) ≤ ((p : ℕ) : ℝ) := by + exact_mod_cast (p.2.two_le : 2 ≤ (p : ℕ)) + exact lt_of_lt_of_le one_lt_two h2 + have hx0 : 0 < ((p : ℕ) : ℝ) := lt_trans zero_lt_one hx1 + + have hnorm_eq : ‖(((p : ℕ) : ℂ) ^ (-s : ℂ))‖ = ((p : ℕ) : ℝ) ^ ((-s : ℂ).re) := by + simpa using (Complex.norm_cpow_eq_rpow_re_of_pos hx0 (-s : ℂ)) + + have hz : ((-s : ℂ).re) < 0 := by + have h0 : 0 < s.re := lt_trans zero_lt_one hs + have : -s.re < 0 := neg_lt_zero.mpr h0 + simpa using this + + have hlt : ((p : ℕ) : ℝ) ^ ((-s : ℂ).re) < 1 := + Real.rpow_lt_one_of_one_lt_of_neg hx1 hz + + have : ‖(((p : ℕ) : ℂ) ^ (-s : ℂ))‖ < 1 := by simpa [hnorm_eq] using hlt + simpa [norm] using this + +lemma zetaEulerprod (s : ℂ) (hs : 1 < s.re) : Multipliable (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) ∧ riemannZeta s = ∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹ := by + have hprod : HasProd (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) (riemannZeta s) := by + simpa using (riemannZeta_eulerProduct_hasProd (s := s) hs) + refine And.intro ?_ ?_ + · exact hprod.multipliable + · simpa using (hprod.tprod_eq.symm) + +lemma abs_of_tprod {P : Type*} (w : P → ℂ) (hw : Multipliable w) : norm (∏' p : P, w p) = ∏' p : P, norm (w p) := by exact Multipliable.norm_tprod hw + +lemma abs_P_prod (s : ℂ) (hs : 1 < s.re) : norm (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) = ∏' p : ℙ, norm ((1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by + have hw : Multipliable (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := (zetaEulerprod s hs).1 + simpa using abs_of_tprod (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) hw + +lemma abs_zeta_prod (s : ℂ) (hs : 1 < s.re) : norm (riemannZeta s) = ∏' p : ℙ, norm ((1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by + rw [zetaEulerprod s hs |>.2, abs_P_prod s hs] + +lemma abs_of_inv (z : ℂ) (_hz : z ≠ 0) : norm (z⁻¹) = (norm z)⁻¹ := norm_inv z + +lemma one_minus_p_s_neq_0 (p : ℙ) (s : ℂ) (hs : 1 < s.re) : 1 - ((p : ℕ) : ℂ) ^ (-s : ℂ) ≠ 0 := by + intro h + have hz : ((p : ℕ) : ℂ) ^ (-s : ℂ) = 1 := by + simpa using (sub_eq_zero.mp h).symm + have : (1 : ℝ) < 1 := by + simpa [hz] using (p_s_abs_1 p s hs) + exact (lt_irrefl (1 : ℝ)) this + +lemma abs_zeta_prod_prime (s : ℂ) (hs : 1 < s.re) : + norm (riemannZeta s) = ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ)))⁻¹ := by + rw [abs_zeta_prod s hs] + congr 1 + ext p + rw [abs_of_inv (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ)) (one_minus_p_s_neq_0 p s hs)] + +lemma Re2s (s : ℂ) : (2 * s).re = 2 * s.re := by simp + +lemma Re2sge1 (s : ℂ) (hs : 1 < s.re) : 1 < (2 * s).re := by + rw [Re2s] + linarith + +lemma zeta_ratio_prod (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-(2 * s) : ℂ))⁻¹) / (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by + have h2 := (zetaEulerprod (2 * s) (Re2sge1 s hs)).2 + have h1 := (zetaEulerprod s hs).2 + simp [h2, h1] + +local notation "ι" => fun (z : ℂˣ) ↦ (z : ℂ) + +theorem tprod_commutes_with_inclusion_infinite {α : Type*} (f : α → ℂˣ) (h : Multipliable f) : + ι (tprod f) = tprod (fun i ↦ ι (f i)) := +by + change ((tprod f : ℂˣ) : ℂ) = tprod (fun i ↦ ((f i : ℂˣ) : ℂ)) + have hcont : Continuous (Units.coeHom ℂ) := by + simpa using! (Units.continuous_val : Continuous (fun u : ℂˣ => ((u : ℂˣ) : ℂ))) + simpa [Units.coeHom] using + (Multipliable.map_tprod (f := f) (γ := ℂ) h (g := Units.coeHom ℂ) hcont) + +theorem inclusion_commutes_with_division (a b : ℂˣ) : + ι (a / b) = ι a / ι b := by + exact Units.val_div_eq_div_val a b + +lemma lift_multipliable_of_nonzero {P : Type*} (a : P → ℂ) (ha : Multipliable a) (h_a_nonzero : ∀ p, a p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0): + Multipliable (fun p ↦ Units.mk0 (a p) (h_a_nonzero p)) := by + + obtain ⟨A, hA⟩ := ha + have hA_nonzero := hA_nonzero' A hA + refine ⟨Units.mk0 A hA_nonzero, ?_⟩ + simp [HasProd, tendsto_nhds] at hA ⊢ + intro sU h_sU_open hA_mem + have hA_im_mem : ι (Units.mk0 A hA_nonzero) ∈ ι '' sU := Set.mem_image_of_mem ι hA_mem + have sU_im_open : IsOpen (ι '' sU) := by + apply (Topology.IsOpenEmbedding.isOpen_iff_image_isOpen ?_).mp + assumption + exact Units.isOpenEmbedding_val + have := hA (ι '' sU) sU_im_open hA_im_mem + obtain ⟨a1, ha⟩ := this + use a1 + intro b ha1 + obtain ⟨x', x'_spec_mem, x'_spec_eq⟩ := ha b ha1 + suffices x' = ∏ b ∈ b, Units.mk0 (a b) (by simp [*]) by + rwa [← this] + have : Units.mk0 (ι x') (Units.ne_zero x') = x' := + Units.mk0_val x' (Units.ne_zero x') + have this2 : (Units.mk0 (∏ b ∈ b, a b) + (Finset.prod_ne_zero_iff.mpr fun a a_1 => h_a_nonzero a)) = x' := + Units.ext (id (Eq.symm x'_spec_eq)) + rw [Units.mk0_prod] at this2 + rw [←this2] + conv => + rhs + rw [← Finset.prod_attach] + +lemma prod_of_ratios_simplified {P : Type*} (a b : P → ℂ) +(ha : Multipliable a) (hb : Multipliable b) + (h_a_nonzero : ∀ p, a p ≠ 0) (h_b_nonzero : ∀ p, b p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0) (hB_nonzero' : ∀ A, HasProd b A → A ≠ 0): + (∏' p : P, a p) / (∏' p : P, b p) = ∏' p : P, (a p / b p) := by + + let a' : P → ℂˣ := fun p ↦ Units.mk0 (a p) (h_a_nonzero p) + let b' : P → ℂˣ := fun p ↦ Units.mk0 (b p) (h_b_nonzero p) + + have h_multipliable_a' : Multipliable a' := lift_multipliable_of_nonzero a ha h_a_nonzero hA_nonzero' + have h_multipliable_b' : Multipliable b' := lift_multipliable_of_nonzero b hb h_b_nonzero hB_nonzero' + have h_multipliable_a'_div_b' : Multipliable (fun p ↦ a' p / b' p) := Multipliable.div h_multipliable_a' h_multipliable_b' + + calc + (∏' p, a p) / (∏' p, b p) + + _ = (∏' p, ι (a' p)) / (∏' p, ι (b' p)) := by simp [a', b'] + + _ = ι (∏' p, a' p) / ι (∏' p, b' p) := by simp [tprod_commutes_with_inclusion_infinite, *] + + _ = ι ((∏' p, a' p) / (∏' p, b' p)) := by rw [← inclusion_commutes_with_division] + + _ = ι (∏' p, a' p / b' p) := by simp [Multipliable.tprod_div, *] + + _ = ∏' p, ι (a' p / b' p) := by simp [tprod_commutes_with_inclusion_infinite, *] + + _ = ∏' p, (ι (a' p) / ι (b' p)) := by simp + + _ = ∏' p, a p / b p := by simp [a', b'] + +lemma prod_of_ratios {P : Type*} (a b : P → ℂ) (ha : Multipliable a) (hb : Multipliable b) (h_b_nonzero : ∀ p, b p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0) (hB_nonzero' : ∀ B, HasProd b B → B ≠ 0): + (∏' p : P, a p) / (∏' p : P, b p) = ∏' p : P, (a p / b p) := by + + by_cases h_a_zero : ∃ p, a p = 0 + case pos => + + have lhs_zero : ∏' p : P, a p = 0 := by + + exact tprod_of_exists_eq_zero h_a_zero + have rhs_zero : ∏' p : P, (a p / b p) = 0 := by + + obtain ⟨p₀, hp₀⟩ := h_a_zero + have h_div_zero : ∃ p, (a p / b p) = 0 := by + use p₀ + simp [hp₀] + exact tprod_of_exists_eq_zero h_div_zero + simp [lhs_zero, rhs_zero] + case neg => + + push Not at h_a_zero + + exact prod_of_ratios_simplified a b ha hb h_a_zero h_b_nonzero hA_nonzero' hB_nonzero' + +lemma simplify_prod_ratio (s : ℂ) (hs : 1 < s.re) : (∏' p : ℙ, (1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹) / (∏' p : ℙ, (1 - (p : ℂ) ^ (-s : ℂ))⁻¹) = ∏' p : ℙ, ((1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹ / (1 - (p : ℂ) ^ (-s : ℂ))⁻¹) := by + + let a := fun p : ℙ => (1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹ + let b := fun p : ℙ => (1 - (p : ℂ) ^ (-s : ℂ))⁻¹ + + have ha : Multipliable a := (zetaEulerprod (2 * s) (Re2sge1 s hs)).1 + have hb : Multipliable b := (zetaEulerprod s hs).1 + + have h_b_nonzero : ∀ p, b p ≠ 0 := by + intro p + exact inv_ne_zero (one_minus_p_s_neq_0 p s hs) + + exact prod_of_ratios a b ha hb h_b_nonzero (by + intro A hA + + have h_eq : A = riemannZeta (2 * s) := by + have h : HasProd a (riemannZeta (2 * s)) := by + simpa [a] using riemannZeta_eulerProduct_hasProd (s := 2 * s) (by simp; linarith) + exact HasProd.unique hA h + rw [h_eq] + exact riemannZeta_ne_zero_of_one_lt_re (by simp; linarith) + ) (by + intro B hB + + have h_eq : B = riemannZeta s := by + have h : HasProd b (riemannZeta s) := by + simpa [b] using riemannZeta_eulerProduct_hasProd (s := s) hs + exact HasProd.unique hB h + rw [h_eq] + exact riemannZeta_ne_zero_of_one_lt_re hs + ) + +lemma zeta_ratios (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = ∏' p : ℙ, ((1 - ((p : ℕ) : ℂ) ^ (-(2 * s) : ℂ))⁻¹ / (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by + have h1 := zeta_ratio_prod s hs + have h2 := simplify_prod_ratio s hs + exact h1.trans h2 + +lemma diff_of_squares (z : ℂ) : 1 - z^2 = (1 - z) * (1 + z) := by ring + +lemma one_sub_ne_zero_of_abs_lt_one (z : ℂ) (hz : norm z < 1) : 1 - z ≠ 0 := by + intro h + have h1 : 1 = z := by + have := congrArg (fun w : ℂ => w + z) h + simpa [sub_add_cancel, zero_add] using this + have habs1lt : norm (1 : ℂ) < 1 := by simpa [h1] using hz + have hnorm1lt : ‖(1 : ℂ)‖ < 1 := by simp [norm] at habs1lt + have : (1 : ℝ) < 1 := by simp [norm_one] at hnorm1lt + exact (lt_irrefl _) this + +lemma one_add_ne_zero_of_abs_lt_one (z : ℂ) (hz : norm z < 1) : 1 + z ≠ 0 := by + have hz' : norm (-z) < 1 := by + simpa [norm, norm_neg] using hz + simpa [sub_eq_add_neg] using one_sub_ne_zero_of_abs_lt_one (-z) hz' + +lemma inv_mul_div_cancel_right_of_ne_zero (a b : ℂ) (ha : a ≠ 0) : ((a * b)⁻¹) / a⁻¹ = b⁻¹ := by + simp [div_eq_mul_inv, inv_inv, mul_inv_rev, mul_comm, ha] + +lemma ratio_invs (z : ℂ) (hz : norm z < 1) : (1 - z^2)⁻¹ / (1 - z)⁻¹ = (1 + z)⁻¹ := by + have hz1 : 1 - z ≠ 0 := one_sub_ne_zero_of_abs_lt_one z hz + simpa [diff_of_squares z] using + inv_mul_div_cancel_right_of_ne_zero (1 - z) (1 + z) hz1 + +lemma complex_cpow_neg_two_mul (z w : ℂ) (_hz : z ≠ 0) : z^(-(2*w)) = (z^(-w))^2 := by + have h1 : -(2*w) = 2*(-w) := by ring + rw [h1] + have h2 : (2 : ℂ)*(-w) = ((2 : ℕ) : ℂ)*(-w) := by norm_cast + rw [h2, Complex.cpow_nat_mul] + +theorem zeta_ratio_identity (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹ := by + rw [zeta_ratios s hs]; congr 1; ext p + have hp : ((p : ℕ) : ℂ) ≠ 0 := by rw [ne_eq, Nat.cast_eq_zero]; exact Nat.Prime.ne_zero p.2 + have h1 : ((p : ℕ) : ℂ) ^ (-(2 * s)) = (((p : ℕ) : ℂ) ^ (-s))^2 := complex_cpow_neg_two_mul ((p : ℕ) : ℂ) s hp + have h2 : norm (((p : ℕ) : ℂ) ^ (-s)) < 1 := p_s_abs_1 p s hs + rw [h1]; exact ratio_invs (((p : ℕ) : ℂ) ^ (-s)) h2 + +lemma two_mul_ofReal_div_two (r : ℝ) : (2 : ℂ) * ((r : ℝ) / 2 : ℂ) = (r : ℂ) := by + have hreal : (2 : ℝ) * (r / 2) = r := by + calc + (2 : ℝ) * (r / 2) = (2 : ℝ) * r / 2 := by + have h : (2 : ℝ) * r / 2 = (2 : ℝ) * (r / 2) := by + simpa using (mul_div_assoc (2 : ℝ) r (2 : ℝ)) + simpa using h.symm + _ = r := by + simp + calc + (2 : ℂ) * ((r : ℝ) / 2 : ℂ) + = ((2 * (r / 2) : ℝ) : ℂ) := by + simp + _ = (r : ℂ) := by simp [hreal] + +lemma zeta_ratio_identity_ofReal_div_two (r : ℝ) (hr : 1 < ( ((r : ℝ) / 2 : ℂ) ).re) : riemannZeta (r : ℂ) / riemannZeta ((r / 2 : ℝ) : ℂ) = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-(((r : ℝ) / 2) : ℂ)))⁻¹ := by + have h := zeta_ratio_identity (((r : ℝ) / 2 : ℂ)) hr + simpa [two_mul_ofReal_div_two r] using h + +lemma zeta_ratio_at_3_2 : riemannZeta 3 / riemannZeta ((3 : ℝ) / 2) = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ := by + have hr : 1 < (((3 : ℝ) / 2 : ℂ)).re := by + simpa using (by norm_num : (1 : ℝ) < (3 : ℝ) / 2) + simpa using zeta_ratio_identity_ofReal_div_two (3 : ℝ) hr + +lemma triangle_inequality_specific (z : ℂ) : norm (1 - z) ≤ 1 + norm z := by + simpa [sub_eq_add_neg, norm_one, norm_neg] using (norm_add_le (1 : ℂ) (-z)) + +lemma re_neg_eq_neg_re (s : ℂ) : (-s).re = - s.re := by + simp + +lemma abs_cpow_eq_rpow_re_of_pos {x : ℝ} (hx : 0 < x) (y : ℂ) : norm ((x : ℂ) ^ y) = x ^ y.re := by + simpa using Complex.norm_cpow_eq_rpow_re_of_pos hx y + +lemma abs_p_pow_s (p : ℙ) (s : ℂ) : norm (((p : ℕ) : ℂ) ^ (-s : ℂ)) = ((p : ℕ) : ℝ) ^ (-s.re : ℝ) := by + have hx : 0 < ((p : ℕ) : ℝ) := by + exact_mod_cast (p.property.pos : 0 < (p : ℕ)) + simpa [Complex.ofReal_natCast, re_neg_eq_neg_re] using + (abs_cpow_eq_rpow_re_of_pos hx (-s)) + +lemma abs_term_bound (p : ℙ) (t : ℝ) : + norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) ≤ 1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by + + have h1 := triangle_inequality_specific (((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) + + have h2 := abs_p_pow_s p (((3 : ℝ) / 2) + t * Complex.I) + + have h3 : (((3 : ℝ) / 2) + t * Complex.I).re = ((3 : ℝ) / 2) := by simp [Complex.add_re, Complex.ofReal_re] + + have h4 : -(((3 : ℝ) / 2) + t * Complex.I).re = -((3 : ℝ) / 2) := by rw [h3] + + have h5 : norm (((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) = ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by + rw [h2, h4] + + rw [h5] at h1 + exact h1 + +lemma inv_inequality {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : b⁻¹ ≤ a⁻¹ := by + simpa [one_div] using (one_div_le_one_div_of_le ha hab) + +lemma eq_of_one_sub_eq_zero (z : ℂ) (h : 1 - z = 0) : z = 1 := by + rw [sub_eq_zero] at h + exact h.symm + +lemma condp32 (p : ℙ) (t : ℝ) : 1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) ≠ 0 := by + intro h + have hp_eq_one : ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) = 1 := eq_of_one_sub_eq_zero _ h + let s := ((3 : ℝ) / 2) + t * Complex.I + have hs : 1 < s.re := by + simp only [s, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, mul_zero] + norm_num + have h_abs_lt : norm (((p : ℕ) : ℂ) ^ (-s)) < 1 := p_s_abs_1 p s hs + have h_s_eq : ((p : ℕ) : ℂ) ^ (-s) = ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) := by simp only [s] + rw [h_s_eq, hp_eq_one] at h_abs_lt + have : norm (1 : ℂ) = 1 := by simp [norm] + rw [this] at h_abs_lt + exact lt_irrefl 1 h_abs_lt + +lemma abs_term_inv_bound (p : ℙ) (t : ℝ) : (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ≤ (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by + have h1 := abs_term_bound p t + have h2 := condp32 p t + have h3 := lem_abspos _ h2 + exact inv_inequality h3 h1 + +open NNReal in +lemma prod_inequality {P : Type*} (a b : P → ℝ≥0) (ha : Multipliable a) (hb : Multipliable b) + (hab : ∀ p : P, a p ≤ b p) : + ∏' p : P, a p ≤ ∏' p : P, b p := by + exact Multipliable.tprod_le_tprod hab ha hb + +lemma multipliable_complex_abs_inv {i : Type*} (g : i → ℂ) (h_mult : Multipliable (fun i => (1 - g i)⁻¹)) (_h_nonzero : ∀ i, 1 - g i ≠ 0) : Multipliable (fun i => (norm (1 - g i))⁻¹) := by + + have h_eq : (fun i => (norm (1 - g i))⁻¹) = (fun i => ‖1 - g i‖⁻¹) := by + ext i + simp + rw [h_eq] + + have h_norm_mult : Multipliable (fun i => ‖(1 - g i)⁻¹‖) := Multipliable.norm h_mult + have h_norm_eq : (fun i => ‖(1 - g i)⁻¹‖) = (fun i => ‖1 - g i‖⁻¹) := by + ext i + rw [norm_inv] + rwa [← h_norm_eq] + +lemma multipliable_positive_inv_powers (r : ℝ) (hr : 1 < r) : Multipliable (fun p : ℙ => (1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹) := by + + have h_sum : Summable (fun p : ℙ => ((p : ℕ) : ℝ) ^ (-r)) := by + rw [Nat.Primes.summable_rpow] + linarith + + have h_log_sum : Summable (fun p : ℙ => Real.log (1 + ((p : ℕ) : ℝ) ^ (-r))) := by + exact Real.summable_log_one_add_of_summable h_sum + + have h_log_inv_sum : Summable (fun p : ℙ => Real.log ((1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹)) := by + have h_eq : (fun p : ℙ => Real.log ((1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹)) = + (fun p : ℙ => -(Real.log (1 + ((p : ℕ) : ℝ) ^ (-r)))) := by + ext p + rw [Real.log_inv] + rw [h_eq] + exact Summable.neg h_log_sum + + have h_pos : ∀ p : ℙ, 0 < (1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹ := by + intro p + apply inv_pos.mpr + have h_ge : 0 ≤ ((p : ℕ) : ℝ) ^ (-r) := Real.rpow_nonneg (Nat.cast_nonneg _) _ + linarith + + exact Real.multipliable_of_summable_log h_pos h_log_inv_sum + +lemma hasProd_map_nnreal_coe {i : Type*} (f : i → NNReal) (a : NNReal) (h : HasProd f a) : HasProd (fun i => (f i : ℝ)) ((a : NNReal) : ℝ) := by + have hcont : Continuous (⇑NNReal.toRealHom) := by + rw [NNReal.coe_toRealHom] + exact NNReal.continuous_coe + exact HasProd.map h NNReal.toRealHom hcont + +lemma multipliable_nnreal_coe {i : Type*} (f : i → NNReal) (hf : Multipliable f) : Multipliable (fun i => (f i : ℝ)) := by + + obtain ⟨a, ha⟩ := hf + + have h_coe := hasProd_map_nnreal_coe f a ha + + exact ⟨(a : ℝ), h_coe⟩ + +lemma nnreal_coe_tprod_eq {i : Type*} (f : i → NNReal) (_hf : Multipliable f) : (∏' i : i, f i : ℝ) = ∏' i : i, (f i : ℝ) := by + rfl + +lemma hasProd_nonneg_of_pos {i : Type*} (f : i → ℝ) (hpos : ∀ i, 0 < f i) (a : ℝ) (ha : HasProd f a) : 0 ≤ a := by + + have h_pos : ∀ s : Finset i, 0 < ∏ i ∈ s, f i := fun s => Finset.prod_pos (fun i _ => hpos i) + + have h_nonneg : ∀ s : Finset i, 0 ≤ ∏ i ∈ s, f i := fun s => le_of_lt (h_pos s) + + exact ge_of_tendsto ha (Filter.Eventually.of_forall h_nonneg) + +lemma tendsto_finprod_coe_iff_tendsto_coe_finprod {i : Type*} (f : i → NNReal) (a : NNReal) : + Filter.Tendsto (fun s => ∏ i ∈ s, (f i : ℝ)) Filter.atTop (𝓝 (a : ℝ)) ↔ + Filter.Tendsto ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) Filter.atTop (𝓝 (a : ℝ)) := by + + have h_comp : ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) = (fun s => ↑(∏ i ∈ s, f i)) := by + rfl + + have h_eq : (fun s => ∏ i ∈ s, (f i : ℝ)) = (fun s => ↑(∏ i ∈ s, f i)) := by + ext s + exact (NNReal.coe_prod s f).symm + + rw [h_comp, ← h_eq] + +lemma pnt_nnreal_isEmbedding_coe : Topology.IsEmbedding (fun x : NNReal => (x : ℝ)) := by + refine ⟨?_, NNReal.coe_injective⟩ + + exact Topology.IsInducing.subtypeVal + +lemma HasProd.of_coe_hasProd {i : Type*} (f : i → NNReal) (a : NNReal) (h : HasProd (fun i => (f i : ℝ)) (a : ℝ)) : HasProd f a := by + + have h_comp : Filter.Tendsto ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) Filter.atTop (𝓝 (a : ℝ)) := by + rw [← tendsto_finprod_coe_iff_tendsto_coe_finprod] + exact h + + have h_embed : Topology.IsEmbedding (fun x : NNReal => (x : ℝ)) := pnt_nnreal_isEmbedding_coe + + exact h_embed.tendsto_nhds_iff.mpr h_comp + +lemma hasProd_nnreal_of_coe {i : Type*} (g : i → NNReal) (b : NNReal) (h : HasProd (fun i => (g i : ℝ)) (b : ℝ)) : HasProd g b := by + exact HasProd.of_coe_hasProd g b h + +lemma multipliable_real_to_nnreal {i : Type*} (f : i → ℝ) (hpos : ∀ i, 0 < f i) (h_mult : Multipliable f) : Multipliable (fun i => ⟨f i, le_of_lt (hpos i)⟩ : i → NNReal) := by + + obtain ⟨a, ha⟩ := h_mult + + have ha_nonneg : 0 ≤ a := hasProd_nonneg_of_pos f hpos a ha + + let a_nnreal : NNReal := ⟨a, ha_nonneg⟩ + + have h_coe_eq : (fun i => ((⟨f i, le_of_lt (hpos i)⟩ : NNReal) : ℝ)) = f := by + ext i + rfl + + have ha_coe : HasProd (fun i => ((⟨f i, le_of_lt (hpos i)⟩ : NNReal) : ℝ)) (a_nnreal : ℝ) := by + rw [h_coe_eq] + simp only [a_nnreal] + exact ha + + have ha_nnreal : HasProd (fun i => ⟨f i, le_of_lt (hpos i)⟩) a_nnreal := + hasProd_nnreal_of_coe (fun i => ⟨f i, le_of_lt (hpos i)⟩) a_nnreal ha_coe + + exact ⟨a_nnreal, ha_nnreal⟩ + +lemma nnreal_coe_tprod_eq_tprod_coe {i : Type*} (f : i → NNReal) (hf : Multipliable f) : + ∏' i, (↑(f i) : ℝ) = ↑(∏' i, f i) := by + + have h_prod : HasProd f (∏' i, f i) := Multipliable.hasProd hf + + have h_map : HasProd (NNReal.toRealHom ∘ f) (NNReal.toRealHom (∏' i, f i)) := + HasProd.map h_prod NNReal.toRealHom NNReal.continuous_coe + + have h_comp : NNReal.toRealHom ∘ f = fun i => (↑(f i) : ℝ) := by + ext i + rfl + have h_val : NNReal.toRealHom (∏' i, f i) = ↑(∏' i, f i) := rfl + + rw [h_comp, h_val] at h_map + + exact HasProd.tprod_eq h_map + +lemma nnreal_tprod_le_coe {i : Type*} (f g : i → NNReal) (hf : Multipliable f) (hg : Multipliable g) (h : ∏' i, f i ≤ ∏' i, g i) : ∏' i, (f i : ℝ) ≤ ∏' i, (g i : ℝ) := by + + rw [nnreal_coe_tprod_eq_tprod_coe f hf, nnreal_coe_tprod_eq_tprod_coe g hg] + + exact NNReal.coe_le_coe.mpr h + +lemma abs_zeta_inequality (t : ℝ) : + ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ≤ + ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by + + have h_pos_left : ∀ p : ℙ, 0 < (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by + intro p + apply inv_pos.mpr + apply add_pos zero_lt_one + + apply Real.rpow_pos_of_pos + exact_mod_cast (p.property.pos : 0 < (p : ℕ)) + + have h_pos_right : ∀ p : ℙ, 0 < (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by + intro p + apply inv_pos.mpr + + rw [norm_pos_iff] + exact condp32 p t + + have h_mult_left : Multipliable (fun p : ℙ => (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹) := + multipliable_positive_inv_powers ((3 : ℝ) / 2) (by norm_num : 1 < (3 : ℝ) / 2) + + have h_mult_right : Multipliable (fun p : ℙ => (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹) := by + let s := ((3 : ℝ) / 2) + t * Complex.I + have hs : 1 < s.re := by + simp only [s, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, mul_zero] + norm_num + + have h_euler := (zetaEulerprod s hs).1 + have h_nonzero : ∀ p : ℙ, 1 - ((p : ℕ) : ℂ) ^ (-s) ≠ 0 := fun p => condp32 p t + exact multipliable_complex_abs_inv (fun p : ℙ => ((p : ℕ) : ℂ) ^ (-s)) h_euler h_nonzero + + let f : ℙ → NNReal := fun p => ⟨(1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹, le_of_lt (h_pos_left p)⟩ + let g : ℙ → NNReal := fun p => ⟨(norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹, le_of_lt (h_pos_right p)⟩ + + have hf : Multipliable f := multipliable_real_to_nnreal _ h_pos_left h_mult_left + have hg : Multipliable g := multipliable_real_to_nnreal _ h_pos_right h_mult_right + + have h_pointwise : ∀ p : ℙ, f p ≤ g p := by + intro p + simp only [f, g] + exact abs_term_inv_bound p t + + have h_nnreal_ineq : ∏' p, f p ≤ ∏' p, g p := prod_inequality f g hf hg h_pointwise + + have h_convert : ∏' p, (f p : ℝ) ≤ ∏' p, (g p : ℝ) := nnreal_tprod_le_coe f g hf hg h_nnreal_ineq + + have h_eq_f : ∏' p, (f p : ℝ) = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by + rfl + + have h_eq_g : ∏' p, (g p : ℝ) = ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by + rfl + + rw [h_eq_f, h_eq_g] at h_convert + exact h_convert + +lemma abs_zeta_ratio_eval : norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by + + have hratio := zeta_ratio_at_3_2 + + let w : ℙ → ℂ := fun p => (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ + let u : ℙ → ℝ := fun p => (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ + + have hu_mult : Multipliable u := + multipliable_positive_inv_powers ((3 : ℝ) / 2) (by norm_num : 1 < (3 : ℝ) / 2) + + have hw_eq : w = fun p : ℙ => (u p : ℂ) := by + funext p + + have hx : 0 ≤ ((p : ℕ) : ℝ) := by exact_mod_cast (Nat.zero_le (p : ℕ)) + have hcpow : (((((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2))) : ℝ) : ℂ) + = ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)) := by + simpa using (Complex.ofReal_cpow (x := ((p : ℕ) : ℝ)) (hx := hx) (y := -((3 : ℝ) / 2))) + calc + w p = (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ := rfl + _ = (1 + (((((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2))) : ℝ) : ℂ))⁻¹ := by + simp [hcpow] + _ = (((1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ : ℝ) : ℂ) := by + simp [Complex.ofReal_add, Complex.ofReal_inv, Complex.ofReal_one] + + have hw_mult : Multipliable w := by + have hmap : Multipliable ((fun x : ℝ => (x : ℂ)) ∘ u) := + Multipliable.map (hf := hu_mult) Complex.ofRealHom Complex.continuous_ofReal + simpa [hw_eq] using! hmap + + have h_abs_tprod : norm (∏' p : ℙ, w p) = ∏' p : ℙ, norm (w p) := + abs_of_tprod w hw_mult + + have h_abs_eq_fun : (fun p : ℙ => norm (w p)) = u := by + funext p + + have hge : 0 ≤ ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := + Real.rpow_nonneg (by exact_mod_cast (Nat.zero_le (p : ℕ))) _ + have hpos : 0 < 1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by linarith + have hnonneg : 0 ≤ u p := by + have : 0 < (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := inv_pos.mpr hpos + exact this.le + + simp [hw_eq, Complex.norm_real, abs_of_nonneg hnonneg] + + have h_abs_ratio : norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) + = norm (∏' p : ℙ, w p) := by + simpa [w] using congrArg norm hratio + calc + norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) + = norm (∏' p : ℙ, w p) := h_abs_ratio + _ = ∏' p : ℙ, norm (w p) := h_abs_tprod + _ = ∏' p : ℙ, u p := by simp [h_abs_eq_fun] + _ = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := rfl + +theorem zeta_lower_bound (t : ℝ) : + norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ≤ + norm (riemannZeta (((3 : ℝ) / 2) + t * Complex.I)) := by + have hs : 1 < (((3 : ℝ) / 2 : ℂ) + t * Complex.I).re := by + simp only [Complex.add_re, Complex.mul_I_re] + norm_num + calc + norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) + = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := abs_zeta_ratio_eval + _ ≤ ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := + abs_zeta_inequality t + _ = norm (riemannZeta (((3 : ℝ) / 2 : ℂ) + t * Complex.I)) := by + simpa using (abs_zeta_prod_prime (((3 : ℝ) / 2 : ℂ) + t * Complex.I) hs).symm + +lemma summable_one_div_nat_add_rpow' {x : ℝ} (hx : 1 < x) : Summable (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x)) := by + have h := (Real.summable_one_div_nat_add_rpow (1 : ℝ) x).2 hx + have h' : Summable (fun n : ℕ => (|((n : ℝ) + 1)| ^ x)⁻¹) := by + simpa [one_div] using h + have h2 : (fun n : ℕ => (|((n : ℝ) + 1)| ^ x)⁻¹) = (fun n : ℕ => (((n : ℝ) + 1) ^ x)⁻¹) := by + funext n + have hn : 0 ≤ (n : ℝ) + 1 := by + have : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) + exact add_nonneg this (show 0 ≤ (1 : ℝ) from zero_le_one) + simp [abs_of_nonneg hn] + have h'' : Summable (fun n : ℕ => (((n : ℝ) + 1) ^ x)⁻¹) := by + simpa [h2] using h' + have h''' : Summable (fun n : ℕ => ((n + 1 : ℝ) ^ x)⁻¹) := by + simpa [Nat.cast_add] using h'' + simpa [one_div] using h''' + +lemma tsum_pos_of_pos_first_term {f : ℕ → ℝ} (hf : Summable f) (h0 : 0 < f 0) (hnonneg : ∀ n, 0 ≤ f n) : 0 < ∑' n, f n := by + have hsum0 : ∑ n ∈ Finset.range 1, f n = f 0 := by + simp + have hpos_partial : 0 < ∑ n ∈ Finset.range 1, f n := by + simpa [hsum0] using h0 + have hsumle : ∑ n ∈ Finset.range 1, f n ≤ ∑' n, f n := by + have hnonneg' : ∀ n ∉ Finset.range 1, 0 ≤ f n := by + intro n hn + exact hnonneg n + simpa using (hf.sum_le_tsum (s := Finset.range 1) hnonneg') + exact lt_of_lt_of_le hpos_partial hsumle + +lemma first_term_pos (x : ℝ) : 0 < (1 : ℝ) / ((1 : ℝ) ^ x) := by + simp [Real.one_rpow] + +lemma terms_nonneg (x : ℝ) : ∀ n : ℕ, 0 ≤ (1 : ℝ) / ((n + 1 : ℝ) ^ x) := by + intro n + have hposb' : 0 < ((n : ℝ) + 1) := + add_pos_of_nonneg_of_pos (show 0 ≤ (n : ℝ) from by exact_mod_cast (Nat.zero_le n)) zero_lt_one + have hposb : 0 < ((n + 1 : ℝ)) := by + simpa [Nat.cast_add, Nat.cast_one] using hposb' + have hdenpos : 0 < ((n + 1 : ℝ) ^ x) := by + simpa using (Real.rpow_pos_of_pos hposb x) + have hden_nonneg : 0 ≤ ((n + 1 : ℝ) ^ x) := le_of_lt hdenpos + have hnum_nonneg : 0 ≤ (1 : ℝ) := le_of_lt (zero_lt_one : 0 < (1 : ℝ)) + exact div_nonneg hnum_nonneg hden_nonneg + +lemma term_eq_ofRealC (x : ℝ) (n : ℕ) : (1 / ((n + 1 : ℂ) ^ (x : ℂ))) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by + have hbase_nonneg : 0 ≤ (n + 1 : ℝ) := by + have hn : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) + have : 0 ≤ (n : ℝ) + 1 := add_nonneg hn (show 0 ≤ (1 : ℝ) from zero_le_one) + simpa [Nat.cast_add, Nat.cast_one] using this + have hpow' : ((n + 1 : ℂ) ^ (x : ℂ)) = (((n + 1 : ℝ) ^ x : ℝ) : ℂ) := by + simpa using (Complex.ofReal_cpow (x := (n + 1 : ℝ)) (hx := hbase_nonneg) (y := x)).symm + have hdiv : (1 : ℂ) / (((n + 1 : ℝ) ^ x : ℝ) : ℂ) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by + simp + calc + 1 / ((n + 1 : ℂ) ^ (x : ℂ)) + = (1 : ℂ) / (((n + 1 : ℝ) ^ x : ℝ) : ℂ) := by simp [hpow'] + _ = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := hdiv + +lemma zeta_eq_ofReal (x : ℝ) (hx : 1 < x) : + riemannZeta x = ((∑' n : ℕ, ((1 : ℝ) / ((n + 1 : ℝ) ^ x))) : ℝ) := by + + have h1 : riemannZeta (x : ℂ) = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) := by + apply zeta_eq_tsum_one_div_nat_add_one_cpow + simpa using hx + + have h2 : ∀ n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by + exact fun n => term_eq_ofRealC x n + + rw [h1] + simp_rw [h2] + + rw [← Complex.ofReal_tsum] + +lemma term_inv_eq_ofRealC (x : ℝ) (n : ℕ) : ((n + 1 : ℂ) ^ (x : ℂ))⁻¹ = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by + rw [inv_eq_one_div] + simpa using (term_eq_ofRealC x n) + +lemma im_tsum_ofReal (g : ℕ → ℝ) : (∑' n : ℕ, (g n : ℂ)).im = 0 := by + have him := congrArg Complex.im (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := g)).symm + have hz : (((∑' n : ℕ, g n) : ℝ) : ℂ).im = 0 := by + simp + exact Eq.trans him hz + +lemma re_tsum_ofReal (g : ℕ → ℝ) : (∑' n : ℕ, (g n : ℂ)).re = ∑' n : ℕ, g n := by + have h := congrArg Complex.re (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := g)).symm + simpa [Complex.ofReal_re] using h + +lemma zetapos (x : ℝ) (hx : 1 < x) : (riemannZeta x).im = 0 ∧ 0 < (riemannZeta x).re := by + have hxC : 1 < (Complex.ofReal x).re := by simpa [Complex.ofReal_re] using hx + have hz : riemannZeta (x : ℂ) = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) := + zeta_eq_tsum_one_div_nat_add_one_cpow (s := (x : ℂ)) hxC + have him : (riemannZeta x).im = 0 := by + simpa [hz, term_eq_ofRealC x] using + (im_tsum_ofReal (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x))) + have hre : (riemannZeta x).re = ∑' n : ℕ, 1 / ((n + 1 : ℝ) ^ x) := by + simpa [hz, term_eq_ofRealC x] using + (re_tsum_ofReal (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x))) + have hsum : Summable (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x)) := + summable_one_div_nat_add_rpow' (x := x) hx + have hpos0 : 0 < 1 / ((Nat.cast 0 + 1 : ℝ) ^ x) := by + simp [zero_add] + have hnonneg : ∀ n : ℕ, 0 ≤ 1 / ((n + 1 : ℝ) ^ x) := terms_nonneg x + have hpos : 0 < ∑' n : ℕ, 1 / ((n + 1 : ℝ) ^ x) := + tsum_pos_of_pos_first_term hsum hpos0 hnonneg + exact ⟨him, by simpa [hre] using hpos⟩ + +lemma zeta332pos : 0 < norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) := by + have h3 : (1 : ℝ) < 3 := by norm_num + have h32 : (1 : ℝ) < (3 : ℝ) / 2 := by norm_num + obtain ⟨h3im, h3repos⟩ := zetapos 3 h3 + obtain ⟨h32im, h32repos⟩ := zetapos ((3 : ℝ) / 2) h32 + have h3ne : riemannZeta (3 : ℝ) ≠ 0 := by + intro hz + exact (ne_of_gt h3repos) (by simpa using congrArg Complex.re hz) + have h32ne : riemannZeta ((3 : ℝ) / 2) ≠ 0 := by + intro hz + exact (ne_of_gt h32repos) (by simpa using congrArg Complex.re hz) + have hdivne : riemannZeta (3 : ℝ) / riemannZeta ((3 : ℝ) / 2) ≠ 0 := + div_ne_zero h3ne h32ne + simpa using (norm_pos_iff.mpr hdivne) + +lemma zeta_low_332 : ∃ a : ℝ, 0 < a ∧ ∀ t : ℝ, a ≤ norm (riemannZeta (((3 : ℝ) / 2) + t * Complex.I)) := by + use norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) + exact ⟨zeta332pos, zeta_lower_bound⟩ + +open Real _root_.Set Filter Topology MeasureTheory +open scoped BigOperators Topology + +lemma one_div_nat_cpow_eq_ite_cpow_neg (s : ℂ) (hs : s ≠ 0) (n : ℕ) : 1 / (n : ℂ) ^ s = if n = 0 then 0 else (n : ℂ) ^ (-s) := by + by_cases h : n = 0 + · simp [h, Complex.zero_cpow hs] + · have hcalc : 1 / (n : ℂ) ^ s = (n : ℂ) ^ (-s) := by + calc + 1 / (n : ℂ) ^ s = ((n : ℂ) ^ s)⁻¹ := by simp [one_div] + _ = (n : ℂ) ^ (-s) := by simpa using (Complex.cpow_neg (n : ℂ) s).symm + simpa [h] using hcalc + +lemma lem_zetaLimit (s : ℂ) (hs : 1 < s.re) : riemannZeta s = ∑' n : ℕ, if n = 0 then 0 else (n : ℂ) ^ (-s) := by + classical + have hsne : s ≠ 0 := by + intro h + have hpos : 0 < s.re := lt_trans (show (0 : ℝ) < 1 from zero_lt_one) hs + have hne : s.re ≠ 0 := ne_of_gt hpos + simp [h] at hne + have hz : riemannZeta s = ∑' n : ℕ, 1 / (n : ℂ) ^ s := zeta_eq_tsum_one_div_nat_cpow (s := s) hs + simpa [one_div_nat_cpow_eq_ite_cpow_neg s hsne] using hz + +noncomputable def zetaPartialSum (s : ℂ) (N : ℕ) : ℂ := + ∑ n ∈ Finset.range N, (n + 1 : ℂ) ^ (-s) + +lemma sum_Icc1_eq_sum_range_succ (N : ℕ) (g : ℕ → ℂ) : + (∑ k ∈ Finset.Icc 1 N, g k) = ∑ n ∈ Finset.range N, g (n + 1) := by + classical + + symm + refine Finset.sum_bij (s := Finset.range N) (t := Finset.Icc 1 N) + (f := fun n => g (n + 1)) (g := fun k => g k) + (i := fun n (_hn : n ∈ Finset.range N) => n + 1) + ?hi ?hinj ?hsurj ?hcongr + · intro n hn + have hlt : n < N := Finset.mem_range.mp hn + have h1 : 1 ≤ n + 1 := Nat.succ_le_succ (Nat.zero_le n) + have h2 : n + 1 ≤ N := Nat.succ_le_of_lt hlt + exact (Finset.mem_Icc.mpr ⟨h1, h2⟩) + · intro a ha b hb h + + simpa using Nat.succ_injective h + · intro k hk + rcases Finset.mem_Icc.mp hk with ⟨hk1, hk2⟩ + refine ⟨k - 1, ?_, ?_⟩ + · + have hsucc : (k - 1) + 1 = k := Nat.sub_add_cancel hk1 + have hle : (k - 1) + 1 ≤ N := by simpa [hsucc] using hk2 + have hlt : k - 1 < N := lt_of_lt_of_le (Nat.lt_succ_self (k - 1)) hle + exact Finset.mem_range.mpr hlt + · + simp [Nat.sub_add_cancel hk1] + · intro n hn + rfl + +lemma sum_Icc0_eq_sum_Icc1_of_zero (N : ℕ) (g : ℕ → ℂ) (h0 : g 0 = 0) : + (∑ k ∈ Finset.Icc 0 N, g k) = ∑ k ∈ Finset.Icc 1 N, g k := by + classical + have hdecomp : insert (0 : ℕ) (Finset.Icc 1 N) = Finset.Icc 0 N := by + simpa [Nat.succ_eq_add_one] using + (Finset.insert_Icc_succ_left_eq_Icc (a := 0) (b := N) (h := Nat.zero_le N)) + have hnotmem : (0 : ℕ) ∉ Finset.Icc 1 N := by + intro h + rcases Finset.mem_Icc.mp h with ⟨h1, _h2⟩ + have : ¬ (1 ≤ (0 : ℕ)) := by decide + exact this h1 + calc + (∑ k ∈ Finset.Icc 0 N, g k) + = ∑ k ∈ insert 0 (Finset.Icc 1 N), g k := by + simp [hdecomp] + _ = g 0 + ∑ k ∈ Finset.Icc 1 N, g k := by + simp + _ = ∑ k ∈ Finset.Icc 1 N, g k := by simp [h0] + +lemma sum_Icc0_shifted_eq_sum_range (a : ℕ → ℂ) (m : ℕ) : + (∑ k ∈ Finset.Icc 0 m, (if k = 0 then 0 else a k)) = ∑ n ∈ Finset.range m, a (n + 1) := by + classical + calc + (∑ k ∈ Finset.Icc 0 m, (if k = 0 then 0 else a k)) + = ∑ k ∈ Finset.Icc 1 m, (if k = 0 then 0 else a k) := by + simpa using + (sum_Icc0_eq_sum_Icc1_of_zero (N := m) + (g := fun k => (if k = 0 then 0 else a k)) (h0 := by simp)) + _ = ∑ n ∈ Finset.range m, (if n + 1 = 0 then 0 else a (n + 1)) := by + simpa using + (sum_Icc1_eq_sum_range_succ (N := m) (g := fun k => (if k = 0 then 0 else a k))) + _ = ∑ n ∈ Finset.range m, a (n + 1) := by + apply Finset.sum_congr rfl + intro n hn + simp + +lemma sum_Icc0_shifted_floor_eq (a : ℕ → ℂ) (t : ℝ) : + (∑ k ∈ Finset.Icc 0 ⌊t⌋₊, (if k = 0 then 0 else a k)) = ∑ n ∈ Finset.range ⌊t⌋₊, a (n + 1) := by + simpa using (sum_Icc0_shifted_eq_sum_range a ⌊t⌋₊) + +lemma helper_contdiff_differentiable_integrable (f : ℝ → ℂ) (hf : ContDiff ℝ 1 f) + (a b : ℝ) : + (∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) ∧ IntegrableOn (deriv f) (Set.Icc a b) := by + have hdiff : Differentiable ℝ f := hf.differentiable (by norm_num) + have hcont_deriv : Continuous (deriv f) := hf.continuous_deriv le_rfl + refine And.intro ?hdiffAt ?hint + · intro t ht + have hdt : DifferentiableAt ℝ f t := hdiff.differentiableAt + exact hdt + · + have hcontOn : ContinuousOn (deriv f) (Set.Icc a b) := hcont_deriv.continuousOn + exact hcontOn.integrableOn_compact isCompact_Icc + +lemma sum_range_mul_shift_comm (N : ℕ) (a : ℕ → ℂ) (f : ℝ → ℂ) : + (∑ n ∈ Finset.range N, f (n + 1) * (if n + 1 = 0 then 0 else a (n + 1))) + = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by + classical + apply Finset.sum_congr rfl + intro n hn + simp [mul_comm] + +lemma sum_range_shifted_coeffs (N : ℕ) (a c : ℕ → ℂ) (f : ℝ → ℂ) + (hshift : ∀ n, c (n + 1) = a (n + 1)) : + (∑ n ∈ Finset.range N, f (↑(n + 1)) * c (n + 1)) + = ∑ n ∈ Finset.range N, f (↑(n + 1)) * a (n + 1) := by + classical + apply Finset.sum_congr rfl + intro n hn + simp [hshift n] + +lemma sum_range_commute_mul (N : ℕ) (a : ℕ → ℂ) (f : ℝ → ℂ) : + (∑ n ∈ Finset.range N, f (↑(n + 1)) * a (n + 1)) + = ∑ n ∈ Finset.range N, a (n + 1) * f (↑(n + 1)) := by + classical + apply Finset.sum_congr rfl + intro n hn + simp [mul_comm] + +lemma lem_abelSummation {a : ℕ → ℂ} {f : ℝ → ℂ} + (hf : ContDiff ℝ 1 f) (N : ℕ) (hN : 1 ≤ N) : + (let A := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1); + ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) + = (A N) * f N - ∫ u in (1 : ℝ)..N, (A u) * deriv f u) := by + classical + + let c : ℕ → ℂ := fun k => if k = 0 then 0 else a k + + set A : ℝ → ℂ := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1) with hA + + have hdiff_int := helper_contdiff_differentiable_integrable (f := f) hf (1 : ℝ) N + rcases hdiff_int with ⟨hdiff, hint⟩ + + have habel := + sum_mul_eq_sub_integral_mul₀' (c := c) (m := N) + (hc := by simp [c]) + (hf_diff := by + intro t ht + simpa using (hdiff t ht)) + (hf_int := by simpa using hint) + + have hLHS : + (∑ k ∈ Finset.Icc 0 N, f k * c k) + = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by + + have h0 : + (∑ k ∈ Finset.Icc 0 N, f k * c k) + = ∑ k ∈ Finset.Icc 1 N, f k * c k := by + simpa [c] using + (sum_Icc0_eq_sum_Icc1_of_zero (N := N) + (g := fun k => f k * c k) (h0 := by simp [c])) + + have h1 : + (∑ k ∈ Finset.Icc 1 N, f k * c k) + = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by + simpa using + (sum_Icc1_eq_sum_range_succ (N := N) (g := fun k => f k * c k)) + + have h2 : + (∑ n ∈ Finset.range N, f (n + 1) * c (n + 1)) + = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by + simpa [c] using (sum_range_mul_shift_comm (N := N) (a := a) (f := f)) + + simp [h0, h1, h2] + + have hAN : A N = ∑ n ∈ Finset.range N, a (n + 1) := by + have : (Nat.floor (N : ℝ)) = N := by + simp + simp [hA, this] + have hMain : + f N * (∑ k ∈ Finset.Icc 0 N, c k) = (A N) * f N := by + + have hs : (∑ k ∈ Finset.Icc 0 N, c k) = ∑ n ∈ Finset.range N, a (n + 1) := by + simpa [c] using (sum_Icc0_shifted_eq_sum_range (a := a) (m := N)) + calc + f N * (∑ k ∈ Finset.Icc 0 N, c k) + = (∑ k ∈ Finset.Icc 0 N, c k) * f N := by simp [mul_comm] + _ = (∑ n ∈ Finset.range N, a (n + 1)) * f N := by simp [hs] + _ = (A N) * f N := by simp [hAN] + + have hInt : + (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) + = ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by + + have hfun : + (fun t => deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) + = (fun t => deriv f t * A t) := by + funext t + have : (∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) = A t := by + simpa [c, hA] using (sum_Icc0_shifted_floor_eq (a := a) (t := t)) + simp [this] + + have h1Nℝ : (1 : ℝ) ≤ N := by exact_mod_cast hN + have hI : + (∫ u in (1 : ℝ)..N, (A u) * deriv f u) + = ∫ u in Set.Ioc (1 : ℝ) N, (A u) * deriv f u := by + simpa using + (intervalIntegral.integral_of_le + (f := fun u => (A u) * deriv f u) (μ := volume) h1Nℝ) + calc + (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) + = ∫ t in Set.Ioc (1 : ℝ) N, deriv f t * A t := by + simp [hfun] + _ = ∫ t in Set.Ioc (1 : ℝ) N, (A t) * deriv f t := by + simp [mul_comm] + _ = ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by + simp [hI] + + have hfinal : ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) + = (A N) * f N - ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by + + simpa [hLHS, hMain, hInt] + using habel + + simpa [hA] using hfinal + +lemma lem_partialSumIsZetaN (s : ℂ) (N : ℕ) : + (let f := fun u : ℝ => (u : ℂ) ^ (-s) + let a := fun _n : ℕ => (1 : ℂ) + zetaPartialSum s N = ∑ n ∈ Finset.range N, a n * f (n + 1)) := by + simp [zetaPartialSum] + +lemma lem_sumOfAn (u : ℝ) (_hu : 1 ≤ u) : + (let a := fun _n : ℕ => (1 : ℂ) + let A := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1) + A u = (Nat.floor u : ℂ)) := by + simp [Finset.sum_const, Finset.card_range] + +lemma lem_fDeriv (s : ℂ) (u : ℝ) (hu : 0 < u) : + (let f := fun u : ℝ => (u : ℂ) ^ (-s) + deriv f u = -s * (u : ℂ) ^ (-s - 1)) := by + + show deriv (fun u : ℝ => (u : ℂ) ^ (-s)) u = -s * (u : ℂ) ^ (-s - 1) + have hu_ne_zero : u ≠ 0 := ne_of_gt hu + by_cases h : s = 0 + · + simp [h] + · + have hneg_s_ne_zero : -s ≠ 0 := neg_ne_zero.mpr h + exact Complex.deriv_ofReal_cpow_const hu_ne_zero hneg_s_ne_zero + +lemma differentiable_integrable_cpow_on_Icc (s : ℂ) (a b : ℝ) (h0 : 0 < a) (_hle : a ≤ b) : + (∀ t ∈ Set.Icc a b, DifferentiableAt ℝ (fun u : ℝ => (u : ℂ) ^ (-s)) t) + ∧ IntegrableOn (deriv (fun u : ℝ => (u : ℂ) ^ (-s))) (Set.Icc a b) := +by + classical + + set f : ℝ → ℂ := fun u => (u : ℂ) ^ (-s) + set g : ℝ → ℂ := fun u => -s * (u : ℂ) ^ (-s - 1) + + have hpos_of_mem : ∀ {t : ℝ}, t ∈ Set.Icc a b → 0 < t := by + intro t ht; exact lt_of_lt_of_le h0 ht.1 + + have hdiff_at : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t := by + intro t ht + have ht_ne : t ≠ 0 := ne_of_gt (hpos_of_mem ht) + by_cases hs : s = 0 + · + simp [f, hs] + · + have hr : (-s) ≠ 0 := by simpa using (neg_ne_zero.mpr hs) + have hhas : HasDerivAt (fun y : ℝ => (y : ℂ) ^ (-s)) ((-s) * t ^ ((-s) - 1)) t := + hasDerivAt_ofReal_cpow_const (x := t) (hx := ht_ne) (r := -s) (hr := hr) + exact hhas.differentiableAt + + have hcont_pow : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := by + intro t ht + have ht_ne : t ≠ 0 := ne_of_gt (hpos_of_mem ht) + by_cases hzero : (-s - 1) = 0 + · + have : (fun u : ℝ => (u : ℂ) ^ (-s - 1)) = fun _ : ℝ => (1 : ℂ) := by + funext u; simp [hzero] + simpa [this] using (continuousAt_const : ContinuousAt (fun _ : ℝ => (1 : ℂ)) t).continuousWithinAt + · + have hr : (-s - 1) ≠ 0 := hzero + have hcpow : HasDerivAt (fun y : ℝ => (y : ℂ) ^ (-s - 1)) ((-s - 1) * t ^ ((-s - 1) - 1)) t := + hasDerivAt_ofReal_cpow_const (x := t) (hx := ht_ne) (r := -s - 1) (hr := hr) + have hcont_at : ContinuousAt (fun u : ℝ => (u : ℂ) ^ (-s - 1)) t := + hcpow.differentiableAt.continuousAt + simpa using hcont_at.continuousWithinAt + have hcont_g : ContinuousOn g (Set.Icc a b) := by + have hconst : ContinuousOn (fun _ : ℝ => (-s : ℂ)) (Set.Icc a b) := continuousOn_const + simpa only [g, Pi.mul_def, neg_mul] using! hconst.mul hcont_pow + + have hEqOn : EqOn (deriv f) g (Set.Icc a b) := by + intro u hu + have hu_pos : 0 < u := hpos_of_mem hu + simpa [f, g] using (lem_fDeriv s u hu_pos) + + have hcont_deriv : ContinuousOn (deriv f) (Set.Icc a b) := by + + have hg_restr : Continuous ((Set.Icc a b).domRestrict g) := hcont_g.domRestrict + have hEqRestr : (Set.Icc a b).domRestrict (deriv f) = (Set.Icc a b).domRestrict g := by + funext x; exact hEqOn x.property + have hderiv_restr : Continuous ((Set.Icc a b).domRestrict (deriv f)) := by + simpa [hEqRestr] using hg_restr + simpa [continuousOn_iff_continuous_domRestrict] using hderiv_restr + + have hInt : IntegrableOn (deriv f) (Set.Icc a b) := + hcont_deriv.integrableOn_compact isCompact_Icc + exact And.intro hdiff_at hInt + +lemma intervalIntegral_congr_of_Ioc_eq (a b : ℝ) (h : a ≤ b) + (f g : ℝ → ℂ) + (hpt : ∀ u ∈ Set.Ioc a b, f u = g u) : + (∫ u in a..b, f u) = ∫ u in a..b, g u := by + + have h1 : (∀ᵐ u ∂(MeasureTheory.volume), u ∈ Set.Ioc a b → f u = g u) := by + refine Filter.Eventually.of_forall ?_; + intro u hu; exact hpt u hu + have hIocEmpty : Set.Ioc b a = (∅ : Set ℝ) := by + simpa using! (Set.Ioc_eq_empty_of_le h) + have h2 : (∀ᵐ u ∂(MeasureTheory.volume), u ∈ Set.Ioc b a → f u = g u) := by + refine Filter.Eventually.of_forall ?_; + intro u hu + have : u ∈ (∅ : Set ℝ) := by simp [hIocEmpty] at hu + exact this.elim + simpa using + (intervalIntegral.integral_congr_ae' (a := a) (b := b) (μ := MeasureTheory.volume) + (f := f) (g := g) h1 h2) + +lemma lem_applyAbel (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : + zetaPartialSum s N + = (N : ℂ) * (N : ℂ) ^ (-s) + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + classical + + set f : ℝ → ℂ := fun u => (u : ℂ) ^ (-s) + let c : ℕ → ℂ := fun k => if k = 0 then 0 else (1 : ℂ) + + have hle : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN + have hdiff_int := + differentiable_integrable_cpow_on_Icc (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) + (h0 := by exact zero_lt_one) (_hle := hle) + rcases hdiff_int with ⟨hdiff, hint⟩ + + have habel := + sum_mul_eq_sub_integral_mul₀' (c := c) (f := f) (m := N) + (hc := by simp [c]) + (hf_diff := by intro t ht; simpa [f] using (hdiff t ht)) + (hf_int := by simpa [f] using hint) + + have hLHS : (∑ k ∈ Finset.Icc 0 N, f k * c k) = zetaPartialSum s N := by + + have h0 : + (∑ k ∈ Finset.Icc 0 N, f k * c k) = ∑ k ∈ Finset.Icc 1 N, f k * c k := by + simpa [c] using + (sum_Icc0_eq_sum_Icc1_of_zero (N := N) + (g := fun k => f k * c k) (h0 := by simp [c])) + have h1 : (∑ k ∈ Finset.Icc 1 N, f k * c k) + = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by + simpa using (sum_Icc1_eq_sum_range_succ (N := N) (g := fun k => f k * c k)) + have h2 : (∑ n ∈ Finset.range N, f (n + 1) * c (n + 1)) + = ∑ n ∈ Finset.range N, f (n + 1) := by + apply Finset.sum_congr rfl; intro n hn; simp [c] + calc + (∑ k ∈ Finset.Icc 0 N, f k * c k) + = ∑ k ∈ Finset.Icc 1 N, f k * c k := by simpa using h0 + _ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by simpa using h1 + _ = ∑ n ∈ Finset.range N, f (n + 1) := by simpa using h2 + _ = zetaPartialSum s N := by simp [zetaPartialSum, f] + + have hset_to_interval : + (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) + = ∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k := by + simpa using + (intervalIntegral.integral_of_le + (f := fun u => deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) + (μ := volume) hle).symm + have hstep1 : + zetaPartialSum s N + = f N * (∑ k ∈ Finset.Icc 0 N, c k) + - ∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k := by + simpa [hLHS, hset_to_interval] using habel + + have hInt_congr : + (∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) + = ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + + apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hle) + (f := fun u => deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) + (g := fun u => (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1))) + intro u hu + have hu_pos : 0 < u := lt_trans zero_lt_one hu.1 + have hderiv : deriv f u = -s * (u : ℂ) ^ (-s - 1) := by + simpa [f] using (lem_fDeriv s u hu_pos) + + have hsumfloor : (∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) = (Nat.floor u : ℂ) := by + have hshift := sum_Icc0_shifted_floor_eq (a := fun _ => (1 : ℂ)) (t := u) + have hsum : (∑ n ∈ Finset.range ⌊u⌋₊, (1 : ℂ)) = (Nat.floor u : ℂ) := by + simp [Finset.sum_const, Finset.card_range] + simpa [c, hsum] using hshift + calc + deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k + = deriv f u * (Nat.floor u : ℂ) := by simp [hsumfloor] + _ = (Nat.floor u : ℂ) * deriv f u := by simp [mul_comm] + _ = (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by simp [hderiv] + + have hstep2 : + zetaPartialSum s N + = f N * (∑ k ∈ Finset.Icc 0 N, c k) + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + simpa [hInt_congr] using hstep1 + + have hMain : f N * (∑ k ∈ Finset.Icc 0 N, c k) = (N : ℂ) * f N := by + have hs : (∑ k ∈ Finset.Icc 0 N, c k) = ∑ n ∈ Finset.range N, (1 : ℂ) := by + simpa [c] using (sum_Icc0_shifted_eq_sum_range (a := fun _ => (1 : ℂ)) (m := N)) + have hsumN : (∑ n ∈ Finset.range N, (1 : ℂ)) = (N : ℂ) := by + simp [Finset.sum_const, Finset.card_range] + calc + f N * (∑ k ∈ Finset.Icc 0 N, c k) + = f N * (∑ n ∈ Finset.range N, (1 : ℂ)) := by simp [hs] + _ = f N * (N : ℂ) := by simp [hsumN] + _ = (N : ℂ) * f N := by simp [mul_comm] + + have hfinal : + zetaPartialSum s N + = (N : ℂ) * (N : ℂ) ^ (-s) + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + calc + zetaPartialSum s N + = f N * (∑ k ∈ Finset.Icc 0 N, c k) + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + simpa using hstep2 + _ = (N : ℂ) * f N + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + simp [hMain] + _ = (N : ℂ) * (N : ℂ) ^ (-s) + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + simp [f] + exact hfinal + +lemma lem_floorNisN (N : ℕ) (_hN : 1 ≤ N) : Nat.floor (N : ℝ) = N := by simp + +lemma helper_integral_const_mul (a b : ℝ) (c : ℂ) (g : ℝ → ℂ) : ∫ x in a..b, c * g x = c * ∫ x in a..b, g x := by simp + +lemma helper_cpow_mul_cpow_neg_eq_cpow_sub (x s : ℂ) (hx : x ≠ 0) : x * x ^ (-s) = x ^ (1 - s) := by + calc + x * x ^ (-s) = x ^ (1 : ℂ) * x ^ (-s) := by + simp [Complex.cpow_one] + _ = x ^ (1 + (-s)) := by + simpa using (Complex.cpow_add (x := x) (y := (1 : ℂ)) (z := (-s)) hx).symm + _ = x ^ (1 - s) := by + simp [sub_eq_add_neg] + +lemma lem_zetaNsimplified1 (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : zetaPartialSum s N = (N : ℂ) ^ (1 - s) + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by + have happly := lem_applyAbel s N hN + + have hInt : + ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) + = (-s) * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by + simp [mul_left_comm] + calc + zetaPartialSum s N + = (N : ℂ) * (N : ℂ) ^ (-s) + - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by + simpa using happly + _ = (N : ℂ) * (N : ℂ) ^ (-s) + - ((-s) * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1)) := by + rw [hInt] + _ = (N : ℂ) * (N : ℂ) ^ (-s) + + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by + simp [sub_eq_add_neg, neg_mul] + _ = (N : ℂ) ^ (1 - s) + + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by + have hpos : 0 < N := (Nat.succ_le_iff).mp hN + have hNz : (N : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt hpos) + have hpow := helper_cpow_mul_cpow_neg_eq_cpow_sub (x := (N : ℂ)) (s := s) hNz + simp [hpow] + +lemma lem_floorUdecomp (u : ℝ) : (Int.floor u : ℝ) = u - Int.fract u := by exact (eq_sub_iff_add_eq).2 (Int.floor_add_fract u) + +lemma lem_fracPartBound (u : ℝ) : 0 ≤ Int.fract u ∧ Int.fract u < 1 ∧ |Int.fract u| ≤ (1 : ℝ) := by + constructor + · exact Int.fract_nonneg u + · constructor + · exact Int.fract_lt_one u + · have hnonneg : 0 ≤ Int.fract u := Int.fract_nonneg u + have hle : Int.fract u ≤ (1 : ℝ) := le_of_lt (Int.fract_lt_one u) + simpa [abs_of_nonneg hnonneg] using hle + +lemma helper_continuousOn_cpow (r : ℂ) {a b : ℝ} (ha : 0 < a) (_hab : a ≤ b) : + ContinuousOn (fun u : ℝ => (u : ℂ) ^ r) (Set.Icc a b) := by + classical + intro t ht + have ht_pos : 0 < t := lt_of_lt_of_le ha ht.1 + by_cases hr : r = 0 + · + have hconst : (fun u : ℝ => (u : ℂ) ^ r) = fun _ => (1 : ℂ) := by + funext u; simp [hr] + simpa [hconst] using (continuousAt_const : ContinuousAt (fun _ : ℝ => (1 : ℂ)) t).continuousWithinAt + · + have hderiv : HasDerivAt (fun u : ℝ => (u : ℂ) ^ r) (r * t ^ (r - 1)) t := + hasDerivAt_ofReal_cpow_const (x := t) (hx := ne_of_gt ht_pos) (r := r) (hr := hr) + exact hderiv.differentiableAt.continuousAt.continuousWithinAt + +lemma helper_intervalIntegrable_mul_cpow_id (s : ℂ) {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : + IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by + classical + + have hcont1 : ContinuousOn (fun u : ℝ => (u : ℂ)) (Set.Icc a b) := + (Complex.continuous_ofReal).continuousOn + have hcont2 : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := + helper_continuousOn_cpow (-s - 1) (lt_of_lt_of_le zero_lt_one ha) hab + have hcont : ContinuousOn (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := + hcont1.mul hcont2 + + have hint_on : IntegrableOn (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := + hcont.integrableOn_compact isCompact_Icc + have hint : IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by + simpa using + (intervalIntegrable_iff_integrableOn_Icc_of_le (μ := volume) (a := a) (b := b) + (f := fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) hab).2 hint_on + exact hint + +lemma helper_aestronglyMeasurable_kernel_Icc (s : ℂ) {a b : ℝ} : + AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) + (volume.restrict (Icc a b)) := by + + have hmeas_fract : Measurable (Int.fract : ℝ → ℝ) := by simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) + have h1 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) (volume.restrict (Icc a b)) := + (Complex.measurable_ofReal.comp hmeas_fract).aestronglyMeasurable + have h2 : AEStronglyMeasurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (volume.restrict (Icc a b)) := by + have hmeas : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by measurability + exact hmeas.aestronglyMeasurable + simpa using! (MeasureTheory.AEStronglyMeasurable.mul h1 h2) + +lemma helper_intervalIntegrable_frac_kernel (s : ℂ) {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : + IntervalIntegrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by + classical + + let μ := volume.restrict (Icc a b) + set f : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) + set g : ℝ → ℝ := fun u => ‖(u : ℂ) ^ (-s - 1)‖ + + have hmeas : AEStronglyMeasurable f μ := by simpa [μ, f] using helper_aestronglyMeasurable_kernel_Icc (s := s) (a := a) (b := b) + + have hbound_ae : ∀ᵐ u ∂μ, ‖f u‖ ≤ g u := by + + refine ((ae_restrict_iff' (μ := volume) (s := Icc a b) + (p := fun u : ℝ => ‖f u‖ ≤ g u) measurableSet_Icc)).2 ?_ + refine Filter.Eventually.of_forall ?_ + intro u hu + + have hfract_le1 : ‖(Int.fract u : ℝ)‖ ≤ (1 : ℝ) := by + simpa using (lem_fracPartBound u).2.2 + + have : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ ‖(Int.fract u : ℝ)‖ * ‖(u : ℂ) ^ (-s - 1)‖ := by + simp + have : ‖f u‖ ≤ ‖(Int.fract u : ℝ)‖ * ‖(u : ℂ) ^ (-s - 1)‖ := by + simp [f] + have : ‖f u‖ ≤ 1 * ‖(u : ℂ) ^ (-s - 1)‖ := + le_trans this (mul_le_mul_of_nonneg_right hfract_le1 (by exact norm_nonneg _)) + simpa [g] using (by simpa [one_mul] using this) + + have hcont : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Icc a b) := + helper_continuousOn_cpow (-s - 1) (lt_of_lt_of_le zero_lt_one ha) hab + have hg_int_on : IntegrableOn g (Icc a b) := by + have hcont_norm : ContinuousOn g (Icc a b) := by + simpa [g] using (hcont.norm) + exact hcont_norm.integrableOn_compact isCompact_Icc + + have hf0 : Integrable (fun _ : ℝ => (0 : ℂ)) μ := by simp [μ] + have hg : Integrable g μ := by simpa [μ] using! hg_int_on + + have hf : Integrable f μ := + MeasureTheory.integrable_of_norm_sub_le (μ := μ) hmeas hf0 hg + (by + + have : ∀ᵐ u ∂μ, ‖(0 : ℂ) - f u‖ ≤ g u := by + simpa [sub_eq_add_neg, norm_neg, μ, f, g] using hbound_ae + simpa using this) + + have hf_on : IntegrableOn f (Icc a b) := by simpa [μ, f] using! hf + simpa using + (intervalIntegrable_iff_integrableOn_Icc_of_le (μ := volume) (a := a) (b := b) + (f := f) hab).2 hf_on + +lemma lem_integralSplit (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : + ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) + = (∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) + - ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by + have hab : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN + + have hcongr1 : + (∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1)) + = ∫ u in (1 : ℝ)..N, + ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1) := by + apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) + intro u hu + have hu0 : 0 ≤ u := le_trans (by norm_num) (le_of_lt hu.1) + have hfloorR : (Nat.floor u : ℝ) = (Int.floor u : ℝ) := by + simpa using (natCast_floor_eq_intCast_floor (R := ℝ) (a := u) hu0) + have hfloorC : (Nat.floor u : ℂ) = ((Int.floor u : ℝ) : ℂ) := by + simpa using congrArg (fun x : ℝ => (x : ℂ)) hfloorR + have hIFR : (Int.floor u : ℝ) = u - Int.fract u := lem_floorUdecomp u + have hIFC : ((Int.floor u : ℝ) : ℂ) = ((u - Int.fract u : ℝ) : ℂ) := + congrArg (fun x : ℝ => (x : ℂ)) hIFR + have : (Nat.floor u : ℂ) = ((u - Int.fract u : ℝ) : ℂ) := hfloorC.trans hIFC + simp [this, sub_eq_add_neg] + + have hcongr2 : + (∫ u in (1 : ℝ)..N, + ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) + = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) + - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := by + have hI1 : IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume (1 : ℝ) (N : ℝ) := + helper_intervalIntegrable_mul_cpow_id (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) (ha := le_rfl) (hab := hab) + have hI2 : IntervalIntegrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) volume (1 : ℝ) (N : ℝ) := + helper_intervalIntegrable_frac_kernel (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) (ha := le_rfl) (hab := hab) + have : + (∫ u in (1 : ℝ)..N, + ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) + = ∫ u in (1 : ℝ)..N, + ((u : ℂ) * (u : ℂ) ^ (-s - 1) + - ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := by + apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) + intro u hu; simp [sub_mul] + calc + (∫ u in (1 : ℝ)..N, + ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) + = ∫ u in (1 : ℝ)..N, + ((u : ℂ) * (u : ℂ) ^ (-s - 1) + - ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := this + _ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) + - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := + (intervalIntegral.integral_sub (μ := volume) (a := (1 : ℝ)) (b := (N : ℝ)) hI1 hI2) + + have hpow : + (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) + = ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) := by + apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) + intro u hu + have hu_pos : 0 < u := lt_trans zero_lt_one hu.1 + have hux0 : (u : ℝ) ≠ 0 := ne_of_gt hu_pos + have hcx0 : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hux0 + calc + (u : ℂ) * (u : ℂ) ^ (-s - 1) + = (u : ℂ) ^ (1 : ℂ) * (u : ℂ) ^ (-s - 1) := by simp [Complex.cpow_one] + _ = (u : ℂ) ^ (1 + (-s - 1)) := by + simpa using + (Complex.cpow_add (x := (u : ℂ)) (y := (1 : ℂ)) (z := (-s - 1)) hcx0).symm + _ = (u : ℂ) ^ (-s) := by + simp [add_left_comm, sub_eq_add_neg] + + calc + ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) + = ∫ u in (1 : ℝ)..N, + ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1) := hcongr1 + _ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) + - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := hcongr2 + _ = (∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) + - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := by + simp [hpow] + +lemma lem_zetaNsimplified2 (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : + zetaPartialSum s N + = (N : ℂ) ^ (1 - s) + + (s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) + - (s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) := by + have hstep1: _ := lem_zetaNsimplified1 s N hN + rw [lem_integralSplit] at hstep1 + rw [mul_sub] at hstep1 + rw [hstep1] + exact (add_sub_assoc _ _ _).symm + exact hN + +lemma lem_evalMainIntegral (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := by + have h01leN : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN + have h0notIcc : (0 : ℝ) ∉ Set.Icc (1 : ℝ) (N : ℝ) := by + intro hx + exact (not_le.mpr (by norm_num : (0 : ℝ) < 1)) hx.1 + have h0not : (0 : ℝ) ∉ Set.uIcc (1 : ℝ) (N : ℝ) := by + simp [uIcc_of_le h01leN] + have hrne : -s ≠ (-1 : ℂ) := by + intro h + apply hs + simpa using congrArg Neg.neg h + have hint : ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) + = ((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1) := by + have hcond : (-1 < (-s).re) ∨ (-s ≠ -1 ∧ (0 : ℝ) ∉ Set.uIcc (1 : ℝ) (N : ℝ)) := by + exact Or.inr ⟨hrne, h0not⟩ + simpa using (integral_cpow (a := (1 : ℝ)) (b := (N : ℝ)) (r := -s) hcond) + have hmul : s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) + = s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) := by + simpa using congrArg (fun x => s * x) hint + have hrewrite : + s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) + = s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) := by + have : s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) + = s * (((N : ℂ) ^ (1 - s) - (1 : ℂ) ^ (1 - s)) / (1 - s)) := by + simp [add_comm, sub_eq_add_neg] + have h1pow : (1 : ℂ) ^ (1 - s) = 1 := by simp + simpa [h1pow] using this + have hsplit : s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) + = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := by + have h1 : s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) + = (s * ((N : ℂ) ^ (1 - s) - 1)) / (1 - s) := by + simpa using (mul_div_assoc s ((N : ℂ) ^ (1 - s) - 1) (1 - s)).symm + have h2 : (s * ((N : ℂ) ^ (1 - s) - 1)) / (1 - s) + = (s / (1 - s)) * ((N : ℂ) ^ (1 - s) - 1) := by + simpa [mul_comm, mul_left_comm, mul_assoc] using + (div_mul_eq_mul_div (a := s) (b := (1 - s)) (c := ((N : ℂ) ^ (1 - s) - 1))).symm + exact h1.trans h2 + calc + s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) + = s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) := hmul + _ = s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) := hrewrite + _ = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := hsplit + +lemma lem_zetaNfinal (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : + zetaPartialSum s N + = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) + - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by + + have hstep := lem_zetaNsimplified2 s N hN + + rw [lem_evalMainIntegral s hs N hN] at hstep + + have hden : (1 - s) ≠ 0 := by + intro h + have h1 : 1 = s := by simpa [sub_eq_zero] using h + have h2 : s = 1 := h1.symm + exact hs h2 + let A := (N : ℂ) ^ (1 - s) + + have h1 : (1 - s) * (A + s / (1 - s) * (A - 1)) = A - s := by + calc + (1 - s) * (A + s / (1 - s) * (A - 1)) + = (1 - s) * A + (1 - s) * (s / (1 - s) * (A - 1)) := by ring + _ = (1 - s) * A + s * (A - 1) := by field_simp [hden] + _ = A - s := by ring + have h2 : (1 - s) * (A / (1 - s) + 1 + 1 / (s - 1)) = A - s := by + have hne : s - 1 ≠ 0 := by simpa [sub_eq_zero] using hs + field_simp [hden, hne]; ring + have halg : A + s / (1 - s) * (A - 1) = A / (1 - s) + 1 + 1 / (s - 1) := + mul_left_cancel₀ hden (h1.trans h2.symm) + + rw [halg] at hstep + exact hstep + +lemma complex_tendsto_zero_iff_norm_tendsto_zero {α : Type*} {f : α → ℂ} {l : Filter α} : + Tendsto f l (𝓝 0) ↔ Tendsto (fun x => ‖f x‖) l (𝓝 0) := by + rw [tendsto_iff_dist_tendsto_zero] + simp only [dist_zero_right] + +lemma complex_norm_natCast_cpow (N : ℕ) (w : ℂ) (hN : 0 < N) : + ‖(N : ℂ) ^ w‖ = (N : ℝ) ^ w.re := by + have hNnz : (N : ℂ) ≠ 0 := by + simp [Ne, Nat.cast_eq_zero] + exact ne_of_gt hN + rw [Complex.norm_cpow_of_ne_zero hNnz] + rw [Complex.norm_natCast] + rw [Complex.natCast_arg] + simp [Real.exp_zero] + +lemma tendsto_natCast_cpow_zero_of_neg_re (w : ℂ) (hw : w.re < 0) : + Tendsto (fun N : ℕ => (N : ℂ) ^ w) atTop (𝓝 0) := by + rw [complex_tendsto_zero_iff_norm_tendsto_zero] + + have h1 : ∀ᶠ (N : ℕ) in atTop, ‖(N : ℂ) ^ w‖ = (N : ℝ) ^ w.re := by + filter_upwards [eventually_gt_atTop 0] with N hN + exact complex_norm_natCast_cpow N w hN + rw [tendsto_congr' h1] + + have hw_pos : 0 < -w.re := neg_pos.mpr hw + + have h_eq : w.re = -(-w.re) := by ring + rw [h_eq] + + have h_comp : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop + have h_rpow : Tendsto (fun x : ℝ => x ^ (-(-w.re))) atTop (𝓝 0) := tendsto_rpow_neg_atTop hw_pos + exact Tendsto.comp h_rpow h_comp + +lemma lem_limitTerm1 (s : ℂ) (hs : 1 < s.re) : + Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s)) atTop (𝓝 0) := by + apply tendsto_natCast_cpow_zero_of_neg_re + simp only [Complex.sub_re, Complex.one_re] + linarith + +lemma lem_integrandBound (u : ℝ) (hu : 1 ≤ u) (s : ℂ) : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by + + set a : ℂ := ((Int.fract u : ℝ) : ℂ) + set b : ℂ := (u : ℂ) ^ (-s - 1) + + have hfract_le1 : ‖a‖ ≤ (1 : ℝ) := by + simpa [a, Complex.norm_real] using (lem_fracPartBound u).2.2 + + have hu0 : 0 < u := lt_of_lt_of_le zero_lt_one hu + + have h₁ : ‖a * b‖ ≤ ‖a‖ * ‖b‖ := by simp + have h₂ : ‖a‖ * ‖b‖ ≤ 1 * ‖b‖ := + mul_le_mul_of_nonneg_right hfract_le1 (norm_nonneg _) + have h₃ : ‖a * b‖ ≤ 1 * ‖b‖ := le_trans h₁ h₂ + have hle : ‖a * b‖ ≤ ‖b‖ := by simpa [one_mul] using h₃ + + have hb : ‖b‖ = u ^ ((-s - 1).re) := by + simpa [b] using + Complex.norm_cpow_eq_rpow_re_of_pos (x := u) (hx := hu0) (y := -s - 1) + + have hexp : (-s - 1).re = -s.re - 1 := by + simp [sub_eq_add_neg] + + calc + ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ + = ‖a * b‖ := rfl + _ ≤ ‖b‖ := hle + _ = u ^ ((-s - 1).re) := hb + _ = u ^ (-s.re - 1) := by simp [hexp] + +lemma lem_integrandBoundeps (ε : ℝ) (_hε : 0 < ε) (u : ℝ) (hu : 1 ≤ u) (s : ℂ) (hs : ε ≤ s.re) : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε) := by + have h1 : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := lem_integrandBound u hu s + have h2 : -s.re - 1 ≤ -1 - ε := by linarith [hs] + have h3 : u ^ (-s.re - 1) ≤ u ^ (-1 - ε) := Real.rpow_le_rpow_of_exponent_le hu h2 + exact le_trans h1 h3 + +lemma lem_triangleInequality_add (z₁ z₂ : ℂ) : + ‖z₁ + z₂‖ ≤ ‖z₁‖ + ‖z₂‖ := by + exact norm_add_le z₁ z₂ + +lemma lem_triangleInequality_integral {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : ℝ → E} {a b : ℝ} (_hf : IntervalIntegrable f volume a b) (h : a ≤ b) : + ‖∫ u in a..b, f u‖ ≤ ∫ u in a..b, ‖f u‖ := by + + simpa using (intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := f) (a := a) (b := b) h) + +lemma helper_integral_interval_sub_left {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : ℝ → E} {a b c : ℝ} + (hab : IntervalIntegrable f volume a b) (hac : IntervalIntegrable f volume a c) : + ((∫ x in a..b, f x) - ∫ x in a..c, f x) = ∫ x in c..b, f x := by + simpa using + (intervalIntegral.integral_interval_sub_left (μ := volume) (f := f) (a := a) (b := b) (c := c) + hab hac) + +lemma helper_integral_rpow_eval {ε : ℝ} (hε : 0 < ε) {m n : ℝ} + (hm : 1 ≤ m) (hmn : m ≤ n) : + ∫ u in m..n, u ^ (-1 - ε) = (m ^ (-ε) - n ^ (-ε)) / ε := by + + have h0notIcc : (0 : ℝ) ∉ Set.Icc m n := by + intro hx + have : ¬ m ≤ 0 := not_le.mpr (lt_of_lt_of_le zero_lt_one hm) + exact this hx.1 + have h0not : (0 : ℝ) ∉ Set.uIcc m n := by + simpa [uIcc_of_le hmn] using h0notIcc + + have hrne : (-1 - ε) ≠ (-1 : ℝ) := by + intro h + have hplus := congrArg (fun t => t + 1) h + have hminus : -ε = 0 := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hplus + have hε0 : ε = 0 := by simpa using congrArg Neg.neg hminus + exact (ne_of_gt hε) hε0 + + have hint : ∫ u in m..n, u ^ (-1 - ε) + = (n ^ ((-1 - ε) + 1) - m ^ ((-1 - ε) + 1)) / ((-1 - ε) + 1) := by + have hcond : (-1 < (-1 - ε)) ∨ ((-1 - ε) ≠ -1 ∧ (0 : ℝ) ∉ Set.uIcc m n) := by + exact Or.inr ⟨hrne, h0not⟩ + simpa using (integral_rpow (a := m) (b := n) (r := -1 - ε) hcond) + + have h1 : ((-1 - ε) + 1) = -ε := by + simp [sub_eq_add_neg, add_comm, add_left_comm] + have : ∫ u in m..n, u ^ (-1 - ε) + = (n ^ (-ε) - m ^ (-ε)) / (-ε) := by + simpa [h1] + using hint + have hnegnum : -(n ^ (-ε) - m ^ (-ε)) = m ^ (-ε) - n ^ (-ε) := by + simp + calc + ∫ u in m..n, u ^ (-1 - ε) + = (n ^ (-ε) - m ^ (-ε)) / (-ε) := this + _ = (n ^ (-ε) - m ^ (-ε)) * ((-ε)⁻¹) := by simp [div_eq_mul_inv] + _ = (n ^ (-ε) - m ^ (-ε)) * (-(ε⁻¹)) := by simp [inv_neg] + _ = -((n ^ (-ε) - m ^ (-ε)) * ε⁻¹) := by simp [mul_neg] + _ = (-(n ^ (-ε) - m ^ (-ε))) * ε⁻¹ := by + simpa using (neg_mul (n ^ (-ε) - m ^ (-ε)) (ε⁻¹)).symm + _ = (m ^ (-ε) - n ^ (-ε)) * ε⁻¹ := by + simp + _ = (m ^ (-ε) - n ^ (-ε)) / ε := by simp [div_eq_mul_inv] + +lemma helper_integral_rpow_le {ε : ℝ} (hε : 0 < ε) {m n : ℝ} + (hm : 1 ≤ m) (hmn : m ≤ n) : + ∫ u in m..n, u ^ (-1 - ε) ≤ (1 / ε) * m ^ (-ε) := by + have heval := helper_integral_rpow_eval (ε := ε) hε hm hmn + have hn0 : 0 ≤ n := by + have h01 : (0 : ℝ) ≤ 1 := by norm_num + exact le_trans h01 (le_trans hm hmn) + have hsub_le : m ^ (-ε) - n ^ (-ε) ≤ m ^ (-ε) := by + exact sub_le_self _ (Real.rpow_nonneg hn0 (-ε)) + have hinv_nonneg : 0 ≤ ε⁻¹ := by + exact inv_nonneg.mpr (le_of_lt hε) + have hdiv_le : ((m ^ (-ε) - n ^ (-ε)) / ε) ≤ (m ^ (-ε) / ε) := by + have := mul_le_mul_of_nonneg_right hsub_le hinv_nonneg + simpa [div_eq_mul_inv, mul_comm] using this + calc + ∫ u in m..n, u ^ (-1 - ε) + = (m ^ (-ε) - n ^ (-ε)) / ε := heval + _ ≤ m ^ (-ε) / ε := hdiv_le + _ = (1 / ε) * m ^ (-ε) := by simp [div_eq_mul_inv, mul_comm] + +lemma helper_tendsto_nat_rpow_neg (ε : ℝ) (hε : 0 < ε) : + Tendsto (fun m : ℕ => (m : ℝ) ^ (-ε)) atTop (𝓝 0) := by + + have hcont : Tendsto (fun x : ℝ => x ^ (-ε)) atTop (𝓝 0) := by + + simpa using (tendsto_rpow_neg_atTop (y := ε) hε) + + have hcoe : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := by + exact tendsto_natCast_atTop_atTop + + have : Tendsto ((fun x : ℝ => x ^ (-ε)) ∘ fun n : ℕ => (n : ℝ)) atTop (𝓝 0) := + hcont.comp hcoe + + simpa using! this + +lemma helper_exists_limit_of_tail_bound (a : ℕ → ℂ) (b : ℕ → ℝ) + (hb_nonneg : ∀ m, 0 ≤ b m) + (hb_tendsto : Tendsto b atTop (𝓝 0)) + (hbound : ∀ᶠ m in atTop, ∀ᶠ n in atTop, m ≤ n → ‖a n - a m‖ ≤ b m) : + ∃ l : ℂ, Tendsto a atTop (𝓝 l) := by + classical + + have hCauchy : CauchySeq a := by + + refine (Metric.cauchySeq_iff).2 ?_ + intro ε hε + + have h_ball : ∀ᶠ m in atTop, dist (b m) 0 < ε / 2 := by + exact hb_tendsto (Metric.ball_mem_nhds (0 : ℝ) (half_pos hε)) + have h_b_lt : ∀ᶠ m in atTop, b m < ε / 2 := by + refine h_ball.mono ?_ + intro m hm + have : |b m| < ε / 2 := by + simpa [Metric.mem_ball, Real.dist_eq] using hm + simpa [abs_of_nonneg (hb_nonneg m)] using this + + rcases eventually_atTop.1 hbound with ⟨M1, hM1⟩ + rcases eventually_atTop.1 h_b_lt with ⟨M2, hM2⟩ + let M := max M1 M2 + have hPM : ∀ᶠ n in atTop, M ≤ n → ‖a n - a M‖ ≤ b M := by + have h' := hM1 M (le_max_left _ _) + exact h' + have hMb : b M < ε / 2 := hM2 M (le_max_right _ _) + rcases eventually_atTop.1 hPM with ⟨N0, hN0⟩ + refine ⟨max N0 M, ?_⟩ + intro n hn k hk + have hMn : M ≤ n := le_trans (le_max_right _ _) hn + have hMk : M ≤ k := le_trans (le_max_right _ _) hk + have hN0n : N0 ≤ n := le_trans (le_max_left _ _) hn + have hN0k : N0 ≤ k := le_trans (le_max_left _ _) hk + have h1 : ‖a n - a M‖ ≤ b M := (hN0 n hN0n) hMn + have h2 : ‖a k - a M‖ ≤ b M := (hN0 k hN0k) hMk + + have htri : ‖a n - a k‖ ≤ ‖a n - a M‖ + ‖a M - a k‖ := by + have h := norm_add_le (a n - a M) (a M - a k) + simpa [sub_add_sub_cancel (a n) (a M) (a k)] using h + have h2' : ‖a M - a k‖ ≤ b M := by simpa [norm_sub_rev] using h2 + have hsumle : ‖a n - a k‖ ≤ b M + b M := + le_trans htri (add_le_add h1 h2') + have hsumlt : b M + b M < ε := by + have := add_lt_add hMb hMb + simpa [add_halves] using this + have : ‖a n - a k‖ < ε := lt_of_le_of_lt hsumle hsumlt + simpa [dist_eq_norm] using this + + rcases cauchySeq_tendsto_of_complete (u := a) hCauchy with ⟨l, hl⟩ + exact ⟨l, hl⟩ + +lemma helper_limit_norm_le_of_uniform_bound {a : ℕ → ℂ} {l : ℂ} {B : ℝ} + (h : Tendsto a atTop (𝓝 l)) (hbound : ∀ n, ‖a n‖ ≤ B) : ‖l‖ ≤ B := by + have hnorm : Tendsto (fun n => ‖a n‖) atTop (𝓝 ‖l‖) := (Filter.Tendsto.norm h) + exact le_of_tendsto' hnorm (fun n => by simpa using hbound n) + +lemma helper_one_le_of_mem_Icc {m n u : ℝ} (hm : 1 ≤ m) (hu : u ∈ Icc m n) : 1 ≤ u := by + exact le_trans hm hu.1 + +lemma helper_intervalIntegrable_rpow_neg {ε : ℝ} {a b : ℝ} (_hε : 0 < ε) + (ha : 1 ≤ a) (hab : a ≤ b) : + IntervalIntegrable (fun u : ℝ => u ^ (-1 - ε)) volume a b := by + have h0notIcc : (0 : ℝ) ∉ Set.Icc a b := by + intro hx + have : ¬ a ≤ 0 := not_le.mpr (lt_of_lt_of_le zero_lt_one ha) + exact this hx.1 + have h0not : (0 : ℝ) ∉ Set.uIcc a b := by + simpa [uIcc_of_le hab] using h0notIcc + simpa using + (intervalIntegral.intervalIntegrable_rpow (μ := volume) (a := a) (b := b) (r := -1 - ε) + (Or.inr h0not)) + +lemma helper_one_le_of_mem_Ioc {m n u : ℝ} (hm : 1 ≤ m) (hu : u ∈ Ioc m n) : 1 ≤ u := by + exact le_trans hm (le_of_lt hu.1) + +lemma helper_integrableOn_of_bound_Ioc {m n : ℝ} {f : ℝ → ℂ} {g : ℝ → ℝ} + (hmeas : AEStronglyMeasurable f (volume.restrict (Ioc m n))) + (hbound : ∀ᵐ u ∂(volume.restrict (Ioc m n)), ‖f u‖ ≤ g u) + (hg : IntegrableOn g (Ioc m n) volume) : + IntegrableOn f (Ioc m n) volume := by + + let μ := volume.restrict (Ioc m n) + + have hf0 : Integrable (fun _ : ℝ => (0 : ℂ)) μ := by + simp + + have hg' : Integrable g μ := by + simpa [μ] using! hg + + have hmeas' : AEStronglyMeasurable f μ := by + simpa [μ] using hmeas + + have hineq : ∀ᵐ u ∂μ, ‖(0 : ℂ) - f u‖ ≤ g u := by + simpa [μ, sub_eq_add_neg, norm_neg] using hbound + + have hf : Integrable f μ := + MeasureTheory.integrable_of_norm_sub_le (μ := μ) hmeas' hf0 hg' hineq + + simpa [μ] using! hf + +lemma helper_aestronglyMeasurable_kernel_Ioc (s : ℂ) {m n : ℝ} : + AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) + (volume.restrict (Ioc m n)) := by + + have h1 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) (volume.restrict (Ioc m n)) := by + have hmeas_fract : Measurable (Int.fract : ℝ → ℝ) := by + simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) + have hmeas_coe : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := + (Complex.measurable_ofReal.comp hmeas_fract) + exact hmeas_coe.aestronglyMeasurable + + have h2 : AEStronglyMeasurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (volume.restrict (Ioc m n)) := by + have hmeas : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by + measurability + exact hmeas.aestronglyMeasurable + + simpa using! (MeasureTheory.AEStronglyMeasurable.mul h1 h2) + +lemma helper_aebound_kernel_Ioc {ε : ℝ} (hε : 0 < ε) (s : ℂ) (hs : ε ≤ s.re) + {m n : ℝ} (hm : 1 ≤ m) (_hmn : m ≤ n) : + ∀ᵐ u ∂(volume.restrict (Ioc m n)), + ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε) := by + + refine + ((ae_restrict_iff' (μ := volume) (s := Ioc m n) + (p := fun u : ℝ => ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε)) + measurableSet_Ioc)).2 ?_ + + refine Filter.Eventually.of_forall ?_ + intro u hu + have hu1 : 1 ≤ u := helper_one_le_of_mem_Ioc hm hu + simpa using (lem_integrandBoundeps ε hε u hu1 s hs) + +lemma helper_integrableOn_rpow_neg_Ioc {ε : ℝ} (hε : 0 < ε) + {m n : ℝ} (hm : 1 ≤ m) (hmn : m ≤ n) : + IntegrableOn (fun u : ℝ => u ^ (-1 - ε)) (Ioc m n) volume := by + have hInt : IntervalIntegrable (fun u : ℝ => u ^ (-1 - ε)) volume m n := + helper_intervalIntegrable_rpow_neg (ε := ε) hε hm hmn + exact + (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) + (f := fun u : ℝ => u ^ (-1 - ε)) hmn).1 hInt + +lemma helper_intervalIntegrable_of_integrableOn_Ioc {f : ℝ → ℂ} {m n : ℝ} + (hmn : m ≤ n) (hint : IntegrableOn f (Ioc m n) volume) : + IntervalIntegrable f volume m n := by + exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) + (a := m) (b := n) (f := f) hmn).2 hint + +lemma helper_rpow_neg_nonneg_on {ε a b : ℝ} (_hε : 0 < ε) (ha : 1 ≤ a) (_hab : a ≤ b) : + ∀ u ∈ Icc a b, 0 ≤ u ^ (-1 - ε) := by + intro u hu + have h1u : 1 ≤ u := le_trans ha hu.1 + have h0u : 0 ≤ u := le_trans (by norm_num) h1u + exact Real.rpow_nonneg h0u (-1 - ε) + +lemma helper_norm_integral_le_integral_norm_of_le {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : ℝ → E} {a b : ℝ} (h : a ≤ b) : + ‖∫ u in a..b, f u‖ ≤ ∫ u in a..b, ‖f u‖ := by + simpa using (intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := f) (a := a) (b := b) h) + +lemma helper_tendsto_const_mul_zero (c : ℝ) {f : ℕ → ℝ} + (h : Tendsto f atTop (𝓝 0)) : Tendsto (fun n => c * f n) atTop (𝓝 0) := by + simpa using (Filter.Tendsto.const_mul (b := c) h) + +lemma helper_limit_norm_le_of_eventual_bound {a : ℕ → ℂ} {l : ℂ} {B : ℝ} + (h : Tendsto a atTop (𝓝 l)) (hbound : ∀ᶠ n in atTop, ‖a n‖ ≤ B) : ‖l‖ ≤ B := by + have hnorm : Tendsto (fun n => ‖a n‖) atTop (𝓝 ‖l‖) := (Filter.Tendsto.norm h) + exact le_of_tendsto hnorm hbound + +lemma lem_integralConvergence (ε : ℝ) (hε : 0 < ε) (s : ℂ) (hs : ε ≤ s.re) : + ∃ I : ℂ, + Tendsto + (fun N : ℕ => + ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) + atTop (𝓝 I) + ∧ ‖I‖ ≤ (1 / ε) := by + classical + + let fC : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) + let gR : ℝ → ℝ := fun u => u ^ (-1 - ε) + let a : ℕ → ℂ := fun N => ∫ u in (1 : ℝ)..(N : ℝ), fC u + let b : ℕ → ℝ := fun m => (1 / ε) * (m : ℝ) ^ (-ε) + + have hb_nonneg : ∀ m, 0 ≤ b m := by + intro m + have hm0 : (0 : ℝ) ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) + have hpow : 0 ≤ (m : ℝ) ^ (-ε) := Real.rpow_nonneg hm0 _ + have hpos : 0 ≤ 1 / ε := by exact le_of_lt (one_div_pos.mpr hε) + have := mul_le_mul_of_nonneg_left hpow hpos + simpa [b] using this + + have hb_tendsto : Tendsto b atTop (𝓝 0) := by + have hpow := helper_tendsto_nat_rpow_neg (ε := ε) hε + have hmul := helper_tendsto_const_mul_zero (c := (1 / ε)) hpow + simpa [b] using hmul + + have h_tail_pointwise : ∀ m n : ℕ, 1 ≤ m → m ≤ n → ‖a n - a m‖ ≤ b m := by + intro m n hm1 hmn + + have hmR : (1 : ℝ) ≤ (m : ℝ) := by exact_mod_cast hm1 + have hmnR : (m : ℝ) ≤ (n : ℝ) := by exact_mod_cast hmn + + have hInt_f_1n : IntervalIntegrable fC volume (1 : ℝ) (n : ℝ) := by + + have h1nNat : 1 ≤ n := le_trans hm1 hmn + have h1nR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast h1nNat + have hmeas := helper_aestronglyMeasurable_kernel_Ioc (s := s) (m := (1 : ℝ)) (n := (n : ℝ)) + have hgIntOn : IntegrableOn gR (Ioc (1 : ℝ) (n : ℝ)) volume := + helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (n : ℝ)) (hm := by norm_num) (hmn := h1nR) + have hbound := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (n : ℝ)) (hm := by norm_num) (_hmn := h1nR) + have hintOn := helper_integrableOn_of_bound_Ioc (m := (1 : ℝ)) (n := (n : ℝ)) (f := fC) (g := gR) + (hmeas := hmeas) (hbound := hbound) (hg := hgIntOn) + exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) + (a := (1 : ℝ)) (b := (n : ℝ)) (f := fC) h1nR).2 hintOn + have hInt_f_1m : IntervalIntegrable fC volume (1 : ℝ) (m : ℝ) := by + have hmeas := helper_aestronglyMeasurable_kernel_Ioc (s := s) (m := (1 : ℝ)) (n := (m : ℝ)) + have hgIntOn : IntegrableOn gR (Ioc (1 : ℝ) (m : ℝ)) volume := + helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (m : ℝ)) (hm := by norm_num) (hmn := hmR) + have hbound := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (m : ℝ)) (hm := by norm_num) (_hmn := hmR) + have hintOn := helper_integrableOn_of_bound_Ioc (m := (1 : ℝ)) (n := (m : ℝ)) (f := fC) (g := gR) + (hmeas := hmeas) (hbound := hbound) (hg := hgIntOn) + exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) + (a := (1 : ℝ)) (b := (m : ℝ)) (f := fC) hmR).2 hintOn + have hdiff := helper_integral_interval_sub_left + (E := ℂ) (f := fC) (a := (1 : ℝ)) (b := (n : ℝ)) (c := (m : ℝ)) + (hab := hInt_f_1n) (hac := hInt_f_1m) + have hsub : a n - a m = ∫ u in (m : ℝ)..(n : ℝ), fC u := by + simpa [a] using hdiff + + have hbound_Ioc := helper_aebound_kernel_Ioc (ε := ε) hε s hs + (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (_hmn := hmnR) + have hbound_Ioc_imp : ∀ᵐ t ∂(volume), t ∈ Ioc (m : ℝ) (n : ℝ) → ‖fC t‖ ≤ gR t := by + simpa [fC, gR] using + ((ae_restrict_iff' (μ := volume) (s := Ioc (m : ℝ) (n : ℝ)) measurableSet_Ioc).1 hbound_Ioc) + + have hgInt_mn : IntervalIntegrable gR volume (m : ℝ) (n : ℝ) := + (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) + (a := (m : ℝ)) (b := (n : ℝ)) (f := gR) hmnR).2 + (helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (hmn := hmnR)) + + have h1 : ‖∫ u in (m : ℝ)..(n : ℝ), fC u‖ ≤ ∫ u in (m : ℝ)..(n : ℝ), gR u := by + simpa using + (intervalIntegral.norm_integral_le_of_norm_le (μ := volume) + (a := (m : ℝ)) (b := (n : ℝ)) (f := fC) (g := gR) + (hab := hmnR) (h := hbound_Ioc_imp) (hbound := hgInt_mn)) + + have h3 : ∫ u in (m : ℝ)..(n : ℝ), gR u ≤ (1 / ε) * (m : ℝ) ^ (-ε) := + helper_integral_rpow_le (ε := ε) hε (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (hmn := hmnR) + + have : ‖∫ u in (m : ℝ)..(n : ℝ), fC u‖ ≤ (1 / ε) * (m : ℝ) ^ (-ε) := + le_trans h1 h3 + simpa [hsub, b] using this + + have hbound : ∀ᶠ m in atTop, ∀ᶠ n in atTop, m ≤ n → ‖a n - a m‖ ≤ b m := by + have h_m_ge1 : ∀ᶠ m in atTop, 1 ≤ m := eventually_ge_atTop 1 + refine h_m_ge1.mono ?_ + intro m hm1 + have h_n_ge_m : ∀ᶠ n in atTop, m ≤ n := eventually_ge_atTop m + exact h_n_ge_m.mono (fun n hmn => by intro hle; exact h_tail_pointwise m n hm1 hle) + + rcases helper_exists_limit_of_tail_bound a b hb_nonneg hb_tendsto hbound with ⟨I, hT⟩ + + have h_eventual_bound : ∀ᶠ N in atTop, ‖a N‖ ≤ (1 / ε) := by + have hN1 : ∀ᶠ N in atTop, 1 ≤ N := eventually_ge_atTop 1 + refine hN1.mono ?_ + intro N hNge1 + have h1N : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hNge1 + + have hbound_Ioc := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (_hmn := h1N) + have hbound_Ioc_imp : ∀ᵐ t ∂(volume), t ∈ Ioc (1 : ℝ) (N : ℝ) → ‖fC t‖ ≤ gR t := by + simpa [fC, gR] using + ((ae_restrict_iff' (μ := volume) (s := Ioc (1 : ℝ) (N : ℝ)) measurableSet_Ioc).1 hbound_Ioc) + + have hgInt_1N : IntervalIntegrable gR volume (1 : ℝ) (N : ℝ) := + (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) + (a := (1 : ℝ)) (b := (N : ℝ)) (f := gR) h1N).2 + (helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (hmn := h1N)) + + have h1 : ‖∫ u in (1 : ℝ)..(N : ℝ), fC u‖ ≤ ∫ u in (1 : ℝ)..(N : ℝ), gR u := by + simpa [a] using + (intervalIntegral.norm_integral_le_of_norm_le (μ := volume) + (a := (1 : ℝ)) (b := (N : ℝ)) (f := fC) (g := gR) + (hab := h1N) (h := hbound_Ioc_imp) (hbound := hgInt_1N)) + + have h3 : ∫ u in (1 : ℝ)..(N : ℝ), gR u ≤ (1 / ε) := by + have := helper_integral_rpow_le (ε := ε) hε (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (hmn := h1N) + simpa [one_div, Real.one_rpow, one_mul] using this + have : ‖a N‖ ≤ (1 / ε) := by exact le_trans h1 h3 + exact this + + have hIle : ‖I‖ ≤ (1 / ε) := + helper_limit_norm_le_of_eventual_bound (a := a) (l := I) (B := 1 / ε) hT h_eventual_bound + + refine ⟨I, ?_, hIle⟩ + simpa [a, fC] using hT + +lemma helper_tendsto_zetaPartialSum_to_zeta (s : ℂ) (hs : 1 < s.re) : + Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) := by + classical + + set g : ℕ → ℂ := fun n => if n = 0 then 0 else (n : ℂ) ^ (-s) + set h : ℕ → ℂ := fun n => (n + 1 : ℂ) ^ (-s) + + have hsne : s ≠ 0 := by + intro h0 + have : (0 : ℝ) < s.re := lt_trans (show (0 : ℝ) < 1 by norm_num) hs + simpa [h0] using (ne_of_gt this) + + have hsum_div : Summable (fun n : ℕ => 1 / (n : ℂ) ^ s) := + (Complex.summable_one_div_nat_cpow (p := s)).2 hs + have hgSumm : Summable g := by + simpa [g, one_div_nat_cpow_eq_ite_cpow_neg s hsne] using hsum_div + + have h_eq_tail : (fun n => g (n + 1)) = h := by + funext n; simp [g, h] + have hhSumm : Summable h := by + have : Summable (fun n : ℕ => g (n + 1)) := (summable_nat_add_iff (f := g) (k := 1)).2 hgSumm + simpa [h_eq_tail] using this + + have hg0 : g 0 = 0 := by simp [g] + have h_tsum_eq : (∑' n : ℕ, h n) = ∑' n : ℕ, g n := by + have hzero_add := (Summable.tsum_eq_zero_add (f := g) hgSumm) + + have : (∑' n : ℕ, g n) = ∑' n : ℕ, g (n + 1) := by + simpa [hg0, add_comm] using hzero_add + simpa [h_eq_tail] using this.symm + + have hzeta : riemannZeta s = ∑' n : ℕ, g n := by + simpa [g] using lem_zetaLimit s hs + + have h_tendsto : Tendsto (fun N : ℕ => ∑ n ∈ Finset.range N, h n) atTop (𝓝 (∑' n, h n)) := + (Summable.tendsto_sum_tsum_nat hhSumm) + + have htsumeq : (∑' n, h n) = riemannZeta s := h_tsum_eq.trans hzeta.symm + simpa [zetaPartialSum, htsumeq, h] using h_tendsto + +lemma integrableOn_of_ae_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : ℝ → E} {g : ℝ → ℝ} {s : Set ℝ} + (hfm : AEStronglyMeasurable f (volume.restrict s)) + (hgint : IntegrableOn g s) + (hbound : ∀ᵐ x ∂(volume.restrict s), ‖f x‖ ≤ g x) : + IntegrableOn f s := by + have hg' : Integrable g (volume.restrict s) := by + simpa [IntegrableOn] using hgint + have hf' : Integrable f (volume.restrict s) := + MeasureTheory.Integrable.mono' (μ := volume.restrict s) hg' hfm hbound + simpa [IntegrableOn] using hf' + +lemma kernel_aestronglyMeasurable_on_Ioi (s : ℂ) (a : ℝ) : + AEStronglyMeasurable (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (volume.restrict (Ioi a)) := by + + have hmeas_fract : Measurable (fun u : ℝ => (Int.fract u : ℝ)) := by + simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) + have hmeas_fractC : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := + hmeas_fract.complex_ofReal + have hmeas_cpow : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by + have hmeas_ofReal : Measurable (fun u : ℝ => (u : ℂ)) := Complex.measurable_ofReal + simpa using hmeas_ofReal.pow_const (-s - 1) + have hmeas : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := + hmeas_fractC.mul hmeas_cpow + + simpa using hmeas.aestronglyMeasurable + +lemma kernel_ae_bound_on_Ioi (s : ℂ) : + ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), + ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by + + let p : ℝ → Prop := fun u => ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) + + have hAll : ∀ u ∈ Ioi (1 : ℝ), p u := by + intro u hu + have hu' : (1 : ℝ) ≤ u := le_of_lt hu + dsimp [p] + simpa using (lem_integrandBound u hu' s) + + have hAE : ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → p u := + MeasureTheory.ae_of_all _ hAll + + have hiff : + (∀ᵐ u ∂volume.restrict (Ioi (1 : ℝ)), p u) ↔ ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → p u := + (MeasureTheory.ae_restrict_iff' (μ := volume) (s := Ioi (1 : ℝ)) (p := p)) measurableSet_Ioi + exact hiff.mpr hAE + +lemma helper_intervalIntegral_tendstoIoi_kernel (s : ℂ) (hs : 1 < s.re) : + Tendsto (fun N : ℕ => ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop + (𝓝 (∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := by + + have hfm : AEStronglyMeasurable (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) + (volume.restrict (Ioi (1 : ℝ))) := by + simpa using kernel_aestronglyMeasurable_on_Ioi (s := s) (a := (1 : ℝ)) + have hbound' : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), + ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by + + simpa using kernel_ae_bound_on_Ioi (s := s) + have hlt : (-s.re - 1) < (-1 : ℝ) := by linarith + have hpos : 0 < (1 : ℝ) := by norm_num + have hgint : IntegrableOn (fun u : ℝ => u ^ (-s.re - 1)) (Ioi (1 : ℝ)) := by + simpa using integrableOn_Ioi_rpow_of_lt (a := (-s.re - 1)) (c := (1 : ℝ)) hlt hpos + have hint : IntegrableOn (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (Ioi (1 : ℝ)) := by + + exact integrableOn_of_ae_bound (s := Ioi (1 : ℝ)) hfm hgint hbound' + + have hb : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop + simpa using + (MeasureTheory.intervalIntegral_tendsto_integral_Ioi (μ := volume) + (f := fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (a := (1 : ℝ)) + (b := fun N : ℕ => (N : ℝ)) hint hb) + +lemma helper_zetaNfinal (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : + zetaPartialSum s N + = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) + - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by + simpa using (lem_zetaNfinal s hs N hN) + +lemma helper_eventually_eq_from_zetaNfinal (s : ℂ) (hs : s ≠ 1) : + ∀ᶠ N in atTop, + zetaPartialSum s N + = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) + - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by + have hEv : ∀ᶠ N : ℕ in atTop, 1 ≤ N := Filter.eventually_ge_atTop (1 : ℕ) + refine hEv.mono ?_ + intro N hN + simpa using (helper_zetaNfinal s hs N hN) + +lemma helper_limit_scaled_cpow (s : ℂ) (hs : 1 < s.re) (_hsne : s ≠ 1) : + Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s) / (1 - s)) atTop (𝓝 0) := by + have h := lem_limitTerm1 s hs + have h' := (Filter.Tendsto.const_mul (b := (1 / (1 - s))) h) + simpa [div_eq_mul_inv, mul_comm] using h' + +lemma helper_tendsto_const_mul {f : ℕ → ℂ} {l : ℂ} (c : ℂ) + (h : Tendsto f atTop (𝓝 l)) : Tendsto (fun n => c * f n) atTop (𝓝 (c * l)) := by + exact h.const_mul c + +lemma helper_tendsto_add {f g : ℕ → ℂ} {a b : ℂ} + (hf : Tendsto f atTop (𝓝 a)) (hg : Tendsto g atTop (𝓝 b)) : + Tendsto (fun n => f n + g n) atTop (𝓝 (a + b)) := by + + have hpair : Tendsto (fun n => (f n, g n)) atTop (𝓝 (a, b)) := by + simpa using (hf.prodMk_nhds hg) + have hadd : Continuous (fun p : ℂ × ℂ => p.1 + p.2) := by + simpa using! (continuous_fst.add continuous_snd) + simpa using! ((hadd.tendsto (a, b)).comp hpair) + +lemma helper_tendsto_neg {f : ℕ → ℂ} {a : ℂ} + (hf : Tendsto f atTop (𝓝 a)) : Tendsto (fun n => - f n) atTop (𝓝 (-a)) := by + simpa only [Function.comp_def] using! ((continuous_neg.tendsto a).comp hf) + +lemma helper_tendsto_sub {f g : ℕ → ℂ} {a b : ℂ} + (hf : Tendsto f atTop (𝓝 a)) (hg : Tendsto g atTop (𝓝 b)) : + Tendsto (fun n => f n - g n) atTop (𝓝 (a - b)) := by + have hneg : Tendsto (fun n => - g n) atTop (𝓝 (-b)) := + helper_tendsto_neg (f := g) (a := b) hg + simpa [sub_eq_add_neg] using + helper_tendsto_add (f := f) (g := fun n => - g n) hf hneg + +lemma lem_zetaFormula (s : ℂ) (hs : 1 < s.re) : + riemannZeta s + = 1 + 1 / (s - 1) + - s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by + classical + + have hsne : s ≠ 1 := by + intro h + have hlt : 1 < (1 : ℝ) := by simp [h, Complex.one_re] at hs + exact (lt_irrefl _ ) hlt + + let G : ℕ → ℂ := fun N => + (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) + - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) + + have hEv : ∀ᶠ N in atTop, zetaPartialSum s N = G N := by + simpa [G] using helper_eventually_eq_from_zetaNfinal s hsne + + have h_ps : Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) := + helper_tendsto_zetaPartialSum_to_zeta s hs + + have hG_to_zeta : Tendsto G atTop (𝓝 (riemannZeta s)) := by + have hcongr := (Filter.tendsto_congr' (hl := hEv) : + Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) ↔ + Tendsto G atTop (𝓝 (riemannZeta s))) + exact hcongr.mp h_ps + + have hA : Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s) / (1 - s)) atTop (𝓝 0) := + helper_limit_scaled_cpow s hs hsne + + have hK : Tendsto (fun _ : ℕ => (1 : ℂ) + 1 / (s - 1)) atTop (𝓝 ((1 : ℂ) + 1 / (s - 1))) := + tendsto_const_nhds + + have hInt : Tendsto (fun N : ℕ => ∫ u in (1 : ℝ)..N, + (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop + (𝓝 (∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := + helper_intervalIntegral_tendstoIoi_kernel s hs + + have hIntMul : Tendsto (fun N : ℕ => s * ∫ u in (1 : ℝ)..N, + (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop + (𝓝 (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := + helper_tendsto_const_mul (c := s) hInt + + set Aseq : ℕ → ℂ := fun N => (N : ℂ) ^ (1 - s) / (1 - s) + set Kseq : ℕ → ℂ := fun _ => (1 : ℂ) + 1 / (s - 1) + have hA2 : Tendsto Aseq atTop (𝓝 0) := by simpa [Aseq] using hA + have hK2 : Tendsto Kseq atTop (𝓝 ((1 : ℂ) + 1 / (s - 1))) := by simp [Kseq] + have hSum : Tendsto (fun N => Aseq N + Kseq N) atTop (𝓝 (0 + ((1 : ℂ) + 1 / (s - 1)))) := + helper_tendsto_add (hf := hA2) (hg := hK2) + set Iseq : ℕ → ℂ := fun N => s * ∫ u in (1 : ℝ)..N, + (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) + have hIseq : Tendsto Iseq atTop (𝓝 (s * ∫ u in Ioi (1 : ℝ), + (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := by + simpa [Iseq] using hIntMul + have hG_limit : Tendsto G atTop + (𝓝 ((0 + ((1 : ℂ) + 1 / (s - 1))) + - (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)))) := by + have hSub := helper_tendsto_sub (hf := hSum) (hg := hIseq) + + have hGdef : (fun N => (Aseq N + Kseq N) - Iseq N) = G := by + funext N; simp [Aseq, Kseq, Iseq, G, add_comm, add_left_comm, add_assoc, sub_eq_add_neg] + simpa [hGdef] + using hSub + + have huniq := + tendsto_nhds_unique (f := G) (l := atTop) + (a := riemannZeta s) + (b := ((0 + ((1 : ℂ) + 1 / (s - 1))) + - (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)))) + (ha := hG_to_zeta) (hb := hG_limit) + + simpa [zero_add, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using huniq + +lemma lem_zetaanalOnnot1 : AnalyticOn ℂ riemannZeta {s : ℂ | s ≠ 1} := by + + have hset : {s : ℂ | s ≠ 1} = ({1} : Set ℂ)ᶜ := by + ext z; simp + have hopen : IsOpen ({s : ℂ | s ≠ 1}) := by + simp [hset] + + have hdiff : DifferentiableOn ℂ riemannZeta {s : ℂ | s ≠ 1} := by + intro z hz + + simpa using (differentiableAt_riemannZeta (by simpa [Set.mem_ofPred_eq] using hz)).differentiableWithinAt + simpa [Complex.analyticOn_iff_differentiableOn hopen] using hdiff + +lemma lem_zetaanalS : (let S := {s : ℂ | s ≠ 1}; AnalyticOn ℂ riemannZeta S) := by exact lem_zetaanalOnnot1 + +lemma lem_S_isOpen : (let S := {s : ℂ | s ≠ 1}; IsOpen S) := by + + have h : {s : ℂ | s ≠ 1} = {(1 : ℂ)}ᶜ := by + ext s; simp [Set.mem_compl_iff, Set.mem_singleton_iff] + rw [h] + exact isOpen_compl_singleton + +lemma lem_T_isOpen : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsOpen T) := by + + show IsOpen {s : ℂ | s ≠ 1 ∧ 1/10 < s.re} + + apply IsOpen.and + · + exact lem_S_isOpen + · + + have h_eq : {s : ℂ | 1/10 < s.re} = Complex.re ⁻¹' (Set.Ioi (1/10)) := by + ext s + simp [Set.mem_preimage, Set.mem_Ioi] + rw [h_eq] + exact Complex.continuous_re.isOpen_preimage (Set.Ioi (1/10)) isOpen_Ioi + +lemma helper_T_open : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsOpen T) := by + classical + + intro S T + + have hSopen : IsOpen S := by simpa using lem_S_isOpen + + have hHalfplane : IsOpen {s : ℂ | (1 / 10 : ℝ) < s.re} := by + have : IsOpen ((fun s : ℂ => s.re) ⁻¹' Ioi (1 / 10 : ℝ)) := + IsOpen.preimage (hf := Complex.continuous_re) (t := Ioi (1 / 10 : ℝ)) (h := isOpen_Ioi) + simpa [Set.preimage, Ioi] using this + + have hInter : IsOpen (S ∩ {s : ℂ | (1 / 10 : ℝ) < s.re}) := hSopen.inter hHalfplane + + simpa [T, Set.ofPred_and] using hInter + +lemma open_mem_interior_of_isOpen {X : Type*} [TopologicalSpace X] {U : Set X} (hU : IsOpen U) {x : X} (hx : x ∈ U) : x ∈ interior U := by simpa [hU.interior_eq] using hx + +lemma isOpen_halfplane_re_gt (a : ℝ) : IsOpen {z : ℂ | a < z.re} := by + simpa [Set.mem_ofPred_eq] using + (isOpen_lt (hf := continuous_const) (hg := Complex.continuous_re)) + +lemma T_eq_inter_S_half (S T : Set ℂ) (_hS : S = {s : ℂ | s ≠ 1}) (hT : T = {s : ℂ | s ∈ S ∧ (1/10 : ℝ) < s.re}) : + T = S ∩ {s : ℂ | (1/10 : ℝ) < s.re} := by + classical + ext z + simp [hT, Set.inter_def] + +lemma inter_compl_singleton_eq_diff {α : Type*} [DecidableEq α] (A : Set α) (x : α) : + A ∩ ({x} : Set α)ᶜ = A \ ({x} : Set α) := by + ext z; simp [Set.mem_inter_iff, Set.mem_singleton_iff] + +lemma joinedIn_of_path_forall_mem {s : Set ℂ} {x y : ℂ} + (γ : Path x y) (hγ : ∀ t, γ t ∈ s) : JoinedIn s x y := by + exact ⟨γ, hγ⟩ + +lemma path_forall_mem_symm {x y : ℂ} {P : ℂ → Prop} (γ : Path x y) + (h : ∀ t, P (γ t)) : ∀ t, P (γ.symm t) := by + intro t + simpa [Path.symm] using (h (unitInterval.symm t)) + +lemma isPathConnected_punctured_halfplane_re_gt (a : ℝ) (p : ℂ) (hp : a < p.re) : + IsPathConnected ({z : ℂ | a < z.re} \ ({p} : Set ℂ)) := by + classical + + let S1 : Set ℂ := {z : ℂ | a < z.re ∧ z.im < p.im} + let S2 : Set ℂ := {z : ℂ | a < z.re ∧ z.re < p.re} + let S3 : Set ℂ := {z : ℂ | a < z.re ∧ p.im < z.im} + let S4 : Set ℂ := {z : ℂ | p.re < z.re} + + have hS1conv : Convex ℝ S1 := by + have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) + have h2 : Convex ℝ {z : ℂ | z.im < p.im} := convex_halfSpace_im_lt (r := p.im) + simpa [S1, Set.ofPred_and] using h1.inter h2 + have hS2conv : Convex ℝ S2 := by + have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) + have h2 : Convex ℝ {z : ℂ | z.re < p.re} := convex_halfSpace_re_lt (r := p.re) + simpa [S2, Set.ofPred_and] using h1.inter h2 + have hS3conv : Convex ℝ S3 := by + have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) + have h2 : Convex ℝ {z : ℂ | p.im < z.im} := convex_halfSpace_im_gt (r := p.im) + simpa [S3, Set.ofPred_and] using h1.inter h2 + have hS4conv : Convex ℝ S4 := by + simpa [S4] using (convex_halfSpace_re_gt (r := p.re)) + + have hS1ne : S1.Nonempty := by + refine ⟨((max a p.re) + 1 : ℝ) + (p.im - 1) * Complex.I, ?_⟩ + have h1 : a < (max a p.re) + 1 := by + have : a ≤ max a p.re := le_max_left _ _ + exact lt_of_le_of_lt this (by linarith) + have h2 : (p.im - 1) < p.im := by linarith + simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h1 h2 + have hS2ne : S2.Nonempty := by + refine ⟨((a + p.re) / 2 : ℝ) + (p.im : ℝ) * Complex.I, ?_⟩ + have h1 : a < (a + p.re) / 2 := by linarith + have h2 : (a + p.re) / 2 < p.re := by linarith + simpa [S2, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h1 h2 + have hS3ne : S3.Nonempty := by + refine ⟨((max a p.re) + 1 : ℝ) + (p.im + 1) * Complex.I, ?_⟩ + have h1 : a < (max a p.re) + 1 := by + have : a ≤ max a p.re := le_max_left _ _ + exact lt_of_le_of_lt this (by linarith) + have h2 : p.im < (p.im + 1) := by linarith + simpa [S3, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h1 h2 + have hS4ne : S4.Nonempty := by + refine ⟨(p.re + 1 : ℝ) + (0 : ℝ) * Complex.I, ?_⟩ + have : p.re < p.re + 1 := by linarith + simp [S4, Complex.add_re] + + have hS1pc : IsPathConnected S1 := (hS1conv.isPathConnected hS1ne) + have hS2pc : IsPathConnected S2 := (hS2conv.isPathConnected hS2ne) + have hS3pc : IsPathConnected S3 := (hS3conv.isPathConnected hS3ne) + have hS4pc : IsPathConnected S4 := (hS4conv.isPathConnected hS4ne) + + let A : Set ℂ := S1 ∪ S2 + let B : Set ℂ := S3 ∪ S4 + + have hS1S2_int : (S1 ∩ S2).Nonempty := by + refine ⟨((a + p.re) / 2 : ℝ) + (p.im - (1/2)) * Complex.I, ?_⟩ + have h1a : a < (a + p.re) / 2 := by linarith + have h1b : (p.im - (1/2)) < p.im := by linarith + have h2a : a < (a + p.re) / 2 := by linarith + have h2b : (a + p.re) / 2 < p.re := by linarith + constructor + · + simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h1a h1b + · + simpa [S2, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h2a h2b + have hApc : IsPathConnected A := + IsPathConnected.union (U := S1) (V := S2) hS1pc hS2pc (by + rcases hS1S2_int with ⟨z, hz⟩; exact ⟨z, hz⟩) + have hS3S4_int : (S3 ∩ S4).Nonempty := by + refine ⟨(p.re + 1 : ℝ) + (p.im + 1) * Complex.I, ?_⟩ + have h3a : a < p.re + 1 := lt_trans hp (by linarith) + have h3b : p.im < p.im + 1 := by linarith + have h4 : p.re < p.re + 1 := by linarith + constructor + · + simpa [S3, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h3a h3b + · + simp [S4, Complex.add_re, Complex.mul_re] + have hBpc : IsPathConnected B := + IsPathConnected.union (U := S3) (V := S4) hS3pc hS4pc (by + rcases hS3S4_int with ⟨z, hz⟩; exact ⟨z, hz⟩) + + have hABint : (A ∩ B).Nonempty := by + refine ⟨(p.re + 1 : ℝ) + (p.im - 1) * Complex.I, ?_⟩ + constructor + · + refine Or.inl ?_ + have h1 : a < p.re + 1 := lt_trans hp (by linarith) + have h2 : (p.im - 1) < p.im := by linarith + simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] + using And.intro h1 h2 + · + refine Or.inr ?_ + have h4 : p.re < p.re + 1 := by linarith + simp [S4, Complex.add_re, Complex.mul_re] + + have hUnionPC : IsPathConnected (A ∪ B) := + IsPathConnected.union (U := A) (V := B) hApc hBpc (by + rcases hABint with ⟨z, hz⟩; exact ⟨z, hz⟩) + + have hcover : ({z : ℂ | a < z.re} \ ({p} : Set ℂ)) = A ∪ B := by + ext z; constructor + · intro hz + rcases hz with ⟨hzH, hznot⟩ + + rcases lt_trichotomy z.re p.re with hlt | heq | hgt + · + exact Or.inl (Or.inr ⟨hzH, hlt⟩) + · + rcases lt_trichotomy z.im p.im with himlt | himeq | himgt + · + exact Or.inl (Or.inl ⟨hzH, himlt⟩) + · + have hz_eq : z = p := by + + have hzdecomp : (z.re : ℂ) + (z.im : ℝ) * Complex.I = z := by + simp + have hpdecomp : (p.re : ℂ) + (p.im : ℝ) * Complex.I = p := by + simp + have : (z.re : ℂ) + (z.im : ℝ) * Complex.I = (p.re : ℂ) + (p.im : ℝ) * Complex.I := by + + simp [heq, himeq] + + simpa [hzdecomp, hpdecomp] using this + have : z ∈ ({p} : Set ℂ) := by simp [Set.mem_singleton_iff, hz_eq] + exact (hznot this).elim + · + exact Or.inr (Or.inl ⟨hzH, himgt⟩) + · + exact Or.inr (Or.inr hgt) + · intro hz + + have hzH : a < z.re := by + rcases hz with hA | hB + · rcases hA with hS1 | hS2 + · exact hS1.1 + · exact hS2.1 + · rcases hB with hS3 | hS4 + · exact hS3.1 + · exact lt_trans hp hS4 + have hzneq : z ≠ p := by + rcases hz with hA | hB + · rcases hA with hS1 | hS2 + · + intro h + have : z.im = p.im := by simp [h] + have : z.im < z.im := by simpa [this] using hS1.2 + exact lt_irrefl _ this + · + intro h + have : z.re = p.re := by simp [h] + exact (ne_of_lt hS2.2) this + · rcases hB with hS3 | hS4 + · + intro h + have : p.im = z.im := by simp [h] + have : z.im < z.im := by simpa [this] using hS3.2 + exact lt_irrefl _ this + · + intro h + have : p.re = z.re := by simp [h] + exact (ne_of_gt hS4) this.symm + exact And.intro hzH (by intro hzmem; exact hzneq (by simpa [Set.mem_singleton_iff] using hzmem)) + + simpa [hcover] using hUnionPC + +lemma inter_compl_singleton_eq_diff' {α : Type*} [DecidableEq α] (A : Set α) (x : α) : + A ∩ ({x} : Set α)ᶜ = A \ ({x} : Set α) := by + ext z; simp [Set.mem_inter_iff, Set.mem_singleton_iff] + +lemma lem_T_isPreconnected : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsPreconnected T) := by + classical + + let S : Set ℂ := {s : ℂ | s ≠ 1} + let T : Set ℂ := {s : ℂ | s ∈ S ∧ (1/10 : ℝ) < s.re} + + have hTinter : T = S ∩ {s : ℂ | (1/10 : ℝ) < s.re} := by + simpa using (T_eq_inter_S_half S T (by rfl) (by rfl)) + + have hScompl : S = ({(1 : ℂ)} : Set ℂ)ᶜ := by + ext z; simp [S] + + have hTdiff : T = {s : ℂ | (1/10 : ℝ) < s.re} \ (({(1 : ℂ)} : Set ℂ)) := by + have : T = {s : ℂ | (1/10 : ℝ) < s.re} ∩ S := by + simpa [Set.inter_comm] using hTinter + + simpa [hScompl, inter_compl_singleton_eq_diff] using this + + have hp : (1/10 : ℝ) < (1 : ℂ).re := by + simpa using (by norm_num : (1/10 : ℝ) < (1 : ℝ)) + + have hpc : IsPathConnected ({z : ℂ | (1/10 : ℝ) < z.re} \ (({(1 : ℂ)} : Set ℂ))) := + isPathConnected_punctured_halfplane_re_gt (a := (1/10 : ℝ)) (p := (1 : ℂ)) (hp := hp) + + have hpcT : IsPathConnected T := by + simpa [hTdiff] using hpc + + have hconnT : IsConnected T := hpcT.isConnected + exact (IsConnected.isPreconnected (s := T) hconnT) + +lemma hasDerivAt_param_cpow_neg_one (u : ℝ) (hu : 0 < u) (z : ℂ) : + HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) (-(Real.log u) * (u : ℂ) ^ (-z - 1)) z := by + + have hcu : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (ne_of_gt hu) + + have hId : HasDerivAt (fun w : ℂ => w) (1 : ℂ) z := by simpa using! (hasDerivAt_id (x := z)) + have hneg : HasDerivAt (fun w : ℂ => -w) (-1 : ℂ) z := by simpa using! hId.neg + have hf : HasDerivAt (fun w : ℂ => -w - 1) (-1 : ℂ) z := by + + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hneg.add_const (-1 : ℂ) + + have h := (HasDerivAt.const_cpow (c := (u : ℂ)) (hf := hf) (h0 := Or.inl hcu)) + + have clog : Complex.log (u : ℂ) = (Real.log u : ℂ) := by + simpa using (Complex.ofReal_log (x := u) (hx := le_of_lt hu)).symm + simpa [clog, mul_comm, mul_left_comm, mul_assoc] using h + +lemma integrableOn_t_mul_exp_neg (ε : ℝ) (hε : 0 < ε) : IntegrableOn (fun t : ℝ => t * Real.exp (- ε * t)) (Ioi (0 : ℝ)) := by + + have h := integrableOn_rpow_mul_exp_neg_mul_rpow (p := (1 : ℝ)) (s := (1 : ℝ)) (b := ε) + (hs := by norm_num) (hp := by norm_num) (hb := hε) + + simpa [Real.rpow_one] using h + +lemma aestronglyMeasurable_kernel_param_deriv (z : ℂ) : + AEStronglyMeasurable (fun u : ℝ => -((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1))) (volume.restrict (Ioi (1 : ℝ))) := by + + let μ := volume.restrict (Ioi (1 : ℝ)) + + have hmeas_logR : Measurable (fun u : ℝ => Real.log u) := Real.measurable_log + have hmeas_logC : Measurable (fun u : ℝ => ((Real.log u) : ℂ)) := hmeas_logR.complex_ofReal + have hmeas_neg : Measurable (fun u : ℝ => -((Real.log u) : ℂ)) := hmeas_logC.neg + have h1 : AEStronglyMeasurable (fun u : ℝ => -((Real.log u) : ℂ)) μ := by + simpa [μ] using hmeas_neg.aestronglyMeasurable + + have h2 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) μ := by + simpa [μ] using kernel_aestronglyMeasurable_on_Ioi (s := z) (a := (1 : ℝ)) + + have hmul : AEStronglyMeasurable + (fun u : ℝ => (-((Real.log u) : ℂ)) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1))) + μ := (MeasureTheory.AEStronglyMeasurable.mul h1 h2) + simpa [μ] using hmul + +lemma kernel_deriv_norm_bound_on_ball (ε : ℝ) (u : ℝ) (hu : 1 < u) (x : ℂ) (hx : ε ≤ x.re) : + ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ ≤ Real.log u * u ^ (-1 - ε) := by + + have hu1 : (1 : ℝ) ≤ u := le_of_lt hu + + have hinner1 : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ≤ u ^ (-x.re - 1) := by + simpa using (lem_integrandBound u hu1 x) + have hexp_le : -x.re - 1 ≤ -1 - ε := by linarith + have hmono : u ^ (-x.re - 1) ≤ u ^ (-1 - ε) := + Real.rpow_le_rpow_of_exponent_le hu1 hexp_le + have hinner : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ≤ u ^ (-1 - ε) := + le_trans hinner1 hmono + + have hmul : ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ + = ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ := by + simp + have hnorm_nonneg : 0 ≤ ‖-((Real.log u) : ℂ)‖ := by simp + have hmul_le : ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ + ≤ ‖-((Real.log u) : ℂ)‖ * (u ^ (-1 - ε)) := by + exact mul_le_mul_of_nonneg_left hinner hnorm_nonneg + + have hlognorm_neg : ‖-((Real.log u) : ℂ)‖ = Real.log u := by + have hnonneg : 0 ≤ Real.log u := le_of_lt (Real.log_pos hu) + simp [norm_neg, Complex.norm_real, abs_of_nonneg hnonneg] + + calc + ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ + = ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ := hmul + _ ≤ ‖-((Real.log u) : ℂ)‖ * (u ^ (-1 - ε)) := hmul_le + _ = (Real.log u) * u ^ (-1 - ε) := by simp [hlognorm_neg, mul_comm] + +lemma exists_radius_ball_two_step_subset_halfspace (s : ℂ) {ε : ℝ} (hε : ε < s.re) : + ∃ δ > 0, ∀ x, dist x s < δ → ∀ y, dist y x < δ → ε ≤ y.re := by + + set δ : ℝ := (s.re - ε) / 2 with hδdef + have hpos : 0 < s.re - ε := sub_pos.mpr hε + have hδpos : 0 < δ := by simpa [hδdef] using (half_pos hpos) + refine ⟨δ, hδpos, ?_⟩ + intro x hx y hy + + have htri : dist y s ≤ dist y x + dist x s := by + simpa using (dist_triangle y x s) + have hsumlt : dist y x + dist x s < δ + δ := add_lt_add hy hx + have hnorm_lt : ‖y - s‖ < δ + δ := by + have := lt_of_le_of_lt htri hsumlt + simpa [dist_eq_norm] using this + have hdeltaSum : δ + δ = s.re - ε := by + simp [hδdef, add_halves] + have hnorm_lt_re : ‖y - s‖ < s.re - ε := by simpa [hdeltaSum] using hnorm_lt + + have h_eps_lt : ε < s.re - ‖y - s‖ := by + have hsum' : ε + ‖y - s‖ < s.re := by + simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using + (add_lt_add_right hnorm_lt_re ε) + simpa [lt_sub_iff_add_lt] using hsum' + + have hre_abs : |(y - s).re| ≤ ‖y - s‖ := by + simpa using (Complex.abs_re_le_norm (y - s)) + have hre_lower : -‖y - s‖ ≤ (y - s).re := by + + have hpair := (abs_le.mp hre_abs) + exact hpair.left + have hyge : s.re - ‖y - s‖ ≤ y.re := by + have h' : s.re + (-‖y - s‖) ≤ s.re + (y - s).re := add_le_add_right hre_lower s.re + have h'' : s.re + (y - s).re = y.re := by + simp [sub_eq_add_neg] + simpa [sub_eq_add_neg, h''] using h' + + have hygt : ε < y.re := lt_of_lt_of_le h_eps_lt hyge + exact le_of_lt hygt + +lemma integrable_kernel_at_param (s : ℂ) (hs : 0 < s.re) : + Integrable ((fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1))) (volume.restrict (Ioi (1 : ℝ))) := by + classical + + set f : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) + set ε : ℝ := s.re / 2 + set g1 : ℝ → ℝ := fun u => u ^ (-s.re - 1) + set g : ℝ → ℝ := fun u => u ^ (-1 - ε) + + have hfm : AEStronglyMeasurable f (volume.restrict (Ioi (1 : ℝ))) := by + simpa [f] using kernel_aestronglyMeasurable_on_Ioi (s := s) (a := (1 : ℝ)) + + have hε : 0 < ε := by + have : 0 < s.re := hs + simpa [ε] using (half_pos this) + have hεle : ε ≤ s.re := by + have hnonneg : 0 ≤ s.re := le_of_lt hs + simpa [ε] using (half_le_self hnonneg) + + have hbound1 : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ‖f u‖ ≤ g1 u := by + simpa [f, g1] using (kernel_ae_bound_on_Ioi (s := s)) + + have hpow_ae : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), g1 u ≤ g u := by + + have hAll : ∀ u ∈ Ioi (1 : ℝ), g1 u ≤ g u := by + intro u hu + have hx : (1 : ℝ) ≤ u := le_of_lt hu + have hlexp : (-s.re - 1) ≤ (-1 - ε) := by linarith + have := Real.rpow_le_rpow_of_exponent_le hx hlexp + simpa [g1, g] using this + + have hAE : ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → g1 u ≤ g u := + MeasureTheory.ae_of_all _ hAll + have hiff := + (MeasureTheory.ae_restrict_iff' (μ := volume) (s := Ioi (1 : ℝ)) + (p := fun u => g1 u ≤ g u) measurableSet_Ioi) + exact hiff.mpr hAE + + have hbound : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ‖f u‖ ≤ g u := by + filter_upwards [hbound1, hpow_ae] with u hu1 hu2 + exact le_trans hu1 hu2 + + have hgint : IntegrableOn g (Ioi (1 : ℝ)) := by + have ha_lt : (-1 - ε) < (-1 : ℝ) := by linarith + have hc : 0 < (1 : ℝ) := by norm_num + simpa [g] using (integrableOn_Ioi_rpow_of_lt (a := (-1 - ε)) (ha := ha_lt) (c := (1 : ℝ)) (hc := hc)) + + have hint : IntegrableOn f (Ioi (1 : ℝ)) := + integrableOn_of_ae_bound (s := Ioi (1 : ℝ)) (f := f) (g := g) + (hfm := hfm) (hgint := hgint) (hbound := hbound) + simpa [IntegrableOn, f] using hint + +lemma eventually_aestronglyMeasurable_kernel_param (s : ℂ) : + ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) (volume.restrict (Ioi (1 : ℝ))) := by + refine Filter.Eventually.of_forall ?_ + intro z + + have hmeas_fract : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := by + have hmeas_fr : Measurable (Int.fract : ℝ → ℝ) := by + simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) + exact (Complex.measurable_ofReal.comp hmeas_fr) + have hmeas_cpow : Measurable (fun u : ℝ => (u : ℂ) ^ (-z - 1)) := by + + measurability + have hmeas : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) := + hmeas_fract.mul hmeas_cpow + simpa using hmeas.aestronglyMeasurable + +lemma hasDerivAt_kernel_in_param (u : ℝ) (hu : 1 < u) (z : ℂ) : + HasDerivAt (fun w : ℂ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-w - 1)) + ( -((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) ) z := by + + set c0 : ℂ := ((Int.fract u : ℝ) : ℂ) + have hu0 : 0 < u := lt_trans zero_lt_one hu + have hux0 : (u : ℝ) ≠ 0 := ne_of_gt hu0 + have hcz : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hux0 + + have hfneg : HasDerivAt (fun w : ℂ => -w) (-1) z := (hasDerivAt_id z).neg + have hf : HasDerivAt (fun w : ℂ => -w - 1) (-1) z := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hfneg.sub_const (1 : ℂ) + + have hbase : HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) + ((u : ℂ) ^ (-z - 1) * Complex.log (u : ℂ) * (-1)) z := + HasDerivAt.const_cpow (c := (u : ℂ)) (hf := hf) (h0 := Or.inl hcz) + have hbase' : HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) + (-(Complex.log (u : ℂ)) * (u : ℂ) ^ (-z - 1)) z := by + + simpa [mul_comm, mul_left_comm, mul_assoc] using hbase + + have hmul : HasDerivAt (fun w : ℂ => c0 * ((u : ℂ) ^ (-w - 1))) + (c0 * (-(Complex.log (u : ℂ)) * (u : ℂ) ^ (-z - 1))) z := + HasDerivAt.const_mul c0 hbase' + + have hlog : (Real.log u : ℂ) = Complex.log (u : ℂ) := by + simpa using (Complex.ofReal_log (x := u) (hx := le_of_lt hu0)) + + simpa [c0, hlog, mul_comm, mul_left_comm, mul_assoc] using hmul + +lemma hasDerivAt_integral_param_dominated_Ioi + (F F' : ℂ → ℝ → ℂ) (s : ℂ) (δ : ℝ) (hδ : 0 < δ) + (hmeas : ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (F z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) + (hFint : Integrable (F s) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) + (hF'meas : AEStronglyMeasurable (F' s) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) + (bound : ℝ → ℝ) + (hbound_int : Integrable bound (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) + (hbound : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ∀ z ∈ Metric.ball s δ, ‖F' z u‖ ≤ bound u) + (hderiv : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ∀ z ∈ Metric.ball s δ, HasDerivAt (fun w => F w u) (F' z u) z) + : + HasDerivAt (fun z => ∫ u in Ioi (1 : ℝ), F z u) (∫ u in Ioi (1 : ℝ), F' s u) s := by + + have h := + hasDerivAt_integral_of_dominated_loc_of_deriv_le + (μ := MeasureTheory.volume.restrict (Ioi (1 : ℝ))) + (F := F) (F' := F') (x₀ := s) + (s := Metric.ball s δ) (hs := Metric.ball_mem_nhds s hδ) + (hF_meas := hmeas) (hF_int := hFint) + (hF'_meas := hF'meas) + (h_bound := hbound) (bound_integrable := hbound_int) + (h_diff := hderiv) + rcases h with ⟨_hint, hDeriv⟩ + + simpa using hDeriv + +lemma dist_lt_of_mem_two_balls {x z s : ℂ} {r : ℝ} + (hxz : dist x z < r) (hzs : dist z s < r) : dist x s < r + r := by + have htri : dist x s ≤ dist x z + dist z s := dist_triangle x z s + have hadd : dist x z + dist z s < r + r := add_lt_add hxz hzs + exact lt_of_le_of_lt htri hadd + +lemma mem_ball_of_mem_two_half_balls {x z s : ℂ} {δ : ℝ} + (hx : x ∈ Metric.ball z (δ/2)) (hz : z ∈ Metric.ball s (δ/2)) : + x ∈ Metric.ball s δ := by + have hxz : dist x z < δ / 2 := by + simpa [Metric.mem_ball] using hx + have hzs : dist z s < δ / 2 := by + simpa [Metric.mem_ball] using hz + have htri : dist x s ≤ dist x z + dist z s := dist_triangle x z s + have hadd : dist x z + dist z s < δ / 2 + δ / 2 := add_lt_add hxz hzs + have hlt : dist x s < δ := by + exact lt_of_le_of_lt htri (by simpa [add_halves] using hadd) + simpa [Metric.mem_ball] using hlt + +lemma dist_lt_delta_of_half {x s : ℂ} {δ : ℝ} (hδpos : 0 < δ) + (hx : dist x s < δ/2) : dist x s < δ := by + have hhalf : δ / 2 < δ := by + simpa using (half_lt_self hδpos) + exact lt_trans hx hhalf + +lemma re_lower_bound_from_two_step {s x : ℂ} {ε δ : ℝ} + (h : ∀ z, dist z s < δ → ∀ y, dist y z < δ → ε ≤ y.re) + (hδpos : 0 < δ) (hx : dist x s < δ) : ε ≤ x.re := by + have hxx : dist x x < δ := by simpa [dist_self] using hδpos + have hxstep := h x hx + have hxres := hxstep x hxx + simpa using hxres + +lemma analyticAt_of_eventually_differentiableAt {f : ℂ → ℂ} {s : ℂ} + (h : ∀ᶠ z in 𝓝 s, DifferentiableAt ℂ f z) : AnalyticAt ℂ f s := by + simpa using + (Complex.analyticAt_iff_eventually_differentiableAt (f := f) (c := s)).2 h + +lemma kernel_integrable_param_of_re_pos (z : ℂ) (hz : 0 < z.re) : + Integrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) + (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by + simpa using (integrable_kernel_at_param (s := z) (hs := hz)) + +lemma integrable_kernel_at_param' (z : ℂ) (hz : 0 < z.re) : + Integrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) + (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by simpa using integrable_kernel_at_param (s := z) hz + +lemma lem_integralAnalytic (s : ℂ) (hs : 1/10 < s.re) : + AnalyticAt ℂ (fun z : ℂ => ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by + classical + + have hspos : 0 < s.re := lt_trans (by norm_num : (0 : ℝ) < 1/10) hs + set ε : ℝ := s.re / 2 with hεdef + have hεpos : 0 < ε := by simpa [ε] using (half_pos hspos) + have hεlt : ε < s.re := by + have : s.re / 2 < s.re := by simpa [ε] using (half_lt_self hspos) + simpa [ε] using this + + rcases exists_radius_ball_two_step_subset_halfspace (s := s) (ε := ε) hεlt with ⟨δ, hδpos, hδprop⟩ + + let F : ℂ → ℝ → ℂ := fun z u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1) + let F' : ℂ → ℝ → ℂ := fun z u => -((Real.log u) : ℂ) * F z u + + let bound : ℝ → ℝ := fun u => (2/ε) * u ^ (-1 - (ε/2)) + + have hbound_int : Integrable bound (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by + have hlt : (-1 - (ε/2)) < (-1 : ℝ) := by + have : 0 < ε/2 := by simpa using (half_pos hεpos) + linarith + have hpos1 : 0 < (1 : ℝ) := by norm_num + have hpow_int : IntegrableOn (fun u : ℝ => u ^ (-1 - (ε/2))) (Ioi (1 : ℝ)) := by + simpa using (integrableOn_Ioi_rpow_of_lt (a := (-1 - (ε/2))) hlt (c := (1 : ℝ)) hpos1) + have hconst : IntegrableOn (fun u : ℝ => (2/ε) * u ^ (-1 - (ε/2))) (Ioi (1 : ℝ)) := + hpow_int.const_mul (2/ε) + simpa [IntegrableOn, bound] using hconst + + have hDiff_eventually : ∀ᶠ z in 𝓝 s, + DifferentiableAt ℂ (fun z0 => ∫ u in Ioi (1 : ℝ), F z0 u) z := by + + have hball : Metric.ball s (δ/2) ∈ 𝓝 s := Metric.ball_mem_nhds _ (by simpa using (half_pos hδpos)) + refine Filter.eventually_of_mem hball ?_ + intro z hz + + have hz_lt_δ : dist z s < δ := lt_trans (by simpa [Metric.mem_ball] using hz) (by simpa using (half_lt_self hδpos)) + have hRe_inner : ∀ y, y ∈ Metric.ball z (δ/2) → ε ≤ y.re := by + intro y hy + have hy_lt_δ : dist y z < δ := lt_trans (by simpa [Metric.mem_ball] using hy) (by simpa using (half_lt_self hδpos)) + exact hδprop z hz_lt_δ y hy_lt_δ + + have hmeas_z : ∀ᶠ w in 𝓝 z, + AEStronglyMeasurable (F w) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := + eventually_aestronglyMeasurable_kernel_param (s := z) + + have hzRe_ge : ε ≤ z.re := by + + have hss : dist s s < δ := by simpa [dist_self] using hδpos + have hz_lt_δ' : dist z s < δ := hz_lt_δ + exact hδprop s hss z hz_lt_δ' + have hzpos : 0 < z.re := lt_of_lt_of_le hεpos hzRe_ge + have hFint_z : Integrable (F z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by + simpa [F] using integrable_kernel_at_param (s := z) hzpos + + have hF'meas_z : AEStronglyMeasurable (F' z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by + simpa [F, F'] using aestronglyMeasurable_kernel_param_deriv (z := z) + + have hbound_z : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), + ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u := by + + have hAll : ∀ u ∈ Ioi (1 : ℝ), ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u := by + intro u hu w hw + have hu1 : 1 < u := hu + have hu0 : 0 < u := lt_trans zero_lt_one hu1 + + have hwRe : ε ≤ w.re := hRe_inner w hw + have hker : ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-w - 1))‖ + ≤ Real.log u * u ^ (-1 - ε) := + kernel_deriv_norm_bound_on_ball (ε := ε) (u := u) (hu := hu1) (x := w) (hx := hwRe) + have hF'le : ‖F' w u‖ ≤ Real.log u * u ^ (-1 - ε) := by + simpa [F, F', mul_comm, mul_left_comm, mul_assoc] using hker + + have hx' := Real.add_one_le_exp ((ε/2) * Real.log u) + have hx : 1 + (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) := by + simpa [add_comm] using hx' + have hsub : (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) - 1 := by + have := sub_le_sub_right hx 1 + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + have hle_exp : (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) := by + have hnonneg : 0 ≤ (1 : ℝ) := by norm_num + have : Real.exp ((ε/2) * Real.log u) - 1 ≤ Real.exp ((ε/2) * Real.log u) := + sub_le_self _ hnonneg + exact le_trans hsub this + have hεne : (ε : ℝ) ≠ 0 := ne_of_gt hεpos + have hpos_inv : 0 < ε⁻¹ := inv_pos.mpr hεpos + have hpos_coeff : 0 < (2/ε) := by + have : 0 < (2 : ℝ) := by norm_num + simpa [one_div, div_eq_mul_inv] using (mul_pos this hpos_inv) + have hlog_bound : Real.log u ≤ (2/ε) * Real.exp ((ε/2) * Real.log u) := by + have hmul := mul_le_mul_of_nonneg_left hle_exp (le_of_lt hpos_coeff) + + have hleft : (2/ε) * ((ε/2) * Real.log u) = Real.log u := by + have h2ne : (2 : ℝ) ≠ 0 := by norm_num + calc + (2/ε) * ((ε/2) * Real.log u) + = ((2/ε) * (ε/2)) * Real.log u := by ring + _ = ((2 * ε⁻¹) * (ε * (2)⁻¹)) * Real.log u := by simp [div_eq_mul_inv] + _ = ((2 * (2)⁻¹) * (ε⁻¹ * ε)) * Real.log u := by ring + _ = (1 * 1) * Real.log u := by simp [hεne, h2ne] + _ = Real.log u := by simp + simpa [hleft] + using hmul + + have hexp_rpow : Real.exp ((ε/2) * Real.log u) = u ^ (ε/2) := by + have : 0 < u := hu0 + simp [Real.rpow_def_of_pos this, mul_comm] + + have hmul : Real.log u * u ^ (-1 - ε) + ≤ ((2/ε) * u ^ (ε/2)) * u ^ (-1 - ε) := by + have hqpos : 0 < u ^ (-1 - ε) := Real.rpow_pos_of_pos hu0 _ + have hq : 0 ≤ u ^ (-1 - ε) := le_of_lt hqpos + exact mul_le_mul_of_nonneg_right (by simpa [hexp_rpow] using hlog_bound) hq + + have hpow_mul : u ^ (ε/2) * u ^ (-1 - ε) = u ^ (-1 - (ε/2)) := by + have hu0' : 0 < u := hu0 + have h1 : Real.exp ((ε/2) * Real.log u) * Real.exp ((-1 - ε) * Real.log u) + = Real.exp (((ε/2) * Real.log u) + ((-1 - ε) * Real.log u)) := by + simpa using (Real.exp_add ((ε/2) * Real.log u) ((-1 - ε) * Real.log u)).symm + calc + u ^ (ε/2) * u ^ (-1 - ε) + = Real.exp ((ε/2) * Real.log u) * Real.exp ((-1 - ε) * Real.log u) := by + simp [Real.rpow_def_of_pos hu0', mul_comm] + _ = Real.exp (((ε/2) * Real.log u) + ((-1 - ε) * Real.log u)) := by + simpa using h1 + _ = Real.exp (((ε/2) + (-1 - ε)) * Real.log u) := by + ring_nf + _ = u ^ (-1 - (ε/2)) := by + have : (ε/2) + (-1 - ε) = -1 - (ε/2) := by ring + simp [this, Real.rpow_def_of_pos hu0', mul_comm] + have hmul' : ((2/ε) * u ^ (ε/2)) * u ^ (-1 - ε) = (2/ε) * u ^ (-1 - (ε/2)) := by + simp [mul_assoc, hpow_mul] + + have : ‖F' w u‖ ≤ bound u := by + refine le_trans hF'le ?_ + simpa [bound, hmul'] using hmul + simpa [F, F', bound] + using this + + have hiff := + (MeasureTheory.ae_restrict_iff' (μ := MeasureTheory.volume) (s := Ioi (1 : ℝ)) + (p := fun u : ℝ => ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u) measurableSet_Ioi) + exact hiff.mpr (MeasureTheory.ae_of_all _ hAll) + + have hderiv_z : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), + ∀ w ∈ Metric.ball z (δ/2), HasDerivAt (fun w0 => F w0 u) (F' w u) w := by + + have hAll : ∀ u ∈ Ioi (1 : ℝ), ∀ w ∈ Metric.ball z (δ/2), + HasDerivAt (fun w0 => F w0 u) (F' w u) w := by + intro u hu w hw + simpa [F, F', mul_comm, mul_left_comm, mul_assoc] + using hasDerivAt_kernel_in_param (u := u) (hu := hu) (z := w) + + have hiff := + (MeasureTheory.ae_restrict_iff' (μ := MeasureTheory.volume) (s := Ioi (1 : ℝ)) + (p := fun u : ℝ => ∀ w ∈ Metric.ball z (δ/2), + HasDerivAt (fun w0 => F w0 u) (F' w u) w) measurableSet_Ioi) + exact hiff.mpr (MeasureTheory.ae_of_all _ hAll) + + have hD := hasDerivAt_integral_param_dominated_Ioi + (F := F) (F' := F') (s := z) (δ := δ/2) (hδ := by simpa using (half_pos hδpos)) + (hmeas := hmeas_z) (hFint := hFint_z) (hF'meas := hF'meas_z) + (bound := bound) (hbound_int := hbound_int) (hbound := hbound_z) (hderiv := hderiv_z) + + simpa using hD.differentiableAt + + exact analyticAt_of_eventually_differentiableAt hDiff_eventually + +lemma lem_zetaFormulaAC : + (let S := {s : ℂ | s ≠ 1} + let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} + let F := fun z : ℂ => + z / (z - 1) + - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) + AnalyticOn ℂ F T) := by + + simp only [AnalyticOn] + intro s hs + simp at hs + obtain ⟨hs_ne_1, hs_re⟩ := hs + + apply AnalyticAt.analyticWithinAt + + have h1 : AnalyticAt ℂ (fun z => z / (z - 1)) s := by + apply AnalyticAt.div + · exact analyticAt_id + · exact analyticAt_id.sub analyticAt_const + · + rw [sub_ne_zero] + exact hs_ne_1 + + have hs_re_eq : (10 : ℝ)⁻¹ = (1 : ℝ) / 10 := by norm_num + have hs_re_correct : (1 : ℝ) / 10 < s.re := by rwa [← hs_re_eq] + + have hconv := lem_integralConvergence (1/10) (by norm_num) s (le_of_lt hs_re_correct) + + obtain ⟨I, hI_tendsto, hI_bound⟩ := hconv + + have hI_bound_10 : ‖I‖ ≤ 10 := by + convert hI_bound + norm_num + + have h_integral : AnalyticAt ℂ (fun z => ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by + apply lem_integralAnalytic s hs_re_correct + + have h2 : AnalyticAt ℂ (fun z => z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by + exact analyticAt_id.mul h_integral + + exact h1.sub h2 + +lemma lem_div_eq_one_plus_one_div (z : ℂ) (hz : z ≠ 1) : z / (z - 1) = 1 + 1 / (z - 1) := by + have h : z - 1 ≠ 0 := by + intro h0 + have : z = 1 := by + rw [sub_eq_zero] at h0 + exact h0 + exact hz this + calc z / (z - 1) + = ((z - 1) + 1) / (z - 1) := by ring_nf + _ = (z - 1) / (z - 1) + 1 / (z - 1) := by rw [add_div] + _ = 1 + 1 / (z - 1) := by simp [div_self h] + +lemma lem_zetaAnalyticContinuation : + (let S := {s : ℂ | s ≠ 1} + let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} + ∀ s ∈ T, + riemannZeta s + = 1 + 1 / (s - 1) + - s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) := by + + simp only [Set.mem_ofPred_eq] + intro s h_s + + have hs_ne_1 : s ≠ 1 := h_s.1 + have hs_re : 1/10 < s.re := h_s.2 + + let F := fun z : ℂ => 1 + 1 / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) + + let S := {s : ℂ | s ≠ 1} + let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} + + have hs_in_T : s ∈ T := by + simp only [T, S, Set.mem_ofPred_eq] + exact ⟨hs_ne_1, hs_re⟩ + + have h_T_open := lem_T_isOpen + have h_T_preconnected := lem_T_isPreconnected + + have h_zeta_analytic_S := lem_zetaanalS + have h_zeta_analytic_T : AnalyticOn ℂ riemannZeta T := by + apply AnalyticOn.mono h_zeta_analytic_S + intro x hx; exact hx.1 + have h_zeta_analyticOnNhd_T : AnalyticOnNhd ℂ riemannZeta T := by + rwa [← h_T_open.analyticOn_iff_analyticOnNhd] + + have h_F_orig_analytic := lem_zetaFormulaAC + + have h_F_eq : EqOn F (fun z => z / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) T := by + intro z hz + simp only [F] + rw [lem_div_eq_one_plus_one_div z hz.1] + + have h_F_analytic_T : AnalyticOn ℂ F T := + AnalyticOn.congr h_F_orig_analytic h_F_eq + have h_F_analyticOnNhd_T : AnalyticOnNhd ℂ F T := by + rwa [← h_T_open.analyticOn_iff_analyticOnNhd] + + have ⟨s₀, hs₀_T, hs₀_re⟩ : ∃ s₀, s₀ ∈ T ∧ 1 < s₀.re := by + use 2 + constructor + · simp only [T, S, Set.mem_ofPred_eq] + norm_num + · norm_num + + have h_eventually_eq : riemannZeta =ᶠ[𝓝 s₀] F := by + + have h_re_cont : ContinuousAt Complex.re s₀ := Complex.continuous_re.continuousAt + have h_nhd_re : ∀ᶠ s in 𝓝 s₀, 1 < s.re := + ContinuousAt.eventually_lt continuousAt_const h_re_cont hs₀_re + + have h_nhd_T : ∀ᶠ s in 𝓝 s₀, s ∈ T := h_T_open.mem_nhds hs₀_T + + filter_upwards [h_nhd_re, h_nhd_T] with w hw_re hw_T + + have h_formula := lem_zetaFormula w hw_re + simp only [F] + exact h_formula + + have h_eqOn_global := AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq + h_zeta_analyticOnNhd_T h_F_analyticOnNhd_T h_T_preconnected hs₀_T h_eventually_eq + + exact h_eqOn_global hs_in_T + +lemma lem_zetaBound1 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ := by + classical + set S : Set ℂ := {z : ℂ | z ≠ 1} + set T : Set ℂ := {z : ℂ | z ∈ S ∧ 1/10 < z.re} + set Iint : ℂ := ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) + have hT : s ∈ T := by + have hsS : s ∈ S := by simpa [S, Set.mem_ofPred_eq] using hs_ne + simpa [T, Set.mem_ofPred_eq] using And.intro hsS hs_re + have hAC : ∀ z ∈ T, riemannZeta z = 1 + 1 / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) := by + simpa [S, T] using lem_zetaAnalyticContinuation + have hzeta : riemannZeta s = 1 + 1 / (s - 1) - s * Iint := by + simpa [Iint] using hAC s hT + have h1 : ‖riemannZeta s‖ ≤ ‖1 + 1 / (s - 1)‖ + ‖-s * Iint‖ := by + simpa [hzeta, sub_eq_add_neg] using (lem_triangleInequality_add (1 + 1 / (s - 1)) (-s * Iint)) + have hA : ‖1 + 1 / (s - 1)‖ ≤ ‖(1 : ℂ)‖ + ‖1 / (s - 1)‖ := by + simpa using (lem_triangleInequality_add (1 : ℂ) (1 / (s - 1))) + have hmul : ‖-s * Iint‖ = ‖-s‖ * ‖Iint‖ := by + simp + have hB : ‖-s * Iint‖ ≤ ‖s‖ * ‖Iint‖ := by + have : ‖-s * Iint‖ = ‖s‖ * ‖Iint‖ := by simp + exact this.le + have h2 : ‖riemannZeta s‖ ≤ (‖(1 : ℂ)‖ + ‖1 / (s - 1)‖) + (‖s‖ * ‖Iint‖) := + le_trans h1 (add_le_add hA hB) + have h1norm : ‖(1 : ℂ)‖ = 1 := by simp + simpa [Iint, h1norm, add_comm, add_left_comm, add_assoc] using h2 + +lemma lem_integralBoundValue (s : ℂ) (hs : 0 < s.re) : ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) = 1 / s.re := by + have ha : (-s.re - 1) < -1 := by linarith + have hc : 0 < (1 : ℝ) := by exact zero_lt_one + have h := integral_Ioi_rpow_of_lt (a := (-s.re - 1)) ha (c := (1 : ℝ)) hc + have h' : ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) = - (1 : ℝ) ^ (-s.re) / (-s.re) := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h + calc + ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) + = - (1 : ℝ) ^ (-s.re) / (-s.re) := h' + _ = - (1 : ℝ) / (-s.re) := by simp [Real.one_rpow] + _ = 1 / s.re := by simp + +lemma lem_zetaBound2 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ / s.re := by + + set f : ℝ → ℂ := fun u => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) with hfdef + set g : ℝ → ℝ := fun u => u ^ (-s.re - 1) with hgdef + + have hζ : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ := by + simpa [hfdef] using lem_zetaBound1 s hs_re hs_ne + + let μ : Measure ℝ := (volume : Measure ℝ).restrict (Ioi (1 : ℝ)) + + have h_ae_bound : ∀ᵐ u ∂μ, ‖f u‖ ≤ g u := by + have hforall : ∀ u ∈ Ioi (1 : ℝ), ‖f u‖ ≤ g u := by + intro u hu + have := lem_integrandBound u (le_of_lt hu) s + simpa [hfdef, hgdef] using this + have hmeas : MeasurableSet (Ioi (1 : ℝ)) := measurableSet_Ioi + simpa [μ] using + (MeasureTheory.ae_restrict_of_forall_mem (μ := volume) (s := Ioi (1 : ℝ)) hmeas hforall) + + have hg_intOn : IntegrableOn g (Ioi (1 : ℝ)) := by + classical + by_contra hnot + have hnot' : ¬ Integrable g μ := by simpa [μ, IntegrableOn] using hnot + have hint0 : (∫ u, g u ∂μ) = 0 := by + simpa using (integral_undef (μ := μ) (f := g) hnot') + have hval : ∫ u in Ioi (1 : ℝ), g u = 1 / s.re := by + simpa [hgdef] using lem_integralBoundValue s (by linarith [hs_re]) + have hne : (1 / s.re) ≠ 0 := by exact one_div_ne_zero (ne_of_gt (by linarith [hs_re])) + have : (∫ u in Ioi (1 : ℝ), g u) = 0 := by simpa [μ] using hint0 + exact hne (by simpa [hval] using this) + have hg_int : Integrable g μ := by simpa [μ, IntegrableOn] using hg_intOn + + have h_int_bound : ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ ∫ u in Ioi (1 : ℝ), g u := by + have := + (MeasureTheory.norm_integral_le_of_norm_le (μ := μ) (f := f) (g := g) hg_int h_ae_bound) + simpa [μ] using this + + have h_g_val : ∫ u in Ioi (1 : ℝ), g u = 1 / s.re := by + simpa [hgdef] using lem_integralBoundValue s (by linarith [hs_re]) + have h_int_bound_conc : ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ 1 / s.re := by + simpa [h_g_val] using h_int_bound + + have hmul : ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ ‖s‖ * (1 / s.re) := by + exact mul_le_mul_of_nonneg_left h_int_bound_conc (by exact norm_nonneg s) + + have hsum0 : (1 + ‖1 / (s - 1)‖) + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ + ≤ (1 + ‖1 / (s - 1)‖) + ‖s‖ * (1 / s.re) := by + exact add_le_add_right hmul (1 + ‖1 / (s - 1)‖) + have hsum : 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ + ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * (1 / s.re) := by + simpa [add_assoc] using hsum0 + + have hfinal1 : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * (1 / s.re) := + le_trans hζ hsum + simpa [div_eq_mul_inv] using hfinal1 + +lemma lem_sOverSminus1Bound (s : ℂ) (_hs : s ≠ 1) : ‖(1 / (s - 1))‖ = 1 / ‖s - 1‖ := by simp [one_div] + +lemma lem_zetaBound3 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := by + simpa [lem_sOverSminus1Bound s hs_ne] using lem_zetaBound2 s hs_re hs_ne + +lemma helper_normsq (z : ℂ) : ‖z‖ ^ 2 = z.re ^ 2 + z.im ^ 2 := by + simpa [Complex.normSq, pow_two] using (Complex.normSq_eq_norm_sq z).symm + +lemma helper_three_abs_sq (t : ℝ) : (3 : ℝ) ^ 2 + t ^ 2 ≤ (3 + |t|) ^ 2 := by + have hnonneg : 0 ≤ (6 : ℝ) * |t| := by + have h6 : (0 : ℝ) ≤ 6 := by norm_num + exact mul_nonneg h6 (abs_nonneg t) + have hmul : |t| * |t| = t * t := by + simp + calc + (3 : ℝ) ^ 2 + t ^ 2 = (3 : ℝ) ^ 2 + t * t := by simp [pow_two] + _ = (3 : ℝ) ^ 2 + |t| * |t| := by simp [hmul] + _ ≤ (3 : ℝ) ^ 2 + |t| * |t| + (6 : ℝ) * |t| := by exact le_add_of_nonneg_right hnonneg + _ = (3 + |t|) ^ 2 := by ring + +lemma lem_sBound (s : ℂ) (hs : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) : ‖s‖ < (3 : ℝ) + |s.im| := by + have hnegthree_lt_re : (- (3 : ℝ)) < s.re := by + have hlt : (- (3 : ℝ)) < (1 / 2 : ℝ) := by norm_num + exact lt_of_lt_of_le hlt hs.1 + have hlt3 : s.re < (3 : ℝ) := hs.2 + have h_re_sq_lt : s.re ^ 2 < (3 : ℝ) ^ 2 := by + simpa using (sq_lt_sq' hnegthree_lt_re hlt3) + have hsumlt : s.re ^ 2 + s.im ^ 2 < (3 : ℝ) ^ 2 + s.im ^ 2 := by + exact add_lt_add_left h_re_sq_lt _ + have hsq : ‖s‖ ^ 2 < (3 + |s.im|) ^ 2 := by + have h := lt_of_lt_of_le hsumlt (helper_three_abs_sq s.im) + simpa [helper_normsq s] using h + have hnormnn : 0 ≤ ‖s‖ := norm_nonneg _ + have hpos : 0 ≤ (3 : ℝ) + |s.im| := add_nonneg (by norm_num) (abs_nonneg _) + exact (sq_lt_sq₀ hnormnn hpos).1 hsq + +lemma lem_invReSbound (s : ℂ) (hs : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) : + 1 / s.re ≤ (2 : ℝ) := by + have h_pos : (0 : ℝ) < s.re := by + linarith [hs.1] + have h_half_pos : (0 : ℝ) < (1/2 : ℝ) := by norm_num + have h_recip : 1 / s.re ≤ 1 / (1/2 : ℝ) := one_div_le_one_div_of_le h_half_pos hs.1 + have h_simplify : 1 / (1/2 : ℝ) = (2 : ℝ) := by norm_num + rw [h_simplify] at h_recip + exact h_recip + +lemma lem_invSminus1bound (s : ℂ) (_hs_re : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) (hs_im : (1 : ℝ) ≤ |s.im|) : (1 : ℝ) ≤ ‖s - 1‖ := by + have h2 : |s.im| ≤ ‖s - 1‖ := by + have : (s - (1 : ℂ)).im = s.im := by + simp [Complex.sub_im, Complex.one_im] + simpa [this] using Complex.abs_im_le_norm (s - 1) + exact le_trans hs_im h2 + +lemma reciprocal_le_one_of_one_le {x : ℝ} (hx_pos : 0 < x) (hx_ge : 1 ≤ x) : 1 / x ≤ 1 := by + + have h_div_pos : 0 < 1 / x := one_div_pos.mpr hx_pos + + have h1 : (1 / x) * 1 ≤ (1 / x) * x := by + exact mul_le_mul_of_nonneg_left hx_ge (le_of_lt h_div_pos) + + rw [mul_one] at h1 + rw [one_div_mul_cancel (ne_of_gt hx_pos)] at h1 + exact h1 + +lemma div_le_mul_of_one_div_le {a c d : ℝ} (ha : 0 ≤ a) (_hc : 0 < c) (h : 1 / c ≤ d) : a / c ≤ a * d := by + + rw [div_eq_mul_one_div] + + exact mul_le_mul_of_nonneg_left h ha + +lemma lem_finalBoundCombination (s : ℂ) (hs_re : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) (hs_im : (1 : ℝ) ≤ |s.im|) : ‖riemannZeta s‖ < 1 + 1 + ((3 : ℝ) + |s.im|) * 2 := by + + have hs_ne : s ≠ 1 := by + intro h + rw [h] at hs_im + simp at hs_im + linarith + + have hs_re_pos : 0 < s.re := by linarith [hs_re.1] + + have h1 : ‖riemannZeta s‖ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := lem_zetaBound3 s (by linarith [hs_re_pos]) hs_ne + + have h2 : (1 : ℝ) ≤ ‖s - 1‖ := lem_invSminus1bound s hs_re hs_im + have h3 : 1 / ‖s - 1‖ ≤ 1 := reciprocal_le_one_of_one_le (by linarith [h2]) h2 + + have h4 : ‖s‖ < (3 : ℝ) + |s.im| := lem_sBound s hs_re + + have h5 : 1 / s.re ≤ (2 : ℝ) := lem_invReSbound s hs_re + + calc ‖riemannZeta s‖ + ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := h1 + _ ≤ 1 + 1 + ‖s‖ / s.re := by linarith [h3] + _ ≤ 1 + 1 + ‖s‖ * 2 := by + have s_nonneg : 0 ≤ ‖s‖ := norm_nonneg _ + exact add_le_add_right (div_le_mul_of_one_div_le s_nonneg hs_re_pos h5) _ + _ < 1 + 1 + ((3 : ℝ) + |s.im|) * 2 := by linarith [h4] + +lemma lem_finalAlgebra (t : ℝ) : 1 + 1 + ((3 : ℝ) + |t|) * 2 = (8 : ℝ) + 2 * |t| := by ring + +lemma lem_zetaUppBd (z : ℂ) (hz_re : z.re ∈ Ico (1/2 : ℝ) (3 : ℝ)) (hz_im : (1 : ℝ) ≤ |z.im|) : ‖riemannZeta z‖ < (8 : ℝ) + 2 * |z.im| := by + have hz_re' : (1/2 : ℝ) ≤ z.re ∧ z.re < (3 : ℝ) := by + simpa [Ico] using hz_re + have h := lem_finalBoundCombination z hz_re' hz_im + simpa [lem_finalAlgebra] using h + +lemma lem_zfroms_calc (s : ℂ) (t : ℝ) : + (let z := s + (3/2 : ℝ) + I * t + z.re = s.re + (3/2 : ℝ) ∧ z.im = s.im + t) := by + constructor + · + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im] + + have h1 : I.re = 0 := Complex.I_re + have h2 : I.im * 0 = 0 := mul_zero _ + rw [h1, h2] + simp + · + simp only [Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im] + + have h1 : I.re * 0 = 0 := mul_zero _ + have h2 : I.im = 1 := Complex.I_im + rw [h1, h2] + simp + +lemma lem_zfroms_conditions (s : ℂ) (t : ℝ) + (hs : ‖s‖ ≤ (1 : ℝ)) (ht : (2 : ℝ) < |t|) : + (let z := s + (3/2 : ℝ) + I * t + z.re ∈ Ico (1/2 : ℝ) (3 : ℝ) ∧ (1 : ℝ) ≤ |z.im|) := by + + have h_calc := lem_zfroms_calc s t + simp only [h_calc.1, h_calc.2] + constructor + + · + + have hs_re_bound : |s.re| ≤ 1 := + (Complex.abs_re_le_norm s).trans hs + rw [abs_le] at hs_re_bound + + rw [Set.mem_Ico] + constructor + · + linarith [hs_re_bound.1] + · + linarith [hs_re_bound.2] + + · + have hs_im_bound : |s.im| ≤ 1 := + (Complex.abs_im_le_norm s).trans hs + rw [abs_le] at hs_im_bound + + by_cases h : 0 ≤ t + · + have ht_pos : t > 2 := by + rwa [abs_of_nonneg h] at ht + + have lower_bound : s.im + t ≥ 1 := by + linarith [hs_im_bound.1, ht_pos] + have nonneg : 0 ≤ s.im + t := by linarith + rw [abs_of_nonneg nonneg] + linarith [lower_bound] + · + push Not at h + have ht_neg : t < -2 := by + rw [abs_of_neg h] at ht + linarith [ht] + + have upper_bound : s.im + t ≤ -1 := by + linarith [hs_im_bound.2, ht_neg] + have neg : s.im + t < 0 := by linarith + rw [abs_of_neg neg] + linarith [upper_bound] + +lemma lem_abs_im_bound (s : ℂ) (t : ℝ) (hs : ‖s‖ ≤ 1) : |s.im + t| ≤ 1 + |t| := by + have h1 : |s.im| ≤ ‖s‖ := Complex.abs_im_le_norm s + have h2 : |s.im| ≤ 1 := le_trans h1 hs + have h3 : |s.im + t| ≤ |s.im| + |t| := abs_add_le s.im t + linarith + +lemma lem_zetaUppBound : + ∀ t : ℝ, ∀ s : ℂ, ‖s‖ ≤ (1 : ℝ) → (2 : ℝ) < |t| → + ‖riemannZeta (s + (3/2 : ℝ) + I * t)‖ < (10 : ℝ) + 2 * |t| := by + intro t s hs ht + set z := s + (3/2 : ℝ) + I * t with hz_def + + have hz_cond : z.re ∈ Ico (1/2 : ℝ) (3 : ℝ) ∧ (1 : ℝ) ≤ |z.im| := + lem_zfroms_conditions s t hs ht + + have h_bound : ‖riemannZeta z‖ < (8 : ℝ) + 2 * |z.im| := + lem_zetaUppBd z hz_cond.1 hz_cond.2 + + have hz_im_calc : z.im = s.im + t := (lem_zfroms_calc s t).2 + have h_im_bound : |z.im| ≤ 1 + |t| := by + rw [hz_im_calc] + exact lem_abs_im_bound s t hs + + have h_intermediate : ‖riemannZeta z‖ < (8 : ℝ) + 2 * (1 + |t|) := by + calc ‖riemannZeta z‖ + < (8 : ℝ) + 2 * |z.im| := h_bound + _ ≤ (8 : ℝ) + 2 * (1 + |t|) := by linarith [h_im_bound] + + have h_algebra : (8 : ℝ) + 2 * (1 + |t|) = (10 : ℝ) + 2 * |t| := by ring + + have h_final : ‖riemannZeta z‖ < (10 : ℝ) + 2 * |t| := by + linarith [h_intermediate, h_algebra] + + rwa [hz_def] at h_final + +open Metric _root_.Set Filter Asymptotics BigOperators + +noncomputable def logDerivZeta (s : ℂ) : ℂ := deriv riemannZeta s / riemannZeta s + +def zerosetKfRc (R : ℝ) (c : ℂ) (f : ℂ → ℂ) : Set ℂ := + {ρ : ℂ | ρ ∈ Metric.closedBall c R ∧ f ρ = 0} + +lemma zetadiffAtnot1 : ∀ s : ℂ, s ≠ 1 → DifferentiableAt ℂ riemannZeta s := + fun _ => differentiableAt_riemannZeta + +lemma DiffAtWithinAt {T : Set ℂ} {g : ℂ → ℂ} {s : ℂ} (_hs : s ∈ T) : + DifferentiableAt ℂ g s → DifferentiableWithinAt ℂ g T s := + DifferentiableAt.differentiableWithinAt + +lemma DiffWithinAtallOn {T : Set ℂ} {g : ℂ → ℂ} : + (∀ s ∈ T, DifferentiableWithinAt ℂ g T s) → DifferentiableOn ℂ g T := fun h => h + +lemma DiffAtOn {T : Set ℂ} {g : ℂ → ℂ} : + (∀ s ∈ T, DifferentiableAt ℂ g s) → DifferentiableOn ℂ g T := by + intro h s hs + exact (h s hs).differentiableWithinAt + +lemma DiffOnanalOnNhd {T : Set ℂ} (hT : IsOpen T) {g : ℂ → ℂ} : + DifferentiableOn ℂ g T → AnalyticOnNhd ℂ g T := by + intro hdiff + exact hdiff.analyticOnNhd hT + +lemma DiffAtallanalOnNhd {T : Set ℂ} (hT : IsOpen T) {g : ℂ → ℂ} : + (∀ s ∈ T, DifferentiableAt ℂ g s) → AnalyticOnNhd ℂ g T := by + intro hdiff + apply DiffOnanalOnNhd hT + exact DiffAtOn hdiff + +lemma zetaanalOnnot1 : AnalyticOnNhd ℂ riemannZeta {s : ℂ | s ≠ 1} := by + apply DiffAtallanalOnNhd + · apply isOpen_compl_singleton + · exact zetadiffAtnot1 + +lemma I_mul_ofReal_im (t : ℝ) : (I * ↑t).im = t := by + have h1 : (I * (↑t : ℂ)).im = (↑t : ℂ).re := Complex.I_mul_im (↑t : ℂ) + rw [h1] + simp [Complex.ofReal_re] + +lemma complex_im_sub_I_mul (a : ℂ) (t : ℝ) : (a - I * t).im = a.im - t := by + rw [Complex.sub_im] + rw [I_mul_ofReal_im] + +lemma D1cinTt_pre (t : ℝ) (ht : |t| > 1) : + ∀ s ∈ closedBall (3/2 + I * t : ℂ) 1, s ≠ 1 := by + intro s hs + by_contra h + + rw [h] at hs + + rw [mem_closedBall] at hs + + rw [Complex.dist_eq] at hs + + have h1 : (1 : ℂ) - (3/2 + I * t) = -1/2 - I * t := by ring + rw [h1] at hs + + have h2 : (-1/2 - I * t : ℂ).im = -t := by + have : (-1/2 - I * t : ℂ) = (-1/2 : ℂ) - I * t := by ring + rw [this] + rw [complex_im_sub_I_mul] + simp + + have h3 : ‖(-1/2 - I * t : ℂ)‖ ≥ |(-1/2 - I * t : ℂ).im| := Complex.abs_im_le_norm _ + + rw [h2] at h3 + rw [abs_neg] at h3 + + have h4 : ‖(-1/2 - I * t : ℂ)‖ > 1 := lt_of_lt_of_le ht h3 + + linarith [h4, hs] + +lemma D1cinTt (t : ℝ) (ht : |t| > 1) : + closedBall (3/2 + I * t : ℂ) 1 ⊆ {s : ℂ | s ≠ 1} := by + + exact fun s hs => D1cinTt_pre t ht s hs + +lemma zetaanalOnD1c (t : ℝ) (ht : |t| > 1) : + AnalyticOnNhd ℂ riemannZeta (closedBall (3/2 + I * t : ℂ) 1) := by + apply zetaanalOnnot1.mono + exact D1cinTt t ht + +lemma zetaanalOnD1c_general (x t : ℝ) (ht : |t| > 1) : + AnalyticOnNhd ℂ riemannZeta (closedBall (x + I * t : ℂ) 1) := by + apply zetaanalOnnot1.mono + + intro s hs + by_contra h + + have h' : s = 1 := by + simp at h + exact h + rw [h'] at hs + rw [mem_closedBall] at hs + rw [Complex.dist_eq] at hs + + have h1 : (1 : ℂ) - (x + I * t) = (1 - x) - I * t := by ring + rw [h1] at hs + + have h2 : ((1 - x) - I * t : ℂ).im = -t := by + rw [Complex.sub_im] + rw [Complex.sub_im] + rw [Complex.ofReal_im] + rw [I_mul_ofReal_im] + simp + + have h3 : ‖((1 - x) - I * t : ℂ)‖ ≥ |((1 - x) - I * t : ℂ).im| := Complex.abs_im_le_norm _ + rw [h2] at h3 + rw [abs_neg] at h3 + + have h4 : ‖((1 - x) - I * t : ℂ)‖ > 1 := lt_of_lt_of_le ht h3 + + linarith + +lemma sigmageq1 (s : ℂ) (hs : s.re > 1) : riemannZeta s ≠ 0 := + riemannZeta_ne_zero_of_one_lt_re hs + +lemma Complex_I_mul_ofReal_re (r : ℝ) : (I * (r : ℂ)).re = 0 := by + have h : (I * (r : ℂ)).re = -(r : ℂ).im := Complex.I_mul_re (r : ℂ) + rw [h] + simp + +lemma re_real_add_I_mul_gt (a b : ℝ) (h : a > 1) : (a + I * b).re > 1 := by + rw [Complex.add_re] + rw [Complex.ofReal_re] + rw [Complex_I_mul_ofReal_re] + simp + exact h + +lemma zetacnot0 (t : ℝ) : riemannZeta (3/2 + I * t) ≠ 0 := by + apply sigmageq1 + apply re_real_add_I_mul_gt + norm_num + +lemma zetacnot0_general (x t : ℝ) (hx : x > 1) : riemannZeta (x + I * t) ≠ 0 := by + apply sigmageq1 + apply re_real_add_I_mul_gt + exact hx + +lemma fc_analytic_normalized (c : ℂ) (f : ℂ → ℂ) + (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) : + (AnalyticOnNhd ℂ (fun z => f (z + c) / f c) (closedBall (0 : ℂ) 1)) ∧ (fun z => f (z + c) / f c) 0 = 1 := by + constructor + · + apply AnalyticOnNhd.div + · + apply AnalyticOnNhd.comp h_analytic + · + intro z _ + exact analyticAt_id.add analyticAt_const + · + intro z hz + rw [mem_closedBall] at hz ⊢ + rw [Complex.dist_eq] at hz ⊢ + + convert hz using 1 + ring_nf + · + exact analyticOnNhd_const + · + intro z _ + exact h_nonzero + · + simpa using h_nonzero + +lemma deriv_normalized_nohd (c : ℂ) (f : ℂ → ℂ) (z : ℂ) (_h_nonzero : f c ≠ 0) : + deriv (fun w => f (w + c) / f c) z = (deriv f (z + c)) / f c := by + rw [deriv_div_const] + rw [deriv_comp_add_const] + +lemma frac_cancel_const {x y c : ℂ} (hc : c ≠ 0) (hy : y ≠ 0) : (x / c) / (y / c) = x / y := by + field_simp [hc, hy] + +lemma fc_log_deriv (c : ℂ) (f : ℂ → ℂ) + (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) + {z : ℂ} (hz_nonzero : f (z + c) ≠ 0) : + (deriv (fun w => f (w + c) / f c) z) / (f (z + c) / f c) = (deriv f (z + c)) / f (z + c) := by + + rw [deriv_normalized_nohd c f z h_nonzero] + + rw [frac_cancel_const h_nonzero hz_nonzero] + +lemma fc_bound (B : ℝ) (_hB : B > 1) (R : ℝ) (_hRpos : 0 < R) (_hR : R < 1) (c : ℂ) (f : ℂ → ℂ) (_h_nonzero : f c ≠ 0) + (h_bound : ∀ z ∈ closedBall c R, ‖f z‖ ≤ B) : + ∀ z ∈ closedBall (0 : ℂ) R, ‖(fun w => f (w + c) / f c) z‖ ≤ B / ‖f c‖ := by + intro z hz + have hz' : ‖z‖ ≤ R := by + simpa [mem_closedBall, Complex.dist_eq] using hz + have hz_plus : z + c ∈ closedBall c R := by + have : ‖(z + c) - c‖ ≤ R := by simpa [add_sub_cancel] using hz' + simpa [mem_closedBall, Complex.dist_eq] using this + have hfb : ‖f (z + c)‖ ≤ B := h_bound (z + c) hz_plus + have hnorm : ‖f (z + c) / f c‖ = ‖f (z + c)‖ / ‖f c‖ := by + simp [div_eq_mul_inv, norm_inv] + have : ‖f (z + c)‖ / ‖f c‖ ≤ B / ‖f c‖ := + div_le_div_of_nonneg_right hfb (norm_nonneg _) + simpa [hnorm] using this + +lemma fc_zeros (r : ℝ) (_h : r > 0) (c : ℂ) (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) + (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) : + (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)) = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := by + ext ρ'; constructor + · intro hmem + rcases hmem with ⟨hball, hzero⟩ + + have hprod : f (ρ' + c) * (f c)⁻¹ = 0 := by simpa [div_eq_mul_inv] using hzero + have hnum0 : f (ρ' + c) = 0 := by + rcases mul_eq_zero.mp hprod with hnum | hinv + · exact hnum + · have : (f c)⁻¹ ≠ 0 := inv_ne_zero h_nonzero + exact (this hinv).elim + refine ⟨ρ' + c, ?_, ?_⟩ + · + have hdist0 : dist ρ' (0 : ℂ) ≤ r := by simpa [mem_closedBall] using hball + have hdist1 : dist (ρ' + c) c ≤ r := by + simpa [Complex.dist_eq, add_sub_cancel] using hdist0 + have hmem_ball : ρ' + c ∈ closedBall c r := by + simpa [mem_closedBall] using hdist1 + exact And.intro hmem_ball hnum0 + · + simp + · intro him + rcases him with ⟨y, hy_mem, hy_eq⟩ + + subst hy_eq + rcases hy_mem with ⟨hy_ball, hy_zero⟩ + refine And.intro ?_ ?_ + · + have hdist : dist y c ≤ r := by simpa [mem_closedBall] using hy_ball + have hdist0 : dist (y - c) (0 : ℂ) ≤ r := by + simpa [Complex.dist_eq, sub_zero] using hdist + simpa [mem_closedBall] using hdist0 + · + simp [sub_add_cancel, hy_zero] + +lemma analyticOrderAt_const_mul_eq (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : + analyticOrderAt (fun z => a * f z) z0 = analyticOrderAt f z0 := by + classical + by_cases hf : AnalyticAt ℂ f z0 + · + have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by + simpa using (analyticAt_const (x := z0) (v := a)) + have hconst_order_zero : analyticOrderAt (fun _ : ℂ => a) z0 = 0 := by + + refine (AnalyticAt.analyticOrderAt_eq_natCast (f := fun _ : ℂ => a) (z₀ := z0) hconst).mpr ?_ + refine ⟨(fun _ : ℂ => a), (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0), ?_, ?_⟩ + · simpa using ha + · exact Filter.Eventually.of_forall (fun _ => by simp) + have hmul := analyticOrderAt_mul (f := fun _ : ℂ => a) (g := f) hconst hf + + simpa [hconst_order_zero, zero_add] using! hmul + · + have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by + simpa using (analyticAt_const (x := z0) (v := a)) + have hconst_ne : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha + have hiff := (analyticAt_iff_analytic_fun_mul (f := fun _ : ℂ => a) (g := f) (z := z0) hconst hconst_ne) + have hmul : ¬ AnalyticAt ℂ (fun z => a * f z) z0 := by + intro h + have : AnalyticAt ℂ f z0 := (hiff.mpr (by simpa using h)) + exact hf this + + simp [analyticOrderAt, hf, hmul] + +lemma AnalyticAt.comp_add_const {f : ℂ → ℂ} {z0 c : ℂ} (hf : AnalyticAt ℂ f (z0 + c)) : AnalyticAt ℂ (fun z => f (z + c)) z0 := by + + have hinner : AnalyticAt ℂ (fun z : ℂ => z + c) z0 := by + have h_id : AnalyticAt ℂ (fun z : ℂ => z) z0 := by + simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) z0) + have h_const : AnalyticAt ℂ (fun _ : ℂ => c) z0 := by + simpa using (analyticAt_const (v := c) (x := z0)) + simpa using (AnalyticAt.fun_add (f := fun z : ℂ => z) (g := fun _ : ℂ => c) (x := z0) h_id h_const) + + simpa using (AnalyticAt.fun_comp (x := z0) hf hinner) + +lemma AnalyticAt.of_comp_add_const {f : ℂ → ℂ} {z0 c : ℂ} + (hg : AnalyticAt ℂ (fun z => f (z + c)) z0) : + AnalyticAt ℂ f (z0 + c) := by + + have hT : AnalyticAt ℂ (fun z => z - c) (z0 + c) := by + have h1 : AnalyticAt ℂ (fun z : ℂ => z) (z0 + c) := by + simpa using! (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (z0 + c)) + have h2 : AnalyticAt ℂ (fun _ : ℂ => -c) (z0 + c) := by + simpa using (analyticAt_const (x := (z0 + c)) (v := (-c : ℂ))) + have : AnalyticAt ℂ (fun z => z + (-c)) (z0 + c) := by + simpa using (AnalyticAt.fun_add h1 h2) + simpa [sub_eq_add_neg] using this + + have hx : (z0 + c) - c = z0 := by simp + have hg' : AnalyticAt ℂ (fun z => f (z + c)) ((z0 + c) - c) := by + simpa [hx] using hg + + have hcomp := + (AnalyticAt.comp (g := (fun z => f (z + c))) (f := (fun z => z - c)) (x := z0 + c) + hg' hT) + have hgf : ((fun z => f (z + c)) ∘ (fun z => z - c)) = f := by + funext z + simp [Function.comp, sub_eq_add_neg] + simpa [hgf] using hcomp + +lemma order_top_iff_comp_add (f : ℂ → ℂ) (z0 c : ℂ) : + analyticOrderAt (fun z => f (z + c)) z0 = ⊤ ↔ analyticOrderAt f (z0 + c) = ⊤ := by + classical + let g : ℂ → ℂ := fun z => f (z + c) + + have eq_left : analyticOrderAt g z0 = ⊤ ↔ ∀ᶠ z in nhds z0, g z = 0 := by + simpa [g] using (analyticOrderAt_eq_top (f := g)) + have eq_right : analyticOrderAt f (z0 + c) = ⊤ ↔ ∀ᶠ w in nhds (z0 + c), f w = 0 := by + simpa using (analyticOrderAt_eq_top (f := f)) + constructor + · intro htop + have hz : ∀ᶠ z in nhds z0, g z = 0 := (eq_left.mp htop) + + have hcont_sub : ContinuousAt (fun w : ℂ => w - c) (z0 + c) := by + simpa [sub_eq_add_neg] using! + ((continuousAt_id).add (continuousAt_const : ContinuousAt (fun _ : ℂ => -c) (z0 + c))) + have htend : Tendsto (fun w : ℂ => w - c) (nhds (z0 + c)) (nhds ((z0 + c) - c)) := + hcont_sub.tendsto + have hz' : ∀ᶠ w in nhds ((z0 + c) - c), g w = 0 := by + simpa [sub_eq_add_neg, add_sub_cancel] using hz + have hw : ∀ᶠ w in nhds (z0 + c), g (w - c) = 0 := htend.eventually hz' + have hw' : ∀ᶠ w in nhds (z0 + c), f w = 0 := by + simpa [g, sub_add_cancel] using hw + exact eq_right.mpr hw' + · intro htop + have hw : ∀ᶠ w in nhds (z0 + c), f w = 0 := (eq_right.mp htop) + + have hcont_add : ContinuousAt (fun z : ℂ => z + c) z0 := + by simpa using! ((continuousAt_id).add (continuousAt_const : ContinuousAt (fun _ : ℂ => c) z0)) + have htend : Tendsto (fun z : ℂ => z + c) (nhds z0) (nhds (z0 + c)) := + hcont_add.tendsto + have hz : ∀ᶠ z in nhds z0, f (z + c) = 0 := htend.eventually hw + have hz' : ∀ᶠ z in nhds z0, g z = 0 := by simpa [g] using hz + exact eq_left.mpr hz' + +lemma enat_le_iff_forall_nat {x y : ℕ∞} : x ≤ y ↔ ∀ n : ℕ, (n : ℕ∞) ≤ x → (n : ℕ∞) ≤ y := by + classical + constructor + · intro hxy n hnx + exact le_trans hnx hxy + · intro h + by_cases hx : x = ⊤ + · + subst hx + + by_contra hnot + have hy_ne : y ≠ ⊤ := by + simpa [WithTop.top_le_iff] using hnot + obtain ⟨m, hm⟩ := (WithTop.ne_top_iff_exists).1 hy_ne + + have h' : ((m + 1 : ℕ) : ℕ∞) ≤ y := h (m + 1) (by simp) + + have h'' : ((m + 1 : ℕ) : ℕ∞) ≤ (m : ℕ∞) := by + simpa [← hm] + using! h' + + have : m + 1 ≤ m := (WithTop.coe_le_coe).1 h'' + exact Nat.not_succ_le_self m this + · + obtain ⟨k, hk'⟩ := (WithTop.ne_top_iff_exists).1 hx + have hk : x = (k : ℕ∞) := hk'.symm + + have hxk : ((k : ℕ∞) ≤ y) := h k (by simp [hk]) + + simpa [hk] using hxk + +lemma natCast_le_order_const_mul_iff (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) (n : ℕ) : + (n : ℕ∞) ≤ analyticOrderAt (fun z => a * f z) z0 ↔ (n : ℕ∞) ≤ analyticOrderAt f z0 := by + constructor + · intro h + simpa [analyticOrderAt_const_mul_eq f a z0 ha] using h + · intro h + simpa [analyticOrderAt_const_mul_eq f a z0 ha] using h + +lemma order_top_iff_const_mul (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : + analyticOrderAt (fun z => a * f z) z0 = ⊤ ↔ analyticOrderAt f z0 = ⊤ := by + simp [analyticOrderAt_const_mul_eq (f := f) (a := a) (z0 := z0) ha] + +lemma analyticOrderAt_mul_const_eq (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : + analyticOrderAt (fun z => f z * a) z0 = analyticOrderAt f z0 := by + classical + + have hcomm : (fun z => f z * a) = (fun z => a * f z) := by + funext z; simp [mul_comm] + have hrew : analyticOrderAt (fun z => f z * a) z0 = + analyticOrderAt (fun z => a * f z) z0 := by + simp [hcomm] + by_cases hf : AnalyticAt ℂ f z0 + · + have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by + simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0) + have hadd : analyticOrderAt (fun z => a * f z) z0 + = analyticOrderAt (fun _ : ℂ => a) z0 + analyticOrderAt f z0 := by + simpa using! (analyticOrderAt_mul hconst hf) + + have hconst_zero : analyticOrderAt (fun _ : ℂ => a) z0 = 0 := by + have hiff := (AnalyticAt.analyticOrderAt_eq_zero hconst) + have hval : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha + exact hiff.mpr hval + calc + analyticOrderAt (fun z => f z * a) z0 + = analyticOrderAt (fun z => a * f z) z0 := hrew + _ = analyticOrderAt (fun _ : ℂ => a) z0 + analyticOrderAt f z0 := hadd + _ = 0 + analyticOrderAt f z0 := by simp [hconst_zero] + _ = analyticOrderAt f z0 := by simp + · + have hnot : ¬ AnalyticAt ℂ (fun z => a * f z) z0 := by + intro hmul + have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by + simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0) + have hval : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha + + have hiff := (analyticAt_iff_analytic_fun_smul (h₁f := hconst) (h₂f := hval) + (g := f) (z := z0)) + have hsmul : AnalyticAt ℂ (fun z => (fun _ : ℂ => a) z • f z) z0 := by + + simpa [smul_eq_mul] using hmul + have : AnalyticAt ℂ f z0 := hiff.mpr hsmul + exact hf this + calc + analyticOrderAt (fun z => f z * a) z0 + = analyticOrderAt (fun z => a * f z) z0 := hrew + _ = 0 := by simp [analyticOrderAt, hnot] + _ = analyticOrderAt f z0 := by simp [analyticOrderAt, hf] + +lemma fc_m_order (r : ℝ) (_h : r > 0) (c : ℂ) (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) + (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) + {ρ' : ℂ} (_hρ' : ρ' ∈ zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)) : + analyticOrderAt (fun z => f (z + c) / f c) ρ' = analyticOrderAt f (ρ' + c) := by + classical + + set g0 : ℂ → ℂ := fun z => f (z + c) with hg0 + + have hconst : analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' = analyticOrderAt g0 ρ' := by + have hne : (1 / f c) ≠ 0 := one_div_ne_zero h_nonzero + simpa using (analyticOrderAt_mul_const_eq (f := g0) (a := (1 / f c)) (z0 := ρ') hne) + have hconst_rewrite : analyticOrderAt (fun z => f (z + c) / f c) ρ' + = analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' := by + have : (fun z => f (z + c) / f c) = (fun z => g0 z * (1 / f c)) := by + funext z; simp [g0, div_eq_mul_inv, mul_comm] + simp [this] + + have htrans : analyticOrderAt g0 ρ' = analyticOrderAt f (ρ' + c) := by + + by_cases hfA : AnalyticAt ℂ f (ρ' + c) + · + have h_add : AnalyticAt ℂ (fun z : ℂ => z + c) ρ' := by + simpa using! (AnalyticAt.add (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) ρ') + (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) ρ')) + have hgA : AnalyticAt ℂ g0 ρ' := by + have : AnalyticAt ℂ f ((fun z : ℂ => z + c) ρ') := by simpa using hfA + simpa [g0, hg0] using! (AnalyticAt.comp (g := f) (f := fun z : ℂ => z + c) (x := ρ') this h_add) + + by_cases hgez : (∀ᶠ z in nhds ρ', g0 z = 0) + · + have hT_sub_cont : ContinuousAt (fun w : ℂ => w - c) (ρ' + c) := by + simpa using! (ContinuousAt.sub (continuousAt_id : ContinuousAt (fun w : ℂ => w) (ρ' + c)) + (continuousAt_const : ContinuousAt (fun _ : ℂ => c) (ρ' + c))) + have hT_sub : Tendsto (fun w : ℂ => w - c) (nhds (ρ' + c)) (nhds ρ') := by + simpa using (hT_sub_cont.tendsto) + have hEfw : ∀ᶠ w in nhds (ρ' + c), f w = 0 := by + have : ∀ᶠ w in nhds (ρ' + c), g0 (w - c) = 0 := hT_sub.eventually hgez + + simpa [g0, hg0, sub_add_cancel] using this + + have hg_top : analyticOrderAt g0 ρ' = ⊤ := + (analyticOrderAt_eq_top (f := g0) (z₀ := ρ')).2 hgez + have hf_top : analyticOrderAt f (ρ' + c) = ⊤ := + (analyticOrderAt_eq_top (f := f) (z₀ := ρ' + c)).2 hEfw + simp [hg_top, hf_top] + · + have h_exists := (AnalyticAt.exists_eventuallyEq_pow_smul_nonzero_iff hgA).mpr hgez + rcases h_exists with ⟨n, φ, hφA, hφ_ne, hevent⟩ + + have hT_sub_cont : ContinuousAt (fun w : ℂ => w - c) (ρ' + c) := by + simpa using! (ContinuousAt.sub (continuousAt_id : ContinuousAt (fun w : ℂ => w) (ρ' + c)) + (continuousAt_const : ContinuousAt (fun _ : ℂ => c) (ρ' + c))) + have hT_sub : Tendsto (fun w : ℂ => w - c) (nhds (ρ' + c)) (nhds ρ') := by + simpa using (hT_sub_cont.tendsto) + have hevent_w : ∀ᶠ w in nhds (ρ' + c), f w + = (w - (ρ' + c)) ^ n * ((fun w => φ (w - c)) w) := by + have : ∀ᶠ w in nhds (ρ' + c), g0 (w - c) + = ((w - c) - ρ') ^ n * φ (w - c) := + hT_sub.eventually hevent + + refine this.mono ?_ + intro w hw + have hsubsimp : (w - c) - ρ' = w - (ρ' + c) := by ring + simpa [g0, hg0, hsubsimp] using hw + + have hψA : AnalyticAt ℂ (fun w => φ (w - c)) (ρ' + c) := by + have h_subA : AnalyticAt ℂ (fun w : ℂ => w - c) (ρ' + c) := by + simpa using! (AnalyticAt.sub (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (ρ' + c)) + (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) (ρ' + c))) + have hφA_at : AnalyticAt ℂ φ ((fun w : ℂ => w - c) (ρ' + c)) := by simpa using hφA + simpa using! (AnalyticAt.comp (g := φ) (f := fun w => w - c) (x := (ρ' + c)) hφA_at h_subA) + have hψ_ne : (fun w => φ (w - c)) (ρ' + c) ≠ 0 := by + + simpa using hφ_ne + + have hg_eq_n : analyticOrderAt g0 ρ' = n := by + exact (AnalyticAt.analyticOrderAt_eq_natCast (f := g0) (z₀ := ρ') hgA).mpr + ⟨φ, hφA, hφ_ne, hevent⟩ + have hf_eq_n : analyticOrderAt f (ρ' + c) = n := by + exact (AnalyticAt.analyticOrderAt_eq_natCast (f := f) (z₀ := ρ' + c) hfA).mpr + ⟨(fun w => φ (w - c)), hψA, hψ_ne, hevent_w⟩ + simp [hg_eq_n, hf_eq_n] + · + have hg_not : ¬ AnalyticAt ℂ g0 ρ' := by + intro hgA + + have h_subA : AnalyticAt ℂ (fun w : ℂ => w - c) (ρ' + c) := by + simpa using! (AnalyticAt.sub (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (ρ' + c)) + (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) (ρ' + c))) + have hgA_at : AnalyticAt ℂ g0 ((ρ' + c) - c) := by simpa using hgA + have hcomp := (AnalyticAt.comp (g := g0) (f := fun w => w - c) + (x := (ρ' + c)) hgA_at h_subA) + + have : AnalyticAt ℂ (fun w : ℂ => g0 (w - c)) (ρ' + c) := by simpa using! hcomp + have : AnalyticAt ℂ f (ρ' + c) := by + simpa [g0, hg0, sub_add_cancel] using this + exact hfA this + + simp [analyticOrderAt, hfA, hg_not] + + calc + analyticOrderAt (fun z => f (z + c) / f c) ρ' + = analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' := hconst_rewrite + _ = analyticOrderAt g0 ρ' := hconst + _ = analyticOrderAt f (ρ' + c) := htrans + +lemma DminusK (r1 : ℝ) (R1 : ℝ) (_hr1 : r1 > 0) (_hR1 : R1 > 0) (c : ℂ) (f : ℂ → ℂ) + (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) : + ∀ z : ℂ, z ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun w => f (w + c) / f c) ↔ + z + c ∈ closedBall c r1 \ zerosetKfRc R1 c f := by + intro z + constructor + · + intro ⟨hz_ball, hz_not_zero⟩ + constructor + · + have hdist : dist z (0 : ℂ) ≤ r1 := by simpa [mem_closedBall] using hz_ball + have hdist_c : dist (z + c) c ≤ r1 := by + simpa [Complex.dist_eq, add_sub_cancel] using hdist + simpa [mem_closedBall] using hdist_c + · + intro h_contra + apply hz_not_zero + + rcases h_contra with ⟨hz_c_ball, hz_c_zero⟩ + constructor + · + have hdist_c : dist (z + c) c ≤ R1 := by simpa [mem_closedBall] using hz_c_ball + have hdist_0 : dist z (0 : ℂ) ≤ R1 := by + simpa [Complex.dist_eq, add_sub_cancel] using hdist_c + simpa [mem_closedBall] using hdist_0 + · + have : f (z + c) = 0 := hz_c_zero + simp [this, zero_div] + · + intro ⟨hz_c_ball, hz_c_not_zero⟩ + constructor + · + have hdist_c : dist (z + c) c ≤ r1 := by simpa [mem_closedBall] using hz_c_ball + have hdist_0 : dist z (0 : ℂ) ≤ r1 := by + simpa [Complex.dist_eq, add_sub_cancel] using hdist_c + simpa [mem_closedBall] using hdist_0 + · + intro h_contra + apply hz_c_not_zero + + rcases h_contra with ⟨hz_ball, hz_zero⟩ + constructor + · + have hdist_0 : dist z (0 : ℂ) ≤ R1 := by simpa [mem_closedBall] using hz_ball + have hdist_c : dist (z + c) c ≤ R1 := by + simpa [Complex.dist_eq, add_sub_cancel] using hdist_0 + simpa [mem_closedBall] using hdist_c + · + have h_div_zero : f (z + c) / f c = 0 := hz_zero + have h_mul_zero : f (z + c) * (f c)⁻¹ = 0 := by simpa [div_eq_mul_inv] using h_div_zero + cases' mul_eq_zero.mp h_mul_zero with h_num h_inv + · exact h_num + · have : (f c)⁻¹ ≠ 0 := inv_ne_zero h_nonzero + exact (this h_inv).elim + +lemma shifted_zeros_correspondence (R1 : ℝ) (hR1 : R1 > 0) (c z : ℂ) + (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) + (hfin_orig : (zerosetKfRc R1 c f).Finite) + (hfin_shift : (zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c)).Finite) : + ∑ ρ ∈ hfin_orig.toFinset, ((analyticOrderAt f ρ).toNat : ℂ) / (z - ρ) = + ∑ ρ' ∈ hfin_shift.toFinset, ((analyticOrderAt (fun u => f (u + c) / f c) ρ').toNat : ℂ) / ((z - c) - ρ') := by + + have h_bij : (zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c)) = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := + fc_zeros R1 hR1 c f h_nonzero h_analytic + + apply Finset.sum_bij (fun ρ _ => ρ - c) + + · intro ρ hρ + simp only [Set.Finite.mem_toFinset] at hρ ⊢ + rw [h_bij] + use ρ, hρ + + · intro ρ₁ hρ₁ ρ₂ hρ₂ h_eq + + have : ρ₁ = ρ₁ - c + c := by ring + rw [this, h_eq] + ring + + · intro ρ' hρ' + simp only [Set.Finite.mem_toFinset] at hρ' + rw [h_bij] at hρ' + obtain ⟨ρ, hρ_mem, hρ_eq⟩ := hρ' + use ρ + simp only [Set.Finite.mem_toFinset] + exact ⟨hρ_mem, hρ_eq⟩ + + · intro ρ hρ + simp only [Set.Finite.mem_toFinset] at hρ + + have h_shift_mem : ρ - c ∈ zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c) := by + rw [h_bij] + use ρ, hρ + + have h_order := fc_m_order R1 hR1 c f h_nonzero h_analytic h_shift_mem + + have h_add : (ρ - c) + c = ρ := by ring + rw [h_add] at h_order + rw [← h_order] + + ring + +lemma final_ineq2 + (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) + (hR1_lt_R : R1 < R) (hR : R < 1) + (c : ℂ) (f : ℂ → ℂ) (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) + (h_bound : ∀ z ∈ closedBall c R, ‖f z‖ < B) + (hfin : (zerosetKfRc R1 (0 : ℂ) (fun z => f (z + c) / f c)).Finite) : + ∀ z ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun z => f (z + c) / f c), + ‖(deriv (fun z => f (z + c) / f c) z / (f (z + c) / f c)) - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt (fun w => f (w + c) / f c) ρ).toNat : ℂ) / (z - ρ)‖ ≤ (16 * r^2 / ((r - r1)^3) + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (B / ‖f c‖) := by + intro z hz + + let g : ℂ → ℂ := fun w => f (w + c) / f c + + have hR_pos : 0 < R := by linarith [hr1pos, hr1_lt_r, hr_lt_R1, hR1_lt_R] + have hR1_pos : 0 < R1 := by linarith [hr1pos, hr1_lt_r, hr_lt_R1] + have h_norm_pos : 0 < ‖f c‖ := norm_pos_iff.mpr h_nonzero + + have h_fc_bound_at_c : ‖f c‖ < B := by + apply h_bound + rw [mem_closedBall, dist_self] + exact le_of_lt hR_pos + + have h_B_div_gt_one : 1 < B / ‖f c‖ := by + rw [one_lt_div h_norm_pos] + exact h_fc_bound_at_c + + have h_g_analytic : ∀ w ∈ closedBall (0 : ℂ) 1, AnalyticAt ℂ g w := + (fc_analytic_normalized c f h_analytic h_nonzero).1 + + have h_g_zero : g 0 = 1 := + (fc_analytic_normalized c f h_analytic h_nonzero).2 + + have h_g_bound : ∀ w ∈ closedBall (0 : ℂ) R, ‖g w‖ ≤ B / ‖f c‖ := by + apply fc_bound B hB R hR_pos hR c f h_nonzero + intro w hw + exact le_of_lt (h_bound w hw) + + have h_zeroset_equiv : zerosetKfRc R1 (0 : ℂ) g = zerosetKfR R1 hR1_pos g := by + ext ρ + simp only [zerosetKfRc, zerosetKfR, mem_ofPred_eq, mem_closedBall, Complex.dist_eq, sub_zero] + + have h_g_finite : (zerosetKfR R1 hR1_pos g).Finite := by + rwa [← h_zeroset_equiv] + + have h_σ_exists : ∃ h_σ : ℂ → (ℂ → ℂ), ∀ σ ∈ zerosetKfR R1 hR1_pos g, + AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ + ∀ᶠ w in nhds σ, g w = (w - σ) ^ (analyticOrderAt g σ).toNat * h_σ σ w := by + + classical + let h_σ : ℂ → (ℂ → ℂ) := fun σ => + if hσ : σ ∈ zerosetKfR R1 hR1_pos g + then Classical.choose (lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR g h_g_analytic + (by simp [g]; exact h_nonzero) σ hσ) + else fun _ => 0 + use h_σ + intro σ hσ + simp only [h_σ, dite_eq_left hσ] + exact Classical.choose_spec (lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR g h_g_analytic + (by simp [g]; exact h_nonzero) σ hσ) + + obtain ⟨h_σ, h_σ_spec⟩ := h_σ_exists + + have := final_ineq1 (B / ‖f c‖) h_B_div_gt_one r1 r R R1 hr1pos hr1_lt_r hr_lt_R1 hR1_lt_R hR + g h_g_analytic h_g_zero h_g_finite h_σ_spec h_g_bound z + + have hz_domain : z ∈ closedBall (0 : ℂ) r1 \ zerosetKfR R1 hR1_pos g := by + rw [h_zeroset_equiv] at hz + exact hz + + exact this hz_domain + +lemma log_Deriv_Expansion_Zeta (t : ℝ) (ht : |t| > 2) + (r1 r R1 R : ℝ) + (hr1_pos : 0 < r1) (hr1_lt_r : r1 < r) + (_hr_pos : 0 < r) (hr_lt_R1 : r < R1) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) : + let c := (3/2 : ℂ) + I * t + ∀ B > 1, (∀ z ∈ closedBall c R, ‖riemannZeta z‖ < B) → + ∀ (hfin : (zerosetKfRc R1 c riemannZeta).Finite), + ∀ z ∈ closedBall c r1 \ zerosetKfRc R1 c riemannZeta, + ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ (16 * r^2 / ((r - r1)^3) + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (B / ‖riemannZeta c‖) := by + intro c B hB h_bound hfin z hzmem + + have ht1 : |t| > 1 := lt_trans (by norm_num : (1 : ℝ) < 2) (by simpa using ht) + + have hζ_analytic : AnalyticOnNhd ℂ riemannZeta (closedBall c 1) := by + simpa [c] using zetaanalOnD1c t ht1 + have hζ_c_ne : riemannZeta c ≠ 0 := by simpa [c] using zetacnot0 t + + have hfin_shift : (zerosetKfRc R1 (0 : ℂ) (fun u => riemannZeta (u + c) / riemannZeta c)).Finite := by + have h_bij := fc_zeros R1 hR1_pos c riemannZeta hζ_c_ne hζ_analytic + have himg : ((fun ρ => ρ - c) '' (zerosetKfRc R1 c riemannZeta)).Finite := hfin.image _ + simpa [h_bij] using himg + + have hz0mem : (z - c) ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun u => riemannZeta (u + c) / riemannZeta c) := by + have hiff := DminusK r1 R1 hr1_pos hR1_pos c riemannZeta hζ_analytic hζ_c_ne (z - c) + exact (hiff).mpr (by simpa [sub_add_cancel] using hzmem) + + have hineq0 := + (final_ineq2 B hB r1 r R R1 hr1_pos hr1_lt_r hr_lt_R1 hR1_lt_R hR_lt_1 c riemannZeta + hζ_analytic hζ_c_ne h_bound hfin_shift) (z - c) hz0mem + + rcases hzmem with ⟨hz_ball, hz_notin⟩ + have hr1_lt_R1' : r1 < R1 := lt_trans hr1_lt_r hr_lt_R1 + have hz_in_ball_R1 : z ∈ closedBall c R1 := by + have hz_le_r1 : dist z c ≤ r1 := by simpa [mem_closedBall] using hz_ball + have hr1_le_R1 : r1 ≤ R1 := le_of_lt hr1_lt_R1' + have hz_le_R1 : dist z c ≤ R1 := le_trans hz_le_r1 hr1_le_R1 + simpa [mem_closedBall] using hz_le_R1 + have hzeta_ne : riemannZeta z ≠ 0 := by + intro hz0 + exact hz_notin ⟨hz_in_ball_R1, hz0⟩ + + have hcancel_frac : (deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta c) + / (riemannZeta z / riemannZeta c) + = deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta z := by + have hc : riemannZeta c ≠ 0 := hζ_c_ne + have hy : riemannZeta z ≠ 0 := hzeta_ne + simpa using (frac_cancel_const (x := deriv (fun x => riemannZeta (x + c)) (z - c)) + (y := riemannZeta z) (c := riemannZeta c) hc hy) + have hcancel_all : (deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta c) + / (riemannZeta z / riemannZeta c) + = deriv riemannZeta z / riemannZeta z := by + simpa [deriv_comp_add_const, sub_add_cancel] using hcancel_frac + + have hineq1 : ‖(deriv riemannZeta z / riemannZeta z) + - ∑ ρ ∈ hfin_shift.toFinset, + ((analyticOrderAt (fun u => riemannZeta (u + c) / riemannZeta c) ρ).toNat : ℂ) + / ((z - c) - ρ)‖ + ≤ (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * + Real.log (B / ‖riemannZeta c‖) := by + simpa [hcancel_all] using hineq0 + + have hsum_eq := shifted_zeros_correspondence R1 hR1_pos c z riemannZeta hζ_c_ne hζ_analytic hfin hfin_shift + + have hineq2 : ‖(deriv riemannZeta z / riemannZeta z) + - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ + ≤ (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * + Real.log (B / ‖riemannZeta c‖) := by + simpa [hsum_eq] using hineq1 + + simpa [logDerivZeta] using hineq2 + +lemma zeta32lower : ∃ a > 0, ∀ t : ℝ, ‖riemannZeta (3/2 + I * t)‖ ≥ a := by + rcases zeta_low_332 with ⟨a, ha_pos, hbound⟩ + refine ⟨a, ha_pos, ?_⟩ + intro t + simpa [mul_comm] using! (hbound t) + +lemma zeta32lower_log : ∃ A > 1, ∀ t : ℝ, + Real.log (1 / ‖riemannZeta (3/2 + I * t)‖) ≤ A := by + obtain ⟨a, ha_pos, hbound⟩ := zeta32lower + refine ⟨max (2 : ℝ) (Real.log (1 / a)), ?_, ?_⟩ + · have h1 : (1 : ℝ) < 2 := by norm_num + have h2 : (2 : ℝ) ≤ max (2 : ℝ) (Real.log (1 / a)) := by exact le_max_left _ _ + exact lt_of_lt_of_le h1 h2 + · intro t + set x := ‖riemannZeta (3/2 + I * t)‖ with hx + have hax : a ≤ x := by + simpa [hx] using (hbound t) + have hxpos : 0 < x := lt_of_lt_of_le ha_pos hax + have hxy : 1 / x ≤ 1 / a := by + + have := one_div_le_one_div_of_le ha_pos hax + + simpa [hx] using this + have hxpos' : 0 < 1 / x := one_div_pos.mpr hxpos + have hlog : Real.log (1 / x) ≤ Real.log (1 / a) := + Real.log_le_log hxpos' hxy + have : Real.log (1 / x) ≤ max (2 : ℝ) (Real.log (1 / a)) := + le_trans hlog (le_max_right _ _) + simpa [hx] using this + +lemma zeta32upper_pre : ∃ b > 1, ∀ t : ℝ, ∀ s : ℂ, ‖s‖ ≤ 1 → (2 : ℝ) < |t| → ‖riemannZeta (s + 3/2 + Complex.I * t)‖ < b * |t| := by + refine ⟨(12 : ℝ), by norm_num, ?_⟩ + intro t s hs ht + have hlt : ‖riemannZeta (s + 3/2 + Complex.I * t)‖ < (10 : ℝ) + 2 * |t| := by + simpa using! (lem_zetaUppBound t s hs ht) + have honele : (1 : ℝ) ≤ |t| := by + have : (1 : ℝ) < |t| := lt_trans (by norm_num) ht + exact le_of_lt this + have h10le : (10 : ℝ) ≤ 10 * |t| := by + simpa [mul_comm] using + (mul_le_mul_of_nonneg_right honele (by norm_num : (0 : ℝ) ≤ (10 : ℝ))) + have hle2 : (10 : ℝ) + 2 * |t| ≤ (12 : ℝ) * |t| := by + have htmp := add_le_add_left h10le (2 * |t|) + have hcalc : 10 * |t| + 2 * |t| = (12 : ℝ) * |t| := by ring + simpa [hcalc] using! htmp + exact lt_of_lt_of_le hlt hle2 + +lemma zeta32upper : ∃ b > 1, ∀ t : ℝ, |t| > 2 → + let c := (3/2 : ℂ) + I * t + ∀ s ∈ closedBall c 1, ‖riemannZeta s‖ < b * |t| := by + + obtain ⟨b, hb_gt, hbound⟩ := zeta32upper_pre + refine ⟨b, hb_gt, ?_⟩ + intro t ht c s hs + + rw [mem_closedBall] at hs + + set s_pre := s - c with hs_pre_def + have hs_pre_bound : ‖s_pre‖ ≤ 1 := by + rw [hs_pre_def] + rwa [Complex.dist_eq] at hs + + have hs_eq : s = s_pre + 3/2 + I * t := by + rw [hs_pre_def] + ring + + rw [hs_eq] + exact hbound t s_pre hs_pre_bound ht + +lemma closedBall_subset_unit (c : ℂ) (R : ℝ) (hR_lt_1 : R < 1) : + Metric.closedBall c R ⊆ Metric.closedBall c 1 := by + apply Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) + +lemma zeta_c_nonzero (t : ℝ) : riemannZeta (3/2 + I * t) ≠ 0 := by + exact zetacnot0 t + +lemma zeta_c_norm_pos (t : ℝ) : 0 < ‖riemannZeta (3/2 + I * t)‖ := by + have h := zetacnot0 t + exact norm_pos_iff.mpr h + +lemma Zeta1_Zeta_Expand : + ∃ A > 1, ∃ b > 1, + ∀ (t : ℝ) (_ht : |t| > 2) + (r1 r R1 R : ℝ) + (_hr1_pos : 0 < r1) (_hr1_lt_r : r1 < r) + (_hr_pos : 0 < r) (_hr_lt_R1 : r < R1) (_hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1), + let c := (3/2 : ℂ) + I * t; + ∀ (hfin : (zerosetKfRc R1 c riemannZeta).Finite), + ∀ z ∈ closedBall c r1 \ zerosetKfRc R1 c riemannZeta, + ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ + (16 * r^2 / ((r - r1)^3) + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * (Real.log |t| + Real.log b + A) := by + + obtain ⟨b, hbgt1, hb⟩ := zeta32upper + obtain ⟨A, hAgt1, hA⟩ := zeta32lower_log + + refine ⟨A, hAgt1, b, hbgt1, ?_⟩ + intro t ht r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 c hfin z hz + + have hexp_lemma := log_Deriv_Expansion_Zeta t ht r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 + + have htpos : (0 : ℝ) < |t| := by linarith [ht] + have hBgt1 : b * |t| > 1 := by + have hb_pos : (0 : ℝ) < b := by linarith [hbgt1] + calc (1 : ℝ) < 1 * 2 := by norm_num + _ < b * 2 := mul_lt_mul_of_pos_right (by linarith [hbgt1]) (by norm_num) + _ < b * |t| := mul_lt_mul_of_pos_left ht hb_pos + + have hbound_ball : ∀ s ∈ closedBall (3/2 + I * t) R, ‖riemannZeta s‖ < b * |t| := by + have hsubset : closedBall (3/2 + I * t) R ⊆ closedBall (3/2 + I * t) 1 := + Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) + intro s hs + have hs1 : s ∈ closedBall (3/2 + I * t) 1 := hsubset hs + have ht2 : |t| > 2 := by linarith [ht] + specialize hb t ht2 + exact hb s hs1 + + have hexp := hexp_lemma (b * |t|) hBgt1 hbound_ball hfin z hz + + have hζne : riemannZeta (3/2 + I * t) ≠ 0 := zetacnot0 t + have hζpos : (0 : ℝ) < ‖riemannZeta (3/2 + I * t)‖ := norm_pos_iff.mpr hζne + + have hBpos : (0 : ℝ) < b * |t| := mul_pos (by linarith [hbgt1]) htpos + have hBne : b * |t| ≠ 0 := ne_of_gt hBpos + have htne : |t| ≠ 0 := ne_of_gt htpos + have hbne : b ≠ 0 := ne_of_gt (by linarith [hbgt1]) + + have hlog_bound : Real.log (b * |t| / ‖riemannZeta (3/2 + I * t)‖) ≤ + Real.log |t| + Real.log b + A := by + rw [Real.log_div hBne (ne_of_gt hζpos)] + rw [Real.log_mul hbne htne] + + have hA_bound := hA t + have : -Real.log ‖riemannZeta (3/2 + I * t)‖ ≤ A := by + have eq_neg : Real.log (1 / ‖riemannZeta (3/2 + I * t)‖) = -Real.log ‖riemannZeta (3/2 + I * t)‖ := by + rw [Real.log_div (by norm_num) (ne_of_gt hζpos)] + simp + rw [← eq_neg] + exact hA_bound + linarith + + have hcoeff_nonneg : (0 : ℝ) ≤ 16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) := by + apply add_nonneg + · apply div_nonneg + · apply mul_nonneg + · norm_num + · apply sq_nonneg + · apply le_of_lt + apply pow_pos + linarith [hr1_lt_r] + · apply div_nonneg + · norm_num + · apply le_of_lt + apply mul_pos + · + have h_gt : R > R1 := hR1_lt_R + have h1_pos : (1 : ℝ) < R/R1 := by + rw [one_lt_div] + · exact h_gt + · exact hR1_pos + have h_sq_div : R^2/R1 = R * (R/R1) := by + field_simp [ne_of_gt hR1_pos] + rw [h_sq_div] + have h_r_pos : (0 : ℝ) < R := by linarith [hR1_pos, h_gt] + have : R * (R/R1) > R * 1 := by + apply mul_lt_mul_of_pos_left h1_pos h_r_pos + simp at this + linarith [this] + · apply Real.log_pos + rw [one_lt_div] + · exact hR1_lt_R + · exact hR1_pos + + calc ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ + ≤ (16 * r^2 / ((r - r1)^3) + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (b * |t| / ‖riemannZeta (3/2 + I * t)‖) := hexp + _ ≤ (16 * r^2 / ((r - r1)^3) + + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * (Real.log |t| + Real.log b + A) := by + exact mul_le_mul_of_nonneg_left hlog_bound hcoeff_nonneg + +lemma helper_log_ratio_le_sum (b t x A : ℝ) + (hb : b > 1) (ht : 0 < |t|) (hx : 0 < x) (hA : Real.log (1 / x) ≤ A) : + Real.log ((b * |t|) / x) ≤ Real.log |t| + Real.log b + A := by + have hbpos : 0 < b := lt_trans (by norm_num) hb + have hb_ne : (b : ℝ) ≠ 0 := ne_of_gt hbpos + have ht_ne : |t| ≠ 0 := ne_of_gt ht + have hx_ne : x ≠ 0 := ne_of_gt hx + have h_inv_ne : (1 / x) ≠ 0 := one_div_ne_zero hx_ne + calc + Real.log ((b * |t|) / x) + = Real.log ((b * |t|) * (1 / x)) := by simp [div_eq_mul_inv] + _ = Real.log (b * |t|) + Real.log (1 / x) := by + exact Real.log_mul (mul_ne_zero hb_ne ht_ne) h_inv_ne + _ ≤ Real.log (b * |t|) + A := by + exact add_le_add_right hA (Real.log (b * |t|)) + _ = Real.log b + Real.log |t| + A := by + have hmul : Real.log (b * |t|) = Real.log b + Real.log |t| := + Real.log_mul hb_ne ht_ne + simp [hmul, add_comm] + _ = Real.log |t| + Real.log b + A := by + simp [add_comm] + +lemma helper_bound_sum_by_Klog (t b A : ℝ) + (ht : |t| > 3) (hb : b > 1) (hA : A > 1) : + ∃ K > 1, Real.log |t| + Real.log b + A ≤ K * Real.log (|t| + 2) := by + + let S := Real.log b + A + let K := 1 + S / Real.log 5 + have hpos_t : 0 < |t| := lt_trans (by norm_num) ht + + have hle_log : Real.log |t| ≤ Real.log (|t| + 2) := by + apply Real.log_le_log + · exact hpos_t + · have hxle : |t| ≤ |t| + 2 := by + have h2 : (0 : ℝ) ≤ 2 := by norm_num + linarith + exact hxle + + have log5pos : 0 < Real.log (5 : ℝ) := by + have : (1 : ℝ) < 5 := by norm_num + exact Real.log_pos this + have Spos : 0 < S := by + have hlogbpos : 0 < Real.log b := Real.log_pos hb + have hApos : 0 < A := lt_trans (by norm_num) hA + exact add_pos hlogbpos hApos + have Kgt1 : 1 < K := by + have : 0 < S / Real.log 5 := div_pos Spos log5pos + simpa [K] using (lt_add_of_pos_right (1 : ℝ) this) + + have hlog5_le : Real.log 5 ≤ Real.log (|t| + 2) := by + apply Real.log_le_log + · exact (by norm_num : 0 < (5 : ℝ)) + · have : (5 : ℝ) < |t| + 2 := by linarith [ht] + exact le_of_lt this + have hfac_nonneg : 0 ≤ S / Real.log 5 := le_of_lt (div_pos Spos log5pos) + have hmul : (S / Real.log 5) * Real.log 5 ≤ (S / Real.log 5) * Real.log (|t| + 2) := + mul_le_mul_of_nonneg_left hlog5_le hfac_nonneg + have hleft : (S / Real.log 5) * Real.log 5 = S := by + have hne : (Real.log 5) ≠ 0 := ne_of_gt log5pos + field_simp [hne] + have hS_le : S ≤ (S / Real.log 5) * Real.log (|t| + 2) := by + simp [hleft] at hmul + exact hmul + + refine ⟨K, Kgt1, ?_⟩ + calc + Real.log |t| + Real.log b + A + = Real.log |t| + S := by + simp [S, add_comm, add_left_comm] + _ + ≤ Real.log (|t| + 2) + S := by + exact add_le_add_left hle_log S + _ + ≤ Real.log (|t| + 2) + (S / Real.log 5) * Real.log (|t| + 2) := by + exact add_le_add_right hS_le (Real.log (|t| + 2)) + _ = (1 + S / Real.log 5) * Real.log (|t| + 2) := by + ring + _ = K * Real.log (|t| + 2) := by rfl + _ = K * Real.log (|t| + 2) := by rfl + +lemma Zeta1_Zeta_Expansion + (r1 r : ℝ) + (hr1_pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < 5 / (6 : ℝ)) : + ∃ C > 1, + ∀ (t : ℝ) (_ht : |t| > 3), + let c := (3/2 : ℂ) + I * t; + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + ∀ z ∈ closedBall c r1 \ zerosetKfRc (5 / (6 : ℝ)) c riemannZeta, + ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ + C * (1 / (r - r1)^3 + 1) * Real.log |t| := by + + obtain ⟨A, hAgt1, b, hbgt1, hmain⟩ := Zeta1_Zeta_Expand + + let R1 : ℝ := 5 / 6 + let R : ℝ := 8 / 9 + have hR1_pos : 0 < R1 := by norm_num [R1] + have hR1_lt_R : R1 < R := by norm_num [R1, R] + have hR_lt_1 : R < 1 := by norm_num [R] + have hr_pos : 0 < r := lt_trans hr1_pos hr1_lt_r + + let d : ℝ := (r - r1) ^ 3 + have hd_pos : 0 < d := by + have : 0 < r - r1 := sub_pos.mpr hr1_lt_r + simpa [d] using pow_pos this 3 + let A0 : ℝ := 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) + have hA0_pos : 0 < A0 := by + have hx1 : 0 < R^2 / R1 - R1 := by + + norm_num [R, R1] + have hx2 : 0 < Real.log (R / R1) := by + + have : (1 : ℝ) < R / R1 := by norm_num [R, R1] + exact Real.log_pos this + have hxden : 0 < (R^2 / R1 - R1) * Real.log (R / R1) := mul_pos hx1 hx2 + simpa [A0] using (one_div_pos.mpr hxden) + + let K : ℝ := 16 * r^2 / d + A0 + + let S : ℝ := Real.log b + A + have hS_pos : 0 < S := by + have hbpos : 0 < Real.log b := Real.log_pos hbgt1 + have hApos : 0 < A := lt_trans (by norm_num) hAgt1 + exact add_pos hbpos hApos + + let Kcoeff : ℝ := max (16 * r^2) A0 + have hK_le : K ≤ Kcoeff * (1 / d + 1) := by + have hx_nonneg : 0 ≤ 1 / d := by + exact le_of_lt (one_div_pos.mpr hd_pos) + have hα_le : 16 * r^2 / d ≤ Kcoeff * (1 / d) := by + have hα : 16 * r^2 ≤ Kcoeff := le_max_left _ _ + have : (16 * r^2) * (1 / d) ≤ Kcoeff * (1 / d) := + mul_le_mul_of_nonneg_right hα hx_nonneg + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this + have hβ_le : A0 ≤ Kcoeff * 1 := by + have hβ : A0 ≤ Kcoeff := le_max_right _ _ + simpa using hβ + have : 16 * r^2 / d + A0 ≤ Kcoeff * (1 / d) + Kcoeff * 1 := + add_le_add hα_le hβ_le + simpa [K, mul_add, mul_one, add_comm, add_left_comm, add_assoc] using this + + let C : ℝ := max (Kcoeff * (1 + S / Real.log 3)) 2 + have hC_gt1 : 1 < C := by + have : (1 : ℝ) < 2 := by norm_num + exact lt_of_lt_of_le this (le_max_right _ _) + refine ⟨C, hC_gt1, ?_⟩ + + intro t ht + + simp only + intro hfin z hz + + have ht2 : |t| > 2 := by linarith [ht] + have hineq0 := + hmain t ht2 r1 r R1 R hr1_pos hr1_lt_r (lt_trans hr1_pos hr1_lt_r) hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 + have hineq1 := hineq0 hfin z hz + + have hK_eq : (16 * r^2 / (r - r1)^3 + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) = K := by + simp [K, A0, d, R1, R] + have hLS_eq : Real.log |t| + Real.log b + A = Real.log |t| + S := by + simp [S, add_comm, add_assoc] + have hineq2 : ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ + ≤ K * (Real.log |t| + S) := by + rw [← hK_eq, ← hLS_eq] + exact hineq1 + + have hlog3pos : 0 < Real.log (3 : ℝ) := by + have : (1 : ℝ) < 3 := by norm_num + exact Real.log_pos this + + have hpos_t : 0 < |t| := lt_trans (by norm_num) ht + have hL_ge_log3' : Real.log 3 ≤ Real.log |t| := by + have hge : (3 : ℝ) ≤ |t| := le_of_lt ht + exact Real.log_le_log (by norm_num) hge + have hratio_nonneg : 0 ≤ S / Real.log 3 := le_of_lt (div_pos hS_pos hlog3pos) + have hneq : Real.log 3 ≠ 0 := ne_of_gt hlog3pos + + have hS_le : S ≤ (S / Real.log 3) * Real.log |t| := by + + calc S + = (S / Real.log 3) * Real.log 3 := by simp [hneq] + _ ≤ (S / Real.log 3) * Real.log |t| := mul_le_mul_of_nonneg_left hL_ge_log3' hratio_nonneg + + have hsum_bound : Real.log |t| + S ≤ (1 + S / Real.log 3) * Real.log |t| := by + have hstep : Real.log |t| + S ≤ Real.log |t| + (S / Real.log 3) * Real.log |t| := + add_le_add_right hS_le (Real.log |t|) + + have h_factor : Real.log |t| + (S / Real.log 3) * Real.log |t| = (1 + S / Real.log 3) * Real.log |t| := by ring + rw [← h_factor] + exact hstep + + have hineq3 : ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ + ≤ K * ((1 + S / Real.log 3) * Real.log |t|) := + le_trans hineq2 (mul_le_mul_of_nonneg_left hsum_bound (by + have hr2_nonneg : 0 ≤ r^2 := by + have : 0 ≤ r * r := mul_nonneg (le_of_lt hr_pos) (le_of_lt hr_pos) + simpa [pow_two] using this + have hterm1 : 0 ≤ 16 * r^2 / d := + div_nonneg (mul_nonneg (by norm_num) hr2_nonneg) (le_of_lt hd_pos) + have : 0 ≤ K := add_nonneg hterm1 (le_of_lt hA0_pos) + exact this)) + + have hKcoeff : K * ((1 + S / Real.log 3) * Real.log |t|) + ≤ (Kcoeff * (1 / d + 1)) * ((1 + S / Real.log 3) * Real.log |t|) := + mul_le_mul_of_nonneg_right hK_le (by + have hLpos : 0 < Real.log |t| := + Real.log_pos (lt_trans (by norm_num) ht) + have hcoef_pos : 0 < 1 + S / Real.log 3 := + add_pos_of_pos_of_nonneg (by norm_num) (le_of_lt (div_pos hS_pos hlog3pos)) + have : 0 ≤ (1 + S / Real.log 3) * Real.log |t| := + le_of_lt (mul_pos hcoef_pos hLpos) + simpa using this) + + have hfinal := le_trans hineq3 hKcoeff + + have hC_ge : Kcoeff * (1 + S / Real.log 3) ≤ C := by + exact le_max_left _ _ + + have : (Kcoeff * (1 / d + 1)) * ((1 + S / Real.log 3) * Real.log |t|) + ≤ C * (1 / d + 1) * Real.log |t| := by + have hnonneg_term : 0 ≤ (1 / d + 1) * Real.log |t| := by + have h1 : 0 ≤ 1 / d := le_of_lt (one_div_pos.mpr hd_pos) + have h2 : 0 ≤ Real.log |t| := le_of_lt (Real.log_pos (lt_trans (by norm_num) ht)) + have : 0 ≤ (1 / d + 1) := add_nonneg h1 (by norm_num) + exact mul_nonneg this h2 + have hstep := mul_le_mul_of_nonneg_left hC_ge hnonneg_term + + simpa [mul_comm, mul_left_comm, mul_assoc] using hstep + + have hfinal_le := le_trans hfinal this + simp only [d] at hfinal_le + exact hfinal_le + +end Erdos970 diff --git a/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean b/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean new file mode 100644 index 0000000..37dfc62 --- /dev/null +++ b/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean @@ -0,0 +1,6165 @@ +import StrongPNT.Erdos970.PNT3_RiemannZeta +import StrongPNT.Erdos970.Z0 + +namespace Erdos970 + + +def zeroZ : Set ℂ := {s : ℂ | riemannZeta s = 0} + +def ZetaZerosNearPoint (t : ℝ) : Set ℂ := { ρ : ℂ | ρ ∈ zeroZ ∧ ‖ρ - ((3/2 : ℂ) + t * Complex.I)‖ ≤ (5/6 : ℝ) } + +lemma ZetaZerosNearPoint_finite (t : ℝ) : Set.Finite (ZetaZerosNearPoint t) := by + + let c : ℂ := (3/2 : ℂ) + t * Complex.I + let R : ℝ := (5/6 : ℝ) + have hRpos : 0 < R := by norm_num + + let H : ℂ → ℂ := Function.update (fun s : ℂ => (s - 1) * riemannZeta s) 1 1 + have hH_diff : Differentiable ℂ H := by + + intro s + rcases eq_or_ne s 1 with rfl | hs + · + refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt + · + filter_upwards [self_mem_nhdsWithin] with t ht + + have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) t := by + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := + (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta t := + (differentiableAt_riemannZeta ht) + exact h1.mul h2 + apply DifferentiableAt.congr_of_eventuallyEq hdiff + filter_upwards [eventually_ne_nhds ht] with u hu using by + simp [H, Function.update_of_ne hu] + · + simpa [H, continuousAt_update_same] using riemannZeta_residue_one + · + have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) s := by + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) s := + (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta s := + (differentiableAt_riemannZeta hs) + exact h1.mul h2 + apply DifferentiableAt.congr_of_eventuallyEq hdiff + filter_upwards [eventually_ne_nhds hs] with u hu using by + simp [H, Function.update_of_ne hu] + + by_cases hPoleIn : ‖1 - c‖ ≤ R + · + let g : ℂ → ℂ := fun z => H (z + c) + + have hzeta_c_ne : riemannZeta c ≠ 0 := by + + have : c.re = (3/2 : ℝ) := by + simp [c, Complex.add_re, Complex.mul_re, Complex.I_re] + have hgt : c.re > 1 := by simpa [this] using (by norm_num : (3:ℝ)/2 > 1) + + exact riemannZeta_ne_zero_of_one_le_re (by + + have : (1 : ℝ) < c.re := hgt + exact le_of_lt this) + have hg_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) R, g z ≠ 0 := by + + have h0in : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by + simpa [Metric.mem_ball, Complex.dist_eq] using hRpos + refine ⟨0, h0in, ?_⟩ + + have hcne1 : c ≠ (1 : ℂ) := by + intro hc; have hcreq : c.re = 1 := by simp [hc, Complex.one_re] + have : (3 : ℝ) / 2 = (1 : ℝ) := by + simpa [c, Complex.add_re, Complex.mul_re, Complex.I_re] using hcreq + norm_num at this + have hHc : g 0 = H c := by simp [g] + have : g 0 = (c - 1) * riemannZeta c := by + simpa [H, Function.update_of_ne hcne1] using hHc + simpa [this] using mul_ne_zero (sub_ne_zero.mpr (by + + exact hcne1)) hzeta_c_ne + + let Kg : Set ℂ := {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ g ρ = 0} + + have h_subset : ZetaZerosNearPoint t ⊆ {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by + intro ρ hρ + rcases hρ with ⟨hzero, hdist⟩ + + have hball : ρ - c ∈ Metric.closedBall 0 R := by + simpa [Metric.mem_closedBall, Complex.dist_eq, c, sub_eq_add_neg] using hdist + + have hρne1 : (ρ : ℂ) ≠ 1 := by + intro hρ1 + + have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) + exact hz1_ne (by simpa [hρ1] using! hzero) + have hsum : (ρ - c) + c = ρ := by simp [sub_add_cancel] + have hxne : (ρ - c) + c ≠ (1 : ℂ) := by simpa [hsum] using hρne1 + have hform : g (ρ - c) = (ρ - 1) * riemannZeta ρ := by + simp [g, H, hsum, Function.update_of_ne hxne] + have hzeroζ : riemannZeta ρ = 0 := hzero + have hzero' : g (ρ - c) = 0 := by simp [hform, hzeroζ] + exact ⟨hball, hzero'⟩ + + have hg_diff : Differentiable ℂ g := by + intro z + have hH := hH_diff (z + c) + have h_addc : DifferentiableAt ℂ (fun z : ℂ => z + c) z := + (differentiableAt_id.add_const c) + simpa [g] using! hH.comp z h_addc + have hg_analyticNhd_univ : AnalyticOnNhd ℂ g Set.univ := + (Complex.analyticOnNhd_univ_iff_differentiable).2 hg_diff + have hg_analyticNhd : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := + AnalyticOnNhd.mono hg_analyticNhd_univ (by intro z hz; simp) + have hNonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, g z ≠ 0 := by + rcases hg_nonzero with ⟨z, hz_in, hz_ne⟩ + + have hz_in' : z ∈ Metric.ball (0 : ℂ) 1 := by + have hRle : (R : ℝ) ≤ 1 := by norm_num + exact Metric.ball_subset_ball hRle hz_in + exact ⟨z, hz_in', hz_ne⟩ + have hfiniteKg : Set.Finite Kg := + (lem_Contra_finiteKR R hRpos (by norm_num : R < 1) g hg_analyticNhd hNonzero) + + have hTarget_eq : {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} = + (fun ρ : ℂ => ρ + c) '' Kg := by + ext ρ; constructor + · intro h + rcases h with ⟨hball, hzero⟩ + refine ⟨ρ - c, ⟨?_, ?_⟩, ?_⟩ + · exact hball + · exact hzero + · simp [sub_add_cancel] + · intro h + rcases h with ⟨z, ⟨hzball, hz0⟩, rfl⟩ + constructor + · simpa [sub_add_cancel] using hzball + · simpa [sub_add_cancel] using hz0 + + have hTarget_fin : Set.Finite {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by + have himg : Set.Finite ((fun ρ : ℂ => ρ + c) '' Kg) := hfiniteKg.image _ + + exact hTarget_eq ▸ himg + exact Set.Finite.subset hTarget_fin h_subset + · + let g : ℂ → ℂ := fun z => H (z + c) + + have hzeta_c_ne : riemannZeta c ≠ 0 := by + have : c.re = (3/2 : ℝ) := by + simp [c, Complex.add_re, Complex.mul_re, Complex.I_re] + have hgt : c.re > 1 := by simpa [this] using (by norm_num : (3:ℝ)/2 > 1) + exact riemannZeta_ne_zero_of_one_le_re (le_of_lt hgt) + have hg_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) R, g z ≠ 0 := by + have h0in : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by + simpa [Metric.mem_ball, Complex.dist_eq] using hRpos + refine ⟨0, h0in, ?_⟩ + have hcne1 : c ≠ (1 : ℂ) := by + intro hc; have hcreq : c.re = 1 := by simp [hc, Complex.one_re] + have : (3 : ℝ) / 2 = (1 : ℝ) := by + simpa [c, Complex.add_re, Complex.mul_re, Complex.I_re] using hcreq + norm_num at this + + have hHc : g 0 = H c := by simp [g] + have : g 0 = (c - 1) * riemannZeta c := by + simpa [H, Function.update_of_ne hcne1] using hHc + simpa [this] using mul_ne_zero (sub_ne_zero.mpr hcne1) hzeta_c_ne + + let Kg : Set ℂ := {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ g ρ = 0} + + have h_subset : ZetaZerosNearPoint t ⊆ {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by + intro ρ hρ + rcases hρ with ⟨hzero, hdist⟩ + have hball : ρ - c ∈ Metric.closedBall 0 R := by + simpa [Metric.mem_closedBall, Complex.dist_eq, c, sub_eq_add_neg] using hdist + have hρne1 : (ρ : ℂ) ≠ 1 := by + intro hρ1 + have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) + exact hz1_ne (by simpa [hρ1] using! hzero) + have hsum : (ρ - c) + c = ρ := by simp [sub_add_cancel] + have hxne : (ρ - c) + c ≠ (1 : ℂ) := by simpa [hsum] using hρne1 + have hform : g (ρ - c) = (ρ - 1) * riemannZeta ρ := by + simp [g, H, hsum, Function.update_of_ne hxne] + + have hzeroζ : riemannZeta ρ = 0 := hzero + have hzero' : g (ρ - c) = 0 := by + calc + g (ρ - c) = (ρ - 1) * riemannZeta ρ := hform + _ = (ρ - 1) * 0 := by simp [hzeroζ] + _ = 0 := by simp + exact ⟨hball, hzero'⟩ + + have hg_diff : Differentiable ℂ g := by + intro z + have hH := hH_diff (z + c) + have h_addc : DifferentiableAt ℂ (fun z : ℂ => z + c) z := + (differentiableAt_id.add_const c) + simpa [g] using! hH.comp z h_addc + have hg_analyticNhd_univ : AnalyticOnNhd ℂ g Set.univ := + (Complex.analyticOnNhd_univ_iff_differentiable).2 hg_diff + have hg_analyticNhd : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := + AnalyticOnNhd.mono hg_analyticNhd_univ (by intro z hz; simp) + have hNonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, g z ≠ 0 := by + rcases hg_nonzero with ⟨z, hz_in, hz_ne⟩ + have hz_in' : z ∈ Metric.ball (0 : ℂ) 1 := by + have hRle : (R : ℝ) ≤ 1 := by norm_num + exact Metric.ball_subset_ball hRle hz_in + exact ⟨z, hz_in', hz_ne⟩ + have hfiniteKg : Set.Finite Kg := + (lem_Contra_finiteKR R hRpos (by norm_num : R < 1) g hg_analyticNhd hNonzero) + have hTarget_eq : {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} = + (fun ρ : ℂ => ρ + c) '' Kg := by + ext ρ; constructor + · intro h + rcases h with ⟨hball, hzero⟩ + refine ⟨ρ - c, ⟨?_, ?_⟩, ?_⟩ + · exact hball + · exact hzero + · simp [sub_add_cancel] + · intro h + rcases h with ⟨z, ⟨hzball, hz0⟩, rfl⟩ + constructor + · simpa [sub_add_cancel] using hzball + · simpa [sub_add_cancel] using hz0 + have hTarget_fin : Set.Finite {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by + have himg : Set.Finite ((fun ρ : ℂ => ρ + c) '' Kg) := hfiniteKg.image _ + exact hTarget_eq ▸ himg + exact Set.Finite.subset hTarget_fin h_subset + +lemma lem_Re1zge0 (z : ℂ) : z.re > 0 → (1 / z).re > 0 := by + intro h + + have hz_ne_zero : z ≠ 0 := by + intro hz_eq_zero + rw [hz_eq_zero] at h + simp at h + + rw [one_div] + + rw [Complex.inv_re] + + apply div_pos h + + rwa [Complex.normSq_pos] + +lemma lem_sigmage1 (sigma t : ℝ) (hsigma : sigma > 1) : riemannZeta (sigma + t * Complex.I) ≠ 0 := by + apply riemannZeta_ne_zero_of_one_le_re + simp [Complex.add_re, Complex.mul_re, Complex.I_re] + linarith + +lemma lem_sigmale1 (sigma1 t1 : ℝ) : riemannZeta (sigma1 + t1 * Complex.I) = 0 → sigma1 ≤ 1 := by + intro h + + by_contra h_not_le + + push Not at h_not_le + + have h_nonzero := lem_sigmage1 sigma1 t1 h_not_le + + exact h_nonzero h + +lemma lem_sigmale1Zt (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : rho1.re ≤ 1 := by + + have h1 : rho1 ∈ zeroZ := h_rho1_in_Zt.1 + + have h2 : riemannZeta rho1 = 0 := h1 + + have h3 : rho1 = rho1.re + rho1.im * Complex.I := by simp [Complex.re_add_im] + + rw [h3] at h2 + + exact lem_sigmale1 rho1.re rho1.im h2 + +lemma lem_s_notin_Zt (δ : ℝ) (hδ : 0 < δ) (t : ℝ) : + ((1 : ℂ) + δ + t * Complex.I) ∉ ZetaZerosNearPoint t := by + intro hmem + + have h_zero : riemannZeta ((1 : ℂ) + δ + t * Complex.I) = 0 := hmem.1 + + have h_gt : (1 : ℝ) + δ > 1 := by linarith [hδ] + have h_nonzero := lem_sigmage1 (1 + δ) t h_gt + + have h_coercion : (1 : ℂ) + δ = ↑(1 + δ) := by simp [Complex.ofReal_add] + + rw [h_coercion] at h_zero + exact h_nonzero h_zero + +lemma complex_abs_of_real (x : ℝ) : ‖(x : ℂ)‖ = abs x := by + rw [Complex.norm_real, Real.norm_eq_abs] + +lemma complex_add_real_imag_parts (a b : ℝ) (t : ℝ) : + ((a : ℂ) + b + t * Complex.I).re = a + b ∧ ((a : ℂ) + b + t * Complex.I).im = t := by + constructor + + · rw [Complex.add_re, Complex.add_re] + + simp [Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im] + + · rw [Complex.add_im, Complex.add_im] + + simp [Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im] + +lemma complex_abs_real_cast (r : ℝ) : ‖(r : ℂ)‖ = abs r := Complex.norm_real r + +lemma isBigO_comp_principal_domain {α β E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] + {f : β → E} {g : β → F} {h : α → β} {l : Filter α} {s : Set β} + (hfg : f =O[Filter.principal s] g) + (h_domain : ∀ᶠ x in l, h x ∈ s) : + (f ∘ h) =O[l] (g ∘ h) := by + + have h_le : Filter.map h l ≤ Filter.principal s := by + intro t ht + + rw [Filter.mem_principal] at ht + + rw [Filter.mem_map] + + rw [Filter.eventually_iff] at h_domain + + apply Filter.mem_of_superset h_domain + intro x hx + exact ht hx + + have hfg_map : f =O[Filter.map h l] g := Asymptotics.IsBigO.mono hfg h_le + + rwa [Asymptotics.isBigO_map] at hfg_map + +lemma isBigOWith_comp_principal_domain {α β E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] + {C : ℝ} {f : β → E} {g : β → F} {h : α → β} {l : Filter α} {s : Set β} + (hfg : Asymptotics.IsBigOWith C (Filter.principal s) f g) + (h_domain : ∀ᶠ x in l, h x ∈ s) : + Asymptotics.IsBigOWith C l (f ∘ h) (g ∘ h) := by + + rw [Asymptotics.isBigOWith_iff, Filter.eventually_principal] at hfg + + rw [Asymptotics.isBigOWith_iff] + + filter_upwards [h_domain] with x hx_in_s + + exact hfg (h x) hx_in_s + +lemma s_in_D12 (delta : ℝ) (hdelta_pos : 0 < delta) (t : ℝ) (hdelta_lt : delta < 1) : + ((1 : ℂ) + (delta : ℝ) + (t : ℝ) * Complex.I) ∈ + Metric.ball ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) (1 / 2) := by + + rw [Metric.mem_ball] + + have h1 : ((1 : ℂ) + (delta : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) = + (1 : ℂ) + (delta : ℝ) - (3 / 2 : ℂ) := by ring + + have h2 : (1 : ℂ) + (delta : ℝ) - (3 / 2 : ℂ) = (delta - 1/2 : ℝ) := by + simp [Complex.ofReal_sub] + ring + + rw [Complex.dist_eq, h1, h2, Complex.norm_real] + + rw [Real.norm_eq_abs] + + have h3 : abs (delta - 1/2) < 1/2 := by + rw [abs_lt] + constructor + · + linarith [hdelta_pos] + · + linarith [hdelta_lt] + exact h3 + +lemma zerosetKfRc_eq_ZetaZerosNearPoint (t : ℝ) : + zerosetKfRc (5/6 : ℝ) ((3/2 : ℂ) + t * Complex.I) riemannZeta = ZetaZerosNearPoint t := by + ext ρ; constructor + · intro h + rcases h with ⟨hball, hzero⟩ + refine ⟨?hz, ?hnorm⟩ + · simpa [zeroZ] using hzero + · simpa [Metric.mem_closedBall, Complex.dist_eq, sub_eq_add_neg] using hball + · intro h + rcases h with ⟨hz, hnorm⟩ + refine ⟨?hball, ?hzero⟩ + · simpa [Metric.mem_closedBall, Complex.dist_eq, sub_eq_add_neg] using hnorm + · simpa [zeroZ] using hz + +lemma mem_closedBall_of_mem_ball {x c : ℂ} {r : ℝ} (hx : x ∈ Metric.ball c r) : + x ∈ Metric.closedBall c r := by + exact (Metric.ball_subset_closedBall) hx + +lemma I_mul_real_eq_real_mul_I (t : ℝ) : + (Complex.I : ℂ) * (t : ℂ) = (t : ℂ) * Complex.I := by + simpa using mul_comm (Complex.I : ℂ) (t : ℂ) + +lemma center_eq_comm (t : ℝ) : + ((3/2 : ℂ) + (Complex.I : ℂ) * (t : ℂ)) = ((3/2 : ℂ) + (t : ℂ) * Complex.I) := by + have h : (Complex.I : ℂ) * (t : ℂ) = (t : ℂ) * Complex.I := by + simpa using mul_comm (Complex.I : ℂ) (t : ℂ) + simp [h] + +lemma log_abs_le_log_abs_add_two {t : ℝ} (ht : 2 < |t|) : + Real.log (abs t) ≤ Real.log (abs t + 2) := by + have hpos : 0 < |t| := lt_trans (by norm_num) ht + have hle : |t| ≤ |t| + 2 := by nlinarith + simpa using Real.log_le_log hpos hle + +lemma s_notin_ZetaZerosNearPoint (δ t : ℝ) (hδ_pos : 0 < δ) : + ((1 : ℂ) + δ + t * Complex.I) ∉ ZetaZerosNearPoint t := by + intro hmem + have hz0 : riemannZeta ((1 : ℂ) + δ + t * Complex.I) = 0 := hmem.1 + have : ((1 : ℂ) + δ + t * Complex.I).re = 1 + δ := by simp + have hpos : (1 : ℝ) < 1 + δ := by linarith + have hnonzero := lem_sigmage1 (1 + δ) t hpos + exact hnonzero (by simpa using hz0) + +lemma norm_sub_comm' (x y : ℂ) : ‖x - y‖ = ‖y - x‖ := by + calc + ‖x - y‖ = ‖-(x - y)‖ := by simpa using (norm_neg (x - y)).symm + _ = ‖y - x‖ := by simp [neg_sub] + +lemma s_in_closedBall_12 (δ t : ℝ) (hδ_pos : 0 < δ) (hδ_lt : δ < 1) : + ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) ∈ + Metric.closedBall ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) (1 / 2) := by + + have hdiff : + ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) + = ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) := by + simp + have hreal : + ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) = ((δ - (1 / 2 : ℝ)) : ℂ) := by + have h' : ((1 + δ : ℝ) - (3 / 2 : ℝ)) = δ - (1 / 2 : ℝ) := by + calc + (1 + δ) - (3 / 2 : ℝ) = δ + 1 - (3 / 2 : ℝ) := by ac_rfl + _ = δ + (1 - (3 / 2 : ℝ)) := by simp [add_sub_assoc] + _ = δ + (- (1 / 2 : ℝ)) := by norm_num + _ = δ - (1 / 2 : ℝ) := by simp [sub_eq_add_neg] + calc + ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) + = ((1 + δ : ℝ) : ℂ) - (3 / 2 : ℂ) := by + simp [add_comm] + _ = (↑((1 + δ : ℝ) - (3 / 2 : ℝ)) : ℂ) := by + simp [Complex.ofReal_sub] + _ = ((δ - (1 / 2 : ℝ)) : ℂ) := by simp [h'] + have hnormle : + ‖((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I)‖ + ≤ (1 / 2 : ℝ) := by + calc + ‖((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I)‖ + = ‖((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ)‖ := by simp [hdiff] + _ = ‖((δ - (1 / 2 : ℝ)) : ℂ)‖ := by simp [hreal] + _ = |δ - (1 / 2 : ℝ)| := by simpa using complex_abs_real_cast (δ - (1 / 2 : ℝ)) + _ ≤ 1 / 2 := by + have hleft : - (1 / 2 : ℝ) ≤ δ - 1 / 2 := by linarith [hδ_pos] + have hright : δ - 1 / 2 ≤ 1 / 2 := by linarith [hδ_lt] + simpa using (abs_le.mpr ⟨hleft, hright⟩) + + simpa [Metric.mem_closedBall, Complex.dist_eq] using hnormle + +lemma lem_explicit1deltat : + ∃ C > 1, + ∀ t : ℝ, 2 < |t| → + ∀ δ : ℝ, 0 < δ ∧ δ < 1 → + ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) + (fun rho1 : ℂ => + ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + δ + t * Complex.I) - rho1)) + - logDerivZeta ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I)‖ + ≤ C * Real.log (abs t + 2) := by + classical + + let r1 : ℝ := (1/2 : ℝ) + let r : ℝ := (2/3 : ℝ) + let R1 : ℝ := (5/6 : ℝ) + let R : ℝ := (9/10 : ℝ) + have hr1_pos : 0 < r1 := by norm_num + have hr_pos : 0 < r := by norm_num + have hr1_lt_r : r1 < r := by norm_num + have hr_lt_R1 : r < R1 := by norm_num + have hR1_pos : 0 < R1 := by norm_num + have hR1_lt_R : R1 < R := by norm_num + have hR_lt_1 : R < 1 := by norm_num + + let F : ℝ := (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) + + obtain ⟨b, hb_gt1, hb_bound⟩ := zeta32upper + obtain ⟨A, hA_gt1, hA_bound⟩ := zeta32lower_log + + let K : ℝ := 1 + (Real.log b + A) / Real.log 4 + + let C : ℝ := max (F * K) 2 + have hC_gt1 : 1 < C := by + have : (1 : ℝ) < 2 := by norm_num + exact lt_of_lt_of_le this (le_max_right _ _) + refine ⟨C, hC_gt1, ?_⟩ + + intro t ht δ hδ + rcases hδ with ⟨hδ_pos, hδ_lt1⟩ + + let c_std : ℂ := ((3/2 : ℂ) + Complex.I * (t : ℂ)) + let c_comm : ℂ := ((3/2 : ℂ) + (t : ℝ) * Complex.I) + have hcenter_eq : c_std = c_comm := by simpa [c_std, c_comm] using (center_eq_comm t) + let s : ℂ := (1 : ℂ) + δ + t * Complex.I + + have hs_mem_comm : s ∈ Metric.closedBall c_comm r1 := s_in_closedBall_12 δ t hδ_pos hδ_lt1 + have hs_mem_std : s ∈ Metric.closedBall c_std r1 := by simpa [c_std, c_comm, hcenter_eq] using hs_mem_comm + + have hs_notin_Zt : s ∉ ZetaZerosNearPoint t := s_notin_ZetaZerosNearPoint δ t hδ_pos + have hzeros_eq : zerosetKfRc (5/6 : ℝ) c_comm riemannZeta = ZetaZerosNearPoint t := by + simpa [c_comm] using zerosetKfRc_eq_ZetaZerosNearPoint t + have hs_notin_comm : s ∉ zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by simpa [hzeros_eq] using hs_notin_Zt + have hs_notin_std : s ∉ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [c_std, c_comm, hcenter_eq] using hs_notin_comm + + have hfin_comm : (zerosetKfRc (5/6 : ℝ) c_comm riemannZeta).Finite := by + simpa [hzeros_eq] using (ZetaZerosNearPoint_finite t) + have hfin_std : (zerosetKfRc (5/6 : ℝ) c_std riemannZeta).Finite := by + simpa [c_std, c_comm, hcenter_eq] using hfin_comm + + have h_bound_R : ∀ z ∈ Metric.closedBall c_std R, ‖riemannZeta z‖ < b * |t| := by + intro z hz + have hsubs : Metric.closedBall c_std R ⊆ Metric.closedBall c_std (1 : ℝ) := by + intro w hw; exact Metric.closedBall_subset_closedBall (by norm_num : (R : ℝ) ≤ (1 : ℝ)) hw + exact hb_bound t (by simpa using ht) z (hsubs hz) + + have hmain := + log_Deriv_Expansion_Zeta t ht + r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 + + have hbpos : 0 < b := lt_trans (by norm_num) hb_gt1 + have ht1 : 1 < |t| := lt_trans (by norm_num) ht + have hmul : b * 1 < b * |t| := (mul_lt_mul_of_pos_left ht1 hbpos) + have hB_gt1 : 1 < b * |t| := lt_trans hb_gt1 (by simpa using hmul) + have hineq := hmain (b * |t|) hB_gt1 h_bound_R + have hz_in : s ∈ Metric.closedBall c_std r1 \ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := ⟨hs_mem_std, hs_notin_std⟩ + have hineq2 := hineq hfin_std s hz_in + + have hFinset_eq : hfin_std.toFinset = (ZetaZerosNearPoint_finite t).toFinset := by + ext ρ; constructor <;> intro hρ + · have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [Set.mem_toFinset] using hρ + have : ρ ∈ ZetaZerosNearPoint t := by + have heq : zerosetKfRc (5/6 : ℝ) c_std riemannZeta = zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by + + simp [c_std, c_comm, hcenter_eq] + simpa [hzeros_eq, heq] + using this + simpa [Set.mem_toFinset] using this + · have : ρ ∈ ZetaZerosNearPoint t := by simpa [Set.mem_toFinset] using hρ + have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by simpa [hzeros_eq] using this + have heq : zerosetKfRc (5/6 : ℝ) c_std riemannZeta = zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by + simp [c_std, c_comm, hcenter_eq] + have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [heq] using this + simpa [Set.mem_toFinset] using this + have hLHS_le : + ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) + (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1)) + - logDerivZeta s‖ + ≤ F * Real.log (b * |t| / ‖riemannZeta c_std‖) := by + have : + ‖logDerivZeta s - + Finset.sum (hfin_std.toFinset) + (fun ρ : ℂ => ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (s - ρ))‖ + ≤ F * Real.log (b * |t| / ‖riemannZeta c_std‖) := by + simpa [F] using! hineq2 + simpa [norm_sub_comm', hFinset_eq] + using this + + have hc_ne : riemannZeta c_std ≠ 0 := by simpa [c_std] using! zetacnot0 t + have hnorm_pos : 0 < ‖riemannZeta c_std‖ := by simpa [norm_pos_iff] using hc_ne + have hnorm_ne : ‖riemannZeta c_std‖ ≠ 0 := ne_of_gt hnorm_pos + have hb_ne : b ≠ 0 := ne_of_gt hbpos + have htpos0 : 0 < |t| := lt_trans (by norm_num) ht + have ht_ne : |t| ≠ 0 := ne_of_gt htpos0 + have hlog_mul1 : + Real.log (b * |t| / ‖riemannZeta c_std‖) + = Real.log (b * |t|) + Real.log (1 / ‖riemannZeta c_std‖) := by + simpa [div_eq_mul_inv] using Real.log_mul (mul_ne_zero hb_ne ht_ne) (inv_ne_zero hnorm_ne) + have hlog_mul2 : Real.log (b * |t|) = Real.log b + Real.log (|t|) := by + simpa using Real.log_mul hb_ne ht_ne + have hζ_log_le : Real.log (1 / ‖riemannZeta c_std‖) ≤ A := by + simpa [c_std] using! hA_bound t + have hlog_bound1 : + Real.log (b * |t| / ‖riemannZeta c_std‖) + ≤ (Real.log b + Real.log (|t|)) + A := by + have := add_le_add_right hζ_log_le (Real.log (b * |t|)) + simpa [hlog_mul1, hlog_mul2, add_comm, add_left_comm, add_assoc] using this + + have hlog_mono : Real.log (|t|) ≤ Real.log (|t| + 2) := + log_abs_le_log_abs_add_two (by simpa using ht) + have hlog_bound2 : + Real.log (b * |t| / ‖riemannZeta c_std‖) + ≤ Real.log (|t| + 2) + (Real.log b + A) := by + have : Real.log b + Real.log (|t|) + A ≤ Real.log b + Real.log (|t| + 2) + A := by + have := add_le_add_right hlog_mono (Real.log b) + simpa [add_comm, add_left_comm, add_assoc] using add_le_add_left this A + exact le_trans hlog_bound1 (by simpa [add_comm, add_left_comm, add_assoc] using this) + + have hlog5pos : 0 < Real.log 4 := Real.log_pos (by norm_num : (1 : ℝ) < 4) + have hge5 : Real.log 4 ≤ Real.log (|t| + 2) := by + have hxy : (4 : ℝ) ≤ |t| + 2 := by nlinarith [le_of_lt ht] + exact Real.log_le_log (by norm_num) hxy + have hconst_nonneg : 0 ≤ Real.log b + A := by + have hbposlog : 0 < Real.log b := Real.log_pos hb_gt1 + have hApos : 0 < A := lt_trans (by norm_num) hA_gt1 + have : 0 ≤ Real.log b := le_of_lt hbposlog + nlinarith + have hnonneg : 0 ≤ (Real.log b + A) / Real.log 4 := div_nonneg hconst_nonneg (le_of_lt hlog5pos) + have hne5 : Real.log 4 ≠ 0 := ne_of_gt hlog5pos + have hconst_bound : (Real.log b + A) + ≤ (Real.log b + A) / Real.log 4 * Real.log (|t| + 2) := by + have := mul_le_mul_of_nonneg_left hge5 hnonneg + + have : ((Real.log b + A) / Real.log 4) * Real.log 4 ≤ (Real.log b + A) / Real.log 4 * Real.log (|t| + 2) := this + + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hne5] using this + have hlog_bound3 : + Real.log (|t| + 2) + (Real.log b + A) + ≤ K * Real.log (|t| + 2) := by + have := add_le_add_right hconst_bound (Real.log (|t| + 2)) + + simpa [K, mul_add, add_comm, add_left_comm, add_assoc, mul_comm, mul_left_comm, mul_assoc, one_mul] + using this + have hlog_bound_final : + Real.log (b * |t| / ‖riemannZeta c_std‖) + ≤ K * Real.log (|t| + 2) := le_trans hlog_bound2 hlog_bound3 + + have hF_nonneg : 0 ≤ F := by + have h1 : 0 ≤ 16 * r ^ 2 / (r - r1) ^ 3 := by + have hnum : 0 ≤ 16 * r ^ 2 := by + have : 0 ≤ (16 : ℝ) := by norm_num + have : 0 ≤ r ^ 2 := by + have := sq_nonneg r + simpa [pow_two] using this + simpa [mul_comm] using mul_nonneg (show 0 ≤ (16 : ℝ) by norm_num) this + have hden : 0 < (r - r1) ^ 3 := by + have : 0 < r - r1 := sub_pos.mpr hr1_lt_r + simpa using pow_pos this 3 + exact div_nonneg hnum (le_of_lt hden) + have h2 : 0 ≤ 1 / ((R ^ 2 / R1 - R1) * Real.log (R / R1)) := by + + have hden1 : 0 < (R ^ 2 / R1 - R1) := by + change 0 < ((9/10 : ℝ) ^ 2 / (5/6 : ℝ) - (5/6 : ℝ)) + norm_num + have hden2 : 0 < Real.log (R / R1) := by + have : 1 < R / R1 := by + change (1 : ℝ) < (9/10 : ℝ) / (5/6 : ℝ) + norm_num + exact Real.log_pos this + have hpos : 0 < ((R ^ 2 / R1 - R1) * Real.log (R / R1)) := mul_pos hden1 hden2 + exact le_of_lt (one_div_pos.mpr hpos) + have := add_nonneg h1 h2 + simpa [F] using this + + have hY_nonneg : 0 ≤ Real.log (|t| + 2) := by + + have hgt1 : (1 : ℝ) < |t| + 2 := by + have : (2 : ℝ) ≤ |t| + 2 := by + have : 0 ≤ |t| := abs_nonneg t + simp + exact lt_of_lt_of_le (by norm_num) this + exact le_of_lt (Real.log_pos hgt1) + have hfinal1 : + ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) + (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1)) + - logDerivZeta s‖ + ≤ F * (K * Real.log (|t| + 2)) := + le_trans hLHS_le (by exact mul_le_mul_of_nonneg_left hlog_bound_final hF_nonneg) + have hFactor_leC : F * K ≤ C := by exact le_trans (le_of_eq rfl) (le_max_left _ _) + have hfinal2 : F * (K * Real.log (|t| + 2)) ≤ C * Real.log (|t| + 2) := by + have := mul_le_mul_of_nonneg_right hFactor_leC hY_nonneg + simpa [mul_comm, mul_left_comm, mul_assoc] using this + have := le_trans hfinal1 hfinal2 + simpa [s] + +lemma lem_explicit1RealReal : + ∃ C > 1, + ∀ t : ℝ, 2 < |t| → + ∀ δ : ℝ, 0 < δ ∧ δ < 1 → + abs ((logDerivZeta ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I)).re + - (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) + (fun rho1 : ℂ => + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + δ + t * Complex.I) - rho1)).re))) + ≤ C * Real.log (|t| + 2) := by + rcases lem_explicit1deltat with ⟨C, hCpos, hE⟩ + refine ⟨C, hCpos, ?_⟩ + intro t ht δ hδ + + let s : ℂ := (1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I + let S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite t) + let g : ℂ → ℂ := fun rho1 : ℂ => + ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1) + + have ht' : ‖logDerivZeta s - ∑ rho1 ∈ S, g rho1‖ + ≤ C * Real.log (abs t + 2) := by + + have h_app := hE t ht δ hδ + rw [norm_sub_rev] at h_app + exact h_app + + have hleft_eq : + abs ((logDerivZeta s).re - ∑ rho1 ∈ S, (g rho1).re) + = abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) := by + simp [Complex.sub_re, Complex.re_sum] + + have hbound : + abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) + ≤ ‖logDerivZeta s - ∑ rho1 ∈ S, g rho1‖ := by + simpa using Complex.abs_re_le_norm (logDerivZeta s - ∑ rho1 ∈ S, g rho1) + + have hfinal : + abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) + ≤ C * Real.log (abs t + 2) := + le_trans hbound ht' + + have hnorm : |t| = abs t := rfl + simpa [s, S, g, hleft_eq, hnorm] using hfinal + +lemma lem_explicit2Real : + ∃ C > 1, + ∀ t : ℝ, 2 < |t| → + ∀ δ : ℝ, 0 < δ ∧ δ < 1 → + abs ( + (logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I)).re + - (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) + (fun rho1 : ℂ => + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + δ + (2 * t) * Complex.I) - rho1)).re)) + ) + ≤ C * Real.log (abs (2 * t) + 2) := by + rcases lem_explicit1RealReal with ⟨C, hCpos, hEv⟩ + refine ⟨C, hCpos, ?_⟩ + intro t ht δ hδ + + have h_2t : 2 < |2 * t| := by + rw [abs_mul, abs_two] + linarith [ht] + have h_bound := hEv (2 * t) h_2t δ hδ + + simp only [Complex.ofReal_mul] at h_bound + exact h_bound + +lemma lem_Realsum {α : Type*} (s : Finset α) (f : α → ℂ) : (Finset.sum s f).re = Finset.sum s (fun i => (f i).re) := by + exact Complex.re_sum s f + +lemma lem_Ztfinite (t : ℝ) : Set.Finite (ZetaZerosNearPoint t) := ZetaZerosNearPoint_finite t + +lemma lem_sumrho1 (t : ℝ) (δ : ℝ) (_hdelta_pos : δ > 0) (_hdelta_lt1 : δ < 1) : + (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) + (fun rho1 : ℂ => + ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + δ + t * Complex.I) - rho1))).re = + Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) + (fun rho1 : ℂ => + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + δ + t * Complex.I) - rho1)).re) := by + exact lem_Realsum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) _ + +lemma lem_sumrho2 (t : ℝ) (delta : ℝ) (_hdelta : delta > 0) (_hdelta_lt1 : delta < 1) : + (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) + (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1))).re = + Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) + (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1)).re) := by + rw [Complex.re_sum] + +lemma lem_1deltatrho1 (delta : ℝ) (_hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (_h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ((1 : ℂ) + delta + t * Complex.I - rho1) = ((1 : ℝ) + delta - rho1.re) + (t - rho1.im) * Complex.I := by + + conv_lhs => rw [← Complex.re_add_im rho1] + + simp only [sub_add_eq_sub_sub] + + ring_nf + + simp only [Complex.ofReal_one] + ring + +lemma lem_Re1deltatrho1 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : +((1 : ℂ) + delta + t * Complex.I - rho1).re = (1 : ℝ) + delta - rho1.re := by + + rw [lem_1deltatrho1 delta hdelta t rho1 h_rho1_in_Zt] + + rw [Complex.add_re] + + rw [Complex.mul_I_re] + + simp + +lemma lem_Re1delta1 (delta : ℝ) (_hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : +(1 : ℝ) + delta - rho1.re ≥ delta := by + + have h_rho1_re_le_1 : rho1.re ≤ 1 := lem_sigmale1Zt t rho1 h_rho1_in_Zt + + have h_nonneg : 1 - rho1.re ≥ 0 := by linarith + + linarith + +lemma lem_Re1deltatge (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ((1 : ℂ) + delta + t * Complex.I - rho1).re ≥ delta := by + + rw [lem_Re1deltatrho1 delta hdelta t rho1 h_rho1_in_Zt] + + exact lem_Re1delta1 delta hdelta t rho1 h_rho1_in_Zt + +lemma lem_Re1deltatneq0 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : +((1 : ℂ) + delta + t * Complex.I - rho1).re > 0 := by + + have h_ge_delta : ((1 : ℂ) + delta + t * Complex.I - rho1).re ≥ delta := lem_Re1deltatge delta hdelta t rho1 h_rho1_in_Zt + + linarith [hdelta] + +lemma lem_Re1deltatge0 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : +(1 / ((1 : ℂ) + delta + t * Complex.I - rho1)).re ≥ 0 := by + + apply le_of_lt + apply lem_Re1zge0 + + exact lem_Re1deltatneq0 delta hdelta t rho1 h_rho1_in_Zt + +lemma lem_Re1deltatge0m (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (_hdelta_lt_1 : delta < 1) + (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + delta + t * Complex.I) - rho1)).re ≥ 0 := by + + let n := (analyticOrderAt riemannZeta rho1).toNat + let z := ((1 : ℂ) + delta + t * Complex.I) - rho1 + + have h_eq : (n : ℂ) / z = n • (1/z) := by + rw [nsmul_eq_mul] + simp [div_eq_mul_inv] + + rw [h_eq, Complex.re_nsmul] + + apply nsmul_nonneg + exact lem_Re1deltatge0 delta hdelta t rho1 h_rho1_in_Zt + +lemma lem_Re1delta2tge0 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint (2 * t)) : +(((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + (2 * t) * Complex.I - rho1)).re ≥ 0 := by + + convert lem_Re1deltatge0m delta hdelta (2 * t) hdelta_lt_1 rho1 h_rho1_in_Zt + simp + +lemma lem_sumrho2ge (t : ℝ) (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) : +Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + (2 * t) * Complex.I - rho1)).re) ≥ 0 := by + apply Finset.sum_nonneg + intro rho1 h_rho1_in_finset + + have h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint (2 * t) := by + rwa [Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite (2 * t))] at h_rho1_in_finset + + exact lem_Re1delta2tge0 delta hdelta hdelta_lt_1 t rho1 h_rho1_in_Zt + +lemma lem_sumrho2ge02 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) : + (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) +(fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1))).re ≥ 0 := by + + rw [lem_sumrho2 t delta hdelta hdelta_lt_1] + + exact lem_sumrho2ge t delta hdelta hdelta_lt_1 + +lemma lem_explicit2Real2 : + ∃ C > 1, + ∀ t : ℝ, 2 < |t| → + ∀ δ : ℝ, 0 < δ ∧ δ < 1 → + ((-logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I)).re) + ≤ C * Real.log (abs (2 * t) + 2) := by + rcases lem_explicit2Real with ⟨C, hCpos, hEv⟩ + refine ⟨C, hCpos, ?_⟩ + intro t ht δ hδ + + set s : ℂ := (1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I + set S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t)) + set Sre : ℝ := + Finset.sum S + (fun rho1 : ℂ => + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (s - rho1)).re) + + have h_bound : + abs ((logDerivZeta s).re - Sre) + ≤ C * Real.log (abs (2 * t) + 2) := by + simpa [s, S, Sre] using hEv t ht δ hδ + + have hS_nonneg : 0 ≤ Sre := by + + have h0 := lem_sumrho2ge02 t δ hδ.1 hδ.2 + + simpa [s, S, Sre, lem_sumrho2 t δ hδ.1 hδ.2] using h0 + + have h_left : -(C * Real.log (abs (2 * t) + 2)) ≤ (logDerivZeta s).re - Sre := + (abs_le.mp h_bound).1 + + have h_neg : -((logDerivZeta s).re - Sre) ≤ C * Real.log (abs (2 * t) + 2) := by + simpa using neg_le_neg h_left + + have h_aux := sub_le_sub_right h_neg Sre + have h_isol : - (logDerivZeta s).re ≤ C * Real.log (abs (2 * t) + 2) - Sre := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h_aux + + have h_drop : C * Real.log (abs (2 * t) + 2) - Sre ≤ C * Real.log (abs (2 * t) + 2) := + sub_le_self _ hS_nonneg + + have h_final := le_trans h_isol h_drop + + simpa [s, Complex.neg_re] using h_final + +lemma lem_log2Olog : (fun t : ℝ => Real.log (2 * t)) =O[Filter.atTop] (fun t : ℝ => Real.log t) := by + + have h_eq : (fun t : ℝ => Real.log (2 * t)) =ᶠ[Filter.atTop] (fun t : ℝ => Real.log 2 + Real.log t) := by + filter_upwards [Filter.eventually_gt_atTop (0 : ℝ)] with t ht + rw [Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (ne_of_gt ht)] + + have h_bigO : (fun t : ℝ => Real.log 2 + Real.log t) =O[Filter.atTop] (fun t : ℝ => Real.log t) := by + + have h_const : (fun _ : ℝ => Real.log 2) =o[Filter.atTop] Real.log := + Real.isLittleO_const_log_atTop + have h_self : Real.log =O[Filter.atTop] Real.log := + Asymptotics.isBigO_refl _ _ + + have h_const_bigO : (fun _ : ℝ => Real.log 2) =O[Filter.atTop] Real.log := + Asymptotics.IsLittleO.isBigO h_const + + exact Asymptotics.IsBigO.add h_const_bigO h_self + + exact h_eq.trans_isBigO h_bigO + +lemma lem_w2t (t : ℝ) : abs (2 * t) + 2 ≥ 0 := by + have h1 : abs (2 * t) ≥ 0 := abs_nonneg (2 * t) + linarith + +lemma lem_log2Olog2 : +(fun t : ℝ => Real.log (abs (2 * t) + 4)) =O[Filter.atTop ⊔ Filter.atBot] (fun t : ℝ => Real.log (abs t + 2)) := by + + have h_eq : ∀ t : ℝ, abs (2 * t) + 4 = 2 * (abs t + 2) := by + intro t + rw [abs_mul, abs_two] + ring + + have h_log_decomp : ∀ t : ℝ, Real.log (abs (2 * t) + 4) = Real.log 2 + Real.log (abs t + 2) := by + intro t + rw [h_eq] + have h_pos : 0 < abs t + 2 := by linarith [abs_nonneg t] + rw [Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (ne_of_gt h_pos)] + + have h_target_eq : (fun t : ℝ => Real.log (abs (2 * t) + 4)) = + (fun t : ℝ => Real.log 2 + Real.log (abs t + 2)) := by + funext t + exact h_log_decomp t + + rw [h_target_eq] + + apply Asymptotics.IsBigO.of_bound 2 + + filter_upwards with t + + have h_pos_arg : abs t + 2 ≥ 1 := by linarith [abs_nonneg t] + have h_log_nonneg : 0 ≤ Real.log (abs t + 2) := Real.log_nonneg h_pos_arg + have h_log2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : 1 < (2 : ℝ)) + + simp only [Real.norm_eq_abs] + rw [abs_of_nonneg (by linarith [h_log2_pos.le, h_log_nonneg] : 0 ≤ Real.log 2 + Real.log (abs t + 2))] + rw [abs_of_nonneg h_log_nonneg] + + have h_bound : Real.log 2 ≤ Real.log (abs t + 2) := by + apply Real.log_le_log (by norm_num : 0 < (2 : ℝ)) + linarith [abs_nonneg t] + + linarith [h_bound] + +lemma lem_Z2bound : + ∃ C > 1, + ∀ t : ℝ, 2 < |t| → + ∀ δ, 0 < δ ∧ δ < 1 → + (-(logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I))).re + ≤ C * Real.log (abs t + 2) := by + + obtain ⟨C₁, hC₁_pos, hbound₁⟩ := lem_explicit2Real2 + + have h_log_comp : + ∀ t : ℝ, 2 < |t| → Real.log (abs (2 * t) + 2) ≤ 2 * Real.log (abs t + 2) := by + intro t ht + have h_pos_2t : 0 < abs (2 * t) + 2 := by linarith [abs_nonneg (2 * t)] + have h_pos_t : 0 < abs t + 2 := by linarith [abs_nonneg t] + have h_2t_eq : abs (2 * t) = 2 * abs t := by + rw [abs_mul, abs_two] + + have h_bound : abs (2 * t) + 2 ≤ 4 * (abs t + 2) := by + rw [h_2t_eq] + + linarith [abs_nonneg t] + + have h_4_pos : (0 : ℝ) < 4 := by norm_num + have h_log_bound : Real.log (abs (2 * t) + 2) ≤ Real.log (4 * (abs t + 2)) := + Real.log_le_log h_pos_2t h_bound + + have h_log_mul_eq : Real.log (4 * (abs t + 2)) = Real.log 4 + Real.log (abs t + 2) := by + exact Real.log_mul (by norm_num : (4 : ℝ) ≠ 0) (ne_of_gt h_pos_t) + + have h_4_le : (4 : ℝ) ≤ abs t + 2 := by linarith [ht] + have h_log_4 : Real.log 4 ≤ Real.log (abs t + 2) := + Real.log_le_log (by norm_num) h_4_le + + calc Real.log (abs (2 * t) + 2) + ≤ Real.log (4 * (abs t + 2)) := h_log_bound + _ = Real.log 4 + Real.log (abs t + 2) := h_log_mul_eq + _ ≤ Real.log (abs t + 2) + Real.log (abs t + 2) := add_le_add_left h_log_4 _ + _ = 2 * Real.log (abs t + 2) := by ring + + have hC₁_nonneg : 0 ≤ C₁ := le_of_lt (lt_trans zero_lt_one hC₁_pos) + + refine ⟨2 * C₁, ?_, ?_⟩ + · + linarith [hC₁_pos] + · + intro t ht δ hδ + let s := (1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I + + have h1 : (-(logDerivZeta s)).re ≤ C₁ * Real.log (abs (2 * t) + 2) := hbound₁ t ht δ hδ + + have h3 : Real.log (abs (2 * t) + 2) ≤ 2 * Real.log (abs t + 2) := h_log_comp t ht + + calc (-(logDerivZeta s)).re + ≤ C₁ * Real.log (abs (2 * t) + 2) := h1 + _ ≤ C₁ * (2 * Real.log (abs t + 2)) := mul_le_mul_of_nonneg_left h3 hC₁_nonneg + _ = (2 * C₁) * Real.log (abs t + 2) := by ring + +lemma lem_Z1split (delta : ℝ) (_hdelta : delta > 0) (_hdelta_lt1 : delta < 1) (rho : ℂ) + (_h_rho_in_zeroZ : rho ∈ zeroZ) + (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : + Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) + (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) = + (((analyticOrderAt riemannZeta rho).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re + + Finset.sum ((Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)).erase rho) + (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) := by + classical + set s := Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im) + set f := fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re + have hmem : rho ∈ s := by + simpa [s, Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite rho.im)] using h_rho_in_Zt + + have h_decomp : ∑ x ∈ s, f x = f rho + ∑ x ∈ s.erase rho, f x := by + rw [← Finset.insert_erase hmem] + rw [Finset.sum_insert (Finset.notMem_erase rho s)] + simp + exact h_decomp + +lemma re_ofReal_mul_eq (a : ℝ) (z : ℂ) : ((a : ℂ) * z).re = a * z.re := by + calc + ((a : ℂ) * z).re = ((a : ℂ).re) * z.re - ((a : ℂ).im) * z.im := by + simp [Complex.mul_re] + _ = a * z.re - 0 := by + simp + _ = a * z.re := by + simp + +lemma re_ofReal_div_eq (a : ℝ) (z : ℂ) : ((a : ℂ) / z).re = a * (1 / z).re := by + simp [div_eq_mul_inv] + +lemma re_ofReal_div_ge_one (a : ℝ) (z : ℂ) (ha : 1 ≤ a) (hz : 0 ≤ (1 / z).re) : ((a : ℂ) / z).re ≥ (1 / z).re := by + have hrepr : ((a : ℂ) / z).re = a * (1 / z).re := by + simp [div_eq_mul_inv, Complex.mul_re] + have hmul : (1 : ℝ) * (1 / z).re ≤ a * (1 / z).re := + mul_le_mul_of_nonneg_right ha hz + calc + ((a : ℂ) / z).re = a * (1 / z).re := hrepr + _ ≥ 1 * (1 / z).re := by exact hmul + _ = (1 / z).re := by simp [one_mul] + +lemma analyticAt_riemannZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : AnalyticAt ℂ riemannZeta s := by + + refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ + + filter_upwards [eventually_ne_nhds hs] with z hz + exact differentiableAt_riemannZeta hz + +lemma riemannZeta_not_eventually_zero_of_ne_one {s : ℂ} (hs : s ≠ 1) : + ¬ (∀ᶠ z in nhds s, riemannZeta z = 0) := by + intro hEvZero + + let H : ℂ → ℂ := Function.update (fun z : ℂ => (z - 1) * riemannZeta z) 1 1 + + have hH_diff : Differentiable ℂ H := by + intro z + rcases eq_or_ne z 1 with rfl | hz + · + refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt + · + + filter_upwards [self_mem_nhdsWithin] with t ht + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta t := by + + exact differentiableAt_riemannZeta ht + have hdiff := h1.mul h2 + + apply hdiff.congr_of_eventuallyEq + filter_upwards [eventually_ne_nhds ht] with u hu + simp [H, Function.update_of_ne hu] + · + simpa [H, continuousAt_update_same] using riemannZeta_residue_one + · + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta z := by + exact differentiableAt_riemannZeta hz + have hdiff := h1.mul h2 + + apply hdiff.congr_of_eventuallyEq + filter_upwards [eventually_ne_nhds hz] with u hu + simp [H, Function.update_of_ne hu] + + have hH_analytic : AnalyticOnNhd ℂ H Set.univ := + (Complex.analyticOnNhd_univ_iff_differentiable).2 hH_diff + + have h0_analytic : AnalyticOnNhd ℂ (fun _ : ℂ => (0 : ℂ)) Set.univ := by + intro z _; simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => (0 : ℂ)) z) + + have hEv_ne1 : ∀ᶠ z in nhds s, z ≠ 1 := eventually_ne_nhds hs + have hEv_H0 : ∀ᶠ z in nhds s, H z = 0 := by + filter_upwards [hEvZero, hEv_ne1] with z hz_zero hz_ne1 + + have : H z = (z - 1) * riemannZeta z := by simp [H, Function.update_of_ne hz_ne1] + simp [this, hz_zero] + + have hEqOn : Set.EqOn H (fun _ : ℂ => (0 : ℂ)) Set.univ := by + + have hU : IsPreconnected (Set.univ : Set ℂ) := by simpa using isPreconnected_univ + exact AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq hH_analytic h0_analytic hU (by simp) hEv_H0 + have hHeq : H = fun _ : ℂ => (0 : ℂ) := by + funext z; simpa using hEqOn (by simp : z ∈ (Set.univ : Set ℂ)) + + have h2ne1 : (2 : ℂ) ≠ 1 := by norm_num + have hH2 : H (2 : ℂ) = (2 - 1) * riemannZeta (2 : ℂ) := by + simp [H] + have hzeta2_ne : riemannZeta (2 : ℂ) ≠ 0 := + riemannZeta_ne_zero_of_one_le_re (by simp) + have hprod_zero' : 0 = (2 - 1) * riemannZeta (2 : ℂ) := by + simpa [hHeq] using hH2 + have hprod_zero : (2 - 1) * riemannZeta (2 : ℂ) = 0 := hprod_zero'.symm + have hnonzero : (2 - 1) * riemannZeta (2 : ℂ) ≠ 0 := by + have hcoeff : (2 : ℂ) - 1 ≠ 0 := sub_ne_zero.mpr h2ne1 + exact mul_ne_zero hcoeff hzeta2_ne + exact hnonzero hprod_zero + +lemma analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero {f : ℂ → ℂ} {z0 : ℂ} + (hf : AnalyticAt ℂ f z0) (hzero : f z0 = 0) + (hnot : ¬ (∀ᶠ z in nhds z0, f z = 0)) : + 1 ≤ (analyticOrderAt f z0).toNat := by + classical + + have hne0 : analyticOrderAt f z0 ≠ 0 := by + intro h0 + have hzne : f z0 ≠ 0 := (AnalyticAt.analyticOrderAt_eq_zero hf).1 h0 + exact hzne hzero + + have hneTop : analyticOrderAt f z0 ≠ ⊤ := by + intro htop + have hall : (∀ᶠ z in nhds z0, f z = 0) := (analyticOrderAt_eq_top).1 htop + exact hnot hall + + rcases WithTop.ne_top_iff_exists.mp hneTop with ⟨n, hn⟩ + + have hn_ne_zero : n ≠ 0 := by + intro hn0 + apply hne0 + + simp [hn.symm, hn0] + rfl + + have hposn : 1 ≤ n := Nat.succ_le_of_lt (Nat.pos_of_ne_zero hn_ne_zero) + + simpa [hn.symm] using! hposn + +lemma lem_Z1splitge (delta : ℝ) (hdelta_pos : delta > 0) (hdelta : delta < 1) (rho : ℂ) + (h_rho_in_zeroZ : rho ∈ zeroZ) (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : + Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) ≥ +(1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re := by + classical + + have hsplit := + lem_Z1split delta hdelta_pos hdelta rho h_rho_in_zeroZ h_rho_in_Zt + + rw [hsplit] + + have h_rho_ne_one : rho ≠ (1 : ℂ) := by + intro h + have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) + exact hz1_ne (by simpa [h] using! h_rho_in_zeroZ) + have hAnal : AnalyticAt ℂ riemannZeta rho := analyticAt_riemannZeta_of_ne_one h_rho_ne_one + have hNotEv : ¬ (∀ᶠ z in nhds rho, riemannZeta z = 0) := + riemannZeta_not_eventually_zero_of_ne_one h_rho_ne_one + have horder_nat : 1 ≤ (analyticOrderAt riemannZeta rho).toNat := + analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero + hAnal (by simpa using! h_rho_in_zeroZ) hNotEv + have ha_real : (1 : ℝ) ≤ ((analyticOrderAt riemannZeta rho).toNat : ℝ) := by exact_mod_cast horder_nat + have hz_nonneg : 0 ≤ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re := + lem_Re1deltatge0 delta hdelta_pos rho.im rho h_rho_in_Zt + have hfirst : + (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re + ≤ (((((analyticOrderAt riemannZeta rho).toNat : ℝ) : ℂ) / + (((1 : ℂ) + delta + rho.im * Complex.I) - rho))).re := by + + simpa [ge_iff_le] using + (re_ofReal_div_ge_one ((analyticOrderAt riemannZeta rho).toNat : ℝ) + ((((1 : ℂ) + delta + rho.im * Complex.I) - rho)) ha_real hz_nonneg) + + have hsum_nonneg : + 0 ≤ Finset.sum + ((Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)).erase rho) + (fun rho1 : ℂ => + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / + (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) := by + apply Finset.sum_nonneg + intro rho1 hmem + rcases Finset.mem_erase.mp hmem with ⟨_, hmemS⟩ + + have hZt : rho1 ∈ ZetaZerosNearPoint rho.im := by + simpa [Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite rho.im)] using hmemS + + have hne1 : rho1 ≠ (1 : ℂ) := by + intro h + have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) + have hzero1 : riemannZeta rho1 = 0 := hZt.1 + exact hz1_ne (by simpa [h] using hzero1) + + have hAnal1 : AnalyticAt ℂ riemannZeta rho1 := analyticAt_riemannZeta_of_ne_one hne1 + have hNotEv1 : ¬ (∀ᶠ z in nhds rho1, riemannZeta z = 0) := + riemannZeta_not_eventually_zero_of_ne_one hne1 + have hzero1 : riemannZeta rho1 = 0 := hZt.1 + have horder1 : 1 ≤ (analyticOrderAt riemannZeta rho1).toNat := + analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero hAnal1 hzero1 hNotEv1 + have ha1_real : (1 : ℝ) ≤ ((analyticOrderAt riemannZeta rho1).toNat : ℝ) := by exact_mod_cast horder1 + + have hz1_nonneg : 0 ≤ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re := + lem_Re1deltatge0 delta hdelta_pos rho.im rho1 hZt + + have hge : + (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re ≤ + (((((analyticOrderAt riemannZeta rho1).toNat : ℝ) : ℂ) / + (((1 : ℂ) + delta + rho.im * Complex.I) - rho1))).re := by + simpa [ge_iff_le] using + (re_ofReal_div_ge_one ((analyticOrderAt riemannZeta rho1).toNat : ℝ) + ((((1 : ℂ) + delta + rho.im * Complex.I) - rho1)) ha1_real hz1_nonneg) + + exact le_trans hz1_nonneg hge + + have h := add_le_add hfirst hsum_nonneg + + simpa using h + +lemma lem_1deltatrho0 (delta : ℝ) (_hdelta : delta > 0) (rho : ℂ) (_h_rho_in_zeroZ : rho ∈ zeroZ) : +((1 : ℂ) + delta + rho.im * Complex.I - rho) = ((1 : ℝ) + delta - rho.re) := by + + calc (1 : ℂ) + delta + rho.im * Complex.I - rho + = (1 : ℂ) + delta + rho.im * Complex.I - (rho.re + rho.im * Complex.I) := by rw [Complex.re_add_im] + _ = (1 : ℂ) + delta - rho.re := by ring + _ = ((1 : ℝ) + delta - rho.re : ℂ) := by norm_cast + +lemma lem_1delsigReal (delta : ℝ) (hdelta_pos : delta > 0) (_hdelta : delta < 1) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : +(1 / ((1 : ℂ) + delta + rho.im * Complex.I - rho)).re = 1 / ((1 : ℝ) + delta - rho.re) := by + rw [lem_1deltatrho0 delta hdelta_pos rho h_rho_in_zeroZ] + + rw [← Complex.ofReal_add, ← Complex.ofReal_sub, ← Complex.ofReal_one] + + rw [Complex.div_ofReal_re] + + rw [Complex.ofReal_re] + +lemma lem_11delsiginR (delta : ℝ) (hdelta : delta > 0) (_hdelta_lt_1 : delta < 1) (sigma : ℝ) (hsigma : sigma ≤ 1) : +(1 / ((1 : ℂ) + delta - sigma)).im = 0 := by + + have h_pos : 1 + delta - sigma > 0 := by + calc 1 + delta - sigma + = (1 - sigma) + delta := by ring + _ ≥ 0 + delta := by linarith [hsigma] + _ = delta := by simp + _ > 0 := hdelta + + have h_eq : (1 : ℂ) + delta - sigma = (1 + delta - sigma : ℝ) := by + simp only [Complex.ofReal_add, Complex.ofReal_sub, Complex.ofReal_one] + + rw [h_eq] + + rw [Complex.div_ofReal_im] + + rw [Complex.one_im] + + simp + +lemma lem_11delsiginR2 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : +(1 / ((1 : ℂ) + delta - rho.re)).im = 0 := by + + have h_zeta_zero : riemannZeta rho = 0 := h_rho_in_zeroZ + + have h_rho_form : rho = rho.re + rho.im * Complex.I := by simp [Complex.re_add_im] + + rw [h_rho_form] at h_zeta_zero + + have h_rho_re_le_1 : rho.re ≤ 1 := lem_sigmale1 rho.re rho.im h_zeta_zero + + exact lem_11delsiginR delta hdelta hdelta_lt_1 rho.re h_rho_re_le_1 + +lemma lem_ReReal (x : ℝ) : (x : ℂ).re = x := Complex.ofReal_re x + +lemma lem_1delsigReal2 (delta : ℝ) (_hdelta : delta > 0) (rho : ℂ) (_h_rho_in_zeroZ : rho ∈ zeroZ) : +(1 / ((1 : ℂ) + delta - rho.re)).re = 1 / ((1 : ℝ) + delta - rho.re) := by + + have h_eq : (1 : ℂ) + delta - rho.re = (1 + delta - rho.re : ℝ) := by + simp only [Complex.ofReal_add, Complex.ofReal_sub, Complex.ofReal_one] + + rw [h_eq] + + rw [Complex.div_ofReal_re] + + rw [Complex.one_re] + +lemma lem_re_inv_one_plus_delta_minus_rho_real (delta : ℝ) (hdelta : delta > 0) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : +(1 / ((1 : ℂ) + delta + rho.im * Complex.I - rho)).re = 1 / ((1 : ℝ) + delta - rho.re) := by + + rw [lem_1deltatrho0 delta hdelta rho h_rho_in_zeroZ] + + exact lem_1delsigReal2 delta hdelta rho h_rho_in_zeroZ + +lemma lem_Z1splitge2 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (rho : ℂ) + (h_rho_in_zeroZ : rho ∈ zeroZ) (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : + Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) + (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + rho.im * Complex.I - rho1)).re) ≥ +1 / ((1 : ℝ) + delta - rho.re) := by + + have h1 := lem_Z1splitge delta hdelta hdelta_lt_1 rho h_rho_in_zeroZ h_rho_in_Zt + + have h2 := lem_re_inv_one_plus_delta_minus_rho_real delta hdelta rho h_rho_in_zeroZ + + rw [← h2] + exact h1 + +lemma lem_Z1splitge3 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (sigma t : ℝ) (rho : ℂ) + (h_rho_eq : rho = sigma + t * Complex.I) (h_rho_in_zeroZ : rho ∈ zeroZ) + (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint t) : +(Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + t * Complex.I) - rho1)) ).re ≥ 1 / ((1 : ℝ) + delta - sigma) := by + + rw [lem_sumrho1 t delta hdelta hdelta_lt_1] + + have h_rho_im : rho.im = t := by + rw [h_rho_eq] + simp [Complex.add_im, Complex.mul_im, Complex.I_im] + have h_rho_re : rho.re = sigma := by + rw [h_rho_eq] + simp [Complex.add_re, Complex.mul_re, Complex.I_re] + + have h_rho_in_Zt' : rho ∈ ZetaZerosNearPoint rho.im := by + rw [h_rho_im] + exact h_rho_in_Zt + + have h_bound := lem_Z1splitge2 delta hdelta hdelta_lt_1 rho h_rho_in_zeroZ h_rho_in_Zt' + + convert h_bound using 1 + + simp_rw [← h_rho_im] + + rw [h_rho_re] + +lemma lem_rho_in_Zt (delta : ℝ) (hdelta : delta > 0) (t : ℝ) + (h_rho_zero : (1 : ℂ) + delta + t * Complex.I ∈ zeroZ) : + (1 : ℂ) + delta + t * Complex.I ∈ ZetaZerosNearPoint t := by + + let ρ : ℂ := (1 : ℂ) + delta + t * Complex.I + + have h_re : ρ.re > 1 := by + simp [ρ, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re] + linarith [hdelta] + + have h_nonzero : riemannZeta ρ ≠ 0 := by + apply riemannZeta_ne_zero_of_one_le_re + exact le_of_lt h_re + + have h_zero : riemannZeta ρ = 0 := h_rho_zero + + exact absurd h_zero h_nonzero + +lemma Z1bound : + ∃ C > 1, + ∀ (delta : ℝ), (0 < delta ∧ delta < 1) → + ∀ t : ℝ, 2 < |t| → + ∀ s : ℂ, s ∈ zeroZ ∧ s.im = t → + (-(logDerivZeta ((1 : ℂ) + delta + t * Complex.I))).re + ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by + classical + + obtain ⟨C0, hC0gt1, hExp⟩ := lem_explicit1RealReal + + have hlog5pos : 0 < Real.log 4 := Real.log_pos (by norm_num : (1 : ℝ) < 4) + let C : ℝ := max (C0 + 3 / Real.log 4) 2 + have hCgt1 : 1 < C := by + have : (1 : ℝ) < 2 := by norm_num + exact lt_of_lt_of_le this (le_max_right _ _) + refine ⟨C, hCgt1, ?_⟩ + intro delta hdelta t ht s hs + + set sp : ℂ := (1 : ℂ) + delta + t * Complex.I + set S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite t) + set Sre : ℝ := + Finset.sum S + (fun rho1 : ℂ => + (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (sp - rho1)).re) + + have h_bound : abs ((logDerivZeta sp).re - Sre) + ≤ C0 * Real.log (abs t + 2) := by + simpa [sp, S, Sre] using hExp t ht delta hdelta + + have h_left : -(C0 * Real.log (abs t + 2)) ≤ (logDerivZeta sp).re - Sre := + (abs_le.mp h_bound).1 + have h_neg : -((logDerivZeta sp).re - Sre) ≤ C0 * Real.log (abs t + 2) := by + simpa using neg_le_neg h_left + have h_isol : - (logDerivZeta sp).re ≤ C0 * Real.log (abs t + 2) - Sre := by + have := sub_le_sub_right h_neg Sre + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + + have hS_nonneg : 0 ≤ Sre := by + apply Finset.sum_nonneg + intro rho1 hmem + have hZt : rho1 ∈ ZetaZerosNearPoint t := by + simpa [S, Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite t)] using hmem + + simpa [sp] using + (lem_Re1deltatge0m delta hdelta.1 t hdelta.2 rho1 hZt) + + have h_basic : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) := by + have h_drop : C0 * Real.log (abs t + 2) - Sre ≤ C0 * Real.log (abs t + 2) := + sub_le_self _ hS_nonneg + exact le_trans h_isol h_drop + + by_cases hmem : s ∈ ZetaZerosNearPoint t + · + set sigma : ℝ := s.re + have h_rho_eq : s = (sigma : ℂ) + t * Complex.I := by + have : s = s.re + s.im * Complex.I := by simp [Complex.re_add_im] + simpa [sigma, hs.2] using this + + have hsum_rew := lem_sumrho1 t delta hdelta.1 hdelta.2 + have h_sum_ge' := + lem_Z1splitge3 delta hdelta.1 hdelta.2 sigma t s h_rho_eq hs.1 hmem + have h_sum_ge : Sre ≥ 1 / ((1 : ℝ) + delta - sigma) := by + simpa [sp, S, Sre, hsum_rew] using h_sum_ge' + + have h1 : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) := by + have : (1 / ((1 : ℝ) + delta - sigma)) ≤ Sre := h_sum_ge + have := sub_le_sub_left this (C0 * Real.log (abs t + 2)) + exact le_trans h_isol (by simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this) + + have hCge : C0 ≤ C := + le_trans (by + have : 0 ≤ 3 / Real.log 4 := le_of_lt (div_pos (by norm_num) hlog5pos) + have := add_le_add_right this C0 + simpa using this) (le_max_left _ _) + + have hY_nonneg : 0 ≤ Real.log (abs t + 2) := by + have h2le : (2 : ℝ) ≤ abs t + 2 := by + have h0 : 0 ≤ |t| := abs_nonneg t + simp + exact le_of_lt (Real.log_pos (lt_of_lt_of_le (by norm_num) h2le)) + have h_enlarge : C0 * Real.log (abs t + 2) ≤ C * Real.log (abs t + 2) := + mul_le_mul_of_nonneg_right hCge hY_nonneg + have h2 : C0 * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) ≤ + C * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using + (sub_le_sub_right h_enlarge (1 / ((1 : ℝ) + delta - sigma))) + have := le_trans h1 h2 + simpa [sp, sigma, Complex.neg_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] + using this + · + + have h_notle : ¬ ‖s - ((3/2 : ℂ) + t * Complex.I)‖ ≤ (5/6 : ℝ) := by + intro hle + exact hmem ⟨hs.1, hle⟩ + have hdist_gt : (5/6 : ℝ) < ‖s - ((3/2 : ℂ) + t * Complex.I)‖ := not_le.mp h_notle + + have h_re : (s - ((3/2 : ℂ) + t * Complex.I)).re = s.re - (3/2 : ℝ) := by + simp [Complex.sub_re, Complex.add_re] + have h_im : (s - ((3/2 : ℂ) + t * Complex.I)).im = 0 := by + have : (s - ((3/2 : ℂ) + t * Complex.I)).im = s.im - t := by + simp [Complex.sub_im, Complex.add_im] + simp [hs.2] + have h_eq : s - ((3/2 : ℂ) + t * Complex.I) = (((s.re - (3/2 : ℝ)) : ℝ) : ℂ) := by + apply Complex.ext + · simp [h_re] + · simp [h_im] + have hdist_real : ‖s - ((3/2 : ℂ) + t * Complex.I)‖ = |s.re - (3/2 : ℝ)| := by + simpa [h_eq] using complex_abs_of_real (s.re - (3/2 : ℝ)) + have habs_gt : (5/6 : ℝ) < |s.re - (3/2 : ℝ)| := by simpa [hdist_real] using hdist_gt + + have h0 : riemannZeta (s.re + s.im * Complex.I) = 0 := by + simpa [Complex.re_add_im] using! hs.1 + have hs_le1 : s.re ≤ 1 := lem_sigmale1 s.re s.im h0 + + have h_nonpos : s.re - (3/2 : ℝ) ≤ 0 := by linarith [hs_le1] + have h_abs_eq : |s.re - (3/2 : ℝ)| = (3/2 : ℝ) - s.re := by + have : |s.re - (3/2 : ℝ)| = -(s.re - (3/2 : ℝ)) := abs_of_nonpos h_nonpos + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + have h_gt' : (5/6 : ℝ) < (3/2 : ℝ) - s.re := by simpa [h_abs_eq] using habs_gt + have hs_le_23 : s.re ≤ (2/3 : ℝ) := by linarith [h_gt'] + + have hden_ge : (1/3 : ℝ) ≤ 1 + delta - s.re := by + have : (1/3 : ℝ) ≤ 1 - s.re := by linarith [hs_le_23] + have : 1 - s.re ≤ 1 + delta - s.re := by linarith [hdelta.1] + exact le_trans ‹(1/3 : ℝ) ≤ 1 - s.re› this + have hone_div_le3 : 1 / (1 + delta - s.re) ≤ (3 : ℝ) := by + have : 1 / (1 + delta - s.re) ≤ 1 / (1/3 : ℝ) := + one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1/3) hden_ge + simpa [one_div] using this + have hneg_ge : - (3 : ℝ) ≤ - (1 / (1 + delta - s.re)) := by + simpa using (neg_le_neg hone_div_le3) + + have hlog_ge : Real.log 4 ≤ Real.log (abs t + 2) := by + have : (4 : ℝ) < abs t + 2 := by linarith [ht] + exact Real.log_le_log (by norm_num) (le_of_lt this) + have hC_ge_add : C ≥ C0 + 3 / Real.log 4 := by exact le_max_left _ _ + have hCminus : C - C0 ≥ 3 / Real.log 4 := by linarith + have hY_nonneg : 0 ≤ Real.log (abs t + 2) := by + have h2le : (2 : ℝ) ≤ abs t + 2 := by + have h0 : 0 ≤ |t| := abs_nonneg t + simp + exact le_of_lt (Real.log_pos (lt_of_lt_of_le (by norm_num) h2le)) + have hmul1 : (3 / Real.log 4) * Real.log 4 ≤ (3 / Real.log 4) * Real.log (abs t + 2) := by + have hk_nonneg : 0 ≤ 3 / Real.log 4 := le_of_lt (div_pos (by norm_num) hlog5pos) + exact mul_le_mul_of_nonneg_left hlog_ge hk_nonneg + have hmul2 : (3 / Real.log 4) * Real.log (abs t + 2) ≤ (C - C0) * Real.log (abs t + 2) := by + exact mul_le_mul_of_nonneg_right hCminus hY_nonneg + have hmul_ge3 : (3 : ℝ) ≤ (C - C0) * Real.log (abs t + 2) := by + have hne5 : Real.log 4 ≠ 0 := ne_of_gt hlog5pos + have hcalc : (3 / Real.log 4) * Real.log 4 = 3 := by + simp [div_eq_mul_inv, hne5] + have : (3 / Real.log 4) * Real.log 4 ≤ (C - C0) * Real.log (abs t + 2) := + le_trans hmul1 hmul2 + simpa [hcalc] using this + + have hCmul' : C0 * Real.log (abs t + 2) + 3 ≤ C * Real.log (abs t + 2) := by + have : C0 * Real.log (abs t + 2) + 3 ≤ C0 * Real.log (abs t + 2) + (C - C0) * Real.log (abs t + 2) := by + exact add_le_add_right hmul_ge3 _ + have hcalc : C * Real.log (abs t + 2) = + C0 * Real.log (abs t + 2) + (C - C0) * Real.log (abs t + 2) := by + ring + simpa [hcalc, add_comm, add_left_comm, add_assoc] using this + + have : (-(logDerivZeta sp)).re ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by + have h1 : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) := h_basic + have h2 : C0 * Real.log (abs t + 2) ≤ C * Real.log (abs t + 2) - 3 := by + linarith [hCmul'] + have h3 : C * Real.log (abs t + 2) - 3 ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by + have := add_le_add_left hneg_ge (C * Real.log (abs t + 2)) + simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using this + exact le_trans h1 (le_trans h2 h3) + simpa [sp, Complex.neg_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + +lemma Z0boundRe : +Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => (- (logDerivZeta ((1 : ℂ) + delta))).re - (1 / delta)) (fun _ => (1 : ℝ)) := by + + have h := Z0bound + + have h_eq : (fun (delta : ℝ) => (- (logDerivZeta ((1 : ℂ) + delta))).re - (1 / delta)) = + (fun (delta : ℝ) => (-logDerivZeta ((1 : ℂ) + delta) - (1 / (delta : ℂ))).re) := by + ext delta + rw [Complex.sub_re, Complex.neg_re] + + have : (1 / (delta : ℂ)).re = 1 / delta := by + rw [Complex.div_re, Complex.one_re, Complex.ofReal_re, Complex.ofReal_im] + simp [Complex.normSq_ofReal] + rw [this] + + rw [h_eq] + + rw [Asymptotics.isBigO_iff] at h ⊢ + obtain ⟨c, hc⟩ := h + use c + filter_upwards [hc] with delta h_delta + have : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp + rw [this] at h_delta + have : ‖(1 : ℝ)‖ = (1 : ℝ) := by simp + rw [this] + exact le_trans (Complex.abs_re_le_norm _) h_delta + +lemma extract_bigO_bound_Z0 (delta : ℝ) (_hdelta : delta > 0) : ∃ C0 > 0, (-logDerivZeta ((1 : ℂ) + delta)).re ≤ 1 / delta + C0 := by + + let target := (-logDerivZeta ((1 : ℂ) + delta)).re + let base := 1 / delta + + use max 1 (target - base + 1) + + constructor + · + exact lt_of_lt_of_le zero_lt_one (le_max_left 1 (target - base + 1)) + + · + + by_cases h : target - base + 1 ≤ 1 + · + have h_max : max 1 (target - base + 1) = 1 := max_eq_left h + rw [h_max] + + linarith [h] + · + have h_max : max 1 (target - base + 1) = target - base + 1 := max_eq_right (le_of_not_ge h) + rw [h_max] + + linarith + +lemma uniform_bound_Z0 : ∃ δ0 > 0, ∃ C0 ≥ 0, ∀ δ : ℝ, 0 < δ → δ < δ0 → (- (logDerivZeta ((1 : ℂ) + δ))).re ≤ 1 / δ + C0 := by + + let f : ℝ → ℝ := fun δ => (- (logDerivZeta ((1 : ℂ) + δ))).re - (1 / δ) + + have hO := Z0boundRe + + rcases (Asymptotics.isBigO_iff).1 hO with ⟨c, hc⟩ + + have h1norm : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c := by + + have : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c * ‖(1 : ℝ)‖ := hc + refine this.mono ?_ + intro δ hδ + simpa using (by simpa using hδ) + + rcases (Filter.eventually_iff_exists_mem).1 h1norm with ⟨S, hS_in, hS_bound⟩ + + rcases (mem_nhdsGT_iff_exists_Ioc_subset).1 hS_in with ⟨δ0, hδ0pos, hIoc_sub_S⟩ + + refine ⟨δ0, hδ0pos, max c 0, le_max_right _ _, ?_⟩ + intro δ hδpos hδlt + + have hδ_in_S : δ ∈ S := hIoc_sub_S ⟨hδpos, le_of_lt hδlt⟩ + + have hnorm_le_c : ‖f δ‖ ≤ c := hS_bound δ hδ_in_S + + have hnorm_le_C0 : ‖f δ‖ ≤ max c 0 := le_trans hnorm_le_c (le_max_left _ _) + + have h_upper : f δ ≤ max c 0 := by + have : |f δ| ≤ max c 0 := by simpa [Real.norm_eq_abs] using hnorm_le_C0 + exact (abs_le.mp this).2 + + have := (sub_le_iff_le_add).1 h_upper + simpa [f, add_comm] using this + +lemma eventually_atTop_sup_atBot_iff_abs {P : ℝ → Prop} : + (∀ᶠ t in (Filter.atTop ⊔ Filter.atBot), P t) ↔ ∃ T : ℝ, ∀ t : ℝ, T ≤ |t| → P t := by + constructor + · intro h + have h' := (Filter.eventually_sup).1 h + rcases h' with ⟨hTop, hBot⟩ + rcases (Filter.eventually_atTop).1 hTop with ⟨A, hA⟩ + rcases (Filter.eventually_atBot).1 hBot with ⟨B, hB⟩ + refine ⟨max A (-B), ?_⟩ + intro t ht + have hcases : max A (-B) ≤ t ∨ max A (-B) ≤ -t := (le_abs).1 ht + cases hcases with + | inl hTle_t => + have hA_le_t : A ≤ t := le_trans (le_max_left A (-B)) hTle_t + exact hA t hA_le_t + | inr hTle_neg_t => + have h_negB_le_neg_t : -B ≤ -t := le_trans (le_max_right A (-B)) hTle_neg_t + have h_t_le_B : t ≤ B := (neg_le_neg_iff).1 h_negB_le_neg_t + exact hB t h_t_le_B + · intro h + rcases h with ⟨T, hT⟩ + refine (Filter.eventually_sup).2 ?_ + constructor + · + refine (Filter.eventually_atTop).2 ?_ + refine ⟨max T 0, ?_⟩ + intro t ht + have ht0 : 0 ≤ t := le_trans (le_max_right T 0) ht + have hTle : T ≤ |t| := by + have : T ≤ t := le_trans (le_max_left T 0) ht + simpa [abs_of_nonneg ht0] using this + exact hT t hTle + · + refine (Filter.eventually_atBot).2 ?_ + refine ⟨-max T 0, ?_⟩ + intro t ht + have ht0 : t ≤ 0 := by + have hnegmax_le_0 : -max T 0 ≤ 0 := by + simp + exact le_trans ht hnegmax_le_0 + have hTle : T ≤ |t| := by + have h1 : max T 0 ≤ -t := by + have := (neg_le_neg ht) + + simpa using this + have : T ≤ -t := le_trans (le_max_left T 0) h1 + simpa [abs_of_nonpos ht0] using this + exact hT t hTle + +lemma re_sum_three (a b : ℝ) (x y z : ℂ) : ((a * x) + (b * y) + z).re = a * x.re + b * y.re + z.re := by + + simp [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, add_assoc] + +lemma log_abs_add_two_ge_one (t : ℝ) (ht : Real.exp 1 - 2 ≤ |t|) : (1 : ℝ) ≤ Real.log (|t| + 2) := by + have hx : Real.exp 1 ≤ |t| + 2 := by + have h' := add_le_add_left ht (2 : ℝ) + simpa [sub_add_cancel] using! h' + have hxpos : 0 < |t| + 2 := by + have two_pos : 0 < (2 : ℝ) := by norm_num + exact add_pos_of_nonneg_of_pos (abs_nonneg t) two_pos + exact (Real.le_log_iff_exp_le hxpos).2 hx + +lemma log_abs_add_two_ge_of_threshold (K t : ℝ) (ht : Real.exp K - 2 ≤ |t|) : K ≤ Real.log (|t| + 2) := by + have hx : Real.exp K ≤ |t| + 2 := by + have h' := add_le_add_left ht (2 : ℝ) + simpa [sub_add_cancel] using! h' + have hxpos : 0 < |t| + 2 := by + have two_pos : 0 < (2 : ℝ) := by norm_num + exact add_pos_of_nonneg_of_pos (abs_nonneg t) two_pos + exact (Real.le_log_iff_exp_le hxpos).2 hx + +lemma re_ofReal_add_ofReal_add (a b : ℝ) (z : ℂ) : (a + b + z).re = a + b + z.re := by + simp [Complex.add_re, Complex.ofReal_re, add_assoc] + +lemma algebraic_rewrite_RHS (δ s L C0 C1 C2 : ℝ) : + 3 * (1 / δ + C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L = + 3 / δ - 4 / (1 + δ - s) + (4 * C1 + C2) * L + 3 * C0 := by + have hA : 3 * (1 / δ + C0) = 3 * (1 / δ) + 3 * C0 := by + simp [mul_add] + have hB2 : + 4 * (-(1 / (1 + δ - s)) + C1 * L) = + -(4 * (1 / (1 + δ - s))) + (4 * C1) * L := by + calc + 4 * (-(1 / (1 + δ - s)) + C1 * L) + = 4 * (-(1 / (1 + δ - s))) + 4 * (C1 * L) := by + simp [mul_add] + _ = -(4 * (1 / (1 + δ - s))) + (4 * C1) * L := by + simp [mul_comm, mul_assoc] + calc + 3 * (1 / δ + C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L + = (3 * (1 / δ) + 3 * C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L := by + rw [hA] + _ = (3 * (1 / δ) + 3 * C0) + (-(4 * (1 / (1 + δ - s))) + (4 * C1) * L) + C2 * L := by + rw [hB2] + _ = (3 / δ + 3 * C0) + (- 4 / (1 + δ - s) + (4 * C1) * L) + C2 * L := by + simp [div_eq_mul_inv] + _ = 3 / δ - 4 / (1 + δ - s) + (4 * C1) * L + C2 * L + 3 * C0 := by + ring + _ = 3 / δ - 4 / (1 + δ - s) + (4 * C1 + C2) * L + 3 * C0 := by + ring + +lemma absorb_pos_constant_into_log {L A c : ℝ} (hL : 1 ≤ L) (hc : 0 ≤ c) : A * L + c ≤ (A + c) * L := by + + have hc_le : c ≤ L * c := by + have h := mul_le_mul_of_nonneg_right hL hc + simpa [one_mul] using h + + have h0 : A * L + c ≤ A * L + L * c := by + exact add_le_add_right hc_le (A * L) + calc + A * L + c ≤ A * L + L * c := h0 + _ = A * L + c * L := by simp [mul_comm] + _ = (A + c) * L := by simp [right_distrib] + +lemma neg_logDeriv_zeta_eq_vonMangoldt_sum (s : ℂ) (hs : 1 < s.re) : -(deriv riemannZeta s / riemannZeta s) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-s) := by + + have h1 := ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs + + have h2 : -deriv riemannZeta s / riemannZeta s = LSeries (fun n => ↑(ArithmeticFunction.vonMangoldt n)) s := h1.symm + + have h3 : -(deriv riemannZeta s / riemannZeta s) = -deriv riemannZeta s / riemannZeta s := by ring + rw [h3, h2] + + rw [LSeries] + congr 1 + ext n + rw [LSeries.term_def] + split_ifs with h_zero + · + simp [h_zero] + · + rw [div_eq_mul_inv, Complex.cpow_neg] + +lemma zeta1zetaseries {s : ℂ} (hs : 1 < s.re) : +-logDerivZeta s = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-s) := by + unfold logDerivZeta + + exact neg_logDeriv_zeta_eq_vonMangoldt_sum s hs + +lemma zeta1zetaseriesxy (x y : ℝ) (hx : 1 < x) : + -logDerivZeta (x + y * I) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I)) := by + apply zeta1zetaseries + + have h : (x + y * I).re = x := by + simp [Complex.add_re, Complex.ofReal_re, Complex.ofReal_im] + right + exact Complex.I_re + rw [h] + exact hx + +lemma Zconverges1 (x y : ℝ) (hx : 1 < x) : riemannZeta (x + y * I) ≠ 0 := by + apply riemannZeta_ne_zero_of_one_lt_re + + have h : (x + y * I).re = x := by + rw [Complex.add_re, Complex.ofReal_re] + simp [Complex.mul_re] + right + exact Complex.I_re + rw [h] + exact hx + +lemma complex_re_of_real_add_imag (x y : ℝ) : (x + y * I).re = x := by + simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im] + + right + exact Complex.I_re + +lemma vonMangoldt_LSeriesSummable (s : ℂ) (hs : 1 < s.re) : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) s := by + + exact ArithmeticFunction.LSeriesSummable_vonMangoldt hs + +lemma summable_of_support_singleton {α : Type*} [SeminormedAddCommGroup α] (f : ℕ → α) (n₀ : ℕ) (h : ∀ n : ℕ, n ≠ n₀ → f n = 0) : Summable f := by + + have h_finite_support : Set.Finite (Function.support f) := by + + have h_subset : Function.support f ⊆ {n₀} := by + intro n hn + + by_contra h_ne + + have h_zero : f n = 0 := h n h_ne + + simp [Function.mem_support] at hn + exact hn h_zero + + exact Set.Finite.subset (Set.finite_singleton n₀) h_subset + + exact summable_of_hasFiniteSupport h_finite_support + +lemma summable_of_summable_add_sub {α : Type*} [SeminormedAddCommGroup α] (f g h : ℕ → α) (h_eq : f = g + h) (hf : Summable f) (hh : Summable h) : Summable g := by + + have g_eq_f_sub_h : g = f - h := by + + rw [← sub_eq_iff_eq_add] at h_eq + exact h_eq.symm + + rw [g_eq_f_sub_h] + + exact hf.sub hh + +lemma LSeriesSummable_to_summable (f : ℕ → ℂ) (s : ℂ) (h : LSeriesSummable f s) : Summable (fun n => f n * (n : ℂ) ^ (-s)) := by + + have h_term_summable : Summable (LSeries.term f s) := h + + have h_eq_nonzero : ∀ n : ℕ, n ≠ 0 → LSeries.term f s n = f n * (n : ℂ) ^ (-s) := by + intro n hn + rw [LSeries.term_of_ne_zero hn] + rw [div_eq_mul_inv, Complex.cpow_neg] + + let diff := fun n => LSeries.term f s n - f n * (n : ℂ) ^ (-s) + + have h_diff_support : ∀ n : ℕ, n ≠ 0 → diff n = 0 := by + intro n hn + simp only [diff] + rw [h_eq_nonzero n hn] + simp + + have h_diff_summable : Summable diff := by + + apply summable_of_support_singleton diff 0 h_diff_support + + have h_rw : LSeries.term f s = (fun n => f n * (n : ℂ) ^ (-s)) + diff := by + ext n + simp only [diff, Pi.add_apply] + ring + + exact summable_of_summable_add_sub (LSeries.term f s) (fun n => f n * (n : ℂ) ^ (-s)) diff h_rw h_term_summable h_diff_summable + +lemma ReZconverges1 (x y : ℝ) (hx : 1 < x) : +Summable (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) := by + + have h_nonzero : riemannZeta (x + y * I) ≠ 0 := Zconverges1 x y hx + + have h_re_gt_one : 1 < (x + y * I).re := by + rw [complex_re_of_real_add_imag] + exact hx + + have h_L_summable : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) := + vonMangoldt_LSeriesSummable (x + y * I) h_re_gt_one + + have h_summable : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) := + LSeriesSummable_to_summable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) h_L_summable + + have h_hasSum : HasSum (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) := + h_summable.hasSum + + have h_hasSum_re : HasSum (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))).re) (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))).re := + Complex.hasSum_re h_hasSum + + exact h_hasSum_re.summable + +lemma exprule (n : ℕ) (hn : n ≥ 1) (alpha beta : ℂ) : (n : ℂ) ^ (alpha + beta) = (n : ℂ) ^ alpha * (n : ℂ) ^ beta := by + apply Complex.cpow_add + + rw [Nat.cast_ne_zero] + + rw [← Nat.one_le_iff_ne_zero] + exact hn + +lemma lem_nxy (n : ℕ) (hn : n ≥ 1) (x y : ℝ) : + Complex.cpow (n : ℂ) (-(x + y * I)) = Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) := by + + have h : -(x + y * I) = (-x : ℂ) + (-(y * I)) := by ring + rw [h] + + exact lem_exprule n hn (-x : ℂ) (-(y * I)) + +lemma lem_zeta1zetaseriesxy2 (x y : ℝ) (hx : 1 < x) : + -logDerivZeta (x + y * I) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (Complex.cpow (n : ℂ) ((-x) : ℂ)) * (Complex.cpow (n : ℂ) (-(y * I))) := by + + rw [zeta1zetaseriesxy x y hx] + + congr 1 + ext n + + rw [← Complex.cpow_eq_pow] + + by_cases h : n = 0 + · + simp [h] + · + have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + rw [lem_nxy n hn x y] + + ring + +lemma complex_add_re_ofReal_mul_I (x y : ℝ) : (x + y * I).re = x := by + rw [Complex.add_re, Complex.ofReal_re, Complex.re_ofReal_mul] + + have h : I.re = 0 := Complex.I_re + rw [h] + simp + +lemma LSeriesSummable_to_explicit_summable (x y : ℝ) (_hx : 1 < x) : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) → Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))) := by + intro h_summable + + have h_vm_zero : (ArithmeticFunction.vonMangoldt 0 : ℂ) = 0 := by + simp + + have h_eq : ∀ n : ℕ, LSeries.term (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) n = + (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) := by + intro n + + rw [LSeries.term_def₀ h_vm_zero] + + rw [← Complex.cpow_eq_pow] + + by_cases hn : n = 0 + · + simp [hn] + · + have hn_ge : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr hn + rw [lem_nxy n hn_ge x y] + ring + + have h_term_summable : Summable (fun n => LSeries.term (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) n) := by + exact h_summable + + convert h_term_summable using 1 + ext n + exact (h_eq n).symm + +lemma Zseriesconverges1 (x y : ℝ) (hx : 1 < x) : +Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))) := by + + have h_zeta_ne_zero := Zconverges1 x y hx + + have h_series := lem_zeta1zetaseriesxy2 x y hx + + have h_re : 1 < (x + y * I).re := by + rw [complex_add_re_ofReal_mul_I] + exact hx + + have h_summable := ArithmeticFunction.LSeriesSummable_vonMangoldt h_re + + exact LSeriesSummable_to_explicit_summable x y hx h_summable + +lemma lem_realnx (n : ℕ) (x : ℝ) (_hn : n ≥ 1) (_hx : x ≥ 1) : + ArithmeticFunction.vonMangoldt n * (n : ℝ) ^ (-x) ≥ 0 := by + apply mul_nonneg + · + exact ArithmeticFunction.vonMangoldt_nonneg + · + apply Real.rpow_nonneg + + exact Nat.cast_nonneg n + +lemma sumReal {v : ℕ → ℂ} {v_sum : ℂ} (h_sum : HasSum v v_sum) : + HasSum (fun n => (v n).re) v_sum.re := by + exact Complex.hasSum_re h_sum + +lemma sumRealLambda (x y : ℝ) (hx : 1 < x) : + (∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re = + ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re := by + apply Complex.re_tsum + exact Zseriesconverges1 x y hx + +lemma lem_sumRealZ (x y : ℝ) (hx : 1 < x) : + (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re := by + + rw [lem_zeta1zetaseriesxy2 x y hx] + + exact sumRealLambda x y hx + +lemma complex_cpow_neg_real (n : ℕ) (x : ℝ) (_hn : n ≥ 1) : Complex.cpow (n : ℂ) ((-x) : ℂ) = Complex.ofReal ((n : ℝ) ^ (-x)) := by + + have h_nonneg : 0 ≤ (n : ℝ) := Nat.cast_nonneg n + + rw [Complex.cpow_eq_pow] + + rw [Complex.ofReal_cpow h_nonneg (-x)] + + congr 1 + + simp + +lemma RealLambdaxy (n : ℕ) (x y : ℝ) (hn : n ≥ 1) (_hx : 1 < x) : + ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re = +((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) * (Complex.cpow (n : ℂ) (-(y * I))).re := by + + let b := ArithmeticFunction.vonMangoldt n * (n : ℝ) ^ (-x) + + have h1 : (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) = (b : ℂ) := by + + have h_real_pow : Complex.cpow (n : ℂ) ((-x) : ℂ) = Complex.ofReal ((n : ℝ) ^ (-x)) := by + exact complex_cpow_neg_real n x hn + + rw [h_real_pow] + rw [← Complex.ofReal_mul] + + have h2 : (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) = + ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ)) * Complex.cpow (n : ℂ) (-(y * I)) := by + rw [mul_assoc] + + rw [h2, h1] + + exact lem_realbw b (Complex.cpow (n : ℂ) (-(y * I))) + +lemma ReZseriesRen (x y : ℝ) (hx : 1 < x) : + (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) * (Complex.cpow (n : ℂ) (-(y * I))).re := by + rw [lem_sumRealZ x y hx] + congr 1 + ext n + by_cases h : n = 0 + · simp [h] + · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + exact RealLambdaxy n x y hn hx + +lemma Rezeta1zetaseries (x y : ℝ) (hx : 1 < x) : + (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by + rw [ReZseriesRen x y hx] + congr 1 + ext n + by_cases h : n = 0 + · simp [h] + · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + rw [← lem_eacosalog3 n hn y] + + congr 1 + + rw [Complex.cpow_eq_pow] + + simp [I] + +lemma complex_vonMangoldt_real_part_eq (n : ℕ) (x y : ℝ) (hn : n ≥ 1) (hx : 1 < x) : +((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re = +(ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by + + rw [lem_nxy n hn x y] + + rw [← mul_assoc] + + rw [RealLambdaxy n x y hn hx] + + have h_cpow : (Complex.cpow (n : ℂ) (-(y * I))).re = ((n : ℂ) ^ (-(y * I))).re := by + rw [Complex.cpow_eq_pow] + + have h_I : -(y * I) = -y * Complex.I := by + simp [I] + + rw [h_cpow, h_I] + + rw [lem_eacosalog3 n hn y] + +lemma Rezetaseries_convergence (x y : ℝ) (hx : 1 < x) : + Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ))) := by + + have h1 : Summable (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) := + ReZconverges1 x y hx + + have h2 : ∀ n : ℕ, ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re = + (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by + intro n + by_cases h : n = 0 + · simp [h] + · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + exact complex_vonMangoldt_real_part_eq n x y hn hx + + have h3 : (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) = + (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ))) := + funext h2 + rwa [← h3] + +lemma Rezetaseries2t (x t : ℝ) (hx : 1 < x) : + Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (2 * t * Real.log (n : ℝ))) := by + + exact Rezetaseries_convergence x (2 * t) hx + +lemma lem_cost0 (n : ℕ) (_hn : n ≥ 1) (t : ℝ) (ht : t = 0) : Real.cos (t * Real.log (n : ℝ)) = 1 := by + rw [ht] + simp + +lemma Rezetaseries0 (x : ℝ) (hx : 1 < x) : + Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) := by + + have h1 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (0 * Real.log (n : ℝ))) := + Rezetaseries_convergence x 0 hx + + convert h1 using 1 + ext n + by_cases h : n = 0 + · simp [h] + · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + rw [lem_cost0 n hn 0 rfl] + ring + +lemma uniform_bound_Z0_complex : ∃ δ0 > 0, ∃ C0 ≥ 0, ∀ δ : ℝ, 0 < δ → δ < δ0 → ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C0 := by + + let f : ℝ → ℂ := fun δ => -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ)) + + have hO := Z0bound + + rcases (Asymptotics.isBigO_iff).1 hO with ⟨c, hc⟩ + have h_event : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c := by + + have : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c * ‖(1 : ℂ)‖ := hc + refine this.mono ?_ + intro δ hδ + have : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp + simpa [this] using hδ + + rcases (Filter.eventually_iff_exists_mem).1 h_event with ⟨S, hS_in, hS_bound⟩ + + rcases (mem_nhdsGT_iff_exists_Ioc_subset).1 hS_in with ⟨δ0, hδ0pos, hIoc_sub_S⟩ + + refine ⟨δ0, hδ0pos, max c 0, le_max_right _ _, ?_⟩ + intro δ hδpos hδlt + + have hδ_in_S : δ ∈ S := hIoc_sub_S ⟨hδpos, le_of_lt hδlt⟩ + + have hnorm_le_c : ‖f δ‖ ≤ c := hS_bound δ hδ_in_S + + exact le_trans hnorm_le_c (le_max_left _ _) + +lemma cpow_neg_zero_I (z : ℂ) : z ^ (-(0 : ℝ) * Complex.I) = (1 : ℂ) := by + simp + +lemma tsum_nonneg_of_nonneg {f : ℕ → ℝ} (hnon : ∀ n, 0 ≤ f n) : 0 ≤ ∑' n, f n := by + simpa using (tsum_nonneg hnon) + +lemma vonMangoldt_rpow_nonneg (x : ℝ) : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) := by + intro n + have h1 : 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) := ArithmeticFunction.vonMangoldt_nonneg + have h2 : 0 ≤ (n : ℝ) ^ (-x) := by + exact Real.rpow_nonneg (show 0 ≤ (n : ℝ) from Nat.cast_nonneg n) _ + simpa using mul_nonneg h1 h2 + +lemma cpow_neg_real_of_nat (n : ℕ) (x : ℝ) (hn : 1 ≤ n) : + (n : ℂ) ^ (-(x : ℂ)) = Complex.ofReal ((n : ℝ) ^ (-x)) := by + simpa using complex_cpow_neg_real n x hn + +lemma norm_negLogDerivZeta_real_eq_abs_tsum_vonMangoldt (x : ℝ) (hx : 1 < x) : + ‖-logDerivZeta (x : ℂ)‖ = |∑' n, ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x))| := by + + have hx' : 1 < (x : ℂ).re := by simpa using hx + have hseries := zeta1zetaseries (s := (x : ℂ)) hx' + + let g : ℕ → ℝ := fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) + have hterm : ∀ n : ℕ, + (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ)) = (g n : ℂ) := by + intro n + by_cases h : n = 0 + · + have hv0C : (ArithmeticFunction.vonMangoldt 0 : ℂ) = 0 := by + simp + have hv0R : (ArithmeticFunction.vonMangoldt 0 : ℝ) = 0 := by + simp + simp [g, h, hv0R] + · + have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h + have hcp : (n : ℂ) ^ (-(x : ℂ)) = Complex.ofReal ((n : ℝ) ^ (-x)) := + complex_cpow_neg_real n x hn + + have : (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ)) + = Complex.ofReal (ArithmeticFunction.vonMangoldt n) * Complex.ofReal ((n : ℝ) ^ (-x)) := by + simp [hcp] + simpa [g, Complex.ofReal_mul] using this + + have hsum_eq : (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ))) + = ∑' n, (g n : ℂ) := by + + have hfun : (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ))) + = (fun n => (g n : ℂ)) := funext hterm + simp [hfun] + + have hsum_ofReal : (∑' n, (g n : ℂ)) = Complex.ofReal (∑' n, g n) := by + simpa using (Complex.ofReal_tsum g).symm + + have hval : -logDerivZeta (x : ℂ) = Complex.ofReal (∑' n, g n) := by + + simpa [hsum_eq, hsum_ofReal] using hseries + + calc + ‖-logDerivZeta (x : ℂ)‖ = ‖Complex.ofReal (∑' n, g n)‖ := by simp [hval] + _ = |∑' n, g n| := by + exact (RCLike.norm_ofReal (K := ℂ) (∑' n, g n)) + +lemma tsum_le_of_nonneg_of_le {f g : ℕ → ℝ} (hf : Summable f) (hg : Summable g) (_hnonneg : ∀ n, 0 ≤ f n) (hle : ∀ n, f n ≤ g n) : (∑' n, f n) ≤ (∑' n, g n) := by + classical + exact Summable.tsum_le_tsum hle hf hg + +lemma rpow_neg_antitone {a x y : ℝ} (ha : 1 ≤ a) (hxy : x ≥ y) : a ^ (-x) ≤ a ^ (-y) := by + + simpa using (Real.rpow_le_rpow_of_exponent_le ha (neg_le_neg hxy)) + +lemma isPrimePow_zero_false : IsPrimePow 0 = False := by + apply propext + constructor + · intro h + rcases (isPrimePow_nat_iff 0).1 h with ⟨p, k, hp, hkpos, hk⟩ + have hpnz : (p : ℕ) ≠ 0 := by + exact ne_of_gt (Nat.Prime.pos hp) + have hpow_ne : (p : ℕ) ^ k ≠ 0 := pow_ne_zero _ hpnz + exact (hpow_ne (by simp [hk])) + · intro hFalse + exact hFalse.elim + +lemma bounded_on_compact_interval (a b : ℝ) (h0 : 0 < a) (_hle : a ≤ b) : ∃ Cmid ≥ 0, ∀ δ : ℝ, a ≤ δ → δ ≤ b → ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ Cmid := by + + let s : Set ℝ := Set.Icc a b + let f : ℝ → ℂ := fun δ => -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ)) + + let H : ℂ → ℂ := Function.update (fun z : ℂ => (z - 1) * riemannZeta z) 1 1 + + have hH_diff : Differentiable ℂ H := by + intro z + rcases eq_or_ne z 1 with rfl | hz + · + refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt + · + filter_upwards [self_mem_nhdsWithin] with t ht + have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) t := by + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := + (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta t := + (differentiableAt_riemannZeta ht) + exact h1.mul h2 + apply DifferentiableAt.congr_of_eventuallyEq hdiff + filter_upwards [eventually_ne_nhds ht] with u hu using by + simp [H, Function.update_of_ne hu] + · + simpa [H, continuousAt_update_same] using riemannZeta_residue_one + · + have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) z := by + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta z := (differentiableAt_riemannZeta hz) + exact h1.mul h2 + apply DifferentiableAt.congr_of_eventuallyEq hdiff + filter_upwards [eventually_ne_nhds hz] with u hu using by + simp [H, Function.update_of_ne hu] + + let G : ℂ → ℂ := fun z => - (deriv H z) / H z + + have h_eq_on_pos : ∀ ⦃δ : ℝ⦄, 0 < δ → + (-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))) = G ((1 : ℂ) + δ) := by + intro δ hδ + + let z : ℂ := (1 : ℂ) + δ + have hz_ne_one : z ≠ (1 : ℂ) := by + intro h + have hre : (1 + δ : ℝ) = 1 := by + simpa [z, Complex.add_re, Complex.ofReal_re] using congrArg Complex.re h + have : δ = 0 := by linarith + exact (ne_of_gt hδ) this + have hzeta_ne : riemannZeta z ≠ 0 := by + have : 1 < z.re := by simpa [z, Complex.add_re, Complex.ofReal_re] using by linarith + exact riemannZeta_ne_zero_of_one_le_re (le_of_lt this) + + have h_id_deriv : deriv (fun u : ℂ => u - 1) z = 1 := by + exact ((hasDerivAt_id z).sub_const 1).deriv + have h_log_id : logDeriv (fun u : ℂ => u - 1) z = 1 / (z - 1) := by + simp [logDeriv_apply, h_id_deriv] + have hz1 : z - 1 ≠ 0 := by simpa using sub_ne_zero.mpr hz_ne_one + have hζ : riemannZeta z ≠ 0 := hzeta_ne + + have h_deriv_mul : deriv (fun u : ℂ => (u - 1) * riemannZeta u) z + = riemannZeta z + (z - 1) * deriv riemannZeta z := by + have h1 : HasDerivAt (fun u : ℂ => u - 1) 1 z := (hasDerivAt_id z).sub_const 1 + have h2 : HasDerivAt riemannZeta (deriv riemannZeta z) z := + (differentiableAt_riemannZeta hz_ne_one).hasDerivAt + simpa [one_mul, mul_comm, mul_left_comm, mul_assoc] using! (h1.mul h2).deriv + + have h_prodLog : + logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = + logDeriv (fun u : ℂ => u - 1) z + logDerivZeta z := by + have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) + have h2 : DifferentiableAt ℂ riemannZeta z := (differentiableAt_riemannZeta hz_ne_one) + have hfnz : (fun u : ℂ => u - 1) z ≠ 0 := by simpa using hz1 + have hgnz : riemannZeta z ≠ 0 := hζ + simpa [logDerivZeta] using! + (logDeriv_mul (x := z) (f := fun u : ℂ => u - 1) (g := riemannZeta) hfnz hgnz h1 h2) + + have h_step : -logDerivZeta z - (1 / (z - 1)) + = - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z := by + have : logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z + = 1 / (z - 1) + logDerivZeta z := by + simpa [h_log_id, add_comm] using h_prodLog + have hneg : - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z + = - (1 / (z - 1) + logDerivZeta z) := by + simpa using congrArg Neg.neg this + simpa [sub_eq_add_neg, add_comm] using hneg.symm + + have h_H_eq : H z = (z - 1) * riemannZeta z := by + simp [H, Function.update_of_ne hz_ne_one] + + have h_eq_event : (fun u : ℂ => H u) =ᶠ[nhds z] (fun u : ℂ => (u - 1) * riemannZeta u) := by + filter_upwards [eventually_ne_nhds hz_ne_one] with u hu + simp [H, Function.update_of_ne hu] + + have h_hasDeriv_prod : + HasDerivAt (fun u : ℂ => (u - 1) * riemannZeta u) + (riemannZeta z + (z - 1) * deriv riemannZeta z) z := by + have h1 : HasDerivAt (fun u : ℂ => u - 1) 1 z := (hasDerivAt_id z).sub_const 1 + have h2 : HasDerivAt riemannZeta (deriv riemannZeta z) z := + (differentiableAt_riemannZeta hz_ne_one).hasDerivAt + simpa [one_mul, mul_comm, mul_left_comm, mul_assoc] using! (h1.mul h2) + + have h_hasDeriv_H : + HasDerivAt H (riemannZeta z + (z - 1) * deriv riemannZeta z) z := + h_hasDeriv_prod.congr_of_eventuallyEq h_eq_event + + have h_dH : deriv H z = riemannZeta z + (z - 1) * deriv riemannZeta z := by + simpa using h_hasDeriv_H.deriv + + have h_log_to_G : - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = G z := by + have h' : logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = (deriv H z) / H z := by + simp [logDeriv_apply, h_H_eq, h_dH, h_deriv_mul] + have hneg' := congrArg (fun w => -w) h' + simpa [G, neg_div] using hneg' + + have : -logDerivZeta z - (1 / (z - 1)) = G z := by + simpa using h_step.trans h_log_to_G + + simpa [z] using this + + let F : ℝ → ℂ := fun δ => G ((1 : ℂ) + δ) + + have hH_analytic_univ : AnalyticOnNhd ℂ H Set.univ := + (Complex.analyticOnNhd_univ_iff_differentiable).2 hH_diff + + have hF_contOn : ContinuousOn F s := by + intro δ0 hδ0 + + let s0 : ℂ := (1 : ℂ) + δ0 + have hδ0pos : 0 < δ0 := lt_of_lt_of_le h0 hδ0.1 + have hs0_ne_one : s0 ≠ (1 : ℂ) := by + intro h + have hre : (1 + δ0 : ℝ) = 1 := by + simpa [s0, Complex.add_re, Complex.ofReal_re] using congrArg Complex.re h + have : δ0 = 0 := by linarith + exact (ne_of_gt hδ0pos) this + have hs0_re_gt_one : 1 < s0.re := by + simpa [s0, Complex.add_re, Complex.ofReal_re] using by linarith + have hζ_ne : riemannZeta s0 ≠ 0 := + riemannZeta_ne_zero_of_one_le_re (le_of_lt hs0_re_gt_one) + have hHs0_eq : H s0 = (s0 - 1) * riemannZeta s0 := by + simp [H, Function.update_of_ne hs0_ne_one] + have hHs0_ne : H s0 ≠ 0 := by + have hs0m1_ne : s0 - 1 ≠ 0 := sub_ne_zero.mpr hs0_ne_one + have : (s0 - 1) * riemannZeta s0 ≠ 0 := mul_ne_zero hs0m1_ne hζ_ne + simpa [hHs0_eq] using this + + have hH_an_at_s0 : AnalyticAt ℂ H s0 := hH_analytic_univ s0 (by simp) + have hH'_an_at_s0 : AnalyticAt ℂ (fun z => deriv H z) s0 := hH_an_at_s0.deriv + have hG_an_at_s0 : AnalyticAt ℂ (fun z => G z) s0 := by + have h_div : AnalyticAt ℂ (fun z => (deriv H z) / H z) s0 := + hH'_an_at_s0.div hH_an_at_s0 (by simpa using hHs0_ne) + have h_neg : AnalyticAt ℂ (fun z => -((deriv H z) / H z)) s0 := h_div.neg + simpa [G, div_eq_mul_inv, mul_left_comm, mul_comm, mul_assoc] using h_neg + have hG_cont_s0 : ContinuousAt (fun z : ℂ => G z) s0 := hG_an_at_s0.continuousAt + + let affine : ℝ → ℂ := fun δ => (1 : ℂ) + (δ : ℂ) + have h_affine_at : ContinuousAt affine δ0 := + (continuousAt_const).add Complex.continuous_ofReal.continuousAt + + have hy : affine δ0 = s0 := by simp [affine, s0] + have hG_at : ContinuousAt (fun z : ℂ => G z) (affine δ0) := by simpa [hy] using hG_cont_s0 + have h_comp_at : ContinuousAt (fun δ : ℝ => G (affine δ)) δ0 := hG_at.comp h_affine_at + simpa [F, s, affine] using h_comp_at.continuousWithinAt + + have h_eq_on_s : ∀ ⦃δ : ℝ⦄, δ ∈ s → f δ = F δ := by + intro δ hδ + have hδpos : 0 < δ := lt_of_lt_of_le h0 hδ.1 + simpa [f, F] using h_eq_on_pos hδpos + + have hK : IsCompact s := isCompact_Icc + have hNorm_contOn : ContinuousOn (fun δ => ‖F δ‖) s := hF_contOn.norm + have hBdd : BddAbove ((fun δ => ‖F δ‖) '' s) := IsCompact.bddAbove_image hK hNorm_contOn + rcases hBdd with ⟨C, hC⟩ + + refine ⟨max C 0, le_max_right _ _, ?_⟩ + intro δ hδa hδb + + change ‖f δ‖ ≤ max C 0 + have hδmem : δ ∈ s := ⟨hδa, hδb⟩ + have himg : (fun δ => ‖F δ‖) δ ∈ (fun δ => ‖F δ‖) '' s := ⟨δ, hδmem, rfl⟩ + have hbound : ‖F δ‖ ≤ C := hC himg + have hbound' : ‖F δ‖ ≤ max C 0 := le_trans hbound (le_max_left _ _) + + have hfδ_eq : f δ = F δ := h_eq_on_s hδmem + calc + ‖f δ‖ = ‖F δ‖ := by simp [hfδ_eq] + _ ≤ max C 0 := hbound' + +lemma norm_one_div_coe_real_le_one_of_one_le {δ : ℝ} (h : 1 ≤ δ) : ‖(1 : ℂ) / (δ : ℂ)‖ ≤ 1 := by + + have hδpos : 0 < δ := lt_of_lt_of_le zero_lt_one h + calc + ‖(1 : ℂ) / (δ : ℂ)‖ = ‖(1 : ℂ)‖ / ‖(δ : ℂ)‖ := by + exact norm_div (1 : ℂ) (δ : ℂ) + _ = 1 / ‖(δ : ℂ)‖ := by simp + _ = 1 / |δ| := by simp + _ = 1 / δ := by simp [abs_of_nonneg (le_of_lt hδpos)] + _ ≤ 1 := by + + simpa using (one_div_le_one_div_of_le (ha := (zero_lt_one)) (h := h)) + +lemma Z0bound_const : + ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), + ‖ -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C := by + + rcases uniform_bound_Z0_complex with ⟨δ0, hδ0pos, C0, hC0nonneg, hsmall⟩ + + let a : ℝ := min δ0 1 + have ha_pos : 0 < a := lt_min_iff.2 ⟨hδ0pos, zero_lt_one⟩ + have ha_le_one : a ≤ 1 := min_le_right _ _ + rcases bounded_on_compact_interval a 1 ha_pos ha_le_one with ⟨Cmid, hCmid_nonneg, hmid⟩ + + let C2 : ℝ := ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) + have hC2_nonneg : 0 ≤ C2 := by + have hnn : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) := + vonMangoldt_rpow_nonneg 2 + exact tsum_nonneg_of_nonneg hnn + + let C : ℝ := 2 + C0 + Cmid + C2 + have hCgt1 : 1 < C := by + have : 2 ≤ 2 + C0 + Cmid + C2 := by linarith [hC0nonneg, hCmid_nonneg, hC2_nonneg] + linarith + refine ⟨C, hCgt1, ?_⟩ + intro δ hδpos + by_cases hlt : δ < δ0 + · + have hbound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C0 := + hsmall δ hδpos hlt + + have hC0_le_C : C0 ≤ C := by linarith + exact le_trans hbound hC0_le_C + · + have hge : δ0 ≤ δ := le_of_not_gt hlt + rcases le_total δ 1 with hδle1 | hδge1 + · + have ha_le_δ : a ≤ δ := le_trans (min_le_left δ0 1) hge + have hbound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ Cmid := + hmid δ ha_le_δ hδle1 + + have hCmid_le_C : Cmid ≤ C := by linarith + exact le_trans hbound hCmid_le_C + · + + let x : ℝ := 1 + δ + have hx1 : 1 < x := by + have : 0 < δ := hδpos + have : 1 < 1 + δ := lt_add_of_pos_right 1 this + exact this + + have h_norm_eq_abs_real : ‖-logDerivZeta (x : ℂ)‖ + = |∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)| := + norm_negLogDerivZeta_real_eq_abs_tsum_vonMangoldt x hx1 + + have eqArg : ((1 : ℂ) + δ) = (x : ℂ) := by simp [x] + + have h_norm_eq_abs : ‖-logDerivZeta ((1 : ℂ) + δ)‖ + = |∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)| := by + simpa [eqArg] using h_norm_eq_abs_real + + let S : ℝ := ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) + have hsum_nonneg : 0 ≤ S := by + change 0 ≤ ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) + exact tsum_nonneg_of_nonneg (vonMangoldt_rpow_nonneg x) + + have h_norm_le_sum : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ S := by + have : ‖-logDerivZeta ((1 : ℂ) + δ)‖ = |S| := h_norm_eq_abs + have : |S| = S := abs_of_nonneg hsum_nonneg + exact le_of_eq (h_norm_eq_abs.trans this) + + have hx_ge_two : 2 ≤ x := by + + have : 1 ≤ δ := hδge1 + have : 2 ≤ 1 + δ := by linarith + exact this + + have h_le_2 : ∀ n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) + ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) := by + intro n + by_cases h0 : n = 0 + · simp [h0] + · have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h0 + have hn' : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn + have hrpow : (n : ℝ) ^ (-x) ≤ (n : ℝ) ^ (-(2 : ℝ)) := + rpow_neg_antitone hn' hx_ge_two + have hΛ_nonneg : 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) := + ArithmeticFunction.vonMangoldt_nonneg + exact mul_le_mul_of_nonneg_left hrpow hΛ_nonneg + + have h_summ_x : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) := by + exact Rezetaseries0 x hx1 + have h_summ_2 : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ))) := + Rezetaseries0 2 (by norm_num) + have hsum_le : S ≤ C2 := by + + have h_nonneg_x : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) := + vonMangoldt_rpow_nonneg x + exact tsum_le_of_nonneg_of_le h_summ_x h_summ_2 h_nonneg_x h_le_2 + + have h_norm_le_C2 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C2 := + le_trans h_norm_le_sum hsum_le + + have h_one_div_le : ‖(1 : ℂ) / (δ : ℂ)‖ ≤ 1 := norm_one_div_coe_real_le_one_of_one_le hδge1 + have htriangle : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ + ≤ ‖-logDerivZeta ((1 : ℂ) + δ)‖ + ‖(1 : ℂ) / (δ : ℂ)‖ := + norm_sub_le _ _ + have hlarge_bound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C2 + 1 := by + refine le_trans htriangle ?_ + exact add_le_add h_norm_le_C2 h_one_div_le + + have hC2_le_C : C2 + 1 ≤ C := by linarith + exact le_trans hlarge_bound hC2_le_C + +lemma Z0boundRe_const : + ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), + ((-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))).re) ≤ C := by + + rcases Z0bound_const with ⟨C, hCpos, hC⟩ + use C + constructor + · exact hCpos + · intro δ hδ + + have h_bound := hC δ hδ + exact le_trans (Complex.re_le_norm _) h_bound + +lemma Z0boundRe_const2 : + ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), + ((-logDerivZeta ((1 : ℂ) + δ)).re + (-(1 / (δ : ℂ))).re) ≤ C := by + + rcases Z0boundRe_const with ⟨C, hC_pos, hC⟩ + use C, hC_pos + intro δ hδ + have h_sub_re : ((-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))).re) = + ((-logDerivZeta ((1 : ℂ) + δ)).re + (-(1 / (δ : ℂ))).re) := by + rw [Complex.sub_re] + rfl + rw [← h_sub_re] + exact hC δ hδ + +lemma Z0boundRe_const3 : + ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), + (-logDerivZeta ((1 : ℂ) + δ)).re - (1 / δ) ≤ C := by + + rcases Z0boundRe_const2 with ⟨C, hCpos, hC⟩ + use C, hCpos + intro δ hδ + + have h := hC δ hδ + + have h_re_eq : (-(1 / (δ : ℂ))).re = -(1 / δ) := by + rw [Complex.neg_re, Complex.div_re, Complex.one_re, Complex.ofReal_re, Complex.ofReal_im] + simp [Complex.normSq_ofReal] + + rwa [h_re_eq] at h + +lemma Z341bounds_const : + ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0) (_hδ1 : δ < 1), ∀ t : ℝ, 2 < |t| → ∀ σ : ℝ, + (σ + t * Complex.I) ∈ zeroZ → + 3 * (-logDerivZeta ((1 : ℂ) + δ)).re + + 4 * (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re + + (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re + ≤ 3 / δ - 4 / (1 + δ - σ) + C * Real.log (|t| + 2) := by + + rcases Z0boundRe_const3 with ⟨C0, hC0pos, hZ0⟩ + rcases Z1bound with ⟨C1, hC1pos, hZ1⟩ + rcases lem_Z2bound with ⟨C2, hC2pos, hZ2⟩ + + let C := 3 * C0 + 4 * C1 + C2 + + have hC_gt_one : 1 < C := by + have h1 : 1 < C0 := hC0pos + have h2 : 3 < 3 * C0 := by linarith [mul_lt_mul_of_pos_left h1 (by norm_num : (0 : ℝ) < 3)] + have h3 : 0 < 4 * C1 := mul_pos (by norm_num) (lt_trans zero_lt_one hC1pos) + have h4 : 0 < C2 := lt_trans zero_lt_one hC2pos + linarith [h2, h3, h4] + + use C + constructor + · exact hC_gt_one + · intro δ hδpos hδ1 t ht σ hσ + + have hZ0_bound : (-logDerivZeta ((1 : ℂ) + δ)).re ≤ C0 + (1 / δ) := by + have := hZ0 δ hδpos + linarith + + have hZ1_bound : (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re ≤ -(1 / (1 + δ - σ)) + C1 * Real.log (|t| + 2) := by + let s := σ + t * Complex.I + have hs_mem : s ∈ zeroZ := hσ + have hs_im : s.im = t := by simp [s] + have hs_re : s.re = σ := by simp [s] + have hδ_cond : 0 < δ ∧ δ < 1 := ⟨hδpos, hδ1⟩ + have := hZ1 δ hδ_cond t ht s ⟨hs_mem, hs_im⟩ + rw [hs_re] at this + exact this + + have hZ2_bound : (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re ≤ C2 * Real.log (|t| + 2) := by + have hδ_cond : 0 < δ ∧ δ < 1 := ⟨hδpos, hδ1⟩ + exact hZ2 t ht δ hδ_cond + + have hlog_ge_one : 1 ≤ Real.log (|t| + 2) := by + have h1 : 2 < |t| := ht + have h2 : Real.exp 1 < 3 := lem_three_gt_e + have he_lt_t2 : Real.exp 1 < |t| + 2 := by linarith + have ht2_pos : 0 < |t| + 2 := by linarith [abs_nonneg t] + exact Real.le_log_iff_exp_le ht2_pos |>.mpr (le_of_lt he_lt_t2) + + calc + 3 * (-logDerivZeta ((1 : ℂ) + δ)).re + 4 * (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re + (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re + ≤ 3 * (C0 + (1 / δ)) + 4 * (-(1 / (1 + δ - σ)) + C1 * Real.log (|t| + 2)) + C2 * Real.log (|t| + 2) := by + exact add_le_add (add_le_add (mul_le_mul_of_nonneg_left hZ0_bound (by norm_num)) (mul_le_mul_of_nonneg_left hZ1_bound (by norm_num))) hZ2_bound + _ = 3 * C0 + 3 / δ - 4 / (1 + δ - σ) + (4 * C1 + C2) * Real.log (|t| + 2) := by ring + _ = 3 / δ - 4 / (1 + δ - σ) + 3 * C0 + (4 * C1 + C2) * Real.log (|t| + 2) := by ring + _ = 3 / δ - 4 / (1 + δ - σ) + ((4 * C1 + C2) * Real.log (|t| + 2) + 3 * C0) := by ring + _ ≤ 3 / δ - 4 / (1 + δ - σ) + (4 * C1 + C2 + 3 * C0) * Real.log (|t| + 2) := by + + have hC0_pos : 0 < C0 := lt_trans zero_lt_one hC0pos + have hC0_nonneg : 0 ≤ 3 * C0 := mul_nonneg (by norm_num) (le_of_lt hC0_pos) + have h_absorb := absorb_pos_constant_into_log (L := Real.log (|t| + 2)) (A := 4 * C1 + C2) (c := 3 * C0) hlog_ge_one hC0_nonneg + + exact add_le_add_right h_absorb (3 / δ - 4 / (1 + δ - σ)) + _ = 3 / δ - 4 / (1 + δ - σ) + (3 * C0 + 4 * C1 + C2) * Real.log (|t| + 2) := by ring + _ = 3 / δ - 4 / (1 + δ - σ) + C * Real.log (|t| + 2) := by ring + +def ZeroAt (σ t : ℝ) : Prop := + (σ + t * I) ∈ zeroZ + +def Ft (σ : ℝ) : Filter ℝ := + (Filter.atTop ⊔ Filter.atBot) ⊓ Filter.principal {t : ℝ | ZeroAt σ t} + +def Fδ : Filter ℝ := nhdsWithin 0 (Set.Ioi 0) + +lemma Rezeta1zetaseries1 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + (-logDerivZeta ((1 : ℂ) + delta + t * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) := by + + have h1 : 1 < 1 + delta := by linarith [hdelta] + convert Rezeta1zetaseries (1 + delta) t h1 + + simp [Complex.ofReal_add] + +lemma Rezeta1zetaseries2 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ)) := by + + have h1 : 1 < 1 + delta := by linarith [hdelta] + + have h2 : (1 : ℂ) + delta + (2 * t) * I = (1 + delta : ℝ) + ((2 * t) : ℝ) * I := by + simp [Complex.ofReal_add, Complex.ofReal_one, Complex.ofReal_mul] + rw [h2] + exact Rezeta1zetaseries (1 + delta) (2 * t) h1 + +lemma Rezeta1zetaseries0 (delta : ℝ) (hdelta : delta > 0) : + (-logDerivZeta ((1 : ℂ) + delta)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) := by + + have h_series : (-logDerivZeta ((1 : ℂ) + delta + 0 * I)).re = + ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (0 * Real.log (n : ℝ)) := + Rezeta1zetaseries1 0 delta hdelta + + have h_lhs : (-logDerivZeta ((1 : ℂ) + delta + 0 * I)).re = (-logDerivZeta ((1 : ℂ) + delta)).re := by + congr 2 + simp + + have h_rhs : ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (0 * Real.log (n : ℝ)) = + ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) := by + congr 1 + funext n + by_cases h : n = 0 + · simp [h] + · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + rw [lem_cost0 n hn 0 rfl, mul_one] + + rw [← h_lhs, h_series, h_rhs] + +lemma Z341series (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + (3 * (-logDerivZeta ((1 : ℂ) + delta)).re + + 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + + (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re) + = + (3 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + + 4 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + + ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := by + rw [Rezeta1zetaseries0 delta hdelta, Rezeta1zetaseries1 t delta hdelta, Rezeta1zetaseries2 t delta hdelta] + +lemma lem341seriesConv (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + Summable (fun n : ℕ => + 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + + 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + + (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := by + + have h1 : 1 < 1 + delta := by linarith [hdelta] + + have h2 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := + Rezetaseries0 (1 + delta) h1 + + have h3 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := + Rezetaseries_convergence (1 + delta) t h1 + + have h4 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := + Rezetaseries2t (1 + delta) t h1 + + have h5 : Summable (fun n : ℕ => 3 * ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)))) := + Summable.mul_left 3 h2 + + have h6 : Summable (fun n : ℕ => 4 * ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)))) := + Summable.mul_left 4 h3 + + have h5' : Summable (fun n : ℕ => 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := by + convert h5 using 1 + ext n + ring + + have h6' : Summable (fun n : ℕ => 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := by + convert h6 using 1 + ext n + ring + + have h7 : Summable (fun n : ℕ => + 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + + 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := + h5'.add h6' + + exact h7.add h4 + +lemma lem341series (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + (3 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) + + (4 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) + + (∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) + = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by + + have h1 : 1 < 1 + delta := by linarith [hdelta] + + have h2 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := + Rezetaseries0 (1 + delta) h1 + + have h3 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := + Rezetaseries_convergence (1 + delta) t h1 + + have h4 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := + Rezetaseries2t (1 + delta) t h1 + + rw [← Summable.tsum_mul_left 3 h2] + rw [← Summable.tsum_mul_left 4 h3] + + rw [← Summable.tsum_add (Summable.mul_left 3 h2) (Summable.mul_left 4 h3)] + rw [← Summable.tsum_add] + + congr 1 + ext n + ring + + · exact Summable.add (Summable.mul_left 3 h2) (Summable.mul_left 4 h3) + · exact h4 + +lemma lem_341seriesConverge (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ)))) := by + + have h1 : Summable (fun n : ℕ => + 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + + 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + + (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := + lem341seriesConv t delta hdelta + + convert h1 using 1 + ext n + ring + +lemma lem_341series2 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + (3 * (-logDerivZeta ((1 : ℂ) + delta)).re + + 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + + (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re) + = + ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by + rw [Z341series t delta hdelta] + exact lem341series t delta hdelta + +lemma lem_Lambda_pos_trig_sum (n : ℕ) (delta : ℝ) (t : ℝ) (hn : n ≥ 1) (hdelta : delta > 0) : + 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by + apply mul_nonneg + · + apply lem_realnx n (1 + delta) hn + + linarith [hdelta] + · + exact lem_postriglogn n hn t + +lemma seriesPos {f : ℕ → ℝ} (_h_summable : Summable (fun n => if 1 ≤ n then f n else 0)) (h_nonneg : ∀ n : ℕ, 1 ≤ n → 0 ≤ f n) : 0 ≤ ∑' (n : ℕ), (if 1 ≤ n then f n else 0) := by + apply tsum_nonneg + intro n + by_cases h : 1 ≤ n + · simp [h] + exact h_nonneg n h + · simp [h] + +lemma lem_seriespos (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + 0 ≤ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by + apply tsum_nonneg + intro n + by_cases h : n = 0 + · + simp [h] + · + have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h + exact lem_Lambda_pos_trig_sum n delta t hn hdelta + +lemma Z341pos (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : + 0 ≤ 3 * (-logDerivZeta ((1 : ℂ) + delta)).re + + 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + + (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re := by + rw [lem_341series2 t delta hdelta] + exact lem_seriespos t delta hdelta + +lemma frac_den_increase_bound {a b c : ℝ} (hpos : 0 < a + b) (hc : 0 ≤ c) : + 4 / (a + b + c) ≤ 4 / (a + b) := by + + have hle : a + b ≤ a + b + c := by linarith + + have h1 : 1 / (a + b + c) ≤ 1 / (a + b) := by + exact one_div_le_one_div_of_le hpos hle + + have h4nonneg : 0 ≤ (4 : ℝ) := by norm_num + have hmul := mul_le_mul_of_nonneg_left h1 h4nonneg + + have hmul' : 4 * (a + b + c)⁻¹ ≤ 4 * (a + b)⁻¹ := by + simpa [one_div] using hmul + simpa [div_eq_mul_inv] using hmul' + +lemma log_abs_add_two_pos (t : ℝ) : 0 < Real.log (abs t + 2) := by + + have h0 : 0 ≤ abs t + 2 := by + have h' : 0 ≤ abs t := abs_nonneg t + linarith + have hge : (2 : ℝ) ≤ abs t + 2 := by + have h' : 0 ≤ abs t := abs_nonneg t + have := add_le_add_left h' (2 : ℝ) + simp + have hgt : 1 < abs t + 2 := lt_of_lt_of_le (by norm_num : (1 : ℝ) < 2) hge + + exact (Real.log_pos_iff h0).2 hgt + +lemma log_gt_of_gt_exp {x y : ℝ} (h : Real.exp y < x) : y < Real.log x := by + have hxpos : 0 < x := lt_trans (Real.exp_pos y) h + exact (Real.lt_log_iff_exp_lt hxpos).2 h + +lemma denom_rewrite (σ C L : ℝ) : 1 - σ + (1 / (2 * C * L)) = 1 + (1 / (2 * C * L)) - σ := by + ring + +lemma pos_delta_from_C_L {C L : ℝ} (hC : 0 < C) (hL : 0 < L) : 0 < 1 / (2 * C * L) := by + have hCL : 0 < C * L := mul_pos hC hL + have h2 : 0 < (2 : ℝ) := by norm_num + have hpos : 0 < 2 * C * L := by + have : 0 < 2 * (C * L) := mul_pos h2 hCL + simpa [mul_assoc] using this + exact one_div_pos.mpr hpos + +lemma add_two_pos_of_abs (t : ℝ) : 0 < |t| + 2 := by + have : 0 ≤ |t| := abs_nonneg t + linarith + +lemma log_abs_two_pos (t : ℝ) : 0 < Real.log (|t| + 2) := by + simpa using log_abs_add_two_pos t + +lemma two_C_log_pos {C t : ℝ} (hC : 0 < C) : 0 < 2 * C * Real.log (|t| + 2) := by + have hL : 0 < Real.log (|t| + 2) := log_abs_two_pos t + have h2 : 0 < (2 : ℝ) := by norm_num + have hCL : 0 < C * Real.log (|t| + 2) := mul_pos hC hL + have : 0 < 2 * (C * Real.log (|t| + 2)) := mul_pos h2 hCL + simpa [mul_comm, mul_left_comm, mul_assoc] using this + +lemma mul_one_div_self_of_pos {a : ℝ} (ha : 0 < a) : a * (1 / a) = 1 := by + have hne : a ≠ 0 := ne_of_gt ha + simp [one_div, hne] + +lemma mul_one_div_mul_right {A b : ℝ} (hA : A ≠ 0) : A * (1 / (A * b)) = 1 / b := by + calc + A * (1 / (A * b)) = A * ((A * b)⁻¹) := by simp [one_div] + _ = A / (A * b) := by simp [div_eq_mul_inv] + _ = A / A / b := by + simpa using (div_mul_eq_div_div (a := A) (b := A) (c := b)) + _ = 1 / b := by + have : A / A = (1 : ℝ) := by simp [hA] + simp [this] + +lemma one_div_mul_one_div_mul_right {A b : ℝ} (hA : A ≠ 0) (_hb : b ≠ 0) : 1 / (A * (1 / (A * b))) = b := by + have h := mul_one_div_mul_right (A := A) (b := b) hA + have hinv := congrArg (fun x : ℝ => x⁻¹) h + calc + 1 / (A * (1 / (A * b))) = (A * (1 / (A * b)))⁻¹ := by simp [one_div] + _ = (1 / b)⁻¹ := by simpa using hinv + _ = b := by simp [one_div] + +lemma inv_of_delta_def (C L δ : ℝ) (hδ : δ = 1 / (2 * C * L)) : 1 / δ = 2 * C * L := by + simp [hδ, one_div] + +lemma rhs_eval_of_inv (C L δ : ℝ) (h : 1 / δ = 2 * C * L) : 3 / δ + C * L = 7 * C * L := by + calc + 3 / δ + C * L + = 3 * (1 / δ) + C * L := by simp [div_eq_mul_inv] + _ = 3 * (2 * C * L) + C * L := by simp [h] + _ = 6 * C * L + C * L := by ring + _ = 7 * C * L := by ring + +lemma lem341tsC : + ∃ C > 1, ∀ s : ℂ, + (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → + 2 < |s.im| → + 4 / (1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2))) ≤ 7 * C * Real.log (abs s.im + 2) := by + + obtain ⟨C, hCpos, hbound⟩ := Z341bounds_const + refine ⟨C, hCpos, ?_⟩ + intro s hs hTim + + let L : ℝ := Real.log (|s.im| + 2) + have hLpos : 0 < L := log_abs_two_pos (s.im) + let δ : ℝ := 1 / (2 * C * L) + + have hCpos_weak : 0 < C := lt_trans zero_lt_one hCpos + have hδpos : 0 < δ := pos_delta_from_C_L hCpos_weak hLpos + + have hδlt : δ < 1 := by + + have hL_gt_1 : 1 < L := by + have h5_lt : 4 < |s.im| + 2 := by linarith [hTim] + have hL_gt_log5 : Real.log 4 < L := Real.log_lt_log (by norm_num) h5_lt + have hlog5_gt_1 : 1 < Real.log 4 := by + have h5_gt_e : Real.exp 1 < 4 := by + have h3_gt_e := lem_three_gt_e + linarith [h3_gt_e] + rw [← Real.log_exp 1] + exact Real.log_lt_log (Real.exp_pos 1) h5_gt_e + linarith [hlog5_gt_1, hL_gt_log5] + + have h2CL_gt_1 : 1 < 2 * C * L := by + + have hCL_gt_1 : 1 < C * L := by + calc C * L + > 1 * L := by exact mul_lt_mul_of_pos_right hCpos hLpos + _ = L := by simp + _ > 1 := hL_gt_1 + have h2_pos : (0 : ℝ) < 2 := by norm_num + calc 2 * C * L + = 2 * (C * L) := by ring + _ > 2 * 1 := by exact mul_lt_mul_of_pos_left hCL_gt_1 h2_pos + _ = 2 := by simp + _ > 1 := by norm_num + + simp only [δ] + rw [div_lt_one_iff] + left + exact ⟨two_C_log_pos hCpos_weak, h2CL_gt_1⟩ + + have hmem : (s.re + s.im * Complex.I) ∈ zeroZ := by + simpa [Complex.re_add_im] using hs.1 + have hupper := hbound δ hδpos hδlt (s.im) hTim (s.re) hmem + + have hpos := Z341pos (s.im) δ hδpos + + have hRHS_nonneg : 0 ≤ 3 / δ - 4 / (1 + δ - s.re) + C * L := le_trans hpos hupper + have hineq1 : 4 / (1 + δ - s.re) ≤ 3 / δ + C * L := by linarith [hRHS_nonneg] + + have hineq2 : 4 / (1 - s.re + δ) ≤ 3 / δ + C * L := by + convert hineq1 using 2 + ring + + have hinv : 1 / δ = 2 * C * L := by + simp only [δ, one_div, inv_inv] + + have hrhs_eval : 3 / δ + C * L = 7 * C * L := rhs_eval_of_inv C L δ hinv + + have hfinal : 4 / (1 - s.re + δ) ≤ 7 * C * L := by + rw [← hrhs_eval] + exact hineq2 + + convert hfinal + +lemma zeta_zero_re_lt_one (s : ℂ) (hs : s ∈ zeroZ) : s.re < 1 := by + + by_contra h + + push Not at h + + have h_zero : riemannZeta s = 0 := hs + + have h_nonzero : riemannZeta s ≠ 0 := riemannZeta_ne_zero_of_one_le_re h + + exact h_nonzero h_zero + +lemma div_le_to_le_mul (x y z : ℝ) (hy : 0 < y) (h : x / y ≤ z) : x ≤ z * y := by + rwa [div_le_iff₀ hy] at h + +lemma le_mul_to_le_div (x y z : ℝ) (hy : 0 < y) (h : x ≤ z * y) : x / y ≤ z := by + rw [div_le_iff₀ hy] + exact h + +lemma reciprocal_div_inequality (a b : ℝ) (ha : 0 < a) (hb : 0 < b) (h : 4 / a ≤ b) : a ≥ 4 / b := by + + have h1 : 4 ≤ b * a := div_le_to_le_mul 4 a b ha h + + have h2 : 4 ≤ a * b := by + rwa [mul_comm] at h1 + + have h3 : 4 / b ≤ a := le_mul_to_le_div 4 b a hb h2 + + exact h3 + +lemma lem341tsC2 : + ∃ C > 1, ∀ s : ℂ, + (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → + 2 < |s.im| → + 1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2)) ≥ 4 / (7 * C * Real.log (abs s.im + 2)) := by + + rcases lem341tsC with ⟨C, hCpos, hT⟩ + refine ⟨C, hCpos, ?_⟩ + intro s hs hTs + + set a := 1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2)) with ha + set b := 7 * C * Real.log (abs s.im + 2) with hb + have hineq : 4 / a ≤ b := by + simpa [ha, hb] using hT s hs hTs + + have h_abs_nonneg : 0 ≤ |s.im| := abs_nonneg _ + have h_two_le : (2 : ℝ) ≤ |s.im| + 2 := by + have h' : (2 : ℝ) + 0 ≤ 2 + |s.im| := add_le_add_right h_abs_nonneg 2 + simp + have h_one_lt : (1 : ℝ) < |s.im| + 2 := lt_of_lt_of_le one_lt_two h_two_le + have hx0 : 0 ≤ |s.im| + 2 := by linarith [h_abs_nonneg] + have hlogpos : 0 < Real.log (|s.im| + 2) := (Real.log_pos_iff hx0).2 h_one_lt + have h7pos : 0 < (7 : ℝ) := by exact_mod_cast (by decide : (0 : ℕ) < 7) + have hbpos : 0 < b := by + have h7Cpos : 0 < 7 * C := by linarith + exact mul_pos h7Cpos hlogpos + + rcases hs with ⟨_, hRepos, hRelt⟩ + have h1 : 0 < 1 - s.re := sub_pos.mpr hRelt + have h2pos : 0 < (2 : ℝ) := lt_trans zero_lt_one one_lt_two + have h2Cpos : 0 < (2 : ℝ) * C := by linarith + have hdenpos : 0 < 2 * C * Real.log (|s.im| + 2) := mul_pos h2Cpos hlogpos + have hinvpos : 0 < 1 / (2 * C * Real.log (|s.im| + 2)) := one_div_pos.mpr hdenpos + have hapos : 0 < a := by + have := add_pos h1 hinvpos + simpa [ha] using this + + have hres := reciprocal_div_inequality a b hapos hbpos hineq + simpa [ha, hb] using hres + +lemma simplify_4_7_2 (C L : ℝ) : 4 / (7 * C * L) - 1 / (2 * C * L) = 1 / (14 * C * L) := by + + have h1 : (4 : ℝ) / (7 * (C * L)) = (4 : ℝ) / (7 : ℝ) / (C * L) := by + simpa using (div_mul_eq_div_div (a := (4 : ℝ)) (b := (7 : ℝ)) (c := C * L)) + have h2 : (1 : ℝ) / (2 * (C * L)) = (1 : ℝ) / (2 : ℝ) / (C * L) := by + simpa using (div_mul_eq_div_div (a := (1 : ℝ)) (b := (2 : ℝ)) (c := C * L)) + + have h3' : ((4 : ℝ) / (7 : ℝ)) - (2 : ℝ)⁻¹ = (14 : ℝ)⁻¹ := by + have h3 : ((4 : ℝ) / (7 : ℝ)) - ((1 : ℝ) / (2 : ℝ)) = (1 : ℝ) / (14 : ℝ) := by + norm_num + simpa [one_div] using h3 + calc + 4 / (7 * C * L) - 1 / (2 * C * L) + = (4 : ℝ) / (7 * (C * L)) - (1 : ℝ) / (2 * (C * L)) := by + simp [mul_assoc] + _ = (4 : ℝ) / (7 : ℝ) / (C * L) - (1 : ℝ) / (2 : ℝ) / (C * L) := by + simp [h1, h2] + _ = (((4 : ℝ) / (7 : ℝ)) - ((1 : ℝ) / (2 : ℝ))) / (C * L) := by + simpa using (sub_div (a := ((4 : ℝ) / (7 : ℝ))) (b := ((1 : ℝ) / (2 : ℝ))) (c := C * L)).symm + _ = (((4 : ℝ) / (7 : ℝ)) - (2 : ℝ)⁻¹) / (C * L) := by + simp [one_div] + _ = (14 : ℝ)⁻¹ / (C * L) := by + simp [h3'] + _ = 1 / (14 * (C * L)) := by + simpa [mul_comm, mul_left_comm, mul_assoc, one_div] using + (div_mul_eq_div_div (a := (1 : ℝ)) (b := (14 : ℝ)) (c := C * L)).symm + _ = 1 / (14 * C * L) := by simp [mul_assoc] + +lemma fraction_diff_lower_bound (C L a : ℝ) : 4 / (7 * C * L) ≤ a + 1 / (2 * C * L) → 1 / (14 * C * L) ≤ a := by + intro h + have h' : 4 / (7 * C * L) - 1 / (2 * C * L) ≤ a := (sub_le_iff_le_add).mpr h + have hdiff : 1 / (14 * C * L) = 4 / (7 * C * L) - 1 / (2 * C * L) := by + symm + exact simplify_4_7_2 C L + calc + 1 / (14 * C * L) + = 4 / (7 * C * L) - 1 / (2 * C * L) := hdiff + _ ≤ a := h' + +lemma lem341tsC3 : + ∃ C > 1, ∀ s : ℂ, + (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → + 2 < |s.im| → + 1 - s.re ≥ 1 / (14 * C * Real.log (abs s.im + 2)) := by + obtain ⟨C, hCpos, hT⟩ := lem341tsC2 + refine ⟨C, hCpos, ?_⟩ + intro s hs hTle + have h := hT s hs hTle + + have h' : 4 / (7 * C * Real.log (abs s.im + 2)) ≤ + (1 - s.re) + 1 / (2 * C * Real.log (abs s.im + 2)) := by + simpa [ge_iff_le, add_comm, add_left_comm, add_assoc] using h + + have h'' := fraction_diff_lower_bound C (Real.log (abs s.im + 2)) (1 - s.re) h' + + simpa [ge_iff_le, mul_comm, mul_left_comm, mul_assoc] using h'' + +lemma zerofree : + ∃ c, c > 0 ∧ c < 1 ∧ ∀ s : ℂ, + (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → + 2 < |s.im| → s.re ≤ 1 - c / (Real.log (abs s.im + 2)) := by + + rcases lem341tsC3 with ⟨C0, hC0pos, hT⟩ + + set C : ℝ := 1 / (14 * C0) with hCdef + + have h14pos : 0 < (14 : ℝ) := by norm_num + have hC0pos' : 0 < C0 := lt_trans zero_lt_one hC0pos + have hCpos : 0 < C := by + have hdenpos : 0 < 14 * C0 := mul_pos h14pos hC0pos' + exact one_div_pos.mpr hdenpos + + have hClt1 : C < 1 := by + have h14C0_pos : 0 < 14 * C0 := mul_pos h14pos hC0pos' + have h14C0_gt_1 : 1 < 14 * C0 := by + have h14_gt_1 : (1 : ℝ) < 14 := by norm_num + calc + (1 : ℝ) = 1 * 1 := by ring + _ < 14 * 1 := by exact mul_lt_mul_of_pos_right h14_gt_1 zero_lt_one + _ < 14 * C0 := by exact mul_lt_mul_of_pos_left hC0pos h14pos + rw [hCdef] + rw [div_lt_one_iff] + left + exact ⟨h14C0_pos, h14C0_gt_1⟩ + + refine ⟨C, hCpos, hClt1, ?_⟩ + intro s hs hTle + + set L := Real.log (abs s.im + 2) with hLdef + + have hb0 := hT s hs hTle + + have hb' : C / L ≤ 1 - s.re := by + simpa [hLdef, hCdef, one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hb0 + + have : s.re ≤ 1 - C / L := by linarith + simpa [hLdef] using this + +def Yt (t : ℝ) (δ : ℝ) : Set ℂ := + { ρ_1 : ℂ | riemannZeta ρ_1 = 0 ∧ ‖ρ_1 - (1 - δ + t * Complex.I)‖ ≤ 2 * δ } + +noncomputable def zerofree_constant : ℝ := Classical.choose zerofree + +lemma zerofree_constant_pos : 0 < zerofree_constant := + (Classical.choose_spec zerofree).1 + +lemma zerofree_constant_lt_one : zerofree_constant < 1 := + (Classical.choose_spec zerofree).2.1 + +noncomputable def deltaz (z : ℂ) : ℝ := (zerofree_constant / 20) / Real.log (|z.im| + 2) + +noncomputable def deltaz_t (t : ℝ) : ℝ := deltaz (t * Complex.I) + +lemma lem_delta19 : + (∀ z : ℂ, |z.im| > 2 → (0 < deltaz z ∧ deltaz z < 1/9)) ∧ + (∀ t : ℝ, |t| > 2 → (0 < deltaz_t t ∧ deltaz_t t < 1/9)) := by + + have h_complex : ∀ z : ℂ, |z.im| > 2 → (0 < deltaz z ∧ deltaz z < 1/9) := by + intro z hz + constructor + · + have h_num_pos : 0 < zerofree_constant / 20 := by + exact div_pos zerofree_constant_pos (by norm_num) + have h_den_pos : 0 < Real.log (|z.im| + 2) := by + have h_gt_one : (1 : ℝ) < |z.im| + 2 := by + have h_nonneg : (0 : ℝ) ≤ |z.im| := abs_nonneg _ + linarith [hz] + exact Real.log_pos h_gt_one + unfold deltaz + exact div_pos h_num_pos h_den_pos + · + + have h_den_ge_half : (1/2 : ℝ) ≤ Real.log (|z.im| + 2) := by + + have h_den_ge_log2 : Real.log 2 ≤ Real.log (|z.im| + 2) := by + have h_pos : 0 < |z.im| + 2 := by linarith [abs_nonneg (z.im)] + have h_le : (2 : ℝ) ≤ |z.im| + 2 := by linarith [abs_nonneg (z.im)] + exact Real.log_le_log (by norm_num) h_le + + have h_log2_ge_half : (1/2 : ℝ) ≤ Real.log 2 := by + have h_exp_half_le_two : Real.exp (1/2) ≤ 2 := by + + have h_exp_one_lt_three : Real.exp 1 < 3 := lem_three_gt_e + have h_exp_sq : (Real.exp (1/2))^2 = Real.exp 1 := by + rw [pow_two, ← Real.exp_add]; norm_num + have h_exp_sq_lt_four : (Real.exp (1/2))^2 < 4 := by + rw [h_exp_sq]; linarith [h_exp_one_lt_three] + + have h_exp_pos : 0 ≤ Real.exp (1/2) := le_of_lt (Real.exp_pos _) + have h_two_pos : 0 ≤ (2 : ℝ) := by norm_num + have h_four_eq : (2 : ℝ)^2 = 4 := by norm_num + rw [← h_four_eq] at h_exp_sq_lt_four + have h_lt_abs := (sq_lt_sq).mp h_exp_sq_lt_four + rw [abs_of_nonneg h_exp_pos, abs_of_nonneg h_two_pos] at h_lt_abs + exact le_of_lt h_lt_abs + exact (Real.le_log_iff_exp_le (by norm_num : 0 < (2 : ℝ))).mpr h_exp_half_le_two + exact le_trans h_log2_ge_half h_den_ge_log2 + + have h_inv_le_two : 1 / Real.log (|z.im| + 2) ≤ 2 := by + have h_pos_half : 0 < (1/2 : ℝ) := by norm_num + have h_ineq := one_div_le_one_div_of_le h_pos_half h_den_ge_half + convert h_ineq using 1; first | rfl | norm_num + + have h_bound : deltaz z ≤ zerofree_constant / 10 := by + unfold deltaz + + rw [div_eq_mul_inv] + + have h_num_nonneg : 0 ≤ zerofree_constant / 20 := by + exact le_of_lt (div_pos zerofree_constant_pos (by norm_num)) + have h_mul_ineq := mul_le_mul_of_nonneg_left h_inv_le_two h_num_nonneg + convert h_mul_ineq using 1 <;> first | rfl | ring + + have h_lt_tenth : zerofree_constant / 10 < 1 / 10 := by + exact div_lt_div_of_pos_right zerofree_constant_lt_one (by norm_num) + have h_tenth_lt_ninth : (1 : ℝ) / 10 < 1 / 9 := by norm_num + exact lt_trans (lt_of_le_of_lt h_bound h_lt_tenth) h_tenth_lt_ninth + + constructor + · exact h_complex + · + intro t ht + + have h_eq : deltaz_t t = deltaz (t * Complex.I) := rfl + rw [h_eq] + have h_im_eq : |(t * Complex.I).im| = |t| := by simp + rw [← h_im_eq] at ht + exact h_complex (t * Complex.I) ht + +lemma closedBall_compact_complex (c : ℂ) (r : ℝ) : + IsCompact (Metric.closedBall c r) := by + + exact ProperSpace.isCompact_closedBall c r + +lemma riemannZeta_no_zeros_accumulate_at_one : + ∀ Z : Set ℂ, (∀ z ∈ Z, riemannZeta z = 0) → ¬AccPt 1 (Filter.principal Z) := by + intro Z hZ + + by_contra h_acc + + have h_residue := riemannZeta_residue_one + + rw [Metric.tendsto_nhdsWithin_nhds] at h_residue + obtain ⟨δ, hδ_pos, hδ_bound⟩ := h_residue (1/2) (by norm_num : (0 : ℝ) < 1/2) + + rw [accPt_iff_nhds] at h_acc + + obtain ⟨y, ⟨hy_ball, hy_Z⟩, hy_ne⟩ := h_acc (Metric.ball 1 δ) (Metric.ball_mem_nhds 1 hδ_pos) + + have hy_zero : riemannZeta y = 0 := hZ y hy_Z + + have hy_in_compl : y ∈ ({1} : Set ℂ)ᶜ := by + rw [Set.mem_compl_iff, Set.mem_singleton_iff] + exact hy_ne + + have hy_dist : dist y 1 < δ := hy_ball + + have h_bound := hδ_bound hy_in_compl hy_dist + + rw [hy_zero, mul_zero] at h_bound + + have h_dist_eq : dist (0 : ℂ) (1 : ℂ) = 1 := by + rw [Complex.dist_eq] + norm_num + + rw [h_dist_eq] at h_bound + + norm_num at h_bound + +lemma complex_minus_singleton_connected : IsPreconnected ({s : ℂ | s ≠ 1} : Set ℂ) := by + + have h_eq : {s : ℂ | s ≠ 1} = ({1} : Set ℂ)ᶜ := by + ext x + simp [Set.mem_compl_iff, Set.mem_singleton_iff] + + rw [h_eq] + + have h_rank : 1 < Module.rank ℝ ℂ := by + rw [Complex.rank_real_complex] + + norm_num + + have h_connected := isConnected_compl_singleton_of_one_lt_rank h_rank (1 : ℂ) + + exact h_connected.isPreconnected + +lemma eventually_eq_zero_implies_frequently_eq_zero_punctured (f : ℂ → ℂ) (z₀ : ℂ) : + (∀ᶠ z in nhds z₀, f z = 0) → (∃ᶠ z in nhdsWithin z₀ {z₀}ᶜ, f z = 0) := by + intro h_eventually + + have h_nebot : Filter.NeBot (nhdsWithin z₀ {z₀}ᶜ) := by + + exact NormedField.nhdsNE_neBot z₀ + + have h_eventually_punctured : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ, f z = 0 := by + + exact Filter.Eventually.filter_mono nhdsWithin_le_nhds h_eventually + + exact h_eventually_punctured.frequently + +lemma riemannZeta_zeros_finite_of_compact (K : Set ℂ) (hK : IsCompact K) : + {z ∈ K | riemannZeta z = 0}.Finite := by + + by_contra h_not_finite + push Not at h_not_finite + + let Z := {z ∈ K | riemannZeta z = 0} + + have hZ_inf : Z.Infinite := h_not_finite + have hZ_sub : Z ⊆ K := fun z hz => hz.1 + + obtain ⟨z₀, hz₀_K, hz₀_acc⟩ := lem_bolzano_weierstrass hK hZ_inf hZ_sub + + by_cases h_eq_one : z₀ = 1 + · + subst h_eq_one + + have hZ_zeros : ∀ z ∈ Z, riemannZeta z = 0 := fun z hz => hz.2 + + exact riemannZeta_no_zeros_accumulate_at_one Z hZ_zeros hz₀_acc + + · + + have h_analytic : AnalyticAt ℂ riemannZeta z₀ := + zetaanalOnnot1 z₀ h_eq_one + + obtain h_ev_zero | h_ev_ne := h_analytic.eventually_eq_zero_or_eventually_ne_zero + + · + + have h_freq := eventually_eq_zero_implies_frequently_eq_zero_punctured riemannZeta z₀ h_ev_zero + + have h_eq_on_zero := zetaanalOnnot1.eqOn_zero_of_preconnected_of_frequently_eq_zero + complex_minus_singleton_connected h_eq_one h_freq + + have : riemannZeta 0 = 0 := h_eq_on_zero (by simp : (0 : ℂ) ∈ {s | s ≠ 1}) + rw [riemannZeta_zero] at this + norm_num at this + + · + + unfold AccPt at hz₀_acc + + have h_ev_not_Z : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ, z ∉ Z := by + apply Filter.Eventually.mono h_ev_ne + intro z hz hz_in_Z + exact hz hz_in_Z.2 + + have h_ev_false : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z, False := by + rw [Filter.eventually_inf_principal] + exact h_ev_not_Z + + have h_eq_bot : nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z = ⊥ := + Filter.eventually_false_iff_eq_bot.mp h_ev_false + + have h_ne_bot : nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z ≠ ⊥ := hz₀_acc.ne + + exact h_ne_bot h_eq_bot + +lemma lem_ZFRdelta : + ∀ z : ℂ, 2 < |z.im| → z.re > 1 - 9 * deltaz z → riemannZeta z ≠ 0 := by + intro z him hre + by_cases h1 : 1 ≤ z.re + · + simpa using riemannZeta_ne_zero_of_one_le_re h1 + + have hzlt1 : z.re < 1 := lt_of_not_ge h1 + + have hgt : |z.im| > 2 := by simpa using him + have hδ := (lem_delta19).1 z hgt + rcases hδ with ⟨hδ_pos, hδ_lt_19⟩ + + have h9δ_lt1 : 9 * deltaz z < 1 := by + have h := mul_lt_mul_of_pos_left hδ_lt_19 (by norm_num : 0 < (9 : ℝ)) + have h9 : (9 : ℝ) * (1 / 9) = 1 := by norm_num + simpa [h9] using h + have hzre_pos : 0 < z.re := by + have : 0 < 1 - 9 * deltaz z := sub_pos.mpr h9δ_lt1 + exact lt_trans this hre + + by_contra hzero + have hzmem : z ∈ zeroZ := by simpa [zeroZ] using hzero + + have hprop := (Classical.choose_spec zerofree).2.2 + have hbound : z.re ≤ 1 - zerofree_constant / Real.log (|z.im| + 2) := + hprop z ⟨hzmem, hzre_pos, hzlt1⟩ him + + set L : ℝ := Real.log (|z.im| + 2) with hLdef + have hLpos : 0 < L := by + have hone_lt : (1 : ℝ) < |z.im| + 2 := by + have : (0 : ℝ) ≤ |z.im| := abs_nonneg _ + linarith + have := Real.log_pos hone_lt + simpa [hLdef] using this + + have hb_le_a' : ((9 : ℝ) / 20) * (zerofree_constant / L) ≤ zerofree_constant / L := by + have hcoef_le1 : ((9 : ℝ) / 20) ≤ 1 := by norm_num + have ha_nonneg : 0 ≤ zerofree_constant / L := le_of_lt (div_pos zerofree_constant_pos hLpos) + have := mul_le_mul_of_nonneg_right hcoef_le1 ha_nonneg + simpa [one_mul] using this + have h9d_eq : 9 * deltaz z = ((9 : ℝ) / 20) * (zerofree_constant / L) := by + simp [deltaz, hLdef, div_eq_mul_inv, mul_left_comm, mul_assoc] + have hdelta_le : 9 * deltaz z ≤ zerofree_constant / L := by + simpa [h9d_eq] using hb_le_a' + have h_le_rhs : 1 - zerofree_constant / L ≤ 1 - 9 * deltaz z := by + have hneg := neg_le_neg hdelta_le + simpa [sub_eq_add_neg] using! add_le_add_right hneg 1 + + have hle : z.re ≤ 1 - 9 * deltaz z := le_trans hbound h_le_rhs + have hcontr : z.re < z.re := lt_of_le_of_lt hle hre + exact (lt_irrefl (z.re)) hcontr + +lemma complex_re_add_I_mul_real (a t : ℝ) : (((a : ℂ) + Complex.I * t).re) = a := by + + have h1 : ((Complex.I * (t : ℂ)).re) = -((t : ℂ).im) := by + simp + have ht_im : ((t : ℂ).im) = 0 := by simp + simp [Complex.add_re, Complex.ofReal_re, h1] + +lemma complex_im_add_I_mul_real (a t : ℝ) : (((a : ℂ) + Complex.I * t).im) = t := by + + have h1 : ((Complex.I * (t : ℂ)).im) = ((t : ℂ).re) := by + simp + have ht_re : ((t : ℂ).re) = t := by simp + simp [Complex.add_im, Complex.ofReal_im, h1] + +lemma complex_sub_ofReal_I_real_eq_ofReal (z : ℂ) (a t : ℝ) (him : z.im = t) : + z - ((a : ℂ) + Complex.I * t) = ((z.re - a) : ℂ) := by + apply Complex.ext + · simp [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.ofReal_im] + · simp [Complex.sub_im, Complex.add_im, Complex.ofReal_im, Complex.ofReal_re, him] + +lemma lem_ZFRinD (t : ℝ) (ht : |t| > 2) (z : ℂ) : + let c := (3/2 : ℂ) + I * t + 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → + z ∈ Metric.closedBall c (2/3) := by + intro c h + rcases h with ⟨h_low, hrest⟩ + rcases hrest with ⟨h_high, him⟩ + have hsub : z - c = ((z.re - (3/2)) : ℂ) := by + simpa [c] using! complex_sub_ofReal_I_real_eq_ofReal z (3/2) t him + have h1 : dist z c = ‖((z.re - (3/2)) : ℂ)‖ := by + simp [dist_eq_norm, hsub] + have h2 : ‖((z.re - (3/2)) : ℂ)‖ = ‖z.re - (3/2)‖ := by + simpa using (Complex.norm_real (z.re - (3/2))) + have hdist_abs : dist z c = |z.re - (3/2)| := by + have h4 : dist z c = ‖z.re - (3/2)‖ := h1.trans h2 + simpa [Real.norm_eq_abs] using h4 + have hnonpos : z.re - (3/2) ≤ 0 := sub_nonpos_of_le h_high + have habs : |z.re - (3/2)| = 3/2 - z.re := by + have := abs_of_nonpos hnonpos + simpa [neg_sub] using this + have hdist_eq : dist z c = 3/2 - z.re := hdist_abs.trans habs + have h_le : dist z c ≤ 1/2 + deltaz_t t := by + calc + dist z c = 3/2 - z.re := hdist_eq + _ ≤ 3/2 - (1 - deltaz_t t) := by linarith + _ = 1/2 + deltaz_t t := by ring + have hδlt : deltaz_t t < 1/9 := (lem_delta19.2 t ht).2 + have h12δ_lt : (1/2 : ℝ) + deltaz_t t < (1/2 : ℝ) + 1/9 := by + have := add_lt_add_left hδlt (1/2 : ℝ) + simpa [add_comm, add_left_comm, add_assoc] using this + have h123_lt : (1/2 : ℝ) + 1/9 < (2/3 : ℝ) := by norm_num + have h_lt : (1/2 : ℝ) + deltaz_t t < (2/3 : ℝ) := lt_trans h12δ_lt h123_lt + have hdist_le : dist z c ≤ 2/3 := le_trans h_le (le_of_lt h_lt) + exact (Metric.mem_closedBall).2 hdist_le + +lemma lem_ZFRnotK (t : ℝ) (ht : |t| > 2) (z : ℂ) : + let c := (3/2 : ℂ) + I * t + 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → + z ∉ zerosetKfRc (5/6) c riemannZeta := by + intro c h + + obtain ⟨h_ge, h_le, h_im⟩ := h + + have h_delta_eq : deltaz z = deltaz_t t := by + rw [deltaz_t, deltaz] + + congr 1 + congr 1 + + rw [h_im] + + simp only [Complex.mul_I_im, Complex.ofReal_re] + + have h_ge_delta : 1 - deltaz z ≤ Complex.re z := by + rwa [← h_delta_eq] at h_ge + + have h_im_gt : |z.im| > 2 := by + rw [h_im] + exact ht + + have h_delta_pos : 0 < deltaz z := by + exact (lem_delta19.1 z h_im_gt).1 + + have h_delta_lt_9delta : deltaz z < 9 * deltaz z := by + linarith [h_delta_pos] + + have h_strict : Complex.re z > 1 - 9 * deltaz z := by + linarith [h_ge_delta, h_delta_lt_9delta] + + have h_zeta_ne_zero : riemannZeta z ≠ 0 := + lem_ZFRdelta z h_im_gt h_strict + + intro h_mem + + have h_zero : riemannZeta z = 0 := h_mem.2 + + exact h_zeta_ne_zero h_zero + +lemma lem_Zeta_Expansion_ZFR : + ∃ C_1 : ℝ, C_1 > 1 ∧ + ∀ t : ℝ, |t| > 3 → + let c := (3/2 : ℂ) + I * t; + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + ∀ z : ℂ, 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → + ‖(deriv riemannZeta z / riemannZeta z) - + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ + ≤ C_1 * Real.log |t| := by + obtain ⟨C, hC_gt_one, hC_expansion⟩ := + Zeta1_Zeta_Expansion (2/3) (3/4) + (by norm_num : (0 : ℝ) < 2/3) + (by norm_num : (2/3 : ℝ) < 3/4) + (by norm_num : (3/4 : ℝ) < 5/6) + let C_1 := C * (1 / ((3/4 : ℝ) - 2/3)^3 + 1) + have hC_1_gt_1 : C_1 > 1 := by + have h_coeff : (1 : ℝ) / ((3/4 : ℝ) - 2/3)^3 + 1 > 1 := by + have h_pos : ((3/4 : ℝ) - 2/3)^3 > 0 := by norm_num + have h_div_pos : (1 : ℝ) / ((3/4 : ℝ) - 2/3)^3 > 0 := div_pos one_pos h_pos + linarith + have h_ge_1 : (1 : ℝ) ≤ C := le_of_lt hC_gt_one + exact one_lt_mul_of_le_of_lt h_ge_1 h_coeff + refine ⟨C_1, hC_1_gt_1, ?_⟩ + intro t ht c hfin z hz + have ht2 : |t| > 2 := by linarith + have hz_in_ball : z ∈ Metric.closedBall c (2/3) := by + simpa [c] using (lem_ZFRinD t ht2 z hz) + have hz_not_in_K : z ∉ zerosetKfRc (5/6) c riemannZeta := by + simpa [c] using (lem_ZFRnotK t ht2 z hz) + have hz_in_diff : z ∈ Metric.closedBall c (2/3) \ zerosetKfRc (5/6) c riemannZeta := + ⟨hz_in_ball, hz_not_in_K⟩ + have h_expansion := hC_expansion t ht hfin z hz_in_diff + rw [show logDerivZeta z = deriv riemannZeta z / riemannZeta z from rfl] at h_expansion + exact h_expansion + +lemma lem_abszrhoReRe (z ρ : ℂ) : ‖z - ρ‖ ≥ z.re - ρ.re := by + have h1 : (z - ρ).re ≤ ‖z - ρ‖ := Complex.re_le_norm (z - ρ) + have h2 : (z - ρ).re = z.re - ρ.re := Complex.sub_re z ρ + rw [← h2] + exact h1 + +lemma lem_Rerhotodeltarho {ρ : ℂ} : + ∀ t : ℝ, |t| > 3 → ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) (3/2+ t* Complex.I) riemannZeta) → ρ.re ≤ 1 - 9 * deltaz ρ := by + intro t ht h_mem + + have h_zero : riemannZeta ρ = 0 := h_mem.2 + + have h_ball : ρ ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6) := h_mem.1 + + have h_dist : dist ρ (3/2 + t * Complex.I) ≤ 5/6 := by + rwa [Metric.mem_closedBall] at h_ball + + have h_im : 2 < |ρ.im| := by + + have h_im_bound : |ρ.im - t| ≤ 5/6 := by + + have h_le_norm : |ρ.im - t| ≤ ‖ρ - (3/2 + t * Complex.I)‖ := by + have : |(ρ - (3/2 + t * Complex.I)).im| ≤ ‖ρ - (3/2 + t * Complex.I)‖ := + Complex.abs_im_le_norm _ + have h_im_eq : (ρ - (3/2 + t * Complex.I)).im = ρ.im - t := by + simp [Complex.sub_im, Complex.add_im, Complex.ofReal_im] + rwa [← h_im_eq] + rw [← Complex.dist_eq] at h_le_norm + linarith [h_le_norm, h_dist] + + have triangle := abs_sub_abs_le_abs_sub t ρ.im + + have eq_comm : |t - ρ.im| = |ρ.im - t| := abs_sub_comm t ρ.im + rw [eq_comm] at triangle + + have h_ge : |ρ.im| ≥ |t| - |ρ.im - t| := by linarith [triangle] + + have : |ρ.im| ≥ |t| - 5/6 := by linarith [h_ge, h_im_bound] + have : |ρ.im| > 3 - 5/6 := by linarith [ht] + have h_calc : (3 : ℝ) - 5/6 = 13/6 := by norm_num + have h_gt2 : (13 : ℝ)/6 > 2 := by norm_num + rw [h_calc] at * + linarith [h_gt2] + + have h_not_gt : ¬(ρ.re > 1 - 9 * deltaz ρ) := by + intro h_gt + have h_ne_zero := lem_ZFRdelta ρ h_im h_gt + exact h_ne_zero h_zero + + exact le_of_not_gt h_not_gt + +lemma lem_DImt2d : + ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), + |z.im| ≤ |t| + 5/6 := by + intro t ht z hz + + rw [Metric.mem_closedBall] at hz + + have center_im : (3/2 + t * Complex.I).im = t := by simp [Complex.add_im, Complex.mul_im] + + have diff_im : (z - (3/2 + t * Complex.I)).im = z.im - t := by + rw [Complex.sub_im, center_im] + + have h1 : |z.im - t| ≤ ‖z - (3/2 + t * Complex.I)‖ := by + rw [← diff_im] + exact Complex.abs_im_le_norm _ + + have h2 : |z.im - t| ≤ 5/6 := le_trans h1 (by simpa only [dist_eq_norm] using! hz) + + have h3 : |z.im| ≤ |z.im - t| + |t| := by + conv_lhs => rw [show z.im = (z.im - t) + t by ring] + exact abs_add_le (z.im - t) t + linarith + +lemma lem_DIMt2 : + ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), + |z.im| + 2 ≤ (|t| + 2)^3 := by + intro t ht z hz + + have h1' := lem_DImt2d t ht z hz + + have h1a : |z.im| + 2 ≤ |t| + 17/6 := by + simpa [show |t| + 5/6 + 2 = |t| + 17/6 by ring] using! add_le_add_left h1' 2 + + have h17le3 : |t| + 17/6 ≤ |t| + 3 := by + have : (17 : ℝ) / 6 ≤ 3 := by norm_num + exact add_le_add_right this _ + + have h_nonneg_poly : 0 ≤ |t|^3 + 6 * |t|^2 + 11 * |t| + 5 := by + have h0 : 0 ≤ |t|^3 := by exact pow_nonneg (abs_nonneg _) 3 + have h1 : 0 ≤ 6 * |t|^2 := by + have : 0 ≤ (6 : ℝ) := by norm_num + exact mul_nonneg this (sq_nonneg _) + have h2 : 0 ≤ 11 * |t| := by + have : 0 ≤ (11 : ℝ) := by norm_num + exact mul_nonneg this (abs_nonneg _) + have h3 : 0 ≤ (5 : ℝ) := by norm_num + exact add_nonneg (add_nonneg (add_nonneg h0 h1) h2) h3 + have h_add : |t| + 3 ≤ (|t| + 3) + (|t|^3 + 6 * |t|^2 + 11 * |t| + 5) := by + simpa using (le_add_of_nonneg_right (a := |t| + 3) h_nonneg_poly) + have h_expand : (|t| + 2)^3 = (|t| + 3) + (|t|^3 + 6 * |t|^2 + 11 * |t| + 5) := by + ring + have h3 : |t| + 3 ≤ (|t| + 2)^3 := by + simpa [h_expand] using h_add + + exact le_trans (le_trans h1a h17le3) h3 + +lemma lem_DlogImlog : + ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), + Real.log (|z.im| + 2) ≤ 3 * Real.log (|t| + 2) := by + intro t ht z hz + + have h1 : |z.im| + 2 ≤ (|t| + 2)^3 := lem_DIMt2 t ht z hz + + have h2 : 0 < |z.im| + 2 := by + have : 0 ≤ |z.im| := abs_nonneg _ + linarith + + have hlog := Real.log_le_log h2 h1 + + simpa [Real.log_pow] using hlog + +lemma lem_D1logtlog : + ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), + (1 : ℝ) / Real.log (|t| + 2) ≤ 3 / Real.log (|z.im| + 2) := by + intro t ht z hz + have h1 := lem_DlogImlog t ht z hz + + have ht_pos : |t| + 2 > 1 := by linarith [abs_nonneg t] + have hz_pos : |z.im| + 2 > 1 := by linarith [abs_nonneg z.im] + have log_t_pos : Real.log (|t| + 2) > 0 := Real.log_pos ht_pos + have log_z_pos : Real.log (|z.im| + 2) > 0 := Real.log_pos hz_pos + + rw [div_le_div_iff₀ log_t_pos log_z_pos] + simp only [one_mul] + exact h1 + +lemma lem_Ddt2dz : + ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), + deltaz_t t ≤ 3 * deltaz z := by + intro t ht z hz + have h := lem_D1logtlog t ht z hz + have hpos : 0 ≤ zerofree_constant / 20 := by + have ha : 0 < zerofree_constant := zerofree_constant_pos + have h9 : 0 < (20 : ℝ) := by norm_num + exact div_nonneg (le_of_lt ha) (le_of_lt h9) + have h2 := mul_le_mul_of_nonneg_left h hpos + calc + deltaz_t t + = (zerofree_constant / 20) / Real.log (|t| + 2) := by + simp [deltaz_t, deltaz] + _ = (zerofree_constant / 20) * (1 / Real.log (|t| + 2)) := by simp [div_eq_mul_inv] + _ ≤ (zerofree_constant / 20) * (3 / Real.log (|z.im| + 2)) := h2 + _ = 3 * ((zerofree_constant / 20) * (1 / Real.log (|z.im| + 2))) := by + simp [div_eq_mul_inv, mul_left_comm, mul_assoc] + _ = 3 * deltaz z := by simp [deltaz, div_eq_mul_inv, mul_left_comm, mul_assoc] + +lemma lem_deltarhotodeltat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → deltaz ρ ≥ (1/3) * deltaz_t t := by + intro c hρK + rcases hρK with ⟨hball, _hzero⟩ + have hball' : ρ ∈ Metric.closedBall ((3/2 : ℂ) + t * Complex.I) (5/6) := by + simpa [c, mul_comm] using! hball + have hmain : deltaz_t t ≤ 3 * deltaz ρ := lem_Ddt2dz t ht ρ hball' + have hthird_nonneg : 0 ≤ (1/3 : ℝ) := by norm_num + have h_mul : (1/3 : ℝ) * deltaz_t t ≤ (1/3 : ℝ) * (3 * deltaz ρ) := + mul_le_mul_of_nonneg_left hmain hthird_nonneg + have h_simplify : (1/3 : ℝ) * (3 * deltaz ρ) = deltaz ρ := by + ring + have : (1/3 : ℝ) * deltaz_t t ≤ deltaz ρ := by + simpa [h_simplify] using h_mul + simpa [mul_comm] using this + +lemma lem_Rerhotodeltat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ρ.re ≤ 1 - 3 * deltaz_t t := by + intros c h_rho_in + + have h1 : ρ.re ≤ 1 - 9 * deltaz ρ := + lem_Rerhotodeltarho (ρ := ρ) t ht (by simpa [c, mul_comm] using! h_rho_in) + + have h2 : deltaz ρ ≥ (1/3) * deltaz_t t := lem_deltarhotodeltat t ht ρ h_rho_in + + have h3 : 9 * deltaz ρ ≥ 3 * deltaz_t t := by + calc + 9 * deltaz ρ + ≥ 9 * ((1/3) * deltaz_t t) := by + exact mul_le_mul_of_nonneg_left h2 (by norm_num : (0 : ℝ) ≤ 9) + _ = 9 * (1/3) * deltaz_t t := by ring + _ = 3 * deltaz_t t := by norm_num + + have h4 : 1 - 9 * deltaz ρ ≤ 1 - 3 * deltaz_t t := by + linarith [h3] + + exact le_trans h1 h4 + +lemma lem_RezRerho (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → + 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + z.re - ρ.re ≥ 2 * deltaz_t t := by + intro c h_rho_mem h_z + + have h_rho_bound := lem_Rerhotodeltat t ht ρ h_rho_mem + + have h_z_lower := h_z.1 + + linarith [h_z_lower, h_rho_bound] + +lemma lem_abszrhodelta (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → + 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + ‖z - ρ‖ ≥ 2 * deltaz_t t := by + intro c h_rho_in_K h_z_conditions + + have h1 : z.re - ρ.re ≥ 2 * deltaz_t t := (lem_RezRerho t ht z ρ) h_rho_in_K h_z_conditions + + have h2 : ‖z - ρ‖ ≥ z.re - ρ.re := lem_abszrhoReRe z ρ + + exact le_trans h1 h2 + +lemma lem_abszrhodeltanot0 (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → + 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + ‖z - ρ‖ > 0 := by + intro c hmem hbounds + + have h1 := lem_abszrhodelta t ht z ρ hmem hbounds + + have h2 := lem_delta19.2 t (by linarith [ht] : |t| > 2) + have h3 : 0 < deltaz_t t := h2.1 + + have h4 : 0 < 2 * deltaz_t t := by + linarith [h3] + + linarith [h1, h4] + +lemma lem_1abszrho (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → + 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + 1 / ‖z - ρ‖ ≤ 1 / (2 * deltaz_t t) := by + intro c hρ hz + + apply one_div_le_one_div_of_le + + · have h_delta_pos : 0 < deltaz_t t := by + have h_delta19 := lem_delta19 + exact (h_delta19.2 t (by linarith [ht] : |t| > 2)).1 + linarith [h_delta_pos] + + · exact lem_abszrhodelta t ht z ρ hρ hz + +lemma lem_m_rho_zeta_nat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : + let c := (3/2 : ℂ) + I * t + ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ∃ n : ℕ, (analyticOrderAt riemannZeta ρ) = n := by + intro c hρK + classical + + have ht1 : |t| > 1 := lt_trans (by norm_num) ht + + have hρ_in_ball1 : ρ ∈ Metric.closedBall c 1 := by + have hρ_le : dist ρ c ≤ (5 / 6 : ℝ) := by simpa [Metric.mem_closedBall] using hρK.1 + have : dist ρ c ≤ (1 : ℝ) := le_trans hρ_le (by norm_num) + simpa [Metric.mem_closedBall] using this + + have hρ_ne_one : ρ ≠ (1 : ℂ) := (D1cinTt_pre t ht1) ρ hρ_in_ball1 + + have hζ_analytic_at_ρ : AnalyticAt ℂ riemannZeta ρ := zetaanalOnnot1 ρ hρ_ne_one + + have h_not_eventually_zero : ¬ (∀ᶠ z in nhds ρ, riemannZeta z = 0) := by + by_contra h_ev + + have h_freq := eventually_eq_zero_implies_frequently_eq_zero_punctured riemannZeta ρ h_ev + + have h_zero_on_S := + zetaanalOnnot1.eqOn_zero_of_preconnected_of_frequently_eq_zero + complex_minus_singleton_connected hρ_ne_one h_freq + + have hc_in_ball1 : c ∈ Metric.closedBall c 1 := by + have : dist c c ≤ (1 : ℝ) := by simp [dist_self] + simp [Metric.mem_closedBall] + have hc_ne_one : c ≠ (1 : ℂ) := (D1cinTt_pre t ht1) c hc_in_ball1 + have hc_in_S : c ∈ {s : ℂ | s ≠ 1} := by simpa [Set.mem_ofPred_eq] using hc_ne_one + have hζc_zero : riemannZeta c = 0 := h_zero_on_S hc_in_S + exact (zetacnot0 t) hζc_zero + + have hfinite : analyticOrderAt riemannZeta ρ ≠ ⊤ := by + intro htop + have hiff : analyticOrderAt riemannZeta ρ = ⊤ ↔ ∀ᶠ z in nhds ρ, riemannZeta z = 0 := + analyticOrderAt_eq_top (f := riemannZeta) (z₀ := ρ) + have : ∀ᶠ z in nhds ρ, riemannZeta z = 0 := hiff.mp htop + exact h_not_eventually_zero this + + refine ⟨(analyticOrderAt riemannZeta ρ).toNat, ?_⟩ + simpa using (ENat.natCast_toNat hfinite).symm + +lemma lem_finiteKzeta (t : ℝ) (_ht : |t| > 3) : + let c := (3/2 : ℂ) + I * t + (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite := by + intro c + have hK : IsCompact (Metric.closedBall c (5 / (6 : ℝ))) := + closedBall_compact_complex c (5 / (6 : ℝ)) + simpa [zerosetKfRc] using + (riemannZeta_zeros_finite_of_compact (Metric.closedBall c (5 / (6 : ℝ))) hK) + +lemma lem_triangle_ZFR (t : ℝ) (_ht : |t| > 3) (z : ℂ) : + let c := (3/2 : ℂ) + I * t + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ ≤ + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) := by + + intros c hfin hz_cond + + apply le_trans (norm_sum_le _ _) + + apply Finset.sum_le_sum + intro ρ hρ + + rw [norm_div] + + rw [Complex.norm_natCast] + +lemma lem_Zeta_Triangle_ZFR : + ∃ C_1 : ℝ, C_1 > 1 ∧ + ∀ t : ℝ, |t| > 3 → + let c := (3/2 : ℂ) + I * t + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + ‖deriv riemannZeta z / riemannZeta z‖ ≤ + ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ + + C_1 * Real.log |t| := by + obtain ⟨C1, hC1, hbound⟩ := lem_Zeta_Expansion_ZFR + refine ⟨C1, hC1, ?_⟩ + intro t ht c hfin z hz + + let S := (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)) + have hbound1 := hbound t ht hfin z hz + have htri : ‖deriv riemannZeta z / riemannZeta z‖ ≤ ‖(deriv riemannZeta z / riemannZeta z) - S‖ + ‖S‖ := by + have hn := norm_add_le ((deriv riemannZeta z / riemannZeta z) - S) S + have hrewrite : (deriv riemannZeta z / riemannZeta z) - S + S = (deriv riemannZeta z / riemannZeta z) := by + simp [sub_eq_add_neg] + simpa [S, hrewrite] using hn + have hsum := add_le_add_left hbound1 ‖S‖ + have : ‖deriv riemannZeta z / riemannZeta z‖ ≤ C1 * Real.log |t| + ‖S‖ := le_trans htri hsum + simpa [S, add_comm] using this + +lemma lem_sumK1abs (t : ℝ) (ht : |t| > 3) (z : ℂ) : + let c := (3/2 : ℂ) + I * t + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ + (1 / (2 * deltaz_t t)) * (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) := by + intro c hfin hzcond + + have hptwise : ∀ ρ ∈ hfin.toFinset, + ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖ ≤ + (1 / (2 * deltaz_t t)) * ((analyticOrderAt riemannZeta ρ).toNat : ℝ) := by + intro ρ hρmem + have hρ_in : ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) := + (Set.Finite.mem_toFinset (hs := hfin)).1 hρmem + have hbase : 1 / ‖z - ρ‖ ≤ 1 / (2 * deltaz_t t) := + lem_1abszrho t ht z ρ hρ_in hzcond + have hnonneg : 0 ≤ ((analyticOrderAt riemannZeta ρ).toNat : ℝ) := by + exact_mod_cast (Nat.zero_le ((analyticOrderAt riemannZeta ρ).toNat)) + have := mul_le_mul_of_nonneg_left hbase hnonneg + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this + have hsum := Finset.sum_le_sum hptwise + + have hrw := + (Finset.mul_sum (s := hfin.toFinset) + (f := fun ρ => ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) + (a := (1 / (2 * deltaz_t t)))) + have hsum2 := hsum + + rw [← hrw] at hsum2 + + simpa [div_eq_mul_inv] using hsum2 + +lemma helper_analyticOnNhd_shift_div (f : ℂ → ℂ) (c : ℂ) + (h : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ f z) + (_hc : f c ≠ 0) : + AnalyticOnNhd ℂ (fun z => f (z + c) / f c) (Metric.closedBall (0 : ℂ) 1) := by + + intro z hz + + have hz_norm : ‖z‖ ≤ 1 := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hz + + have hz_addc_mem : z + c ∈ Metric.closedBall c 1 := by + + have : dist (z + c) c ≤ 1 := by + simpa [dist_eq_norm, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hz_norm + simpa [Metric.mem_closedBall] using this + + have h_f_at : AnalyticAt ℂ f (z + c) := h (z + c) hz_addc_mem + + have h_addc : AnalyticAt ℂ (fun w => w + c) z := by + simpa using! (analyticAt_id.add analyticAt_const) + + have h_comp : AnalyticAt ℂ (fun w => f (w + c)) z := + (AnalyticAt.fun_comp h_f_at h_addc) + + have h_mul_const : AnalyticAt ℂ (fun w => (1 / f c) * f (w + c)) z := + (analyticAt_const.mul h_comp) + + simpa [div_eq_mul_inv, mul_comm] using h_mul_const + +lemma helper_finite_zeros_shift (r : ℝ) (_hr : r > 0) (c : ℂ) (f : ℂ → ℂ) + (hc : f c ≠ 0) + (_h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) + (hfin : (zerosetKfRc r c f).Finite) : + (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)).Finite := +by + classical + let g : ℂ → ℂ := fun z => f (z + c) / f c + have hEq : + zerosetKfRc r (0 : ℂ) g = (fun ρ : ℂ => ρ - c) '' zerosetKfRc r c f := by + apply Set.Subset.antisymm + · intro x hx + + have hx_ball : dist x (0 : ℂ) ≤ r := by + simpa [Metric.mem_closedBall] using hx.1 + + have hx_ball' : dist (x + c) c ≤ r := by + simpa [Complex.dist_eq, add_sub_cancel] using hx_ball + + have hx_zero : f (x + c) = 0 := by + rcases (div_eq_zero_iff).mp (by simpa [g] using hx.2) with hnum | hden + · exact hnum + · exact (hc hden).elim + refine ⟨x + c, ?_, ?_⟩ + · exact ⟨by simpa [Metric.mem_closedBall] using hx_ball', hx_zero⟩ + · simp + · intro x hx + rcases hx with ⟨ρ, hρ, rfl⟩ + + have hρ_ball : dist ρ c ≤ r := by + simpa [Metric.mem_closedBall] using hρ.1 + refine ⟨?_, ?_⟩ + · + simpa [Metric.mem_closedBall, Complex.dist_eq] using hρ_ball + · + have : f ρ = 0 := hρ.2 + simp [g, sub_add_cancel, this] + + have himage : ((fun ρ : ℂ => ρ - c) '' zerosetKfRc r c f).Finite := + hfin.image (fun ρ : ℂ => ρ - c) + simpa [g, hEq] using himage + +lemma helper_bound_shifted (B R : ℝ) (_hB : 1 < B) (_hRpos : 0 < R) (_hRlt1 : R < 1) + (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) + (h_bound : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R, + ‖(fun w => f (w + c) / f c) z‖ ≤ B / ‖f c‖ := +by + intro z hz + + have hz_norm : ‖z‖ ≤ R := by + have hz' : dist z (0 : ℂ) ≤ R := by simpa [Metric.mem_closedBall] using hz + simpa [Complex.dist_eq] using hz' + + have hz_ballc : z + c ∈ Metric.closedBall c R := by + simpa [Metric.mem_closedBall, Complex.dist_eq, add_sub_cancel] using hz_norm + + have hfb : ‖f (z + c)‖ ≤ B := h_bound (z + c) hz_ballc + + have hpos : 0 < ‖f c‖ := (norm_pos_iff).2 hc + + have hdiv : ‖f (z + c)‖ / ‖f c‖ ≤ B / ‖f c‖ := (div_le_div_iff_of_pos_right hpos).2 hfb + + have hnorm_eq : ‖(fun w => f (w + c) / f c) z‖ = ‖f (z + c)‖ / ‖f c‖ := by + change ‖f (z + c) / f c‖ = ‖f (z + c)‖ / ‖f c‖ + simp + simpa [hnorm_eq] using hdiv + +lemma helper_g_zero_eq_one (f : ℂ → ℂ) (c : ℂ) (hc : f c ≠ 0) : + (fun z => f (z + c) / f c) 0 = 1 := by + simp [hc] + +lemma helper_zerosetKfR_eq_center0 (r : ℝ) (hr : r > 0) (f : ℂ → ℂ) : + zerosetKfR r hr f = zerosetKfRc r (0 : ℂ) f := by + ext ρ; simp [zerosetKfR, zerosetKfRc] + +lemma helper_sum_nonneg_nat (ι : Type*) (s : Finset ι) (f : ι → ℕ) : + 0 ≤ ∑ i ∈ s, ((f i : ℝ)) := by + classical + have h : ∀ i ∈ s, (0 : ℝ) ≤ (f i : ℝ) := by + intro i hi + exact_mod_cast (Nat.zero_le (f i)) + simpa using Finset.sum_nonneg h + +lemma helper_one_le_Bdivfc2 (B R : ℝ) (_hB : 1 < B) (hRpos : 0 < R) (_hRlt1 : R < 1) + (f : ℂ → ℂ) (c : ℂ) (hc : f c ≠ 0) + (h_bound : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) : + 1 ≤ B / ‖f c‖ := +by + have hc_in : c ∈ Metric.closedBall c R := by + have h0le : (0 : ℝ) ≤ R := le_of_lt hRpos + simpa [Metric.mem_closedBall, dist_self] using h0le + have hfc_le : ‖f c‖ ≤ B := h_bound c hc_in + have hfc_pos : 0 < ‖f c‖ := (norm_pos_iff.mpr hc) + have hdiv := (div_le_div_iff_of_pos_right (c := ‖f c‖) hfc_pos).mpr hfc_le + simpa [div_self (ne_of_gt hfc_pos)] using hdiv + +lemma helper_sum_over_equal_finite_sets {α : Type*} (S T : Set α) + (hS : S.Finite) (hT : T.Finite) (hST : S = T) (φ : α → ℝ) : + (∑ x ∈ hS.toFinset, φ x) = (∑ x ∈ hT.toFinset, φ x) := by + classical + have hfin_eq : hS.toFinset = hT.toFinset := by + ext x + constructor + · intro hx + have hxS : x ∈ S := by + have hmem : x ∈ hS.toFinset ↔ x ∈ S := by + simp + exact hmem.mp hx + have hxT : x ∈ T := by simpa [hST] using hxS + have hmemT : x ∈ hT.toFinset ↔ x ∈ T := by + simp + exact hmemT.mpr hxT + · intro hx + have hxT : x ∈ T := by + have hmemT : x ∈ hT.toFinset ↔ x ∈ T := by + simp + exact hmemT.mp hx + have hxS : x ∈ S := by simpa [hST] using hxT + have hmemS : x ∈ hS.toFinset ↔ x ∈ S := by + simp + exact hmemS.mpr hxS + simp [hfin_eq] + +lemma helper_apply_jensen_to_g + (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (g : ℂ → ℂ) + (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) + (hg0_ne : g 0 ≠ 0) + (hg0_one : g 0 = 1) + (hfin_g : (zerosetKfR R1 (by linarith) g).Finite) + (hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B) : + (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ≤ Real.log B / Real.log (R / R1) := by + classical + + have h_exists : ∀ σ ∈ zerosetKfR R1 (by linarith) g, + ∃ hσ : ℂ → ℂ, AnalyticAt ℂ hσ σ ∧ hσ σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, g z = (z - σ) ^ (analyticOrderAt g σ).toNat * hσ z := by + intro σ hσ + exact lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR_lt_1 g h_g_analytic hg0_ne σ hσ + + let h_σ : ℂ → (ℂ → ℂ) := + fun σ => dite (σ ∈ zerosetKfR R1 (by linarith) g) + (fun h => Classical.choose (h_exists σ h)) + (fun _ => fun _ => (1 : ℂ)) + + have h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) g, + AnalyticAt ℂ (h_σ σ) σ ∧ (h_σ σ) σ ≠ 0 ∧ + ∀ᶠ z in nhds σ, g z = (z - σ) ^ (analyticOrderAt g σ).toNat * (h_σ σ) z := by + intro σ hσin + have hx := h_exists σ hσin + dsimp [h_σ] + + simpa [hσin] using (Classical.choose_spec hx) + + have hbound := + lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 + g h_g_analytic hg0_ne hg0_one hfin_g (h_σ := h_σ) hg_le_B h_σ_spec + + simpa [one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hbound + +lemma helper_sum_f_equals_sum_g + (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) + (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) + (hfin : (zerosetKfRc r c f).Finite) : + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) + = + (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), + ((analyticOrderAt (fun z => f (z + c) / f c) ρ').toNat : ℝ)) := +by + classical + + let S : Finset ℂ := hfin.toFinset + let φ : ℂ → ℂ := fun ρ => ρ - c + let g' : ℂ → ℂ := fun z => f (z + c) / f c + + have himg : (φ '' zerosetKfRc r c f).Finite := hfin.image φ + have h_img_toFinset : ((hfin.image φ).toFinset) = S.image φ := by + simpa [S] using (Set.Finite.toFinset_image (s := (zerosetKfRc r c f)) (f := φ) + (hs := hfin) (h := himg)) + + have h_orders_match : + (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ)) = + (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := by + apply Finset.sum_congr rfl + intro ρ hρS + + have hρ_mem : ρ ∈ zerosetKfRc r c f := + (Set.Finite.mem_toFinset (hs := hfin)).1 hρS + have hρ_ball : ρ ∈ Metric.closedBall c r := hρ_mem.1 + have hρ_fzero : f ρ = 0 := hρ_mem.2 + + have hρ'_ball : (φ ρ) ∈ Metric.closedBall (0 : ℂ) r := by + + have hdist_le : dist ρ c ≤ r := by + simpa [Metric.mem_closedBall] using hρ_ball + + have : dist (φ ρ) 0 ≤ r := by + simpa [φ, dist_eq_norm] using (by simpa [dist_eq_norm] using hdist_le) + simpa [Metric.mem_closedBall] using this + have hρ'_gzero : g' (φ ρ) = 0 := by + simp [g', φ, hρ_fzero, sub_eq_add_neg, add_comm] + have hρ'_mem : (φ ρ) ∈ zerosetKfRc r (0 : ℂ) g' := ⟨hρ'_ball, hρ'_gzero⟩ + + have h_m_eq := fc_m_order r hr c f hc h_analytic (ρ' := φ ρ) hρ'_mem + + have h_m_eq' : analyticOrderAt g' (φ ρ) = analyticOrderAt f ρ := by + simpa [g', φ, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h_m_eq + + have h_toNat : (analyticOrderAt g' (φ ρ)).toNat = (analyticOrderAt f ρ).toNat := by + simpa using congrArg ENat.toNat h_m_eq' + simp [h_toNat] + + have h_inj : Function.Injective φ := by + intro x y hxy + + have := congrArg (fun z => z + c) hxy + simpa [φ, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this + + have h_sum_image : + (∑ ρ' ∈ S.image φ, ((analyticOrderAt g' ρ').toNat : ℝ)) = + (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := by + refine Finset.sum_image ?h + intro x hx y hy hxy + + exact h_inj hxy + + calc + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) + = (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ)) := by rfl + _ = (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := h_orders_match + _ = (∑ ρ' ∈ S.image φ, ((analyticOrderAt g' ρ').toNat : ℝ)) := h_sum_image.symm + _ = (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), + ((analyticOrderAt (fun z => f (z + c) / f c) ρ').toNat : ℝ)) := by + + simp [S, φ, g', h_img_toFinset] + +lemma helper_zero_set_shift_eq + (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) + (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) : + zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c) + = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := by + simpa using fc_zeros r hr c f hc h_analytic + +lemma helper_fin_zero_g_is_image + (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) + (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) + (hfin : (zerosetKfRc r c f).Finite) : + (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)).Finite := +by + classical + have hset : zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c) + = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := + by simpa using fc_zeros r hr c f hc h_analytic + have hfin_img : ((fun ρ => ρ - c) '' (zerosetKfRc r c f)).Finite := hfin.image _ + simpa [hset] using hfin_img + +lemma helper_AnalyticOnNhd_to_pointwise {S : Set ℂ} {f : ℂ → ℂ} + (h : AnalyticOnNhd ℂ f S) : ∀ z ∈ S, AnalyticAt ℂ f z := by + intro z hz + exact h z hz + +lemma jensen_sum_bound_strict + (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) + (g : ℂ → ℂ) + (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) + (hg0_ne : g 0 ≠ 0) + (hg0_one : g 0 = 1) + (hfin_g : (zerosetKfR R1 (by linarith) g).Finite) + (hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B) : + (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ≤ + Real.log B / Real.log (R / R1) := by + exact helper_apply_jensen_to_g B R R1 hB hR1_pos hR1_lt_R hR_lt_1 g + h_g_analytic hg0_ne hg0_one hfin_g hg_le_B + +lemma no_zero_of_bound_one_and_center_one + (R : ℝ) (hR_lt_1 : R < 1) + (g : ℂ → ℂ) + (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) + (hg0_one : g 0 = 1) + (hg_le_one : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ 1) : + ∀ z ∈ Metric.closedBall (0 : ℂ) R, g z ≠ 0 := by + intro z hz + by_cases hRpos : 0 < R + · + + have hdiff : DifferentiableOn ℂ g (Metric.ball (0 : ℂ) R) := by + intro x hx + have hxlt : ‖x‖ < R := by + simpa [Metric.mem_ball, Complex.dist_eq] using hx + have hxle1 : ‖x‖ ≤ 1 := le_trans (le_of_lt hxlt) (le_of_lt hR_lt_1) + have hx_in1 : x ∈ Metric.closedBall (0 : ℂ) 1 := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hxle1 + exact ((h_g_analytic x hx_in1).differentiableAt).differentiableWithinAt + + have hcont : ContinuousOn g (Metric.closedBall (0 : ℂ) R) := by + intro x hx + have hxleR : ‖x‖ ≤ R := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hx + have hxle1 : ‖x‖ ≤ 1 := le_trans hxleR (le_of_lt hR_lt_1) + have hx_in1 : x ∈ Metric.closedBall (0 : ℂ) 1 := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hxle1 + exact (h_g_analytic x hx_in1).continuousAt.continuousWithinAt + have hdcc : DiffContOnCl ℂ g (Metric.ball (0 : ℂ) R) := + DiffContOnCl.mk_ball hdiff hcont + + have hIsMax : IsMaxOn (fun z => ‖g z‖) (Metric.ball (0 : ℂ) R) 0 := by + intro y hy + have hynormlt : ‖y‖ < R := by + simpa [Metric.mem_ball, Complex.dist_eq] using hy + have hyle : ‖y‖ ≤ R := le_of_lt hynormlt + have hgy : ‖g y‖ ≤ 1 := hg_le_one y hyle + simpa [hg0_one] using hgy + + have hEqOn := + Complex.eqOn_closedBall_of_isMaxOn_norm (z := (0 : ℂ)) (r := R) hdcc hIsMax + have hz_eq : g z = (fun _ => g 0) z := hEqOn hz + have hz_eq1 : g z = g 0 := by simpa using hz_eq + have gz_one : g z = 1 := by simpa [hg0_one] using hz_eq1 + simp [gz_one] + · + + have hRle : R ≤ 0 := le_of_not_gt hRpos + have hz_le : ‖z‖ ≤ R := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hz + have hz_norm_eq : ‖z‖ = 0 := + le_antisymm (le_trans hz_le hRle) (norm_nonneg z) + have hz_zero : z = 0 := by + simpa [norm_eq_zero] using hz_norm_eq + simp [hz_zero, hg0_one] + +lemma helper_sum_over_equal_finite_sets_orders + {S T : Set ℂ} (g : ℂ → ℂ) + (hS : S.Finite) (hT : T.Finite) (hST : S = T) : + (∑ x ∈ hS.toFinset, ((analyticOrderAt g x).toNat : ℝ)) + = (∑ x ∈ hT.toFinset, ((analyticOrderAt g x).toNat : ℝ)) := by + classical + have hF : hS.toFinset = hT.toFinset := by + ext x + simp [Set.Finite.mem_toFinset, hST] + simp [hF] + +lemma helper_mem_closedBall_zero_iff_norm_le (z : ℂ) (R : ℝ) : + z ∈ Metric.closedBall (0 : ℂ) R ↔ ‖z‖ ≤ R := by + simp [Metric.mem_closedBall, dist_eq_norm] + +lemma helper_bound_on_ball_to_norm_imp + {R : ℝ} {g : ℂ → ℂ} {M : ℝ} + (hg : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖g z‖ ≤ M) : + ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ M := by + intro z hz + have hz' : z ∈ Metric.closedBall (0 : ℂ) R := by + have : dist z (0 : ℂ) ≤ R := by + simpa [dist_eq_norm] using hz + simpa [Metric.mem_closedBall] using this + exact hg z hz' + +lemma helper_pointwise_to_AnalyticOnNhd {S : Set ℂ} {f : ℂ → ℂ} + (h : ∀ z ∈ S, AnalyticAt ℂ f z) : AnalyticOnNhd ℂ f S := by + simpa using! h + +lemma lem_sum_m_rho_bound_c (B R R1 : ℝ) (hB : 1 < B) + (hR1_pos : 0 < R1) + (hR1_lt_R : R1 < R) + (hR_lt_1 : R < 1) + (f : ℂ → ℂ) + (c : ℂ) + (h_f_analytic : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ f z) + (h_f_nonzero_at_zero : f c ≠ 0) + (hf_le_B : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) + (hfin : (zerosetKfRc R1 c f).Finite) : + ∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by + classical + + let g : ℂ → ℂ := fun z => f (z + c) / f c + + have h_g_analyticOn : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := + helper_analyticOnNhd_shift_div f c h_f_analytic h_f_nonzero_at_zero + have h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z := + helper_AnalyticOnNhd_to_pointwise h_g_analyticOn + + have hg0_one : g 0 = 1 := helper_g_zero_eq_one f c h_f_nonzero_at_zero + have hg0_ne : g 0 ≠ 0 := by simp [hg0_one] + + have hAnal_f : AnalyticOnNhd ℂ f (Metric.closedBall c 1) := + helper_pointwise_to_AnalyticOnNhd h_f_analytic + have hfin_g0 : (zerosetKfRc R1 (0 : ℂ) g).Finite := + helper_fin_zero_g_is_image R1 hR1_pos c f h_f_nonzero_at_zero hAnal_f hfin + have hZR_eq : zerosetKfR R1 hR1_pos g = zerosetKfRc R1 (0 : ℂ) g := + helper_zerosetKfR_eq_center0 R1 hR1_pos g + have hfin_g : (zerosetKfR R1 (by exact hR1_pos) g).Finite := by + simpa [hZR_eq] using hfin_g0 + + have h_bound_shift : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖g z‖ ≤ B / ‖f c‖ := + helper_bound_shifted B R hB (by exact lt_trans hR1_pos hR1_lt_R) hR_lt_1 c f + h_f_nonzero_at_zero (fun z hz => hf_le_B z <| by simpa using hz) + have hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B / ‖f c‖ := + helper_bound_on_ball_to_norm_imp (R := R) (g := g) (M := B / ‖f c‖) h_bound_shift + + have hfc_le : ‖f c‖ ≤ B := by + have : c ∈ Metric.closedBall c R := by + have hRpos' : 0 ≤ R := le_of_lt (lt_trans hR1_pos hR1_lt_R) + have : dist c c ≤ R := by simpa [dist_self] using hRpos' + simpa [Metric.mem_closedBall] using this + exact hf_le_B c this + have hfc_pos : 0 < ‖f c‖ := (norm_pos_iff).2 h_f_nonzero_at_zero + have hBdiv_ge_one : 1 ≤ B / ‖f c‖ := by + have hdiv := (div_le_div_iff_of_pos_right hfc_pos).mpr hfc_le + simpa [div_self (ne_of_gt hfc_pos)] using hdiv + + have hsum_fg_eq : + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) + = (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), + ((analyticOrderAt g ρ').toNat : ℝ)) := + helper_sum_f_equals_sum_g (r := R1) (hr := hR1_pos) (c := c) + (f := f) (hc := h_f_nonzero_at_zero) (h_analytic := hAnal_f) (hfin := hfin) + + have hST_g_img : zerosetKfR R1 hR1_pos g + = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := by + have h1 : zerosetKfR R1 hR1_pos g = zerosetKfRc R1 (0 : ℂ) g := + helper_zerosetKfR_eq_center0 R1 hR1_pos g + have h2 : zerosetKfRc R1 (0 : ℂ) g + = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := + helper_zero_set_shift_eq R1 hR1_pos c f h_f_nonzero_at_zero hAnal_f + simpa [h1] using h2 + + rcases lt_or_eq_of_le hBdiv_ge_one with hBdiv_gt_one | hBdiv_eq_one + · + have hsum_g_bound := + jensen_sum_bound_strict (B := B / ‖f c‖) (R := R) (R1 := R1) + (hB := hBdiv_gt_one) + (hR1_pos := hR1_pos) (hR1_lt_R := hR1_lt_R) (hR_lt_1 := hR_lt_1) + (g := g) (h_g_analytic := h_g_analytic) (hg0_ne := hg0_ne) + (hg0_one := hg0_one) (hfin_g := hfin_g) (hg_le_B := hg_le_B) + + have hsum_g_reindex : + (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) + = (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) := + helper_sum_over_equal_finite_sets_orders (g := g) + (S := zerosetKfR R1 hR1_pos g) + (T := (fun ρ => ρ - c) '' (zerosetKfRc R1 c f)) + (hS := hfin_g) (hT := hfin.image (fun ρ => ρ - c)) (hST := hST_g_img) + + have : + (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) + ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by + simpa [hsum_g_reindex] using hsum_g_bound + + simpa [hsum_fg_eq] using this + · + have hBdiv_eq_one' : B / ‖f c‖ = 1 := by + simpa [eq_comm] using hBdiv_eq_one + have hg_le_one : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ 1 := by + intro z hz + have := hg_le_B z hz + simpa [hBdiv_eq_one'] using this + have g_nonzero_on_ball : ∀ z ∈ Metric.closedBall (0 : ℂ) R, g z ≠ 0 := + no_zero_of_bound_one_and_center_one R hR_lt_1 g h_g_analytic hg0_one hg_le_one + + have hS_empty : zerosetKfR R1 hR1_pos g = (∅ : Set ℂ) := by + ext z; constructor + · intro hz + rcases hz with ⟨hzball, hzzero⟩ + have hzR1 : ‖z‖ ≤ R1 := by simpa [Metric.mem_closedBall, dist_eq_norm] using hzball + have hzR : ‖z‖ ≤ R := le_trans hzR1 (le_of_lt hR1_lt_R) + have hzR' : z ∈ Metric.closedBall (0 : ℂ) R := by + simpa [Metric.mem_closedBall, dist_eq_norm] using hzR + exact (g_nonzero_on_ball z hzR') hzzero + · intro hzfalse + cases hzfalse + have hsum_g_zero : + (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) = 0 := by + have h := + helper_sum_over_equal_finite_sets_orders (g := g) + (S := zerosetKfR R1 hR1_pos g) (T := (∅ : Set ℂ)) + (hS := hfin_g) (hT := Set.finite_empty) (hST := hS_empty) + simpa using h + + have hsum_reindex := + helper_sum_over_equal_finite_sets_orders (g := g) + (S := zerosetKfR R1 hR1_pos g) + (T := (fun ρ => ρ - c) '' (zerosetKfRc R1 c f)) + (hS := hfin_g) (hT := hfin.image (fun ρ => ρ - c)) (hST := hST_g_img) + have hsum_img_eq : + (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) + = (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) := by + simpa using hsum_reindex.symm + have hsum_img_zero : + (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) = 0 := by + simp [hsum_img_eq, hsum_g_zero] + + have hsum_f_zero : + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) = 0 := by + simpa [hsum_img_zero] using hsum_fg_eq + + have hRHS_zero : Real.log (B / ‖f c‖) / Real.log (R / R1) = 0 := by + simp [hBdiv_eq_one'] + + have : + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) + ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by + simp [hsum_f_zero, hRHS_zero] + exact this + +lemma lem_sum_m_rho_zeta : + ∃ C_2 > 1, ∀ (t : ℝ) (_ht : |t| > 3), + let c := (3/2 : ℂ) + I * t; + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + ∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) ≤ C_2 * Real.log |t| := by + classical + + obtain ⟨b, hb_gt1, hb_bound⟩ := zeta32upper + obtain ⟨a, ha_pos, ha_bound⟩ := zeta_low_332 + + let R1 : ℝ := 5 / 6 + let R : ℝ := 8 / 9 + let logRatio : ℝ := Real.log (R / R1) + + let u : ℝ := Real.log (b / a) + let C2 : ℝ := max 2 ((1 + |u|) / logRatio) + have hC2_gt_one : 1 < C2 := by + have htwo_lt : (1 : ℝ) < 2 := by norm_num + have hle : (2 : ℝ) ≤ C2 := by + have := le_max_left (2 : ℝ) ((1 + |u|) / logRatio) + simp [C2] + exact lt_of_lt_of_le htwo_lt hle + refine ⟨C2, hC2_gt_one, ?_⟩ + intro t ht c hfin + + have hR1_pos : 0 < R1 := by dsimp [R1]; norm_num + have hR1_lt_R : R1 < R := by dsimp [R1, R]; norm_num + have hR_lt_1 : R < 1 := by dsimp [R]; norm_num + have hR_le_one : R ≤ (1 : ℝ) := by dsimp [R]; norm_num + + have ht1 : |t| > 1 := lt_trans (by norm_num) ht + have h_f_analytic : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ riemannZeta z := by + intro z hz + have hz_ne_one : z ≠ (1 : ℂ) := (D1cinTt_pre t ht1) z (by simpa [c] using hz) + exact zetaanalOnnot1 z hz_ne_one + + have h_nonzero : riemannZeta c ≠ 0 := by simpa [c] using zetacnot0 t + + have ht2 : |t| > 2 := by linarith + have h_upper_on_ball1 : ∀ z ∈ Metric.closedBall c 1, ‖riemannZeta z‖ < b * |t| := by + have h := hb_bound t ht2 + intro z hz; simpa [c] using h z (by simpa [c] using hz) + have hf_le_B : ∀ z ∈ Metric.closedBall c R, ‖riemannZeta z‖ ≤ b * |t| := by + intro z hz + have hz1 : z ∈ Metric.closedBall c 1 := + (Metric.closedBall_subset_closedBall hR_le_one) hz + exact le_of_lt (h_upper_on_ball1 z hz1) + + have hb_pos : 0 < b := lt_trans (by norm_num) hb_gt1 + have htabove1 : (1 : ℝ) ≤ |t| := le_of_lt ht1 + have hb_le_B : b ≤ b * |t| := by + have := mul_le_mul_of_nonneg_left htabove1 (le_of_lt hb_pos) + simpa [one_mul] using this + have hBpos : 1 < b * |t| := lt_of_lt_of_le hb_gt1 hb_le_B + + have h_sum_bound := + lem_sum_m_rho_bound_c (B := b * |t|) (R := R) (R1 := R1) + (hB := hBpos) + (hR1_pos := hR1_pos) + (hR1_lt_R := hR1_lt_R) + (hR_lt_1 := hR_lt_1) + (f := riemannZeta) (c := c) + (h_f_analytic := h_f_analytic) + (h_f_nonzero_at_zero := h_nonzero) + (hf_le_B := hf_le_B) + (hfin := hfin) + + have hlogRatio_pos : 0 < logRatio := by + have : 1 < R / R1 := by dsimp [R, R1]; norm_num + exact Real.log_pos this + + have h_zeta_ge_a : a ≤ ‖riemannZeta c‖ := by + simpa [c, mul_comm] using! ha_bound t + + have ht_abs_pos : 0 < |t| := lt_trans (by norm_num) ht + have hζ_norm_pos : 0 < ‖riemannZeta c‖ := norm_pos_iff.mpr h_nonzero + have hb_ne : (b : ℝ) ≠ 0 := ne_of_gt hb_pos + have ht_abs_ne : (|t| : ℝ) ≠ 0 := ne_of_gt ht_abs_pos + have ha_ne : a ≠ 0 := ne_of_gt ha_pos + have hlog_split1 : + Real.log ((b * |t|) / ‖riemannZeta c‖) + = (Real.log b + Real.log |t|) - Real.log ‖riemannZeta c‖ := by + have : Real.log (b * |t|) = Real.log b + Real.log |t| := + Real.log_mul hb_ne ht_abs_ne + have : + Real.log ((b * |t|) / ‖riemannZeta c‖) + = Real.log (b * |t|) - Real.log ‖riemannZeta c‖ := + Real.log_div (by exact mul_ne_zero hb_ne ht_abs_ne) (ne_of_gt hζ_norm_pos) + simp [this, Real.log_mul hb_ne ht_abs_ne] + have hlog_div_eq : Real.log (b / a) = Real.log b - Real.log a := + Real.log_div hb_ne ha_ne + have hlog_a_le : Real.log a ≤ Real.log ‖riemannZeta c‖ := + Real.log_le_log (by exact ha_pos) (by exact h_zeta_ge_a) + have hneg : -(Real.log ‖riemannZeta c‖) ≤ -Real.log a := by + simpa using (neg_le_neg hlog_a_le) + have hRHS_le_const : + Real.log ((b * |t|) / ‖riemannZeta c‖) + ≤ Real.log |t| + Real.log (b / a) := by + + have : + (Real.log b + Real.log |t|) - Real.log ‖riemannZeta c‖ + ≤ (Real.log b + Real.log |t|) - Real.log a := by + simpa [sub_eq_add_neg] using! add_le_add_right hneg (Real.log b + Real.log |t|) + simpa [hlog_split1, sub_eq_add_neg, add_comm, add_left_comm, add_assoc, hlog_div_eq] + using this + + have hRHS1 : + Real.log ((b * |t|) / ‖riemannZeta c‖) / logRatio + ≤ (Real.log |t| + Real.log (b / a)) / logRatio := by + exact div_le_div_of_nonneg_right hRHS_le_const (le_of_lt hlogRatio_pos) + + have hlogt_ge_one : (1 : ℝ) ≤ Real.log |t| := by + + have h3le : (3 : ℝ) ≤ |t| := le_of_lt ht + have hlog3_le : Real.log 3 ≤ Real.log |t| := Real.log_le_log (by norm_num) h3le + have h_exp_le : Real.exp (1 : ℝ) ≤ 3 := le_of_lt lem_three_gt_e + have hlog3_ge_one : (1 : ℝ) ≤ Real.log 3 := + (Real.le_log_iff_exp_le (by norm_num : 0 < (3 : ℝ))).mpr h_exp_le + exact le_trans hlog3_ge_one hlog3_le + have hadd_le : Real.log |t| + Real.log (b / a) ≤ (1 + |u|) * Real.log |t| := by + have haux1 : Real.log (b / a) ≤ |u| := by simpa [u] using le_abs_self (Real.log (b / a)) + have haux2 : |u| ≤ |u| * Real.log |t| := by + have hnonneg : 0 ≤ |u| := abs_nonneg _ + have h1le : (1 : ℝ) ≤ Real.log |t| := hlogt_ge_one + simpa [one_mul] using (mul_le_mul_of_nonneg_left h1le hnonneg) + calc + Real.log |t| + Real.log (b / a) + ≤ Real.log |t| + |u| := by exact add_le_add_right haux1 _ + _ ≤ Real.log |t| + (|u| * Real.log |t|) := by exact add_le_add_right haux2 _ + _ = (1 + |u|) * Real.log |t| := by ring + have hRHS2 : + (Real.log |t| + Real.log (b / a)) / logRatio + ≤ ((1 + |u|) / logRatio) * Real.log |t| := by + have := div_le_div_of_nonneg_right hadd_le (le_of_lt hlogRatio_pos) + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this + have hfinal : + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) + ≤ ((1 + |u|) / logRatio) * Real.log |t| := by + have := le_trans h_sum_bound hRHS1 + exact le_trans this hRHS2 + + have hC2_ge : ((1 + |u|) / logRatio) ≤ C2 := by + have := le_max_right (2 : ℝ) ((1 + |u|) / logRatio) + simp [C2] + have hlogt_nonneg : 0 ≤ Real.log |t| := le_trans (by norm_num) hlogt_ge_one + have hscale := mul_le_mul_of_nonneg_right hC2_ge hlogt_nonneg + exact le_trans hfinal hscale + +lemma lem_sumKdeltatlogt : + ∃ C_3 > 1, ∀ (t : ℝ) (_ht : |t| > 3), + let c := (3/2 : ℂ) + I * t; + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ + (C_3 / (deltaz_t t)) * Real.log |t| := by + + obtain ⟨C_2, hC_2_pos, hC_2_bound⟩ := lem_sum_m_rho_zeta + + use C_2 + + constructor + · + exact hC_2_pos + + · + intro t ht c hfin z hz + + have h1 := lem_sumK1abs t ht z hfin hz + + have h2 := hC_2_bound t ht hfin + + have ht2 : |t| > 2 := by linarith [ht] + have h_delta_pos : 0 < deltaz_t t := (lem_delta19.2 t ht2).1 + + have h_t_ge_one : (1 : ℝ) ≤ |t| := by linarith [ht] + + calc + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) + ≤ (1 / (2 * deltaz_t t)) * (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) := h1 + _ ≤ (1 / (2 * deltaz_t t)) * (C_2 * Real.log |t|) := by + apply mul_le_mul_of_nonneg_left h2 + apply div_nonneg (by norm_num) + apply mul_nonneg (by norm_num) (le_of_lt h_delta_pos) + _ = (C_2 / (2 * deltaz_t t)) * Real.log |t| := by ring + _ ≤ (C_2 / deltaz_t t) * Real.log |t| := by + apply mul_le_mul_of_nonneg_right _ (Real.log_nonneg h_t_ge_one) + + apply div_le_div_of_nonneg_left (le_of_lt (lt_trans zero_lt_one hC_2_pos)) + · exact h_delta_pos + · + calc deltaz_t t + = 1 * deltaz_t t := by rw [one_mul] + _ ≤ 2 * deltaz_t t := by + apply mul_le_mul_of_nonneg_right (by norm_num : (1 : ℝ) ≤ 2) (le_of_lt h_delta_pos) + +lemma lem_sumKlogt2 : + ∃ C_4 > 1, ∀ (t : ℝ) (_ht : |t| > 3), + let c := (3/2 : ℂ) + I * t + ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), + ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → + (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ + C_4 * Real.log |t|^2 := by + + obtain ⟨C_3, hC_3_gt, hC_3⟩ := lem_sumKdeltatlogt + + use max (100 * C_3 / zerofree_constant) 2 + + constructor + · exact lt_max_of_lt_right (by norm_num : (2 : ℝ) > 1) + + · intro t ht c hfin z hz + + have h_bound := hC_3 t ht hfin z hz + + have h_t_pos : 0 < |t| := by linarith [ht, abs_nonneg t] + have h_log_t_pos : 0 < Real.log |t| := Real.log_pos (by linarith [ht] : (1 : ℝ) < |t|) + have hC_3_pos : 0 < C_3 := lt_trans zero_lt_one hC_3_gt + have h_zerofree_pos : 0 < zerofree_constant := zerofree_constant_pos + + have h_log_bound : Real.log (|t| + 2) ≤ 2 * Real.log |t| := by + have h_ineq : |t| + 2 ≤ 2 * |t| := by linarith [ht] + have h_log_ineq := Real.log_le_log (by linarith [abs_nonneg t] : 0 < |t| + 2) h_ineq + rw [Real.log_mul (by norm_num) (ne_of_gt h_t_pos)] at h_log_ineq + have h_log2_bound : Real.log 2 ≤ Real.log |t| := + Real.log_le_log (by norm_num) (by linarith [ht] : (2 : ℝ) ≤ |t|) + linarith [h_log_ineq] + + have h_deltaz_eq : deltaz_t t = (zerofree_constant / 20) / Real.log (|t| + 2) := by + simp [deltaz_t, deltaz] + + have h_main_bound : C_3 / deltaz_t t * Real.log |t| ≤ + 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := by + + rw [h_deltaz_eq] + + have h_div_rewrite : C_3 / ((zerofree_constant / 20) / Real.log (|t| + 2)) = + C_3 * Real.log (|t| + 2) * 20 / zerofree_constant := by + field_simp [ne_of_gt h_zerofree_pos, ne_of_gt (Real.log_pos (by linarith [abs_nonneg t] : (1 : ℝ) < |t| + 2))] + + rw [h_div_rewrite] + + have h_pos_factor : 0 ≤ C_3 * 20 / zerofree_constant := + div_nonneg (mul_nonneg (le_of_lt hC_3_pos) (by norm_num)) (le_of_lt h_zerofree_pos) + + calc C_3 * Real.log (|t| + 2) * 20 / zerofree_constant * Real.log |t| + = C_3 * 20 / zerofree_constant * Real.log (|t| + 2) * Real.log |t| := by ring + _ ≤ C_3 * 20 / zerofree_constant * (2 * Real.log |t|) * Real.log |t| := by + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left h_log_bound h_pos_factor) + (le_of_lt h_log_t_pos) + _ = 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := by simp [pow_two]; ring + + calc (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) + ≤ C_3 / deltaz_t t * Real.log |t| := h_bound + _ ≤ 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := h_main_bound + _ ≤ max (100 * C_3 / zerofree_constant) 2 * (Real.log |t|)^2 := by + have h_factor_bound : 40 * C_3 / zerofree_constant ≤ max (100 * C_3 / zerofree_constant) 2 := by + have h_coeff_ineq : 40 * C_3 ≤ 100 * C_3 := by + + have h_coeff : (40 : ℝ) ≤ 100 := by norm_num + exact mul_le_mul_of_nonneg_right h_coeff (le_of_lt hC_3_pos) + have h_div_ineq : 40 * C_3 / zerofree_constant ≤ 100 * C_3 / zerofree_constant := by + + exact div_le_div_of_nonneg_right h_coeff_ineq (le_of_lt h_zerofree_pos) + exact le_trans h_div_ineq (le_max_left _ _) + exact mul_le_mul_of_nonneg_right h_factor_bound (sq_nonneg _) + +lemma lem_logDerivZetalogt0 : + ∃ C > 1, + ∀ (t : ℝ) (_ht : |t| > 3), + ∀ s : ℂ, (1 - deltaz_t t) ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t → + ‖deriv riemannZeta s / riemannZeta s‖ ≤ C * Real.log |t|^2 := by + + obtain ⟨C_1, hC_1_gt, hC_1⟩ := lem_Zeta_Triangle_ZFR + obtain ⟨C_4, hC_4_gt, hC_4⟩ := lem_sumKlogt2 + + use C_1 + C_4 + + constructor + · + linarith [hC_1_gt, hC_4_gt] + + · + intro t ht s hs + + let c := (3/2 : ℂ) + I * t + have hfin := lem_finiteKzeta t ht + + have h_triangle := hC_1 t ht hfin s hs + + have h_triangle_ineq := lem_triangle_ZFR t ht s hfin hs + + have h_sum_bound := hC_4 t ht hfin s hs + + have h_log_sq_ge : Real.log |t| ≤ Real.log |t|^2 := by + have h_log_ge_one : (1 : ℝ) ≤ Real.log |t| := by + + have h_t_gt_e : Real.exp 1 < |t| := by + have h_e_bound : Real.exp 1 < 3 := by + + simpa using lem_three_gt_e + linarith [ht] + + have h_t_pos : 0 < |t| := by linarith [ht, abs_nonneg t] + rw [← Real.log_exp 1] + exact Real.log_le_log (Real.exp_pos 1) (le_of_lt h_t_gt_e) + have h_log_pos : 0 < Real.log |t| := Real.log_pos (by linarith [ht] : (1 : ℝ) < |t|) + rw [pow_two] + exact le_mul_of_one_le_right (le_of_lt h_log_pos) h_log_ge_one + + calc ‖deriv riemannZeta s / riemannZeta s‖ + ≤ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (s - ρ))‖ + C_1 * Real.log |t| := h_triangle + _ ≤ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖s - ρ‖) + C_1 * Real.log |t| := by + apply add_le_add_left h_triangle_ineq + _ ≤ C_4 * Real.log |t|^2 + C_1 * Real.log |t| := by + apply add_le_add_left h_sum_bound + _ ≤ C_4 * Real.log |t|^2 + C_1 * Real.log |t|^2 := by + + have h_c1_nonneg : 0 ≤ C_1 := le_of_lt (lt_trans zero_lt_one hC_1_gt) + exact add_le_add_right (mul_le_mul_of_nonneg_left h_log_sq_ge h_c1_nonneg) _ + _ = (C_4 + C_1) * Real.log |t|^2 := by ring + _ = (C_1 + C_4) * Real.log |t|^2 := by ring + +lemma lem_logDerivZetalogt2 : + ∃ A: ℝ, A > 0 ∧ A < 1 ∧ + ∃ C > 1, + ∀ (t : ℝ) (_ht : |t| > 3), + ∀ s : ℂ, (1 - A / Real.log (abs t + 2) ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t) → + ‖deriv riemannZeta s / riemannZeta s‖ ≤ C * Real.log |t|^2 := by + obtain ⟨C, hC_gt, hC_bound⟩ := lem_logDerivZetalogt0 + refine ⟨zerofree_constant / 20, ?Apos, ?Alt1, ⟨C, hC_gt, ?_⟩⟩ + · + exact div_pos zerofree_constant_pos (by norm_num) + · + have hlt : zerofree_constant / 20 < (1 : ℝ) / 20 := + div_lt_div_of_pos_right zerofree_constant_lt_one (by norm_num) + have : (1 : ℝ) / 20 < 1 := by norm_num + exact lt_trans hlt this + · + intro t ht s hs + have hδ : 1 - deltaz_t t ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t := by + simpa [deltaz_t, deltaz, Complex.mul_I_im] using hs + exact hC_bound t ht s hδ + +lemma lem_rhoDRe4 : + ∀ t : ℝ, ∀ z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t), + z.re > 1 - 4 * deltaz_t t := by + intro t z hz + + have h_pos : 0 < deltaz_t t := by + + have h_log_pos : 0 < Real.log (|t| + 2) := by + have h1 : (1 : ℝ) < |t| + 2 := by + have : (0 : ℝ) ≤ |t| := abs_nonneg _ + linarith + exact Real.log_pos h1 + have h_num_pos : 0 < zerofree_constant / 20 := by + have h20 : 0 < (20 : ℝ) := by norm_num + exact div_pos zerofree_constant_pos h20 + have : 0 < (zerofree_constant / 20) / Real.log (|t| + 2) := by + exact div_pos h_num_pos h_log_pos + simpa [deltaz_t, deltaz, Complex.mul_I_im] using this + + have h_norm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hz + + have re_bound : |(z - (1 - deltaz_t t + t * Complex.I)).re| ≤ 2 * deltaz_t t := + (Complex.abs_re_le_norm _).trans h_norm + + have center_re : (1 - deltaz_t t + t * Complex.I).re = 1 - deltaz_t t := by + calc (1 - deltaz_t t + t * Complex.I).re + = (1 - deltaz_t t : ℂ).re + (t * Complex.I).re := by rw [Complex.add_re] + _ = (1 - deltaz_t t) + (t * Complex.I).re := by simp [Complex.ofReal_re] + _ = (1 - deltaz_t t) + 0 := by simp [Complex.mul_re, Complex.I_re] + _ = 1 - deltaz_t t := by simp + + have re_simp : (z - (1 - deltaz_t t + t * Complex.I)).re = z.re - (1 - deltaz_t t) := by + rw [Complex.sub_re, center_re] + + have re_bound' : |z.re - (1 - deltaz_t t)| ≤ 2 * deltaz_t t := by + simpa [re_simp] using re_bound + + have lower_bound : z.re - (1 - deltaz_t t) ≥ -(2 * deltaz_t t) := by + have h := (abs_le).1 re_bound' + exact h.1 + + have : z.re ≥ 1 - deltaz_t t - 2 * deltaz_t t := by linarith [lower_bound] + have : z.re ≥ 1 - 3 * deltaz_t t := by linarith + linarith [h_pos] + +lemma helper_absIm_le_add_smallball (t : ℝ) (z : ℂ) + (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : + |z.im| ≤ |t| + 2 * deltaz_t t := by + + have hnorm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hz + + have h_im_diff : |(z - (1 - deltaz_t t + t * Complex.I)).im| ≤ 2 * deltaz_t t := + le_trans (Complex.abs_im_le_norm _) hnorm + + have center_im : (1 - deltaz_t t + t * Complex.I).im = t := by + simp [Complex.add_im, Complex.mul_im] + + have diff_im : (z - (1 - deltaz_t t + t * Complex.I)).im = z.im - t := by + simp [Complex.sub_im, center_im] + + have h_im_sub : |z.im - t| ≤ 2 * deltaz_t t := by + simpa [diff_im] using h_im_diff + + have tri : |z.im| ≤ |z.im - t| + |t| := by + simpa [sub_eq_add_neg] using! (abs_add_le (z.im - t) t) + + have : |z.im - t| + |t| ≤ 2 * deltaz_t t + |t| := add_le_add_left h_im_sub _ + have hfinal : |z.im| ≤ 2 * deltaz_t t + |t| := le_trans tri this + simpa [add_comm] using hfinal + +lemma helper_log_le_two_log_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) + (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : + Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by + + have h_abs : |z.im| ≤ |t| + 2 * deltaz_t t := + helper_absIm_le_add_smallball t z hz + + set a : ℝ := |t| + 2 + have h1 : |z.im| + 2 ≤ a + 2 * deltaz_t t := by + have := add_le_add_left h_abs (2 : ℝ) + simpa [a, add_comm, add_left_comm, add_assoc] using this + + have ht2 : |t| > 2 := by linarith + have hδ : 0 < deltaz_t t ∧ deltaz_t t < 1 / 9 := (lem_delta19).2 t ht2 + have hδlt : deltaz_t t < 1 / 9 := hδ.2 + + have h_two_delta_le_one : 2 * deltaz_t t ≤ 1 := by + have hle : deltaz_t t ≤ 1 / 9 := le_of_lt hδlt + have hmul : 2 * deltaz_t t ≤ 2 * (1 / 9 : ℝ) := + mul_le_mul_of_nonneg_left hle (by norm_num) + have : 2 * (1 / 9 : ℝ) ≤ 1 := by norm_num + exact le_trans hmul this + have h2 : a + 2 * deltaz_t t ≤ a + 1 := add_le_add_right h_two_delta_le_one a + + have ha_ge_two : (2 : ℝ) ≤ a := by + have : 0 ≤ |t| := abs_nonneg t + linarith [this] + have ha_ge_one : (1 : ℝ) ≤ a := le_trans (by norm_num) ha_ge_two + have h_a_plus_one_le_two_a : a + 1 ≤ a + a := by + simpa using add_le_add_right ha_ge_one a + have h_nonneg_a : 0 ≤ a := le_trans (by norm_num) ha_ge_two + have h_2a_le_a2 : (2 : ℝ) * a ≤ a ^ 2 := by + have : (2 : ℝ) * a ≤ a * a := mul_le_mul_of_nonneg_right ha_ge_two h_nonneg_a + simpa [pow_two] using this + have h_a1_le_a2 : a + 1 ≤ a ^ 2 := + le_trans h_a_plus_one_le_two_a (by simpa [two_mul] using h_2a_le_a2) + + have h_total : |z.im| + 2 ≤ a ^ 2 := le_trans (le_trans h1 h2) h_a1_le_a2 + + have hxpos : 0 < |z.im| + 2 := by + have : 0 ≤ |z.im| := abs_nonneg _ + linarith + have hlog := Real.log_le_log hxpos h_total + calc + Real.log (|z.im| + 2) ≤ Real.log (a ^ 2) := hlog + _ = (2 : ℝ) * Real.log a := by simp + _ = 2 * Real.log (|t| + 2) := by simp [a] + +lemma helper_one_div_log_le_two_div_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) + (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : + (1 : ℝ) / Real.log (|t| + 2) ≤ 2 / Real.log (|z.im| + 2) := by + + have ht_pos1 : 1 < |t| + 2 := by linarith [abs_nonneg t] + have hz_pos1 : 1 < |z.im| + 2 := by linarith [abs_nonneg z.im] + have log_t_pos : 0 < Real.log (|t| + 2) := Real.log_pos ht_pos1 + have log_z_pos : 0 < Real.log (|z.im| + 2) := Real.log_pos hz_pos1 + + have h_norm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hz + have center_im : (1 - deltaz_t t + t * Complex.I).im = t := by + simp [Complex.add_im] + have diff_im : (z - (1 - deltaz_t t + t * Complex.I)).im = z.im - t := by + simp [Complex.sub_im, center_im] + have h1 : |z.im - t| ≤ ‖z - (1 - deltaz_t t + t * Complex.I)‖ := by + simpa [diff_im] using Complex.abs_im_le_norm (z - (1 - deltaz_t t + t * Complex.I)) + have h2 : |z.im - t| ≤ 2 * deltaz_t t := h1.trans h_norm + have hz_im_le : |z.im| ≤ |z.im - t| + |t| := by + + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using! abs_add_le (z.im - t) t + have hz_im_le2 : |z.im| ≤ 2 * deltaz_t t + |t| := hz_im_le.trans (add_le_add_left h2 _) + have hz_add2_le1 : |z.im| + 2 ≤ (2 * deltaz_t t + |t|) + 2 := add_le_add_left hz_im_le2 2 + + have hdelta_lt_one : deltaz_t t < 1 := by + have hlt19 : deltaz_t t < 1 / 9 := + ((lem_delta19).2 t (by linarith : |t| > 2)).2 + exact lt_trans hlt19 (by norm_num) + have h2delta_le_two : 2 * deltaz_t t ≤ 2 := by + have hle : deltaz_t t ≤ 1 := le_of_lt hdelta_lt_one + have := mul_le_mul_of_nonneg_left hle (by norm_num : (0 : ℝ) ≤ 2) + simpa using this + have htwo_le : (2 : ℝ) ≤ |t| + 2 := by linarith [abs_nonneg t] + have h2delta_le_tplus2 : 2 * deltaz_t t ≤ |t| + 2 := le_trans h2delta_le_two htwo_le + have step_mid : (2 * deltaz_t t + |t|) + 2 ≤ ((|t| + 2) + |t|) + 2 := by + have := add_le_add_left (add_le_add_left h2delta_le_tplus2 |t|) 2 + simpa [add_comm, add_left_comm, add_assoc] using this + have hz_plus2_le : |z.im| + 2 ≤ (|t| + 2) + |t| + 2 := le_trans hz_add2_le1 step_mid + have hz_im_bound_final : |z.im| + 2 ≤ 2 * (|t| + 2) := by + + simpa [two_mul, add_comm, add_left_comm, add_assoc] using hz_plus2_le + + have hxpos : 0 < |z.im| + 2 := by linarith [abs_nonneg z.im] + have hlog_step : Real.log (|z.im| + 2) ≤ Real.log (2 * (|t| + 2)) := + Real.log_le_log hxpos hz_im_bound_final + have hlog_mul : Real.log (2 * (|t| + 2)) = Real.log 2 + Real.log (|t| + 2) := by + have hneet : (|t| + 2) ≠ 0 := ne_of_gt (lt_trans (by norm_num) ht_pos1) + simpa using Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) hneet + have hlog2_le_logt : Real.log 2 ≤ Real.log (|t| + 2) := by + have h2lt : 0 < (2 : ℝ) := by norm_num + have h2le : (2 : ℝ) ≤ |t| + 2 := by linarith [abs_nonneg t] + exact Real.log_le_log h2lt h2le + have hlog_le_two : Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by + have : Real.log (|z.im| + 2) ≤ Real.log 2 + Real.log (|t| + 2) := by + simpa [hlog_mul] using hlog_step + have : Real.log (|z.im| + 2) ≤ Real.log (|t| + 2) + Real.log (|t| + 2) := + this.trans (add_le_add_left hlog2_le_logt _) + simpa [two_mul] using this + + have h' : 1 * Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by + simpa [one_mul] using hlog_le_two + simpa [one_mul] using (div_le_div_iff₀ log_t_pos log_z_pos).mpr h' + +lemma helper_deltaz_t_le_two_deltaz_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) + (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : + deltaz_t t ≤ 2 * deltaz z := by + + have h_recip := helper_one_div_log_le_two_div_smallball t ht z hz + + have hpos_const : 0 ≤ zerofree_constant / 20 := by + have hpos : 0 < zerofree_constant := zerofree_constant_pos + have h20 : 0 < (20 : ℝ) := by norm_num + exact div_nonneg (le_of_lt hpos) (le_of_lt h20) + + have h_mul := mul_le_mul_of_nonneg_left h_recip hpos_const + + calc + deltaz_t t + = (zerofree_constant / 20) / Real.log (|t| + 2) := by + simp [deltaz_t, deltaz] + _ = (zerofree_constant / 20) * (1 / Real.log (|t| + 2)) := by + simp [div_eq_mul_inv] + _ ≤ (zerofree_constant / 20) * (2 / Real.log (|z.im| + 2)) := by + simpa [one_div, div_eq_mul_inv] using h_mul + _ = 2 * ((zerofree_constant / 20) * (1 / Real.log (|z.im| + 2))) := by + ring + _ = 2 * deltaz z := by + simp [deltaz, div_eq_mul_inv] + +lemma lem_DRez6dz : + ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t), + z.re ≥ 1 - 6 * deltaz z := by + intro t ht z hz + + have h_ball : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by + simpa [Metric.mem_closedBall, Complex.dist_eq] using hz + + have h_re_absle : |(z - (1 - deltaz_t t + t * Complex.I)).re| ≤ 2 * deltaz_t t := + (Complex.abs_re_le_norm _).trans h_ball + have h_re_absle' : |z.re - (1 - deltaz_t t)| ≤ 2 * deltaz_t t := by + simpa [Complex.sub_re] using h_re_absle + + have h_lower : z.re - (1 - deltaz_t t) ≥ -(2 * deltaz_t t) := by + have := (abs_le).1 h_re_absle' + exact this.1 + + have h3 : z.re ≥ 1 - 3 * deltaz_t t := by + linarith + + have h_dt_le : deltaz_t t ≤ 2 * deltaz z := + helper_deltaz_t_le_two_deltaz_smallball t ht z hz + + have h_mult : 3 * deltaz_t t ≤ 6 * deltaz z := by + have h := mul_le_mul_of_nonneg_left h_dt_le (by norm_num : (0 : ℝ) ≤ 3) + calc + 3 * deltaz_t t ≤ 3 * (2 * deltaz z) := h + _ = 6 * deltaz z := by ring + + have h_final : 1 - 3 * deltaz_t t ≥ 1 - 6 * deltaz z := by + linarith [h_mult] + + exact le_trans h_final h3 + +lemma lem_YinD : + ∀ t : ℝ, |t| > 3 → + Yt t (deltaz_t t) ⊆ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t) := by + intro t ht z hz + rcases hz with ⟨hzero, habs⟩ + have hdist : dist z (1 - deltaz_t t + t * Complex.I) ≤ 2 * deltaz_t t := by + simpa [Complex.dist_eq] using habs + exact Metric.mem_closedBall.mpr hdist + +theorem lem_rhoYzero (t : ℝ) (δ : ℝ) (ρ_1 : ℂ) (h_rho_1_in_Yt : ρ_1 ∈ Yt t δ) : + riemannZeta ρ_1 = 0 := by + + unfold Yt at h_rho_1_in_Yt + + exact h_rho_1_in_Yt.1 + +theorem lem_absReabs (w : ℂ) : |w.re| ≤ ‖w‖ := by + exact Complex.abs_re_le_norm w + +theorem lem_zRe (t : ℝ) (δ : ℝ) (z : ℂ) : |(z - (1 - δ + t * Complex.I)).re| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := by + apply lem_absReabs + +theorem lem_zRe2 (t : ℝ) (δ : ℝ) (z : ℂ) + (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : + |(z - (1 - δ + t * Complex.I)).re| ≤ 2 * δ := by + have h1 : |(z - (1 - δ + t * Complex.I)).re| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := lem_zRe t δ z + exact le_trans h1 h_le + +theorem lem_Rezit (t : ℝ) (δ : ℝ) (z : ℂ) : + (z - (1 - δ + t * Complex.I)).re = z.re - (1 - δ) := by + rw [Complex.sub_re] + + rw [Complex.add_re] + + rw [Complex.sub_re, Complex.one_re, Complex.ofReal_re] + + rw [Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im] + + simp + +theorem lem_zRe3 (t : ℝ) (δ : ℝ) (z : ℂ) + (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : + |z.re - (1 - δ)| ≤ 2 * δ := by + + have h1 : |(z - (1 - δ + t * Complex.I)).re| ≤ 2 * δ := + lem_zRe2 t δ z h_le + + have hRe : (z - (1 - δ + t * Complex.I)).re = z.re - (1 - δ) := + lem_Rezit t δ z + simpa [hRe] using h1 + +theorem lem_negleabs (a : ℝ) (b : ℝ) (h_abs : |a| ≤ b) : a ≥ -b := by + rw [abs_le] at h_abs + exact h_abs.1 + +theorem lem_absrez1d (δ : ℝ) (z : ℂ) + (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : + z.re - (1 - δ) ≥ - (2 * δ) := by + exact lem_negleabs (z.re - (1 - δ)) (2 * δ) h_le + +theorem lem_absrez1d2 (δ : ℝ) (z : ℂ) + (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : + z.re ≥ 1 - 3 * δ := by + + have hneg : z.re - (1 - δ) ≥ - (2 * δ) := + lem_absrez1d δ z h_le + + have : z.re ≥ 1 - δ - 2 * δ := by linarith + + convert this using 1 + ring +theorem lem_absrez1d3 (δ : ℝ) (z : ℂ) (hδ : δ > 0) + (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : + z.re > 1 - 4 * δ := by + have h1 : z.re ≥ 1 - 3 * δ := lem_absrez1d2 δ z h_le + linarith [h1, hδ] + +theorem lem_zRe4 (t : ℝ) (δ : ℝ) (hδ : δ > 0) (z : ℂ) + (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : + z.re > 1 - 4 * δ := by + have h1 : |z.re - (1 - δ)| ≤ 2 * δ := lem_zRe3 t δ z h_le + exact lem_absrez1d3 δ z hδ h1 + +lemma riemannZeta_no_zeros_left_halfplane_off_real_axis (s : ℂ) (h_re : s.re ≤ 0) (h_im : s.im ≠ 0) : riemannZeta s ≠ 0 := by + + intro h_zero + + have hs_not_neg_nat : ∀ n : ℕ, s ≠ -n := by + intro n h_eq + + have : s.im = 0 := by + rw [h_eq] + rw [Complex.neg_im] + simp + exact h_im this + + have hs_not_one : s ≠ 1 := by + intro h_eq + + have : s.re = 1 := by + rw [h_eq] + exact Complex.one_re + linarith [h_re, this] + + have functional_eq := riemannZeta_one_sub hs_not_neg_nat hs_not_one + + rw [h_zero] at functional_eq + simp at functional_eq + + have h1s_re_ge_1 : (1 - s).re ≥ 1 := by + rw [Complex.sub_re, Complex.one_re] + linarith [h_re] + + have h1s_nonzero : riemannZeta (1 - s) ≠ 0 := by + apply riemannZeta_ne_zero_of_one_le_re + exact h1s_re_ge_1 + + exact h1s_nonzero functional_eq + +lemma lem_Imzit (t : ℝ) (δ : ℝ) (z : ℂ) : + (z - (1 - δ + t * Complex.I)).im = z.im - t := by + have him : (1 - δ + t * Complex.I).im = t := by + simp [Complex.add_im, Complex.mul_im] + simp [Complex.sub_im, him] + +lemma lem_zIm2 (t : ℝ) (δ : ℝ) (z : ℂ) + (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : + |(z - (1 - δ + t * Complex.I)).im| ≤ 2 * δ := by + have : |(z - (1 - δ + t * Complex.I)).im| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := + Complex.abs_im_le_norm (z - (1 - δ + t * Complex.I)) + exact le_trans this h_le + +lemma lem_zIm3 (t : ℝ) (δ : ℝ) (z : ℂ) + (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : + |z.im - t| ≤ 2 * δ := by + have h1 : |(z - (1 - δ + t * Complex.I)).im| ≤ 2 * δ := + lem_zIm2 t δ z h_le + have him : (z - (1 - δ + t * Complex.I)).im = z.im - t := + lem_Imzit t δ z + simpa [him] using h1 + +lemma abs_le_add_of_abs_sub_le {a b ε : ℝ} (h : |a - b| ≤ ε) : + |a| ≤ |b| + ε := by + calc + |a| = |b + (a - b)| := by + simp [sub_eq_add_neg, add_left_comm] + _ ≤ |b| + |a - b| := by + simpa [sub_eq_add_neg] using! abs_add_le b (a - b) + _ ≤ |b| + ε := by + exact add_le_add_right h _ + +lemma log_add_lt_log_add_div {x y : ℝ} (hx : 0 < x) (hy : 0 < y) : + Real.log (x + y) < Real.log x + y / x := by + have hxne : x ≠ 0 := ne_of_gt hx + have hxy_pos : 0 < x + y := add_pos hx hy + have hxy_ne : x + y ≠ 0 := ne_of_gt hxy_pos + have hy_div_pos : 0 < y / x := div_pos hy hx + have hdiv_eq : (x + y) / x = 1 + y / x := by + have : (x + y) / x = x / x + y / x := by simp [add_div] + simpa [div_self hxne] using this + have hgt1 : 1 < (x + y) / x := by + have : 1 < 1 + y / x := by linarith [hy_div_pos] + simpa [hdiv_eq] using this + have hposu : 0 < (x + y) / x := lt_trans zero_lt_one hgt1 + have hne1 : (x + y) / x ≠ 1 := ne_of_gt hgt1 + have hloglt : Real.log ((x + y) / x) < (x + y) / x - 1 := + Real.log_lt_sub_one_of_pos hposu hne1 + have hrhs : (x + y) / x - 1 = y / x := by + have : (1 + y / x) - 1 = y / x := by + simp + simp [hdiv_eq] + have hldiv : Real.log ((x + y) / x) = Real.log (x + y) - Real.log x := + Real.log_div hxy_ne hxne + have hcore : Real.log (x + y) - Real.log x < y / x := by + simpa [hldiv, hrhs] using hloglt + have := add_lt_add_left hcore (Real.log x) + simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using this + +lemma abs_le_add_of_abs_sub_le' {a b ε : ℝ} (h : |a - b| ≤ ε) : + |a| ≤ |b| + ε := by + calc + |a| = |b + (a - b)| := by + simp [sub_eq_add_neg, add_left_comm] + _ ≤ |b| + |a - b| := by + simpa [sub_eq_add_neg] using! abs_add_le b (a - b) + _ ≤ |b| + ε := by + exact add_le_add_right h _ + +lemma delta_half_eq (c t : ℝ) : + ((c / 2) / Real.log (|t| + 2)) / 2 = (c / 4) / Real.log (|t| + 2) := by + + have hx : + ((c * (1 / 2)) * ((Real.log (|t| + 2))⁻¹)) * (1 / 2) + = (c * (1 / 4)) * ((Real.log (|t| + 2))⁻¹) := by + ring + simpa [div_eq_mul_inv] using hx + +lemma log_abs_im_le (t t1 δ : ℝ) (h : |t1 - t| ≤ δ) : + Real.log (|t1| + 2) ≤ Real.log (|t| + 2) + δ / (|t| + 2) := by + + have hx1pos : 0 < |t1| + 2 := by + have : (0 : ℝ) ≤ |t1| := abs_nonneg t1 + linarith + have hxpos : 0 < |t| + 2 := by + have : (0 : ℝ) ≤ |t| := abs_nonneg t + linarith + have hxnonneg : 0 ≤ |t| + 2 := le_of_lt hxpos + + have habs : |t1| ≤ |t| + |t1 - t| := by + have htri : |(t1 - t) + t| ≤ |t1 - t| + |t| := abs_add_le (t1 - t) t + simpa [sub_add_cancel, add_comm] using htri + + have hxy : |t1| + 2 ≤ (|t| + 2) + |t1 - t| := by + have := add_le_add_left habs 2 + simpa [add_comm, add_left_comm, add_assoc] using this + + have hlog1 : Real.log (|t1| + 2) ≤ Real.log ((|t| + 2) + |t1 - t|) := + Real.log_le_log hx1pos hxy + + have hy_nonneg : 0 ≤ |t1 - t| := abs_nonneg (t1 - t) + have hlog2 : Real.log ((|t| + 2) + |t1 - t|) + ≤ Real.log (|t| + 2) + |t1 - t| / (|t| + 2) := by + by_cases hpos : 0 < |t1 - t| + · exact le_of_lt (log_add_lt_log_add_div hxpos hpos) + · have heq : |t1 - t| = 0 := le_antisymm (le_of_not_gt hpos) hy_nonneg + have : Real.log (|t| + 2) ≤ Real.log (|t| + 2) := le_rfl + simp [heq] + + have hdiv : |t1 - t| / (|t| + 2) ≤ δ / (|t| + 2) := + div_le_div_of_nonneg_right h hxnonneg + have hadd := add_le_add_right hdiv (Real.log (|t| + 2)) + exact le_trans (le_trans hlog1 hlog2) hadd + +lemma combine_re_bounds_to_c_over_log_le {ρre c δ L1 : ℝ} + (h_ge : ρre ≥ 1 - (3 / 2) * δ) (h_le : ρre ≤ 1 - c / L1) : + c / L1 ≤ (3 / 2) * δ := by + + have h : 1 - (3 / 2) * δ ≤ 1 - c / L1 := le_trans h_ge h_le + + have h' := sub_le_sub_right h (1 : ℝ) + + have h'' : -((3 / 2) * δ) ≤ -(c / L1) := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h' + + simpa using (neg_le_neg_iff.mp h'') + +lemma core_contradiction2 {L t c δ : ℝ} + (hLpos : 0 < L) (hpos : 0 < |t| + 2) + (hδ : δ = (c / 2) / L) + (h : L ≤ (3 / 2) * δ / (|t| + 2)) : + L ^ 2 * (|t| + 2) ≤ 3 * c / 4 := by + + have h1' := (mul_le_mul_of_nonneg_right h (le_of_lt hpos)) + + have hbne : (|t| + 2) ≠ 0 := ne_of_gt hpos + have rhs_eq : ((3 / 2) * δ / (|t| + 2)) * (|t| + 2) = (3 / 2) * δ := by + calc + ((3 / 2) * δ / (|t| + 2)) * (|t| + 2) + = ((3 / 2) * δ) * ((1 / (|t| + 2)) * (|t| + 2)) := by + simp [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] + _ = ((3 / 2) * δ) * 1 := by + simp [hbne] + _ = (3 / 2) * δ := by + ring + have h1 : L * (|t| + 2) ≤ (3 / 2) * δ := by + simpa [rhs_eq] using h1' + + have h2 := (mul_le_mul_of_nonneg_left h1 (le_of_lt hLpos)) + have h3 : L ^ 2 * (|t| + 2) ≤ (3 / 2) * (δ * L) := by + simpa [pow_two, mul_left_comm, mul_assoc, mul_comm] using h2 + + have hLne : L ≠ 0 := ne_of_gt hLpos + have hδL : δ * L = c / 2 := by + calc + δ * L = ((c / 2) / L) * L := by simp [hδ] + _ = (c / 2) * ((L⁻¹) * L) := by + simp [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] + _ = (c / 2) * 1 := by + simp [hLne] + _ = c / 2 := by simp + have h4 : L ^ 2 * (|t| + 2) ≤ (3 / 2) * (c / 2) := by + simpa [hδL] using h3 + + have h5 : (3 / 2 : ℝ) * (c / 2) = 3 * c / 4 := by + ring + simpa [h5] using h4 + +lemma abs_lower_bound_sub (x y : ℝ) : |x| ≥ |y| - |x - y| := by + + have h' : |y| ≤ |x| + |y - x| := by + have htriv : |y - x| ≤ |y - x| := le_rfl + simpa [sub_eq_add_neg] using + (abs_le_add_of_abs_sub_le' (a := y) (b := x) (ε := |y - x|) htriv) + + have h1 : |y| ≤ |x| + |x - y| := by simpa [abs_sub_comm] using h' + + simpa [ge_iff_le] using (sub_le_iff_le_add).2 h1 + +lemma abs_im_ge_T0_from_close {t : ℝ} {ρ : ℂ} {δ T0 : ℝ} + (hclose : |ρ.im - t| ≤ 2 * δ) (hineq : |t| - 2 * δ ≥ T0) : + T0 ≤ |ρ.im| := by + have h1 : |ρ.im| ≥ |t| - |ρ.im - t| := by + simpa [sub_eq_add_neg, abs_sub_comm] using (abs_lower_bound_sub ρ.im t) + have : |ρ.im| ≥ |t| - 2 * δ := by + exact ge_trans h1 (by + + gcongr) + exact le_trans hineq this + +lemma lem_Kzetaempty : + ∀ t : ℝ, |t| > 3 → + Yt t (deltaz_t t) = ∅ := by + intro t ht + + rw [Set.eq_empty_iff_forall_notMem] + intro ρ_1 h_mem + + have h_zero : riemannZeta ρ_1 = 0 := lem_rhoYzero t (deltaz_t t) ρ_1 h_mem + + have h_norm : ‖ρ_1 - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by + exact h_mem.2 + + have h_im_bound : |ρ_1.im - t| ≤ 2 * deltaz_t t := by + exact lem_zIm3 t (deltaz_t t) ρ_1 h_norm + + have h_delta_small : deltaz_t t < 1/9 := by + have h_bounds := lem_delta19 + exact (h_bounds.2 t (by linarith [ht])).2 + + have h_im_large : 2 < |ρ_1.im| := by + + have h_tri : |ρ_1.im| ≥ |t| - |ρ_1.im - t| := by + exact abs_lower_bound_sub ρ_1.im t + have h_bound : |ρ_1.im| ≥ |t| - 2 * deltaz_t t := by + exact ge_trans h_tri (by gcongr) + have h_small_delta : 2 * deltaz_t t < 2/9 := by + linarith [h_delta_small] + have h_final : |t| - 2 * deltaz_t t > 3 - 2/9 := by + linarith [ht, h_small_delta] + have h_gt_2 : 3 - 2/9 > 2 := by norm_num + linarith [h_bound, h_final, h_gt_2] + + have h_in_ball : ρ_1 ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t) := by + exact Metric.mem_closedBall.mpr (by simpa only [dist_eq_norm] using! h_norm) + + have h_re_bound : ρ_1.re ≥ 1 - 6 * deltaz ρ_1 := by + exact lem_DRez6dz t ht ρ_1 h_in_ball + + have h_delta_pos : 0 < deltaz ρ_1 := by + have h_bounds := lem_delta19 + exact (h_bounds.1 ρ_1 (by linarith [h_im_large])).1 + + have h_re_strict : ρ_1.re > 1 - 9 * deltaz ρ_1 := by + linarith [h_re_bound, h_delta_pos] + + have h_nonzero : riemannZeta ρ_1 ≠ 0 := by + exact lem_ZFRdelta ρ_1 h_im_large h_re_strict + + exact h_nonzero h_zero + +lemma Yt_subset_closedBall (t : ℝ) (δ : ℝ) : + Yt t δ ⊆ Metric.closedBall (1 - δ + t * Complex.I) (2 * δ) := by + + intro ρ_1 hρ_1 + + unfold Yt at hρ_1 + + obtain ⟨_, h_abs⟩ := hρ_1 + + rw [Metric.mem_closedBall] + + rw [Complex.dist_eq] + + exact h_abs + +lemma Yt_finite (t : ℝ) (δ : ℝ) : (Yt t δ).Finite := by + + have h_subset := Yt_subset_closedBall t δ + + let K := Metric.closedBall (1 - δ + t * Complex.I) (2 * δ) + have h_compact : IsCompact K := closedBall_compact_complex (1 - δ + t * Complex.I) (2 * δ) + + have h_zeros_finite := riemannZeta_zeros_finite_of_compact K h_compact + + have h_sub : Yt t δ ⊆ {z ∈ K | riemannZeta z = 0} := by + intro ρ hρ + + constructor + · + exact h_subset hρ + · + unfold Yt at hρ + exact hρ.1 + + exact Set.Finite.subset h_zeros_finite h_sub + +lemma lem_sumempty (g : ℂ → ℂ) : (∑ s ∈ (∅ : Finset ℂ), g s) = 0 := by + rfl + +lemma lem_Ksumempty : + ∀ t : ℝ, |t| > 3 → + (∑ ρ_1 ∈ (Yt_finite t (deltaz_t t)).toFinset, ((analyticOrderAt riemannZeta ρ_1).toNat : ℂ) / (1 - (deltaz_t t) + t * Complex.I - ρ_1)) = 0 := by + intro t ht + + have h_empty : Yt t (deltaz_t t) = ∅ := lem_Kzetaempty t ht + + have h_finset_empty : (Yt_finite t (deltaz_t t)).toFinset = ∅ := by + rw [Set.Finite.toFinset_eq_empty] + exact h_empty + + rw [h_finset_empty] + exact lem_sumempty _ + +lemma norm_div_cast_vonMangoldt (s : ℂ) : + (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) + = (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by + funext n + simp [Complex.norm_real, Real.norm_eq_abs] + +lemma ArithmeticFunction.summable_vonMangoldt_norm_rw {s : ℂ} : + Summable (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) + ↔ Summable (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by + classical + have hfun : + (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) + = (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by + funext n + simp [Complex.norm_real, div_eq_mul_inv] + simp + +lemma lem_norm_cpow_nat (n : ℕ) (s : ℂ) (hn : 1 ≤ n) : ‖(n : ℂ) ^ s‖ = (n : ℝ) ^ s.re := by + have hpos : 0 < (n : ℝ) := + lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (by exact_mod_cast hn) + simpa using (Complex.norm_cpow_eq_rpow_re_of_pos (x := (n : ℝ)) hpos s) + +lemma lem_vonMangoldt_nonneg (n : ℕ) : 0 ≤ (ArithmeticFunction.vonMangoldt n) := by + simp + +lemma lem_term_real_nonneg (n : ℕ) (σ : ℝ) (_hσ : 1 < σ) : ∃ r ≥ (0:ℝ), ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = (r : ℂ) := by + + let r : ℝ := (ArithmeticFunction.vonMangoldt n) / ((n : ℝ) ^ σ) + refine ⟨r, ?_, ?_⟩ + · + have hbase_nonneg : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) + have hden_nonneg : 0 ≤ (n : ℝ) ^ σ := by + simpa using (Real.rpow_nonneg hbase_nonneg σ) + + have hv_nonneg : 0 ≤ (ArithmeticFunction.vonMangoldt n) := by + simp + have : 0 ≤ (ArithmeticFunction.vonMangoldt n) * ((n : ℝ) ^ σ)⁻¹ := + mul_nonneg hv_nonneg (inv_nonneg.mpr hden_nonneg) + simpa [r, div_eq_mul_inv] using this + · + have hbase_nonneg : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) + have hden_eq : (((n : ℝ) ^ σ : ℝ) : ℂ) = (n : ℂ) ^ (σ : ℂ) := by + simpa using (Complex.ofReal_cpow (x := (n : ℝ)) (hx := hbase_nonneg) (y := σ)) + calc + ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) + = ((ArithmeticFunction.vonMangoldt n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) := by + simp [hden_eq.symm] + _ = (((ArithmeticFunction.vonMangoldt n : ℝ) / ((n : ℝ) ^ σ)) : ℝ) := by + simp + _ = (r : ℂ) := by rfl + +lemma lem_tsum_norm_vonMangoldt_depends_on_Re (s : ℂ) (σ : ℝ) (hσ : σ = s.re) (_hs : 1 < s.re) : + (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) = + (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by + classical + + have hfun : (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) + = (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by + funext n + by_cases h0 : n = 0 + · + subst h0 + simp [ArithmeticFunction.vonMangoldt] + simp only [_root_.ite_eq_right (not_isPrimePow_zero (R := ℕ)), abs_zero, zero_div] + · + have hn0C : (n : ℂ) ≠ 0 := by + exact_mod_cast (Nat.cast_ne_zero.mpr h0) + have harg : Complex.arg (n : ℂ) = 0 := by + have : (0 : ℝ) ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) + simp + + have hden_s : ‖(n : ℂ) ^ s‖ = ‖(n : ℂ)‖ ^ s.re := by + + simpa [harg, Real.exp_zero, div_one] using + (Complex.norm_cpow_of_ne_zero (z := (n : ℂ)) (w := s) hn0C) + have hden_σ : ‖(n : ℂ) ^ (σ : ℂ)‖ = ‖(n : ℂ)‖ ^ σ := by + simp + + simp [hden_s, hσ] + + have htsum := congrArg (fun f : ℕ → ℝ => (∑' n, f n)) hfun + simpa using htsum + +lemma helper_LSeries_vonMangoldt_tsum (σ : ℝ) (hσ : 1 < σ) : + (∑' n : ℕ, (ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = + - deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ) := by + have hs : 1 < (σ : ℂ).re := by simpa using hσ + have h0 : ((fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ)) 0) = 0 := by simp + simpa [LSeries, LSeries.term_def₀ (f := fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ)) h0, + Complex.cpow_neg, div_eq_mul_inv] using + (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := (σ : ℂ)) hs) + +lemma summable_ofReal_iff {f : ℕ → ℝ} : Summable (fun n => (f n : ℂ)) ↔ Summable f := by + simp + +lemma helper_summable_of_summable_norm {u : ℕ → ℂ} + (h : Summable (fun n => ‖u n‖)) : Summable u := by + simpa using (Summable.of_norm (f := u) h) + +lemma helper_norm_tsum_eq_tsum_norm_of_nonneg_real {u : ℕ → ℂ} {r : ℕ → ℝ} + (h : ∀ n, u n = (r n : ℂ)) (hr : ∀ n, 0 ≤ r n) (_hu : Summable u) : + ‖(∑' n, u n)‖ = ∑' n, ‖u n‖ := by + classical + + have hsum_eq_ofReal : (∑' n, (r n : ℂ)) = ((∑' n, r n : ℝ) : ℂ) := by + simpa using (Complex.ofReal_tsum r).symm + have hrewrite_u : ‖∑' n, u n‖ = ‖∑' n, (r n : ℂ)‖ := by + have hfun : u = (fun n => (r n : ℂ)) := funext h + simp [hfun] + have hnorm_abs : ‖((∑' n, r n : ℝ) : ℂ)‖ = |∑' n, r n| := by + simp [Real.norm_eq_abs] + + have hLHS : ‖∑' n, u n‖ = |∑' n, r n| := by + simp [hrewrite_u, hsum_eq_ofReal] + + have hsum_nonneg : 0 ≤ ∑' n, r n := tsum_nonneg hr + have habs_sum : |∑' n, r n| = ∑' n, r n := abs_of_nonneg hsum_nonneg + + have hfunEq : (fun n => ‖u n‖) = (fun n => ‖(r n : ℂ)‖) := by + funext n; simp [h n] + have hfunEq2 : (fun n => ‖(r n : ℂ)‖) = (fun n => r n) := by + funext n + have : ‖(r n : ℂ)‖ = ‖r n‖ := by simp + have : ‖r n‖ = |r n| := by simp + have : |r n| = r n := abs_of_nonneg (hr n) + simp [this] + have hsum_norms1 : (∑' n, ‖u n‖) = ∑' n, ‖(r n : ℂ)‖ := + congrArg (fun f : ℕ → ℝ => ∑' n, f n) hfunEq + have hsum_norms2 : (∑' n, ‖(r n : ℂ)‖) = ∑' n, r n := + congrArg (fun f : ℕ → ℝ => ∑' n, f n) hfunEq2 + have hRHS : (∑' n, ‖u n‖) = ∑' n, r n := hsum_norms1.trans hsum_norms2 + + calc + ‖(∑' n, u n)‖ = |∑' n, r n| := hLHS + _ = ∑' n, r n := habs_sum + _ = ∑' n, ‖u n‖ := by simp [hRHS] + +lemma lem_norm_logDeriv_le_tsum (s : ℂ) (hs : 1 < s.re) : + ‖deriv riemannZeta s / riemannZeta s‖ ≤ ∑' n : ℕ, ‖((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) / ((n : ℂ) ^ s)‖ := by + classical + + let f : ℕ → ℂ := fun n => ((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) + + have hsum_term : Summable (fun n : ℕ => LSeries.term f s n) := by + simpa [f] using! (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := s) hs) + + have hsum_norm : Summable (fun n : ℕ => ‖LSeries.term f s n‖) := + (summable_norm_iff).mpr hsum_term + + have hEq : (∑' n : ℕ, LSeries.term f s n) = - deriv riemannZeta s / riemannZeta s := by + simpa [f] using! (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := s) hs) + + have hpoint : (fun n : ℕ => ‖LSeries.term f s n‖) + = (fun n : ℕ => ‖f n / ((n : ℂ) ^ s)‖) := by + funext n + by_cases h0 : n = 0 + · + subst h0 + + have hf0r : ArithmeticFunction.vonMangoldt 0 = 0 := by + simp + have hf0 : f 0 = 0 := by simp [f, hf0r] + simp [LSeries.term, f, hf0] + · + simp [LSeries.term, f, h0] + + calc + ‖deriv riemannZeta s / riemannZeta s‖ + = ‖- deriv riemannZeta s / riemannZeta s‖ := by simp [norm_neg] + _ = ‖∑' n : ℕ, LSeries.term f s n‖ := by simp [hEq] + _ ≤ ∑' n : ℕ, ‖LSeries.term f s n‖ := + norm_tsum_le_tsum_norm (f := fun n : ℕ => LSeries.term f s n) hsum_norm + _ = ∑' n : ℕ, ‖f n / ((n : ℂ) ^ s)‖ := by simp [hpoint] + _ = ∑' n : ℕ, ‖((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) / ((n : ℂ) ^ s)‖ := rfl + +lemma lem_tsum_norm_vonMangoldt_depends_on_Re_cast (s : ℂ) (σ : ℝ) + (hσ : σ = s.re) (hs : 1 < s.re) : + (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) + = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by + + have hre_ne_zero : s.re ≠ 0 := ne_of_gt (lt_trans zero_lt_one hs) + have hσ_ne_zero : σ ≠ 0 := by + have : 0 < σ := by simpa [hσ] using (lt_trans zero_lt_one hs) + exact ne_of_gt this + + have hterm : (fun n : ℕ => ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) + = (fun n : ℕ => ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by + funext n + + have hden_s : ‖(n : ℂ) ^ s‖ = (n : ℝ) ^ s.re := + Complex.norm_natCast_cpow_of_re_ne_zero n hre_ne_zero + have hden_σ : ‖(n : ℂ) ^ (σ : ℂ)‖ = (n : ℝ) ^ (σ : ℂ).re := + Complex.norm_natCast_cpow_of_re_ne_zero n (by simpa [Complex.ofReal_re] using hσ_ne_zero) + calc + ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖ + = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ))‖ / ‖(n : ℂ) ^ s‖ := by simp + _ = |ArithmeticFunction.vonMangoldt n| / ((n : ℝ) ^ s.re) := by + simp [hden_s, Complex.norm_real] + _ = |ArithmeticFunction.vonMangoldt n| / ((n : ℝ) ^ σ) := by simp [hσ] + _ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ))‖ / ‖(n : ℂ) ^ (σ : ℂ)‖ := by + simp [hden_σ, Complex.ofReal_re, Complex.norm_real] + _ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖ := by simp + simpa using congrArg (fun f : ℕ → ℝ => ∑' n, f n) hterm + +lemma helper_norm_neg_logDeriv_eq_tsum_norm (σ : ℝ) (hσ : 1 < σ) : + ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ = + (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by + classical + + let s : ℂ := (σ : ℂ) + + let f : ℕ → ℂ := fun n => ((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) + + let u : ℕ → ℂ := fun n => LSeries.term f s n + + have hs_re : 1 < s.re := by simpa using! hσ + have hsum_term : Summable (fun n : ℕ => LSeries.term f s n) := by + simpa [f] using! (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := s) hs_re) + + have hsum_u : Summable u := hsum_term + + have hL_eq : (∑' n : ℕ, LSeries.term f s n) = - deriv riemannZeta s / riemannZeta s := + (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := s) hs_re) + have hsum_eq : (∑' n, u n) = - deriv riemannZeta s / riemannZeta s := by + simpa [u] using hL_eq + + have hterm_as_div : ∀ n, + u n = ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) := by + intro n; by_cases h0 : n = 0 + · + subst h0; simp [u, LSeries.term, f, s] + · + simp [u, LSeries.term, f, s, h0] + + let r : ℕ → ℝ := fun n => Classical.choose (lem_term_real_nonneg n σ hσ) + have hr_nonneg : ∀ n, 0 ≤ r n := by + intro n; exact (Classical.choose_spec (lem_term_real_nonneg n σ hσ)).1 + have hr_cast : ∀ n, + ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = (r n : ℂ) := by + intro n; exact (Classical.choose_spec (lem_term_real_nonneg n σ hσ)).2 + have hr_eq' : ∀ n, u n = (r n : ℂ) := by + intro n; simpa [hterm_as_div n] using (hr_cast n) + + have hsum_rc : Summable (fun n => (r n : ℂ)) := by + simpa [u, hr_eq'] using hsum_u + have hsum_r : Summable r := (Complex.summable_ofReal).1 hsum_rc + + have hsum_u_as_real : (∑' n, u n) = ((∑' n, r n) : ℝ) := by + have hru : (fun n => (r n : ℂ)) = u := by + funext n; symm; exact hr_eq' n + have := (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := r)) + + simpa [hru] using this.symm + + have hpoint_norm : (fun n : ℕ => ‖u n‖) + = (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by + funext n; by_cases h0 : n = 0 + · subst h0; simp [u, LSeries.term, f, s] + · simp [u, LSeries.term, f, s, h0] + have hnorm_fun : (fun n : ℕ => ‖u n‖) = r := by + funext n; simp [hr_eq' n, Complex.norm_real, abs_of_nonneg (hr_nonneg n)] + have hsum_norm : Summable (fun n : ℕ => ‖u n‖) := by + simpa [hnorm_fun] using hsum_r + + have hineq : ‖∑' n, u n‖ ≤ ∑' n, ‖u n‖ := + norm_tsum_le_tsum_norm (f := u) hsum_norm + + set S : ℝ := ∑' n, r n + have hS_le : ‖((S : ℝ) : ℂ)‖ ≤ S := by + simpa [S, hsum_u_as_real, hnorm_fun] using hineq + + have hS_nonneg : 0 ≤ S := by + have habs_le : |S| ≤ S := by simpa [Complex.norm_real] using hS_le + exact (abs_nonneg S).trans habs_le + + have h_left : ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ + = ‖∑' n, u n‖ := by + have : - deriv riemannZeta s / riemannZeta s = ∑' n, u n := by simpa [hsum_u_as_real] using hsum_eq.symm + simp [s, this] + have h_mid : ‖∑' n, u n‖ = S := by + + have : ‖((S : ℝ) : ℂ)‖ = S := by simp [Complex.norm_real, abs_of_nonneg hS_nonneg] + simpa [S, hsum_u_as_real] using this + have h_right : (∑' n : ℕ, ‖u n‖) = S := by simp [S, hnorm_fun] + + calc + ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ + = ‖∑' n, u n‖ := h_left + _ = S := h_mid + _ = (∑' n : ℕ, ‖u n‖) := h_right.symm + _ = (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by + simp [hpoint_norm] + +theorem lem_zetacenterbd : + ∀ t : ℝ, + ∀ σ : ℝ, + σ ≥ 3/2 → + ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ + ‖deriv riemannZeta σ / riemannZeta σ‖ := by + intro t σ hσge + + set s : ℂ := Complex.mk σ t + + have hs : 1 < s.re := by + have : (1 : ℝ) < (3 / 2 : ℝ) := by norm_num + exact lt_of_lt_of_le this hσge + have hσgt1 : 1 < σ := by + have : (1 : ℝ) < (3 / 2 : ℝ) := by norm_num + exact lt_of_lt_of_le this hσge + + have h_le_sum := lem_norm_logDeriv_le_tsum s hs + have h1 : ‖deriv riemannZeta s / riemannZeta s‖ ≤ + (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) := by + simpa [norm_div, Complex.norm_real] using h_le_sum + + have h_dep : + (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) + = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by + + have hre : σ = s.re := by simp [s] + simpa using (lem_tsum_norm_vonMangoldt_depends_on_Re_cast s σ hre hs) + have h_dep_ratio : + (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) + = (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) := by + simpa [norm_div, Complex.norm_real] using h_dep + + have h_sum_eq_norm : + ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ + = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := + helper_norm_neg_logDeriv_eq_tsum_norm σ hσgt1 + have h_sum_eq_norm_ratio : + (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) + = ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := by + simpa [norm_div, Complex.norm_real] using h_sum_eq_norm.symm + + have h_main : ‖deriv riemannZeta s / riemannZeta s‖ ≤ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := by + calc + ‖deriv riemannZeta s / riemannZeta s‖ + ≤ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) := h1 + _ = (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) := h_dep_ratio + _ = ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := h_sum_eq_norm_ratio + + simpa [s, norm_neg] using h_main + +lemma lem_logDerivZetalogt32 : + ∃ C : ℝ, C > 1 ∧ + ∀ t : ℝ, |t| > 3 → + ∀ σ : ℝ, + σ ≥ 3/2 → + ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ C := by + + obtain ⟨C0, hC0_gt1, hC0_bound⟩ := Z0bound_const + + refine ⟨C0 + 2, by linarith, ?_⟩ + intro t ht σ hσ + + have h_center := lem_zetacenterbd t σ hσ + + set δ : ℝ := σ - 1 + have hδ_pos : 0 < δ := by linarith [hσ] + have hδ_ge_half : (1 / 2 : ℝ) ≤ δ := by linarith [hσ] + + have hZ0 := hC0_bound δ hδ_pos + + have h_tri : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ + ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ + ‖(1 / (δ : ℂ))‖ := by + simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using + (norm_add_le (-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))) (1 / (δ : ℂ))) + + have h_norm_div_le_two : ‖(1 / (δ : ℂ))‖ ≤ 2 := by + + have hnorm_div : ‖(1 : ℂ) / (δ : ℂ)‖ = ‖(1 : ℂ)‖ / ‖(δ : ℂ)‖ := by + simp + have hnorm_ofReal : ‖(δ : ℂ)‖ = |δ| := by + simp + + have h_abs_ge : (1 / 2 : ℝ) ≤ |δ| := by + have hδ_nonneg : 0 ≤ δ := le_of_lt hδ_pos + simpa [abs_of_nonneg hδ_nonneg] using hδ_ge_half + have hhalfpos : (0 : ℝ) < 1 / 2 := by norm_num + have hone_div_abs_le_two : 1 / |δ| ≤ 2 := by + simpa using (one_div_le_one_div_of_le hhalfpos h_abs_ge) + + have : 1 / ‖(δ : ℂ)‖ ≤ 2 := by simpa [hnorm_ofReal] using hone_div_abs_le_two + + have hnorm_div' : ‖(1 / (δ : ℂ))‖ = 1 / ‖(δ : ℂ)‖ := by + simp + simpa [hnorm_div'] using this + + have h_real_axis_bound : ‖logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + 2 := by + have h1 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + ‖(1 / (δ : ℂ))‖ := + le_trans h_tri (add_le_add_left hZ0 _) + have h2 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + 2 := + le_trans h1 (add_le_add_right h_norm_div_le_two _) + simpa [norm_neg] using h2 + + have hσ_real : (1 : ℝ) + δ = σ := by + simp [δ, sub_eq_add_neg, add_left_comm] + have hσ_eq : (1 : ℂ) + δ = (σ : ℂ) := by + have : ((1 + δ : ℝ) : ℂ) = (σ : ℂ) := by simpa using congrArg Complex.ofReal hσ_real + simpa [Complex.ofReal_add] using this + have hR_bound : ‖deriv riemannZeta σ / riemannZeta σ‖ ≤ C0 + 2 := by + + simpa [logDerivZeta, hσ_eq] using h_real_axis_bound + + exact le_trans h_center hR_bound + +theorem thm_final_result : + ∃ A : ℝ, A > 0 ∧ A < 1 ∧ + ∃ C : ℝ, C > 1 ∧ + ∀ t : ℝ, |t| > 3 → + ∀ σ : ℝ, + σ ≥ 1 - A / Real.log (abs t + 2) → + ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ C * (Real.log (abs t)) ^ 2 := by + + obtain ⟨C₀, hC₀_pos, hC₀⟩ := lem_logDerivZetalogt0 + obtain ⟨C₃₂, hC₃₂_pos, hC₃₂⟩ := lem_logDerivZetalogt32 + + use zerofree_constant / 20 + + constructor + · + apply div_pos zerofree_constant_pos + norm_num + + constructor + · + rw [div_lt_one (by norm_num : (0 : ℝ) < 20)] + + have h1 : zerofree_constant < 1 := zerofree_constant_lt_one + linarith + + use max C₀ C₃₂ + + constructor + · + exact lt_max_of_lt_left hC₀_pos + + · + intro t ht σ hσ + + have h_eq : zerofree_constant / 20 / Real.log (abs t + 2) = deltaz_t t := by + unfold deltaz_t deltaz + simp + + have hσ' : σ ≥ 1 - deltaz_t t := by + rw [← h_eq] + exact hσ + + by_cases h : σ ≥ 3/2 + · + have bound := hC₃₂ t ht σ h + have hC_le : C₃₂ ≤ max C₀ C₃₂ := le_max_right _ _ + + have hlog_ge_one : 1 ≤ Real.log (abs t) := by + have h_ge : Real.exp 1 ≤ abs t := by + + have he_lt_3 : Real.exp 1 < 3 := lem_three_gt_e + linarith [ht, abs_nonneg t] + exact (Real.le_log_iff_exp_le (by linarith [abs_nonneg t])).2 h_ge + have h_one_le_sq : 1 ≤ (Real.log (abs t)) ^ 2 := by + have h_sq : (Real.log (abs t)) ^ 2 = Real.log (abs t) * Real.log (abs t) := by + rw [pow_two] + rw [h_sq] + have h_mul : 1 * 1 ≤ Real.log (abs t) * Real.log (abs t) := + mul_self_le_mul_self (zero_le_one) hlog_ge_one + simpa using h_mul + have h_pos : 0 < C₃₂ := lt_trans zero_lt_one hC₃₂_pos + calc ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ + ≤ C₃₂ := bound + _ = C₃₂ * 1 := by rw [mul_one] + _ ≤ C₃₂ * (Real.log (abs t)) ^ 2 := by + apply mul_le_mul_of_nonneg_left h_one_le_sq (le_of_lt h_pos) + _ ≤ max C₀ C₃₂ * (Real.log (abs t)) ^ 2 := by + apply mul_le_mul_of_nonneg_right hC_le (sq_nonneg _) + + · + push Not at h + have h_conditions : 1 - deltaz_t t ≤ σ ∧ σ ≤ 3/2 ∧ t = t := by + exact ⟨hσ', le_of_lt h, rfl⟩ + have bound := hC₀ t ht ⟨σ, t⟩ h_conditions + have hC_le : C₀ ≤ max C₀ C₃₂ := le_max_left _ _ + calc ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ + ≤ C₀ * Real.log |t| ^ 2 := bound + _ ≤ max C₀ C₃₂ * Real.log |t| ^ 2 := by + apply mul_le_mul_of_nonneg_right hC_le (sq_nonneg _) + +lemma ZetaZeroFree_p : + ∃ (A : ℝ) (_ : A ∈ Set.Ioc 0 (1 / 2)), + ∀ (σ : ℝ) + (t : ℝ) (_ : 3 < |t|) + (_ : σ ∈ Set.Ico (1 - A / Real.log |t| ^ 1) 1), + riemannZeta (σ + t * Complex.I) ≠ 0 := by + + obtain ⟨c, hc_pos, hc_lt_one, hbound⟩ := zerofree + + let A0 : ℝ := min (1 / 2 : ℝ) (c / 2) + let A : ℝ := min A0 ((1 / 4 : ℝ) * Real.log 3) + have hA_pos : 0 < A := by + have h1 : 0 < (1 / 2 : ℝ) := by norm_num + have h2 : 0 < c / 2 := by + have : 0 < (2 : ℝ) := by norm_num + exact div_pos hc_pos this + have hA0pos : 0 < A0 := lt_min_iff.mpr ⟨h1, h2⟩ + have hlog3pos : 0 < Real.log (3 : ℝ) := + (Real.log_pos_iff (by norm_num : (0 : ℝ) ≤ 3)).2 (by norm_num) + have h3 : 0 < (1 / 4 : ℝ) * Real.log 3 := by + exact mul_pos (by norm_num) hlog3pos + exact lt_min_iff.mpr ⟨hA0pos, h3⟩ + have hA_le_half : A ≤ 1/2 := by + have : A ≤ A0 := min_le_left _ _ + exact this.trans (min_le_left _ _) + have hA_le_c2 : A ≤ c / 2 := by + have : A ≤ A0 := min_le_left _ _ + exact this.trans (min_le_right _ _) + have hA_le_log3quarter : A ≤ (1 / 4 : ℝ) * Real.log 3 := min_le_right _ _ + refine ⟨A, ?_, ?_⟩ + · exact ⟨hA_pos, hA_le_half⟩ + · intro σ t htgt3 hσI hzero + + set L := Real.log |t| with hLdef + set Lp := Real.log (|t| + 2) with hLpdef + have hpos_abs : 0 ≤ |t| := abs_nonneg t + have hLpos : 0 < L := (Real.log_pos_iff hpos_abs).2 (lt_trans (by norm_num) htgt3) + have hLp_pos_arg : 0 < |t| + 2 := by linarith + have hLp_pos : 0 < Lp := (Real.log_pos_iff (le_of_lt hLp_pos_arg)).2 (by linarith) + + have hlog3_le_L : Real.log 3 ≤ L := by + have h3pos : 0 < (3 : ℝ) := by norm_num + have : (3 : ℝ) ≤ |t| := le_of_lt htgt3 + simpa [hLdef] using Real.log_le_log h3pos this + + have hquarter_ratio_le : ((1 / 4 : ℝ) * Real.log 3) / L ≤ (1 / 4 : ℝ) := by + have h := div_le_div_of_nonneg_right hlog3_le_L (le_of_lt hLpos) + have h' := mul_le_mul_of_nonneg_left h (by norm_num : (0 : ℝ) ≤ 1/4) + have hne : L ≠ 0 := ne_of_gt hLpos + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hne] using h' + + have hA_over_le_quarter : A / L ≤ (1 / 4 : ℝ) := by + have := div_le_div_of_nonneg_right hA_le_log3quarter (le_of_lt hLpos) + exact this.trans hquarter_ratio_le + + have hlow : 1 - A / L ≤ σ := by simpa [hLdef, pow_one] using hσI.1 + have hσ_ge_34 : (3 / 4 : ℝ) ≤ σ := by + have : (3 / 4 : ℝ) ≤ 1 - A / L := by linarith + exact this.trans hlow + have hσ_pos : 0 < σ := lt_of_lt_of_le (by norm_num : (0 : ℝ) < (3/4 : ℝ)) hσ_ge_34 + have hσ_lt_one : σ < 1 := hσI.2 + + have hlog_lt : Lp < 2 * L := by + have h1 : 0 < |t| - 2 := by linarith + have h2 : 0 < |t| + 1 := by linarith + have hprod_pos : 0 < (|t| - 2) * (|t| + 1) := mul_pos h1 h2 + have hpoly : |t| * |t| - (|t| + 2) = (|t| - 2) * (|t| + 1) := by ring + have hlt : |t| + 2 < |t| * |t| := by + calc + |t| + 2 < |t| + 2 + (|t| - 2) * (|t| + 1) := by linarith [hprod_pos] + _ = |t| * |t| := by rw [← hpoly]; ring + have hposb : 0 < |t| + 2 := by linarith + have hlog_lt' : Real.log (|t| + 2) < Real.log (|t| * |t|) := Real.log_lt_log hposb hlt + have hlogmul : Real.log (|t| ^ 2) = 2 * Real.log |t| := Real.log_pow |t| 2 + calc + Lp = Real.log (|t| + 2) := by simp [hLpdef] + _ < Real.log (|t| * |t|) := hlog_lt' + _ = Real.log (|t| ^ 2) := by simp [pow_two] + _ = 2 * Real.log |t| := by simp + _ = 2 * L := by simp [hLdef] + + have h_inv_comp : 1 / (2 * L) < 1 / Lp := one_div_lt_one_div_of_lt hLp_pos hlog_lt + have hstep2 : (c / 2) / L < c / Lp := by + have hcpos' : 0 < c := hc_pos + have : c * (1 / (2 * L)) < c * (1 / Lp) := mul_lt_mul_of_pos_left h_inv_comp hcpos' + simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this + + have hstep1 : A / L ≤ (c / 2) / L := by + have := div_le_div_of_nonneg_right hA_le_c2 (le_of_lt hLpos) + simpa [div_eq_mul_inv] using this + have hstrict_div : A / L < c / Lp := lt_of_le_of_lt hstep1 hstep2 + + have hσ_gt : 1 - c / Lp < σ := by + have hneg' : - (c / Lp) < - (A / L) := by simpa [neg_div] using neg_lt_neg hstrict_div + have : 1 - c / Lp < 1 - A / L := by simpa [sub_eq_add_neg] using! add_lt_add_right hneg' 1 + exact this.trans_le hlow + + let s : ℂ := Complex.mk σ t + have hs_zero : riemannZeta s = 0 := by simpa [s, Complex.mk_eq_add_mul_I] using hzero + have hs_in_zeroZ : s ∈ zeroZ := by simpa [zeroZ] using hs_zero + have hpre : s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1 := by + refine ⟨hs_in_zeroZ, ?_, ?_⟩ + · simpa [s] using hσ_pos + · simpa [s] using hσ_lt_one + have him_bound : 2 < |s.im| := by + have : 2 < |t| := lt_trans (by norm_num) htgt3 + simpa [s] using this + have hbound_applied : s.re ≤ 1 - c / Real.log (abs s.im + 2) := hbound s hpre him_bound + have hle : σ ≤ 1 - c / Lp := by simpa [s, hLpdef] using hbound_applied + have hcontr : σ < σ := lt_of_le_of_lt hle hσ_gt + exact (lt_irrefl _ : ¬ σ < σ) hcontr + +open _root_.Set Function Filter _root_.Complex _root_.Real +lemma LogDerivZetaBndUnif2 : + ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) + (_ : σ ∈ Ici (1 - A / Real.log |t| ^ 1)), ‖(deriv riemannZeta) (σ + t * Complex.I) / riemannZeta (σ + t * Complex.I)‖ ≤ + C * Real.log |t| ^ 2 := by + classical + obtain ⟨c, hc, hc2, K, hK, hfinal⟩ := thm_final_result + + let A : ℝ := min (1/2 : ℝ) (c / 2) + have hApos : 0 < A := by + have h1 : 0 < (1/2 : ℝ) := by norm_num + have h2 : 0 < c / 2 := by + have : 0 < (2 : ℝ) := by norm_num + exact div_pos hc this + exact (lt_min_iff).2 ⟨h1, h2⟩ + have hAle : A ≤ (1/2 : ℝ) := min_le_left _ _ + have hA_in : A ∈ Ioc 0 (1/2) := ⟨hApos, hAle⟩ + let C : ℝ := K + have hCpos : 0 < C := by + have hKpos : 0 < K := lt_trans (by norm_num : (0 : ℝ) < 1) hK + exact hKpos + refine ⟨A, hA_in, C, hCpos, ?_⟩ + intro σ t htgt3 hσI + + let x := |t| + have hxpos : 0 ≤ x := abs_nonneg t + have hxgt3 : 3 < x := htgt3 + let L := Real.log x + let L' := Real.log (x + 2) + have hLpos : 0 < L := (Real.log_pos_iff hxpos).2 (lt_trans (by norm_num) hxgt3) + have hL'pos : 0 < L' := + (Real.log_pos_iff (by linarith : 0 ≤ x + 2)).2 (by linarith [hxpos, hxgt3]) + + have hσ_ge : 1 - A / L ≤ σ := by simpa [pow_one, L, x] using hσI + + have hprod_pos : 0 < (x - 2) * (x + 1) := by + have hxgt2 : (2 : ℝ) < x := lt_trans (by norm_num) hxgt3 + exact mul_pos (sub_pos.mpr hxgt2) (add_pos_of_nonneg_of_pos hxpos (by norm_num)) + have hdiff_pos : 0 < x ^ 2 - (x + 2) := by + have hpoly : x ^ 2 - (x + 2) = (x - 2) * (x + 1) := by ring + simpa [hpoly] using hprod_pos + have hlt_sq : x + 2 < x ^ 2 := by linarith + have hlog_lt : L' < Real.log (x ^ 2) := + Real.log_lt_log (by linarith : 0 < x + 2) hlt_sq + have hlog_pow : Real.log (x ^ 2) = 2 * L := by + simp [L] + have hL'_lt_2L : L' < 2 * L := by simpa [L', hlog_pow] + using hlog_lt + + have hA_le_c2 : A ≤ c / 2 := min_le_right _ _ + have hstep0 : A / L ≤ (c / 2) / L := + div_le_div_of_nonneg_right hA_le_c2 (le_of_lt hLpos) + have hrecip : 1 / (2 * L) < 1 / L' := + one_div_lt_one_div_of_lt hL'pos hL'_lt_2L + have hmul : c * (1 / (2 * L)) < c * (1 / L') := + mul_lt_mul_of_pos_left hrecip hc + have hstep2 : (c / 2) / L < c / L' := by + simpa [one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] + using hmul + have hineq : A / L < c / L' := lt_of_le_of_lt hstep0 hstep2 + have hσ_gt : σ > 1 - c / L' := by + have : 1 - c / L' < 1 - A / L := by linarith [hineq] + exact lt_of_lt_of_le this hσ_ge + + have hmain' : ‖(deriv riemannZeta) (σ + t * Complex.I) / riemannZeta (σ + t * Complex.I)‖ ≤ + K * (Real.log |t|) ^ 2 := by + have h_eq : σ + t * Complex.I = Complex.mk σ t := by + rw [Complex.mk_eq_add_mul_I] + rw [h_eq] + have hσ_ge_required : σ ≥ 1 - c / Real.log (abs t + 2) := by + have h_abs_eq : abs t = |t| := by simp + rw [h_abs_eq] + exact le_of_lt hσ_gt + exact hfinal t htgt3 σ hσ_ge_required + + simpa [C, L, x] using hmain' + +end Erdos970 diff --git a/StrongPNT/Erdos970/PNT5_Strong.lean b/StrongPNT/Erdos970/PNT5_Strong.lean new file mode 100644 index 0000000..bc0f938 --- /dev/null +++ b/StrongPNT/Erdos970/PNT5_Strong.lean @@ -0,0 +1,5754 @@ +import PrimeNumberTheoremAnd.Erdos970.ZetaBounds +import PrimeNumberTheoremAnd.Erdos970.ZetaConj +import PrimeNumberTheoremAnd.Erdos970.SmoothExistence +import Mathlib.Algebra.Group.Support +import Mathlib.Analysis.SpecialFunctions.Log.Monotone +import Mathlib.Analysis.Real.Pi.Bounds +import Mathlib.Analysis.Complex.ExponentialBounds +import StrongPNT.Erdos970.ZetaZeroFree + +namespace Erdos970 + + +open _root_.Set _root_.Function _root_.Filter _root_.Complex _root_.Real + +open _root_.ArithmeticFunction (vonMangoldt) + +noncomputable abbrev MellinTransform : (ℝ → ℂ) → ℂ → ℂ := mellin + +lemma MellinTransform_integral (f : ℝ → ℂ) (s : ℂ) : + MellinTransform f s = ∫ x in Set.Ioi (0 : ℝ), f x * (x : ℂ) ^ (s - 1) := by + simp only [MellinTransform, mellin, smul_eq_mul, mul_comm] + +lemma MellinTransform_eq : MellinTransform = (mellin : (ℝ → ℂ) → ℂ → ℂ) := by + rfl + +noncomputable def MellinInverseTransform (F : ℂ → ℂ) (σ : ℝ) (x : ℝ) : ℂ := + VerticalIntegral' (fun s ↦ x ^ (-s) * F s) σ + +lemma MellinInverseTransform_eq (σ : ℝ) (f : ℂ → ℂ) : + MellinInverseTransform f σ = mellinInv σ f := by + unfold mellinInv MellinInverseTransform VerticalIntegral' VerticalIntegral + beta_reduce; ext x + rw [← smul_assoc, smul_eq_mul (b := Complex.I), div_mul]; simp + +theorem MellinInversion (σ : ℝ) {f : ℝ → ℂ} {x : ℝ} (hx : 0 < x) (hf : MellinConvergent f σ) + (hFf : VerticalIntegrable (mellin f) σ) (hfx : ContinuousAt f x) : + MellinInverseTransform (MellinTransform f) σ x = f x := by + rw [MellinInverseTransform_eq, mellinInv_mellin_eq σ f hx hf hFf hfx] + +local notation (name := mellintransform2) "𝓜" => MellinTransform + +local notation "Λ" => vonMangoldt + +local notation "ζ" => riemannZeta + +local notation "ζ'" => deriv ζ + +local notation "I" => Complex.I + +noncomputable def ChebyshevPsi (x : ℝ) : ℝ := + (Finset.range ⌊x + 1⌋₊).sum Λ + +local notation "ψ" => ChebyshevPsi + +theorem LogDerivativeDirichlet (s : ℂ) (hs : 1 < s.re) : + - deriv riemannZeta s / riemannZeta s = ∑' n, Λ n / (n : ℂ) ^ s := by + rw [← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs] + dsimp [LSeries, LSeries.term] + nth_rewrite 2 [Summable.tsum_eq_add_tsum_ite (b := 0) ?_] + · simp + · have := ArithmeticFunction.LSeriesSummable_vonMangoldt hs + dsimp [LSeriesSummable] at this + convert! this using 1 + funext n + by_cases h : n = 0 <;> simp [LSeries.term, h] + +noncomputable abbrev SmoothedChebyshevIntegrand (SmoothingF : ℝ → ℝ) (ε : ℝ) (X : ℝ) : ℂ → ℂ := + fun s ↦ (- deriv riemannZeta s) / riemannZeta s * + 𝓜 ((Smooth1 SmoothingF ε) ·) s * (X : ℂ) ^ s + +noncomputable def SmoothedChebyshev (SmoothingF : ℝ → ℝ) (ε : ℝ) (X : ℝ) : ℂ := + VerticalIntegral' (SmoothedChebyshevIntegrand SmoothingF ε X) ((1 : ℝ) + (Real.log X)⁻¹) + +open ComplexConjugate + +lemma smoothedChebyshevIntegrand_conj {SmoothingF : ℝ → ℝ} {ε X : ℝ} (Xpos : 0 < X) (s : ℂ) : + SmoothedChebyshevIntegrand SmoothingF ε X (conj s) = conj (SmoothedChebyshevIntegrand SmoothingF ε X s) := by + unfold SmoothedChebyshevIntegrand + simp only [map_mul, map_div₀, map_neg] + congr + · exact deriv_riemannZeta_conj s + · exact riemannZeta_conj s + · simp_rw [MellinTransform_integral] + + rw[← integral_conj] + apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi + intro x xpos + simp only [map_mul, Complex.conj_ofReal] + congr + nth_rw 1 [← map_one conj] + rw[← map_sub, Complex.cpow_conj, Complex.conj_ofReal] + rw[Complex.arg_ofReal_of_nonneg xpos.le] + exact Real.pi_ne_zero.symm + · rw[Complex.cpow_conj, Complex.conj_ofReal] + rw[Complex.arg_ofReal_of_nonneg Xpos.le] + exact Real.pi_ne_zero.symm + +open _root_.MeasureTheory + +lemma SmoothedChebyshevDirichlet_aux_integrable {SmoothingF : ℝ → ℝ} + (diffSmoothingF : ContDiff ℝ 1 SmoothingF) + (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) + (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) + (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) + {ε : ℝ} (εpos : 0 < ε) (ε_lt_one : ε < 1) {σ : ℝ} (σ_gt : 1 < σ) (σ_le : σ ≤ 2) : + MeasureTheory.Integrable + (fun (y : ℝ) ↦ 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (σ + y * I)) := by + obtain ⟨c, cpos, hc⟩ := MellinOfSmooth1b diffSmoothingF suppSmoothingF + apply Integrable.mono' (g := (fun t ↦ c / ε * 1 / (1 + t ^ 2))) + · apply Integrable.const_mul integrable_inv_one_add_sq + · apply Continuous.aestronglyMeasurable + apply continuous_iff_continuousAt.mpr + intro x + have := Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ + SmoothingFpos mass_one (s := σ + x * I) (by simp only [add_re, ofReal_re, mul_re, I_re, + mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith) |>.continuousAt + fun_prop + · filter_upwards [] with t + calc + _≤ c / ε * 1 / (σ^2 + t^2) := by + convert hc (σ / 2) (by linarith) (σ + t * I) (by simp only [add_re, ofReal_re, mul_re, + I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, half_le_self_iff]; linarith) + (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero]; linarith) ε εpos ε_lt_one using 1 + simp only [mul_one, Complex.sq_norm, normSq_apply, add_re, ofReal_re, mul_re, I_re, + mul_zero, ofReal_im, I_im, sub_self, add_zero, add_im, mul_im, zero_add, mul_inv_rev] + ring_nf + _ ≤ _ := by + gcongr; nlinarith + +attribute [fun_prop] Continuous.const_cpow + +lemma SmoothedChebyshevDirichlet_aux_tsum_integral {SmoothingF : ℝ → ℝ} + (diffSmoothingF : ContDiff ℝ 1 SmoothingF) + (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) + (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) + (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) {X : ℝ} + (X_pos : 0 < X) {ε : ℝ} (εpos : 0 < ε) + (ε_lt_one : ε < 1) {σ : ℝ} (σ_gt : 1 < σ) (σ_le : σ ≤ 2) : + ∫ (t : ℝ), + ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n) / (n : ℂ) ^ (σ + t * I) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + t * I) * (X : ℂ) ^ (σ + t * I) = + ∑' (n : ℕ), + ∫ (t : ℝ), (ArithmeticFunction.vonMangoldt n) / (n : ℂ) ^ (σ + ↑t * I) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X : ℂ) ^ (σ + t * I) := by + + have cont_mellin_smooth : Continuous fun (a : ℝ) ↦ + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑a * I) := by + apply continuousOn_univ.mp + refine ContinuousOn.comp' ?_ ?_ ?_ (t := {z : ℂ | 0 < z.re }) + . refine continuousOn_of_forall_continuousAt ?_ + intro z hz + exact (Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one hz).continuousAt + . fun_prop + . simp only [mapsTo_univ_iff, mem_ofPred_eq, add_re, ofReal_re, mul_re, I_re, mul_zero, + ofReal_im, I_im, mul_one, sub_self, add_zero, forall_const]; linarith + + have abs_two : ∀ a : ℝ, ∀ i : ℕ, ‖(i : ℂ) ^ ((σ : ℂ) + ↑a * I)‖₊ = i ^ σ := by + intro a i + simp_rw [← norm_toNNReal] + + rw [norm_natCast_cpow_of_re_ne_zero _ (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, + ofReal_im, I_im, mul_one, sub_self, add_zero, ne_eq]; linarith)] + simp only [add_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero, Real.toNNReal_of_nonneg <| rpow_nonneg (y:= σ) (x:= i) (by linarith)] + norm_cast + + rw [MeasureTheory.integral_tsum] + have x_neq_zero : X ≠ 0 := by linarith + . intro i + by_cases i_eq_zero : i = 0 + . simpa [i_eq_zero] using aestronglyMeasurable_const + . apply Continuous.aestronglyMeasurable + fun_prop (disch := simp[i_eq_zero, x_neq_zero]) + . rw [← lt_top_iff_ne_top] + simp_rw [enorm_mul, enorm_eq_nnnorm, nnnorm_div, ← norm_toNNReal, Complex.norm_cpow_eq_rpow_re_of_pos X_pos, norm_toNNReal, abs_two] + simp only [nnnorm_real, add_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, + mul_one, sub_self, add_zero] + simp_rw [MeasureTheory.lintegral_mul_const' (r := ↑(X ^ σ).toNNReal) (hr := by simp), ENNReal.tsum_mul_right] + apply ENNReal.mul_lt_top ?_ ENNReal.coe_lt_top + + conv => + arg 1 + arg 1 + intro i + rw [MeasureTheory.lintegral_const_mul' (hr := by simp)] + + rw [ENNReal.tsum_mul_right] + apply ENNReal.mul_lt_top + . rw [lt_top_iff_ne_top, ENNReal.tsum_coe_ne_top_iff_summable_coe] + push_cast + convert (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := σ) + (by simp only [ofReal_re]; linarith)).norm + rw [LSeries.term_def] + split_ifs with h <;> simp[h] + . simp_rw [← enorm_eq_nnnorm] + rw [← MeasureTheory.hasFiniteIntegral_iff_enorm] + exact SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos suppSmoothingF + mass_one εpos ε_lt_one σ_gt σ_le |>.hasFiniteIntegral + +theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} + (diffSmoothingF : ContDiff ℝ 1 SmoothingF) + (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (mass_one: ∫ x in Ioi (0 : ℝ), SmoothingF x / x = 1) + {X : ℝ} (X_gt : 3 < X) {ε : ℝ} (εpos: 0 < ε) (ε_lt_one : ε < 1) : + SmoothedChebyshev SmoothingF ε X = + ∑' n, ArithmeticFunction.vonMangoldt n * Smooth1 SmoothingF ε (n / X) := by + dsimp [SmoothedChebyshev, SmoothedChebyshevIntegrand, VerticalIntegral', VerticalIntegral] + set σ : ℝ := 1 + (Real.log X)⁻¹ + have log_gt : 1 < Real.log X := by + rw [Real.lt_log_iff_exp_lt (by linarith : 0 < X)] + linarith [Real.exp_one_lt_d9] + have σ_gt : 1 < σ := by + simp only [σ] + have : 0 < (Real.log X)⁻¹ := by + simp only [inv_pos] + linarith + linarith + have σ_le : σ ≤ 2 := by + simp only [σ] + have : (Real.log X)⁻¹ < 1 := inv_lt_one_of_one_lt₀ log_gt + linarith + calc + _ = 1 / (2 * π * I) * (I * ∫ (t : ℝ), ∑' n, Λ n / (n : ℂ) ^ (σ + ↑t * I) * + mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ + _ = 1 / (2 * π * I) * (I * ∑' n, ∫ (t : ℝ), Λ n / (n : ℂ) ^ (σ + ↑t * I) * + mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ + _ = 1 / (2 * π * I) * (I * ∑' n, Λ n * ∫ (t : ℝ), + mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ + _ = 1 / (2 * π) * (∑' n, Λ n * ∫ (t : ℝ), + mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ + _ = ∑' n, Λ n * (1 / (2 * π) * ∫ (t : ℝ), + mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ + _ = ∑' n, Λ n * (1 / (2 * π) * ∫ (t : ℝ), + mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * ((n : ℂ) / X) ^ (-(σ + ↑t * I))) := ?_ + _ = _ := ?_ + · congr; ext t + rw [LogDerivativeDirichlet] + · rw [← tsum_mul_right, ← tsum_mul_right] + · simp [σ_gt] + · congr + exact SmoothedChebyshevDirichlet_aux_tsum_integral diffSmoothingF SmoothingFpos + suppSmoothingF mass_one (by linarith) εpos ε_lt_one σ_gt σ_le + · field_simp; congr; ext n; rw [← MeasureTheory.integral_const_mul]; congr; ext t + by_cases n_ne_zero : n = 0; simp [n_ne_zero] + rw [mul_div_assoc, mul_assoc] + congr + rw [(div_eq_iff ?_).mpr] + have := @mul_cpow_ofReal_nonneg (a := X / (n : ℝ)) (b := (n : ℝ)) (r := σ + t * I) ?_ ?_ + push_cast at this ⊢ + rw [mul_comm I (↑t : ℂ)] + rw [← this, div_mul_cancel₀] + · simp only [ne_eq, Nat.cast_eq_zero, n_ne_zero, not_false_eq_true] + · apply div_nonneg (by linarith : 0 ≤ X); simp + · simp + · simp only [ne_eq, cpow_eq_zero_iff, Nat.cast_eq_zero, not_and, not_not] + intro hn; exfalso; exact n_ne_zero hn + · conv => rw [← mul_assoc, div_mul]; lhs; lhs; rhs; simp + · simp_rw [← tsum_mul_left, ← mul_assoc, mul_comm] + · have ht (t : ℝ) : -(σ + t * I) = (-1) * (σ + t * I) := by simp + have hn (n : ℂ) : (n / X) ^ (-1 : ℂ) = X / n := by simp [cpow_neg_one] + have (n : ℕ) : (log ((n : ℂ) / (X : ℂ)) * -1).im = 0 := by + simp [Complex.log_im, arg_eq_zero_iff, div_nonneg (Nat.cast_nonneg _) (by linarith : 0 ≤ X)] + have h (n : ℕ) (t : ℝ) : ((n : ℂ) / X) ^ ((-1 : ℂ) * (σ + t * I)) = + ((n / X) ^ (-1 : ℂ)) ^ (σ + ↑t * I) := by + rw [cpow_mul] <;> {rw [this n]; simp [Real.pi_pos, Real.pi_nonneg]} + congr 1 + funext n + + simp_rw [ht, h, hn] + · push_cast + congr + ext n + by_cases n_zero : n = 0; simp [n_zero] + have n_pos : 0 < n := by + simpa only [n_zero, gt_iff_lt, false_or] using (Nat.eq_zero_or_pos n) + congr + rw [(by rw [div_mul]; simp : 1 / (2 * π) = 1 / (2 * π * I) * I), mul_assoc] + conv => lhs; rhs; rhs; rhs; intro t; rw [mul_comm]; norm_cast + have := MellinInversion σ (f := fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (x := n / X) + ?_ ?_ ?_ ?_ + · beta_reduce at this + dsimp [MellinInverseTransform, VerticalIntegral] at this + rw [this] + · exact div_pos (by exact_mod_cast n_pos) (by linarith : 0 < X) + · apply Smooth1MellinConvergent diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one + simp only [ofReal_re] + linarith + · dsimp [VerticalIntegrable] + apply SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos + suppSmoothingF mass_one εpos ε_lt_one σ_gt σ_le + · refine ContinuousAt.comp (g := ofReal) RCLike.continuous_ofReal.continuousAt ?_ + exact Smooth1ContinuousAt diffSmoothingF SmoothingFpos suppSmoothingF + εpos (by positivity) + +theorem SmoothedChebyshevClose_aux {Smooth1 : (ℝ → ℝ) → ℝ → ℝ → ℝ} (SmoothingF : ℝ → ℝ) + (c₁ : ℝ) (c₁_pos : 0 < c₁) (c₁_lt : c₁ < 1) + (c₂ : ℝ) (c₂_pos : 0 < c₂) (c₂_lt : c₂ < 2) (hc₂ : ∀ (ε x : ℝ), ε ∈ Ioo 0 1 → 1 + c₂ * ε ≤ x → Smooth1 SmoothingF ε x = 0) + (C : ℝ) (C_eq : C = 6 * (3 * c₁ + c₂)) + (ε : ℝ) (ε_pos : 0 < ε) (ε_lt_one : ε < 1) + (X : ℝ) (X_pos : 0 < X) (X_gt_three : 3 < X) (X_bound_1 : 1 ≤ X * ε * c₁) (X_bound_2 : 1 ≤ X * ε * c₂) + (smooth1BddAbove : ∀ (n : ℕ), 0 < n → Smooth1 SmoothingF ε (↑n / X) ≤ 1) + (smooth1BddBelow : ∀ (n : ℕ), 0 < n → Smooth1 SmoothingF ε (↑n / X) ≥ 0) + (smoothIs1 : ∀ (n : ℕ), 0 < n → ↑n ≤ X * (1 - c₁ * ε) → Smooth1 SmoothingF ε (↑n / X) = 1) + (smoothIs0 : ∀ (n : ℕ), 1 + c₂ * ε ≤ ↑n / X → Smooth1 SmoothingF ε (↑n / X) = 0) : + ‖(↑((∑' (n : ℕ), ArithmeticFunction.vonMangoldt n * Smooth1 SmoothingF ε (↑n / X))) : ℂ) - + ↑((Finset.range ⌊X + 1⌋₊).sum ⇑ArithmeticFunction.vonMangoldt)‖ ≤ + C * ε * X * Real.log X := by + norm_cast + + let F := Smooth1 SmoothingF ε + + let n₀ := ⌈X * (1 - c₁ * ε)⌉₊ + + have n₀_pos : 0 < n₀ := by + simp only [Nat.ceil_pos, n₀] + subst C_eq + simp_all only [mem_Ioo, and_imp, ge_iff_le, implies_true, mul_pos_iff_of_pos_left, sub_pos] + exact (mul_le_of_le_one_right c₁_pos.le ε_lt_one.le).trans_lt c₁_lt + + have n₀_inside_le_X : X * (1 - c₁ * ε) ≤ X := by + nth_rewrite 2 [← mul_one X] + apply mul_le_mul_of_nonneg_left _ X_pos.le + apply sub_le_self + positivity + + have n₀_le : n₀ ≤ X * ((1 - c₁ * ε)) + 1 := by + simp only [n₀] + apply le_of_lt + exact Nat.ceil_lt_add_one (by bound) + + have n₀_gt : X * ((1 - c₁ * ε)) ≤ n₀ := by + simp only [n₀] + exact Nat.le_ceil (X * (1 - c₁ * ε)) + + have sumΛ : Summable (fun (n : ℕ) ↦ Λ n * F (n / X)) := by + exact (summable_of_ne_finset_zero fun a s=>mul_eq_zero_of_right _ + (hc₂ _ _ (by trivial) ((le_div_iff₀ X_pos).2 (Nat.ceil_le.1 (not_lt.1 + (s ∘ Finset.mem_range.2)))))) + + have sumΛn₀ (n₀ : ℕ) : Summable (fun n ↦ Λ (n + n₀) * F ((n + n₀) / X)) := by exact_mod_cast sumΛ.comp_injective fun Q=>by valid + + rw[← Summable.sum_add_tsum_nat_add' (k := n₀) (mod_cast sumΛn₀ n₀)] + + let n₁ := ⌊X * (1 + c₂ * ε)⌋₊ + + have n₁_pos : 0 < n₁ := by + dsimp only [n₁] + apply Nat.le_floor + rw[Nat.succ_eq_add_one, zero_add] + norm_cast + apply one_le_mul_of_one_le_of_one_le (by linarith) + apply le_add_of_nonneg_right + positivity + + have n₁_ge : X * (1 + c₂ * ε) - 1 ≤ n₁ := by + simp only [tsub_le_iff_right, n₁] + exact le_of_lt (Nat.lt_floor_add_one (X * (1 + c₂ * ε))) + + have n₁_le : (n₁ : ℝ) ≤ X * (1 + c₂ * ε) := by + simp only [n₁] + exact Nat.floor_le (by bound) + + have n₁_ge_n₀ : n₀ ≤ n₁ := by + have hn : (n₀ : ℝ) ≤ (n₁ : ℝ) := by linarith + exact_mod_cast hn + + have n₁_sub_n₀ : (n₁ : ℝ) - n₀ ≤ X * ε * (c₂ + c₁) := by + calc + (n₁ : ℝ) - n₀ ≤ X * (1 + c₂ * ε) - n₀ := by + exact sub_le_sub_right n₁_le ↑n₀ + _ ≤ X * (1 + c₂ * ε) - (X * (1 - c₁ * ε)) := by + exact tsub_le_tsub_left n₀_gt (X * (1 + c₂ * ε)) + _ = X * ε * (c₂ + c₁) := by ring + + have : (∑' (n : ℕ), Λ (n + n₀ : ) * F ((n + n₀ : ) / X)) = + (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((n + n₀) / X)) + + (∑' (n : ℕ), Λ (n + n₁ : ) * F ((n + n₁ : ) / X)) := by + rw[← Summable.sum_add_tsum_nat_add' (k := n₁ - n₀)] + congr! 5 + · simp only [Nat.cast_add] + · omega + · congr! 1 + norm_cast + omega + · convert sumΛn₀ ((n₁ - n₀) + n₀) using 4 + · omega + · congr! 1 + norm_cast + omega + + rw [this] + clear this + + have : (∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X)) = Λ (n₁) * F (↑n₁ / X) := by + have : (∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X)) = Λ (n₁) * F (↑n₁ / X) + (∑' (n : ℕ), Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X)) := by + let fTemp := fun n ↦ Λ (n + n₁) * F ((↑n + ↑n₁) / X) + have sum_fTemp : Summable fTemp := by exact sumΛn₀ n₁ + have hTemp (n : ℕ): fTemp n = Λ (n + n₁) * F (↑(n + n₁) / X) := by rw[Nat.cast_add] + have : ∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X) = ∑' (n : ℕ), fTemp n := by exact Eq.symm (tsum_congr hTemp) + rw[this] + have (n : ℕ): fTemp (n + 1) = Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X) := by exact hTemp (n + 1) + have : ∑' (n : ℕ), Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X) = ∑' (n : ℕ), fTemp (n + 1) := by exact Eq.symm (tsum_congr this) + rw[this] + have : Λ n₁ * F (↑n₁ / X) = fTemp 0 := by + dsimp only [fTemp] + rw[← Nat.cast_add, zero_add] + rw[this] + exact Summable.tsum_eq_zero_add (sumΛn₀ n₁) + rw[this] + apply add_eq_left.mpr + convert tsum_zero with n + have : n₁ ≤ n + (n₁) := by exact Nat.le_add_left (n₁) n + convert mul_zero _ + convert smoothIs0 (n + 1 + n₁) ?_ + rw[← mul_le_mul_iff_left₀ X_pos] + have : ↑(n + 1 + n₁) / X * X = ↑(n + 1 + n₁) := by field_simp + rw[this] + have : (1 + c₂ * ε) * X = 1 + (X * (1 + c₂ * ε) - 1) := by ring + rw[this, Nat.cast_add, Nat.cast_add] + exact add_le_add (by bound) n₁_ge + + rw [this] + clear this + + have X_le_floor_add_one : X ≤ ↑⌊X + 1⌋₊ := by + rw[Nat.floor_add_one, Nat.cast_add, Nat.cast_one] + have temp : X ≤ ↑⌈X⌉₊ := by exact Nat.le_ceil X + have : (⌈X⌉₊ : ℝ) ≤ ↑⌊X⌋₊ + 1 := by exact_mod_cast Nat.ceil_le_floor_add_one X + exact Preorder.le_trans X (↑⌈X⌉₊) (↑⌊X⌋₊ + 1) temp this + positivity + + have floor_X_add_one_le_self : ↑⌊X + 1⌋₊ ≤ X + 1 := by exact Nat.floor_le (by positivity) + + have : ∑ x ∈ Finset.range ⌊X + 1⌋₊, Λ x = + (∑ x ∈ Finset.range n₀, Λ x) + + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + ↑n₀) := by + simp only [add_comm _ n₀] + rw [← Finset.sum_range_add, Nat.add_sub_of_le] + dsimp only [n₀] + refine Nat.ceil_le.mpr ?_ + exact Preorder.le_trans (X * (1 - c₁ * ε)) X (↑⌊X + 1⌋₊) n₀_inside_le_X X_le_floor_add_one + rw [this] + clear this + + have : ∑ n ∈ Finset.range n₀, Λ n * F (↑n / X) = + ∑ n ∈ Finset.range n₀, Λ n := by + apply Finset.sum_congr rfl + intro n hn + by_cases n_zero : n = 0 + · rw [n_zero] + simp only [ArithmeticFunction.map_zero, CharP.cast_eq_zero, zero_div, zero_mul] + · convert mul_one _ + convert smoothIs1 n (Nat.zero_lt_of_ne_zero n_zero) ?_ + simp only [Finset.mem_range, n₀] at hn + have : (n < ⌈X * (1 - c₁ * ε)⌉₊) → (n ≤ ⌊X * (1 - c₁ * ε)⌋₊) := by + intro n_lt + by_contra hcontra + + rw[not_le] at hcontra + + have temp1: (⌊X * (1 - c₁ * ε)⌋₊).succ.succ ≤ n.succ := by + apply Nat.succ_le_succ + exact Nat.succ_le_of_lt hcontra + have : n.succ ≤ ⌈X * (1 - c₁ * ε)⌉₊ := by exact Nat.succ_le_of_lt hn + have temp2: ⌊X * (1 - c₁ * ε)⌋₊ + 2 = (⌊X * (1 - c₁ * ε)⌋₊ + 1) + 1 := by ring + have : ⌊X * (1 - c₁ * ε)⌋₊ + 2 ≤ ⌈X * (1 - c₁ * ε)⌉₊ := by + rw[temp2, ← Nat.succ_eq_add_one, ← Nat.succ_eq_add_one] + exact Nat.le_trans temp1 hn + rw[← and_not_self_iff (⌊X * (1 - c₁ * ε)⌋₊ + 2 ≤ ⌈X * (1 - c₁ * ε)⌉₊), not_le] + apply And.intro + exact this + rw[temp2, ← Nat.succ_eq_add_one, Nat.lt_succ_iff] + exact Nat.ceil_le_floor_add_one (X * (1 - c₁ * ε)) + exact (Nat.le_floor_iff' n_zero).mp (this hn) + + rw [this, sub_eq_add_neg, add_assoc, add_assoc] + nth_rewrite 3 [add_comm] + nth_rewrite 2 [← add_assoc] + rw [← add_assoc, ← add_assoc, ← sub_eq_add_neg] + clear this + + have : + ∑ n ∈ Finset.range n₀, Λ n + (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X)) - + (∑ x ∈ Finset.range n₀, Λ x + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀)) + = + (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X)) - + (∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀)) := by + ring + rw [this] + clear this + + have : + ‖∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X) - ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀) + Λ n₁ * F (↑n₁ / X)‖ + ≤ + (∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖) + + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + + ‖Λ n₁‖ * ‖F (↑n₁ / X)‖:= by + apply norm_add_le_of_le + apply norm_sub_le_of_le + apply norm_sum_le_of_le + intro b hb + exact norm_mul_le_of_le (by rfl) (by rfl) + apply norm_sum_le_of_le + intro b hb + rfl + exact_mod_cast norm_mul_le_of_le (by rfl) (by rfl) + + refine this.trans ?_ + + clear this + + have vonBnd1 : + ∀ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ ≤ Real.log (X * (1 + c₂ * ε)) := by + intro n hn + have n_add_n0_le_n1: (n : ℝ) + n₀ ≤ n₁ := by + apply le_of_lt + rw[Finset.mem_range] at hn + rw[← add_lt_add_iff_right (-↑n₀), add_neg_cancel_right, add_comm, ← sub_eq_neg_add] + exact_mod_cast hn + have inter1: ‖ Λ (n + n₀)‖ ≤ Real.log (↑n + ↑n₀) := by + rw[Real.norm_of_nonneg, ← Nat.cast_add] + apply ArithmeticFunction.vonMangoldt_le_log + apply ArithmeticFunction.vonMangoldt_nonneg + have inter2: Real.log (↑n + ↑n₀) ≤ Real.log (↑n₁) := by exact_mod_cast Real.log_le_log (by positivity) n_add_n0_le_n1 + have inter3: Real.log (↑n₁) ≤ Real.log (X * (1 + c₂ * ε)) := by exact Real.log_le_log (by bound) (by linarith) + exact inter1.trans (inter2.trans inter3) + + have bnd1 : + ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ≤ (n₁ - n₀) * Real.log (X * (1 + c₂ * ε)) := by + have : (n₁ - n₀) * Real.log (X * (1 + c₂ * ε)) = (∑ n ∈ Finset.range (n₁ - n₀), Real.log (X * (1 + c₂ * ε))) := by + rw[← Nat.cast_sub] + nth_rewrite 1 [← Finset.card_range (n₁ - n₀)] + rw[Finset.cast_card, Finset.sum_const, smul_one_mul] + exact Eq.symm (Finset.sum_const (Real.log (X * (1 + c₂ * ε)))) + exact n₁_ge_n₀ + rw [this] + apply Finset.sum_le_sum + intro n hn + rw [← mul_one (Real.log (X * (1 + c₂ * ε)))] + apply mul_le_mul (vonBnd1 _ hn) _ (norm_nonneg _) (log_nonneg (by bound)) + rw[Real.norm_of_nonneg, ← Nat.cast_add] + dsimp only [F] + apply smooth1BddAbove + bound + rw[← Nat.cast_add] + dsimp only [F] + apply smooth1BddBelow + bound + + have bnd2 : + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ ≤ (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) := by + have : (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) = (∑ n ∈ Finset.range (⌊X + 1⌋₊ - n₀), Real.log (X + 1)) := by + rw[← Nat.cast_sub] + nth_rewrite 1 [← Finset.card_range (⌊X + 1⌋₊ - n₀)] + rw[Finset.cast_card, Finset.sum_const, smul_one_mul] + exact Eq.symm (Finset.sum_const (Real.log (X + 1))) + simp only [Nat.ceil_le, n₀] + exact Preorder.le_trans (X * (1 - c₁ * ε)) X (↑⌊X + 1⌋₊) n₀_inside_le_X X_le_floor_add_one + rw[this] + apply Finset.sum_le_sum + intro n hn + have n_add_n0_le_X_add_one: (n : ℝ) + n₀ ≤ X + 1 := by + rw[Finset.mem_range] at hn + rw[← add_le_add_iff_right (-↑n₀), add_assoc, ← sub_eq_add_neg, sub_self, add_zero, ← sub_eq_add_neg] + have temp: (n : ℝ) < ⌊X + 1⌋₊ - n₀ := by + rw[← Nat.cast_sub, Nat.cast_lt] + exact hn + simp only [Nat.ceil_le, n₀] + exact le_trans n₀_inside_le_X X_le_floor_add_one + have : ↑⌊X + 1⌋₊ - ↑n₀ ≤ X + 1 - ↑n₀ := by + apply sub_le_sub_right floor_X_add_one_le_self + exact le_of_lt (lt_of_le_of_lt' this temp) + have inter1: ‖ Λ (n + n₀)‖ ≤ Real.log (↑n + ↑n₀) := by + rw[Real.norm_of_nonneg, ← Nat.cast_add] + apply ArithmeticFunction.vonMangoldt_le_log + apply ArithmeticFunction.vonMangoldt_nonneg + apply le_trans inter1 + exact_mod_cast Real.log_le_log (by positivity) (n_add_n0_le_X_add_one) + + have largeSumBound := add_le_add bnd1 bnd2 + + clear vonBnd1 bnd1 bnd2 + + have inter1 : Real.log (X * (1 + c₂ * ε)) ≤ Real.log (3 * X) := by + apply Real.log_le_log (by positivity) + have const_le_2: 1 + c₂ * ε ≤ 3 := by + have : (3 : ℝ) = 1 + 2 := by ring + rw[this] + apply add_le_add_right + rw[← mul_one 2] + exact mul_le_mul (by linarith) (by linarith) (by positivity) (by positivity) + rw[mul_comm] + exact mul_le_mul const_le_2 (by rfl) (by positivity) (by positivity) + + have inter2 : (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) ≤ (X * ε * (c₂ + c₁)) * (Real.log (X) + Real.log (3)) := by + apply mul_le_mul n₁_sub_n₀ _ (log_nonneg (by linarith)) (by positivity) + rw[← Real.log_mul (by positivity) (by positivity)] + nth_rewrite 3 [mul_comm] + exact inter1 + + have inter3 : (X * ε * (c₂ + c₁)) * (Real.log (X) + Real.log (3)) ≤ 2 * (X * ε * (c₂ + c₁)) * (Real.log (X)) := by + nth_rewrite 3 [mul_assoc] + rw[two_mul, mul_add] + apply add_le_add_right + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact Real.log_le_log (by positivity) (by linarith) + + have inter4 : (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) ≤ 2 * (X * ε * (c₁ + c₂)) * (Real.log (X)) := by + nth_rewrite 2 [add_comm] + exact le_trans inter2 inter3 + + clear inter2 inter3 + + have inter6 : (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) ≤ 2 * (X * ε * c₁) * (Real.log (X) + Real.log (3)) := by + apply mul_le_mul _ _ (log_nonneg (by linarith)) (by positivity) + have : 2 * (X * ε * c₁) = (X * (1 + ε * c₁)) - (X * (1 - ε * c₁)) := by ring + rw[this] + apply sub_le_sub + have : X + 1 ≤ X * (1 + ε * c₁) := by + ring_nf + rw[add_comm, add_le_add_iff_left] + exact X_bound_1 + exact le_trans floor_X_add_one_le_self this + nth_rewrite 2 [mul_comm] + exact n₀_gt + rw[← Real.log_mul (by positivity) (by norm_num), mul_comm] + exact Real.log_le_log (by positivity) (by linarith) + + have inter7: 2 * (X * ε * c₁) * (Real.log (X) + Real.log (3)) ≤ 4 * (X * ε * c₁) * Real.log (X) := by + have : (4 : ℝ) = 2 + 2 := by ring + rw[this, mul_add] + nth_rewrite 5 [mul_assoc] + rw[add_mul] + apply add_le_add + nth_rewrite 1 [mul_assoc] + rfl + nth_rewrite 1 [mul_assoc] + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply mul_le_mul_of_nonneg_left <| Real.log_le_log (by positivity) (by linarith) + positivity + + have inter9: (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) + (↑⌊X + 1⌋₊ - ↑n₀) * Real.log (X + 1) ≤ + 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X := by + have : 2 * (X * ε * (3 * c₁ + c₂)) = 2 * (X * ε * (c₁ + c₂)) + 4 * (X * ε * c₁) := by ring + rw[this, add_mul] + exact add_le_add inter4 <| le_trans inter6 inter7 + + have largeSumBound2 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ ≤ + 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X := by + exact le_trans largeSumBound inter9 + + clear largeSumBound inter4 inter9 + + have inter2 : ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ Real.log (X * (1 + c₂ * ε)) := by + rw[← mul_one (Real.log (X * (1 + c₂ * ε)))] + apply mul_le_mul _ _ (norm_nonneg _) (log_nonneg (by bound)) + rw[Real.norm_of_nonneg ArithmeticFunction.vonMangoldt_nonneg] + exact le_trans ArithmeticFunction.vonMangoldt_le_log <| Real.log_le_log (mod_cast n₁_pos) n₁_le + rw[Real.norm_of_nonneg] + apply smooth1BddAbove _ n₁_pos + apply smooth1BddBelow _ n₁_pos + + have largeSumBound3 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + + ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X + Real.log (3 * X) := by exact add_le_add largeSumBound2 (le_trans inter2 inter1) + clear inter1 inter2 largeSumBound2 + + have largeSumBound4 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + + ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ 2 * (X * ε * (3 * c₁ + c₂)) * (2 * Real.log X + Real.log (3)) := by + nth_rewrite 2 [two_mul, add_assoc] + rw [← Real.log_mul (by positivity) (by positivity), mul_comm X 3] + apply le_trans largeSumBound3 + nth_rewrite 2 [mul_add] + apply add_le_add_right + nth_rewrite 1 [← one_mul (Real.log (3 * X))] + apply mul_le_mul_of_nonneg_right _ (log_nonneg (by linarith)) + linarith + + clear largeSumBound3 + + have largeSumBoundFinal : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + + ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ (6 * (X * ε * (3 * c₁ + c₂))) * Real.log (X) := by + apply le_trans largeSumBound4 + rw[mul_add] + have : (6 : ℝ) = 4 + 2 := by ring + rw[this, add_mul, add_mul] + apply add_le_add + ring_nf + rfl + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact Real.log_le_log (by positivity) (by linarith) + + clear largeSumBound4 + + rw[C_eq] + linear_combination largeSumBoundFinal + +theorem SmoothedChebyshevClose {SmoothingF : ℝ → ℝ} + (diffSmoothingF : ContDiff ℝ 1 SmoothingF) + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) + (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : + ∃ C > 0, ∀ (X : ℝ) (_ : 3 < X) (ε : ℝ) (_ : 0 < ε) (_ : ε < 1) (_ : 2 < X * ε), + ‖SmoothedChebyshev SmoothingF ε X - ChebyshevPsi X‖ ≤ C * ε * X * Real.log X := by + have vonManBnd (n : ℕ) : ArithmeticFunction.vonMangoldt n ≤ Real.log n := + ArithmeticFunction.vonMangoldt_le_log + + obtain ⟨c₁, c₁_pos, c₁_eq, hc₁⟩ := Smooth1Properties_below suppSmoothingF mass_one + + obtain ⟨c₂, c₂_pos, c₂_eq, hc₂⟩ := Smooth1Properties_above suppSmoothingF + + have c₁_lt : c₁ < 1 := by + rw[c₁_eq] + exact lt_trans (Real.log_two_lt_d9) (by norm_num) + + have c₂_lt : c₂ < 2 := by + rw[c₂_eq] + nth_rewrite 3 [← mul_one 2] + apply mul_lt_mul' + rfl + exact lt_trans (Real.log_two_lt_d9) (by norm_num) + exact Real.log_nonneg (by norm_num) + positivity + + let C : ℝ := 6 * (3 * c₁ + c₂) + have C_eq : C = 6 * (3 * c₁ + c₂) := rfl + + clear_value C + + have Cpos : 0 < C := by + rw [C_eq] + positivity + + refine ⟨C, Cpos, fun X X_ge_C ε εpos ε_lt_one ↦ ?_⟩ + unfold ChebyshevPsi + + have X_gt_zero : (0 : ℝ) < X := by linarith + + have X_ne_zero : X ≠ 0 := by linarith + + have n_on_X_pos {n : ℕ} (npos : 0 < n) : + 0 < n / X := by + have : (0 : ℝ) < n := by exact_mod_cast npos + positivity + + have smooth1BddAbove (n : ℕ) (npos : 0 < n) : + Smooth1 SmoothingF ε (n / X) ≤ 1 := + Smooth1LeOne SmoothingFnonneg mass_one εpos (n_on_X_pos npos) + + have smooth1BddBelow (n : ℕ) (npos : 0 < n) : + Smooth1 SmoothingF ε (n / X) ≥ 0 := + Smooth1Nonneg SmoothingFnonneg (n_on_X_pos npos) εpos + + have smoothIs1 (n : ℕ) (npos : 0 < n) (n_le : n ≤ X * (1 - c₁ * ε)) : + Smooth1 SmoothingF ε (↑n / X) = 1 := by + apply hc₁ (ε := ε) (n / X) εpos (n_on_X_pos npos) + exact (div_le_iff₀' X_gt_zero).mpr n_le + + have smoothIs0 (n : ℕ) (n_le : (1 + c₂ * ε) ≤ n / X) := + hc₂ (ε := ε) (n / X) ⟨εpos, ε_lt_one⟩ n_le + + have ε_pos: ε > 0 := by linarith + have X_pos: X > 0 := by linarith + have X_gt_three : 3 < X := by linarith + + intro X_bound + + have X_bound_1 : 1 ≤ X * ε * c₁ := by + rw[c₁_eq, ← div_le_iff₀] + have : 1 / Real.log 2 < 2 := by + nth_rewrite 2 [← one_div_one_div 2] + rw[one_div_lt_one_div] + exact lt_of_le_of_lt (by norm_num) (Real.log_two_gt_d9) + exact Real.log_pos (by norm_num) + norm_num + apply le_of_lt + exact gt_trans X_bound this + exact Real.log_pos (by norm_num) + + have X_bound_2 : 1 ≤ X * ε * c₂ := by + rw[c₂_eq, ← div_le_iff₀] + have : 1 / (2 * Real.log 2) < 2 := by + nth_rewrite 3 [← one_div_one_div 2] + rw[one_div_lt_one_div, ← one_mul (1 / 2)] + apply mul_lt_mul + norm_num + apply le_of_lt + exact lt_trans (by norm_num) (Real.log_two_gt_d9) + all_goals norm_num + exact Real.log_pos (by norm_num) + + apply le_of_lt + exact gt_trans X_bound this + norm_num + exact Real.log_pos (by norm_num) + + rw [SmoothedChebyshevDirichlet diffSmoothingF SmoothingFnonneg suppSmoothingF + mass_one (by linarith) εpos ε_lt_one] + + convert SmoothedChebyshevClose_aux SmoothingF c₁ c₁_pos c₁_lt c₂ c₂_pos c₂_lt hc₂ C C_eq ε ε_pos ε_lt_one + X X_pos X_gt_three X_bound_1 X_bound_2 smooth1BddAbove smooth1BddBelow smoothIs1 smoothIs0 + +@[inline] noncomputable def sigma1Of (A T : ℝ) : ℝ := 1 - A / Real.log T + +noncomputable def I₁ (SmoothingF : ℝ → ℝ) (ε X T : ℝ) : ℂ := + (1 / (2 * π * I)) * (I * (∫ t : ℝ in Iic (-T), + SmoothedChebyshevIntegrand SmoothingF ε X ((1 + (Real.log X)⁻¹) + t * I))) + +noncomputable def I₂ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := + (1 / (2 * π * I)) * ((∫ σ in σ₁..(1 + (Real.log X)⁻¹), + SmoothedChebyshevIntegrand SmoothingF ε X (σ - T * I))) + +noncomputable def I₃₇ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := + (1 / (2 * π * I)) * (I * (∫ t in (-T)..T, + SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) + +noncomputable def I₈ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := + (1 / (2 * π * I)) * ((∫ σ in σ₁..(1 + (Real.log X)⁻¹), + SmoothedChebyshevIntegrand SmoothingF ε X (σ + T * I))) + +noncomputable def I₉ (SmoothingF : ℝ → ℝ) (ε X T : ℝ) : ℂ := + (1 / (2 * π * I)) * (I * (∫ t : ℝ in Ici T, + SmoothedChebyshevIntegrand SmoothingF ε X ((1 + (Real.log X)⁻¹) + t * I))) + +noncomputable def I₃ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := + (1 / (2 * π * I)) * (I * (∫ t in (-T)..(-3), + SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) + +noncomputable def I₇ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := + (1 / (2 * π * I)) * (I * (∫ t in (3 : ℝ)..T, + SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) + +noncomputable def I₄ (SmoothingF : ℝ → ℝ) (ε X σ₁ σ₂ : ℝ) : ℂ := + (1 / (2 * π * I)) * ((∫ σ in σ₂..σ₁, + SmoothedChebyshevIntegrand SmoothingF ε X (σ - 3 * I))) + +noncomputable def I₆ (SmoothingF : ℝ → ℝ) (ε X σ₁ σ₂ : ℝ) : ℂ := + (1 / (2 * π * I)) * ((∫ σ in σ₂..σ₁, + SmoothedChebyshevIntegrand SmoothingF ε X (σ + 3 * I))) + +noncomputable def I₅ (SmoothingF : ℝ → ℝ) (ε X σ₂ : ℝ) : ℂ := + (1 / (2 * π * I)) * (I * (∫ t in (-3)..3, + SmoothedChebyshevIntegrand SmoothingF ε X (σ₂ + t * I))) + +theorem realDiff_of_complexDiff {f : ℂ → ℂ} (s : ℂ) (hf : DifferentiableAt ℂ f s) : + ContinuousAt (fun (x : ℝ) ↦ f (s.re + x * I)) s.im := by + apply ContinuousAt.comp _ (by fun_prop) + convert hf.continuousAt + simp + +theorem riemannZeta_bdd_on_vertical_lines {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) (t : ℝ) : + ∃ c > 0, ‖ζ (σ₀ + t * I)‖ ≤ c := + by + let s := σ₀ + t * I + let s_re : ℂ := σ₀ + + have H : s.re = σ₀ := by + rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] + simp + + have non_neg : σ₀ ≠ 0 := by + by_contra h + rw [h] at σ₀_gt + norm_cast at σ₀_gt + + have pos : s.re > 1 := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm H)) + have pos_triv : s_re.re > 1 := by exact σ₀_gt + + have series := LSeries_one_eq_riemannZeta pos + rw [← series] + + have identity : ∀(n : ℕ), ‖LSeries.term 1 s n‖ = 1 / n^σ₀ := by + unfold LSeries.term + intro n + by_cases h0 : n = 0 + · simp [*] + · simp [*] + push Not at h0 + have C : n > 0 := by exact Nat.zero_lt_of_ne_zero h0 + have T := Complex.norm_natCast_cpow_of_pos C s + rw [H] at T + exact T + + have summable : Summable (fun (n : ℕ) ↦ ‖LSeries.term 1 s n‖) := by + simp [identity] + exact σ₀_gt + + have B := calc + ‖∑' (n : ℕ), LSeries.term 1 s n‖ ≤ ∑' (n : ℕ), ‖LSeries.term 1 s n‖ := norm_tsum_le_tsum_norm summable + _ ≤ ∑' (n : ℕ), (1 / ↑n^σ₀) := by simp [← identity] + _ ≤ norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) := by exact le_norm_self (∑' (n : ℕ), 1 / ↑n ^ σ₀) + _ ≤ 1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) := by linarith + + let c : ℝ := 1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) + + have c_is_pos : c > 0 := by positivity + use (1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ )) + exact ⟨c_is_pos, B⟩ + +theorem summable_real_iff_summable_coe_complex (f : ℕ → ℝ) : + Summable f ↔ Summable (fun n => (f n : ℂ)) := by + constructor + + · intro ⟨s, hs⟩ + use (s : ℂ) + exact hasSum_ofReal.mpr hs + + · intro ⟨s, hs⟩ + use s.re + have h_re : HasSum (fun n => ((f n : ℂ)).re) s.re := + by exact hasSum_re hs + simpa using! h_re + +theorem cast_pow_eq (n : ℕ) (σ₀ : ℝ): + (↑((↑n : ℝ) ^ σ₀) : ℂ ) = (↑n : ℂ) ^ (↑σ₀ : ℂ) := by + have U : (↑n : ℝ) ≥ 0 := by exact Nat.cast_nonneg' n + have endit := Complex.ofReal_cpow U σ₀ + exact endit + +theorem strongPnt_summable_complex_then_summable_real_part (f : ℕ → ℂ) : + Summable f → Summable (fun n ↦ (f n).re) := by + intro ⟨s, hs⟩ + use s.re + have h_re : HasSum (fun n => ((f n : ℂ)).re) s.re := + by exact hasSum_re hs + convert h_re using 1 + +theorem strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized : + ∀(σ₀ σ₁ : ℝ), ∀(t : ℝ), 1 < σ₀ → σ₀ ≤ σ₁ → + ‖(- ζ' (σ₁ + t * I) / ζ (σ₁ + t * I))‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by + intro σ₀ σ₁ t σ₀_gt_one σ₀_lt_σ₁ + + let s₁ := σ₁ + t * I + have s₁_re_eq_sigma : s₁.re = σ₁ := by + rw [Complex.add_re (σ₁) (t * I)] + rw [Complex.ofReal_re σ₁] + rw [Complex.mul_I_re] + simp [*] + + have s₀_re_eq_sigma : (↑σ₀ : ℂ).re = σ₀ := by + rw [Complex.ofReal_re σ₀] + + let s₀ := σ₀ + + have σ₁_gt_one : 1 < σ₁ := by exact lt_of_le_of_lt' σ₀_lt_σ₁ σ₀_gt_one + have s₀_gt_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt_one + + have s₁_re_geq_one : 1 < s₁.re := by exact lt_of_lt_of_eq σ₁_gt_one (id (Eq.symm s₁_re_eq_sigma)) + have s₁_re_coerce_geq_one : 1 < (↑s₁.re : ℂ).re := by exact s₁_re_geq_one + rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₁_re_geq_one)] + unfold LSeries + + have summable_von_mangoldt : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) s₁.re i) := by + exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₁_re_geq_one + + have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by + exact ArithmeticFunction.LSeriesSummable_vonMangoldt σ₀_gt_one + + have summable_re_von_mangoldt : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) s₁.re i).re) := by + exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) s₁.re) summable_von_mangoldt + + have summable_re_von_mangoldt_at_σ₀ : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i).re) := by + exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) σ₀) summable_von_mangoldt_at_σ₀ + + have positivity : ∀(n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ = (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by + intro n + calc + ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ = Λ n / ‖(↑n : ℂ)^(s₁ : ℂ)‖ := by + unfold LSeries.term + by_cases h : n = 0 + · simp [*] + · push Not at h + simp [*] + + _ = Λ n / (↑n)^s₁.re := by + by_cases h : n = 0 + · simp [*] + · rw [Complex.norm_natCast_cpow_of_pos] + push Not at h + exact Nat.zero_lt_of_ne_zero h + + _ = (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by + unfold LSeries.term + by_cases h : n = 0 + · simp [*] + · simp [*] + push Not at h + ring_nf + rw [Complex.re_ofReal_mul (Λ n)] + ring_nf + rw [Complex.inv_re] + rw [Complex.cpow_ofReal_re] + simp [*] + left + have N : (0 : ℝ) ≤ ↑n := by exact Nat.cast_nonneg' n + have T2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).re = (↑n : ℝ)^σ₁ := by exact rfl + have T1 : ((↑n : ℂ ) ^ (↑σ₁ : ℂ)).im = 0 := by + refine abs_re_eq_norm.mp ?_ + rw [T2] + simp [*] + exact Real.rpow_nonneg N σ₁ + + simp [Complex.normSq_apply] + simp [T1, T2] + + have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ i‖) := by + rw [summable_congr positivity] + exact summable_re_von_mangoldt + + have triangle_ineq : ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), ↑‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ := + norm_tsum_le_tsum_norm summable_abs_value + + have bounded_by_sum_of_re : ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n).re := + by + simp [positivity] at triangle_ineq + exact triangle_ineq + + have sum_of_re_commutes : ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n).re = (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)).re := + (Complex.re_tsum (summable_von_mangoldt)).symm + + have re_of_sum_bdd_by_norm : (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)).re ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)‖ := + Complex.re_le_norm (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)) + + have ineq_s₁_s₀ : ∀(n : ℕ), + (LSeries.term (fun n ↦ Λ n) s₁.re n).re ≤ (LSeries.term (fun n ↦ Λ n) σ₀ n).re := + by + intro n + unfold LSeries.term + by_cases h : n = 0 + · simp [*] + · push Not at h + simp [*] + have H : 0 ≤ Λ n := ArithmeticFunction.vonMangoldt_nonneg + ring_nf + rw [Complex.re_ofReal_mul (Λ n) ((↑n : ℂ) ^ (↑σ₁ : ℂ))⁻¹] + rw [Complex.re_ofReal_mul (Λ n) ((↑n : ℂ) ^ (↑σ₀ : ℂ))⁻¹] + refine mul_le_mul_of_nonneg_left ?_ H + · simp [Complex.inv_re] + have R1 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).re = (↑n : ℝ) ^ σ₀ := rfl + have R2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).re = (↑n : ℝ) ^ σ₁ := rfl + have geq : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h + have geq_zero : 0 ≤ n := Nat.zero_le n + have n_geq_one : (1 : ℝ) ≤ ↑n := by + norm_cast + have n_geq_pos : (0 : ℝ) ≤ ↑n := by + norm_cast + have n_gt_pos : (0 : ℝ) < (↑n) := by + norm_cast + + have I1 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).im = 0 := by + refine abs_re_eq_norm.mp ?_ + rw [R1] + simp [*] + exact Real.rpow_nonneg n_geq_pos σ₀ + + have I2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).im = 0 := by + refine abs_re_eq_norm.mp ?_ + rw [R2] + simp [*] + exact Real.rpow_nonneg n_geq_pos σ₁ + + simp [Complex.normSq_apply, R1, R2, I1, I2] + have P1 : 0 < (↑n : ℝ)^σ₁ := Real.rpow_pos_of_pos n_gt_pos σ₁ + have P2 : 0 < (↑n : ℝ)^σ₀ := Real.rpow_pos_of_pos n_gt_pos σ₀ + + have N : (↑n : ℝ)^σ₀ ≤ (↑n : ℝ)^σ₁ := + Real.rpow_le_rpow_of_exponent_le n_geq_one σ₀_lt_σ₁ + apply inv_anti₀ + · exact P2 + · exact N + + have Z := + by + calc + ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ + := norm_tsum_le_tsum_norm summable_abs_value + _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by simp [←positivity] + _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n).re := by + refine Summable.tsum_mono ?_ ?_ ineq_s₁_s₀ + · exact summable_re_von_mangoldt + · exact summable_re_von_mangoldt_at_σ₀ + _ = (∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n)).re := (Complex.re_tsum (summable_von_mangoldt_at_σ₀)).symm + _ ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n)‖ := re_le_norm (∑' (n : ℕ), LSeries.term (fun n ↦ ↑(Λ n)) σ₀ n) + _ = ‖- ζ' (σ₀) / ζ (σ₀)‖ := by + simp only [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₀_gt_one)] + unfold LSeries + rfl + _ = ‖ζ' σ₀ / ζ σ₀‖ := by + rw [← s₀_re_eq_sigma] + simp [*] + + exact Z + +theorem strongPnt_triv_bound_zeta : + ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ (σ₀ - 1)⁻¹ + C + := by + + let ⟨U, ⟨U_in_nhds, zeta_residue_on_U⟩⟩ := riemannZetaLogDerivResidue + + let ⟨open_in_U, ⟨open_in_U_subs_U, open_in_U_is_open, one_in_open_U⟩⟩ := mem_nhds_iff.mp U_in_nhds + + let ⟨ε₀, ⟨ε_pos, metric_ball_around_1_is_in_U'⟩⟩ := EMetric.isOpen_iff.mp open_in_U_is_open (1 : ℂ) one_in_open_U + + let ε := if ε₀ = ⊤ then ENNReal.ofReal 1 else ε₀ + have O1 : ε ≠ ⊤ := by + by_cases h : ε₀ = ⊤ + · unfold ε + simp [*] + · unfold ε + simp [*] + + have metric_ball_around_1_is_in_U : + Metric.eball (1 : ℂ) ε ⊆ U := by + by_cases h : ε₀ = ⊤ + · unfold ε + simp [*] + have T : Metric.eball (1 : ℂ) 1 ⊆ Metric.eball 1 ε₀ := by + rw [h] + exact Metric.eball_subset_eball (by simp) + exact subset_trans (subset_trans T metric_ball_around_1_is_in_U') open_in_U_subs_U + + · unfold ε + + simp [h] + exact subset_trans metric_ball_around_1_is_in_U' open_in_U_subs_U + + have O2 : ε ≠ 0 := by + by_cases h : ε₀ = ⊤ + · unfold ε + simp [*] + · unfold ε + simp [*] + exact pos_iff_ne_zero.mp ε_pos + + let metric_ball_around_1 := Metric.eball (1 : ℂ) ε + let ε_div_two := ε / 2 + let boundary := ENNReal.toReal (1 + ε_div_two) + + let ⟨bound, ⟨bound_pos, bound_prop⟩⟩ := + BddAbove.exists_ge zeta_residue_on_U 0 + + have boundary_geq_one : 1 < boundary := by + unfold boundary + have Z : (1 : ENNReal).toReal = 1 := by rfl + rw [←Z] + have U : ε_div_two ≠ ⊤ := by + refine ENNReal.div_ne_top O1 ?_ + simp + simp + simp [ENNReal.toReal_add _ U] + refine ENNReal.toReal_pos ?_ ?_ + · unfold ε_div_two + simp [*] + · exact U + + let const : ℝ := bound + let final_const : ℝ := (boundary - 1)⁻¹ + const + have boundary_inv_pos : 0 < (boundary - 1)⁻¹ := by + ring_nf + apply inv_pos_of_pos + simp [*] + + have final_const_pos : final_const ≥ 0 := by + unfold final_const + simp [*] + have Z := + by + calc + 0 ≤ (boundary - 1)⁻¹ := by simp; linarith + _ ≤ (boundary - 1)⁻¹ + const := by unfold const; simp [bound_pos] + + exact Z + + have const_le_final_const : const ≤ final_const := by + calc + const ≤ (boundary - 1)⁻¹ + const := by simp; linarith + _ = final_const := by rfl + + have const_pos : const ≥ 0 := by + linarith + + use final_const + use final_const_pos + intro σ₀ t σ₀_gt + + by_cases h : σ₀ ≤ boundary + · have σ₀_in_ball : (↑σ₀ : ℂ) ∈ metric_ball_around_1 := by + unfold metric_ball_around_1 + unfold Metric.eball + simp [*] + have Z := edist_dist (↑σ₀) (↑1 : ℂ) + rw [Z] + have U := dist_eq_norm (↑σ₀) (↑1 : ℂ) + rw [U] + norm_cast + have U : 0 ≤ σ₀ - 1 := by linarith + have U1 : ‖σ₀ - 1‖ = σ₀ - 1 := by exact norm_of_nonneg U + have U2 : ε ≠ ⊤ := by exact O1 + have U3 : 0 ≤ ε := by exact zero_le + simp [Real.norm_of_nonneg U] + simp [ENNReal.ofReal_lt_iff_lt_toReal U U2] + have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top + have Z0 : ε_div_two.toReal < ε.toReal := by + have T1 : ε ≠ ⊤ := by exact U2 + have T2 : ε ≠ 0 := by exact O2 + have T3 : ε_div_two < ε := by + refine ENNReal.half_lt_self ?_ U2 + exact T2 + + exact ENNReal.toReal_strict_mono T1 T3 + + have Z := by + calc + σ₀ - 1 ≤ boundary - 1 := by linarith + _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl + _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp + _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 + _ = ENNReal.toReal (ε_div_two) := by simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] + _ < ε.toReal := Z0 + + exact Z + + have σ₀_in_U : (↑σ₀ : ℂ) ∈ (U \ {1}) := by + refine mem_sdiff_singleton.mpr ?_ + constructor + · unfold metric_ball_around_1 at σ₀_in_ball + exact metric_ball_around_1_is_in_U σ₀_in_ball + · by_contra a + have U : σ₀ = 1 := by exact ofReal_eq_one.mp a + rw [U] at σ₀_gt + linarith + + have bdd := Set.forall_mem_image.mp bound_prop (σ₀_in_U) + simp [*] at bdd + have Z := + calc + ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by + have U := strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized σ₀ σ₀ t (σ₀_gt) (by simp) + exact U + _ = ‖- ζ' σ₀ / ζ σ₀‖ := by simp only [Complex.norm_div, norm_neg] + _ = ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) + (σ₀ - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] + _ ≤ ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹)‖ + ‖(σ₀ - 1)⁻¹‖ := by + have Z := norm_add_le (- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) ((σ₀ - 1)⁻¹) + norm_cast at Z + _ ≤ const + ‖(σ₀ - 1)⁻¹‖ := by + have U := add_le_add_left bdd ‖(σ₀ - 1)⁻¹‖ + ring_nf at U + ring_nf + norm_cast at U + norm_cast + _ ≤ const + (σ₀ - 1)⁻¹ := by + simp [norm_inv] + have pos : 0 ≤ σ₀ - 1 := by + linarith + simp [abs_of_nonneg pos] + _ = (σ₀ - 1)⁻¹ + const := by + rw [add_comm] + _ ≤ (σ₀ - 1)⁻¹ + final_const := by + simp [const_le_final_const] + + exact Z + + · push Not at h + + have boundary_geq_one : 1 < boundary := by + unfold boundary + have Z : (1 : ENNReal).toReal = 1 := by rfl + rw [←Z] + have U : ε_div_two ≠ ⊤ := by + refine ENNReal.div_ne_top O1 ?_ + simp + simp + simp [ENNReal.toReal_add _ U] + refine ENNReal.toReal_pos ?_ ?_ + · unfold ε_div_two + simp [*] + · exact U + + have boundary_in_ball : (↑boundary : ℂ) ∈ metric_ball_around_1 := by + unfold metric_ball_around_1 + unfold Metric.eball + simp [*] + have Z := edist_dist (↑boundary) (↑1 : ℂ) + rw [Z] + have U := dist_eq_norm (↑boundary) (↑1 : ℂ) + rw [U] + norm_cast + have U : 0 ≤ boundary - 1 := by linarith + have U1 : ‖boundary - 1‖ = boundary - 1 := by exact norm_of_nonneg U + have U2 : ε ≠ ⊤ := by exact O1 + have U3 : 0 ≤ ε := by exact zero_le + simp [Real.norm_of_nonneg U] + simp [ENNReal.ofReal_lt_iff_lt_toReal U U2] + have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top + have Z0 : ε_div_two.toReal < ε.toReal := by + have T1 : ε ≠ ⊤ := by exact U2 + have T2 : ε ≠ 0 := by exact O2 + have T3 : ε_div_two < ε := by + refine ENNReal.half_lt_self ?_ U2 + exact T2 + + exact ENNReal.toReal_strict_mono T1 T3 + + have Z := by + calc + boundary - 1 ≤ boundary - 1 := by linarith + _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl + _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp + _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 + _ = ENNReal.toReal (ε_div_two) := by simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] + _ < ε.toReal := Z0 + + exact Z + + have boundary_in_U : (↑boundary : ℂ) ∈ U \ {1} := by + refine mem_sdiff_singleton.mpr ?_ + constructor + · unfold metric_ball_around_1 at boundary_in_ball + exact metric_ball_around_1_is_in_U boundary_in_ball + · by_contra a + norm_cast at a + norm_cast at boundary_geq_one + simp [←a] at boundary_geq_one + + have bdd := Set.forall_mem_image.mp bound_prop (boundary_in_U) + + have Z := + calc + ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ ‖ζ' boundary / ζ boundary‖ := by + have U := strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized boundary σ₀ t (boundary_geq_one) (by linarith) + exact U + _ = ‖- ζ' boundary / ζ boundary‖ := by simp only [Complex.norm_div, norm_neg] + _ = ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) + (boundary - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] + _ ≤ ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹)‖ + ‖(boundary - 1)⁻¹‖ := by + have Z := norm_add_le (- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) ((boundary - 1)⁻¹) + norm_cast at Z + _ ≤ const + ‖(boundary - 1)⁻¹‖ := by + have U9 := add_le_add_left bdd ‖(boundary - 1)⁻¹‖ + ring_nf at U9 + ring_nf + norm_cast at U9 + norm_cast + simp [*] at U9 + simp [*] + exact U9 + + _ ≤ const + (boundary - 1)⁻¹ := by + simp [norm_inv] + have pos : 0 ≤ boundary - 1 := by + linarith + simp [abs_of_nonneg pos] + _ = (boundary - 1)⁻¹ + const := by + rw [add_comm] + _ = final_const := by rfl + _ ≤ (σ₀ - 1)⁻¹ + final_const := by + have H : 0 ≤ (σ₀ - 1)⁻¹ := by + simp + linarith + + simp [H] + + exact Z + +def LogDerivZetaHasBound (A C : ℝ) : Prop := ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) + (_ : σ ∈ Ici (1 - A / Real.log |t|)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ + C * Real.log |t| ^ 9 + +def LogDerivZetaIsHoloSmall (σ₂ : ℝ) : Prop := + HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) + (((uIcc σ₂ 2) ×ℂ (uIcc (-3) 3)) \ {1}) + +theorem dlog_riemannZeta_bdd_on_vertical_lines_explicit {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : + ∀(t : ℝ), ‖(-ζ' (σ₀ + t * I) / ζ (σ₀ + t * I))‖ ≤ ‖(ζ' σ₀ / ζ σ₀)‖ := by + + intro t + let s := σ₀ + t * I + have s_re_eq_sigma : s.re = σ₀ := by + rw [Complex.add_re (σ₀) (t * I)] + rw [Complex.ofReal_re σ₀] + rw [Complex.mul_I_re] + simp [*] + + have s₀_geq_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt + have s_re_geq_one : 1 < s.re := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm s_re_eq_sigma)) + have s_re_coerce_geq_one : 1 < (↑s.re : ℂ).re := by exact s_re_geq_one + rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s_re_geq_one)] + unfold LSeries + + have summable_von_mangoldt : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) s.re i) := by + exact ArithmeticFunction.LSeriesSummable_vonMangoldt s_re_geq_one + + have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by + exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₀_geq_one + + have summable_re_von_mangoldt : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) s.re i).re) := by + exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) s.re) summable_von_mangoldt + + have positivity : ∀(n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ = (LSeries.term (fun n ↦ Λ n) s.re n).re := by + intro n + calc + ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ = Λ n / ‖(↑n : ℂ)^(s : ℂ)‖ := by + unfold LSeries.term + by_cases h : n = 0 + · simp [*] + · push Not at h + simp [*] + + _ = Λ n / (↑n)^s.re := by + by_cases h : n = 0 + · simp [*] + · rw [Complex.norm_natCast_cpow_of_pos] + push Not at h + exact Nat.zero_lt_of_ne_zero h + + _ = (LSeries.term (fun n ↦ Λ n) s.re n).re := by + unfold LSeries.term + by_cases h : n = 0 + · simp [*] + · simp [*] + push Not at h + ring_nf + rw [Complex.re_ofReal_mul (Λ n)] + ring_nf + rw [Complex.inv_re] + rw [Complex.cpow_ofReal_re] + simp [*] + left + have N : (0 : ℝ) ≤ ↑n := by exact Nat.cast_nonneg' n + have T2 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).re = (↑n : ℝ)^σ₀ := by exact rfl + have T1 : ((↑n : ℂ ) ^ (↑σ₀ : ℂ)).im = 0 := by + refine abs_re_eq_norm.mp ?_ + rw [T2] + simp [*] + exact Real.rpow_nonneg N σ₀ + + simp [Complex.normSq_apply] + simp [T1, T2] + + have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s i‖) := by + rw [summable_congr positivity] + exact summable_re_von_mangoldt + + have triangle_ineq : ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), ↑‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ := + norm_tsum_le_tsum_norm summable_abs_value + + have bounded_by_sum_of_re : ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n).re := + by + simp [positivity] at triangle_ineq + exact triangle_ineq + + have sum_of_re_commutes : ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n).re = (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)).re := + (Complex.re_tsum (summable_von_mangoldt)).symm + + have re_of_sum_bdd_by_norm : (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)).re ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)‖ := + Complex.re_le_norm (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)) + + have Z := + by + calc + ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ + := norm_tsum_le_tsum_norm summable_abs_value + _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n).re := by simp [←positivity] + _ = (∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n)).re := (Complex.re_tsum (summable_von_mangoldt)).symm + _ ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n)‖ := re_le_norm (∑' (n : ℕ), LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n) + _ = ‖- ζ' (↑s.re) / ζ (↑s.re)‖ := by + simp only [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s_re_coerce_geq_one)] + unfold LSeries + rfl + _ = ‖ζ' σ₀ / ζ σ₀‖ := by + rw [← s_re_eq_sigma] + simp [*] + + exact Z + +theorem dlog_riemannZeta_bdd_on_vertical_lines {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : + ∃ c > 0, ∀(t : ℝ), ‖ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ c := by + + let s_re : ℂ := σ₀ + + let new_const : ℝ := 1 + (↑(Norm.norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) (↑ s_re : ℂ ) n‖)) : ℝ ) + have new_const_is_pos : new_const > 0 := by positivity + + use new_const + use new_const_is_pos + intro t + + let s := σ₀ + t * I + + have DD : (↑ s.re : ℂ) = s_re := by + refine ofReal_inj.mpr ?_ + rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] + simp + + have L : s_re = σ₀ := by rfl + + have H : s.re = σ₀ := by + rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] + simp + + have non_neg : σ₀ ≠ 0 := by + by_contra h + rw [h] at σ₀_gt + norm_cast at σ₀_gt + + have pos : s.re > 1 := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm H)) + have pos_triv : s_re.re > 1 := by exact σ₀_gt + + rw [← norm_neg, ← neg_div, ← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div pos] + + have identity0 : ∀(n : ℕ), ‖LSeries.term 1 s n‖ = 1 / n^σ₀ := by + unfold LSeries.term + intro n + by_cases h0 : n = 0 + · simp [*] + · simp [*] + push Not at h0 + have C : n > 0 := by exact Nat.zero_lt_of_ne_zero h0 + have T := Complex.norm_natCast_cpow_of_pos C s + rw [H] at T + exact T + + have O : ∀(s : ℂ), ∀(n : ℕ), s.re = σ₀ → (↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ) : ℂ) = LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n := by + intro s n cond + + by_cases h1 : (n = 0) + · simp [h1] + · push Not at h1 + unfold LSeries.term + simp [*] + have U : |Λ n| = Λ n := abs_of_nonneg (ArithmeticFunction.vonMangoldt_nonneg) + have R : n > 0 := by exact Nat.zero_lt_of_ne_zero h1 + rw [U] + have Z := Complex.norm_natCast_cpow_of_pos R s + rw [Z] + rw [← L] + + by_cases h : (Λ n = 0) + · simp [h] + · norm_cast + apply_fun (fun (w : ℂ) ↦ w * (↑ n : ℂ)^s_re / (Λ n)) + · simp [*] + ring_nf + rw [mul_comm] + nth_rewrite 1 [mul_assoc] + simp [*] + have := cast_pow_eq n σ₀ + rw [this] + simp [*] + + · have G : (↑ n : ℂ)^s_re / (Λ n) ≠ 0 := by + have T : (↑ n : ℂ)^s_re ≠ 0 := by + have T : n > 0 := by exact R + have M : ∃(m : ℕ), n = m + 1 := by exact Nat.exists_eq_succ_of_ne_zero h1 + let ⟨m, pf⟩ := M + have U := Complex.natCast_add_one_cpow_ne_zero m s_re + rw [pf] + push_cast + exact U + refine div_ne_zero T ?_ + push Not at h + norm_cast + have U := by exact mul_left_injective₀ G + have T : (fun (x : ℂ) ↦ x * (↑ n : ℂ)^s_re / (Λ n)) = (fun (x : ℂ) ↦ x * ((↑ n : ℂ)^s_re / (Λ n))) := by funext x; exact mul_div_assoc x (↑n ^ s_re) ↑(Λ n) + simp [←T] at U + exact U + + have K : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ)) = (fun (n : ℕ) ↦ (LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n )) := by + funext n + rw [O s n H] + + have K1 : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) (↑ s.re : ℂ) n‖ : ℝ)) = (fun (n : ℕ) ↦ (LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n )) := by + funext n + rw [O (↑ s.re : ℂ) n H] + simp [*] + + have D2 : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ)) = (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) (↑ s.re : ℂ) n‖ : ℝ)) := by + simp [← K] + + have S : Summable (fun n ↦ (↑(‖LSeries.term (fun x ↦ Λ x) s n‖ : ℝ) : ℝ )) := by + apply (summable_real_iff_summable_coe_complex (fun n ↦ (↑(‖LSeries.term (fun x ↦ Λ x) s n‖ : ℝ) : ℝ ))).mpr + rw [K] + have T := ArithmeticFunction.LSeriesSummable_vonMangoldt (pos_triv) + have U : s_re = s.re := by exact congrFun (congrArg Complex.mk (id (Eq.symm H))) 0 + simp [← U] + exact T + + have C := calc + ‖∑' (n : ℕ), (LSeries.term (fun x ↦ Λ x) s n)‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) s n‖ := norm_tsum_le_tsum_norm S + + _ ≤ norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) s n‖) := by exact le_norm_self (∑' (n : ℕ), ‖LSeries.term (fun x ↦ ↑(Λ x)) s n‖) + _ = norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ) n‖) := by simp [D2] + _ ≤ 1 + norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) ( ↑ s.re : ℂ) n‖ ) := by linarith + _ = new_const := by rw [DD] + + exact C + +theorem dlog_riemannZeta_bdd_on_vertical_lines' {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : + ∃ C > 0, ∀ (t : ℝ), ‖ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ C := + dlog_riemannZeta_bdd_on_vertical_lines σ₀_gt + +theorem SmoothedChebyshevPull1_aux_integrable {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 < ε) + (ε_lt_one : ε < 1) + {X : ℝ} (X_gt : 3 < X) + {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) (σ₀_le_2 : σ₀ ≤ 2) + (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) + (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) + (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + : + Integrable (fun (t : ℝ) ↦ + SmoothedChebyshevIntegrand SmoothingF ε X (σ₀ + (t : ℂ) * I)) volume := by + obtain ⟨C, C_pos, hC⟩ := dlog_riemannZeta_bdd_on_vertical_lines' σ₀_gt + let c : ℝ := C * X ^ σ₀ + have : ∀ t, ‖(fun (t : ℝ) ↦ (- deriv riemannZeta (σ₀ + (t : ℂ) * I)) / + riemannZeta (σ₀ + (t : ℂ) * I) * + (X : ℂ) ^ (σ₀ + (t : ℂ) * I)) t‖ ≤ c := by + intro t + simp only [Complex.norm_mul, c] + gcongr + · simpa only [neg_div, norm_neg] using hC t + + · rw [Complex.norm_cpow_eq_rpow_re_of_nonneg] + · simp + · linarith + · simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, + add_zero, ne_eq] + linarith + convert! (SmoothedChebyshevDirichlet_aux_integrable ContDiffSmoothingF SmoothingFnonneg + suppSmoothingF mass_one ε_pos ε_lt_one σ₀_gt σ₀_le_2).bdd_mul (c := c) ?_ (Filter.Eventually.of_forall this) using 2 + · unfold SmoothedChebyshevIntegrand + ring + · apply Continuous.aestronglyMeasurable + apply continuousOn_univ.mp + intro t _ + let s := σ₀ + (t : ℂ) * I + have s_ne_one : s ≠ 1 := by + intro h + + have : σ₀ = 1 := by + have := congr_arg Complex.re h + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero, one_re, s] at this + exact this + + linarith [σ₀_gt] + apply ContinuousAt.continuousWithinAt + apply ContinuousAt.mul + · have diffζ := differentiableAt_riemannZeta s_ne_one + apply ContinuousAt.div + · apply ContinuousAt.neg + have : DifferentiableAt ℂ (fun s ↦ deriv riemannZeta s) s := + differentiableAt_deriv_riemannZeta s_ne_one + convert realDiff_of_complexDiff (s := σ₀ + (t : ℂ) * I) this <;> simp + · convert realDiff_of_complexDiff (s := σ₀ + (t : ℂ) * I) diffζ <;> simp + · apply riemannZeta_ne_zero_of_one_lt_re + simp [σ₀_gt] + · apply ContinuousAt.comp _ (by fun_prop) + apply continuousAt_const_cpow + norm_cast + linarith + +lemma BddAboveOnRect {g : ℂ → ℂ} {z w : ℂ} (holoOn : HolomorphicOn g (z.Rectangle w)) : + BddAbove (norm ∘ g '' (z.Rectangle w)) := by + have compact_rect : IsCompact (z.Rectangle w) := by + apply IsCompact.reProdIm <;> apply isCompact_uIcc + refine IsCompact.bddAbove_image compact_rect ?_ + apply holoOn.continuousOn.norm + +theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos: 0 < ε) + (ε_lt_one : ε < 1) + (X : ℝ) (X_gt : 3 < X) + {T : ℝ} (T_pos : 0 < T) {σ₁ : ℝ} + (σ₁_pos : 0 < σ₁) (σ₁_lt_one : σ₁ < 1) + (holoOn : HolomorphicOn (ζ' / ζ) ((Icc σ₁ 2)×ℂ (Icc (-T) T) \ {1})) + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) + (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) : + SmoothedChebyshev SmoothingF ε X = + I₁ SmoothingF ε X T - + I₂ SmoothingF ε T X σ₁ + + I₃₇ SmoothingF ε T X σ₁ + + I₈ SmoothingF ε T X σ₁ + + I₉ SmoothingF ε X T + + 𝓜 ((Smooth1 SmoothingF ε) ·) 1 * X := by + unfold SmoothedChebyshev + unfold VerticalIntegral' + have X_eq_gt_one : 1 < 1 + (Real.log X)⁻¹ := by + nth_rewrite 1 [← add_zero 1] + refine add_lt_add_of_le_of_lt ?_ ?_ + rfl + rw[inv_pos, ← Real.log_one] + apply Real.log_lt_log + norm_num + linarith + have X_eq_lt_two : (1 + (Real.log X)⁻¹) < 2 := by + rw[← one_add_one_eq_two] + refine (add_lt_add_iff_left 1).mpr ?_ + refine inv_lt_one_of_one_lt₀ ?_ + refine (lt_log_iff_exp_lt ?_).mpr ?_ + positivity + have : rexp 1 < 3 := by exact lt_trans (Real.exp_one_lt_d9) (by norm_num) + linarith + have X_eq_le_two : 1 + (Real.log X)⁻¹ ≤ 2 := X_eq_lt_two.le + rw [verticalIntegral_split_three (a := -T) (b := T)] + swap + · + exact SmoothedChebyshevPull1_aux_integrable ε_pos ε_lt_one X_gt X_eq_gt_one + X_eq_le_two suppSmoothingF SmoothingFnonneg mass_one ContDiffSmoothingF + · + have temp : ↑(1 + (Real.log X)⁻¹) = (1 : ℂ) + ↑(Real.log X)⁻¹ := by push_cast; rfl + repeat rw[smul_eq_mul] + unfold I₁ + rw[temp, mul_add, mul_add, add_assoc, sub_eq_add_neg] + nth_rewrite 4 [add_assoc] + nth_rewrite 3 [add_assoc] + nth_rewrite 2 [add_assoc] + rw[add_assoc, add_left_cancel_iff, add_assoc] + nth_rewrite 7 [add_comm] + rw[← add_assoc] + unfold I₉ + rw[add_right_cancel_iff, ← add_right_inj (1 / (2 * ↑π * I) * + -VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) (1 + (Real.log X)⁻¹) (-T) T), + ← mul_add, ← sub_eq_neg_add, sub_self, mul_zero] + unfold VIntegral I₂ I₃₇ I₈ + rw[smul_eq_mul, temp, ← add_assoc, ← add_assoc] + nth_rewrite 2 [div_mul_comm] + rw[mul_one, ← neg_div, ← mul_neg] + nth_rewrite 2 [← one_div_mul_eq_div] + repeat rw[← mul_add] + let fTempRR : ℝ → ℝ → ℂ := fun x ↦ fun y ↦ + SmoothedChebyshevIntegrand SmoothingF ε X ((x : ℝ) + (y : ℝ) * I) + let fTempC : ℂ → ℂ := fun z ↦ fTempRR z.re z.im + have : ∫ (y : ℝ) in -T..T, + SmoothedChebyshevIntegrand SmoothingF ε X (1 + ↑(Real.log X)⁻¹ + ↑y * I) = + ∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y := by + unfold fTempRR + rw[temp] + rw[this] + have : ∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, + SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I) = + ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T) := by + unfold fTempRR + rw[Complex.ofReal_neg, neg_mul] + rfl + rw[this] + have : ∫ (t : ℝ) in -T..T, SmoothedChebyshevIntegrand SmoothingF ε X (↑σ₁ + ↑t * I) = + ∫ (y : ℝ) in -T..T, fTempRR σ₁ y := by rfl + rw[this] + have : ∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, + SmoothedChebyshevIntegrand SmoothingF ε X (↑σ + ↑T * I) = + ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T := by rfl + rw[this] + repeat rw[← add_assoc] + have : (((I * -∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y) + + -∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T)) + + I * ∫ (y : ℝ) in -T..T, fTempRR σ₁ y) + + ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T = + -1 * RectangleIntegral fTempC ((1 : ℝ) + (Real.log X)⁻¹ + T * I) (σ₁ - T * I) := by + unfold RectangleIntegral + rw[HIntegral_symm, VIntegral_symm] + nth_rewrite 2 [HIntegral_symm, VIntegral_symm] + unfold HIntegral VIntegral + repeat rw[smul_eq_mul] + repeat rw[add_re] + repeat rw[add_im] + repeat rw[sub_re] + repeat rw[sub_im] + repeat rw[mul_re] + repeat rw[mul_im] + repeat rw[ofReal_re] + repeat rw[ofReal_im] + rw[I_re, I_im, mul_zero, zero_mul, mul_one] + ring_nf + unfold fTempC + have : ∫ (y : ℝ) in -T..T, fTempRR (I * ↑y + ↑σ₁).re (I * ↑y + ↑σ₁).im = + ∫ (y : ℝ) in -T..T, fTempRR σ₁ y := by simp + rw[this] + have : ∫ (y : ℝ) in -T..T, + fTempRR (I * ↑y + ↑(1 + (Real.log X)⁻¹)).re (I * ↑y + ↑(1 + (Real.log X)⁻¹)).im = + ∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y := by simp + rw[this] + have : ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR (I * ↑T + ↑x).re (I * ↑T + ↑x).im = + ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T := by simp + rw[this] + have : ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR (I * ↑(-T) + ↑x).re (I * ↑(-T) + ↑x).im = + ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T) := by simp + rw[this] + ring_nf + rw[this, neg_one_mul, div_mul_comm, mul_one, + ← add_right_inj + (RectangleIntegral fTempC (1 + ↑(Real.log X)⁻¹ + ↑T * I) (↑σ₁ - ↑T * I) / (2 * ↑π * I)), + ← add_assoc] + simp only [ofReal_one, ofReal_inv, add_zero] + rw[rectangleIntegral_symm] + have : RectangleIntegral fTempC (↑σ₁ - ↑T * I) (1 + 1 / ↑(Real.log X) + ↑T * I) / (2 * ↑π * I) = + RectangleIntegral' fTempC (σ₁ - T * I) (1 + ↑(Real.log X)⁻¹ + T * I) := by + unfold RectangleIntegral' + rw [smul_eq_mul] + simp only [one_div, ofReal_inv] + ring + + simp only [one_div, ofReal_inv] at this + rw [this] + + let holoMatch : ℂ → ℂ := fun z ↦ + (fTempC z - (𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) 1 * ↑X) / (z - 1)) + have inv_log_X_pos: 0 < (Real.log X)⁻¹ := by + rw[inv_pos, ← Real.log_one] + apply Real.log_lt_log (by positivity) (by linarith) + have pInRectangleInterior : + (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) ∈ nhds 1) := by + refine rectangle_mem_nhds_iff.mpr ?_ + refine mem_reProdIm.mpr ?_ + have : re 1 = 1 := by rfl + rw[this] + have : im 1 = 0 := by rfl + rw[this] + repeat rw[sub_re] + repeat rw[sub_im] + repeat rw[add_re] + repeat rw[add_im] + rw[mul_re, mul_im, I_re, I_im] + repeat rw[ofReal_re] + repeat rw[ofReal_im] + ring_nf + have temp : 1 ∈ uIoo σ₁ (re 1 + (Real.log X)⁻¹) := by + have : re 1 = 1 := by rfl + rw[this] + unfold uIoo + have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) + rw[this] + have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by exact max_eq_right (by linarith) + rw[this] + refine mem_Ioo.mpr ?_ + exact ⟨σ₁_lt_one, (by linarith)⟩ + have : 0 ∈ uIoo (-T) (T + im 1) := by + have : im 1 = 0 := by rfl + rw[this, add_zero] + unfold uIoo + have : min (-T) T = -T := by exact min_eq_left (by linarith) + rw[this] + have : max (-T) T = T := by exact max_eq_right (by linarith) + rw[this] + refine mem_Ioo.mpr ?_ + exact ⟨(by linarith), (by linarith)⟩ + exact ⟨temp, this⟩ + + have holoMatchHoloOn : HolomorphicOn holoMatch + (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) \ {1}) := by + unfold HolomorphicOn holoMatch + refine DifferentiableOn.sub ?_ ?_ + · unfold fTempC fTempRR + have : (fun z ↦ SmoothedChebyshevIntegrand SmoothingF ε X (↑z.re + ↑z.im * I)) = + (fun z ↦ SmoothedChebyshevIntegrand SmoothingF ε X z) := by + apply funext + intro z + have : (↑z.re + ↑z.im * I) = z := by exact re_add_im z + rw[this] + rw[this] + refine DifferentiableOn.mul ?_ ?_ + · refine DifferentiableOn.mul ?_ ?_ + · have : (fun s ↦ -ζ' s / ζ s) = (fun s ↦ -(ζ' s / ζ s)) := by + refine funext ?_ + intro x + exact neg_div (ζ x) (ζ' x) + rw[this] + refine DifferentiableOn.neg ?_ + unfold DifferentiableOn + intro x x_location + unfold Rectangle at x_location + rw[Set.mem_sdiff, Complex.mem_reProdIm, sub_re, add_re, sub_im, add_im, mul_re, mul_im, + I_re, I_im, add_re, add_im] at x_location + simp only [ofReal_re, mul_zero, ofReal_im, mul_one, sub_self, sub_zero, one_re, + ofReal_inv, inv_re, normSq_ofReal, div_self_mul_self', add_zero, zero_sub, one_im, + inv_im, neg_zero, zero_div, zero_add, mem_singleton_iff] at x_location + + obtain ⟨⟨xReIn, xImIn⟩, xOut⟩ := x_location + unfold uIcc at xReIn xImIn + have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) + rw[this] at xReIn + have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by exact max_eq_right (by linarith) + rw[this] at xReIn + have : min (-T) T = (-T) := by exact min_eq_left (by linarith) + rw[this] at xImIn + have : max (-T) T = T := by exact max_eq_right (by linarith) + rw[this] at xImIn + unfold HolomorphicOn DifferentiableOn at holoOn + have temp : DifferentiableWithinAt ℂ (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) x := by + have : x ∈ Icc σ₁ 2 ×ℂ Icc (-T) T \ {1} := by + rw [Set.mem_sdiff, Complex.mem_reProdIm] + have xReTemp : x.re ∈ Icc σ₁ 2 := by + have xReLb : σ₁ ≤ x.re := by exact xReIn.1 + have xReUb : x.re ≤ 2 := by exact (lt_of_le_of_lt xReIn.2 X_eq_lt_two).le + exact ⟨xReLb, xReUb⟩ + have xImTemp : x.im ∈ Icc (-T) T := by exact ⟨xImIn.1, xImIn.2⟩ + exact ⟨⟨xReTemp, xImTemp⟩, xOut⟩ + exact holoOn x this + + have : ((↑σ₁ - ↑T * I).Rectangle (1 + ↑(Real.log X)⁻¹ + ↑T * I) \ {1}) ⊆ + (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) := by + intro a a_location + rw[Set.mem_sdiff, Complex.mem_reProdIm] + rw[Set.mem_sdiff] at a_location + obtain ⟨aIn, aOut⟩ := a_location + unfold Rectangle uIcc at aIn + rw[sub_re, add_re, add_re, sub_im, add_im, add_im, mul_re, mul_im, ofReal_re, ofReal_re, ofReal_re, ofReal_im, ofReal_im, ofReal_im, I_re, I_im] at aIn + have : re 1 = 1 := by rfl + rw[this] at aIn + have : im 1 = 0 := by rfl + rw[this] at aIn + ring_nf at aIn + have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by linarith + rw[this] at aIn + have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by linarith + rw[this] at aIn + have : min (-T) T = (-T) := by linarith + rw[this] at aIn + have : max (-T) T = T := by linarith + rw[this] at aIn + rw[Complex.mem_reProdIm] at aIn + obtain ⟨aReIn, aImIn⟩ := aIn + have aReInRedo : a.re ∈ Icc σ₁ 2 := by + have : a.re ≤ 2 := by exact (lt_of_le_of_lt aReIn.2 X_eq_lt_two).le + exact ⟨aReIn.1, this⟩ + exact ⟨⟨aReInRedo, aImIn⟩, aOut⟩ + exact DifferentiableWithinAt.mono temp this + · unfold DifferentiableOn + intro x x_location + refine DifferentiableAt.differentiableWithinAt ?_ + have hε : ε ∈ Ioo 0 1 := by exact ⟨ε_pos, ε_lt_one⟩ + have xRePos : 0 < x.re := by + unfold Rectangle at x_location + rw[Set.mem_sdiff, Complex.mem_reProdIm] at x_location + obtain ⟨⟨xReIn, _⟩, _⟩ := x_location + unfold uIcc at xReIn + rw[sub_re, add_re, add_re, mul_re, I_re, I_im] at xReIn + repeat rw[ofReal_re] at xReIn + repeat rw[ofReal_im] at xReIn + ring_nf at xReIn + have : re 1 = 1 := by rfl + rw[this] at xReIn + have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) + rw[this] at xReIn + have : σ₁ ≤ x.re := by exact xReIn.1 + linarith + exact Smooth1MellinDifferentiable ContDiffSmoothingF suppSmoothingF hε SmoothingFnonneg mass_one xRePos + · unfold DifferentiableOn + intro x x_location + apply DifferentiableAt.differentiableWithinAt + unfold HPow.hPow instHPow + simp only + apply DifferentiableAt.const_cpow + · exact differentiableAt_fun_id + · left + refine ne_zero_of_re_pos ?_ + simp only [ofReal_re] + linarith + · refine DifferentiableOn.mul ?_ ?_ + · + unfold DifferentiableOn + intro x x_location + rw[Set.mem_sdiff] at x_location + obtain ⟨xInRect, xOut⟩ := x_location + apply DifferentiableAt.differentiableWithinAt + apply differentiableAt_const + · unfold DifferentiableOn + intro x x_location + apply DifferentiableAt.differentiableWithinAt + apply DifferentiableAt.inv + · fun_prop + · intro h + rw [sub_eq_zero] at h + have := x_location.2 + simp only [mem_singleton_iff] at this + exact this h + + have holoMatchBddAbove : BddAbove + (norm ∘ holoMatch '' (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) \ {1})) := by + let U : Set ℂ := Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) + let f : ℂ → ℂ := fun z ↦ -ζ' z / ζ z + let g : ℂ → ℂ := fun z ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z + have bigO_holoMatch : holoMatch =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by + unfold holoMatch fTempC fTempRR SmoothedChebyshevIntegrand + simp only [re_add_im] + have : (fun z ↦ + (-ζ' z / ζ z * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z - + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) 1 * ↑X / (z - 1))) = + (fun z ↦ (f z * g z - 1 * g 1 / (z - 1))) := by + apply funext + intro x + simp[f, g] + rw[mul_assoc] + rw[this] + have g_holc : HolomorphicOn g U := by + unfold HolomorphicOn DifferentiableOn + intro u uInU + refine DifferentiableAt.differentiableWithinAt ?_ + simp[g] + refine DifferentiableAt.mul ?_ ?_ + have hε : ε ∈ Set.Ioo 0 1 := by exact ⟨ε_pos, ε_lt_one⟩ + have hu : 0 < u.re := by + simp[U] at uInU + unfold Rectangle uIcc at uInU + rw[Complex.mem_reProdIm] at uInU + obtain ⟨uReIn, uImIn⟩ := uInU + have : min (↑σ₁ - ↑T * I).re (1 + (↑(Real.log X))⁻¹ + ↑T * I).re = σ₁ := by + rw[sub_re, add_re, add_re, mul_re, I_re, I_im] + repeat rw[ofReal_re] + repeat rw[ofReal_im] + simp + linarith + rw[this] at uReIn + have : σ₁ ≤ u.re := by exact uReIn.1 + linarith + exact Smooth1MellinDifferentiable ContDiffSmoothingF suppSmoothingF hε SmoothingFnonneg mass_one hu + unfold HPow.hPow instHPow + simp + apply DifferentiableAt.const_cpow + exact differentiableAt_fun_id + refine Or.inl ?_ + refine ne_zero_of_re_pos ?_ + rw[ofReal_re] + positivity + have U_in_nhds : U ∈ nhds 1 := by + simp only [U] + exact pInRectangleInterior + have f_near_p : (f - fun (z : ℂ) => 1 * (z - 1)⁻¹) =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by + simp[f] + have : ((fun z ↦ -ζ' z / ζ z) - fun z ↦ (z - 1)⁻¹) = + (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) := by + apply funext + intro z + simp + rw[this] + exact riemannZetaLogDerivResidueBigO + exact ResidueMult g_holc U_in_nhds f_near_p + have : ∃ V ∈ nhds 1, BddAbove (norm ∘ holoMatch '' (V \ {1})) := by exact IsBigO_to_BddAbove bigO_holoMatch + obtain ⟨V, VInNhds_one, BddAboveV⟩ := this + have : ∃ W ⊆ V, 1 ∈ W ∧ IsOpen W ∧ BddAbove (norm ∘ holoMatch '' (W \ {1})) := by + rw[mem_nhds_iff] at VInNhds_one + obtain ⟨W, WSubset, WOpen, one_in_W⟩ := VInNhds_one + use W + have : BddAbove (Norm.norm ∘ holoMatch '' (W \ {1})) := by + have : Norm.norm ∘ holoMatch '' (W \ {1}) ⊆ + Norm.norm ∘ holoMatch '' (V \ {1}) := by + exact image_mono (by exact sdiff_subset_sdiff_left WSubset) + exact BddAbove.mono this BddAboveV + exact ⟨WSubset, ⟨one_in_W, WOpen, this⟩⟩ + obtain ⟨W, WSubset, one_in_W, OpenW, BddAboveW⟩ := this + have : (↑σ₁ - ↑T * I).Rectangle (1 + ↑(Real.log X)⁻¹ + ↑T * I) = U := by rfl + rw[this] at holoMatchHoloOn ⊢ + have one_in_U : 1 ∈ U := by + have U_in_nhds : U ∈ nhds 1 := by + simp only [U] + exact pInRectangleInterior + exact mem_of_mem_nhds U_in_nhds + have (h1 : 1 ∈ U) (h2 : 1 ∈ W) : U \ {1} = (U \ W) ∪ ((U ∩ W) \ {1}) := by + ext x + simp only [Set.mem_sdiff, Set.mem_singleton_iff, Set.mem_union, Set.mem_inter_iff] + constructor + intro ⟨hxU, hx1⟩ + by_cases hw : x ∈ W + · right + exact ⟨⟨hxU, hw⟩, hx1⟩ + · left + exact ⟨hxU, hw⟩ + · intro h + cases' h with h_left h_right + have : x ≠ 1 := by + intro x_eq_1 + rw[x_eq_1] at h_left + exact h_left.2 h2 + · exact ⟨h_left.1, this⟩ + · exact ⟨h_right.1.1, h_right.2⟩ + rw[this one_in_U one_in_W] + have : Norm.norm ∘ holoMatch '' (U \ W ∪ (U ∩ W) \ {1}) = + Norm.norm ∘ holoMatch '' (U \ W) ∪ Norm.norm ∘ holoMatch '' ((U ∩ W) \ {1}) := by + exact image_union (Norm.norm ∘ holoMatch) (U \ W) ((U ∩ W) \ {1}) + rw[this] + refine BddAbove.union ?_ ?_ + refine IsCompact.bddAbove_image ?_ ?_ + refine IsCompact.diff ?_ ?_ + unfold U Rectangle + apply IsCompact.reProdIm + unfold uIcc + exact isCompact_Icc + unfold uIcc + exact isCompact_Icc + exact OpenW + refine Continuous.comp_continuousOn ?_ ?_ + exact continuous_norm + have : HolomorphicOn holoMatch (U \ W) := by + have : U \ W ⊆ U \ {1} := by + intro x x_location + obtain ⟨xInU, xOutW⟩ := x_location + rw[Set.mem_sdiff] + apply And.intro + exact xInU + rw[Set.mem_singleton_iff] + intro x_eq_1 + rw[x_eq_1] at xOutW + exact xOutW one_in_W + exact DifferentiableOn.mono holoMatchHoloOn this + unfold HolomorphicOn at this + exact DifferentiableOn.continuousOn this + have : Norm.norm ∘ holoMatch '' ((U ∩ W) \ {1}) ⊆ + Norm.norm ∘ holoMatch '' (W \ {1}) := by + have : (U ∩ W) \ {1} ⊆ W \ {1} := by + intro x x_location + rw[Set.mem_sdiff] at x_location + obtain ⟨⟨xInU, xInW⟩, xOut⟩ := x_location + exact ⟨xInW, xOut⟩ + exact image_mono this + exact BddAbove.mono this BddAboveW + + obtain ⟨g, gHolo_Eq⟩ := existsDifferentiableOn_of_bddAbove + pInRectangleInterior holoMatchHoloOn holoMatchBddAbove + obtain ⟨gHolo, gEq⟩ := gHolo_Eq + + have zRe_le_wRe : (σ₁ - ↑T * I).re ≤ (1 + (Real.log X)⁻¹ + T * I).re := by + repeat rw[sub_re] + repeat rw[add_re] + repeat rw[mul_re] + rw[I_re, I_im] + repeat rw[ofReal_re] + repeat rw[ofReal_im] + ring_nf + have : re 1 = 1 := by rfl + rw[this] + linarith + have zIm_le_wIm : (σ₁ - ↑T * I).im ≤ (1 + (Real.log X)⁻¹ + T * I).im := by + repeat rw[sub_im] + repeat rw[add_im] + repeat rw[mul_im] + rw[I_re, I_im] + repeat rw[ofReal_re] + repeat rw[ofReal_im] + ring_nf + have : im 1 = 0 := by rfl + rw[this] + linarith + have hres := ResidueTheoremOnRectangleWithSimplePole zRe_le_wRe zIm_le_wIm + pInRectangleInterior gHolo gEq + simp only [ofReal_inv] at hres + rw [← hres] + unfold RectangleIntegral' + simp only [smul_eq_mul] + ring + +lemma interval_membership (r : ℝ)(a b: ℝ)(h1 : r ∈ Set.Icc (min a b) (max a b)) (h2 : a < b) : + a ≤ r ∧ r ≤ b := by + + have min_eq : min a b = a := min_eq_left (le_of_lt h2) + have max_eq : max a b = b := max_eq_right (le_of_lt h2) + rw [min_eq, max_eq] at h1 + rw [← @mem_Icc] + exact h1 + +lemma verticalIntegral_split_three_finite {s a b e σ : ℝ} {f : ℂ → ℂ} + (hf : IntegrableOn (fun t : ℝ ↦ f (σ + t * I)) (Icc s e)) + (hab: s < a ∧ a < b ∧ b < e): + VIntegral f σ s e = + VIntegral f σ s a + + VIntegral f σ a b + + VIntegral f σ b e := by + dsimp [VIntegral] + rw [← intervalIntegrable_iff_integrableOn_Icc_of_le (by linarith)] at hf + rw[← intervalIntegral.integral_add_adjacent_intervals (b := a), ← intervalIntegral.integral_add_adjacent_intervals (a := a) (b := b)] + · ring + all_goals apply IntervalIntegrable.mono_set hf; apply uIcc_subset_uIcc <;> apply mem_uIcc_of_le <;> linarith + +lemma verticalIntegral_split_three_finite' {s a b e σ : ℝ} {f : ℂ → ℂ} + (hf : IntegrableOn (fun t : ℝ ↦ f (σ + t * I)) (Icc s e)) + (hab: s < a ∧ a < b ∧ b < e): + (1 : ℂ) / (2 * π * I) * (VIntegral f σ s e) = + (1 : ℂ) / (2 * π * I) * (VIntegral f σ s a) + + (1 : ℂ) / (2 * π * I) * (VIntegral f σ a b) + + (1 : ℂ) / (2 * π * I) * (VIntegral f σ b e) := by + have : (1 : ℂ) / (2 * π * I) * (VIntegral f σ s a) + + (1 : ℂ) / (2 * π * I) * (VIntegral f σ a b) + + (1 : ℂ) / (2 * π * I) * (VIntegral f σ b e) = (1 : ℂ) / (2 * π * I) * ((VIntegral f σ s a) + + (VIntegral f σ a b) + + (VIntegral f σ b e)) := by ring + rw [this] + clear this + rw [← verticalIntegral_split_three_finite hf hab] + +theorem SmoothedChebyshevPull2_aux1 {T σ₁ : ℝ} (σ₁lt : σ₁ < 1) + (holoOn : HolomorphicOn (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1})) : + ContinuousOn (fun (t : ℝ) ↦ -ζ' (σ₁ + t * I) / ζ (σ₁ + t * I)) (Icc (-T) T) := by + rw [show (fun (t : ℝ) ↦ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) = -(ζ' / ζ) ∘ (fun (t : ℝ) ↦ ↑σ₁ + ↑t * I) by ext; simp; ring_nf] + apply ContinuousOn.neg + apply holoOn.continuousOn.comp (by fun_prop) + intro t ht + simp + constructor + · apply mem_reProdIm.mpr + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add, left_mem_Icc, ht, and_true] + linarith + · intro h + replace h := congr_arg re h + simp at h + linarith + +theorem SmoothedChebyshevPull2 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos: 0 < ε) (ε_lt_one : ε < 1) + (X : ℝ) (_ : 3 < X) + {T : ℝ} (T_pos : 3 < T) {σ₁ σ₂ : ℝ} + (σ₂_pos : 0 < σ₂) (σ₁_lt_one : σ₁ < 1) + (σ₂_lt_σ₁ : σ₂ < σ₁) + (holoOn : HolomorphicOn (ζ' / ζ) ((Icc σ₁ 2)×ℂ (Icc (-T) T) \ {1})) + (holoOn2 : HolomorphicOn (SmoothedChebyshevIntegrand SmoothingF ε X) + (Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1})) + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) + (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) + (diff_SmoothingF : ContDiff ℝ 1 SmoothingF) : + I₃₇ SmoothingF ε T X σ₁ = + I₃ SmoothingF ε T X σ₁ - + I₄ SmoothingF ε X σ₁ σ₂ + + I₅ SmoothingF ε X σ₂ + + I₆ SmoothingF ε X σ₁ σ₂ + + I₇ SmoothingF ε T X σ₁ := by + let z : ℂ := σ₂ - 3 * I + let w : ℂ := σ₁ + 3 * I + have σ₁_pos : 0 < σ₁ := by linarith + + have sub : z.Rectangle w ⊆ Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1} := by + + intro x hx + constructor + . + simp only [Rectangle, uIcc] at hx + rw [Complex.mem_reProdIm] at hx ⊢ + obtain ⟨hx_re, hx_im⟩ := hx + + have hzw_re : z.re < w.re := by + simp only [z, w, add_re, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] + linarith + have x_re_bounds : z.re ≤ x.re ∧ x.re ≤ w.re := by + exact interval_membership x.re z.re w.re hx_re hzw_re + have x_re_in_Icc : x.re ∈ Icc σ₂ 2 := by + have ⟨h_left, h_right⟩ := x_re_bounds + have h_left' : σ₂ ≤ x.re := by + simp only [z, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, mul_one] at h_left + linarith + have h_right' : x.re ≤ 2 := by + apply le_trans h_right + simp only [w, add_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] + linarith + exact ⟨h_left', h_right'⟩ + + have hzw_im : z.im < w.im := by + simp only [z, w, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, add_im, sub_im, mul_im, mul_one, zero_sub] + linarith + have x_im_bounds : z.im ≤ x.im ∧ x.im ≤ w.im := by + exact interval_membership x.im z.im w.im hx_im hzw_im + have x_im_in_Icc : x.im ∈ Icc (-3) 3 := by + have ⟨h_left, h_right⟩ := x_im_bounds + have h_left' : -3 ≤ x.im := by + simp only [z, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, sub_im, mul_im, mul_one, zero_sub] at h_left + linarith + have h_right' : x.im ≤ 3 := by + simp only [w, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, add_im, mul_im, mul_one] at h_right + linarith + exact ⟨h_left', h_right'⟩ + exact ⟨x_re_in_Icc, x_im_in_Icc⟩ + + . simp only [mem_singleton_iff] + + have x_re_upper: x.re ≤ σ₁ := by + simp only [Rectangle, uIcc] at hx + rw [Complex.mem_reProdIm] at hx + obtain ⟨hx_re, _⟩ := hx + + have hzw_re : z.re < w.re := by + simp only [z, w, add_re, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] + linarith + have x_re_bounds : z.re ≤ x.re ∧ x.re ≤ w.re := by + exact interval_membership x.re z.re w.re hx_re hzw_re + have x_re_upper' : x.re ≤ w.re := by exact x_re_bounds.2 + simp only [w, add_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] at x_re_upper' + linarith + + have h_x_ne_one : x ≠ 1 := by + intro h_eq + have h_re : x.re = 1 := by rw [h_eq, Complex.one_re] + have h1 : 1 ≤ σ₁ := by + rw [← h_re] + exact x_re_upper + linarith + exact h_x_ne_one + have zero_over_box := HolomorphicOn.vanishesOnRectangle holoOn2 sub + have splitting : I₃₇ SmoothingF ε T X σ₁ = + I₃ SmoothingF ε T X σ₁ + I₅ SmoothingF ε X σ₁ + I₇ SmoothingF ε T X σ₁ := by + unfold I₃₇ I₃ I₅ I₇ + apply verticalIntegral_split_three_finite' + · apply ContinuousOn.integrableOn_Icc + unfold SmoothedChebyshevIntegrand + apply ContinuousOn.mul + · apply ContinuousOn.mul + · apply SmoothedChebyshevPull2_aux1 σ₁_lt_one holoOn + · apply continuousOn_of_forall_continuousAt + intro t t_mem + have := Smooth1MellinDifferentiable diff_SmoothingF suppSmoothingF ⟨ε_pos, ε_lt_one⟩ SmoothingFnonneg mass_one (s := ↑σ₁ + ↑t * I) (by simpa) + simpa using! realDiff_of_complexDiff _ this + · apply continuousOn_of_forall_continuousAt + intro t t_mem + apply ContinuousAt.comp + · refine continuousAt_const_cpow' ?_ + intro h + have : σ₁ = 0 := by + have h_real : (↑σ₁ + ↑t * I).re = (0 : ℂ).re := by + rw [h] + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero, zero_re] at h_real + exact h_real + linarith + · + apply ContinuousAt.add + · exact continuousAt_const + · apply ContinuousAt.mul + · apply continuous_ofReal.continuousAt + · exact continuousAt_const + · refine ⟨by linarith, by linarith, by linarith⟩ + calc I₃₇ SmoothingF ε T X σ₁ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (0 : ℂ) := by simp + _ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (RectangleIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z w) := by rw [← zero_over_box] + _ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re z.im + - HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im + + VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im + - VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by simp [RectangleIntegral] + _ = I₃₇ SmoothingF ε T X σ₁ - ((1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re z.im + - (1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im + + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im + - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by ring + _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ + - (1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im + + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im + - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by + simp only [one_div, mul_inv_rev, inv_I, neg_mul, HIntegral, sub_im, ofReal_im, mul_im, + re_ofNat, I_im, mul_one, im_ofNat, I_re, mul_zero, add_zero, zero_sub, ofReal_neg, + ofReal_ofNat, sub_re, ofReal_re, mul_re, sub_self, sub_zero, add_re, add_im, zero_add, + sub_neg_eq_add, I₄, sub_right_inj, add_left_inj, neg_inj, mul_eq_mul_left_iff, mul_eq_zero, + I_ne_zero, inv_eq_zero, ofReal_eq_zero, OfNat.ofNat_ne_zero, or_false, false_or, z, w] + left + rfl + _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ + - I₆ SmoothingF ε X σ₁ σ₂ + + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im + - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by + simp only [one_div, mul_inv_rev, inv_I, neg_mul, HIntegral, add_im, ofReal_im, mul_im, + re_ofNat, I_im, mul_one, im_ofNat, I_re, mul_zero, add_zero, zero_add, ofReal_ofNat, sub_re, + ofReal_re, mul_re, sub_self, sub_zero, add_re, sub_neg_eq_add, sub_im, zero_sub, I₆, w, z] + _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ + - I₆ SmoothingF ε X σ₁ σ₂ + + I₅ SmoothingF ε X σ₁ + - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by + simp only [one_div, mul_inv_rev, inv_I, neg_mul, VIntegral, add_re, ofReal_re, mul_re, + re_ofNat, I_re, mul_zero, im_ofNat, I_im, mul_one, sub_self, add_zero, sub_im, ofReal_im, + mul_im, zero_sub, add_im, zero_add, smul_eq_mul, sub_re, sub_zero, sub_neg_eq_add, I₅, + w, z] + _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ + - I₆ SmoothingF ε X σ₁ σ₂ + + I₅ SmoothingF ε X σ₁ + - I₅ SmoothingF ε X σ₂) := by + simp only [I₅, one_div, mul_inv_rev, inv_I, neg_mul, VIntegral, sub_re, ofReal_re, mul_re, + re_ofNat, I_re, mul_zero, im_ofNat, I_im, mul_one, sub_self, sub_zero, sub_im, ofReal_im, + mul_im, add_zero, zero_sub, add_im, zero_add, smul_eq_mul, sub_neg_eq_add, z, w] + + _ = I₃ SmoothingF ε T X σ₁ + + I₅ SmoothingF ε X σ₁ + + I₇ SmoothingF ε T X σ₁ + - (I₄ SmoothingF ε X σ₁ σ₂ + - I₆ SmoothingF ε X σ₁ σ₂ + + I₅ SmoothingF ε X σ₁ + - I₅ SmoothingF ε X σ₂) := by + rw [splitting] + _ = I₃ SmoothingF ε T X σ₁ + - I₄ SmoothingF ε X σ₁ σ₂ + + I₅ SmoothingF ε X σ₂ + + I₆ SmoothingF ε X σ₁ σ₂ + + I₇ SmoothingF ε T X σ₁ := by + ring + +theorem ZetaBoxEval {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) : + ∃ C, ∀ᶠ ε in (nhdsWithin 0 (Ioi 0)), ∀ X : ℝ, 0 ≤ X → + ‖𝓜 ((Smooth1 SmoothingF ε) ·) 1 * X - X‖ ≤ C * ε * X := by + have := MellinOfSmooth1c ContDiffSmoothingF suppSmoothingF mass_one + clear suppSmoothingF mass_one ContDiffSmoothingF + rw[Asymptotics.isBigO_iff] at this + obtain ⟨C, hC⟩ := this + use C + have εpos : ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Ioi 0), ε > 0 := + eventually_mem_of_tendsto_nhdsWithin fun ⦃U⦄ hU ↦ hU + filter_upwards [hC, εpos] with ε hC εpos + rw[id_eq, norm_of_nonneg (le_of_lt εpos)] at hC + intro X Xnne + nth_rw 2 [← one_mul (X : ℂ)] + rw[← sub_mul, norm_mul, norm_real, norm_of_nonneg Xnne] + exact mul_le_mul_of_nonneg_right hC Xnne + +theorem norm_reciprocal_inequality_1 (x : ℝ) (x₁ : ℝ) (hx₁ : x₁ ≥ 1) : + ‖x^2 + x₁^2‖₊⁻¹ ≤ (‖x₁‖₊^2)⁻¹ := by + + have h1 : x₁^2 ≥ 1 := by + have h_abs : |x₁| ≥ 1 := by + rw [abs_of_pos] + linarith + positivity + simp only [ge_iff_le, one_le_sq_iff_one_le_abs, h_abs] + + have h2 : x^2 + x₁^2 ≥ x₁^2 := by + linarith [sq_nonneg x] + + have h3 : x₁^2 > 0 := by + apply sq_pos_of_ne_zero + linarith + + have h33 : 2 * x₁^2 > 0 := by + simp [*] + + have h4 : x^2 + x₁^2 > 0 := by + linarith [sq_nonneg x, h3] + + have h5 : x₁^2 ≤ x^2 + x₁^2 := h2 + + have h6 : ‖x₁^2‖₊ = ‖x₁‖₊^2 := by + rw [nnnorm_pow] + + have h7 : ‖x^2 + x₁^2‖₊ = x^2 + x₁^2 := by + rw [Real.nnnorm_of_nonneg (le_of_lt h4)] + norm_cast + + rw [← NNReal.coe_le_coe] + push_cast + simp [*] + simp_all + rw [abs_of_nonneg] + · have U := inv_le_inv₀ h4 h3 + rw [U] + simp [*] + + · positivity + +theorem norm_reciprocal_inequality (x : ℝ) (x₁ : ℝ) (hx₁ : x₁ ≤ -1) : + ‖x^2 + x₁^2‖₊⁻¹ ≤ (‖x₁‖₊^2)⁻¹ := by + + have h1 : x₁^2 ≥ 1 := by + have h_abs : |x₁| ≥ 1 := by + rw [abs_of_nonpos (le_of_lt (lt_of_le_of_lt hx₁ (by norm_num : (-1 : ℝ) < 0)))] + linarith + simp only [ge_iff_le, one_le_sq_iff_one_le_abs, h_abs] + + have h2 : x^2 + x₁^2 ≥ x₁^2 := by + linarith [sq_nonneg x] + + have h3 : x₁^2 > 0 := by + apply sq_pos_of_ne_zero + linarith + + have h33 : 2 * x₁^2 > 0 := by + simp [*] + + have h4 : x^2 + x₁^2 > 0 := by + linarith [sq_nonneg x, h3] + + have h5 : x₁^2 ≤ x^2 + x₁^2 := h2 + + have h6 : ‖x₁^2‖₊ = ‖x₁‖₊^2 := by + rw [nnnorm_pow] + + have h7 : ‖x^2 + x₁^2‖₊ = x^2 + x₁^2 := by + rw [Real.nnnorm_of_nonneg (le_of_lt h4)] + norm_cast + + rw [← NNReal.coe_le_coe] + push_cast + simp [*] + simp_all + rw [abs_of_nonneg] + · have U := inv_le_inv₀ h4 h3 + rw [U] + simp [*] + + · positivity + +theorem poisson_kernel_integrable (x : ℝ) (hx : x ≠ 0) : + MeasureTheory.Integrable (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by + + have h1 : ∀ t : ℝ, ‖x + t * I‖^2 = x^2 + t^2 := by + intro t + rw [Complex.norm_add_mul_I, Real.sq_sqrt] + positivity + + have h2 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) = (fun (t : ℝ) ↦ (x^2 + t^2)⁻¹) := by + ext t + rw [h1] + rw [h2] + + have h3 : ∀ t : ℝ, x^2 + t^2 > 0 := by + intro t + apply add_pos_of_pos_of_nonneg + · exact sq_pos_of_ne_zero hx + · exact sq_nonneg t + + have h4 : Continuous (fun t : ℝ ↦ (x^2 + t^2)⁻¹) := by + apply Continuous.inv₀ + · exact continuous_const.add (continuous_pow 2) + · intro t + exact ne_of_gt (h3 t) + + have integrable_on_bounded : ∀ R > 0, MeasureTheory.IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Icc (-R) R) := by + intro R hR + refine ContinuousOn.integrableOn_Icc ?_ + · exact Continuous.continuousOn h4 + + have decay_bound : ∀ t : ℝ, 0 < |t| → (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by + intro t hyp_t + rw [←inv_le_inv₀] + simp_all only [ne_eq, gt_iff_lt, abs_pos, inv_inv, le_add_iff_nonneg_left] + · positivity + · simp_all only [ne_eq, gt_iff_lt, abs_pos, inv_pos] + positivity + · positivity + + have decay_bound_1 : ∀ x_1 ≤ -1, ‖x ^ 2 + x_1 ^ 2‖₊⁻¹ ≤ (‖x_1‖₊ ^ 2)⁻¹ := by + exact norm_reciprocal_inequality x + + have decay_bound_2 : ∀ (x_1 : ℝ), 1 ≤ x_1 → ‖x ^ 2 + x_1 ^ 2‖₊⁻¹ ≤ (‖x_1‖₊ ^ 2)⁻¹ := by + exact norm_reciprocal_inequality_1 x + + have f_int_1 : IntegrableOn (fun (t : ℝ) ↦ (t^2)⁻¹) (Set.Iic (-1)) volume := by + have D1 : (-2) < (-1 : ℝ) := by simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, + Nat.one_lt_ofNat] + have D2 : 0 < (1 : ℝ) := by simp only [zero_lt_one] + have D := integrableOn_Ioi_rpow_of_lt D1 D2 + have D3 := MeasureTheory.IntegrableOn.comp_neg D + simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 + have D4 := + (integrableOn_Iic_iff_integrableOn_Iio' + (by + refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ + · simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, + zero_lt_one, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, + EReal.coe_ennreal_zero, EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 + simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, zero_lt_one, + rpow_neg_ofNat, Int.reduceNeg, zpow_neg] + unfold IntegrableOn at D4 + have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by + funext x + simp_all only [even_two, Even.neg_pow] + simp_all only [even_two, Even.neg_pow] + norm_cast at D4 + simp_all only [even_two, Even.neg_pow, Int.reduceNegSucc, Int.cast_neg, Int.cast_one] + exact D4 + + have f_int_2 : IntegrableOn (fun (t : ℝ) ↦ (t^2)⁻¹) (Set.Ici 1) volume := by + have D1 : (-2) < (-1 : ℝ) := by simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, + Nat.one_lt_ofNat] + have D2 : 0 < (1 : ℝ) := by simp only [zero_lt_one] + have D3 := integrableOn_Ioi_rpow_of_lt D1 D2 + simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg] at D3 + have D4 := + (integrableOn_Ici_iff_integrableOn_Ioi' + (by + refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ + · simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, + zero_lt_one, measure_singleton, EReal.coe_ennreal_zero, EReal.coe_ennreal_top, + EReal.zero_ne_top, not_false_eq_true])).mpr D3 + simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, zero_lt_one] + unfold IntegrableOn at D4 + have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by + funext x + simp_all only [even_two, Even.neg_pow] + simp_all only [even_two, Even.neg_pow] + norm_cast at D4 + + have int_neg : IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Iic (-1)) volume := by + have h_le : ∀ t ∈ Set.Iic (-1), (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by + intro t ht + simp only [Set.mem_Iic] at ht + + have t_neg : t < 0 := lt_of_le_of_lt ht (by norm_num : (-1 : ℝ) < 0) + exact decay_bound t (abs_pos.mpr (ne_of_lt t_neg)) + have h_meas : AEStronglyMeasurable (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Set.Iic (-1))) := by + exact Continuous.aestronglyMeasurable h4 + + unfold IntegrableOn + unfold Integrable + constructor + · exact h_meas + · have Z : HasFiniteIntegral (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Iic (-1))) := by + refine MeasureTheory.HasFiniteIntegral.mono'_enorm f_int_1.2 ?_ + · unfold Filter.Eventually + simp only [measurableSet_Iic, ae_restrict_eq, nnnorm_inv, nnnorm_pow, enorm_le_coe] + refine mem_inf_of_right ?_ + · refine mem_principal.mpr ?_ + · rw [Set.subset_def] + simp only [mem_Iic, mem_ofPred_eq] + exact decay_bound_1 + + exact Z + + have int_pos : IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Ici 1) volume := by + have h_le : ∀ t ∈ Set.Ici 1, (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by + intro t ht + simp only [Set.mem_Ici] at ht + + have t_pos : t > 0 := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) ht + exact decay_bound t (abs_pos.mpr (ne_of_gt t_pos)) + have h_meas : AEStronglyMeasurable (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Set.Ici 1)) := by + exact Continuous.aestronglyMeasurable h4 + + unfold IntegrableOn + unfold Integrable + constructor + · exact h_meas + · have Z : HasFiniteIntegral (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Ici (1))) := by + refine MeasureTheory.HasFiniteIntegral.mono'_enorm f_int_2.2 ?_ + · unfold Filter.Eventually + simp only [measurableSet_Ici, ae_restrict_eq, nnnorm_inv, nnnorm_pow, enorm_le_coe] + refine mem_inf_of_right ?_ + · refine mem_principal.mpr ?_ + · rw [Set.subset_def] + simp only [mem_Ici, mem_ofPred_eq] + exact decay_bound_2 + + exact Z + + have split : Set.univ = Set.Iic (-1) ∪ Set.Icc (-1) 1 ∪ Set.Ici 1 := by + ext t + simp only [Set.mem_univ, Set.mem_union, Set.mem_Iic, Set.mem_Icc, Set.mem_Ici, true_iff] + by_cases h : t ≤ -1 + · left; left; exact h + · by_cases h' : t ≥ 1 + · right; exact h' + · left; right; constructor <;> linarith + + have Z := + MeasureTheory.IntegrableOn.union + (MeasureTheory.IntegrableOn.union + (int_neg) + (integrable_on_bounded 1 zero_lt_one)) + (int_pos) + + simp_all only [ne_eq, gt_iff_lt, abs_pos, Int.reduceNeg, neg_le_self_iff, zero_le_one, Iic_union_Icc_eq_Iic, + Iic_union_Ici, integrableOn_univ] + +theorem ae_volume_of_contains_compl_singleton_zero + (s : Set ℝ) + (h : (univ : Set ℝ) \ {0} ⊆ s) : + s ∈ (MeasureTheory.ae volume) := by + + have h_zero_null : volume ({0} : Set ℝ) = 0 := by + exact volume_singleton + + have h_compl_subset : sᶜ ⊆ {0} := by + intro x hx + + by_contra h_not_zero + have : x ∈ univ \ {0} := ⟨trivial, h_not_zero⟩ + exact hx (h this) + + have h_compl_measure : volume sᶜ ≤ volume ({0} : Set ℝ) := + measure_mono h_compl_subset + + have h_compl_zero : volume sᶜ = 0 := by + rw [h_zero_null] at h_compl_measure + exact le_antisymm h_compl_measure zero_le + + rwa [mem_ae_iff] + +theorem integral_evaluation (x : ℝ) (T : ℝ) + : (3 < T) → ∫ (t : ℝ) in Iic (-T), (‖x + t * I‖ ^ 2)⁻¹ ≤ T⁻¹ := by + + intro T_large + + have T00 : ∀ (x t : ℝ), t^2 ≤ ‖x + t * I‖^2 := by + intro x t + rw [Complex.norm_add_mul_I x t] + ring_nf + rw [Real.sq_sqrt _] + simp only [le_add_iff_nonneg_right]; positivity + positivity + + have T0 : ∀ (x t : ℝ), t ≠ 0 → (‖x + t * I‖^2)⁻¹ ≤ (t^2)⁻¹ := by + intro x t hyp + have U0 : 0 < t^2 := by positivity + have U1 : 0 < ‖x + t * I‖^2 := by + rw [Complex.norm_add_mul_I x t] + rw [Real.sq_sqrt _] + positivity + positivity + rw [inv_le_inv₀ U1 U0] + exact (T00 x t) + + have T1 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) ≤ᶠ[ae (volume.restrict (Iic (-T)))] (fun (t : ℝ) ↦ (t^2)⁻¹) := by + unfold Filter.EventuallyLE + unfold Filter.Eventually + simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq] + refine mem_inf_of_left ?_ + · refine Filter.mem_sets.mp ?_ + · have U : {x_1 : ℝ | x_1 ≠ 0} ⊆ {x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} := by + rw [Set.ofPred_subset_ofPred] + intro t hyp_t + exact T0 x t hyp_t + have U1 : {x_1 : ℝ | x_1 ≠ 0} = (univ \ {0}) := by + apply Set.ext + intro x + simp_all only [ne_eq, ofPred_subset_ofPred, not_false_eq_true, implies_true, mem_ofPred_eq, Set.mem_sdiff, mem_univ, + mem_singleton_iff, true_and] + + rw [U1] at U + have Z := ae_volume_of_contains_compl_singleton_zero + ({x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} : Set ℝ) U + exact Z + + have T2 : 0 ≤ᶠ[ae (volume.restrict (Iic (-T)))] (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by + unfold Filter.EventuallyLE + unfold Filter.Eventually + simp_all only [ne_eq, Pi.zero_apply, inv_nonneg, norm_nonneg, pow_nonneg, + ofPred_true, univ_mem] + + have T4 : deriv (fun (t : ℝ) ↦ t⁻¹) = (fun t ↦ (- (t^2)⁻¹)) := by + exact deriv_inv' + + have hcont : ContinuousWithinAt (fun t ↦ t⁻¹) (Set.Iic (-T)) (-T) := by + refine ContinuousWithinAt.inv₀ ?_ ?_ + · exact ContinuousAt.continuousWithinAt fun ⦃U⦄ a ↦ a + · intro hyp + linarith + + have hderiv : ∀ x ∈ Set.Iio (-T), HasDerivAt (fun t ↦ t⁻¹) ((fun t ↦ - (t^2)⁻¹) x) x := by + + intro x hx + + have hx_ne_zero : x ≠ 0 := by + intro h + rw [h] at hx + simp [Set.Iio] at hx + linarith + + convert hasDerivAt_inv hx_ne_zero + + have f'int : IntegrableOn (fun t ↦ - (t^2)⁻¹) (Set.Iic (-T)) volume := by + have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] + have D2 : 0 < T := by positivity + have D := integrableOn_Ioi_rpow_of_lt D1 D2 + + have D3 := MeasureTheory.IntegrableOn.comp_neg D + simp [*] at D3 + have D4 := + (integrableOn_Iic_iff_integrableOn_Iio' + (by + refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ + · simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, neg_lt_neg_iff, + Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, EReal.coe_ennreal_zero, + EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 + simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, neg_lt_neg_iff, + Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg] + + unfold IntegrableOn at D4 + have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by + funext x + simp_all only [even_two, Even.neg_pow] + + simp_all only [even_two, Even.neg_pow] + have D6 := MeasureTheory.integrable_neg_iff.mpr D4 + have eq_fun : (-fun x ↦ (x^2)⁻¹) = (fun (x : ℝ) ↦ - (x^2)⁻¹) := by + funext x + simp only [Pi.neg_apply] + rw [eq_fun] at D6 + exact D6 + + have hf : Filter.Tendsto (fun (t : ℝ) ↦ t⁻¹) Filter.atBot (nhds 0) := by exact + tendsto_inv_atBot_zero + + have T5 : ∫ (t : ℝ) in Iic (-T), - (t^2)⁻¹ = (-T)⁻¹ - 0 := by + exact MeasureTheory.integral_Iic_of_hasDerivAt_of_tendsto hcont hderiv f'int hf + + have T6 : ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ = T⁻¹ := by + simp only [inv_neg, sub_zero] at T5 + have D6 : - ∫ (t : ℝ) in Iic (-T), - (t^2)⁻¹ = ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ := by + simp only [integral_neg fun a ↦ (a ^ 2)⁻¹, neg_neg] + + rw [←D6] + rw [T5] + simp only [neg_neg] + + have T3 : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Iic (-T))) := by + + have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] + have D2 : 0 < T := by positivity + have D := integrableOn_Ioi_rpow_of_lt D1 D2 + + have D3 := MeasureTheory.IntegrableOn.comp_neg D + simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 + have D4 := + (integrableOn_Iic_iff_integrableOn_Iio' + (by + refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ + · simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, inv_neg, sub_zero, + neg_lt_neg_iff, Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, EReal.coe_ennreal_zero, + EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 + simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, inv_neg, sub_zero, + neg_lt_neg_iff, Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg] + + unfold IntegrableOn at D4 + have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by + funext x + simp_all only [even_two, Even.neg_pow] + simp_all only [even_two, Even.neg_pow] + norm_cast at D4 + simp_all only [even_two, Even.neg_pow] + + have Z := + by + calc + ∫ (t : ℝ) in Iic (-T), (‖x + t * I‖ ^ 2)⁻¹ ≤ ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ := by + exact MeasureTheory.integral_mono_of_nonneg T2 T3 T1 + + _ = T⁻¹ := by exact T6 + + exact Z + +theorem integral_evaluation' (x : ℝ) (T : ℝ) + : (3 < T) → ∫ (t : ℝ) in Ici (T), (‖x + t * I‖ ^ 2)⁻¹ ≤ T⁻¹ := by + intro T_large + + have T00 : ∀ (x t : ℝ), t^2 ≤ ‖x + t * I‖^2 := by + intro x t + rw [Complex.norm_add_mul_I x t] + ring_nf + rw [Real.sq_sqrt _] + simp only [le_add_iff_nonneg_right]; positivity + positivity + + have T0 : ∀ (x t : ℝ), t ≠ 0 → (‖x + t * I‖^2)⁻¹ ≤ (t^2)⁻¹ := by + intro x t hyp + have U0 : 0 < t^2 := by positivity + have U1 : 0 < ‖x + t * I‖^2 := by + rw [Complex.norm_add_mul_I x t] + rw [Real.sq_sqrt _] + positivity + positivity + rw [inv_le_inv₀ U1 U0] + exact (T00 x t) + + have T2 : 0 ≤ᶠ[ae (volume.restrict (Ioi T))] (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by + unfold Filter.EventuallyLE + unfold Filter.Eventually + simp_all only [ne_eq, Pi.zero_apply, inv_nonneg, norm_nonneg, pow_nonneg, + ofPred_true, univ_mem] + + have T3 : Integrable (fun (t : ℝ) ↦ - (t^2)⁻¹) (volume.restrict (Ioi T)) := by + have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] + have D2 : 0 < T := by positivity + have D := integrableOn_Ioi_rpow_of_lt D1 D2 + simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg] at D + exact MeasureTheory.Integrable.fun_neg D + + have T3' : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Ioi T)) := by + have D := MeasureTheory.Integrable.fun_neg T3 + simp_all only [ne_eq, measurableSet_Ioi, ae_restrict_eq, neg_neg] + + have T1 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) ≤ᶠ[ae (volume.restrict (Ioi T))] (fun (t : ℝ) ↦ (t^2)⁻¹) := by + unfold Filter.EventuallyLE + unfold Filter.Eventually + simp_all only [ne_eq, measurableSet_Ioi, ae_restrict_eq] + refine mem_inf_of_left ?_ + · refine Filter.mem_sets.mp ?_ + · have U : {x_1 : ℝ | x_1 ≠ 0} ⊆ {x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} := by + rw [Set.ofPred_subset_ofPred] + intro t hyp_t + exact T0 x t hyp_t + have U1 : {x_1 : ℝ | x_1 ≠ 0} = (univ \ {0}) := by + apply Set.ext + intro x + simp_all only [ne_eq, ofPred_subset_ofPred, not_false_eq_true, implies_true, mem_ofPred_eq, Set.mem_sdiff, mem_univ, + mem_singleton_iff, true_and] + + rw [U1] at U + have Z := ae_volume_of_contains_compl_singleton_zero + ({x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} : Set ℝ) U + exact Z + + have hcont : ContinuousWithinAt (fun t ↦ t⁻¹) (Set.Ici T) T := by + refine ContinuousWithinAt.inv₀ ?_ ?_ + · exact ContinuousAt.continuousWithinAt fun ⦃U⦄ a ↦ a + · intro hyp + linarith + + have hderiv : ∀ x ∈ Set.Ioi T, HasDerivAt (fun t ↦ t⁻¹) ((fun t ↦ - (t^2)⁻¹) x) x := by + + intro x hx + + have hx_ne_zero : x ≠ 0 := by + intro h + rw [h] at hx + simp at hx + linarith + + convert hasDerivAt_inv hx_ne_zero + + have hf : Filter.Tendsto (fun (t : ℝ) ↦ t⁻¹) Filter.atTop (nhds 0) := by exact + tendsto_inv_atTop_zero + + have T5 : ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ = (T)⁻¹ - 0 := by + have U := MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv T3 hf + simp [*] at U + rw [MeasureTheory.integral_neg] at U + simp_all only [ne_eq, mem_Ioi, neg_inj, sub_zero] + + have T6 : ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ = T⁻¹ := by + simp only [sub_zero] at T5 + have D6 : - ∫ (t : ℝ) in Ioi T, - (t^2)⁻¹ = ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ := by + simp only [integral_neg fun a ↦ (a ^ 2)⁻¹, neg_neg] + + rw [←D6] + rw [←T5] + exact D6 + + have Z := + by + calc + ∫ (t : ℝ) in Ioi T, (‖x + t * I‖ ^ 2)⁻¹ ≤ ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ := by + exact MeasureTheory.integral_mono_of_nonneg T2 T3' T1 + + _ = T⁻¹ := by exact T6 + + rw [←MeasureTheory.integral_Ici_eq_integral_Ioi] at Z + + exact Z + +lemma IBound_aux1 (X₀ : ℝ) (X₀pos : X₀ > 0) (k : ℕ) : ∃ C ≥ 1, ∀ X ≥ X₀, Real.log X ^ k ≤ C * X := by + + have ⟨M, hM⟩ := Filter.eventually_atTop.mp (isLittleO_log_rpow_rpow_atTop k zero_lt_one).eventuallyLE + + let f := fun X ↦ Real.log X ^ k / X + let I1 := Icc X₀ M + have : 0 ∉ I1 := notMem_Icc_of_lt X₀pos + have f_cont : ContinuousOn f (Icc X₀ M) := + ((continuousOn_log.pow k).mono (subset_compl_singleton_iff.mpr this)).div + continuous_id.continuousOn (fun x hx ↦ ne_of_mem_of_not_mem hx this) + have ⟨C₁, hC₁⟩ := isCompact_Icc.exists_bound_of_continuousOn f_cont + use max C₁ 1, le_max_right C₁ 1 + intro X hX + have Xpos : X > 0 := lt_of_lt_of_le X₀pos hX + by_cases hXM : X ≤ M + · rw[← div_le_iff₀ Xpos] + calc + f X ≤ ‖f X‖ := le_norm_self _ + _ ≤ C₁ := hC₁ X ⟨hX, hXM⟩ + _ ≤ max C₁ 1 := le_max_left C₁ 1 + · calc + Real.log X ^ k ≤ ‖Real.log X ^ k‖ := le_norm_self _ + _ ≤ ‖X ^ 1‖ := by exact_mod_cast hM X (by linarith[hXM]) + _ = 1 * X := by + rw[pow_one, one_mul] + apply norm_of_nonneg + exact Xpos.le + _ ≤ max C₁ 1 * X := by + rw[mul_le_mul_iff_left₀ Xpos] + exact le_max_right C₁ 1 + +theorem I1Bound + {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) + (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : + ∃ C > 0, ∀(ε : ℝ) (_ : 0 < ε) + (_ : ε < 1) + (X : ℝ) (_ : 3 < X) + {T : ℝ} (_ : 3 < T), + ‖I₁ SmoothingF ε X T‖ ≤ C * X * Real.log X / (ε * T) := by + + obtain ⟨M, ⟨M_is_pos, M_bounds_mellin_hard⟩⟩ := + MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF + + have G0 : ∃K > 0, ∀(t σ : ℝ), 1 < σ → σ < 2 → ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ K * (σ - 1)⁻¹ := by + let ⟨K', ⟨K'_pos, K'_bounds_zeta⟩⟩ := strongPnt_triv_bound_zeta + use (2 * (K' + 1)) + use (by positivity) + intro t σ cond cond2 + + have T0 : 0 < K' + 1 := by positivity + have T1 : 1 ≤ (σ - 1)⁻¹ := by + have U : σ - 1 ≤ 1 := by linarith + have U1 := (inv_le_inv₀ (by positivity) (by exact sub_pos.mpr cond)).mpr U + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, ge_iff_le, Complex.norm_div, + norm_neg, tsub_le_iff_right, inv_one] + + have T : (K' + 1) * 1 ≤ (K' + 1) * (σ - 1)⁻¹ := + by + exact (mul_le_mul_iff_right₀ T0).mpr T1 + have T2 : (K' + 1) ≤ (K' + 1) * (σ - 1)⁻¹ := by + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, ge_iff_le, Complex.norm_div, + norm_neg, mul_one, le_mul_iff_one_le_right] + + have U := calc + ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ = ‖-ζ' (σ + t * I) / ζ (σ + t * I)‖ := by + rw [← norm_neg _, mul_comm, neg_div' _ _] + _ ≤ (σ - 1)⁻¹ + K' := K'_bounds_zeta σ t cond + _ ≤ (σ - 1)⁻¹ + (K' + 1) := by aesop + _ ≤ (K' + 1) * (σ - 1)⁻¹ + (K' + 1) := by aesop + _ ≤ (K' + 1) * (σ - 1)⁻¹ + (K' + 1) * (σ - 1)⁻¹ := by linarith + _ = 2 * (K' + 1) * (σ - 1)⁻¹ := by + ring_nf + + exact U + + obtain ⟨K, ⟨K_is_pos, K_bounds_zeta_at_any_t'⟩⟩ := G0 + + have C_final_pos : |π|⁻¹ * 2⁻¹ * (Real.exp 1 * K * M) > 0 := by + positivity + + use (|π|⁻¹ * 2⁻¹ * (Real.exp 1 * K * M)) + use C_final_pos + + intro eps eps_pos eps_less_one X X_large T T_large + + let pts_re := 1 + (Real.log X)⁻¹ + let pts := fun (t : ℝ) ↦ (pts_re + t * I) + + have pts_re_triv : ∀(t : ℝ), (pts t).re = pts_re := by + intro t + unfold pts + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, + add_zero] + + have pts_re_ge_one : 1 < pts_re := by + unfold pts_re + simp only [lt_add_iff_pos_right, inv_pos] + have U : 1 < X := by linarith + exact Real.log_pos U + + have pts_re_le_one : pts_re < 2 := by + unfold pts_re + have Z0 : 3 ∈ {x : ℝ | 1 ≤ x} := by + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, Complex.norm_div, + mem_ofPred_eq, Nat.one_le_ofNat] + have Z1 : X ∈ {x : ℝ | 1 ≤ x} := by + simp only [mem_ofPred_eq] + linarith + have Z : Real.log 3 < Real.log X := + by + refine log_lt_log ?_ X_large + simp only [Nat.ofNat_pos] + + have Z01 : 1 < Real.log 3 := + by + have Z001 : 1 = Real.log (rexp 1) := by exact Eq.symm (Real.log_exp 1) + rw [Z001] + have Z002 : (0 : ℝ) < rexp 1 := by positivity + have Z003 : (0 : ℝ) < 3 := by positivity + have Z004 : rexp 1 < 3 := by + calc + rexp 1 < (↑ 2.7182818286 : ℚ) := Real.exp_one_lt_d9 + _ < (↑ 3 : ℚ) := by linarith + + exact (Real.log_lt_log_iff Z002 Z003).mpr Z004 + + have Zpos0 : 0 < Real.log 3 := by positivity + have Zpos1 : 0 < Real.log X := by calc + 0 < Real.log 3 := Zpos0 + _ < Real.log X := Z + + have Z1 : (Real.log X)⁻¹ < (Real.log 3)⁻¹ := + by + exact (inv_lt_inv₀ Zpos1 Zpos0).mpr Z + + have Z02 : (Real.log 3)⁻¹ < 1 := by + have T01 := (inv_lt_inv₀ ?_ ?_).mpr Z01 + simp only [inv_one] at T01 + exact T01 + exact Zpos0 + simp only [zero_lt_one] + + have Z2 : 1 + (Real.log X)⁻¹ < 1 + (Real.log 3)⁻¹ := by + exact (add_lt_add_iff_left 1).mpr Z1 + + have Z3 : 1 + (Real.log 3)⁻¹ < 2 := by + calc + 1 + (Real.log 3)⁻¹ < 1 + 1 := by linarith + _ = 2 := by ring_nf + + calc + 1 + (Real.log X)⁻¹ < 1 + (Real.log 3)⁻¹ := Z2 + _ < 2 := Z3 + + have inve : (pts_re - 1)⁻¹ = Real.log X := by + unfold pts_re + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, + Complex.norm_div, add_sub_cancel_left, inv_inv] + + have K_bounds_zeta_at_any_t : ∀(t : ℝ), ‖ζ' (pts t) / ζ (pts t)‖ ≤ K * Real.log X := by + intro t + rw [←inve] + exact K_bounds_zeta_at_any_t' t pts_re pts_re_ge_one pts_re_le_one + + have pts_re_pos : pts_re > 0 := by + unfold pts_re + positivity + + have triv_pts_lo_bound : ∀(t : ℝ), pts_re ≤ (pts t).re := by + intro t + unfold pts_re + exact Eq.ge (pts_re_triv t) + + have triv_pts_up_bound : ∀(t : ℝ), (pts t).re ≤ 2 := by + intro t + unfold pts + refine EReal.coe_le_coe_iff.mp ?_ + · simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, + Complex.norm_div, le_refl, implies_true, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, + I_im, mul_one, sub_self, add_zero, EReal.coe_le_coe_iff] + exact le_of_lt pts_re_le_one + + have pts_re_ge_1 : pts_re > 1 := by + unfold pts_re + exact pts_re_ge_one + + have X_pos_triv : 0 < X := by positivity + + let f := fun (t : ℝ) ↦ SmoothedChebyshevIntegrand SmoothingF eps X (pts t) + + have G : ∀(t : ℝ), ‖f t‖ ≤ (K * M) * Real.log X * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by + + intro t + + let M_bounds_mellin_easy := fun (t : ℝ) ↦ M_bounds_mellin_hard pts_re pts_re_pos (pts t) (triv_pts_lo_bound t) (triv_pts_up_bound t) eps eps_pos eps_less_one + + let zeta_part := (fun (t : ℝ) ↦ -ζ' (pts t) / ζ (pts t)) + let mellin_part := (fun (t : ℝ) ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF eps x)) (pts t)) + let X_part := (fun (t : ℝ) ↦ (↑X : ℂ) ^ (pts t)) + + let g := fun (t : ℝ) ↦ (zeta_part t) * (mellin_part t) * (X_part t) + + have X_part_eq : ∀(t : ℝ), ‖X_part t‖ = X^pts_re := by + intro t + have U := Complex.norm_cpow_eq_rpow_re_of_pos (X_pos_triv) (pts t) + rw [pts_re_triv t] at U + exact U + + have X_part_bound : ∀(t : ℝ), ‖X_part t‖ ≤ X^pts_re := by + intro t + rw [←X_part_eq] + + have mellin_bound : ∀(t : ℝ), ‖mellin_part t‖ ≤ M * (eps * ‖pts t‖ ^ 2)⁻¹ := by + intro t + exact M_bounds_mellin_easy t + + have X_part_and_mellin_bound : ∀(t : ℝ),‖mellin_part t * X_part t‖ ≤ M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by + intro t + exact norm_mul_le_of_le (mellin_bound t) (X_part_bound t) + + have T2 : ∀(t : ℝ), ‖zeta_part t‖ = ‖ζ' (pts t) / ζ (pts t)‖ := by + intro t + unfold zeta_part + simp only [Complex.norm_div, norm_neg] + + have zeta_bound : ∀(t : ℝ), ‖zeta_part t‖ ≤ K * Real.log X := by + intro t + unfold zeta_part + rw [T2] + exact K_bounds_zeta_at_any_t t + + have g_bound : ∀(t : ℝ), ‖zeta_part t * (mellin_part t * X_part t)‖ ≤ (K * Real.log X) * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) := by + intro t + exact norm_mul_le_of_le (zeta_bound t) (X_part_and_mellin_bound t) + + have T1 : f = g := by rfl + + have final_bound_pointwise : ‖f t‖ ≤ K * Real.log X * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) := by + rw [T1] + unfold g + rw [mul_assoc] + exact g_bound t + + have trivialize : K * Real.log X * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) = (K * M) * Real.log X * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by + ring_nf + + rw [trivialize] at final_bound_pointwise + exact final_bound_pointwise + + have σ₀_gt : 1 < pts_re := by exact pts_re_ge_1 + have σ₀_le_2 : pts_re ≤ 2 := by + unfold pts_re + + exact + Preorder.le_trans (1 + (Real.log X)⁻¹) (pts (SmoothingF (SmoothingF M))).re 2 + (triv_pts_lo_bound (SmoothingF (SmoothingF M))) (triv_pts_up_bound (SmoothingF (SmoothingF M))) + + have f_integrable := SmoothedChebyshevPull1_aux_integrable eps_pos eps_less_one X_large σ₀_gt σ₀_le_2 suppSmoothingF SmoothingFnonneg mass_one ContDiffSmoothingF + + have S : X^pts_re = rexp 1 * X := by + unfold pts_re + + calc + X ^ (1 + (Real.log X)⁻¹) = X * X ^ ((Real.log X)⁻¹) := by + refine rpow_one_add' ?_ ?_ + · positivity + · exact Ne.symm (ne_of_lt pts_re_pos) + _ = X * rexp 1 := by + refine (mul_right_inj' ?_).mpr ?_ + · exact Ne.symm (ne_of_lt X_pos_triv) + · refine rpow_inv_log X_pos_triv ?_ + · by_contra h + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, + Complex.norm_div, Nat.not_ofNat_lt_one] + _ = rexp 1 * X := by ring_nf + + have pts_re_neq_zero : pts_re ≠ 0 := by + by_contra h + rw [h] at pts_re_ge_1 + simp only [gt_iff_lt] at pts_re_ge_1 + norm_cast at pts_re_ge_1 + + have Z := + by + calc + ‖∫ (t : ℝ) in Iic (-T), f t‖ ≤ ∫ (t : ℝ) in Iic (-T), ‖f t‖ := MeasureTheory.norm_integral_le_integral_norm f + _ ≤ ∫ (t : ℝ) in Iic (-T), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re := by + refine integral_mono ?_ ?_ (fun t ↦ G t) + · refine Integrable.norm ?_ + · unfold f + exact MeasureTheory.Integrable.restrict f_integrable + · have equ : ∀(t : ℝ), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re = (K * M) * Real.log X * eps⁻¹ * X ^ pts_re * (‖pts t‖^2)⁻¹ := by + intro t; ring_nf + have fun_equ : (fun (t : ℝ) ↦ ((K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re)) = (fun (t : ℝ) ↦ ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re * (‖pts t‖^2)⁻¹)) := by + funext t + exact equ t + + rw [fun_equ] + have nonzero := ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re) + have simple_int : MeasureTheory.Integrable (fun (t : ℝ) ↦ (‖pts t‖^2)⁻¹) + := by + unfold pts + exact poisson_kernel_integrable pts_re (pts_re_neq_zero) + + have U := MeasureTheory.Integrable.const_mul simple_int ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re) + refine MeasureTheory.Integrable.restrict ?_ + exact U + _ = (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * ∫ (t : ℝ) in Iic (-T), (‖pts t‖ ^ 2)⁻¹ := by + have simpli : ∀(t : ℝ), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re = (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * (‖pts t‖^2)⁻¹ := + by intro t; ring_nf + have simpli_fun : (fun (t : ℝ) ↦ (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re ) = (fun (t : ℝ) ↦ ((K * M) * Real.log X * X ^ pts_re * eps⁻¹ * (‖pts t‖^2)⁻¹)) := + by funext t; ring_nf + rw [simpli_fun] + exact MeasureTheory.integral_const_mul ((K * M) * Real.log X * X ^ pts_re * eps⁻¹) (fun (t : ℝ) ↦ (‖pts t‖^2)⁻¹) + _ ≤ (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * T⁻¹ := by + have U := integral_evaluation (pts_re) T (T_large) + unfold pts + simp only [ge_iff_le] + have U2 : 0 ≤ (K * M) * Real.log X * X ^ pts_re * eps⁻¹ := by + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, + Complex.norm_div, le_refl, implies_true, inv_pos, mul_nonneg_iff_of_pos_right] + refine Left.mul_nonneg ?_ ?_ + · refine Left.mul_nonneg ?_ ?_ + · exact Left.mul_nonneg (by positivity) (by positivity) + · refine log_nonneg ?_ + · linarith + · refine Left.mul_nonneg ?_ ?_ + · exact exp_nonneg 1 + · exact le_of_lt X_pos_triv + have U1 := mul_le_mul_of_nonneg_left U U2 + + exact U1 + _ = (Real.exp 1 * K * M) * Real.log X * X * eps⁻¹ * T⁻¹ := by + rw [S] + ring_nf + _ = (Real.exp 1 * K * M) * X * Real.log X / (eps * T) := by ring_nf + + unfold I₁ + unfold f at Z + unfold pts at Z + have Z3 : (↑pts_re : ℂ) = 1 + (Real.log X)⁻¹ := by unfold pts_re; norm_cast + rw [Z3] at Z + rw [Complex.norm_mul (1 / (2 * ↑π * I)) _] + simp only [one_div, mul_inv_rev, inv_I, neg_mul, norm_neg, Complex.norm_mul, norm_I, norm_inv, + norm_real, norm_eq_abs, Complex.norm_ofNat, one_mul, ofReal_inv, ge_iff_le] + have Z2 : 0 ≤ |π|⁻¹ * 2⁻¹ := by positivity + simp only [ofReal_inv] at Z + simp only [ge_iff_le] + have Z4 := + mul_le_mul_of_nonneg_left Z Z2 + ring_nf + ring_nf at Z4 + exact Z4 + +lemma I9I1 {SmoothingF : ℝ → ℝ} {ε X T : ℝ} (Xpos : 0 < X) : + I₉ SmoothingF ε X T = conj (I₁ SmoothingF ε X T) := by + unfold I₉ I₁ + simp only [map_mul, map_div₀, conj_I, conj_ofReal, conj_ofNat, map_one] + rw [neg_mul, mul_neg, ← neg_mul] + congr + · ring + · rw [← integral_conj, ← integral_comp_neg_Ioi, integral_Ici_eq_integral_Ioi] + apply setIntegral_congr_fun <| measurableSet_Ioi + intro t ht + simp only + rw[← smoothedChebyshevIntegrand_conj Xpos] + simp + +theorem I9Bound + {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) + (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : + ∃ C > 0, ∀{ε : ℝ} (_ : 0 < ε) + (_ : ε < 1) + (X : ℝ) (_ : 3 < X) + {T : ℝ} (_ : 3 < T), + ‖I₉ SmoothingF ε X T‖ ≤ C * X * Real.log X / (ε * T) := by + obtain ⟨C, Cpos, bound⟩ := I1Bound suppSmoothingF ContDiffSmoothingF SmoothingFnonneg mass_one + refine ⟨C, Cpos, ?_⟩ + intro ε εpos ε_lt_one X X_gt T T_gt + specialize bound ε εpos ε_lt_one X X_gt T_gt + rwa [I9I1 (by linarith), norm_conj] + +lemma one_add_inv_log {X : ℝ} (X_ge : 3 ≤ X): (1 + (Real.log X)⁻¹) < 2 := by + rw[← one_add_one_eq_two] + refine (add_lt_add_iff_left 1).mpr ?_ + refine inv_lt_one_of_one_lt₀ ?_ + refine (lt_log_iff_exp_lt ?_).mpr ?_ <;> linarith[Real.exp_one_lt_d9] + +theorem log_pos (T : ℝ) (T_gt : 3 < T) : (Real.log T > 1) := by + have elt3 : Real.exp 1 < 3 := by + linarith[Real.exp_one_lt_d9] + have logTgt1 : Real.log T > 1 := by + refine (lt_log_iff_exp_lt ?_).mpr ?_ + · linarith + · linarith + exact logTgt1 + +lemma I2Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {A C₂ : ℝ} (has_bound: LogDerivZetaHasBound A C₂) (C₂pos : 0 < C₂) (A_in : A ∈ Ioc 0 (1 / 2)) : + ∃ (C : ℝ) (_ : 0 < C), + ∀(X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) + (_ : ε < 1) {T : ℝ} (_ : 3 < T), + let σ₁ := sigma1Of A T + ‖I₂ SmoothingF ε T X σ₁‖ ≤ C * X / (ε * T) := by + have ⟨C₁, C₁pos, Mbd⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF + have := (IBound_aux1 3 (by norm_num) 9) + obtain ⟨C₃, ⟨C₃_gt, hC₃⟩⟩ := this + + let C' : ℝ := C₁ * C₂ * C₃ * rexp 1 + have : C' > 0 := by positivity + use ‖1/(2*π*I)‖ * (2 * C'), by + refine Right.mul_pos ?_ ?_ + · rw[norm_pos_iff] + simp[pi_ne_zero] + · simp[this] + intro X X_gt ε ε_pos ε_lt_one T T_gt σ₁ + + have Xpos : 0 < X := lt_trans (by simp only [Nat.ofNat_pos]) X_gt + have Tpos : 0 < T := lt_trans (by norm_num) T_gt + have log_big : 1 < Real.log T := by exact log_pos T (T_gt) + unfold I₂ + rw[norm_mul, mul_assoc (c := X), ← mul_div] + refine mul_le_mul_of_nonneg_left ?_ (norm_nonneg _) + have interval_length_nonneg : σ₁ ≤ 1 + (Real.log X)⁻¹ := by + have : σ₁ = sigma1Of A T := rfl + rw [this] + unfold sigma1Of + rw[sub_le_iff_le_add] + nth_rw 1 [← add_zero 1] + rw[add_assoc] + apply add_le_add_right + refine Left.add_nonneg ?_ ?_ + · rw[inv_nonneg, log_nonneg_iff Xpos] + exact le_trans (by norm_num) (le_of_lt X_gt) + · refine div_nonneg ?_ ?_ + exact A_in.1.le + rw[log_nonneg_iff Tpos] + exact le_trans (by norm_num) (le_of_lt T_gt) + have : σ₁ = sigma1Of A T := rfl + have σ₁pos : 0 < σ₁ := by + have : σ₁ = sigma1Of A T := rfl + rw [this] + unfold sigma1Of + rw[sub_pos] + calc + A / Real.log T ≤ 1 / 2 / Real.log T := by + refine div_le_div_of_nonneg_right (A_in.2) ?_ + apply le_of_lt + linarith + + _ ≤ 1 / 2 / 1 := by + refine div_le_div_of_nonneg_left (by norm_num) (by norm_num) ?_ + apply le_of_lt + refine (lt_log_iff_exp_lt ?_).mpr ?_ <;> linarith[Real.exp_one_lt_d9] + _ < 1 := by norm_num + suffices ∀ σ ∈ Ioc σ₁ (1 + (Real.log X)⁻¹), ‖SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ C' * X / (ε * T) by + calc + ‖∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, + SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ + C' * X / (ε * T) * |1 + (Real.log X)⁻¹ - σ₁| := by + refine intervalIntegral.norm_integral_le_of_norm_le_const ?_ + convert this using 3 + apply uIoc_of_le + exact interval_length_nonneg + _ ≤ C' * X / (ε * T) * 2 := by + apply mul_le_mul_of_nonneg_left + rw[abs_of_nonneg (sub_nonneg.mpr interval_length_nonneg)] + calc + 1 + (Real.log X)⁻¹ - σ₁ ≤ 1 + (Real.log X)⁻¹ := by linarith + _ ≤ 2 := (one_add_inv_log X_gt.le).le + positivity + _ = 2 * C' * X / (ε * T) := by ring + + intro σ hσ + unfold SmoothedChebyshevIntegrand + have log_deriv_zeta_bound : ‖ζ' (σ - T * I) / ζ (σ - T * I)‖ ≤ C₂ * (C₃ * T) := by + calc + ‖ζ' (σ - (T : ℝ) * I) / ζ (σ - (T : ℝ) * I)‖ = ‖ζ' (σ + (-T : ℝ) * I) / ζ (σ + (-T : ℝ) * I)‖ := by + have Z : σ - (T : ℝ) * I = σ + (- T : ℝ) * I := by simp; ring_nf + simp [Z] + _ ≤ C₂ * Real.log |-T| ^ 9 := has_bound σ (-T) (by simp; rw [abs_of_pos Tpos]; exact T_gt) (by rw[this] at hσ; unfold sigma1Of at hσ; simp at hσ ⊢; replace hσ := hσ.1; linarith) + _ ≤ C₂ * Real.log T ^ 9 := by simp + _ ≤ C₂ * (C₃ * T) := by gcongr; exact hC₃ T (by linarith) + + calc + ‖-ζ' (σ - T * I) / ζ (σ - T * I) * 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x)) + (σ - T * I) * X ^ (σ - T * I)‖ = + ‖-ζ' (σ - T * I) / ζ (σ - T * I)‖ * ‖𝓜 (fun x ↦ (Smooth1 SmoothingF ε x)) + (σ - T * I)‖ * ‖(X : ℂ) ^ (σ - T * I)‖ := by + repeat rw[norm_mul] + _ ≤ C₂ * (C₃ * T) * (C₁ * (ε * ‖σ - T * I‖ ^ 2)⁻¹) * (rexp 1 * X) := by + apply mul_le_mul₃ + · rw[neg_div, norm_neg] + exact log_deriv_zeta_bound + · refine Mbd σ₁ σ₁pos _ ?_ ?_ ε ε_pos ε_lt_one + · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, sub_zero] at hσ ⊢ + linarith + · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, sub_zero] at hσ ⊢ + linarith[one_add_inv_log X_gt.le] + · rw[cpow_def_of_ne_zero] + · rw[norm_exp,← ofReal_log, re_ofReal_mul] + simp only [sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, + sub_zero] + rw[← le_log_iff_exp_le, Real.log_mul (exp_ne_zero 1), Real.log_exp, ← le_div_iff₀', add_comm, add_div, div_self, one_div] + exact hσ.2 + · refine (Real.log_pos ?_).ne.symm + linarith + · apply Real.log_pos + linarith + · linarith + · positivity + · positivity + · exact_mod_cast Xpos.ne.symm + · positivity + · positivity + · positivity + _ = (C' * X * T) / (ε * ‖σ - T * I‖ ^ 2) := by ring + _ ≤ C' * X / (ε * T) := by + have : ‖σ - T * I‖ ^ 2 ≥ T ^ 2 := by + calc + ‖σ - T * I‖ ^ 2 = ‖σ + (-T : ℝ) * I‖ ^ 2 := by + congr 2 + push_cast + ring + _ = normSq (σ + (-T : ℝ) * I) := (normSq_eq_norm_sq _).symm + _ = σ^2 + (-T)^2 := by + rw[Complex.normSq_add_mul_I] + _ ≥ T^2 := by + rw[neg_sq] + exact le_add_of_nonneg_left (sq_nonneg _) + calc + C' * X * T / (ε * ‖↑σ - ↑T * I‖ ^ 2) ≤ C' * X * T / (ε * T ^ 2) := by + rw[div_le_div_iff_of_pos_left, mul_le_mul_iff_right₀] + exact this + exact ε_pos + positivity + apply mul_pos ε_pos + exact lt_of_lt_of_le (pow_pos Tpos 2) this + positivity + _ = C' * X / (ε * T) := by + field_simp + +lemma I8I2 {SmoothingF : ℝ → ℝ} + {X ε T σ₁ : ℝ} (T_gt : 3 < T) : + I₈ SmoothingF ε X T σ₁ = -conj (I₂ SmoothingF ε X T σ₁) := by + unfold I₂ I₈ + rw[map_mul, ← neg_mul] + congr + · simp[conj_ofNat] + · rw[← intervalIntegral_conj] + apply intervalIntegral.integral_congr + intro σ hσ + simp only [] + rw[← smoothedChebyshevIntegrand_conj] + simp only [map_sub, conj_ofReal, map_mul, conj_I, mul_neg, sub_neg_eq_add] + exact lt_trans (by norm_num) T_gt + +lemma I8Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {A C₂ : ℝ} (has_bound : LogDerivZetaHasBound A C₂) (C₂_pos : 0 < C₂) (A_in : A ∈ Ioc 0 (1 / 2)) : + + ∃ (C : ℝ) (_ : 0 < C), + ∀(X : ℝ) (_ : 3 < X) {ε : ℝ} (_: 0 < ε) + (_ : ε < 1) + {T : ℝ} (_ : 3 < T), + let σ₁ : ℝ := 1 - A / (Real.log T) + ‖I₈ SmoothingF ε T X σ₁‖ ≤ C * X / (ε * T) := by + + obtain ⟨C, hC, i2Bound⟩ := I2Bound suppSmoothingF ContDiffSmoothingF has_bound C₂_pos A_in + use C, hC + intro X hX ε hε0 hε1 T hT σ₁ + let i2Bound := i2Bound X hX hε0 hε1 hT + rw[I8I2 hX, norm_neg, norm_conj] + + change ‖I₂ SmoothingF ε T X (sigma1Of A T)‖ ≤ C * X / (ε * T) at i2Bound + unfold sigma1Of at i2Bound + have σ₁_eq : σ₁ = 1 - A / (Real.log T) := rfl + rw[σ₁_eq] + exact i2Bound + +lemma log_pow_over_xsq_integral_bounded : + ∀ n : ℕ, ∃ C : ℝ, 0 < C ∧ ∀ T >3, ∫ x in Ioo 3 T, (Real.log x)^n / x^2 < C := by + have elt3 : Real.exp 1 < 3 := by + linarith[Real.exp_one_lt_d9] + have log3gt1: 1 < Real.log 3 := by + apply (Real.lt_log_iff_exp_lt (by norm_num)).mpr + exact elt3 + intro n + induction n with + | zero => + use 1 + constructor + · norm_num + · intro T hT + have Tgt3 : (3 : ℝ) < T := hT + simp only [pow_zero] + have h1 :(0 ≤ (-2) ∨ (-2) ≠ (-1) ∧ 0 ∉ Set.uIcc 3 T) := by + right + constructor + · linarith + · refine notMem_uIcc_of_lt ?_ ?_ + · exact three_pos + · linarith + have integral := integral_zpow h1 + ring_nf at integral + + have swap_int_kind : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), 1 / x ^ 2 = ∫ (x : ℝ) in Ioo 3 T, 1 / x ^ 2 := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + rw [← swap_int_kind] + have change_int_power : ∫ (x : ℝ) in (3 : ℝ)..T, (1 : ℝ) / x ^ (↑ 2) + = ∫ (x : ℝ) in (3 : ℝ).. T, x ^ (-2 : ℤ) := by + apply intervalIntegral.integral_congr + intro x hx + simp + rw [change_int_power, integral] + have : T ^ (-1 : ℤ) > 0 := by + refine zpow_pos ?_ (-1) + linarith + linarith + | succ d ih => + obtain ⟨Cd, Cdpos, IH⟩ := ih + use ((Real.log 3)^(d+1) / 3) + (d+1) * Cd + constructor + · have logpowpos : (Real.log 3) ^ (d + 1) > 0 := by + refine pow_pos ?_ (d + 1) + linarith + have : 0 < (Real.log 3) ^ (d + 1) / 3 := by + exact div_pos logpowpos (by norm_num) + have dbound : d + 1 ≥ 1 := by + exact Nat.le_add_left 1 d + have : Real.log 3 ^ (d + 1) / 3 + (↑d + 1) * Cd > 0 / 3 + 0 := by + have term1_pos : 0 < Real.log 3 ^ (d + 1) / 3 := this + have term2_pos : 0 < (↑d + 1) * Cd := by + refine (mul_pos_iff_of_pos_right Cdpos).mpr ?_ + exact Nat.cast_add_one_pos d + refine add_lt_add ?_ term2_pos + refine div_lt_div₀ logpowpos ?_ ?_ ?_ + linarith + linarith + linarith + ring_nf at this + ring_nf + exact this + · intro T Tgt3 + let u := fun x : ℝ ↦ (Real.log x) ^ (d + 1) + let v := fun x : ℝ ↦ -1 / x + let u' := fun x : ℝ ↦ (d + 1 : ℝ) * (Real.log x)^d / x + let v' := fun x : ℝ ↦ 1 / x^2 + + have swap_int_type : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) / x ^ 2 + = ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ (d + 1) / x ^ 2 := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + + rw [← swap_int_type] + + have uIcc_is_Icc : Set.uIcc 3 T = Set.Icc 3 T := by + exact uIcc_of_lt Tgt3 + + have cont_u : ContinuousOn u (Set.uIcc 3 T) := by + unfold u + rw[uIcc_is_Icc] + refine ContinuousOn.pow ?_ (d + 1) + refine continuousOn_of_forall_continuousAt ?_ + intro x hx + refine continuousAt_log ?_ + linarith [hx.1] + + have cont_v : ContinuousOn v (Set.uIcc 3 T) := by + unfold v + rw[uIcc_is_Icc] + refine continuousOn_of_forall_continuousAt ?_ + intro x hx + have cont1 : ContinuousAt (fun (x : ℝ) ↦ 1 / x) x := by + refine ContinuousAt.div₀ ?_ (fun ⦃U⦄ a ↦ a) ?_ + · exact continuousAt_const + · linarith [hx.1] + have cont2 : ContinuousAt (fun (x : ℝ) ↦ 1 / x) (-x) := by + refine ContinuousAt.div₀ ?_ (fun ⦃U⦄ a ↦ a) ?_ + · exact continuousAt_const + · linarith [hx.1] + have fun1 : (fun (x : ℝ) ↦ -1 / x) = (fun (x : ℝ) ↦ 1 / (-x)) := by + ext x + ring_nf + rw [fun1] + exact ContinuousAt.comp cont2 (HasDerivAt.neg (hasDerivAt_id x)).continuousAt + + have deriv_u : (∀ x ∈ Set.Ioo (3 ⊓ T) (3 ⊔ T), HasDerivAt u (u' x) x) := by + intro x hx + have min3t : min 3 T = 3 := by + exact min_eq_left_of_lt Tgt3 + have max3t : max 3 T = T := by + exact max_eq_right_of_lt Tgt3 + rw[min3t, max3t] at hx + unfold u u' + have xne0 : x ≠ 0 := by linarith [hx.1] + have deriv1 := Real.deriv_log x + have deriv2 := (Real.hasDerivAt_log xne0).pow (d + 1) + have fun1 : (fun x ↦ (↑d + 1) * Real.log x ^ d / x) = (fun x ↦ (↑d + 1) * Real.log x ^ d * x⁻¹) := by + exact rfl + have fun2 : (↑d + 1) * Real.log x ^ d / x = (↑d + 1) * Real.log x ^ d * x⁻¹:= by + exact rfl + rw [fun2] + simpa [Nat.cast_add, Nat.cast_one] using! deriv2 + + have deriv_v : (∀ x ∈ Set.Ioo (3 ⊓ T) (3 ⊔ T), HasDerivAt v (v' x) x) := by + intro x hx + have min3t : min 3 T = 3 := by + exact min_eq_left_of_lt Tgt3 + have max3t : max 3 T = T := by + exact max_eq_right_of_lt Tgt3 + rw[min3t, max3t] at hx + have xne0 : x ≠ 0 := by linarith [hx.1] + unfold v v' + have deriv1 := hasDerivAt_inv xne0 + have fun1 : (fun (x : ℝ) ↦ x⁻¹) = (fun (x : ℝ) ↦ 1 / x) := by + ext x + exact inv_eq_one_div x + rw [fun1] at deriv1 + have fun2 : -(x ^ 2)⁻¹ = - 1 / x ^ 2 := by + field_simp + rw [fun2] at deriv1 + simpa [neg_div, neg_neg] using! HasDerivAt.neg deriv1 + + have cont_u' : ContinuousOn u' (Set.uIcc 3 T) := by + rw[uIcc_is_Icc] + unfold u' + refine ContinuousOn.div₀ ?_ ?_ ?_ + · refine ContinuousOn.mul ?_ ?_ + · exact continuousOn_const + · refine ContinuousOn.pow ?_ d + refine continuousOn_of_forall_continuousAt ?_ + intro x hx + refine continuousAt_log ?_ + linarith [hx.1] + · exact continuousOn_id' (Icc 3 T) + · intro x hx + linarith [hx.1] + + have cont_v' : ContinuousOn v' (Set.uIcc 3 T) := by + rw[uIcc_is_Icc] + unfold v' + refine ContinuousOn.div₀ ?_ ?_ ?_ + · exact continuousOn_const + · exact continuousOn_pow 2 + · intro x hx + refine pow_ne_zero 2 ?_ + linarith [hx.1] + + have int_u': IntervalIntegrable u' MeasureTheory.volume 3 T := by + exact ContinuousOn.intervalIntegrable cont_u' + + have int_v': IntervalIntegrable v' MeasureTheory.volume 3 T := by + exact ContinuousOn.intervalIntegrable cont_v' + + have IBP := intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt cont_u cont_v deriv_u deriv_v int_u' int_v' + + unfold u u' v v' at IBP + + have int1 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) * (1 / x ^ 2) + = ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) / x ^ 2 := by + refine intervalIntegral.integral_congr ?_ + intro x hx + field_simp + + rw[int1] at IBP + rw[IBP] + + have int2 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), (↑d + 1) * Real.log x ^ d / x * (-1 / x) + = -(↑d + 1) * ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ d / x ^ 2 := by + have : ∀ x, (↑d + 1) * Real.log x ^ d / x * (-1 / x) + = -((↑d + 1) * Real.log x ^ d / x ^ 2) := by + intro x + field_simp + have : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), (↑d + 1) * Real.log x ^ d / x * (-1 / x) + = ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), -((↑d + 1) * Real.log x ^ d / x ^ 2) := by + exact intervalIntegral.integral_congr fun ⦃x⦄ a ↦ this x + rw [this] + rw [←intervalIntegral.integral_const_mul] + ring_nf + + rw[int2] + + have int3 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ d / x ^ 2 + = ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d / x ^ 2 := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + + rw[int3] + + have IHbound : ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d / x ^ 2 < Cd := by + exact IH T Tgt3 + + ring_nf + have bound2 : (Real.log T * Real.log T ^ d * T⁻¹) ≥ 0 := by + have logTpos : Real.log T ≥ 0 := by + refine log_nonneg ?_ + linarith + apply mul_nonneg + · apply mul_nonneg + · exact logTpos + · exact pow_nonneg logTpos d + · positivity + + have bound3 : -(Real.log T * Real.log T ^ d * T⁻¹) ≤ 0 := by + exact Right.neg_nonpos_iff.mpr bound2 + let S := Real.log T * Real.log T ^ d * T⁻¹ + have Spos : S ≥ 0 := by + unfold S + exact bound2 + + have : (-(Real.log T * Real.log T ^ d * T⁻¹) + Real.log 3 * Real.log 3 ^ d * (1 / 3) + + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 = (-S + Real.log 3 * Real.log 3 ^ d * (1 / 3) + + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 := by + unfold S + rfl + rw [this] + + have GetRidOfS : (-S + Real.log 3 * Real.log 3 ^ d * (1 / 3) + + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 + ≤ ( Real.log 3 * Real.log 3 ^ d * (1 / 3) + + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 := by + linarith [Spos] + apply lt_of_le_of_lt GetRidOfS + rw [add_assoc] + + have bound4 : ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 < Cd := IHbound + + have bound5 : ↑d * ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 ≤ ↑d * Cd := by + apply (mul_le_mul_of_nonneg_left bound4.le) + exact Nat.cast_nonneg d + + have bound_sum : ↑d * (∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2) + + ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 < ↑d * Cd + Cd := by + linarith [bound4, bound5] + rw[add_assoc] + apply add_lt_add_right + field_simp + linarith [bound_sum] + +theorem I3Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {A Cζ : ℝ} (hCζ : LogDerivZetaHasBound A Cζ) (Cζpos : 0 < Cζ) (hA : A ∈ Ioc 0 (1 / 2)) : + ∃ (C : ℝ) (_ : 0 < C), + ∀ (X : ℝ) (_ : 3 < X) + {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) + {T : ℝ} (_ : 3 < T), + + let σ₁ : ℝ := 1 - A / (Real.log T) + ‖I₃ SmoothingF ε T X σ₁‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by + + obtain ⟨CM, CMpos, CMhyp⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF + obtain ⟨Cint, Cintpos, Cinthyp⟩ := log_pow_over_xsq_integral_bounded 9 + use Cint * CM * Cζ + have : Cint * CM > 0 := mul_pos Cintpos CMpos + have : Cint * CM * Cζ > 0 := mul_pos this Cζpos + use this + intro X Xgt3 ε εgt0 εlt1 T Tgt3 σ₁ + unfold I₃ + unfold SmoothedChebyshevIntegrand + + have elt3 : Real.exp 1 < 3 := by + linarith[Real.exp_one_lt_d9] + + have log3gt1: 1 < Real.log 3 := by + apply (Real.lt_log_iff_exp_lt (by norm_num)).mpr + exact elt3 + + have logXgt1 : Real.log X > 1 := by + refine (lt_log_iff_exp_lt ?_).mpr ?_ + linarith + linarith + + have logTgt1 : Real.log T > 1 := by + refine (lt_log_iff_exp_lt ?_).mpr ?_ + linarith + linarith + + have logX9gt1 : Real.log X ^ 1 > 1 := by + refine (one_lt_pow_iff_of_nonneg ?_ ?_).mpr logXgt1 + linarith + linarith + + have logT9gt1 : Real.log T ^ 1 > 1 := by + refine (one_lt_pow_iff_of_nonneg ?_ ?_).mpr logTgt1 + linarith + linarith + + have t_bounds : ∀ t ∈ Ioo (-T) (-3), 3 < |t| ∧ |t| < T := by + intro t ht + obtain ⟨h1,h2⟩ := ht + have : |t| = -t := by + refine abs_of_neg ?_ + linarith[h2] + have abs_tgt3 : 3 < |t| := by + rw[this] + linarith[h2] + have abs_tltX : |t| < T := by + rw[this] + linarith[h1] + exact ⟨abs_tgt3, abs_tltX⟩ + + have logtgt1_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| > 1 := by + intro t ht + obtain ⟨h1,h2⟩ := ht + refine logt_gt_one ?_ + exact h1.le + + have logt9gt1_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 > 1 := by + intro t ht + refine one_lt_pow₀ (logtgt1_bounds t ht) ?_ + linarith + + have logtltlogT_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| < Real.log T := by + intro t ht + obtain ⟨h1,h2⟩ := ht + have m := log_lt_log (by linarith : 0 < (|t|)) (h2 : |t| < T ) + exact m + + have logt9ltlogT9_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 < Real.log T ^ 9 := by + intro t ht + obtain h1 := logtltlogT_bounds t ht + obtain h2 := logtgt1_bounds t ht + have h3: 0 ≤ Real.log |t| := by linarith + refine (pow_lt_pow_iff_left₀ ?_ ?_ ?_).mpr h1 + linarith + linarith + linarith + + have Aoverlogt9gtAoverlogT9_bounds : ∀ t, 3 < |t| ∧ |t| < T → + A / Real.log |t| ^ 9 > A / Real.log T ^ 9 := by + intro t ht + have h1 := logt9ltlogT9_bounds t ht + have h2 :=logt9gt1_bounds t ht + refine div_lt_div_of_pos_left ?_ ?_ h1 + linarith [hA.1] + linarith + + have AoverlogT9in0half: A / Real.log T ^ 1 ∈ Ioo 0 (1/2) := by + constructor + · refine div_pos ?_ ?_ + refine EReal.coe_pos.mp ?_ + exact EReal.coe_lt_coe hA.1 + linarith + · refine (div_lt_comm₀ ?_ ?_).mpr ?_ + linarith + linarith + refine (div_lt_iff₀' ?_).mpr ?_ + linarith + have hA_lt : A ≤ 1 / 2 := hA.2 + have hbound : 1 / 2 < (1 / 2) * Real.log T ^ 1 := by + linarith + linarith + + have σ₁lt2 : (σ₁ : ℝ) < 2 := by + unfold σ₁ + calc 1 - A / Real.log T + < 1 - 0 := by simp only [sub_zero]; exact sub_lt_self 1 (div_pos hA.1 (lt_trans zero_lt_one logTgt1)) + _ = 1 := by norm_num + _ < 2 := by norm_num + + have σ₁lt1 : σ₁ < 1 := by + unfold σ₁ + calc 1 - A / Real.log T + < 1 - 0 := by simp only [sub_zero]; exact sub_lt_self 1 (div_pos hA.1 (by linarith [logTgt1])) + _ = 1 := by norm_num + + have σ₁pos : 0 < σ₁ := by + unfold σ₁ + rw [sub_pos] + calc + A / Real.log T ≤ (1/2) / Real.log T := by + apply div_le_div_of_nonneg_right hA.2 (by linarith) + _ ≤ (1/2) / 1 := by + apply div_le_div_of_nonneg_left (by norm_num) (by norm_num) (by linarith) + _ = 1/2 := by norm_num + _ < 1 := by norm_num + + have quotient_bound : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) ≤ Real.log |t| ^ 9/ t ^ 2 := by + intro t ht + have loght := logt9gt1_bounds t ht + have logpos : Real.log |t| ^ 9 > 0 := by linarith + have denom_le : t ^ 2 ≤ σ₁ ^ 2 + t ^ 2 := by linarith [sq_nonneg σ₁] + have denom_pos : 0 < t ^ 2 := by + have : t ^ 2 = |t| ^ 2 := by + exact Eq.symm (sq_abs t) + rw [this] + have h1 := ht.1 + have abspos : |t| > 0 := by linarith + exact sq_pos_of_pos abspos + have denom2_pos : 0 < σ₁ ^ 2 + t ^ 2 := by linarith [sq_nonneg σ₁] + exact (div_le_div_iff_of_pos_left logpos denom2_pos denom_pos).mpr denom_le + + have boundthing : ∀ t, 3 < |t| ∧ |t| < T → σ₁ ∈ Ici (1 - A / Real.log |t|) := by + intro t ht + have h1 := Aoverlogt9gtAoverlogT9_bounds t ht + unfold σ₁ + apply mem_Ici.mpr + ring_nf + + apply sub_le_sub_left + have : Real.log |t| ≤ Real.log T := by + apply Real.log_le_log (by linarith) (le_of_lt ht.2) + exact div_le_div_of_nonneg_left (le_of_lt hA.1) (Real.log_pos (by linarith)) this + + have : ∫ (t : ℝ) in -T..-3, + -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑X ^ (↑σ₁ + ↑t * I) = ∫ (t : ℝ) in Ioo (-T : ℝ) (-3 : ℝ), + -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑X ^ (↑σ₁ + ↑t * I) := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + rw[this] + + have MellinBound : ∀ (t : ℝ) , ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖(σ₁ + t * I)‖ ^ 2)⁻¹ := by + intro t + apply CMhyp σ₁ + exact σ₁pos + · simp only [add_re, mul_re, ofReal_re, ofReal_im, I_re, I_im, mul_zero, zero_mul, sub_zero, add_zero] + exact le_rfl + · simpa only [add_re, mul_re, ofReal_re, ofReal_im, I_re, I_im, mul_zero, zero_mul, sub_zero, add_zero] using σ₁lt2.le + exact εgt0 + exact εlt1 + + have logzetabnd : ∀ t : ℝ, 3 < |t| ∧ |t| < T → ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ ≤ Cζ * Real.log (|t| : ℝ) ^ 9 := by + intro t tbounds + obtain ⟨tgt3, tltT⟩ := tbounds + apply hCζ + · exact tgt3 + · apply boundthing + constructor + · exact tgt3 + · exact tltT + + have Mellin_bd : ∀ t, 3 < |t| ∧ |t| < T → + ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖σ₁ + t * I‖ ^ 2)⁻¹ := by + intro t ht + apply MellinBound + + have logzeta_bd : ∀ t, 3 < |t| ∧ |t| < T → + ‖ζ' (σ₁ + t * I) / ζ (σ₁ + t * I)‖ ≤ Cζ * Real.log |t| ^ 9 := by + intro t t_bounds + obtain ⟨abs_tgt3,abs_tltX⟩ := t_bounds + apply logzetabnd + constructor + · exact abs_tgt3 + · exact abs_tltX + have : ‖1 / (2 * ↑π * I) * + (I * ∫ (t : ℝ) in -X..-3, + -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑T ^ (↑σ₁ + ↑t * I))‖ + = + (1 / (2 * π)) * ‖∫ (t : ℝ) in -X..-3, + -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑T ^ (↑σ₁ + ↑t * I)‖ := by + simp only [norm_mul] + rw[Complex.norm_I] + simp only [one_mul] + have : ‖1 / (2 * ↑π * I)‖ = 1 / (2 * π) := by + + ring_nf + simp only [norm_mul] + rw[inv_I] + have : ‖-I‖ = ‖-1 * I‖ := by + simp + rw[this] + have : ‖-1 * I‖ = ‖-1‖ * ‖I‖ := by + simp + rw[this, Complex.norm_I] + ring_nf + simp + rw[this] + + let f t := (-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑X ^ (↑σ₁ + ↑t * I) + + let g t := Cζ * CM * Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) * X ^ σ₁ + + have norm_X_sigma1: ∀ (t : ℝ), ‖↑(X : ℂ) ^ (↑σ₁ + ↑t * I)‖ = X ^ σ₁ := by + intro t + have Xpos : 0 < X := by linarith + have : ((↑σ₁ + ↑t * I).re) = σ₁ := by + simp + + nth_rw 2[← this] + apply Complex.norm_cpow_eq_rpow_re_of_pos Xpos + + have bound_integral : ∀ (t : ℝ), 3 < |t| ∧ |t| < T → ‖f t‖ ≤ g t := by + intro t + rintro ⟨ht_gt3, ht_ltT⟩ + have Xσ_bound : ‖↑(X : ℂ) ^ (↑σ₁ + ↑t * I)‖ = X ^ σ₁ := norm_X_sigma1 t + have logtgt1 : 1 < Real.log |t| := by + exact logt_gt_one ht_gt3.le + have hζ := logzetabnd t ⟨ht_gt3, ht_ltT⟩ + have h𝓜 := MellinBound t + have : ‖f ↑t‖ = ‖(-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑X ^ (↑σ₁ + ↑t * I)‖ := by + rfl + rw[this] + have : ‖(-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑X ^ (↑σ₁ + ↑t * I)‖ ≤ ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ * + ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I)‖ * + ‖(↑(X : ℝ) : ℂ) ^ (↑σ₁ + ↑t * I)‖ := by + simp [norm_neg] + + have : ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ * + ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I)‖ * + ‖(↑X : ℂ) ^ (↑σ₁ + ↑t * I)‖ ≤ (Cζ * Real.log |t| ^ 9) * + (CM * (ε * ‖↑σ₁ + ↑t * I‖ ^ 2)⁻¹) * X ^ σ₁:= by + rw[Xσ_bound] + gcongr + have : (Cζ * Real.log |t| ^ 9) * (CM * (ε * ‖↑σ₁ + ↑t * I‖ ^ 2)⁻¹) * X ^ σ₁ = g t := by + unfold g + ring_nf + linarith + + have int_with_f: ‖1 / (2 * ↑π * I) * + (I * + ∫ (t : ℝ) in Ioo (-T) (-3), + -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * + ↑X ^ (↑σ₁ + ↑t * I))‖ = ‖1 / (2 * ↑π * I) * + (I * + ∫ (t : ℝ) in Ioo (-T) (-3), + f t)‖ := by + unfold f + simp + rw[int_with_f] + apply (norm_mul_le _ _).trans + have int_mulbyI_is_int : ‖I * ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ = ‖ ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ := by + rw [Complex.norm_mul, Complex.norm_I] + ring + rw[int_mulbyI_is_int] + + have norm_1over2pii_le1: ‖1 / (2 * ↑π * I)‖ ≤ 1 := by + simp + have pi_gt_3 : Real.pi > 3 := by + exact pi_gt_three + have pi_pos : 0 < π := by linarith [pi_gt_3] + have abs_pi_inv_le : |π|⁻¹ ≤ (1 : ℝ) := by + rw [abs_of_pos pi_pos] + have h : 1 = π * π⁻¹ := by + field_simp + rw[h] + nth_rw 1 [← one_mul π⁻¹] + apply mul_le_mul_of_nonneg_right + · linarith + · exact inv_nonneg.mpr (le_of_lt pi_pos) + have : (0 : ℝ) < (2 : ℝ) := by norm_num + have h_half_le_one : (2 : ℝ)⁻¹ ≤ 1 := by norm_num + rw [abs_of_pos pi_pos] at abs_pi_inv_le + norm_num; linarith + + have : ‖1 / (2 * ↑π * I)‖ * ‖∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ ≤ ‖∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ := by + apply mul_le_of_le_one_left + · apply norm_nonneg + · exact norm_1over2pii_le1 + apply le_trans this + have : ‖ ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ ≤ ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑ t‖ := by + apply norm_integral_le_integral_norm + apply le_trans this + + have norm_f_nonneg: ∀ t, ‖f t‖ ≥ 0 := by + exact fun t ↦ norm_nonneg (f t) + + have g_cont : ContinuousOn g (Icc (-T) (-3)) := by + unfold g + refine ContinuousOn.mul ?_ ?_ + refine ContinuousOn.mul ?_ ?_ + refine ContinuousOn.mul ?_ ?_ + refine ContinuousOn.mul ?_ ?_ + · exact continuousOn_const + · exact continuousOn_const + · refine ContinuousOn.pow ?_ 9 + refine ContinuousOn.log ?_ ?_ + · refine Continuous.continuousOn ?_ + exact _root_.continuous_abs + · intro t ht + have h1 := ht.1 + have h2 := ht.2 + by_contra! + have : t = 0 := by + exact abs_eq_zero.mp this + rw[this] at h2 + absurd + h2 + linarith + · refine ContinuousOn.inv₀ ?_ ?_ + · refine ContinuousOn.mul ?_ ?_ + · exact continuousOn_const + · refine ContinuousOn.pow ?_ 2 + refine ContinuousOn.norm ?_ + refine ContinuousOn.add ?_ ?_ + · exact continuousOn_const + · refine ContinuousOn.mul ?_ ?_ + · refine continuousOn_of_forall_continuousAt ?_ + intro x hx + exact continuous_ofReal.continuousAt + · exact continuousOn_const + · intro x hx + have norm_sq_pos : ‖(σ₁ : ℂ) + x * Complex.I‖ ^ 2 = σ₁ ^ 2 + x ^ 2 := by + rw [Complex.sq_norm] + exact normSq_add_mul_I σ₁ x + have : 0 < σ₁ ^ 2 + x ^ 2 := by + apply add_pos_of_pos_of_nonneg + · exact sq_pos_of_pos σ₁pos + · exact sq_nonneg x + apply mul_ne_zero + · linarith + · rw [norm_sq_pos] + exact ne_of_gt this + · exact continuousOn_const + + have g_integrable_Icc : IntegrableOn g (Icc (-T) (-3)) volume := by + exact ContinuousOn.integrableOn_Icc g_cont + + have g_integrable_Ioo : IntegrableOn g (Ioo (-T) (-3)) volume := by + apply MeasureTheory.IntegrableOn.mono_set g_integrable_Icc + exact Ioo_subset_Icc_self + + have int_normf_le_int_g: ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ + ≤ ∫ (t : ℝ) in Ioo (-T) (-3), g ↑t := by + + by_cases h_int : IntervalIntegrable (fun t : ℝ ↦ ‖f t‖) volume (-T) (-3) + · have f_int : IntegrableOn (fun (t : ℝ) ↦ ‖f t‖) (Ioo (-T : ℝ) (-3 : ℝ)) volume := by + have hle : -T ≤ -3 := by linarith + exact (intervalIntegrable_iff_integrableOn_Ioo_of_le hle).mp h_int + apply MeasureTheory.setIntegral_mono_on + exact f_int + exact g_integrable_Ioo + exact measurableSet_Ioo + intro t ht + apply bound_integral + have : |t| = -t := by + refine abs_of_neg ?_ + linarith [ht.2] + have abs_tgt3 : 3 < |t| := by + rw[this] + linarith[ht.2] + have abs_tltX : |t| < T := by + rw[this] + linarith[ht.1] + constructor + · linarith + · linarith + · have : ∫ (t : ℝ) in -T..-3, ‖f ↑ t‖ = ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + have : ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ = 0 := by + rw [← this] + exact intervalIntegral.integral_undef h_int + rw [this] + apply MeasureTheory.setIntegral_nonneg + · exact measurableSet_Ioo + · intro t ht + have abst_negt : |t| = -t := by + refine abs_of_neg ?_ + linarith [ht.2] + have tbounds1 : 3 < |t| ∧ |t| < T := by + rw[abst_negt] + constructor + · linarith [ht.2] + · linarith [ht.1] + unfold g + apply mul_nonneg + apply mul_nonneg + apply mul_nonneg + apply mul_nonneg + · linarith + · linarith + · have : 0 ≤ Real.log |t| := by + apply Real.log_nonneg + linarith [tbounds1.1] + positivity + · positivity + + · apply Real.rpow_nonneg + linarith + + apply le_trans int_normf_le_int_g + unfold g + + have : X ^ σ₁ = X ^ (1 - A / Real.log T ) := by + rfl + rw[this] + + have : X ^ (1 - A / Real.log T) = X * X ^ (- A / Real.log T) := by + have hX : X > 0 := by linarith + simp only [Real.rpow_sub hX, Real.rpow_one] + have h₁ : X ^ (-A / Real.log T) * X ^ (A / Real.log T) = 1 := by + rw [← Real.rpow_add hX] + ring_nf + exact rpow_zero X + field_simp + simpa only [neg_div, mul_comm] using h₁.symm + + rw[this] + + have Bound_of_log_int: ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) ≤ Cint / ε := by + have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) + = (1 / ε) * ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 := by + rw [← integral_const_mul] + congr with t + field_simp [εgt0] + rw[this] + have normsquared : ∀ (t : ℝ), ‖↑σ₁ + ↑t * I‖ ^ 2 = σ₁ ^ 2 + t ^ 2 := by + intro t + simp only [Complex.sq_norm] + exact normSq_add_mul_I σ₁ t + + have : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 + = ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) := by + simp_rw [normsquared] + + have bound : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 ≤ Cint := by + rw [this] + have : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) + ≤ ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 := by + refine setIntegral_mono_on ?_ ?_ ?_ ?_ + · + have cont : ContinuousOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Set.Icc (-T) (-3)) := by + refine ContinuousOn.div ?_ ?_ ?_ + · refine ContinuousOn.pow ?_ 9 + refine ContinuousOn.log ?_ ?_ + · refine continuousOn_of_forall_continuousAt ?_ + intro x hx + refine Continuous.continuousAt ?_ + exact _root_.continuous_abs + · intro x hx + have h1 : x ≤ -3 := hx.2 + have xne0 : x ≠ 0 := by linarith + exact abs_ne_zero.mpr xne0 + · refine ContinuousOn.add ?_ ?_ + · exact continuousOn_const + · refine ContinuousOn.pow ?_ 2 + exact continuousOn_id' (Icc (-T) (-3)) + · intro t ht + have h1 : t ≤ -3 := ht.2 + have h2 : t ≠ 0 := by linarith + have h3 : 0 < t ^ 2 := pow_two_pos_of_ne_zero h2 + have h4 : 0 < σ₁ ^ 2 := sq_pos_of_pos σ₁pos + linarith [h3, h4] + have int_Icc : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Icc (-T) (-3)) volume := by + exact ContinuousOn.integrableOn_Icc cont + have int_Ioo : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Ioo (-T) (-3)) volume := by + apply MeasureTheory.IntegrableOn.mono_set int_Icc + exact Ioo_subset_Icc_self + exact int_Ioo + · have cont : ContinuousOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Set.Icc (-T) (-3)) := by + refine ContinuousOn.div ?_ ?_ ?_ + · refine ContinuousOn.pow ?_ 9 + refine ContinuousOn.log ?_ ?_ + · refine continuousOn_of_forall_continuousAt ?_ + intro x hx + refine Continuous.continuousAt ?_ + exact _root_.continuous_abs + · intro x hx + have h1 : x ≤ -3 := hx.2 + have xne0 : x ≠ 0 := by linarith + exact abs_ne_zero.mpr xne0 + · refine ContinuousOn.pow ?_ 2 + exact continuousOn_id' (Icc (-T) (-3)) + · intro t ht + have h1 : t ≤ -3 := ht.2 + have tne0 : t ≠ 0 := by linarith + exact pow_ne_zero 2 tne0 + have int_Icc : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Icc (-T) (-3)) volume := by + exact ContinuousOn.integrableOn_Icc cont + have int_Ioo : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Ioo (-T) (-3)) volume := by + apply MeasureTheory.IntegrableOn.mono_set int_Icc + exact Ioo_subset_Icc_self + exact int_Ioo + · exact measurableSet_Ioo + · intro x hx + have xneg : x < 0 := by linarith[hx.2] + have absx : |x| = -x := abs_of_neg xneg + have h1 : 3 < |x| ∧ |x| < T := by + rw[absx] + constructor + · linarith [hx.2] + · linarith [hx.1] + exact quotient_bound x (t_bounds x hx) + apply le_trans this + have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 + = ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 := by + have eq_integrand : ∀ (t : ℝ), t ∈ Ioo (-T) (-3) → (Real.log |t|) ^ 9 / t ^ 2 = (Real.log (-t)) ^ 9 / (-t) ^ 2 := by + intro t ht + have tneg : t < 0 := by linarith[ht.2] + have : |t| = -t := abs_of_neg tneg + rw [this, neg_sq] + + have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 + = ∫ (t : ℝ) in Ioo (-T) (-3), Real.log (-t) ^ 9 / (-t) ^ 2 := by + exact MeasureTheory.setIntegral_congr_fun measurableSet_Ioo eq_integrand + + rw [this] + + have interval_to_Ioo1 : ∫ (t : ℝ) in -T..-3, Real.log (-t) ^ 9 / (-t) ^ 2 + = ∫ (t : ℝ) in Ioo (-T) (-3), Real.log (-t) ^ 9 / (-t) ^ 2 := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + + have interval_to_Ioo2 : ∫ (t : ℝ) in (3)..(T), Real.log t ^ 9 / t ^ 2 + = ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 := by + rw [intervalIntegral.integral_of_le (by linarith)] + exact MeasureTheory.integral_Ioc_eq_integral_Ioo + + rw [← interval_to_Ioo1, ← interval_to_Ioo2] + rw [intervalIntegral.integral_comp_neg (fun (t : ℝ) ↦ Real.log (t) ^ 9 / (t) ^ 2)] + simp + rw [this] + have : ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 < Cint := by + exact Cinthyp T Tgt3 + linarith + rw [ mul_comm] + rw [← mul_div_assoc, mul_one] + exact (div_le_div_iff_of_pos_right εgt0).mpr bound + + have factor_out_constants : + ∫ (t : ℝ) in Ioo (-T) (-3), Cζ * CM * Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) * (X * X ^ (-A / Real.log T )) + = Cζ * CM * (X * X ^ (-A / Real.log T)) * ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) := by + rw [mul_assoc, ← mul_assoc (Cζ * CM), ← mul_assoc] + field_simp + rw [← integral_const_mul] + apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioo + intro t ht + ring_nf + + rw [factor_out_constants] + + have : Cζ * CM * (X * X ^ (-A / Real.log T)) * ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) + ≤ Cζ * CM * ((X : ℝ) * X ^ (-A / Real.log T)) * (Cint / ε) := by + apply mul_le_mul_of_nonneg_left + · exact Bound_of_log_int + · have hpos : 0 < X * X ^ (-A / Real.log T) := by + apply mul_pos + · linarith + · apply Real.rpow_pos_of_pos + linarith + apply mul_nonneg + · apply mul_nonneg + · linarith + · linarith + · linarith [hpos] + + apply le_trans this + ring_nf + field_simp; norm_num + +lemma I7I3 {SmoothingF : ℝ → ℝ} {ε X T σ₁ : ℝ} (Xpos : 0 < X) : + I₇ SmoothingF ε T X σ₁ = conj (I₃ SmoothingF ε T X σ₁) := by + unfold I₃ I₇ + simp only [map_mul, map_div₀, conj_I, conj_ofReal, conj_ofNat, map_one] + rw [neg_mul, mul_neg, ← neg_mul] + congr + · ring + · rw [← intervalIntegral_conj, ← intervalIntegral.integral_comp_neg] + apply intervalIntegral.integral_congr + intro t ht + simp only + rw [← smoothedChebyshevIntegrand_conj Xpos] + simp + +lemma I7Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {A Cζ : ℝ} (hCζ : LogDerivZetaHasBound A Cζ) (Cζpos : 0 < Cζ) (hA : A ∈ Ioc 0 (1 / 2)) + : ∃ (C : ℝ) (_ : 0 < C), + ∀ (X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) + (_ : ε < 1) {T : ℝ} (_ : 3 < T), + let σ₁ : ℝ := 1 - A / (Real.log T) + ‖I₇ SmoothingF ε T X σ₁‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by + obtain ⟨C, Cpos, bound⟩ := I3Bound suppSmoothingF ContDiffSmoothingF hCζ Cζpos hA + refine ⟨C, Cpos, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ + specialize bound X X_gt εpos ε_lt_one T_gt + intro σ₁ + rwa [I7I3 (by linarith), norm_conj] + +lemma I4Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) + {A : ℝ} + (hA : A ∈ Ioc 0 (1 / 2)) : + ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : ℝ) (_ : 3 < Tlb), + ∀ (X : ℝ) (_ : 3 < X) + {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) + {T : ℝ} (_ : Tlb < T), + let σ₁ : ℝ := 1 - A / (Real.log T) + ‖I₄ SmoothingF ε X σ₁ σ₂‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by + + have reOne : re 1 = 1 := by exact rfl + have imOne : im 1 = 0 := by exact rfl + have reThree : re 3 = 3 := by exact rfl + have imThree : im 3 = 0 := by exact rfl + + have elt3 : Real.exp 1 < 3 := by + linarith[Real.exp_one_lt_d9] + + unfold I₄ SmoothedChebyshevIntegrand + + let S : Set ℝ := (fun (t : ℝ) ↦ ↑‖-ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)‖₊) '' Icc 0 1 + let C' : ℝ := sSup S + have bddAboveS : BddAbove S := by + refine IsCompact.bddAbove ?_ + unfold S + refine IsCompact.image_of_continuousOn ?_ ?_ + · exact isCompact_Icc + · refine ContinuousOn.norm ?_ + have : (fun (t : ℝ) ↦ -ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)) = + (fun (t : ℝ) ↦ -(ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I))) := by + apply funext + intro x + apply neg_div + rw[this] + refine ContinuousOn.neg ?_ + have : (fun (t : ℝ) ↦ ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)) = + ((ζ' / ζ) ∘ (fun (t : ℝ) ↦ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I))) := by exact rfl + rw[this] + apply h_logDeriv_holo.continuousOn.comp' (by fun_prop) + unfold MapsTo + intro x xInIcc + simp only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, Set.mem_sdiff] + have : ¬↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I = 1 := by + by_contra h + rw[Complex.ext_iff, sub_re, add_re, sub_im, add_im] at h + repeat rw[mul_im] at h + repeat rw[mul_re] at h + rw[sub_im, sub_re, reOne, imOne, reThree, imThree, I_im, I_re] at h + repeat rw[ofReal_re] at h + repeat rw[ofReal_im] at h + ring_nf at h + obtain ⟨_, ripGoal⟩ := h + have : -3 ≠ 0 := by norm_num + linarith + refine ⟨?_, this⟩ + rw [mem_reProdIm] + simp only [sub_re, add_re, ofReal_re, mul_re, one_re, ofReal_im, sub_im, one_im, sub_self, + mul_zero, sub_zero, re_ofNat, I_re, im_ofNat, I_im, mul_one, add_im, mul_im, zero_mul, + add_zero, zero_sub, mem_Icc, le_refl, neg_le_self_iff, Nat.ofNat_nonneg, and_self, and_true] + rw [Set.uIcc_of_le] + · rw [mem_Icc] + constructor + · simp only [le_add_iff_nonneg_right] + apply mul_nonneg + · exact xInIcc.1 + · linarith [hσ₂.2] + · have : σ₂ + x * (1 - σ₂) = σ₂ * (1 - x) + x := by ring + rw [this] + clear this + have : (2 : ℝ) = 1 * 1 + 1 := by norm_num + rw [this] + clear this + gcongr + · linarith [xInIcc.2] + · exact hσ₂.2.le + · linarith [xInIcc.1] + · exact xInIcc.2 + · linarith [hσ₂.2] + + have CPrimeNonneg : 0 ≤ C' := by + apply Real.sSup_nonneg + intro x x_in_S + obtain ⟨t, ht, rfl⟩ := x_in_S + exact NNReal.coe_nonneg _ + + obtain ⟨D, Dpos, MellinSmooth1bBound⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF + let C : ℝ := C' * D / sInf ((fun t => ‖ σ₂ + (t : ℝ) * (1 - σ₂) - 3 * I ‖₊ ^ 2) '' Set.Icc 0 1) + use C + have sInfPos : 0 < sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1) := by + refine (IsCompact.lt_sInf_iff_of_continuous ?_ ?_ ?_ 0).mpr ?_ + · exact isCompact_Icc + · exact Nonempty.of_subtype + · have : (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) = + (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ * ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊) := by + apply funext + intro x + rw[pow_two] + rw[this] + have : ContinuousOn (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊) (Icc 0 1) := by + refine ContinuousOn.nnnorm ?_ + refine ContinuousOn.sub ?_ (by exact continuousOn_const) + refine ContinuousOn.add (by exact continuousOn_const) ?_ + exact ContinuousOn.mul (by exact Complex.continuous_ofReal.continuousOn) (by exact continuousOn_const) + exact ContinuousOn.mul (by exact this) (by exact this) + · intro x xLoc + apply pow_pos + have temp : |(↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I).im| ≤ + ‖↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I‖₊ := by apply Complex.abs_im_le_norm + rw[sub_im, add_im, mul_im, mul_im, I_re, I_im, sub_im, sub_re] at temp + repeat rw[ofReal_re] at temp + repeat rw[ofReal_im] at temp + rw[reThree, imOne] at temp + ring_nf at temp ⊢ + rw[abs_of_neg, neg_neg] at temp + · have : (3 : NNReal) ≤ ‖↑σ₂ - ↑σ₂ * ↑x + (↑x - I * 3)‖₊ := by + apply (NNReal.coe_le_coe).mp + convert! temp using 1; congr 2; ring + have hp : (0 : NNReal) < ‖↑σ₂ - ↑σ₂ * ↑x + (↑x - I * 3)‖₊ := + lt_of_lt_of_le (by norm_num) this + convert! hp using 1; congr 2; ring + · rw[neg_lt_zero] + norm_num + have CNonneg : 0 ≤ C := by + unfold C + apply mul_nonneg + · exact mul_nonneg (by exact CPrimeNonneg) (by exact Dpos.le) + · rw[inv_nonneg] + norm_cast + convert sInfPos.le using 5 + norm_cast + use CNonneg + + let Tlb : ℝ := max 4 (max (rexp A) (rexp (A / (1 - σ₂)))) + use Tlb + + have : 3 < Tlb := by + unfold Tlb + rw[lt_max_iff] + refine Or.inl ?_ + norm_num + use this + + intro X X_gt_three ε ε_pos ε_lt_one T T_gt_Tlb σ₁ + have σ₂_le_σ₁ : σ₂ ≤ σ₁ := by + have logTlb_pos : 0 < Real.log Tlb := by + rw[← Real.log_one] + exact log_lt_log (by norm_num) (by linarith) + have logTlb_nonneg : 0 ≤ Real.log Tlb := by exact le_of_lt (by exact logTlb_pos) + have expr_nonneg : 0 ≤ A / (1 - σ₂) := by + apply div_nonneg + · linarith [hA.1] + · rw[sub_nonneg] + exact le_of_lt hσ₂.2 + have temp : σ₂ ≤ 1 - A / Real.log Tlb := by + have : rexp (A / (1 - σ₂)) ≤ Tlb := by + unfold Tlb + apply le_max_of_le_right + apply le_max_right + rw[← Real.le_log_iff_exp_le] at this + · rw[div_le_iff₀, mul_comm, ← div_le_iff₀] at this + · linarith + · exact logTlb_pos + · rw[sub_pos] + exact hσ₂.2 + · positivity + have : 1 - A / Real.log Tlb ≤ 1 - A / Real.log T := by + apply sub_le_sub (by rfl) + apply div_le_div₀ + · exact le_of_lt (by exact hA.1) + · rfl + · exact logTlb_pos + · apply log_le_log (by positivity) + exact le_of_lt (by exact T_gt_Tlb) + exact le_trans temp this + have minσ₂σ₁ : min σ₂ σ₁ = σ₂ := by exact min_eq_left (by exact σ₂_le_σ₁) + have maxσ₂σ₁ : max σ₂ σ₁ = σ₁ := by exact max_eq_right (by exact σ₂_le_σ₁) + have σ₁_lt_one : σ₁ < 1 := by + rw[← sub_zero 1] + unfold σ₁ + apply sub_lt_sub_left + apply div_pos (by exact hA.1) + rw[← Real.log_one] + exact log_lt_log (by norm_num) (by linarith) + + rw[norm_mul, ← one_mul C] + have : 1 * C * X * X ^ (-A / Real.log T) / ε = 1 * (C * X * X ^ (-A / Real.log T) / ε) := by ring + rw[this] + apply mul_le_mul + · rw[norm_div, norm_one] + repeat rw[norm_mul] + rw[Complex.norm_two, Complex.norm_real, Real.norm_of_nonneg, Complex.norm_I, mul_one] + have : 1 / (2 * π) < 1 / 6 := by + rw[one_div_lt_one_div] + · refine (div_lt_iff₀' ?_).mp ?_ + norm_num + ring_nf + refine gt_iff_lt.mpr ?_ + exact Real.pi_gt_three + · positivity + · norm_num + apply le_of_lt + exact lt_trans this (by norm_num) + exact pi_nonneg + · let f : ℝ → ℂ := fun σ ↦ (-ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)) + have temp : ‖∫ (σ : ℝ) in σ₂..σ₁, -ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)‖ ≤ + C * X * X ^ (-A / Real.log T) / ε * |σ₁ - σ₂| := by + have : ∀ x ∈ Set.uIoc σ₂ σ₁, ‖f x‖ ≤ C * X * X ^ (-A / Real.log T) / ε := by + intro x xInIoc + let t : ℝ := (x - σ₂) / (1 - σ₂) + have tInIcc : t ∈ Icc 0 1 := by + unfold t + constructor + · apply div_nonneg + · rw[sub_nonneg] + unfold uIoc at xInIoc + rw[minσ₂σ₁] at xInIoc + exact le_of_lt (by exact xInIoc.1) + · rw[sub_nonneg] + apply le_of_lt (by exact hσ₂.2) + · rw[div_le_one] + · refine sub_le_sub ?_ (by rfl) + unfold uIoc at xInIoc + rw[maxσ₂σ₁] at xInIoc + apply le_trans xInIoc.2 + exact le_of_lt (by exact σ₁_lt_one) + · rw[sub_pos] + exact hσ₂.2 + have tExpr : (↑σ₂ + t * (1 - ↑σ₂) - 3 * I) = (↑x - 3 * I) := by + unfold t + simp only [ofReal_div, ofReal_sub, ofReal_one, sub_left_inj] + rw[div_mul_comm, div_self] + · simp only [one_mul, add_sub_cancel] + · refine sub_ne_zero_of_ne ?_ + apply Ne.symm + rw[Complex.ofReal_ne_one] + exact ne_of_lt (by exact hσ₂.2) + unfold f + simp only [Complex.norm_mul] + have : C * X * X ^ (-A / Real.log T) / ε = + (C / ε) * (X * X ^ (-A / Real.log T)) := by ring + rw[this] + have temp : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)‖ ≤ + C / ε := by + unfold C + rw[div_div] + nth_rewrite 2 [div_eq_mul_inv] + have temp : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ ≤ C' := by + unfold C' + have : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ ∈ + (fun (t : ℝ) ↦ ↑‖-ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)‖₊) '' Icc 0 1 := by + rw[Set.mem_image] + use t + constructor + · exact tInIcc + · rw[tExpr] + rfl + exact le_csSup (by exact bddAboveS) (by exact this) + have : ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)‖ ≤ + D * ((sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1)) * ε)⁻¹ := by + nth_rewrite 3 [mul_comm] + let s : ℂ := x - 3 * I + have : 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I) = + 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) s := by exact rfl + rw[this] + have temp : σ₂ ≤ s.re := by + unfold s + rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] + ring_nf + apply le_of_lt + unfold uIoc at xInIoc + rw[minσ₂σ₁] at xInIoc + exact xInIoc.1 + have : s.re ≤ 2 := by + unfold s + rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] + ring_nf + have : x < 1 := by + unfold uIoc at xInIoc + rw[maxσ₂σ₁] at xInIoc + exact lt_of_le_of_lt xInIoc.2 σ₁_lt_one + linarith + have temp : ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) s‖ ≤ D * (ε * ‖s‖ ^ 2)⁻¹ := by + exact MellinSmooth1bBound σ₂ hσ₂.1 s temp this ε ε_pos ε_lt_one + have : D * (ε * ‖s‖ ^ 2)⁻¹ ≤ D * (ε * ↑(sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1)))⁻¹ := by + refine mul_le_mul (by rfl) ?_ ?_ (by exact le_of_lt (by exact Dpos)) + · rw[inv_le_inv₀] + · apply mul_le_mul (by rfl) + · rw[NNReal.coe_sInf] + apply csInf_le + · apply NNReal.bddBelow_coe + · unfold s + rw[Set.mem_image] + let xNorm : NNReal := ‖x - 3 * I‖₊ ^ 2 + use xNorm + constructor + · rw[Set.mem_image] + use t + exact ⟨tInIcc, by rw[tExpr]⟩ + · rfl + · exact le_of_lt (by exact sInfPos) + · exact le_of_lt (by exact ε_pos) + · apply mul_pos (ε_pos) + refine sq_pos_of_pos ?_ + refine norm_pos_iff.mpr ?_ + refine ne_zero_of_re_pos ?_ + unfold s + rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] + ring_nf + unfold uIoc at xInIoc + rw[minσ₂σ₁] at xInIoc + exact lt_trans hσ₂.1 xInIoc.1 + · exact mul_pos (ε_pos) (sInfPos) + · rw[inv_nonneg] + apply mul_nonneg (by exact le_of_lt (by exact ε_pos)) + exact sq_nonneg ‖s‖ + exact le_trans temp this + rw[mul_assoc] + apply mul_le_mul (by exact temp) (by exact this) + · have this : 0 ≤ |(𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)).re| := by + apply abs_nonneg + exact le_trans this (by refine Complex.abs_re_le_norm ?_) + · exact CPrimeNonneg + have : ‖(X : ℂ) ^ (↑x - 3 * I)‖ ≤ + X * X ^ (-A / Real.log T) := by + nth_rewrite 2 [← Real.rpow_one X] + rw[← Real.rpow_add] + · rw[Complex.norm_cpow_of_ne_zero] + · rw[sub_re, sub_im, mul_re, mul_im, ofReal_re, ofReal_im, I_re, I_im, reThree, imThree] + ring_nf + rw[Complex.norm_of_nonneg] + · rw[Complex.arg_ofReal_of_nonneg] + + · have one_inv: (1⁻¹ : ℝ) = ( 1 : ℝ) := by norm_num + rw[zero_mul, neg_zero, Real.exp_zero, one_inv, mul_one] + refine rpow_le_rpow_of_exponent_le ?_ ?_ + · linarith + · unfold uIoc at xInIoc + rw[maxσ₂σ₁] at xInIoc + unfold σ₁ at xInIoc + rw [←div_eq_mul_inv] + ring_nf at xInIoc ⊢ + exact xInIoc.2 + · positivity + · positivity + · refine ne_zero_of_re_pos ?_ + rw[ofReal_re] + positivity + · positivity + apply mul_le_mul + · exact temp + · exact this + · rw[Complex.norm_cpow_eq_rpow_re_of_pos] + · rw[sub_re, mul_re, ofReal_re, I_re, I_im, reThree, imThree] + ring_nf + apply Real.rpow_nonneg + positivity + · positivity + · exact div_nonneg CNonneg (le_of_lt ε_pos) + exact intervalIntegral.norm_integral_le_of_norm_le_const this + have : C * X * X ^ (-A / Real.log T) / ε * |σ₁ - σ₂| ≤ + C * X * X ^ (-A / Real.log T) / ε := by + have : |σ₁ - σ₂| ≤ 1 := by + rw[abs_of_nonneg] + · rw[← sub_zero 1] + exact sub_le_sub σ₁_lt_one.le hσ₂.1.le + · rw[sub_nonneg] + exact σ₂_le_σ₁ + bound + exact le_trans temp this + simp only [norm_nonneg] + norm_num + +lemma I6I4 {SmoothingF : ℝ → ℝ} {ε X σ₁ σ₂ : ℝ} (Xpos : 0 < X) : + I₆ SmoothingF ε X σ₁ σ₂ = -conj (I₄ SmoothingF ε X σ₁ σ₂) := by + unfold I₆ I₄ + simp only [map_mul, map_div₀, conj_ofReal, conj_I, map_one, conj_ofNat] + rw [← neg_mul] + congr + · ring + · rw [← intervalIntegral_conj] + apply intervalIntegral.integral_congr + intro σ hσ + simp only + rw[← smoothedChebyshevIntegrand_conj Xpos] + simp [conj_ofNat] + +lemma I6Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) + {A : ℝ} + (hA : A ∈ Ioc 0 (1 / 2)) : + ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : ℝ) (_ : 3 < Tlb), + ∀ (X : ℝ) (_ : 3 < X) + {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) + {T : ℝ} (_ : Tlb < T), + let σ₁ : ℝ := 1 - A / (Real.log T) + ‖I₆ SmoothingF ε X σ₁ σ₂‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by + obtain ⟨C, Cpos, Tlb, Tlb_gt, bound⟩ := I4Bound suppSmoothingF ContDiffSmoothingF h_logDeriv_holo hσ₂ hA + refine ⟨C, Cpos, Tlb, Tlb_gt, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ + specialize bound X X_gt εpos ε_lt_one T_gt + intro σ₁ + rwa [I6I4 (by linarith), norm_neg, norm_conj] + +lemma I5Bound {SmoothingF : ℝ → ℝ} + (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) + (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) + {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) + : ∃ (C : ℝ) (_ : 0 < C), + ∀ (X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) + (_ : ε < 1), + ‖I₅ SmoothingF ε X σ₂‖ ≤ C * X ^ σ₂ / ε := by + + unfold LogDerivZetaIsHoloSmall HolomorphicOn at h_logDeriv_holo + let zeta'_zeta_on_line := fun (t : ℝ) ↦ ζ' (σ₂ + t * I) / ζ (σ₂ + t * I) + + have subst : {σ₂} ×ℂ uIcc (-3) 3 ⊆ (uIcc σ₂ 2 ×ℂ uIcc (-3) 3) \ {1} := by + simp! only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le] + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, neg_le_self_iff, + Nat.ofNat_nonneg, uIcc_of_le] + intro z hyp_z + simp only [mem_reProdIm, mem_singleton_iff, mem_Icc] at hyp_z + simp only [Set.mem_sdiff, mem_reProdIm, mem_Icc, mem_singleton_iff] + constructor + · constructor + · rw [hyp_z.1] + apply left_mem_uIcc + · exact hyp_z.2 + · push Not + by_contra h + rw [h] at hyp_z + simp only [one_re, one_im, Left.neg_nonpos_iff, Nat.ofNat_nonneg, and_self, and_true] at hyp_z + linarith [hσ₂.2] + + have zeta'_zeta_cont := (h_logDeriv_holo.mono subst).continuousOn + + have is_compact' : IsCompact ({σ₂} ×ℂ uIcc (-3) 3) := by + refine IsCompact.reProdIm ?_ ?_ + · exact isCompact_singleton + · exact isCompact_uIcc + + let ⟨zeta_bound, zeta_prop⟩ := + IsCompact.exists_bound_of_continuousOn (is_compact') zeta'_zeta_cont + + let ⟨M, ⟨M_is_pos, M_bounds_mellin_hard⟩⟩ := + MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF + + clear is_compact' zeta'_zeta_cont subst zeta'_zeta_on_line h_logDeriv_holo + + unfold I₅ + unfold SmoothedChebyshevIntegrand + + let mellin_prop : ∀ (t ε : ℝ), + 0 < ε → ε < 1 → ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ ≤ M * (ε * ‖↑σ₂ + ↑t * I‖ ^ 2)⁻¹ := + fun (t : ℝ) ↦ (M_bounds_mellin_hard σ₂ (by linarith[hσ₂.1]) (σ₂ + t * I) (by simp only [add_re, + ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, le_refl]) (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith[hσ₂.2])) + + simp only [mul_inv_rev] at mellin_prop + + let Const := 1 + (σ₂^2)⁻¹ * (abs zeta_bound) * M + + let C := |π|⁻¹ * 2⁻¹ * 6 * Const + use C + have C_pos : 0 < C := by positivity + use C_pos + + have U : σ₂ ∈ Ioo 0 1 := by + refine mem_Ioo.mpr ?_ + · constructor + · linarith[hσ₂.1] + · linarith[hσ₂.2] + + clear U C_pos + + intros X X_gt ε ε_pos ε_lt_one + + have mellin_bound := fun (t : ℝ) ↦ mellin_prop t ε ε_pos ε_lt_one + + have U: 0 < σ₂^2 := by + exact sq_pos_of_pos (by linarith[hσ₂.1]) + + have easy_bound : ∀(t : ℝ), (‖↑σ₂ + ↑t * I‖^2)⁻¹ ≤ (σ₂^2)⁻¹ := + by + intro t + rw [inv_le_inv₀] + rw [Complex.sq_norm]; rw [Complex.normSq_apply]; simp only [add_re, ofReal_re, mul_re, I_re, + mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add]; ring_nf; simp only [le_add_iff_nonneg_right]; exact zpow_two_nonneg t + rw [Complex.sq_norm, Complex.normSq_apply]; simp only [add_re, ofReal_re, mul_re, I_re, + mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add]; ring_nf; positivity + positivity + + have T1 : ∀(t : ℝ), t ∈ uIoc (-3) (3 : ℝ) → ‖-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I) * + (↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ≤ Const * ε⁻¹ * X ^ σ₂ := by + intro t hyp_t + have Z := by + calc + ‖(-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)) * (𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)) * + (↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ = ‖-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by simp only [Complex.norm_mul, + Complex.norm_div, norm_neg] + _ ≤ ‖ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by simp only [Complex.norm_div, + norm_neg, le_refl] + _ ≤ zeta_bound * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := + by + have U := zeta_prop (↑σ₂ + t * I) (by + simp only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le] + simp only [mem_reProdIm, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, + mul_one, sub_self, add_zero, mem_singleton_iff, add_im, mul_im, zero_add, mem_Icc] + constructor + · trivial + · refine mem_Icc.mp ?_ + · refine mem_Icc_of_Ioc ?_ + · have T : (-3 : ℝ) ≤ 3 := by simp only [neg_le_self_iff, Nat.ofNat_nonneg] + rw [←Set.uIoc_of_le T] + exact hyp_t) + simp only [Complex.norm_div] at U + simp only [Complex.norm_div, ge_iff_le] + linear_combination U * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ + _ ≤ abs zeta_bound * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by + have U : zeta_bound ≤ abs zeta_bound := by simp only [le_abs_self] + linear_combination (U * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ) + _ ≤ abs zeta_bound * M * ((‖↑σ₂ + ↑t * I‖ ^ 2)⁻¹ * ε⁻¹) * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by + have U := mellin_bound t + linear_combination (abs zeta_bound) * U * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ + _ ≤ abs zeta_bound * M * (σ₂^2)⁻¹ * ε⁻¹ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by + have T : 0 ≤ abs zeta_bound * M := by positivity + linear_combination (abs zeta_bound * M * easy_bound t * ε⁻¹ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖) + _ = abs zeta_bound * M * (σ₂^2)⁻¹ * ε⁻¹ * X ^ (σ₂) := by + rw [Complex.norm_cpow_eq_rpow_re_of_pos] + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, + add_zero] + positivity + _ ≤ Const * ε⁻¹ * X ^ σ₂ := by + unfold Const + ring_nf + simp only [inv_pow, le_add_iff_nonneg_right, inv_pos, mul_nonneg_iff_of_pos_left, ε_pos] + positivity + + exact Z + + simp only [one_div, mul_inv_rev, inv_I, neg_mul, norm_neg, Complex.norm_mul, norm_I, norm_inv, + norm_real, norm_eq_abs, Complex.norm_ofNat, one_mul, ge_iff_le] + have Z := + intervalIntegral.norm_integral_le_of_norm_le_const T1 + simp only [ge_iff_le] + + have S : |π|⁻¹ * 2⁻¹ * (Const * ε⁻¹ * X ^ σ₂ * |3 + 3|) = C * X ^ σ₂ / ε := + by + unfold C + ring_nf + + simp only [sub_neg_eq_add] at Z + simp only [← S, ge_iff_le] + linear_combination (|π|⁻¹ * 2⁻¹ * Z) + +lemma LogDerivZetaBoundedAndHolo : ∃ A C : ℝ, 0 < C ∧ A ∈ Ioc 0 (1 / 2) ∧ LogDerivZetaHasBound A C + ∧ ∀ (T : ℝ) (_ : 3 ≤ T), + HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) + (( (Icc ((1 : ℝ) - A / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by + + obtain ⟨A₁, A₁_in, C, C_pos, zeta_bnd2⟩ := LogDerivZetaBndUnif2 + obtain ⟨A₂, A₂_in, holo⟩ := LogDerivZetaHolcLargeT' + refine ⟨min A₁ A₂, C, C_pos, ?_, ?_, ?_⟩ + · exact ⟨lt_min A₁_in.1 A₂_in.1, le_trans (min_le_left _ _) A₁_in.2⟩ + · + intro σ t ht hσ + have hσ' : σ ∈ Ici (1 - A₁ / Real.log |t| ^ 1) := by + + have hAle : min A₁ A₂ ≤ A₁ := min_le_left _ _ + have hlogpos : 0 < Real.log |t| := by + + exact Real.log_pos (lt_trans (by norm_num) ht) + have := sub_le_sub_left + (div_le_div_of_nonneg_right (show min A₁ A₂ ≤ A₁ from hAle) (le_of_lt hlogpos)) 1 + + have hthr : 1 - A₁ / Real.log |t| ^ 1 ≤ 1 - (min A₁ A₂) / Real.log |t| ^ 1 := by + simpa [pow_one] using this + + have : σ ∈ Ici (1 - (min A₁ A₂) / Real.log |t| ^ 1) := by + simpa [pow_one] using hσ + exact le_trans hthr (mem_Ici.mp this) + + have hmain := zeta_bnd2 σ t ht (by simpa [pow_one] using hσ') + have hlog_ge_one : (1 : ℝ) ≤ Real.log |t| := by + + have hpos : 0 < |t| := lt_trans (by norm_num) ht + have hle : Real.exp 1 ≤ |t| := by + have : Real.exp 1 ≤ 3 := le_of_lt (lt_trans Real.exp_one_lt_d9 (by norm_num)) + exact this.trans (le_of_lt ht) + have := Real.log_le_log (Real.exp_pos 1) hle + simpa [Real.log_exp] using this + have hpow : Real.log |t| ^ (2 : ℕ) ≤ Real.log |t| ^ (9 : ℕ) := by + exact pow_le_pow_right₀ hlog_ge_one (by decide : (2 : ℕ) ≤ 9) + + have : C * Real.log |t| ^ (2 : ℕ) ≤ C * Real.log |t| ^ (9 : ℕ) := + mul_le_mul_of_nonneg_left hpow (le_of_lt C_pos) + exact (le_trans hmain this) + · + intro T hT + + have hsubset : + ((Icc ((1 : ℝ) - min A₁ A₂ / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) \ {1}) ⊆ + ((Icc ((1 : ℝ) - A₂ / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) \ {1}) := by + intro s hs + rcases hs with ⟨hs_box, hs_ne⟩ + rcases hs_box with ⟨hre, him⟩ + rcases hre with ⟨hre_left, hre_right⟩ + + constructor + · + constructor + · + constructor + · + have hAle : min A₁ A₂ ≤ A₂ := min_le_right _ _ + have hlogpos : 0 < Real.log T := by + have hT' : 1 < T := by linarith + exact Real.log_pos hT' + have := sub_le_sub_left + (div_le_div_of_nonneg_right hAle (le_of_lt hlogpos)) 1 + have hthr : 1 - A₂ / Real.log T ^ 1 ≤ 1 - (min A₁ A₂) / Real.log T ^ 1 := by + simpa [pow_one] using this + exact le_trans hthr hre_left + · exact hre_right + · exact him + · exact hs_ne + exact (holo T hT).mono hsubset + +lemma MellinOfSmooth1cExplicit {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) + (suppν : ν.support ⊆ Icc (1 / 2) 2) + (mass_one : ∫ x in Ioi 0, ν x / x = 1) : + ∃ ε₀ c : ℝ, 0 < ε₀ ∧ 0 < c ∧ + ∀ ε ∈ Ioo 0 ε₀, ‖𝓜 ((Smooth1 ν ε) ·) 1 - 1‖ ≤ c * ε := by + have := MellinOfSmooth1c diffν suppν mass_one + rw [Asymptotics.isBigO_iff'] at this + rcases this with ⟨c, cpos, hc⟩ + unfold Filter.Eventually at hc + rw [mem_nhdsGT_iff_exists_Ioo_subset] at hc + rcases hc with ⟨ε₀, ε₀pos, h⟩ + refine ⟨ε₀, c, ε₀pos, cpos, fun ε hε ↦ ?_⟩ + specialize h hε + rw [mem_ofPred_eq, id_eq, norm_of_nonneg hε.1.le] at h + exact h + +open _root_.Filter Topology + +theorem Strong_PNT : ∃ c > 0, + (ψ - id) =O[atTop] + fun (x : ℝ) ↦ x * Real.exp (-c * (Real.log x) ^ ((1 : ℝ) / 2)) := by + have ⟨ν, ContDiffν, ν_nonneg', ν_supp, ν_massOne'⟩ := SmoothExistence + have ContDiff1ν : ContDiff ℝ 1 ν := by + exact ContDiffν.of_le (by simp) + have ν_nonneg : ∀ x > 0, 0 ≤ ν x := fun x _ ↦ ν_nonneg' x + have ν_massOne : ∫ x in Ioi 0, ν x / x = 1 := by + rwa [← integral_Ici_eq_integral_Ioi] + clear ContDiffν ν_nonneg' ν_massOne' + obtain ⟨c_close, c_close_pos, h_close⟩ := + SmoothedChebyshevClose ContDiff1ν ν_supp ν_nonneg ν_massOne + obtain ⟨ε_main, C_main, ε_main_pos, C_main_pos, h_main⟩ := MellinOfSmooth1cExplicit ContDiff1ν ν_supp ν_massOne + obtain ⟨A, C_bnd, C_bnd_pos, A_in_Ioc, zeta_bnd, holo1⟩ := LogDerivZetaBoundedAndHolo + obtain ⟨σ₂', σ₂'_lt_one, holo2'⟩ := LogDerivZetaHolcSmallT + let σ₂ : ℝ := max σ₂' (1 / 2) + have σ₂_pos : 0 < σ₂ := by bound + have σ₂_lt_one : σ₂ < 1 := by bound + have holo2 : HolomorphicOn (fun s ↦ ζ' s / ζ s) (uIcc σ₂ 2 ×ℂ uIcc (-3) 3 \ {1}) := by + apply holo2'.mono + intro s hs + simp [mem_reProdIm] at hs ⊢ + refine ⟨?_, hs.2⟩ + refine ⟨?_, hs.1.2⟩ + rcases hs.1.1 with ⟨left, right⟩ + constructor + · apply le_trans _ left + apply min_le_min_right + apply le_max_left + · rw [max_eq_right (by linarith)] at right ⊢ + exact right + + clear holo2' σ₂'_lt_one + + obtain ⟨c₁, c₁pos, hc₁⟩ := I1Bound ν_supp ContDiff1ν ν_nonneg ν_massOne + obtain ⟨c₂, c₂pos, hc₂⟩ := I2Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc + obtain ⟨c₃, c₃pos, hc₃⟩ := I3Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc + obtain ⟨c₅, c₅pos, hc₅⟩ := I5Bound ν_supp ContDiff1ν holo2 ⟨σ₂_pos, σ₂_lt_one⟩ + obtain ⟨c₇, c₇pos, hc₇⟩ := I7Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc + obtain ⟨c₈, c₈pos, hc₈⟩ := I8Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc + obtain ⟨c₉, c₉pos, hc₉⟩ := I9Bound ν_supp ContDiff1ν ν_nonneg ν_massOne + + obtain ⟨c₄, c₄pos, Tlb₄, Tlb₄bnd, hc₄⟩ := I4Bound ν_supp ContDiff1ν + holo2 ⟨σ₂_pos, σ₂_lt_one⟩ A_in_Ioc + + obtain ⟨c₆, c₆pos, Tlb₆, Tlb₆bnd, hc₆⟩ := I6Bound ν_supp ContDiff1ν + holo2 ⟨σ₂_pos, σ₂_lt_one⟩ A_in_Ioc + + let C' := c_close + C_main + let C'' := c₁ + c₂ + c₈ + c₉ + let C''' := c₃ + c₄ + c₆ + c₇ + + let c : ℝ := A ^ ((1 : ℝ) / 2) / 4 + have cpos : 0 < c := by + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, + mem_Ioc, lt_sup_iff, + inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, + div_pos_iff_of_pos_right, σ₂, c] + obtain ⟨left, right⟩ := A_in_Ioc + positivity + refine ⟨c, cpos, ?_⟩ + rw [Asymptotics.isBigO_iff] + let C : ℝ := C' + C'' + C''' + c₅ + refine ⟨C, ?_⟩ + + let c_εx : ℝ := A ^ ((1 : ℝ) / 2) / 2 + have c_εx_pos : 0 < c_εx := by + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, + mem_Ioc, lt_sup_iff, + inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, + div_pos_iff_of_pos_right, σ₂, c, c_εx] + let c_Tx : ℝ := A ^ ((1 : ℝ) / 2) + have c_Tx_pos : 0 < c_Tx := by + simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, + mem_Ioc, lt_sup_iff, + inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, + div_pos_iff_of_pos_right, σ₂, c, c_εx, c_Tx] + + let εx := (fun x ↦ Real.exp (-c_εx * (Real.log x) ^ ((1 : ℝ) / 2))) + let Tx := (fun x ↦ Real.exp (c_Tx * (Real.log x) ^ ((1 : ℝ) / 2))) + + have coeff_to_zero {B : ℝ} (B_le : B < 1) : + Tendsto (fun x ↦ Real.log x ^ (B - 1)) atTop (𝓝 0) := by + have B_minus_1_neg : B - 1 < 0 := by linarith + rw [← Real.zero_rpow (ne_of_lt B_minus_1_neg)] + rw [zero_rpow (ne_of_lt B_minus_1_neg)] + have one_minus_B_pos : 0 < 1 - B := by linarith + rw [show B - 1 = -(1 - B) by ring] + have : ∀ᶠ (x : ℝ) in atTop, Real.log x ^ (-(1 - B)) = (Real.log x ^ ((1 - B)))⁻¹ := by + filter_upwards [eventually_ge_atTop (1 : ℝ)] with x hx + apply Real.rpow_neg + exact Real.log_nonneg hx + rw [tendsto_congr' this] + apply tendsto_inv_atTop_zero.comp + apply (tendsto_rpow_atTop one_minus_B_pos).comp + exact tendsto_log_atTop + + have log_sub_log_pow_inf (c : ℝ) {B : ℝ} (B_le : B < 1) : + Tendsto (fun (x : ℝ) ↦ Real.log x - c * Real.log x ^ B) atTop atTop := by + have factor_form : ∀ x > 1, Real.log x - c * Real.log x ^ B = + Real.log x * (1 - c * Real.log x ^ (B - 1)) := by + intro x hx + ring_nf + congr! 1 + rw [mul_assoc, mul_comm (Real.log x), mul_assoc] + congr! 1 + have log_pos : 0 < Real.log x := Real.log_pos hx + rw [(by simp : Real.log x ^ (-1 + B) * Real.log x = + Real.log x ^ (-1 + B) * (Real.log x) ^ (1 : ℝ))] + rw [← Real.rpow_add log_pos] + ring_nf + have B_minus_1_neg : B - 1 < 0 := by linarith + have coeff_to_one : Tendsto (fun x ↦ 1 - c * Real.log x ^ (B - 1)) atTop (𝓝 1) := by + specialize coeff_to_zero B_le + apply Tendsto.const_mul c at coeff_to_zero + convert (tendsto_const_nhds (x := (1 : ℝ)) (f := (atTop : Filter ℝ))).sub coeff_to_zero + ring + + have eventually_pos : ∀ᶠ x in atTop, 0 < 1 - c * Real.log x ^ (B - 1) := by + apply (tendsto_order.mp coeff_to_one).1 + norm_num + + have eventually_factored : ∀ᶠ x in atTop, Real.log x - c * Real.log x ^ B = + Real.log x * (1 - c * Real.log x ^ (B - 1)) := by + filter_upwards [eventually_gt_atTop (1 : ℝ)] with x hx + exact factor_form x hx + + rw [tendsto_congr' eventually_factored] + apply Tendsto.atTop_mul_pos (by norm_num : (0 : ℝ) < 1) tendsto_log_atTop coeff_to_one + + have x_εx_eq (c B : ℝ) : ∀ᶠ (x : ℝ) in atTop, x * rexp (-c * Real.log x ^ B) = + rexp (Real.log x - c * Real.log x ^ B) := by + filter_upwards [eventually_gt_atTop 0] with x hx_pos + conv => + enter [1, 1] + rw [(Real.exp_log hx_pos).symm] + rw [← Real.exp_add] + ring_nf + + have x_ε_to_inf (c : ℝ) {B : ℝ} (B_le : B < 1) : Tendsto + (fun x ↦ x * Real.exp (-c * (Real.log x) ^ B)) atTop atTop := by + rw [tendsto_congr' (x_εx_eq c B)] + exact tendsto_exp_atTop.comp (log_sub_log_pow_inf c B_le) + + have Tx_to_inf : Tendsto Tx atTop atTop := by + unfold Tx + apply tendsto_exp_atTop.comp + apply Tendsto.pos_mul_atTop c_Tx_pos tendsto_const_nhds + exact (tendsto_rpow_atTop (by norm_num : 0 < (1 : ℝ) / 2)).comp Real.tendsto_log_atTop + + have ex_to_zero : Tendsto εx atTop (𝓝 0) := by + unfold εx + apply Real.tendsto_exp_atBot.comp + have this (x : ℝ) : -c_εx * Real.log x ^ ((1 : ℝ) / 2) = -(c_εx * Real.log x ^ ((1 : ℝ) / 2)) := by + ring + simp_rw [this] + rw [tendsto_neg_atBot_iff] + apply Tendsto.const_mul_atTop c_εx_pos + apply (tendsto_rpow_atTop (by norm_num)).comp + exact tendsto_log_atTop + + have eventually_εx_lt_one : ∀ᶠ (x : ℝ) in atTop, εx x < 1 := by + apply (tendsto_order.mp ex_to_zero).2 + norm_num + + have eventually_2_lt : ∀ᶠ (x : ℝ) in atTop, 2 < x * εx x := by + have := x_ε_to_inf c_εx (by norm_num : (1 : ℝ) / 2 < 1) + exact this.eventually_gt_atTop 2 + + have eventually_T_gt_3 : ∀ᶠ (x : ℝ) in atTop, 3 < Tx x := by + exact Tx_to_inf.eventually_gt_atTop 3 + + have eventually_T_gt_Tlb₄ : ∀ᶠ (x : ℝ) in atTop, Tlb₄ < Tx x := by + exact Tx_to_inf.eventually_gt_atTop _ + have eventually_T_gt_Tlb₆ : ∀ᶠ (x : ℝ) in atTop, Tlb₆ < Tx x := by + exact Tx_to_inf.eventually_gt_atTop _ + + have eventually_σ₂_lt_σ₁ : ∀ᶠ (x : ℝ) in atTop, σ₂ < 1 - A / (Real.log (Tx x)) := by + + apply (tendsto_order.mp ?_).1 + · exact σ₂_lt_one + have := tendsto_inv_atTop_zero.comp ((tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1)).comp + (tendsto_log_atTop.comp Tx_to_inf)) + have := Tendsto.const_mul (b := A) this + convert (tendsto_const_nhds (x := (1 : ℝ))).sub this using 2 + · simp [Function.comp, div_eq_mul_inv] + · simp + + have eventually_ε_lt_ε_main : ∀ᶠ (x : ℝ) in atTop, εx x < ε_main := by + apply (tendsto_order.mp ex_to_zero).2 + assumption + + have event_logX_ge : ∀ᶠ (x : ℝ) in atTop, 1 ≤ Real.log x := by + apply Real.tendsto_log_atTop.eventually_ge_atTop + + have event_1_aux_1 {const1 const2 : ℝ} (const1pos : 0 < const1) (const2pos : 0 < const2) : + ∀ᶠ (x : ℝ) in atTop, + rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ + rexp 0 := by + have := ((isLittleO_log_rpow_atTop const2pos).bound const1pos) + have : ∀ᶠ (x : ℝ) in atTop, Real.log (Real.log x) ≤ + const1 * (Real.log x) ^ const2 := by + have := tendsto_log_atTop.eventually this + filter_upwards [this, eventually_gt_atTop 100] with x hx x_gt + convert hx using 1 + · rw [Real.norm_of_nonneg] + apply Real.log_nonneg + have : (1 : ℝ) = Real.log (rexp 1) := by + exact Eq.symm (Real.log_exp 1) + + rw [this] + apply Real.log_le_log + · exact Real.exp_pos _ + · have := Real.exp_one_lt_d9 + + linarith + · congr! 1 + rw [Real.norm_of_nonneg] + apply Real.rpow_nonneg + apply Real.log_nonneg + linarith + have loglogx : ∀ᶠ (x : ℝ) in atTop, + Real.log x = rexp (Real.log (Real.log x)) := by + filter_upwards [eventually_gt_atTop 3] with x hx + rw [Real.exp_log] + apply Real.log_pos + linarith + filter_upwards [loglogx, this] with x loglogx hx + conv => + enter [1, 2] + rw [loglogx] + rw [← Real.exp_add] + apply Real.exp_monotone + grw [hx] + simp + + have event_1_aux {const1 const1' const2 : ℝ} (const1bnds : const1' < const1) + (const2pos : 0 < const2) : + ∀ᶠ (x : ℝ) in atTop, + rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ + rexp (-const1' * Real.log x ^ const2) := by + have : 0 < const1 - const1' := by linarith + filter_upwards [event_1_aux_1 this const2pos] with x hx + have : rexp (-const1 * Real.log x ^ const2) * Real.log x + = rexp (-(const1') * Real.log x ^ const2) + * rexp (-(const1 - const1') * Real.log x ^ const2) * Real.log x := by + congr! 1 + rw [← Real.exp_add] + congr! 1 + ring + rw [this] + rw [mul_assoc] + grw [hx] + simp + + have event_1 : ∀ᶠ (x : ℝ) in atTop, C' * (εx x) * x * Real.log x ≤ + C' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by + unfold c εx c_εx + have : 0 < (A ^ ((1 : ℝ) / 2) / 4) := by + positivity + have const1bnd : (A ^ ((1 : ℝ) / 2) / 4) < (A ^ ((1 : ℝ) / 2) / 2) := by + linarith + have const2bnd : (0 : ℝ) < 1 / 2 := by norm_num + have this (x : ℝ) : + C' * rexp (-(A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) * x * Real.log x = + C' * x * (rexp (-(A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) * Real.log x) := by ring + simp_rw [this] + filter_upwards [event_1_aux const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt + grw [x_bnd] + + have event_2 : ∀ᶠ (x : ℝ) in atTop, C'' * x * Real.log x / (εx x * Tx x) ≤ + C'' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by + unfold c εx c_εx Tx c_Tx + set const2 : ℝ := 1 / 2 + have const2bnd : 0 < const2 := by norm_num + set const1 := (A ^ const2 / 2) + set const1' := (A ^ const2 / 4) + have : 0 < A ^ const2 := by + unfold const2 + + apply Real.rpow_pos_of_pos + exact A_in_Ioc.1 + have this (x : ℝ) : -(-const1 * Real.log x ^ const2 + A ^ const2 * Real.log x ^ const2) = + -(A ^ const2 - const1) * Real.log x ^ const2 := by ring + simp_rw [← Real.exp_add, div_eq_mul_inv, ← Real.exp_neg, this] + have const1bnd : const1' < (A ^ const2 - const1) := by + unfold const1' const1 + linarith + filter_upwards [event_1_aux const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt + rw [mul_assoc] + conv => + enter [1, 2] + rw [mul_comm] + grw [x_bnd] + + have event_3_aux {const1 const1' const2 : ℝ} (const2_eq : const2 = 1 / 2) + (const1_eq : const1 = (A ^ const2 / 2)) (const1'_eq : const1' = (A ^ const2 / 4)) : + ∀ᶠ (x : ℝ) in atTop, + x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2)) ^ (1 : ℝ)) * + rexp (-(-const1 * Real.log x ^ const2)) ≤ + rexp (-const1' * Real.log x ^ const2) := by + have : ∀ᶠ (x : ℝ) in atTop, x = rexp (Real.log x) := by + filter_upwards [eventually_gt_atTop 0] with x hx + rw [Real.exp_log hx] + filter_upwards [this, eventually_gt_atTop 3] with x hx x_gt_3 + have logxpos : 0 < Real.log x := by apply Real.log_pos; linarith + conv => + enter [1, 1, 1] + rw [hx] + rw [← Real.exp_mul] + rw [Real.log_exp] + rw [Real.mul_rpow] + · have {y : ℝ} (ypos : 0 < y) : y / (y ^ const2) ^ (1 : ℝ) = y ^ const2 := by + rw [← Real.rpow_mul ypos.le] + rw [div_eq_mul_inv] + rw [← Real.rpow_neg ypos.le] + conv => + enter [1, 1] + rw [← Real.rpow_one y] + rw [← Real.rpow_add ypos] + rw [(by linarith : 1 + -(const2 * 1) = const2)] + rw [div_mul_eq_div_div] + rw [neg_div] + rw [this (A_in_Ioc.1)] + + rw [mul_div] + conv => + enter [1, 1, 1, 1] + rw [mul_comm] + rw [← mul_div] + + rw [this (y := Real.log x) logxpos] + + rw [← Real.exp_add] + apply Real.exp_monotone + + have : -A ^ const2 * Real.log x ^ const2 + -(-const1 * Real.log x ^ const2) + = (-(A ^ const2 - const1) * Real.log x ^ const2) := by ring + rw [this] + + gcongr + + rw [const1'_eq, const1_eq] + have : 0 ≤ A ^ const2 := by + apply Real.rpow_nonneg A_in_Ioc.1.le + linarith + · rw [const2_eq] + rw [←Real.sqrt_eq_rpow] + apply Real.sqrt_nonneg + + · apply Real.rpow_nonneg + apply Real.log_nonneg + linarith + + have event_3 : ∀ᶠ (x : ℝ) in atTop, C''' * x * x ^ (-A / Real.log (Tx x) ) / (εx x) ≤ + C''' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by + unfold c Tx c_Tx εx c_εx + set const2 : ℝ := 1 / 2 + have const2eq : const2 = 1 / 2 := by rfl + have const2bnd : 0 < const2 := by norm_num + set const1 := (A ^ const2 / 2) + have const1eq : const1 = (A ^ const2 / 2) := by rfl + set const1' := (A ^ const2 / 4) + have const1'eq : const1' = (A ^ const2 / 4) := by rfl + have A_pow_pos : 0 < A ^ const2 := by + unfold const2 + apply Real.rpow_pos_of_pos + exact A_in_Ioc.1 + + conv => + enter [1, x, 1] + rw [div_eq_mul_inv, ← Real.exp_neg] + + filter_upwards [event_3_aux const2eq const1eq const1'eq, + eventually_gt_atTop 3] with x x_bnd x_gt + + have this (x : ℝ) : C''' * x * x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2))) + * rexp (-(-const1 * Real.log x ^ const2)) + = C''' * x * (x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2))) + * rexp (-(-const1 * Real.log x ^ const2))) := by + ring + rw [this] + rw [rpow_one] at x_bnd + grw [x_bnd] + + have event_4_aux4 {pow2 : ℝ} (pow2_neg : pow2 < 0) {c : ℝ} (cpos : 0 < c) (c' : ℝ) : + Tendsto (fun x ↦ c' * Real.log x ^ pow2) atTop (𝓝 0) := by + rw [← mul_zero c'] + apply Tendsto.const_mul + have := tendsto_rpow_neg_atTop (y := -pow2) (by linarith) + rw [neg_neg] at this + apply this.comp + exact Real.tendsto_log_atTop + + have event_4_aux3 {pow2 : ℝ} (pow2_neg : pow2 < 0) {c : ℝ} (cpos : 0 < c) (c' : ℝ) : + ∀ᶠ (x : ℝ) in atTop, c' * (Real.log x) ^ pow2 < c := by + apply (event_4_aux4 pow2_neg cpos c').eventually_lt_const + exact cpos + + have event_4_aux2 {c1 : ℝ} (c1pos : 0 < c1) (c2 : ℝ) {pow1 : ℝ} (pow1_lt : pow1 < 1) : + ∀ᶠ (x : ℝ) in atTop, 0 ≤ Real.log x * (c1 - c2 * (Real.log x) ^ (pow1 - 1)) := by + filter_upwards [eventually_gt_atTop 3 , event_4_aux3 (by linarith : pow1 - 1 < 0) + (by linarith : 0 < c1 / 2) c2] with x x_gt hx + have : 0 ≤ Real.log x := by + apply Real.log_nonneg + linarith + apply mul_nonneg this + linarith + + have event_4_aux1 {const1 : ℝ} (const1_lt : const1 < 1) (const2 const3 : ℝ) + {pow1 : ℝ} (pow1_lt : pow1 < 1) : ∀ᶠ (x : ℝ) in atTop, + const1 * Real.log x + const2 * Real.log x ^ pow1 + ≤ Real.log x - const3 * Real.log x ^ pow1 := by + filter_upwards [event_4_aux2 (by linarith : 0 < 1 - const1) (const2 + const3) pow1_lt, + eventually_gt_atTop 3] with x hx x_gt + rw [← sub_nonneg] + have : + Real.log x - const3 * Real.log x ^ pow1 - (const1 * Real.log x + const2 * Real.log x ^ pow1) + = (1 - const1) * Real.log x - (const2 + const3) * Real.log x ^ pow1 := by ring + rw [this] + convert hx using 1 + ring_nf + congr! 1 + have : Real.log x * const2 * Real.log x ^ (-1 + pow1) + = const2 * Real.log x ^ pow1 := by + rw [mul_assoc, mul_comm, mul_assoc] + congr! 1 + conv => + enter [1, 2] + rw [← Real.rpow_one (Real.log x)] + rw [← Real.rpow_add (Real.log_pos (by linarith))] + ring_nf + rw [this] + have : Real.log x * const3 * Real.log x ^ (-1 + pow1) + = const3 * Real.log x ^ pow1 := by + rw [mul_assoc, mul_comm, mul_assoc] + congr! 1 + conv => + enter [1, 2] + rw [← Real.rpow_one (Real.log x)] + rw [← Real.rpow_add (Real.log_pos (by linarith))] + ring_nf + rw [this] + + have event_4_aux : ∀ᶠ (x : ℝ) in atTop, + c₅ * rexp (σ₂ * Real.log x + (A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) ≤ + c₅ * rexp (Real.log x - (A ^ ((1 : ℝ) / 2) / 4) * Real.log x ^ ((1 : ℝ) / 2)) := by + filter_upwards [eventually_gt_atTop 3, event_4_aux1 σ₂_lt_one (A ^ ((1 : ℝ) / 2) / 2) + (A ^ ((1 : ℝ) / 2) / 4) (by norm_num : (1 : ℝ) / 2 < 1)] with x x_gt hx + rw [mul_le_mul_iff_right₀ c₅pos] + apply Real.exp_monotone + convert hx + + have event_4 : ∀ᶠ (x : ℝ) in atTop, c₅ * x ^ σ₂ / (εx x) ≤ + c₅ * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by + unfold εx c_εx c + filter_upwards [event_4_aux, eventually_gt_atTop 0] with x hx xpos + convert hx using 1 + · rw [← mul_div] + congr! 1 + rw [div_eq_mul_inv, ← Real.exp_neg] + conv => + enter [1, 1, 1] + rw [← Real.exp_log xpos] + rw [← exp_mul, ← Real.exp_add] + ring_nf + + · rw [mul_assoc] + congr! 1 + conv => + enter [1, 1] + rw [← Real.exp_log xpos] + rw [← Real.exp_add] + ring_nf + + filter_upwards [eventually_gt_atTop 3, eventually_εx_lt_one, eventually_2_lt, + eventually_T_gt_3, eventually_T_gt_Tlb₄, eventually_T_gt_Tlb₆, + eventually_σ₂_lt_σ₁, eventually_ε_lt_ε_main, event_logX_ge, event_1, event_2, + event_3, event_4] with X X_gt_3 ε_lt_one ε_X T_gt_3 T_gt_Tlb₄ T_gt_Tlb₆ + σ₂_lt_σ₁ ε_lt_ε_main logX_ge event_1 event_2 event_3 event_4 + + clear eventually_εx_lt_one eventually_2_lt eventually_T_gt_3 eventually_T_gt_Tlb₄ + eventually_T_gt_Tlb₆ eventually_σ₂_lt_σ₁ eventually_ε_lt_ε_main event_logX_ge zeta_bnd + + let ε : ℝ := εx X + have ε_pos : 0 < ε := by positivity + specialize h_close X X_gt_3 ε ε_pos ε_lt_one ε_X + let ψ_ε_of_X := SmoothedChebyshev ν ε X + + let T : ℝ := Tx X + specialize holo1 T T_gt_3.le + let σ₁ : ℝ := 1 - A / (Real.log T) + have σ₁pos : 0 < σ₁ := by calc + 1 - A / (Real.log T) >= 1 - (1/2) / 1 := by + gcongr + · exact A_in_Ioc.2 + · apply (Real.le_log_iff_exp_le (by positivity)).mpr + linarith[Real.exp_one_lt_d9] + _ > 0 := by norm_num + have σ₁_lt_one : σ₁ < 1 := by + apply sub_lt_self + apply div_pos A_in_Ioc.1 + bound + + rw [uIcc_of_le (by linarith), uIcc_of_le (by linarith)] at holo2 + + have holo1_compat : HolomorphicOn (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) := by + + simpa [σ₁, pow_one] using! holo1 + + have holo2a : HolomorphicOn (SmoothedChebyshevIntegrand ν ε X) + (Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1}) := by + apply DifferentiableOn.mul + · apply DifferentiableOn.mul + · rw [(by ext; ring : (fun s ↦ -ζ' s / ζ s) = (fun s ↦ -(ζ' s / ζ s)))] + apply DifferentiableOn.neg holo2 + · intro s hs + apply DifferentiableAt.differentiableWithinAt + apply Smooth1MellinDifferentiable ContDiff1ν ν_supp ⟨ε_pos, ε_lt_one⟩ ν_nonneg ν_massOne + linarith[mem_reProdIm.mp hs.1 |>.1.1] + · intro s hs + apply DifferentiableAt.differentiableWithinAt + apply DifferentiableAt.const_cpow (by fun_prop) + left + norm_cast + linarith + have ψ_ε_diff : ‖ψ_ε_of_X - 𝓜 ((Smooth1 ν ε) ·) 1 * X‖ ≤ ‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ + + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ + + ‖I₈ ν ε T X σ₁‖ + ‖I₉ ν ε X T‖ := by + unfold ψ_ε_of_X + rw [SmoothedChebyshevPull1 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) + σ₁pos σ₁_lt_one holo1_compat ν_supp ν_nonneg ν_massOne ContDiff1ν] + rw [SmoothedChebyshevPull2 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) + σ₂_pos σ₁_lt_one σ₂_lt_σ₁ holo1_compat holo2a ν_supp ν_nonneg ν_massOne ContDiff1ν] + ring_nf + iterate 5 + apply le_trans (by apply norm_add_le) + gcongr + exact (norm_sub_le _ _).trans + (add_le_add ((norm_add_le _ _).trans + (add_le_add (norm_sub_le _ _) le_rfl)) le_rfl) + + specialize h_main ε ⟨ε_pos, ε_lt_ε_main⟩ + have main : ‖𝓜 ((Smooth1 ν ε) ·) 1 * X - X‖ ≤ C_main * ε * X := by + nth_rewrite 2 [← one_mul X] + push_cast + rw [← sub_mul, norm_mul] + gcongr + rw [norm_real, norm_of_nonneg (by linarith)] + specialize hc₁ ε ε_pos ε_lt_one X X_gt_3 T_gt_3 + specialize hc₂ X X_gt_3 ε_pos ε_lt_one T_gt_3 + specialize hc₃ X X_gt_3 ε_pos ε_lt_one T_gt_3 + specialize hc₅ X X_gt_3 ε_pos ε_lt_one + specialize hc₇ X X_gt_3 ε_pos ε_lt_one T_gt_3 + specialize hc₈ X X_gt_3 ε_pos ε_lt_one T_gt_3 + specialize hc₉ ε_pos ε_lt_one X X_gt_3 T_gt_3 + specialize hc₄ X X_gt_3 ε_pos ε_lt_one T_gt_Tlb₄ + specialize hc₆ X X_gt_3 ε_pos ε_lt_one T_gt_Tlb₆ + + clear ν_nonneg ν_massOne ContDiff1ν ν_supp holo2 + + have C'bnd : c_close * ε * X * Real.log X + C_main * ε * X ≤ C' * ε * X * Real.log X := by + have : C_main * ε * X * 1 ≤ C_main * ε * X * Real.log X := by + gcongr + linarith + + have C''bnd : c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) + c₈ * X / (ε * T) + + c₉ * X * Real.log X / (ε * T) ≤ C'' * X * Real.log X / (ε * T) := by + unfold C'' + rw [(by ring : (c₁ + c₂ + c₈ + c₉) * X * Real.log X / (ε * T) + = c₁ * X * Real.log X / (ε * T) + c₂ * X * Real.log X / (ε * T) + + c₈ * X * Real.log X / (ε * T) + c₉ * X * Real.log X / (ε * T))] + have : c₂ * X / (ε * T) * 1 ≤ c₂ * X / (ε * T) * Real.log X := by + gcongr + have : c₂ * X / (ε * T) ≤ c₂ * X * Real.log X / (ε * T) := by + ring_nf at this ⊢ + linarith + grw [this] + have : c₈ * X / (ε * T) * 1 ≤ c₈ * X / (ε * T) * Real.log X := by + gcongr + have : c₈ * X / (ε * T) ≤ c₈ * X * Real.log X / (ε * T) := by + ring_nf at this ⊢ + linarith + grw [this] + + have C'''bnd : c₃ * X * X ^ (-A / Real.log T) / ε + + c₄ * X * X ^ (-A / Real.log T) / ε + + c₆ * X * X ^ (-A / Real.log T) / ε + + c₇ * X * X ^ (-A / Real.log T) / ε + ≤ C''' * X * X ^ (-A / Real.log T) / ε := by + apply le_of_eq + ring + + calc + _ = ‖(ψ X - ψ_ε_of_X) + (ψ_ε_of_X - X)‖ := by ring_nf; norm_cast + _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖ψ_ε_of_X - X‖ := norm_add_le _ _ + _ = ‖ψ X - ψ_ε_of_X‖ + ‖(ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X) + + (𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X)‖ := by ring_nf + _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X‖ + + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ := by + rw [add_assoc] + gcongr + apply norm_add_le + _ = ‖ψ X - ψ_ε_of_X‖ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ + + ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X‖ := by ring + _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ + + (‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ + + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ + ‖I₈ ν ε T X σ₁‖ + + ‖I₉ ν ε X T‖) := by gcongr + _ ≤ c_close * ε * X * Real.log X + C_main * ε * X + + (c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) + + c₃ * X * X ^ (-A / Real.log T) / ε + + c₄ * X * X ^ (-A / Real.log T) / ε + + c₅ * X ^ σ₂ / ε + + c₆ * X * X ^ (-A / Real.log T) / ε + + c₇ * X * X ^ (-A / Real.log T) / ε + + c₈ * X / (ε * T) + + c₉ * X * Real.log X / (ε * T)) := by + gcongr + convert! h_close using 1 + rw [← norm_neg] + congr + ring + + change ‖I₂ ν ε (Tx X) X σ₁‖ ≤ c₂ * X / (ε * (Tx X)) + dsimp at hc₂ + dsimp [σ₁] + + unfold sigma1Of at hc₂ + + exact hc₂ + + _ = (c_close * ε * X * Real.log X + C_main * ε * X) + + ((c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) + + c₈ * X / (ε * T) + + c₉ * X * Real.log X / (ε * T)) + + (c₃ * X * X ^ (-A / Real.log T) / ε + + c₄ * X * X ^ (-A / Real.log T) / ε + + c₆ * X * X ^ (-A / Real.log T) / ε + + c₇ * X * X ^ (-A / Real.log T) / ε) + + c₅ * X ^ σ₂ / ε + ) := by ring + _ ≤ C' * ε * X * Real.log X + + (C'' * X * Real.log X / (ε * T) + + C''' * X * X ^ (-A / Real.log T) / ε + + c₅ * X ^ σ₂ / ε + ) := by + gcongr + _ = C' * ε * X * Real.log X + + C'' * X * Real.log X / (ε * T) + + C''' * X * X ^ (-A / Real.log T) / ε + + c₅ * X ^ σ₂ / ε + := by ring + _ ≤ C' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) + + C'' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) + + C''' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) + + c₅ * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) + := by + gcongr + _ = C * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) + := by ring + _ = _ := by + rw [Real.norm_of_nonneg] + · rw [← mul_assoc] + · positivity + +end Erdos970 diff --git a/StrongPNT/Erdos970/Z0.lean b/StrongPNT/Erdos970/Z0.lean new file mode 100644 index 0000000..093671d --- /dev/null +++ b/StrongPNT/Erdos970/Z0.lean @@ -0,0 +1,60 @@ +import PrimeNumberTheoremAnd.Erdos970.ZetaBounds +import StrongPNT.Erdos970.PNT3_RiemannZeta + +namespace Erdos970 + +open _root_.Complex Topology Filter Interval _root_.Set Asymptotics + +local notation (name := riemannzeta1) "ζ" => riemannZeta +local notation (name := derivriemannzeta1) "ζ'" => deriv riemannZeta + +lemma Z0bound_aux : + Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => -(ζ' / ζ) ((1 : ℂ) + delta) - (1 / (delta : ℂ))) (fun _ => (1 : ℂ)) := by + + let F := fun s : ℂ => -(ζ' / ζ) s - (s - 1)⁻¹ + + have h_F_bigO : F =O[𝓝[≠] 1] (1 : ℂ → ℂ) := by + have h_fun_eq : F = (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) := by + ext s + simp only [F, Pi.sub_apply, Pi.neg_apply, Pi.div_apply, neg_div] + rw [h_fun_eq] + exact riemannZetaLogDerivResidueBigO + + let u := fun (delta : ℝ) => (1 : ℂ) + delta + have h_tendsto : Tendsto u (nhdsWithin 0 (Set.Ioi 0)) (𝓝[≠] 1) := by + + apply tendsto_inf.mpr + constructor + · + have h_cont : Continuous u := continuous_const.add continuous_ofReal + + have h_tendsto_nhds : Tendsto u (𝓝 0) (𝓝 (u 0)) := h_cont.continuousAt.tendsto + + simp only [u, Complex.ofReal_zero, add_zero] at h_tendsto_nhds + + exact h_tendsto_nhds.mono_left nhdsWithin_le_nhds + · + + simp + + filter_upwards [self_mem_nhdsWithin] with delta h_delta_pos + simp only [u] + + refine add_ne_left.mpr ?_ + rw [Complex.ofReal_ne_zero] + exact ne_of_gt h_delta_pos + + have h_comp := h_F_bigO.comp_tendsto h_tendsto + + convert h_comp using 1 + ext delta + + simp only [F, u, Function.comp_apply, Pi.div_apply] + rw [inv_eq_one_div] + aesop + all_goals rfl + +lemma Z0bound : + Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => -logDerivZeta ((1 : ℂ) + delta) - (1 / (delta : ℂ))) (fun _ => (1 : ℂ)) := Z0bound_aux + +end Erdos970 diff --git a/StrongPNT/Erdos970/ZetaZeroFree.lean b/StrongPNT/Erdos970/ZetaZeroFree.lean new file mode 100644 index 0000000..10f11b5 --- /dev/null +++ b/StrongPNT/Erdos970/ZetaZeroFree.lean @@ -0,0 +1,240 @@ +import StrongPNT.Erdos970.PNT4_ZeroFreeRegion +import Mathlib.Analysis.Calculus.ContDiff.Defs +import Mathlib.Analysis.Asymptotics.Defs +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus +import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts +import Mathlib.Analysis.Calculus.Deriv.Basic +import Mathlib.NumberTheory.LSeries.RiemannZeta +import Mathlib.Algebra.Group.Basic +import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles +import PrimeNumberTheoremAnd.Erdos970.MellinCalculus +import Mathlib.MeasureTheory.Function.Floor +import Mathlib.Analysis.Complex.CauchyIntegral +import Mathlib.NumberTheory.Harmonic.Bounds +import Mathlib.MeasureTheory.Order.Group.Lattice +import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Tactic.Bound +import Mathlib.NumberTheory.LSeries.PrimesInAP +import Mathlib.Tactic.FunProp +import PrimeNumberTheoremAnd.Erdos970.Fourier +import PrimeNumberTheoremAnd.Erdos970.ZetaBounds + +namespace Erdos970 + +open _root_.Complex Topology _root_.Filter Interval _root_.Set Asymptotics +local notation (name := riemannzeta') "ζ" => riemannZeta +local notation (name := derivriemannzeta') "ζ'" => deriv riemannZeta + +local notation "I" => Complex.I + +lemma ZetaNoZerosOn1Line' (t : ℝ) : ζ (1 + t * I) ≠ 0 := by + refine riemannZeta_ne_zero_of_one_le_re ?_ + simp + +lemma ZetaCont' : ContinuousOn ζ (univ \ {1}) := by + apply continuousOn_of_forall_continuousAt (fun x hx ↦ ?_) + apply DifferentiableAt.continuousAt (𝕜 := ℂ) + convert differentiableAt_riemannZeta ?_ + simp only [Set.mem_sdiff, mem_univ, mem_singleton_iff, true_and] at hx + exact hx + +lemma ZetaNoZerosInBox' (T : ℝ) : + ∃ (σ : ℝ) (_ : σ < 1), ∀ (t : ℝ) (_ : |t| ≤ T) + (σ' : ℝ) (_ : σ' ≥ σ), ζ (σ' + t * I) ≠ 0 := by + by_contra h + push Not at h + + have hn (n : ℕ) := h (σ := 1 - 1 / (n + 1)) (sub_lt_self _ (by positivity)) + + have : ∃ (tn : ℕ → ℝ) (σn : ℕ → ℝ), (∀ n, σn n ≤ 1) ∧ + (∀ n, (1 : ℝ) - 1 / (n + 1) ≤ σn n) ∧ (∀ n, |tn n| ≤ T) ∧ + (∀ n, ζ (σn n + tn n * I) = 0) := by + choose t ht σ' hσ' hζ using hn + refine ⟨t, σ', ?_, hσ', ht, hζ⟩ + intro n + by_contra hσn + push Not at hσn + have := riemannZeta_ne_zero_of_one_lt_re (s := σ' n + t n * I) + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, + add_zero, ne_eq] at this + exact this hσn (hζ n) + + choose t σ' hσ'_le hσ'_ge ht hζ using this + + have σTo1 : Filter.Tendsto σ' Filter.atTop (𝓝 1) := by + have hlow : Tendsto (fun n : ℕ => (1 : ℝ) - 1 / (n + 1)) atTop (𝓝 1) := by + simpa using! (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_sub 1 + exact tendsto_of_tendsto_of_tendsto_of_le_of_le hlow tendsto_const_nhds hσ'_ge hσ'_le + + have : ∃ (t₀ : ℝ) (subseq : ℕ → ℕ), + Filter.Tendsto (t ∘ subseq) Filter.atTop (𝓝 t₀) ∧ + Filter.Tendsto subseq Filter.atTop Filter.atTop := by + refine (isCompact_Icc.isSeqCompact fun and => abs_le.1 (ht and)).imp fun and ⟨x, A, B, _⟩ => ?_ + use A, by valid, B.tendsto_atTop + + obtain ⟨t₀, subseq, tTendsto, subseqTendsto⟩ := this + + have σTo1 : Filter.Tendsto (σ' ∘ subseq) Filter.atTop (𝓝 1) := + σTo1.comp subseqTendsto + + have (n : ℕ) : ζ (σ' (subseq n) + I * (t (subseq n))) = 0 := by + convert hζ (subseq n) using 3 + ring + + have ToOneT0 : Filter.Tendsto (fun n ↦ (σ' (subseq n) : ℂ) + Complex.I * (t (subseq n))) Filter.atTop + (𝓝[≠]((1 : ℂ) + I * t₀)) := by + simp_rw [tendsto_nhdsWithin_iff, Function.comp_def] at tTendsto ⊢ + constructor + · exact (σTo1.ofReal.add (tTendsto.ofReal.const_mul _)).trans (by simp) + · filter_upwards with n + apply ne_of_apply_ne ζ + rw [this] + apply Ne.symm + apply riemannZeta_ne_zero_of_one_le_re + simp only [add_re, one_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, + sub_self, add_zero, le_refl] + + by_cases ht₀ : t₀ = 0 + · have ZetaBlowsUp : ∀ᶠ s in 𝓝[≠](1 : ℂ), ‖ζ s‖ ≥ 1 := by + have hprod : Tendsto (fun s : ℂ => ‖(s - 1) * ζ s‖) (𝓝[≠] 1) (𝓝 1) := by + simpa only [norm_one] using! riemannZeta_residue_one.norm + have hid : Tendsto (fun s : ℂ => s) (𝓝[≠] 1) (𝓝 1) := + tendsto_id.mono_left nhdsWithin_le_nhds + have hdist : Tendsto (fun s : ℂ => ‖s - 1‖) (𝓝[≠] 1) (𝓝 0) := by + simpa only [sub_self, norm_zero] using! (hid.sub_const 1).norm + filter_upwards [hprod.eventually_const_lt (by norm_num : (1 / 2 : ℝ) < 1), + hdist.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2)] with s hp hs + by_contra h + have hlt : ‖ζ s‖ < 1 := lt_of_not_ge h + have hm := mul_le_mul_of_nonneg_left hlt.le (norm_nonneg (s - 1)) + rw [norm_mul] at hp + rw [mul_one] at hm + linarith + + have ZetaNonZ : ∀ᶠ s in 𝓝[≠](1 : ℂ), ζ s ≠ 0 := by + filter_upwards [ZetaBlowsUp] + intro s hs hfalse + rw [hfalse] at hs + simp only [norm_zero, ge_iff_le] at hs + linarith + + rw [ht₀] at ToOneT0 + simp only [ofReal_zero, mul_zero, add_zero] at ToOneT0 + rcases (ToOneT0.eventually ZetaNonZ).exists with ⟨n, hn⟩ + exact hn (this n) + + · have zetaIsZero : ζ (1 + Complex.I * t₀) = 0 := by + have hpoint : (1 + Complex.I * t₀ : ℂ) ≠ 1 := by + intro heq + have him := congrArg Complex.im heq + have htzero : t₀ = 0 := by simpa using him + exact ht₀ htzero + have hcont := (differentiableAt_riemannZeta hpoint).continuousAt + have hlim : Tendsto (fun n : ℕ => ζ (σ' (subseq n) + I * t (subseq n))) atTop + (𝓝 (ζ (1 + I * t₀))) := by + simpa only [Function.comp_def] using! + hcont.tendsto.comp (ToOneT0.mono_right nhdsWithin_le_nhds) + have hfun : (fun n : ℕ => ζ (σ' (subseq n) + I * t (subseq n))) = (fun _ => 0) := + funext this + rw [hfun] at hlim + exact tendsto_nhds_unique hlim tendsto_const_nhds + + exact riemannZeta_ne_zero_of_one_le_re (s := 1 + I * t₀) (by simp) zetaIsZero + +lemma LogDerivZetaHoloOn' {S : Set ℂ} (s_ne_one : 1 ∉ S) + (nonzero : ∀ s ∈ S, ζ s ≠ 0) : + HolomorphicOn (fun s ↦ ζ' s / ζ s) S := by + apply DifferentiableOn.div _ _ nonzero <;> intro s hs <;> apply DifferentiableAt.differentiableWithinAt + · apply differentiableAt_deriv_riemannZeta + exact ne_of_mem_of_not_mem hs s_ne_one + · apply differentiableAt_riemannZeta + exact ne_of_mem_of_not_mem hs s_ne_one + +theorem LogDerivZetaHolcSmallT' : + ∃ (σ₂ : ℝ) (_ : σ₂ < 1), HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) + (( [[ σ₂, 2 ]] ×ℂ [[ -3, 3 ]]) \ {1}) := by + obtain ⟨σ₂, hσ₂_lt_one, hζ_ne_zero⟩ := ZetaNoZerosInBox 3 + refine ⟨σ₂, hσ₂_lt_one, ?_⟩ + let U := ([[σ₂, 2]] ×ℂ [[-3, 3]]) \ {1} + have s_in_U_im_le3 : ∀ s ∈ U, |s.im| ≤ 3 := by + intro s hs + rw [mem_sdiff_singleton] at hs + rcases hs with ⟨hbox, _hne⟩ + rcases hbox with ⟨hre, him⟩ + simp only [Set.mem_preimage] at him + obtain ⟨him_lower, him_upper⟩ := him + apply abs_le.2 + simp at him_lower + simp at him_upper + constructor + · exact him_lower + · exact him_upper + + have s_in_U_re_ges2 : ∀ s ∈ U, σ₂ ≤ s.re := by + intro s hs + rw [mem_sdiff_singleton] at hs + rcases hs with ⟨hbox, _hne⟩ + rcases hbox with ⟨hre, _him⟩ + simp only [Set.mem_preimage] at hre + obtain ⟨hre_lower, hre_upper⟩ := hre + have : min σ₂ 2 = σ₂ := by + apply min_eq_left + linarith [hσ₂_lt_one] + rw[this] at hre_lower + exact hre_lower + + apply LogDerivZetaHoloOn + · exact notMem_sdiff_of_mem rfl + · intro s hs + rw[← re_add_im s] + apply hζ_ne_zero + apply s_in_U_im_le3 _ hs + apply s_in_U_re_ges2 _ hs + +theorem LogDerivZetaHolcLargeT' : + ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), ∀ (T : ℝ) (_ : 3 ≤ T), + HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) + (( (Icc ((1 : ℝ) - A / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by + obtain ⟨A, A_inter, restOfZetaZeroFree⟩ := ZetaZeroFree_p + obtain ⟨σ₁, σ₁_lt_one, noZerosInBox⟩ := ZetaNoZerosInBox' 3 + let A₀ := min A ((1 - σ₁) * Real.log 3 ^ 1) + refine ⟨A₀, ?_, ?_⟩ + · constructor + · apply lt_min A_inter.1 + bound + · exact le_trans (min_le_left _ _) A_inter.2 + intro T hT + apply LogDerivZetaHoloOn + · exact notMem_sdiff_of_mem rfl + intro s hs + rcases le_or_gt 1 s.re with one_le|lt_one + · exact riemannZeta_ne_zero_of_one_le_re one_le + rw [← re_add_im s] + have := Complex.mem_reProdIm.mp hs.1 + rcases lt_or_ge 3 |s.im| with gt3|le3 + · apply restOfZetaZeroFree _ _ gt3 + refine ⟨?_, lt_one⟩ + calc + _ ≤ 1 - A₀ / Real.log T ^ 1 := by + gcongr + · exact A_inter.1.le + · bound + · bound + · bound + · exact abs_le.mpr ⟨this.2.1, this.2.2⟩ + _ ≤ _:= by exact this.1.1 + + · apply noZerosInBox _ le3 + calc + _ ≥ 1 - A₀ / Real.log T ^ 1 := by exact this.1.1 + _ ≥ 1 - A₀ / Real.log 3 ^ 1 := by + gcongr + apply le_min A_inter.1.le + bound + _ ≥ 1 - (((1 - σ₁) * Real.log 3 ^ 1)) / Real.log 3 ^ 1:= by + gcongr + apply min_le_right + _ = _ := by field_simp; ring + +end Erdos970 diff --git a/lakefile.toml b/lakefile.toml index 3bf8290..2fecc18 100644 --- a/lakefile.toml +++ b/lakefile.toml @@ -1,16 +1,6 @@ - -name = "StrongPNT" -version = "0.1.0" -defaultTargets = ["StrongPNT"] - -[leanOptions] -pp.unicode.fun = true -autoImplicit = false -relaxedAutoImplicit = false -linter.unusedVariables = false - -[[lean_lib]] name = "StrongPNT" +version = "0.1.0" +defaultTargets = ["StrongPNTErdos970"] [[require]] name = "mathlib" @@ -30,3 +20,8 @@ git = "https://github.com/PatrickMassot/checkdecls.git" name = "«doc-gen4»" git = "https://github.com/leanprover/doc-gen4" rev = "v4.21.0" + +[[lean_lib]] +name = "StrongPNTErdos970" +roots = ["StrongPNT.Erdos970"] +globs = ["StrongPNT.Erdos970.*"] diff --git a/lean-toolchain b/lean-toolchain index 980709b..ba8ebf2 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:v4.21.0 +leanprover/lean4:v4.34.1