import F04Riemann.FiniteChainBounds import F04Riemann.WorkedExamples /-! # Symmetric `LDLᵀ` / Schur-Complement Certification and 3- & 7-Window Certificates (`N = 64`, `L = 1/20`) This module formalizes the Schur-complement / `LDLᵀ` matrix positivity criterion and certifies both infinite-dimensional multi-window examples from `riemann-reconstruction-2026-10-14`: 1. **General `LDLᵀ` Positivity & Entrywise Monotonicity**: - `quadForm_eq_ldl_sum`: if `M = L diag(D) Lᵀ`, then `quadForm M z = ∑ k, D k * (∑ i, L i k * z i)^2`. - `quadForm_ge_of_ldl`: if `M - ε I = L diag(D) Lᵀ` with `0 ≤ D k`, then `ε * ∑ i, z_i^2 ≤ quadForm M z`. - `quadForm_gt_of_unit_lower_ldl`: if `0 < D k` and `L` is unit lower triangular, the inequality is strict for every nonzero `z`. - `quadForm_mono_entrywise_nonneg`: if `M₁ i j ≤ M₂ i j` entrywise, then `quadForm M₁ v ≤ quadForm M₂ v` for every nonnegative vector `v ≥ 0`. 2. **Kernel-Checked Sharp Bounds for `m_chain 64 (1/20)`**: - `pi_gt_3141`, `pi_lt_3142`, `eulerGamma_le_H10_sub_log_21_div_2`, `weilWeight_ge_inv_add_49_100`, `m_func_one_twentieth_gt`, `chainContrib_32_one_twentieth_gt`, and `m_chain_64_one_twentieth_gt : (1175 / 1000 : ℝ) < m_chain 64 (1 / 20)`. 3. **Kernel-Checked 3-Window Certificate (`N = 64`, `L = 1/20`, `ε = 1/4`)**: - `certified_three_window_L_one_twentieth`: centers `0, 7/10, 7/5` (span `29/20`), prime-linked triangle `{2, 4, 2}`, exact `3 × 3` rational `LDLᵀ` pivots all positive, proving `(1/4) * normSq (∑ i, c_i • φ_i) ≤ Q_form (∑ i, c_i • φ_i)`. 4. **Kernel-Checked 7-Window / 21-Edge Certificate (`N = 64`, `L = 1/20`, `ε = 1/100`)**: - `certified_seven_window_L_one_twentieth`: centers `0, 2/5, 7/10, 6/5, 8/5, 2, 12/5` (span `49/20`, all 21 mixed edges retained, prime links `{2}`, `{5}`, `{11}`), exact `7 × 7` rational `LDLᵀ` factorization with all 7 Schur pivots strictly positive, proving `(1/100) * normSq (∑ i, c_i • φ_i) ≤ Q_form (∑ i, c_i • φ_i)`. - `seven_window_row0_prime_sum_gt`: proves that row 0's prime-power sum alone already exceeds `19/10` (above `m_chain 64 (1/20) ≈ 1.182`), illustrating why full `LDLᵀ` / Schur pivots are needed where row dominance fails. -/ namespace F04Riemann open Real Complex MeasureTheory Set Finset Filter Topology /-! ### 1. General Symmetric `LDLᵀ` Positivity and Entrywise Monotonicity -/ /-- Exact sum-of-squares expansion of a quadratic form from an `LDLᵀ` factorization `M i j = ∑ k, L i k * D k * L j k`. -/ theorem quadForm_eq_ldl_sum {r : ℕ} (M L : Matrix (Fin r) (Fin r) ℝ) (D : Fin r → ℝ) (hfac : ∀ i j : Fin r, M i j = ∑ k : Fin r, L i k * D k * L j k) (z : Fin r → ℝ) : quadForm M z = ∑ k : Fin r, D k * (∑ i : Fin r, L i k * z i) ^ 2 := by unfold quadForm have h1 : ∑ i : Fin r, ∑ j : Fin r, z i * M i j * z j = ∑ i : Fin r, ∑ j : Fin r, ∑ k : Fin r, D k * (L i k * z i) * (L j k * z j) := by refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) rw [hfac i j, Finset.mul_sum, Finset.sum_mul] refine Finset.sum_congr rfl (fun k _ => by ring) rw [h1] have hswap1 : ∑ i : Fin r, ∑ j : Fin r, ∑ k : Fin r, D k * (L i k * z i) * (L j k * z j) = ∑ i : Fin r, ∑ k : Fin r, ∑ j : Fin r, D k * (L i k * z i) * (L j k * z j) := Finset.sum_congr rfl (fun i _ => Finset.sum_comm) rw [hswap1, Finset.sum_comm] refine Finset.sum_congr rfl (fun k _ => ?_) rw [sq, Finset.sum_mul, Finset.mul_sum] refine Finset.sum_congr rfl (fun i _ => ?_) rw [Finset.mul_sum, Finset.mul_sum] refine Finset.sum_congr rfl (fun j _ => by ring) /-- If `M - ε I = L diag(D) Lᵀ` with all pivots `D k ≥ 0`, then `ε ∑ z_i^2 ≤ zᵀ M z` for every `z : Fin r → ℝ`. -/ theorem quadForm_ge_of_ldl {r : ℕ} (M L : Matrix (Fin r) (Fin r) ℝ) (D : Fin r → ℝ) (ε : ℝ) (hfac : ∀ i j : Fin r, M i j - (if i = j then ε else 0) = ∑ k : Fin r, L i k * D k * L j k) (hD : ∀ k : Fin r, 0 ≤ D k) (z : Fin r → ℝ) : ε * ∑ i : Fin r, z i ^ 2 ≤ quadForm M z := by let S : Matrix (Fin r) (Fin r) ℝ := Matrix.of fun i j => M i j - (if i = j then ε else 0) have hS_quad : quadForm S z = quadForm M z - ε * ∑ i : Fin r, z i ^ 2 := by unfold quadForm have hsplit : ∀ i : Fin r, ∑ j : Fin r, z i * S i j * z j = (∑ j : Fin r, z i * M i j * z j) - ε * z i ^ 2 := by intro i have hterm : ∀ j : Fin r, z i * S i j * z j = z i * M i j * z j - (if i = j then ε * z i ^ 2 else 0) := by intro j simp only [S, Matrix.of_apply] split_ifs with h · subst h; ring · ring simp_rw [hterm, Finset.sum_sub_distrib] congr 1 rw [Finset.sum_ite_eq Finset.univ i] simp simp_rw [hsplit, Finset.sum_sub_distrib, Finset.mul_sum] have hS_nn : 0 ≤ quadForm S z := by rw [quadForm_eq_ldl_sum S L D (fun i j => hfac i j) z] exact Finset.sum_nonneg (fun k _ => mul_nonneg (hD k) (sq_nonneg _)) linarith /-- Strict `LDLᵀ` positivity: if `M - ε I = L diag(D) Lᵀ` with strictly positive pivots `D k > 0` and unit lower triangular `L`, then `ε ∑ z_i^2 < zᵀ M z` for every nonzero `z`. -/ theorem quadForm_gt_of_unit_lower_ldl {r : ℕ} (M L : Matrix (Fin r) (Fin r) ℝ) (D : Fin r → ℝ) (ε : ℝ) (hfac : ∀ i j : Fin r, M i j - (if i = j then ε else 0) = ∑ k : Fin r, L i k * D k * L j k) (hD : ∀ k : Fin r, 0 < D k) (hL_diag : ∀ k : Fin r, L k k = 1) (hL_lower : ∀ i k : Fin r, i < k → L i k = 0) {z : Fin r → ℝ} (hz : ∃ i : Fin r, z i ≠ 0) : ε * ∑ i : Fin r, z i ^ 2 < quadForm M z := by let S : Matrix (Fin r) (Fin r) ℝ := Matrix.of fun i j => M i j - (if i = j then ε else 0) have hS_quad : quadForm S z = quadForm M z - ε * ∑ i : Fin r, z i ^ 2 := by unfold quadForm have hsplit : ∀ i : Fin r, ∑ j : Fin r, z i * S i j * z j = (∑ j : Fin r, z i * M i j * z j) - ε * z i ^ 2 := by intro i have hterm : ∀ j : Fin r, z i * S i j * z j = z i * M i j * z j - (if i = j then ε * z i ^ 2 else 0) := by intro j simp only [S, Matrix.of_apply] split_ifs with h · subst h; ring · ring simp_rw [hterm, Finset.sum_sub_distrib] congr 1 rw [Finset.sum_ite_eq Finset.univ i] simp simp_rw [hsplit, Finset.sum_sub_distrib, Finset.mul_sum] -- Pick the largest index `k₀` where `z k₀ ≠ 0`. Then `∑ i, L i k₀ * z i = z k₀ ≠ 0`. let nz : Finset (Fin r) := Finset.univ.filter (fun i => z i ≠ 0) have hnz_ne : nz.Nonempty := by obtain ⟨i, hi⟩ := hz exact ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩⟩ let k₀ : Fin r := nz.max' hnz_ne have hk₀_mem : k₀ ∈ nz := Finset.max'_mem nz hnz_ne have hk₀_ne : z k₀ ≠ 0 := (Finset.mem_filter.mp hk₀_mem).2 have hk₀_max : ∀ i : Fin r, k₀ < i → z i = 0 := by intro i hi by_contra hne have hle : i ≤ k₀ := Finset.le_max' nz i (Finset.mem_filter.mpr ⟨Finset.mem_univ i, hne⟩) exact not_lt_of_ge hle hi have hlin_k₀ : ∑ i : Fin r, L i k₀ * z i = z k₀ := by rw [Finset.sum_eq_single k₀] · rw [hL_diag k₀, one_mul] · intro i _ hne rcases lt_or_gt_of_ne hne with hlt | hgt · rw [hL_lower i k₀ hlt, zero_mul] · rw [hk₀_max i hgt, mul_zero] · intro habs; exact False.elim (habs (Finset.mem_univ k₀)) have hS_pos : 0 < quadForm S z := by rw [quadForm_eq_ldl_sum S L D (fun i j => hfac i j) z] refine Finset.sum_pos' (fun k _ => mul_nonneg (le_of_lt (hD k)) (sq_nonneg _)) ?_ refine ⟨k₀, Finset.mem_univ k₀, ?_⟩ rw [hlin_k₀] exact mul_pos (hD k₀) (sq_pos_of_ne_zero hk₀_ne) linarith /-- Entrywise comparison for quadratic forms on nonnegative vectors: if `M₁ i j ≤ M₂ i j` for all `i, j` and `v i ≥ 0`, then `quadForm M₁ v ≤ quadForm M₂ v`. -/ theorem quadForm_mono_entrywise_nonneg {r : ℕ} (M₁ M₂ : Matrix (Fin r) (Fin r) ℝ) (hle : ∀ i j : Fin r, M₁ i j ≤ M₂ i j) {v : Fin r → ℝ} (hv : ∀ i : Fin r, 0 ≤ v i) : quadForm M₁ v ≤ quadForm M₂ v := by unfold quadForm refine Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => ?_)) have h1 : v i * M₁ i j ≤ v i * M₂ i j := mul_le_mul_of_nonneg_left (hle i j) (hv i) exact mul_le_mul_of_nonneg_right h1 (hv j) /-! ### 2. Kernel-Checked Sharp Bounds for `π`, `γ_E`, `w(t)`, and `m_chain 64 (1/20)` -/ /-- Taylor lower/upper chain for `sin` and `cos` up to degree 10 on `[0, ∞)`. -/ lemma cos_taylor_bounds_deg10 {x : ℝ} (hx : 0 ≤ x) : 1 - x ^ 2 / 2 + x ^ 4 / 24 - x ^ 6 / 720 + x ^ 8 / 40320 - x ^ 10 / 3628800 ≤ Real.cos x ∧ Real.cos x ≤ 1 - x ^ 2 / 2 + x ^ 4 / 24 - x ^ 6 / 720 + x ^ 8 / 40320 := by have h1 : ∀ t ≥ 0, Real.sin t ≤ t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => Real.hasDerivAt_sin s) (fun s _ => hasDerivAt_id' s) Real.continuous_cos continuous_const (fun s _ => Real.cos_le_one s) (by simp) linarith have h2 : ∀ t ≥ 0, 1 - t ^ 2 / 2 ≤ Real.cos t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (fun s _ => by have hd := (hasDerivAt_pow 2 s).div_const 2 have hv : (2 : ℕ) * s ^ (2 - 1) / 2 = s := by push_cast; ring rwa [hv] at hd) Real.continuous_sin continuous_id (fun s hs => h1 s hs.1) (by simp) linarith have h3 : ∀ t ≥ 0, t - t ^ 3 / 6 ≤ Real.sin t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by have hd := (hasDerivAt_id' s).sub ((hasDerivAt_pow 3 s).div_const 6) have hv : 1 - (3 : ℕ) * s ^ (3 - 1) / 6 = 1 - s ^ 2 / 2 := by push_cast; ring rwa [hv] at hd) (fun s _ => Real.hasDerivAt_sin s) (continuous_const.sub ((continuous_pow 2).div_const 2)) Real.continuous_cos (fun s hs => h2 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h4 : ∀ t ≥ 0, Real.cos t ≤ 1 - t ^ 2 / 2 + t ^ 4 / 24 := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by have hd := ((hasDerivAt_pow 2 s).div_const 2).sub ((hasDerivAt_pow 4 s).div_const 24) have hv : (2 : ℕ) * s ^ (2 - 1) / 2 - (4 : ℕ) * s ^ (4 - 1) / 24 = s - s ^ 3 / 6 := by push_cast; ring rwa [hv] at hd) (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (continuous_id.sub ((continuous_pow 3).div_const 6)) Real.continuous_sin (fun s hs => h3 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h5 : ∀ t ≥ 0, Real.sin t ≤ t - t ^ 3 / 6 + t ^ 5 / 120 := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => Real.hasDerivAt_sin s) (fun s _ => by have hd := ((hasDerivAt_id' s).sub ((hasDerivAt_pow 3 s).div_const 6)).add ((hasDerivAt_pow 5 s).div_const 120) have hv : 1 - (3 : ℕ) * s ^ (3 - 1) / 6 + (5 : ℕ) * s ^ (5 - 1) / 120 = 1 - s ^ 2 / 2 + s ^ 4 / 24 := by push_cast; ring rwa [hv] at hd) Real.continuous_cos ((continuous_const.sub ((continuous_pow 2).div_const 2)).add ((continuous_pow 4).div_const 24)) (fun s hs => h4 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h6 : ∀ t ≥ 0, 1 - t ^ 2 / 2 + t ^ 4 / 24 - t ^ 6 / 720 ≤ Real.cos t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (fun s _ => by have hd := (((hasDerivAt_pow 2 s).div_const 2).sub ((hasDerivAt_pow 4 s).div_const 24)).add ((hasDerivAt_pow 6 s).div_const 720) have hv : (2 : ℕ) * s ^ (2 - 1) / 2 - (4 : ℕ) * s ^ (4 - 1) / 24 + (6 : ℕ) * s ^ (6 - 1) / 720 = s - s ^ 3 / 6 + s ^ 5 / 120 := by push_cast; ring rwa [hv] at hd) Real.continuous_sin ((continuous_id.sub ((continuous_pow 3).div_const 6)).add ((continuous_pow 5).div_const 120)) (fun s hs => h5 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h7 : ∀ t ≥ 0, t - t ^ 3 / 6 + t ^ 5 / 120 - t ^ 7 / 5040 ≤ Real.sin t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by have hd := (((hasDerivAt_id' s).sub ((hasDerivAt_pow 3 s).div_const 6)).add ((hasDerivAt_pow 5 s).div_const 120)).sub ((hasDerivAt_pow 7 s).div_const 5040) have hv : 1 - (3 : ℕ) * s ^ (3 - 1) / 6 + (5 : ℕ) * s ^ (5 - 1) / 120 - (7 : ℕ) * s ^ (7 - 1) / 5040 = 1 - s ^ 2 / 2 + s ^ 4 / 24 - s ^ 6 / 720 := by push_cast; ring rwa [hv] at hd) (fun s _ => Real.hasDerivAt_sin s) (((continuous_const.sub ((continuous_pow 2).div_const 2)).add ((continuous_pow 4).div_const 24)).sub ((continuous_pow 6).div_const 720)) Real.continuous_cos (fun s hs => h6 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h8 : ∀ t ≥ 0, Real.cos t ≤ 1 - t ^ 2 / 2 + t ^ 4 / 24 - t ^ 6 / 720 + t ^ 8 / 40320 := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by have hd := ((((hasDerivAt_pow 2 s).div_const 2).sub ((hasDerivAt_pow 4 s).div_const 24)).add ((hasDerivAt_pow 6 s).div_const 720)).sub ((hasDerivAt_pow 8 s).div_const 40320) have hv : (2 : ℕ) * s ^ (2 - 1) / 2 - (4 : ℕ) * s ^ (4 - 1) / 24 + (6 : ℕ) * s ^ (6 - 1) / 720 - (8 : ℕ) * s ^ (8 - 1) / 40320 = s - s ^ 3 / 6 + s ^ 5 / 120 - s ^ 7 / 5040 := by push_cast; ring rwa [hv] at hd) (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (((continuous_id.sub ((continuous_pow 3).div_const 6)).add ((continuous_pow 5).div_const 120)).sub ((continuous_pow 7).div_const 5040)) Real.continuous_sin (fun s hs => h7 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h9 : ∀ t ≥ 0, Real.sin t ≤ t - t ^ 3 / 6 + t ^ 5 / 120 - t ^ 7 / 5040 + t ^ 9 / 362880 := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => Real.hasDerivAt_sin s) (fun s _ => by have hd := ((((hasDerivAt_id' s).sub ((hasDerivAt_pow 3 s).div_const 6)).add ((hasDerivAt_pow 5 s).div_const 120)).sub ((hasDerivAt_pow 7 s).div_const 5040)).add ((hasDerivAt_pow 9 s).div_const 362880) have hv : 1 - (3 : ℕ) * s ^ (3 - 1) / 6 + (5 : ℕ) * s ^ (5 - 1) / 120 - (7 : ℕ) * s ^ (7 - 1) / 5040 + (9 : ℕ) * s ^ (9 - 1) / 362880 = 1 - s ^ 2 / 2 + s ^ 4 / 24 - s ^ 6 / 720 + s ^ 8 / 40320 := by push_cast; ring rwa [hv] at hd) Real.continuous_cos ((((continuous_const.sub ((continuous_pow 2).div_const 2)).add ((continuous_pow 4).div_const 24)).sub ((continuous_pow 6).div_const 720)).add ((continuous_pow 8).div_const 40320)) (fun s hs => h8 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h10 : ∀ t ≥ 0, 1 - t ^ 2 / 2 + t ^ 4 / 24 - t ^ 6 / 720 + t ^ 8 / 40320 - t ^ 10 / 3628800 ≤ Real.cos t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (fun s _ => by have hd := (((((hasDerivAt_pow 2 s).div_const 2).sub ((hasDerivAt_pow 4 s).div_const 24)).add ((hasDerivAt_pow 6 s).div_const 720)).sub ((hasDerivAt_pow 8 s).div_const 40320)).add ((hasDerivAt_pow 10 s).div_const 3628800) have hv : (2 : ℕ) * s ^ (2 - 1) / 2 - (4 : ℕ) * s ^ (4 - 1) / 24 + (6 : ℕ) * s ^ (6 - 1) / 720 - (8 : ℕ) * s ^ (8 - 1) / 40320 + (10 : ℕ) * s ^ (10 - 1) / 3628800 = s - s ^ 3 / 6 + s ^ 5 / 120 - s ^ 7 / 5040 + s ^ 9 / 362880 := by push_cast; ring rwa [hv] at hd) Real.continuous_sin ((((continuous_id.sub ((continuous_pow 3).div_const 6)).add ((continuous_pow 5).div_const 120)).sub ((continuous_pow 7).div_const 5040)).add ((continuous_pow 9).div_const 362880)) (fun s hs => h9 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith exact ⟨h10 x hx, h8 x hx⟩ lemma one_sub_cos_ge_taylor {x : ℝ} (hx : 0 ≤ x) : x ^ 2 / 2 - x ^ 4 / 24 ≤ 1 - Real.cos x := by have h1 : ∀ t ≥ 0, Real.sin t ≤ t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => Real.hasDerivAt_sin s) (fun s _ => hasDerivAt_id' s) Real.continuous_cos continuous_const (fun s _ => Real.cos_le_one s) (by simp) linarith have h2 : ∀ t ≥ 0, 1 - t ^ 2 / 2 ≤ Real.cos t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (fun s _ => by have hd := (hasDerivAt_pow 2 s).div_const 2 have hv : (2 : ℕ) * s ^ (2 - 1) / 2 = s := by push_cast; ring rwa [hv] at hd) Real.continuous_sin continuous_id (fun s hs => h1 s hs.1) (by simp) linarith have h3 : ∀ t ≥ 0, t - t ^ 3 / 6 ≤ Real.sin t := fun t ht => by have := sub_le_of_deriv_le ht (fun s _ => by have hd := (hasDerivAt_id' s).sub ((hasDerivAt_pow 3 s).div_const 6) have hv : 1 - (3 : ℕ) * s ^ (3 - 1) / 6 = 1 - s ^ 2 / 2 := by push_cast; ring rwa [hv] at hd) (fun s _ => Real.hasDerivAt_sin s) (continuous_const.sub ((continuous_pow 2).div_const 2)) Real.continuous_cos (fun s hs => h2 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at this; linarith have h4 := sub_le_of_deriv_le hx (fun s _ => by have hd := ((hasDerivAt_pow 2 s).div_const 2).sub ((hasDerivAt_pow 4 s).div_const 24) have hv : (2 : ℕ) * s ^ (2 - 1) / 2 - (4 : ℕ) * s ^ (4 - 1) / 24 = s - s ^ 3 / 6 := by push_cast; ring rwa [hv] at hd) (fun s _ => by simpa using (Real.hasDerivAt_cos s).const_sub 1) (continuous_id.sub ((continuous_pow 3).div_const 6)) Real.continuous_sin (fun s hs => h3 s hs.1) (by simp) dsimp only [Pi.sub_apply, Pi.add_apply] at h4; linarith /-- Elementary lower bound `2 ≤ π` from `π/4 = arctan 1 = ∫_0^1 (1 + t^2)⁻¹ dt ≥ 1/2`. -/ lemma two_le_pi_elem : (2 : ℝ) ≤ Real.pi := by have hftc := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hasDerivAt_arctan t) ((continuous_const.div (continuous_const.add (continuous_pow 2)) (fun t => ne_of_gt (one_add_sq_pos t))).intervalIntegrable 0 1) rw [arctan_one, arctan_zero, sub_zero] at hftc have hge : ∫ _t in (0 : ℝ)..1, (1 / 2 : ℝ) ≤ ∫ t in (0 : ℝ)..1, 1 / (1 + t ^ 2) := by refine intervalIntegral.integral_mono_on zero_le_one (continuous_const.intervalIntegrable 0 1) ((continuous_const.div (continuous_const.add (continuous_pow 2)) (fun t => ne_of_gt (one_add_sq_pos t))).intervalIntegrable 0 1) (fun t ht => ?_) rw [div_le_div_iff₀ (by norm_num) (one_add_sq_pos t)] nlinarith [ht.1, ht.2] have hhalf : ∫ _t in (0 : ℝ)..1, (1 / 2 : ℝ) = 1 / 2 := by rw [intervalIntegral.integral_const, smul_eq_mul]; norm_num linarith /-- Sharp rational lower bound `3.141 < π`. -/ lemma pi_gt_3141 : (3141 / 1000 : ℝ) < Real.pi := by have hcos_pos : 0 < Real.cos (15705 / 10000 : ℝ) := by have h := (cos_taylor_bounds_deg10 (x := 15705 / 10000) (by norm_num)).1 have hnum : (0 : ℝ) < 1 - (15705 / 10000 : ℝ) ^ 2 / 2 + (15705 / 10000) ^ 4 / 24 - (15705 / 10000) ^ 6 / 720 + (15705 / 10000) ^ 8 / 40320 - (15705 / 10000) ^ 10 / 3628800 := by norm_num linarith by_contra hle push Not at hle have hcos_nonpos : Real.cos (15705 / 10000 : ℝ) ≤ 0 := Real.cos_nonpos_of_pi_div_two_le_of_le (by linarith) (by linarith [two_le_pi_elem]) linarith /-- Sharp rational upper bound `π < 3.142`. -/ lemma pi_lt_3142 : Real.pi < 3142 / 1000 := by have hcos_neg : Real.cos (1571 / 1000 : ℝ) < 0 := by have h := (cos_taylor_bounds_deg10 (x := 1571 / 1000) (by norm_num)).2 have hnum : (1 : ℝ) - (1571 / 1000) ^ 2 / 2 + (1571 / 1000) ^ 4 / 24 - (1571 / 1000) ^ 6 / 720 + (1571 / 1000) ^ 8 / 40320 < 0 := by norm_num linarith by_contra hge push Not at hge rcases eq_or_lt_of_le (show (1571 / 1000 : ℝ) ≤ Real.pi / 2 by linarith) with heq | hlt · rw [heq, Real.cos_pi_div_two] at hcos_neg; linarith · have hpos := Real.cos_pos_of_mem_Ioo (⟨by linarith [Real.pi_pos], hlt⟩ : (1571 / 1000 : ℝ) ∈ Ioo (-(Real.pi / 2)) (Real.pi / 2)) linarith /-- Elementary hyperbolic-tangent log bound: `2 u + (2 / 3) u^3 ≤ log((1 + u) / (1 - u))` for `0 ≤ u < 1`. -/ lemma log_one_add_div_one_sub_ge {u : ℝ} (hu0 : 0 ≤ u) (hu1 : u < 1) : 2 * u + (2 / 3) * u ^ 3 ≤ Real.log ((1 + u) / (1 - u)) := by have hf : ∀ s ∈ Icc (0 : ℝ) u, HasDerivAt (fun t => 2 * t + (2 / 3) * t ^ 3) (2 + 2 * s ^ 2) s := fun s _ => by have h1 := ((hasDerivAt_id' s).const_mul 2).add (((hasDerivAt_pow 3 s).const_mul (2 / 3))) have hv : 2 * 1 + (2 / 3 : ℝ) * ((3 : ℕ) * s ^ (3 - 1)) = 2 + 2 * s ^ 2 := by push_cast; ring rwa [hv] at h1 have hg : ∀ s ∈ Icc (0 : ℝ) u, HasDerivAt (fun t => Real.log ((1 + t) / (1 - t))) (2 / (1 - s ^ 2)) s := by intro s hs have hp : 0 < 1 + s := by linarith [hs.1] have hm : 0 < 1 - s := by linarith [hs.2] have h1 := HasDerivAt.comp s (hasDerivAt_log_pos hp) ((hasDerivAt_id' s).const_add 1) have h2 := HasDerivAt.comp s (hasDerivAt_log_pos hm) ((hasDerivAt_id' s).const_sub 1) have hsub := h1.sub h2 have heq : (fun t => Real.log ((1 + t) / (1 - t))) =ᶠ[𝓝 s] (fun t => Real.log (1 + t) - Real.log (1 - t)) := by have hopen : IsOpen (Ioo (-1 : ℝ) 1) := isOpen_Ioo have hmem : s ∈ Ioo (-1 : ℝ) 1 := ⟨by linarith [hs.1], lt_of_le_of_lt hs.2 hu1⟩ filter_upwards [hopen.mem_nhds hmem] with t ht rw [Real.log_div (by linarith [ht.1]) (by linarith [ht.2])] have hcomb := hsub.congr_of_eventuallyEq heq have hval : (1 + s)⁻¹ * 1 - (1 - s)⁻¹ * (-1) = 2 / (1 - s ^ 2) := by have h1ms : 1 - s ^ 2 ≠ 0 := by nlinarith [hs.1, hs.2, hu1] have hp' : 1 + s ≠ 0 := ne_of_gt hp have hm' : 1 - s ≠ 0 := ne_of_gt hm field_simp; ring rwa [hval] at hcomb have hint_f : IntervalIntegrable (fun s : ℝ => 2 + 2 * s ^ 2) volume 0 u := (continuous_const.add (continuous_const.mul (continuous_pow 2))).intervalIntegrable 0 u have hint_g : IntervalIntegrable (fun s : ℝ => 2 / (1 - s ^ 2)) volume 0 u := by refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hu0] refine ContinuousOn.div continuousOn_const (continuous_const.sub (continuous_pow 2)).continuousOn (fun s hs => ?_) nlinarith [hs.1, hs.2, hu1] have hftc_f := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun s hs => hf s (by rwa [uIcc_of_le hu0] at hs)) hint_f have hftc_g := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun s hs => hg s (by rwa [uIcc_of_le hu0] at hs)) hint_g have hmono := intervalIntegral.integral_mono_on hu0 hint_f hint_g (fun s hs => by have hden : 0 < 1 - s ^ 2 := by nlinarith [hs.1, hs.2, hu1] rw [le_div_iff₀ hden] nlinarith [sq_nonneg (s ^ 2)]) simp only [mul_zero, zero_pow three_ne_zero, add_zero, sub_zero, div_one, Real.log_one] at hftc_f hftc_g linarith /-- Sharp midpoint upper bound for `eulerGamma`: the sequence `H_{n+1} - log(n + 3/2)` is antitone and converges to `eulerGamma`, yielding `γ_E ≤ 7381/2520 - log(21/2) ≈ 0.57759`. -/ lemma eulerGamma_le_H10_sub_log_21_div_2 : eulerGamma ≤ 7381 / 2520 - Real.log (21 / 2) := by let g : ℕ → ℝ := fun n => (∑ k ∈ Finset.range (n + 1), (1 : ℝ) / ((k : ℝ) + 1)) - Real.log ((n : ℝ) + 3 / 2) have hg_anti : Antitone g := by refine antitone_nat_of_succ_le (fun n => ?_) change (∑ k ∈ Finset.range (n + 2), (1 : ℝ) / ((k : ℝ) + 1)) - Real.log (((n + 1 : ℕ) : ℝ) + 3 / 2) ≤ (∑ k ∈ Finset.range (n + 1), (1 : ℝ) / ((k : ℝ) + 1)) - Real.log ((n : ℝ) + 3 / 2) rw [Finset.sum_range_succ (n := n + 1)] push_cast set u : ℝ := 1 / (2 * (n : ℝ) + 4) have hu0 : 0 ≤ u := by positivity have hu1 : u < 1 := by simp only [u]; rw [div_lt_one (by positivity)]; linarith [Nat.cast_nonneg (α := ℝ) n] have hlog := log_one_add_div_one_sub_ge hu0 hu1 have hratio : (1 + u) / (1 - u) = ((n : ℝ) + 1 + 3 / 2) / ((n : ℝ) + 3 / 2) := by have h1mu : 1 - u ≠ 0 := ne_of_gt (by linarith) have h2 : (n : ℝ) + 3 / 2 ≠ 0 := by positivity rw [div_eq_div_iff h1mu h2] simp only [u] have h1 : (2 * (n : ℝ) + 4) ≠ 0 := by positivity field_simp [h1]; ring rw [hratio, Real.log_div (by positivity) (by positivity)] at hlog have h2u : (1 : ℝ) / ((n : ℝ) + 1 + 1) = 2 * u := by simp only [u]; have : (n : ℝ) + 1 + 1 ≠ 0 := by positivity field_simp; ring have hu3 : 0 ≤ (2 / 3 : ℝ) * u ^ 3 := by positivity linarith have hg_tend : Tendsto g atTop (𝓝 eulerGamma) := by have hdiff : ∀ n : ℕ, g n = eulerSeq n - Real.log (((n : ℝ) + 3 / 2) / ((n : ℝ) + 1)) := by intro n unfold eulerSeq simp only [g] rw [Real.log_div (by positivity) (by positivity)] ring have hratio_tend : Tendsto (fun n : ℕ => ((n : ℝ) + 3 / 2) / ((n : ℝ) + 1)) atTop (𝓝 1) := by have hrew : (fun n : ℕ => ((n : ℝ) + 3 / 2) / ((n : ℝ) + 1)) = fun n : ℕ => 1 + (1 / 2 : ℝ) / ((n : ℝ) + 1) := by ext n have hpos : (n : ℝ) + 1 ≠ 0 := by positivity field_simp; ring rw [hrew] have hinv : Tendsto (fun n : ℕ => (1 / 2 : ℝ) / ((n : ℝ) + 1)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_natCast_atTop_atTop) simpa using tendsto_const_nhds.add hinv have hlog_tend : Tendsto (fun n : ℕ => Real.log (((n : ℝ) + 3 / 2) / ((n : ℝ) + 1))) atTop (𝓝 0) := by have h := (hasDerivAt_log_pos zero_lt_one).continuousAt.tendsto.comp hratio_tend rwa [Real.log_one] at h have hsub := tendsto_eulerSeq.sub hlog_tend rw [sub_zero] at hsub exact hsub.congr (fun n => (hdiff n).symm) have hle' : eulerGamma ≤ g 9 := by refine le_of_tendsto hg_tend ?_ filter_upwards [Filter.eventually_ge_atTop 9] with n hn exact hg_anti hn have hH10 : ∑ k ∈ Finset.range 10, (1 : ℝ) / ((k : ℝ) + 1) = 7381 / 2520 := by norm_num [Finset.sum_range_succ] have hg9 : g 9 = 7381 / 2520 - Real.log (21 / 2) := by simp only [g, show (9 + 1 : ℕ) = 10 by rfl, hH10] norm_num linarith /-- Sharp arctangent difference bound: `arctan 1 - arctan x ≤ (1 - x) / (1 + x^2)` for `0 ≤ x ≤ 1`. -/ lemma arctan_one_sub_arctan_le_sharp {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : arctan 1 - arctan x ≤ (1 - x) / (1 + x ^ 2) := by have hftc := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _ => hasDerivAt_arctan t) ((continuous_const.div (continuous_const.add (continuous_pow 2)) (fun t => ne_of_gt (one_add_sq_pos t))).intervalIntegrable x 1) rw [← hftc] have hle : ∫ t in x..1, 1 / (1 + t ^ 2) ≤ ∫ _t in x..1, 1 / (1 + x ^ 2) := by refine intervalIntegral.integral_mono_on hx1 ((continuous_const.div (continuous_const.add (continuous_pow 2)) (fun t => ne_of_gt (one_add_sq_pos t))).intervalIntegrable x 1) (continuous_const.intervalIntegrable x 1) (fun t ht => ?_) have hsq : x ^ 2 ≤ t ^ 2 := by nlinarith [ht.1] exact one_div_le_one_div_of_le (one_add_sq_pos x) (by linarith) have hrhs : ∫ _t in x..1, (1 / (1 + x ^ 2) : ℝ) = (1 - x) / (1 + x ^ 2) := by rw [intervalIntegral.integral_const, smul_eq_mul]; ring linarith /-- Elementary polynomial lower bound on the Weil weight `w(t) = e^{t/2} / sinh t` on `(0, 1/20]`: `1 / t + 49 / 100 ≤ weilWeight t`. -/ lemma weilWeight_ge_inv_add_49_100 {t : ℝ} (ht0 : 0 < t) (ht1 : t ≤ 1 / 20) : 1 / t + 49 / 100 ≤ weilWeight t := by -- Step 1: `1 + x + x^2/2 ≤ exp x` for `x ≥ 0`. have hexp_ge : 1 + t / 2 + t ^ 2 / 8 ≤ Real.exp (t / 2) := by have h0 : ∀ s ≥ 0, (1 : ℝ) ≤ Real.exp s := fun s hs => Real.one_le_exp hs have h1 : ∀ s ≥ 0, 1 + s ≤ Real.exp s := fun s hs => by have := sub_le_of_deriv_le hs (fun r _ => (hasDerivAt_id' r).const_add 1) (fun r _ => Real.hasDerivAt_exp r) continuous_const Real.continuous_exp (fun r hr => h0 r hr.1) (by simp) linarith have h2 : ∀ s ≥ 0, 1 + s + s ^ 2 / 2 ≤ Real.exp s := fun s hs => by have := sub_le_of_deriv_le hs (fun r _ => by have hd := ((hasDerivAt_id' r).const_add 1).add ((hasDerivAt_pow 2 r).div_const 2) have hv : 1 + (2 : ℕ) * r ^ (2 - 1) / 2 = 1 + r := by push_cast; ring rwa [hv] at hd) (fun r _ => Real.hasDerivAt_exp r) (continuous_const.add continuous_id) Real.continuous_exp (fun r hr => h1 r hr.1) (by simp) dsimp only [Pi.add_apply] at this; linarith have := h2 (t / 2) (by linarith) linarith -- Step 2: `cosh s ≤ 6/5` on `[0, 1/20]`, hence `sinh t ≤ t + t^3 / 5`. have hcosh_le : ∀ s ∈ Icc (0 : ℝ) (1 / 20), Real.cosh s ≤ 6 / 5 := by intro s hs rw [Real.cosh_eq] have hneg_ge : 1 - s ≤ Real.exp (-s) := by have h := Real.add_one_le_exp (-s); linarith have hneg_pos : 0 < 1 - s := by linarith [hs.2] have hexp_s_le : Real.exp s ≤ 20 / 19 := by have hmul : (1 - s) * Real.exp s ≤ 1 := by have := mul_le_mul_of_nonneg_right hneg_ge (le_of_lt (Real.exp_pos s)) rwa [Real.exp_neg, inv_mul_cancel₀ (ne_of_gt (Real.exp_pos s))] at this have h19 : (19 / 20 : ℝ) ≤ 1 - s := by linarith [hs.2] nlinarith [Real.exp_pos s] have hneg_le : Real.exp (-s) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith [hs.1]) linarith have hsinh_le1 : ∀ s ∈ Icc (0 : ℝ) (1 / 20), Real.sinh s ≤ (6 / 5) * s := by intro s hs have := sub_le_of_deriv_le hs.1 (fun r _ => hasDerivAt_sinh_real r) (fun r _ => by simpa using (hasDerivAt_id' r).const_mul (6 / 5 : ℝ)) Real.continuous_cosh continuous_const (fun r hr => hcosh_le r ⟨hr.1, le_trans hr.2 hs.2⟩) (by simp) linarith have hcosh_le2 : ∀ s ∈ Icc (0 : ℝ) (1 / 20), Real.cosh s ≤ 1 + (3 / 5) * s ^ 2 := by intro s hs have := sub_le_of_deriv_le hs.1 (fun r _ => hasDerivAt_cosh_real r) (fun r _ => by have hd := ((hasDerivAt_pow 2 r).const_mul (3 / 5 : ℝ)).const_add 1 have hv : (3 / 5 : ℝ) * ((2 : ℕ) * r ^ (2 - 1)) = (6 / 5) * r := by push_cast; ring rwa [hv] at hd) Real.continuous_sinh (continuous_const.mul continuous_id) (fun r hr => hsinh_le1 r ⟨hr.1, le_trans hr.2 hs.2⟩) (by simp) linarith have hsinh_le : Real.sinh t ≤ t + t ^ 3 / 5 := by have := sub_le_of_deriv_le (le_of_lt ht0) (fun r _ => hasDerivAt_sinh_real r) (fun r _ => by have hd := (hasDerivAt_id' r).add ((hasDerivAt_pow 3 r).div_const 5) have hv : 1 + (3 : ℕ) * r ^ (3 - 1) / 5 = 1 + (3 / 5) * r ^ 2 := by push_cast; ring rwa [hv] at hd) Real.continuous_cosh (continuous_const.add (continuous_const.mul (continuous_pow 2))) (fun r hr => hcosh_le2 r ⟨hr.1, le_trans hr.2 ht1⟩) (by simp) dsimp only [Pi.add_apply] at this; linarith -- Step 3: Compare `(1/t + 49/100) * sinh t ≤ 1 + t/2 + t^2/8 ≤ exp(t/2)`. unfold weilWeight rw [le_div_iff₀ (sinh_pos_of_pos ht0)] have hpos_fac : 0 ≤ 1 / t + 49 / 100 := by positivity have hmul : (1 / t + 49 / 100) * Real.sinh t ≤ (1 / t + 49 / 100) * (t + t ^ 3 / 5) := mul_le_mul_of_nonneg_left hsinh_le hpos_fac have halg : (1 / t + 49 / 100) * (t + t ^ 3 / 5) = 1 + (49 / 100) * t + t ^ 2 / 5 + (49 / 500) * t ^ 3 := by field_simp [ne_of_gt ht0]; ring have hpoly : 1 + (49 / 100) * t + t ^ 2 / 5 + (49 / 500) * t ^ 3 ≤ 1 + t / 2 + t ^ 2 / 8 := by have hrem : (1 / 100 : ℝ) - (3 / 40) * t - (49 / 500) * t ^ 2 ≥ 0 := by nlinarith nlinarith linarith /-- Integral corollary on `(0, 1/20]`: `log(b / a) + (49 / 100) * (b - a) ≤ B(a) - B(b)`. -/ lemma B_func_diff_ge_log_add {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) (hb : b ≤ 1 / 20) : Real.log (b / a) + (49 / 100) * (b - a) ≤ B_func a - B_func b := by rw [← setIntegral_Ioc_weilWeight ha hab, ← intervalIntegral.integral_of_le hab] have hint_lhs : IntervalIntegrable (fun t : ℝ => 1 / t + 49 / 100) volume a b := by refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hab] exact (continuousOn_const.div continuousOn_id (fun t ht => ne_of_gt (lt_of_lt_of_le ha ht.1))).add continuousOn_const have hint_rhs : IntervalIntegrable weilWeight volume a b := by refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hab] exact continuousOn_weilWeight.mono (fun t ht => lt_of_lt_of_le ha ht.1) have hmono := intervalIntegral.integral_mono_on hab hint_lhs hint_rhs (fun t ht => weilWeight_ge_inv_add_49_100 (lt_of_lt_of_le ha ht.1) (le_trans ht.2 hb)) have hftc : ∫ t in a..b, (1 / t + 49 / 100 : ℝ) = Real.log (b / a) + (49 / 100) * (b - a) := by have hd : ∀ t ∈ uIcc a b, HasDerivAt (fun x => Real.log x + (49 / 100) * x) (1 / t + 49 / 100) t := by intro t ht rw [uIcc_of_le hab] at ht have h1 : HasDerivAt Real.log (1 / t) t := by rw [one_div]; exact hasDerivAt_log_pos (lt_of_lt_of_le ha ht.1) have h2 : HasDerivAt (fun x => (49 / 100 : ℝ) * x) (49 / 100) t := by simpa using (hasDerivAt_id' t).const_mul (49 / 100 : ℝ) exact h1.add h2 rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hd hint_lhs, Real.log_div (ne_of_gt (lt_of_lt_of_le ha hab)) (ne_of_gt ha)] ring linarith /-! ### 3. Generic Rational Taylor Helpers for `exp`, `log`, and `R_bound` -/ lemma exp_neg_pow_lt_of_taylor {x u : ℝ} {k : ℕ} (hx : 0 ≤ x) (hk : 1 ≤ k) (h1 : 1 - x / (k : ℝ) + (x / (k : ℝ)) ^ 2 / 2 - (x / (k : ℝ)) ^ 3 / 6 + (x / (k : ℝ)) ^ 4 / 24 - (x / (k : ℝ)) ^ 5 / 120 + (x / (k : ℝ)) ^ 6 / 720 < u) : Real.exp (-x) < u ^ k := by have hk_pos : (0 : ℝ) < (k : ℝ) := by exact_mod_cast (show 0 < k by omega) have hxk : 0 ≤ x / (k : ℝ) := div_nonneg hx (le_of_lt hk_pos) have htay := (exp_neg_taylor_bounds hxk).2 have hstep : Real.exp (-(x / (k : ℝ))) < u := lt_of_le_of_lt htay h1 have heq : Real.exp (-x) = Real.exp (-(x / (k : ℝ))) ^ k := by rw [← Real.exp_nat_mul]; congr 1; field_simp [ne_of_gt hk_pos] rw [heq] exact pow_lt_pow_left₀ hstep (le_of_lt (Real.exp_pos _)) (by omega) lemma exp_neg_pow_gt_of_taylor {x l : ℝ} {k : ℕ} (hx : 0 ≤ x) (hl : 0 ≤ l) (hk : 1 ≤ k) (h1 : l < 1 - x / (k : ℝ) + (x / (k : ℝ)) ^ 2 / 2 - (x / (k : ℝ)) ^ 3 / 6 + (x / (k : ℝ)) ^ 4 / 24 - (x / (k : ℝ)) ^ 5 / 120) : l ^ k < Real.exp (-x) := by have hk_pos : (0 : ℝ) < (k : ℝ) := by exact_mod_cast (show 0 < k by omega) have hxk : 0 ≤ x / (k : ℝ) := div_nonneg hx (le_of_lt hk_pos) have htay := (exp_neg_taylor_bounds hxk).1 have hstep : l < Real.exp (-(x / (k : ℝ))) := lt_of_lt_of_le h1 htay have heq : Real.exp (-x) = Real.exp (-(x / (k : ℝ))) ^ k := by rw [← Real.exp_nat_mul]; congr 1; field_simp [ne_of_gt hk_pos] rw [heq] exact pow_lt_pow_left₀ hstep hl (by omega) lemma log_gt_of_taylor {y q l : ℝ} {k : ℕ} (hy : 0 < y) (hq : 0 ≤ q) (hl : 0 ≤ l) (hk : 1 ≤ k) (h1 : l < 1 - q / (k : ℝ) + (q / (k : ℝ)) ^ 2 / 2 - (q / (k : ℝ)) ^ 3 / 6 + (q / (k : ℝ)) ^ 4 / 24 - (q / (k : ℝ)) ^ 5 / 120) (h2 : y⁻¹ < l ^ k) : q < Real.log y := by rw [← Real.exp_lt_exp, Real.exp_log hy] have hexp : y⁻¹ < Real.exp (-q) := lt_trans h2 (exp_neg_pow_gt_of_taylor hq hl hk h1) rw [Real.exp_neg] at hexp have hmul := mul_lt_mul_of_pos_right hexp (mul_pos hy (Real.exp_pos q)) have hL : y⁻¹ * (y * Real.exp q) = Real.exp q := by field_simp [ne_of_gt hy] have hR : (Real.exp q)⁻¹ * (y * Real.exp q) = y := by field_simp [ne_of_gt (Real.exp_pos q)] linarith lemma log_lt_of_taylor {y q u : ℝ} {k : ℕ} (hy : 0 < y) (hq : 0 ≤ q) (hk : 1 ≤ k) (h1 : 1 - q / (k : ℝ) + (q / (k : ℝ)) ^ 2 / 2 - (q / (k : ℝ)) ^ 3 / 6 + (q / (k : ℝ)) ^ 4 / 24 - (q / (k : ℝ)) ^ 5 / 120 + (q / (k : ℝ)) ^ 6 / 720 < u) (h2 : u ^ k < y⁻¹) : Real.log y < q := by rw [← Real.exp_lt_exp, Real.exp_log hy] have hexp : Real.exp (-q) < y⁻¹ := lt_trans (exp_neg_pow_lt_of_taylor hq hk h1) h2 rw [Real.exp_neg] at hexp have hmul := mul_lt_mul_of_pos_right hexp (mul_pos hy (Real.exp_pos q)) have hL : (Real.exp q)⁻¹ * (y * Real.exp q) = y := by field_simp [ne_of_gt (Real.exp_pos q)] have hR : y⁻¹ * (y * Real.exp q) = Real.exp q := by field_simp [ne_of_gt hy] linarith /-- Generic kernel-checked upper bound on `R_bound (1/20) (1/20) d` via degree-6 Taylor. -/ lemma R_bound_one_twentieth_lt_of_taylor {d u1 u2 tgt : ℝ} {k m : ℕ} (hd : 0 < d) (hk : 1 ≤ k) (hm : 1 ≤ m) (h1 : 1 - (5 * d / 2) / (k : ℝ) + ((5 * d / 2) / (k : ℝ)) ^ 2 / 2 - ((5 * d / 2) / (k : ℝ)) ^ 3 / 6 + ((5 * d / 2) / (k : ℝ)) ^ 4 / 24 - ((5 * d / 2) / (k : ℝ)) ^ 5 / 120 + ((5 * d / 2) / (k : ℝ)) ^ 6 / 720 < u1) (h2 : 1 - (2 * d) / (m : ℝ) + ((2 * d) / (m : ℝ)) ^ 2 / 2 - ((2 * d) / (m : ℝ)) ^ 3 / 6 + ((2 * d) / (m : ℝ)) ^ 4 / 24 - ((2 * d) / (m : ℝ)) ^ 5 / 120 + ((2 * d) / (m : ℝ)) ^ 6 / 720 < u2) (hu2 : u2 ^ m < 1) (htgt : (1 / 20 : ℝ) * (u1 ^ k / (1 - u2 ^ m)) < tgt) : R_bound (1 / 20) (1 / 20) d < tgt := by unfold R_bound rw [Real.sqrt_mul_self (by norm_num)] have he1 : Real.exp (-(5 * d / 2)) < u1 ^ k := exp_neg_pow_lt_of_taylor (by positivity) hk h1 have he2 : Real.exp (-(2 * d)) < u2 ^ m := exp_neg_pow_lt_of_taylor (by positivity) hm h2 have hden : 1 - u2 ^ m < 1 - Real.exp (-(2 * d)) := by linarith have hden_pos : 0 < 1 - u2 ^ m := by linarith have hu1_pos : 0 < u1 ^ k := lt_trans (Real.exp_pos _) he1 have hfrac : Real.exp (-(5 * d / 2)) / (1 - Real.exp (-(2 * d))) < u1 ^ k / (1 - u2 ^ m) := by calc Real.exp (-(5 * d / 2)) / (1 - Real.exp (-(2 * d))) < u1 ^ k / (1 - Real.exp (-(2 * d))) := div_lt_div_of_pos_right he1 (lt_trans hden_pos hden) _ < u1 ^ k / (1 - u2 ^ m) := div_lt_div_of_pos_left hu1_pos hden_pos hden linarith /-- Monotonicity of `R_bound (1/20) (1/20) d` in the gap `d > 0`. -/ lemma R_bound_one_twentieth_lt_of_le {d₁ d₂ tgt : ℝ} (hd₁ : 0 < d₁) (hle : d₁ ≤ d₂) (hbound : R_bound (1 / 20) (1 / 20) d₁ < tgt) : R_bound (1 / 20) (1 / 20) d₂ < tgt := by rcases eq_or_lt_of_le hle with rfl | hlt · exact hbound · unfold R_bound at hbound ⊢ have hanti := residualWeight_antiOn hd₁ (lt_trans hd₁ hlt) hlt unfold residualWeight at hanti rw [mul_div_assoc (2 : ℝ), mul_div_assoc (2 : ℝ)] at hanti rw [Real.sqrt_mul_self (by norm_num)] at hbound ⊢ linarith /-! ### 4. Kernel-Checked Lower Bound `1175 / 1000 < m_chain 64 (1 / 20)` -/ lemma m_func_one_twentieth_gt : (5537 / 10000 : ℝ) < m_func (1 / 20) := by unfold m_func B_func weilConstA have hL : (0 : ℝ) < 1 / 20 := by norm_num have hlog80 : Real.log 80 ≤ Real.log ((1 + Real.exp (-((1 / 20 : ℝ) / 2))) / (1 - Real.exp (-((1 / 20 : ℝ) / 2)))) := by have hr := ratio_ge_four_div hL have h80 : (4 : ℝ) / (1 / 20) = 80 := by norm_num rw [h80] at hr exact Real.log_le_log (by norm_num) hr have hq_lo : (9753 / 10000 : ℝ) < Real.exp (-((1 / 20 : ℝ) / 2)) := by have h := (exp_neg_taylor_bounds (x := 1 / 40) (by norm_num)).1 have hnorm : (1 / 20 : ℝ) / 2 = 1 / 40 := by norm_num rw [hnorm] have hnum : (9753 / 10000 : ℝ) < 1 - 1 / 40 + (1 / 40) ^ 2 / 2 - (1 / 40) ^ 3 / 6 + (1 / 40) ^ 4 / 24 - (1 / 40) ^ 5 / 120 := by norm_num linarith have hq_le1 : Real.exp (-((1 / 20 : ℝ) / 2)) ≤ 1 := Real.exp_le_one_iff.mpr (by norm_num) have hatan_ge : Real.pi / 2 - 2 * ((1 - 9753 / 10000) / (1 + (9753 / 10000) ^ 2)) ≤ 2 * arctan (Real.exp (-((1 / 20 : ℝ) / 2))) := by have hdiff := arctan_one_sub_arctan_le_sharp (le_of_lt (Real.exp_pos _)) hq_le1 rw [arctan_one] at hdiff have hnum_le : 1 - Real.exp (-((1 / 20 : ℝ) / 2)) ≤ 1 - 9753 / 10000 := by linarith have hden_ge : 1 + (9753 / 10000 : ℝ) ^ 2 ≤ 1 + Real.exp (-((1 / 20 : ℝ) / 2)) ^ 2 := by nlinarith have hdiv_le : (1 - Real.exp (-((1 / 20 : ℝ) / 2))) / (1 + Real.exp (-((1 / 20 : ℝ) / 2)) ^ 2) ≤ (1 - 9753 / 10000) / (1 + (9753 / 10000) ^ 2) := by calc (1 - Real.exp (-((1 / 20 : ℝ) / 2))) / (1 + Real.exp (-((1 / 20 : ℝ) / 2)) ^ 2) ≤ (1 - 9753 / 10000) / (1 + Real.exp (-((1 / 20 : ℝ) / 2)) ^ 2) := div_le_div_of_nonneg_right hnum_le (by positivity) _ ≤ (1 - 9753 / 10000) / (1 + (9753 / 10000) ^ 2) := div_le_div_of_nonneg_left (by norm_num) (by positivity) hden_ge linarith have hlog_comb : (3508 / 1000 : ℝ) < Real.log 80 - Real.log (8 * Real.pi) + Real.log (21 / 2) := by have heq : Real.log 80 - Real.log (8 * Real.pi) + Real.log (21 / 2) = Real.log (105 / Real.pi) := by rw [← Real.log_div (by norm_num) (by positivity), ← Real.log_mul (by positivity) (by norm_num)] congr 1; field_simp [ne_of_gt Real.pi_pos]; ring rw [heq] have hgt : (52500 / 1571 : ℝ) < 105 / Real.pi := by rw [div_lt_div_iff₀ (by norm_num) Real.pi_pos] linarith [pi_lt_3142] have hlog_rat : (3508 / 1000 : ℝ) < Real.log (52500 / 1571) := by exact log_gt_of_taylor (k := 7) (l := 6058 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) exact lt_trans hlog_rat (Real.log_lt_log (by norm_num) hgt) have hgam := eulerGamma_le_H10_sub_log_21_div_2 have hfinal : (5537 / 10000 : ℝ) < (3508 / 1000) - 7381 / 2520 - 2 * ((1 - 9753 / 10000) / (1 + (9753 / 10000) ^ 2)) := by norm_num linarith /-- Elementary rational lower bound for each `chainTerm n (1/20)` (`n ≥ 2`). -/ noncomputable def chainTermLower (n : ℕ) : ℝ := (if n = 2 then (1 / 2 : ℝ) else ((3141 / 1000 : ℝ) / ((n : ℝ) + 1)) ^ 2 / 2 - ((3141 / 1000 : ℝ) / ((n : ℝ) + 1)) ^ 4 / 24) * (2 / (2 * (n : ℝ) - 1) + (2 / 3) * (1 / (2 * (n : ℝ) - 1)) ^ 3 + (49 / 2000) * (1 / ((n : ℝ) - 1) - 1 / (n : ℝ))) lemma chainTermLower_le_chainTerm {n : ℕ} (hn : 2 ≤ n) : chainTermLower n ≤ chainTerm n (1 / 20) := by unfold chainTermLower chainTerm have hn_pos : (0 : ℝ) < (n : ℝ) := by exact_mod_cast (show 0 < n by omega) have hnm1_pos : (0 : ℝ) < (n : ℝ) - 1 := by have : (2 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn linarith have h2nm1_pos : (0 : ℝ) < 2 * (n : ℝ) - 1 := by linarith -- Factor 1: `1 - cos(π/(n+1))` lower bound. have hfac1 : (if n = 2 then (1 / 2 : ℝ) else ((3141 / 1000 : ℝ) / ((n : ℝ) + 1)) ^ 2 / 2 - ((3141 / 1000 : ℝ) / ((n : ℝ) + 1)) ^ 4 / 24) ≤ 1 - Real.cos (Real.pi / ((n : ℝ) + 1)) := by split_ifs with h2 · subst h2 have h3 : ((2 : ℕ) : ℝ) + 1 = 3 := by norm_num rw [h3, Real.cos_pi_div_three]; norm_num · set x := (3141 / 1000 : ℝ) / ((n : ℝ) + 1) have hx0 : 0 ≤ x := by positivity have hlt : x < Real.pi / ((n : ℝ) + 1) := div_lt_div_of_pos_right pi_gt_3141 (by positivity) have hle_pi : Real.pi / ((n : ℝ) + 1) ≤ Real.pi := by rw [div_le_iff₀ (by positivity)] nlinarith [Real.pi_pos] have hcos_lt : Real.cos (Real.pi / ((n : ℝ) + 1)) < Real.cos x := Real.strictAntiOn_cos ⟨hx0, le_trans (le_of_lt hlt) hle_pi⟩ ⟨le_of_lt (lt_of_le_of_lt hx0 hlt), hle_pi⟩ hlt linarith [one_sub_cos_ge_taylor hx0] have hfac1_nn : 0 ≤ (if n = 2 then (1 / 2 : ℝ) else ((3141 / 1000 : ℝ) / ((n : ℝ) + 1)) ^ 2 / 2 - ((3141 / 1000 : ℝ) / ((n : ℝ) + 1)) ^ 4 / 24) := by split_ifs with h2 · norm_num · have hn3 : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast (show 3 ≤ n by omega) set x := (3141 / 1000 : ℝ) / ((n : ℝ) + 1) have hx1 : x ≤ 1 := by simp only [x]; rw [div_le_one (by positivity)]; linarith have hx0 : 0 ≤ x := by positivity have hxsq : x ^ 2 ≤ 1 := by nlinarith nlinarith [sq_nonneg x] -- Factor 2: `B(L/n) - B(L/(n-1))` lower bound. have ha_pos : (0 : ℝ) < (1 / 20 : ℝ) / (n : ℝ) := div_pos (by norm_num) hn_pos have hab : (1 / 20 : ℝ) / (n : ℝ) ≤ (1 / 20 : ℝ) / ((n : ℝ) - 1) := div_le_div_of_nonneg_left (by norm_num) hnm1_pos (by linarith) have hb_le : (1 / 20 : ℝ) / ((n : ℝ) - 1) ≤ 1 / 20 := by rw [div_le_iff₀ hnm1_pos] have : (1 : ℝ) ≤ (n : ℝ) - 1 := by have : (2 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn linarith linarith have hB := B_func_diff_ge_log_add ha_pos hab hb_le have hu1 : (1 : ℝ) / (2 * (n : ℝ) - 1) < 1 := by rw [div_lt_one h2nm1_pos] have : (2 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn linarith have hratio : ((1 / 20 : ℝ) / ((n : ℝ) - 1)) / ((1 / 20 : ℝ) / (n : ℝ)) = (1 + 1 / (2 * (n : ℝ) - 1)) / (1 - 1 / (2 * (n : ℝ) - 1)) := by have h2n : 2 * (n : ℝ) - 1 ≠ 0 := ne_of_gt h2nm1_pos have hL_r : ((1 / 20 : ℝ) / ((n : ℝ) - 1)) / ((1 / 20 : ℝ) / (n : ℝ)) = (n : ℝ) / ((n : ℝ) - 1) := by field_simp [ne_of_gt hn_pos, ne_of_gt hnm1_pos] have h1p : 1 + (1 : ℝ) / (2 * (n : ℝ) - 1) = (2 * (n : ℝ)) / (2 * (n : ℝ) - 1) := by field_simp [h2n]; ring have h1m : 1 - (1 : ℝ) / (2 * (n : ℝ) - 1) = (2 * ((n : ℝ) - 1)) / (2 * (n : ℝ) - 1) := by field_simp [h2n]; ring have hR_r : (1 + (1 : ℝ) / (2 * (n : ℝ) - 1)) / (1 - (1 : ℝ) / (2 * (n : ℝ) - 1)) = (n : ℝ) / ((n : ℝ) - 1) := by rw [h1p, h1m, div_div_div_cancel_right₀ h2n] field_simp [ne_of_gt hnm1_pos] exact hL_r.trans hR_r.symm have hdiff : (49 / 100 : ℝ) * ((1 / 20 : ℝ) / ((n : ℝ) - 1) - (1 / 20 : ℝ) / (n : ℝ)) = (49 / 2000 : ℝ) * (1 / ((n : ℝ) - 1) - 1 / (n : ℝ)) := by ring have hu0 : (0 : ℝ) ≤ 1 / (2 * (n : ℝ) - 1) := by positivity have hlog := log_one_add_div_one_sub_ge hu0 hu1 have hfac2 : 2 / (2 * (n : ℝ) - 1) + (2 / 3) * (1 / (2 * (n : ℝ) - 1)) ^ 3 + (49 / 2000) * (1 / ((n : ℝ) - 1) - 1 / (n : ℝ)) ≤ B_func ((1 / 20 : ℝ) / (n : ℝ)) - B_func ((1 / 20 : ℝ) / ((n : ℝ) - 1)) := by rw [hratio, hdiff] at hB have h2u : 2 * (1 / (2 * (n : ℝ) - 1)) = 2 / (2 * (n : ℝ) - 1) := by ring linarith have hfac2_nn : 0 ≤ 2 / (2 * (n : ℝ) - 1) + (2 / 3) * (1 / (2 * (n : ℝ) - 1)) ^ 3 + (49 / 2000) * (1 / ((n : ℝ) - 1) - 1 / (n : ℝ)) := by have hsub_nn : 0 ≤ 1 / ((n : ℝ) - 1) - 1 / (n : ℝ) := by have := one_div_le_one_div_of_le hnm1_pos (show (n : ℝ) - 1 ≤ (n : ℝ) by linarith) linarith positivity exact mul_le_mul hfac1 hfac2 hfac2_nn (by linarith) lemma chainContrib_32_one_twentieth_gt : (622 / 1000 : ℝ) < chainContrib 32 (1 / 20) := by have hle : ∑ n ∈ Finset.Icc 2 32, chainTermLower n ≤ chainContrib 32 (1 / 20) := Finset.sum_le_sum (fun n hn => chainTermLower_le_chainTerm (Finset.mem_Icc.mp hn).1) have hnum : (622 / 1000 : ℝ) < ∑ n ∈ Finset.Icc 2 32, chainTermLower n := by norm_num [Finset.sum_Icc_succ_top, chainTermLower] linarith /-- **Kernel-checked finite-chain diagonal margin (`N = 64`, `L = 1/20`)**: `1.175 < m_chain 64 (1/20)` (true FLINT value `1.181741...`). -/ theorem m_chain_64_one_twentieth_gt : (1175 / 1000 : ℝ) < m_chain 64 (1 / 20) := by have hmono : m_chain 32 (1 / 20) ≤ m_chain 64 (1 / 20) := m_chain_mono (by norm_num) (by norm_num) have h32 : (1175 / 1000 : ℝ) < m_chain 32 (1 / 20) := by unfold m_chain linarith [m_func_one_twentieth_gt, chainContrib_32_one_twentieth_gt] linarith /-! ### 5. Prime-Power Ranges and Edge Bounds for `L = 1/20` -/ lemma vonMangoldt_eleven : vonMangoldt 11 = Real.log 11 := by simpa using vonMangoldt_prime (by decide : Nat.Prime 11) lemma log_three_gt_109_100 : (109 / 100 : ℝ) < Real.log 3 := log_gt_of_taylor (k := 2) (l := 5798 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_three_lt_11_10 : Real.log 3 < 11 / 10 := log_lt_of_taylor (k := 2) (u := 5770 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_five_gt_8_5 : (8 / 5 : ℝ) < Real.log 5 := log_gt_of_taylor (k := 4) (l := 6703 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_five_lt_161_100 : Real.log 5 < 161 / 100 := log_lt_of_taylor (k := 4) (u := 6687 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_seven_lt_39_20 : Real.log 7 < 39 / 20 := log_lt_of_taylor (k := 4) (u := 6142 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_ten_lt_231_100 : Real.log 10 < 231 / 100 := log_lt_of_taylor (k := 5) (u := 6301 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_eleven_gt_239_100 : (239 / 100 : ℝ) < Real.log 11 := log_gt_of_taylor (k := 5) (l := 6200 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_eleven_lt_2399_1000 : Real.log 11 < 2399 / 1000 := log_lt_of_taylor (k := 5) (u := 6190 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma log_six_eq : Real.log (6 : ℝ) = Real.log 2 + Real.log 3 := by rw [show (6 : ℝ) = 2 * 3 by norm_num, Real.log_mul (by norm_num) (by norm_num)] lemma log_eight_eq : Real.log (8 : ℝ) = 3 * Real.log 2 := by rw [show (8 : ℝ) = 2 ^ 3 by norm_num, Real.log_pow]; norm_num lemma log_twelve_eq : Real.log (12 : ℝ) = 2 * Real.log 2 + Real.log 3 := by rw [show (12 : ℝ) = 4 * 3 by norm_num, Real.log_mul (by norm_num) (by norm_num), log_four_eq] /-- Helper for proving `primePowerRange d D = ∅` when `D < log 2`. -/ lemma primePowerRange_empty_of_lt_log_two {d D : ℝ} (hD : D < Real.log 2) : primePowerRange d D = ∅ := by ext n rw [mem_primePowerRange_iff] simp only [Finset.notMem_empty, iff_false, not_and] intro h2 _ hle have hlog := Real.log_le_log (by norm_num) (show (2 : ℝ) ≤ (n : ℝ) by exact_mod_cast h2) linarith /-- Helper for proving `primePowerRange d D = ∅` when `log m < d` and `D < log (m + 1)`. -/ lemma primePowerRange_empty_between {d D : ℝ} {m : ℕ} (hm : 1 ≤ m) (h1 : Real.log (m : ℝ) < d) (h2 : D < Real.log ((m + 1 : ℕ) : ℝ)) : primePowerRange d D = ∅ := by ext n rw [mem_primePowerRange_iff] simp only [Finset.notMem_empty, iff_false, not_and] intro hn2 hd hD by_cases hle : n ≤ m · have hlog := Real.log_le_log (by exact_mod_cast (show 0 < n by omega)) (show (n : ℝ) ≤ (m : ℝ) by exact_mod_cast hle) linarith · have hge : m + 1 ≤ n := by omega have hlog := Real.log_le_log (by exact_mod_cast (show 0 < m + 1 by omega)) (show ((m + 1 : ℕ) : ℝ) ≤ (n : ℝ) by exact_mod_cast hge) linarith /-- Helper for proving `primePowerRange d D = {m}` when `log (m - 1) < d ≤ log m ≤ D < log (m + 1)`. -/ lemma primePowerRange_singleton_of_bounds {d D : ℝ} {m : ℕ} (hm : 2 ≤ m) (hprev : Real.log ((m - 1 : ℕ) : ℝ) < d) (hd : d ≤ Real.log (m : ℝ)) (hD : Real.log (m : ℝ) ≤ D) (hnext : D < Real.log ((m + 1 : ℕ) : ℝ)) : primePowerRange d D = {m} := by ext n rw [mem_primePowerRange_iff, Finset.mem_singleton] constructor · rintro ⟨hn2, hdn, hDn⟩ by_cases hlt : n < m · have hle : n ≤ m - 1 := by omega have hlog := Real.log_le_log (by exact_mod_cast (show 0 < n by omega)) (show (n : ℝ) ≤ ((m - 1 : ℕ) : ℝ) by exact_mod_cast hle) linarith · by_cases hgt : m < n · have hge : m + 1 ≤ n := by omega have hlog := Real.log_le_log (by exact_mod_cast (show 0 < m + 1 by omega)) (show ((m + 1 : ℕ) : ℝ) ≤ (n : ℝ) by exact_mod_cast hge) linarith · omega · rintro rfl exact ⟨hm, hd, hD⟩ lemma primePowerRange_31_33 : primePowerRange (31 / 20) (33 / 20) = {5} := by refine primePowerRange_singleton_of_bounds (m := 5) (by norm_num) ?_ ?_ ?_ ?_ · push_cast; rw [log_four_eq]; linarith [log_two_lt] · push_cast; linarith [log_five_gt_8_5] · push_cast; linarith [log_five_lt_161_100] · push_cast; rw [log_six_eq]; linarith [log_two_gt, log_three_gt_109_100] lemma primePowerRange_47_49 : primePowerRange (47 / 20) (49 / 20) = {11} := by refine primePowerRange_singleton_of_bounds (m := 11) (by norm_num) ?_ ?_ ?_ ?_ · push_cast; linarith [log_ten_lt_231_100] · push_cast; linarith [log_eleven_gt_239_100] · push_cast; linarith [log_eleven_lt_2399_1000] · push_cast; rw [log_twelve_eq]; linarith [log_two_gt, log_three_gt_109_100] -- Kernel-checked `R_bound (1/20) (1/20) d` upper bounds for all 10 distinct gaps: lemma R_bound_1_4_lt : R_bound (1 / 20) (1 / 20) (1 / 4) < 69 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 2) (m := 1) (u1 := 7317 / 10000) (u2 := 3033 / 5000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_7_20_lt : R_bound (1 / 20) (1 / 20) (7 / 20) < 42 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 2) (m := 2) (u1 := 6457 / 10000) (u2 := 7047 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_9_20_lt : R_bound (1 / 20) (1 / 20) (9 / 20) < 28 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 3) (m := 2) (u1 := 6873 / 10000) (u2 := 6377 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_13_20_lt : R_bound (1 / 20) (1 / 20) (13 / 20) < 14 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 4) (m := 3) (u1 := 3331 / 5000) (u2 := 1621 / 2500) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_3_4_lt : R_bound (1 / 20) (1 / 20) (3 / 4) < 10 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 4) (m := 3) (u1 := 3129 / 5000) (u2 := 3033 / 5000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_17_20_lt : R_bound (1 / 20) (1 / 20) (17 / 20) < 8 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 5) (m := 4) (u1 := 3269 / 5000) (u2 := 3269 / 5000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_23_20_lt : R_bound (1 / 20) (1 / 20) (23 / 20) < 4 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 6) (m := 5) (u1 := 3097 / 5000) (u2 := 6313 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_5_4_lt : R_bound (1 / 20) (1 / 20) (5 / 4) < 3 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 7) (m := 5) (u1 := 16 / 25) (u2 := 3033 / 5000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_27_20_lt : R_bound (1 / 20) (1 / 20) (27 / 20) < 2 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 7) (m := 6) (u1 := 247 / 400) (u2 := 6377 / 10000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) lemma R_bound_33_20_lt : R_bound (1 / 20) (1 / 20) (33 / 20) < 1 / 1000 := R_bound_one_twentieth_lt_of_taylor (k := 9) (m := 7) (u1 := 1581 / 2500) (u2 := 3121 / 5000) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) -- Complete `E_bound (1/20) (1/20) d D` upper bounds for every distinct difference interval: lemma E_bound_1_4_7_20_lt : E_bound (1 / 20) (1 / 20) (1 / 4) (7 / 20) < 69 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_of_lt_log_two (by linarith [log_two_gt]), Finset.sum_empty, zero_add] exact R_bound_1_4_lt lemma E_bound_7_20_9_20_lt : E_bound (1 / 20) (1 / 20) (7 / 20) (9 / 20) < 42 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_of_lt_log_two (by linarith [log_two_gt]), Finset.sum_empty, zero_add] exact R_bound_7_20_lt lemma E_bound_9_20_11_20_lt : E_bound (1 / 20) (1 / 20) (9 / 20) (11 / 20) < 28 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_of_lt_log_two (by linarith [log_two_gt]), Finset.sum_empty, zero_add] exact R_bound_9_20_lt lemma E_bound_13_20_3_4_lt : E_bound (1 / 20) (1 / 20) (13 / 20) (3 / 4) < 507 / 1000 := by unfold E_bound rw [arithmetic_illustration_L_one_twentieth.1] have hsqrt2 : (141 / 100 : ℝ) < Real.sqrt 2 := by calc (141 / 100 : ℝ) = Real.sqrt ((141 / 100) ^ 2) := (Real.sqrt_sq (by norm_num)).symm _ < Real.sqrt 2 := Real.sqrt_lt_sqrt (by norm_num) (by norm_num) have hP : Real.log 2 / Real.sqrt 2 < 493 / 1000 := by rw [div_lt_iff₀ (Real.sqrt_pos.mpr (by norm_num))] linarith [log_two_lt] linarith [R_bound_13_20_lt] lemma E_bound_3_4_17_20_lt : E_bound (1 / 20) (1 / 20) (3 / 4) (17 / 20) < 10 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_between (m := 2) (by norm_num) (by push_cast; linarith [log_two_lt]) (by push_cast; linarith [log_three_gt_109_100]), Finset.sum_empty, zero_add] exact R_bound_3_4_lt lemma E_bound_17_20_19_20_lt : E_bound (1 / 20) (1 / 20) (17 / 20) (19 / 20) < 8 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_between (m := 2) (by norm_num) (by push_cast; linarith [log_two_lt]) (by push_cast; linarith [log_three_gt_109_100]), Finset.sum_empty, zero_add] exact R_bound_17_20_lt lemma E_bound_23_20_5_4_lt : E_bound (1 / 20) (1 / 20) (23 / 20) (5 / 4) < 4 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_between (m := 3) (by norm_num) (by push_cast; linarith [log_three_lt_11_10]) (by push_cast; rw [log_four_eq]; linarith [log_two_gt]), Finset.sum_empty, zero_add] exact R_bound_23_20_lt lemma E_bound_5_4_27_20_lt : E_bound (1 / 20) (1 / 20) (5 / 4) (27 / 20) < 3 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_between (m := 3) (by norm_num) (by push_cast; linarith [log_three_lt_11_10]) (by push_cast; rw [log_four_eq]; linarith [log_two_gt]), Finset.sum_empty, zero_add] exact R_bound_5_4_lt lemma E_bound_27_20_29_20_lt : E_bound (1 / 20) (1 / 20) (27 / 20) (29 / 20) < 350 / 1000 := by unfold E_bound rw [arithmetic_illustration_L_one_twentieth.2] linarith [log_two_lt, R_bound_27_20_lt] lemma E_bound_31_20_33_20_lt : E_bound (1 / 20) (1 / 20) (31 / 20) (33 / 20) < 723 / 1000 := by unfold E_bound P_bound rw [primePowerRange_31_33, Finset.sum_singleton] simp only [arithWeight, vonMangoldt_five, Nat.cast_ofNat] have hsqrt5 : (2236 / 1000 : ℝ) < Real.sqrt 5 := by calc (2236 / 1000 : ℝ) = Real.sqrt ((2236 / 1000) ^ 2) := (Real.sqrt_sq (by norm_num)).symm _ < Real.sqrt 5 := Real.sqrt_lt_sqrt (by norm_num) (by norm_num) have hP : Real.log 5 / Real.sqrt 5 < 721 / 1000 := by rw [div_lt_iff₀ (Real.sqrt_pos.mpr (by norm_num))] linarith [log_five_lt_161_100] have hR : R_bound (1 / 20) (1 / 20) (31 / 20) < 2 / 1000 := R_bound_one_twentieth_lt_of_le (by norm_num) (by norm_num) R_bound_27_20_lt linarith lemma E_bound_33_20_7_4_lt : E_bound (1 / 20) (1 / 20) (33 / 20) (7 / 4) < 1 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_between (m := 5) (by norm_num) (by push_cast; linarith [log_five_lt_161_100]) (by push_cast; rw [log_six_eq]; linarith [log_two_gt, log_three_gt_109_100]), Finset.sum_empty, zero_add] exact R_bound_33_20_lt lemma E_bound_39_20_41_20_lt : E_bound (1 / 20) (1 / 20) (39 / 20) (41 / 20) < 1 / 1000 := by unfold E_bound P_bound rw [primePowerRange_empty_between (m := 7) (by norm_num) (by push_cast; linarith [log_seven_lt_39_20]) (by push_cast; rw [log_eight_eq]; linarith [log_two_gt]), Finset.sum_empty, zero_add] exact R_bound_one_twentieth_lt_of_le (by norm_num) (by norm_num) R_bound_33_20_lt lemma E_bound_47_20_49_20_lt : E_bound (1 / 20) (1 / 20) (47 / 20) (49 / 20) < 725 / 1000 := by unfold E_bound P_bound rw [primePowerRange_47_49, Finset.sum_singleton] simp only [arithWeight, vonMangoldt_eleven, Nat.cast_ofNat] have hsqrt11 : (3316 / 1000 : ℝ) < Real.sqrt 11 := by calc (3316 / 1000 : ℝ) = Real.sqrt ((3316 / 1000) ^ 2) := (Real.sqrt_sq (by norm_num)).symm _ < Real.sqrt 11 := Real.sqrt_lt_sqrt (by norm_num) (by norm_num) have hP : Real.log 11 / Real.sqrt 11 < 724 / 1000 := by rw [div_lt_iff₀ (Real.sqrt_pos.mpr (by norm_num))] linarith [log_eleven_lt_2399_1000] have hR : R_bound (1 / 20) (1 / 20) (47 / 20) < 1 / 1000 := R_bound_one_twentieth_lt_of_le (by norm_num) (by norm_num) R_bound_33_20_lt linarith /-! ### 6. Certified 3-Window Theorem (`N = 64`, `L = 1/20`, `ε = 1/4`) -/ /-- Exact rational lower-bound comparison matrix for the 3-window `L = 1/20` certificate. -/ noncomputable def threeWindowRatMat : Matrix (Fin 3) (Fin 3) ℝ := !![1175 / 1000, -(507 / 1000), -(350 / 1000); -(507 / 1000), 1175 / 1000, -(507 / 1000); -(350 / 1000), -(507 / 1000), 1175 / 1000] /-- Exact unit lower triangular `L` factor for `threeWindowRatMat - (1/4) I = L D Lᵀ`. -/ noncomputable def threeWindowL : Matrix (Fin 3) (Fin 3) ℝ := !![1, 0, 0; -(507 / 925), 1, 0; -(14 / 37), -(646425 / 598576), 1] /-- Exact strictly positive Schur pivots `D` for `threeWindowRatMat - (1/4) I = L D Lᵀ`. -/ noncomputable def threeWindowD : Fin 3 → ℝ := ![37 / 40, 74822 / 115625, 906627 / 23943040] lemma threeWindow_ldl_identity : ∀ i j : Fin 3, threeWindowRatMat i j - (if i = j then (1 / 4 : ℝ) else 0) = ∑ k : Fin 3, threeWindowL i k * threeWindowD k * threeWindowL j k := by intro i j fin_cases i <;> fin_cases j <;> simp [threeWindowRatMat, threeWindowL, threeWindowD, Fin.sum_univ_three] <;> norm_num lemma threeWindowD_pos : ∀ k : Fin 3, 0 < threeWindowD k := by intro k; fin_cases k <;> simp [threeWindowD] /-- **Kernel-checked certification of the 3-window `N = 64`, `L = 1/20` certificate (`ε = 1/4`)**: On the three windows centered at `0, 7/10, 7/5` with width `L = 1/20` (span `29/20`, prime links `{2, 4, 2}`), the finite-chain `N = 64` comparison matrix admits an exact `LDLᵀ` factorization with strictly positive Schur pivots, proving `Q(∑_{i=0}^2 c_i φ_i) ≥ (1/4) ‖∑_{i=0}^2 c_i φ_i‖_2^2` for ALL locally balanced smooth functions supported in those windows and ALL `c ∈ ℂ³`. -/ theorem certified_three_window_L_one_twentieth (φ : Fin 3 → TestFn) (c : Fin 3 → ℂ) (hsupp : ∀ i : Fin 3, SupportedIn (φ i) (exampleCenters i - 1 / 40) (exampleCenters i + 1 / 40)) (hbal : ∀ i : Fin 3, IsBalanced (φ i)) : (1 / 4 : ℝ) * normSq (∑ i : Fin 3, c i • φ i) ≤ Q_form (∑ i : Fin 3, c i • φ i) := by set a : Fin 3 → ℝ := fun i => exampleCenters i - 1 / 40 set b : Fin 3 → ℝ := fun i => exampleCenters i + 1 / 40 have hL_pos : ∀ i : Fin 3, 0 < b i - a i := fun i => by simp only [a, b]; norm_num have hL_le : ∀ i : Fin 3, b i - a i ≤ Real.log 2 := fun i => by have hlen : b i - a i = 1 / 20 := by simp only [a, b]; ring rw [hlen]; linarith [log_two_gt] have hsep : ∀ i j : Fin 3, i < j → b i < a j := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all [a, b, exampleCenters] <;> norm_num have hdiag : ∀ i : Fin 3, (1175 / 1000 : ℝ) < m_chain 64 (b i - a i) := by intro i have hlen : b i - a i = 1 / 20 := by simp only [a, b]; ring rw [hlen]; exact m_chain_64_one_twentieth_gt have hupper : ∀ i j : Fin 3, i < j → offDiagBound a b i j < -threeWindowRatMat i j := by intro i j hij rw [offDiagBound_of_lt a b hij] fin_cases i <;> fin_cases j <;> try (exfalso; exact (by decide : ¬ _) hij) all_goals simp only [a, b, exampleCenters, threeWindowRatMat] · convert E_bound_13_20_3_4_lt using 2 <;> norm_num · convert E_bound_27_20_29_20_lt using 2 <;> norm_num · convert E_bound_13_20_3_4_lt using 2 <;> norm_num have hsymm_rat : ∀ i j : Fin 3, threeWindowRatMat j i = threeWindowRatMat i j := by intro i j; fin_cases i <;> fin_cases j <;> simp [threeWindowRatMat] have hentry : ∀ i j : Fin 3, threeWindowRatMat i j ≤ compMatrixChain 64 a b i j := by intro i j rcases lt_trichotomy i j with hlt | rfl | hgt · have hne : i ≠ j := ne_of_lt hlt simp only [compMatrixChain, Matrix.of_apply, hne, ↓reduceIte] linarith [hupper i j hlt] · simp only [compMatrixChain, Matrix.of_apply, ↓reduceIte] have hdiag_rat : threeWindowRatMat i i = 1175 / 1000 := by fin_cases i <;> simp [threeWindowRatMat] rw [hdiag_rat] exact le_of_lt (hdiag i) · have hne : i ≠ j := ne_of_gt hgt simp only [compMatrixChain, Matrix.of_apply, hne, ↓reduceIte] rw [offDiagBound_symm, ← hsymm_rat i j] linarith [hupper j i hgt] have hM : ∀ v : Fin 3 → ℝ, (∀ i, 0 ≤ v i) → (1 / 4 : ℝ) * ∑ i : Fin 3, v i ^ 2 ≤ quadForm (compMatrixChain 64 a b) v := fun v hv => le_trans (quadForm_ge_of_ldl threeWindowRatMat threeWindowL threeWindowD (1 / 4) threeWindow_ldl_identity (fun k => le_of_lt (threeWindowD_pos k)) v) (quadForm_mono_entrywise_nonneg threeWindowRatMat (compMatrixChain 64 a b) hentry hv) exact theorem1_chain_uniform_positivity 64 (by norm_num) hL_pos hL_le hsep hsupp hbal hM c /-! ### 7. Certified 7-Window / 21-Edge Theorem (`N = 64`, `L = 1/20`, `ε = 1/100`) -/ /-- The seven window centers `0, 2/5, 7/10, 6/5, 8/5, 2, 12/5` from `seven-window-certificate.json`. -/ noncomputable def sevenWindowCenters : Fin 7 → ℝ := ![0, 2 / 5, 7 / 10, 6 / 5, 8 / 5, 2, 12 / 5] /-- Exact rational lower-bound comparison matrix for the 7-window / 21-edge certificate (`diag = 1175/1000`, all 21 mixed edges conservatively bounded upward). -/ noncomputable def sevenWindowRatMat : Matrix (Fin 7) (Fin 7) ℝ := !![1175 / 1000, -(42 / 1000), -(507 / 1000), -(4 / 1000), -(723 / 1000), -(1 / 1000), -(725 / 1000); -(42 / 1000), 1175 / 1000, -(69 / 1000), -(10 / 1000), -(4 / 1000), -(723 / 1000), -(1 / 1000); -(507 / 1000), -(69 / 1000), 1175 / 1000, -(28 / 1000), -(8 / 1000), -(3 / 1000), -(1 / 1000); -(4 / 1000), -(10 / 1000), -(28 / 1000), 1175 / 1000, -(42 / 1000), -(10 / 1000), -(4 / 1000); -(723 / 1000), -(4 / 1000), -(8 / 1000), -(42 / 1000), 1175 / 1000, -(42 / 1000), -(10 / 1000); -(1 / 1000), -(723 / 1000), -(3 / 1000), -(10 / 1000), -(42 / 1000), 1175 / 1000, -(42 / 1000); -(725 / 1000), -(1 / 1000), -(1 / 1000), -(4 / 1000), -(10 / 1000), -(42 / 1000), 1175 / 1000] /-- Exact unit lower triangular `L` factor for `sevenWindowRatMat - (1/100) I = L D Lᵀ`. -/ noncomputable def sevenWindowL : Matrix (Fin 7) (Fin 7) ℝ := !![1, 0, 0, 0, 0, 0, 0; -(42 / 1165), 1, 0, 0, 0, 0, 0; -(507 / 1165), -(101679 / 1355461), 1, 0, 0, 0, 0; -(4 / 1165), -(11818 / 1355461), -(41343910 / 1271164843), 1, 0, 0, 0; -(723 / 1165), -(35026 / 1355461), -(440389223 / 1271164843), -(70310316192 / 1479516094495), 1, 0, 0; -(1 / 1165), -(842337 / 1355461), -(78173853 / 1271164843), -(23113887182 / 1479516094495), -(121540877915928 / 888212726761307), 1, 0; -(145 / 233), -(31615 / 1355461), -(431783065 / 1271164843), -(21719828456 / 1479516094495), -(846001056349684 / 888212726761307), -(139972233898958871 / 622285436975007292), 1] /-- Exact strictly positive 7-window Schur pivots `D` for `sevenWindowRatMat - (1/100) I = L D Lᵀ`. -/ noncomputable def sevenWindowD : Fin 7 → ℝ := ![233 / 200, 1355461 / 1165000, 1271164843 / 1355461000, 295903218899 / 254232968600, 888212726761307 / 1479516094495000, 155571359243751823 / 222053181690326750, 15339908177557585501 / 622285436975007292000] lemma sevenWindowD_pos : ∀ k : Fin 7, 0 < sevenWindowD k := by intro k; fin_cases k <;> simp [sevenWindowD] lemma sevenWindow_ldl_identity : ∀ i j : Fin 7, sevenWindowRatMat i j - (if i = j then (1 / 100 : ℝ) else 0) = ∑ k : Fin 7, sevenWindowL i k * sevenWindowD k * sevenWindowL j k := by intro i j fin_cases i <;> fin_cases j <;> simp [sevenWindowRatMat, sevenWindowL, sevenWindowD, Fin.sum_univ_succ] <;> norm_num /-- **Kernel-checked certification of the 7-window / 21-edge `N = 64`, `L = 1/20` certificate (`ε = 1/100`)**: On the seven windows centered at `0, 2/5, 7/10, 6/5, 8/5, 2, 12/5` of width `L = 1/20` (total log-span `49/20`), retaining every one of the 21 mixed interaction edges (including prime links `2`, `5`, `11`), the finite-chain `N = 64` comparison matrix admits an exact `7 × 7` Schur-complement `LDLᵀ` factorization with all 7 pivots strictly positive, proving `Q(∑_{i=0}^6 c_i φ_i) ≥ (1/100) ‖∑_{i=0}^6 c_i φ_i‖_2^2` for ALL locally balanced smooth functions supported in those 7 windows and ALL `c ∈ ℂ⁷`. -/ theorem certified_seven_window_L_one_twentieth (φ : Fin 7 → TestFn) (c : Fin 7 → ℂ) (hsupp : ∀ i : Fin 7, SupportedIn (φ i) (sevenWindowCenters i - 1 / 40) (sevenWindowCenters i + 1 / 40)) (hbal : ∀ i : Fin 7, IsBalanced (φ i)) : (1 / 100 : ℝ) * normSq (∑ i : Fin 7, c i • φ i) ≤ Q_form (∑ i : Fin 7, c i • φ i) := by set a : Fin 7 → ℝ := fun i => sevenWindowCenters i - 1 / 40 set b : Fin 7 → ℝ := fun i => sevenWindowCenters i + 1 / 40 have hL_pos : ∀ i : Fin 7, 0 < b i - a i := fun i => by simp only [a, b]; norm_num have hL_le : ∀ i : Fin 7, b i - a i ≤ Real.log 2 := fun i => by have hlen : b i - a i = 1 / 20 := by simp only [a, b]; ring rw [hlen]; linarith [log_two_gt] have hsep : ∀ i j : Fin 7, i < j → b i < a j := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all [a, b, sevenWindowCenters] <;> norm_num have hdiag : ∀ i : Fin 7, (1175 / 1000 : ℝ) < m_chain 64 (b i - a i) := by intro i have hlen : b i - a i = 1 / 20 := by simp only [a, b]; ring rw [hlen]; exact m_chain_64_one_twentieth_gt -- Verify all 21 upper-triangular off-diagonal edge bounds `offDiagBound a b i j < -sevenWindowRatMat i j`. have hupper : ∀ i j : Fin 7, i < j → offDiagBound a b i j < -sevenWindowRatMat i j := by intro i j hij rw [offDiagBound_of_lt a b hij] fin_cases i <;> fin_cases j <;> try (exfalso; exact (by decide : ¬ _) hij) all_goals simp only [a, b, sevenWindowCenters, sevenWindowRatMat] · convert E_bound_7_20_9_20_lt using 2 <;> norm_num · convert E_bound_13_20_3_4_lt using 2 <;> norm_num · convert E_bound_23_20_5_4_lt using 2 <;> norm_num · convert E_bound_31_20_33_20_lt using 2 <;> norm_num · convert E_bound_39_20_41_20_lt using 2 <;> norm_num · convert E_bound_47_20_49_20_lt using 2 <;> norm_num · convert E_bound_1_4_7_20_lt using 2 <;> norm_num · convert E_bound_3_4_17_20_lt using 2 <;> norm_num · convert E_bound_23_20_5_4_lt using 2 <;> norm_num · convert E_bound_31_20_33_20_lt using 2 <;> norm_num · convert E_bound_39_20_41_20_lt using 2 <;> norm_num · convert E_bound_9_20_11_20_lt using 2 <;> norm_num · convert E_bound_17_20_19_20_lt using 2 <;> norm_num · convert E_bound_5_4_27_20_lt using 2 <;> norm_num · convert E_bound_33_20_7_4_lt using 2 <;> norm_num · convert E_bound_7_20_9_20_lt using 2 <;> norm_num · convert E_bound_3_4_17_20_lt using 2 <;> norm_num · convert E_bound_23_20_5_4_lt using 2 <;> norm_num · convert E_bound_7_20_9_20_lt using 2 <;> norm_num · convert E_bound_3_4_17_20_lt using 2 <;> norm_num · convert E_bound_7_20_9_20_lt using 2 <;> norm_num have hsymm_rat : ∀ i j : Fin 7, sevenWindowRatMat j i = sevenWindowRatMat i j := by intro i j fin_cases i <;> fin_cases j <;> simp [sevenWindowRatMat] have hentry : ∀ i j : Fin 7, sevenWindowRatMat i j ≤ compMatrixChain 64 a b i j := by intro i j rcases lt_trichotomy i j with hlt | rfl | hgt · have hne : i ≠ j := ne_of_lt hlt simp only [compMatrixChain, Matrix.of_apply, hne, ↓reduceIte] linarith [hupper i j hlt] · simp only [compMatrixChain, Matrix.of_apply, ↓reduceIte] have hdiag_rat : sevenWindowRatMat i i = 1175 / 1000 := by fin_cases i <;> simp [sevenWindowRatMat] rw [hdiag_rat] exact le_of_lt (hdiag i) · have hne : i ≠ j := ne_of_gt hgt simp only [compMatrixChain, Matrix.of_apply, hne, ↓reduceIte] rw [offDiagBound_symm, ← hsymm_rat i j] linarith [hupper j i hgt] have hM : ∀ v : Fin 7 → ℝ, (∀ i, 0 ≤ v i) → (1 / 100 : ℝ) * ∑ i : Fin 7, v i ^ 2 ≤ quadForm (compMatrixChain 64 a b) v := fun v hv => le_trans (quadForm_ge_of_ldl sevenWindowRatMat sevenWindowL sevenWindowD (1 / 100) sevenWindow_ldl_identity (fun k => le_of_lt (sevenWindowD_pos k)) v) (quadForm_mono_entrywise_nonneg sevenWindowRatMat (compMatrixChain 64 a b) hentry hv) exact theorem1_chain_uniform_positivity 64 (by norm_num) hL_pos hL_le hsep hsupp hbal hM c /-- **Row-dominance insufficiency on the 7-window geometry**: Row 0 carries three prime-linked mixed edges (`2`, `5`, `11`) whose arithmetic weights alone sum to `log 2 / √2 + log 5 / √5 + log 11 / √11 > 1.9`, strictly exceeding `m_chain 64 (1/20)`. Thus Gershgorin row dominance fails on row 0, demonstrating why full `LDLᵀ` / Schur pivots are essential for `certified_seven_window_L_one_twentieth`. -/ theorem seven_window_row0_prime_sum_gt : (19 / 10 : ℝ) < P_bound (13 / 20) (3 / 4) + P_bound (31 / 20) (33 / 20) + P_bound (47 / 20) (49 / 20) := by rw [arithmetic_illustration_L_one_twentieth.1] have hP5 : P_bound (31 / 20) (33 / 20) = Real.log 5 / Real.sqrt 5 := by unfold P_bound; rw [primePowerRange_31_33, Finset.sum_singleton] simp [arithWeight, vonMangoldt_five] have hP11 : P_bound (47 / 20) (49 / 20) = Real.log 11 / Real.sqrt 11 := by unfold P_bound; rw [primePowerRange_47_49, Finset.sum_singleton] simp [arithWeight, vonMangoldt_eleven] rw [hP5, hP11] have hs2 : Real.sqrt 2 < 142 / 100 := by calc Real.sqrt 2 < Real.sqrt ((142 / 100) ^ 2) := Real.sqrt_lt_sqrt (by norm_num) (by norm_num) _ = 142 / 100 := Real.sqrt_sq (by norm_num) have hs5 : Real.sqrt 5 < 224 / 100 := by calc Real.sqrt 5 < Real.sqrt ((224 / 100) ^ 2) := Real.sqrt_lt_sqrt (by norm_num) (by norm_num) _ = 224 / 100 := Real.sqrt_sq (by norm_num) have hs11 : Real.sqrt 11 < 332 / 100 := by calc Real.sqrt 11 < Real.sqrt ((332 / 100) ^ 2) := Real.sqrt_lt_sqrt (by norm_num) (by norm_num) _ = 332 / 100 := Real.sqrt_sq (by norm_num) have h1 : (48 / 100 : ℝ) < Real.log 2 / Real.sqrt 2 := by rw [lt_div_iff₀ (Real.sqrt_pos.mpr (by norm_num))]; linarith [log_two_gt] have h2 : (71 / 100 : ℝ) < Real.log 5 / Real.sqrt 5 := by rw [lt_div_iff₀ (Real.sqrt_pos.mpr (by norm_num))]; linarith [log_five_gt_8_5] have h3 : (71 / 100 : ℝ) < Real.log 11 / Real.sqrt 11 := by rw [lt_div_iff₀ (Real.sqrt_pos.mpr (by norm_num))]; linarith [log_eleven_gt_239_100] linarith end F04Riemann