import Mathlib.LinearAlgebra.Matrix.Symmetric import F04Riemann.WindowBounds /-! # The Comparison Theorem and Fixed-Center Narrow-Interval Positivity (F04 §§5–6) This module proves the two main theorems of F04: 1. **Theorem 1 (`theorem1_comparison` and `theorem1_uniform_positivity`, Section 5, eqs. (10)–(11))**: Given `r` strictly separated intervals `I_i = [a_i, b_i]` of lengths `0 < L_i ≤ log 2`, the symmetric comparison matrix `M` with `M_{ii} = m(L_i)` and `M_{ij} = -E_{ij}` (`i ≠ j`) satisfies `Q(∑_i c_i φ_i) ≥ v^T M v` (`v_i = |c_i| ‖φ_i‖_2`) for all locally balanced `φ_i` supported in `I_i` and all `c ∈ ℂ^r`. Whenever `z^T M z ≥ ε ∑_i z_i^2` for all `z ∈ ℝ^r`, `Q(∑_i c_i φ_i) ≥ ε ‖∑_i c_i φ_i‖_2^2`. 2. **Row-dominance criterion (`row_dominance_implies_matrix_lower_bound`, Section 5, eq. (12))**: If `m(L_i) - ∑_{j ≠ i} E_{ij} ≥ ε` for every `i`, then `z^T M z ≥ ε ∑_i z_i^2` for every `z ∈ ℝ^r`. 3. **Theorem 2 (`theorem2_fixed_centers_explicit` and `theorem2_fixed_centers`, Section 6, eq. (13))**: For any fixed finite set of distinct real centers `c_1 < ... < c_r` and any desired margin `η > 0`, taking the explicit common width bound (13) yields `Q(∑_i φ_i) ≥ η ‖∑_i φ_i‖_2^2` and strict positivity on every nonzero locally balanced sum supported in `[c_i - L/2, c_i + L/2]`. -/ namespace F04Riemann open Real Complex MeasureTheory Set Finset Matrix /-! ### 1. Comparison Matrix `M` and Row Margins (Section 5) -/ /-- Symmetric off-diagonal interaction bound `E_{ij}` for ordered separated intervals. -/ noncomputable def offDiagBound {r : ℕ} (a b : Fin r → ℝ) (i j : Fin r) : ℝ := if i < j then E_bound (b i - a i) (b j - a j) (a j - b i) (b j - a i) else if j < i then E_bound (b j - a j) (b i - a i) (a i - b j) (b i - a j) else 0 lemma offDiagBound_symm {r : ℕ} (a b : Fin r → ℝ) (i j : Fin r) : offDiagBound a b i j = offDiagBound a b j i := by unfold offDiagBound rcases lt_trichotomy i j with hlt | rfl | hgt · have hnot : ¬ (j < i) := not_lt_of_gt hlt simp [hlt, hnot] · simp · have hnot : ¬ (i < j) := not_lt_of_gt hgt simp [hgt, hnot] lemma offDiagBound_of_lt {r : ℕ} (a b : Fin r → ℝ) {i j : Fin r} (h : i < j) : offDiagBound a b i j = E_bound (b i - a i) (b j - a j) (a j - b i) (b j - a i) := by simp [offDiagBound, h] lemma offDiagBound_nonneg {r : ℕ} {a b : Fin r → ℝ} (hsep : ∀ i j : Fin r, i < j → b i < a j) (i j : Fin r) : 0 ≤ offDiagBound a b i j := by unfold offDiagBound split_ifs with h1 h2 · exact E_bound_nonneg (by linarith [hsep i j h1]) · exact E_bound_nonneg (by linarith [hsep j i h2]) · exact le_refl 0 /-- The real symmetric comparison matrix `M` from Section 5 of F04: `M_{ii} = m(L_i)` and `M_{ij} = -E_{ij}` for `i ≠ j`. -/ noncomputable def compMatrix {r : ℕ} (a b : Fin r → ℝ) : Matrix (Fin r) (Fin r) ℝ := fun i j => if i = j then m_func (b i - a i) else -offDiagBound a b i j lemma compMatrix_isSymm {r : ℕ} (a b : Fin r → ℝ) : (compMatrix a b).IsSymm := by ext i j simp only [Matrix.transpose_apply, compMatrix] by_cases h : i = j · subst h; simp · have h' : j ≠ i := Ne.symm h simp [h, h', offDiagBound_symm] /-- Quadratic form `z^T M z = ∑_i ∑_j z_i M_{ij} z_j`. -/ noncomputable def quadForm {r : ℕ} (M : Matrix (Fin r) (Fin r) ℝ) (z : Fin r → ℝ) : ℝ := ∑ i : Fin r, ∑ j : Fin r, z i * M i j * z j /-- Explicit expansion `v^T M v = ∑_i m(L_i) v_i^2 - 2 ∑_{i < j} E_{ij} v_i v_j` (Section 5). -/ lemma quadForm_compMatrix {r : ℕ} (a b : Fin r → ℝ) (v : Fin r → ℝ) : quadForm (compMatrix a b) v = (∑ i : Fin r, m_func (b i - a i) * v i ^ 2) - 2 * ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * v i * v j := by unfold quadForm have hrow : ∀ i : Fin r, ∑ j : Fin r, v i * compMatrix a b i j * v j = m_func (b i - a i) * v i ^ 2 - (∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * v i * v j) - (∑ j ∈ Finset.univ.filter (fun j => j < i), offDiagBound a b i j * v i * v j) := by intro i have hunion : (Finset.univ : Finset (Fin r)) = ({i} ∪ Finset.univ.filter (fun j => i < j)) ∪ Finset.univ.filter (fun j => j < i) := by ext j simp only [Finset.mem_univ, Finset.mem_union, Finset.mem_singleton, Finset.mem_filter, true_and, true_iff] rcases lt_trichotomy i j with hlt | rfl | hgt · exact Or.inl (Or.inr hlt) · exact Or.inl (Or.inl rfl) · exact Or.inr hgt have hd1 : Disjoint ({i} : Finset (Fin r)) (Finset.univ.filter (fun j => i < j)) := by rw [Finset.disjoint_singleton_left]; simp have hd2 : Disjoint ({i} ∪ Finset.univ.filter (fun j => i < j)) (Finset.univ.filter (fun j => j < i)) := by rw [Finset.disjoint_left] intro j hj1 hj2 simp only [Finset.mem_union, Finset.mem_singleton, Finset.mem_filter, Finset.mem_univ, true_and] at hj1 hj2 rcases hj1 with rfl | hgt · exact lt_irrefl _ hj2 · exact lt_asymm hgt hj2 conv_lhs => rw [hunion] rw [Finset.sum_union hd2, Finset.sum_union hd1, Finset.sum_singleton] have hdiag : v i * compMatrix a b i i * v i = m_func (b i - a i) * v i ^ 2 := by simp [compMatrix]; ring have hgt_sum : ∑ j ∈ Finset.univ.filter (fun j => i < j), v i * compMatrix a b i j * v j = -∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * v i * v j := by rw [← Finset.sum_neg_distrib] refine Finset.sum_congr rfl (fun j hj => ?_) have hne : i ≠ j := ne_of_lt (Finset.mem_filter.mp hj).2 simp only [compMatrix, hne, ↓reduceIte]; ring have hlt_sum : ∑ j ∈ Finset.univ.filter (fun j => j < i), v i * compMatrix a b i j * v j = -∑ j ∈ Finset.univ.filter (fun j => j < i), offDiagBound a b i j * v i * v j := by rw [← Finset.sum_neg_distrib] refine Finset.sum_congr rfl (fun j hj => ?_) have hne : i ≠ j := ne_of_gt (Finset.mem_filter.mp hj).2 simp only [compMatrix, hne, ↓reduceIte]; ring rw [hdiag, hgt_sum, hlt_sum] ring simp_rw [hrow, Finset.sum_sub_distrib] have hswap : ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => j < i), offDiagBound a b i j * v i * v j = ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * v i * v j := by simp_rw [Finset.sum_filter] rw [Finset.sum_comm] refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) split_ifs with h · rw [offDiagBound_symm]; ring · rfl rw [hswap] ring /-- Row-dominance margin `m(L_i) - ∑_{j ≠ i} E_{ij}` from Section 5, eq. (12). -/ noncomputable def rowMargin {r : ℕ} (a b : Fin r → ℝ) (i : Fin r) : ℝ := m_func (b i - a i) - ∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j /-- **Sufficient Gershgorin / row-dominance check (Section 5, eq. (12))**: If `m(L_i) - ∑_{j ≠ i} E_{ij} ≥ ε` for every `i`, then `z^T M z ≥ ε ∑_i z_i^2` for every `z ∈ ℝ^r`. -/ theorem row_dominance_implies_matrix_lower_bound {r : ℕ} {a b : Fin r → ℝ} {ε : ℝ} (hsep : ∀ i j : Fin r, i < j → b i < a j) (hrow : ∀ i : Fin r, ε ≤ rowMargin a b i) (z : Fin r → ℝ) : ε * ∑ i : Fin r, z i ^ 2 ≤ quadForm (compMatrix a b) z := by rw [quadForm_compMatrix] -- Bound `2 E_{ij} z_i z_j ≤ E_{ij} (z_i^2 + z_j^2)` for every `i < j`. have hpair : 2 * ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * z i * z j ≤ ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * (z i ^ 2 + z j ^ 2) := by rw [Finset.mul_sum] refine Finset.sum_le_sum (fun i _ => ?_) rw [Finset.mul_sum] refine Finset.sum_le_sum (fun j _ => ?_) have hE : 0 ≤ offDiagBound a b i j := offDiagBound_nonneg hsep i j have hsq : 0 ≤ (z i - z j) ^ 2 := sq_nonneg _ nlinarith have hsum_split : ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * (z i ^ 2 + z j ^ 2) = ∑ i : Fin r, (∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j) * z i ^ 2 := by have hexpand : ∀ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * (z i ^ 2 + z j ^ 2) = (∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * z i ^ 2) + (∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * z j ^ 2) := by intro i; rw [← Finset.sum_add_distrib]; refine Finset.sum_congr rfl (fun j _ => by ring) simp_rw [hexpand, Finset.sum_add_distrib] have hswap : ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * z j ^ 2 = ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => j < i), offDiagBound a b i j * z i ^ 2 := by simp_rw [Finset.sum_filter] rw [Finset.sum_comm] refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) split_ifs · rw [offDiagBound_symm] · rfl rw [hswap, ← Finset.sum_add_distrib] refine Finset.sum_congr rfl (fun i _ => ?_) rw [← Finset.sum_mul, ← Finset.sum_mul, ← add_mul] congr 1 have hunion : Finset.univ.filter (fun j : Fin r => j ≠ i) = Finset.univ.filter (fun j => i < j) ∪ Finset.univ.filter (fun j => j < i) := by ext j simp only [Finset.mem_filter, Finset.mem_univ, Finset.mem_union, true_and] exact ne_iff_lt_or_gt.trans or_comm have hdisj : Disjoint (Finset.univ.filter (fun j : Fin r => i < j)) (Finset.univ.filter (fun j : Fin r => j < i)) := by rw [Finset.disjoint_left] intro j h1 h2 exact lt_asymm (Finset.mem_filter.mp h1).2 (Finset.mem_filter.mp h2).2 rw [hunion, Finset.sum_union hdisj] have hmargin : ε * ∑ i : Fin r, z i ^ 2 ≤ (∑ i : Fin r, m_func (b i - a i) * z i ^ 2) - ∑ i : Fin r, (∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j) * z i ^ 2 := by rw [Finset.mul_sum, ← Finset.sum_sub_distrib] refine Finset.sum_le_sum (fun i _ => ?_) have hri := hrow i unfold rowMargin at hri have hsub : m_func (b i - a i) * z i ^ 2 - (∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j) * z i ^ 2 = (m_func (b i - a i) - ∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j) * z i ^ 2 := by ring rw [hsub] exact mul_le_mul_of_nonneg_right hri (sq_nonneg _) linarith /-! ### 2. Theorem 1: The Comparison Theorem (Section 5, eqs. (10)–(11)) -/ /-- **Theorem 1, eq. (10) (F04 §5)**: For `r` ordered strictly separated intervals `I_i = [a_i, b_i]` with `0 < L_i ≤ log 2`, locally balanced smooth `φ_i` supported in `I_i`, and arbitrary complex coefficients `c_i`, setting `v_i = |c_i| ‖φ_i‖_2` gives `Q(∑_i c_i φ_i) ≥ v^T M v`. -/ theorem theorem1_comparison {r : ℕ} {a b : Fin r → ℝ} {φ : Fin r → TestFn} (hL_pos : ∀ i, 0 < b i - a i) (hL_le : ∀ i, b i - a i ≤ Real.log 2) (hsep : ∀ i j : Fin r, i < j → b i < a j) (hsupp : ∀ i, SupportedIn (φ i) (a i) (b i)) (hbal : ∀ i, IsBalanced (φ i)) (c : Fin r → ℂ) : quadForm (compMatrix a b) (fun i => ‖c i‖ * l2Norm (φ i)) ≤ Q_form (∑ i : Fin r, c i • φ i) := by rw [quadForm_compMatrix, Q_form_sum_expansion] have hdiag : ∑ i : Fin r, m_func (b i - a i) * (‖c i‖ * l2Norm (φ i)) ^ 2 ≤ ∑ i : Fin r, ‖c i‖ ^ 2 * Q_form (φ i) := by refine Finset.sum_le_sum (fun i _ => ?_) have h1 := lemma1_single_interval_lower_bound (hL_pos i) (hL_le i) (hsupp i) have hsq : m_func (b i - a i) * (‖c i‖ * l2Norm (φ i)) ^ 2 = ‖c i‖ ^ 2 * (m_func (b i - a i) * normSq (φ i)) := by rw [mul_pow, sq_l2Norm]; ring rw [hsq] exact mul_le_mul_of_nonneg_left h1 (sq_nonneg _) have hoff : -(∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), offDiagBound a b i j * (‖c i‖ * l2Norm (φ i)) * (‖c j‖ * l2Norm (φ j))) ≤ ∑ i : Fin r, ∑ j ∈ Finset.univ.filter (fun j => i < j), (c j * starRingEnd ℂ (c i) * B_form (φ j) (φ i)).re := by rw [← Finset.sum_neg_distrib] refine Finset.sum_le_sum (fun i _ => ?_) rw [← Finset.sum_neg_distrib] refine Finset.sum_le_sum (fun j hj => ?_) have hij : i < j := (Finset.mem_filter.mp hj).2 have h2 := lemma2_interwindow_bound (sub_nonneg.mp (le_of_lt (hL_pos i))) (hsep i j hij) (sub_nonneg.mp (le_of_lt (hL_pos j))) (hsupp i) (hsupp j) (hbal i) (hbal j) have hre_ge : -‖c j * starRingEnd ℂ (c i) * B_form (φ j) (φ i)‖ ≤ (c j * starRingEnd ℂ (c i) * B_form (φ j) (φ i)).re := by have := Complex.abs_re_le_norm (c j * starRingEnd ℂ (c i) * B_form (φ j) (φ i)) linarith [(abs_le.mp this).1] have hnorm_eq : ‖c j * starRingEnd ℂ (c i) * B_form (φ j) (φ i)‖ = ‖c i‖ * ‖c j‖ * ‖B_form (φ j) (φ i)‖ := by rw [norm_mul, norm_mul, Complex.norm_conj]; ring rw [hnorm_eq] at hre_ge rw [offDiagBound_of_lt a b hij] have hmul : ‖c i‖ * ‖c j‖ * ‖B_form (φ j) (φ i)‖ ≤ E_bound (b i - a i) (b j - a j) (a j - b i) (b j - a i) * (‖c i‖ * l2Norm (φ i)) * (‖c j‖ * l2Norm (φ j)) := by have := mul_le_mul_of_nonneg_left h2 (mul_nonneg (norm_nonneg (c i)) (norm_nonneg (c j))) linarith linarith linarith /-- **Theorem 1, eq. (11) (F04 §5)**: If the comparison matrix satisfies `z^T M z ≥ ε ∑_i z_i^2` for every `z ∈ ℝ^r`, then `Q(∑_i c_i φ_i) ≥ ε ∑_i |c_i|^2 ‖φ_i‖_2^2 = ε ‖∑_i c_i φ_i‖_2^2`. -/ theorem theorem1_uniform_positivity {r : ℕ} {a b : Fin r → ℝ} {φ : Fin r → TestFn} {ε : ℝ} (hL_pos : ∀ i, 0 < b i - a i) (hL_le : ∀ i, b i - a i ≤ Real.log 2) (hsep : ∀ i j : Fin r, i < j → b i < a j) (hsupp : ∀ i, SupportedIn (φ i) (a i) (b i)) (hbal : ∀ i, IsBalanced (φ i)) (hM : ∀ z : Fin r → ℝ, ε * ∑ i : Fin r, z i ^ 2 ≤ quadForm (compMatrix a b) z) (c : Fin r → ℂ) : ε * normSq (∑ i : Fin r, c i • φ i) ≤ Q_form (∑ i : Fin r, c i • φ i) := by have h1 := theorem1_comparison hL_pos hL_le hsep hsupp hbal c have h2 := hM (fun i => ‖c i‖ * l2Norm (φ i)) have hnorm : ∑ i : Fin r, (‖c i‖ * l2Norm (φ i)) ^ 2 = normSq (∑ i : Fin r, c i • φ i) := by rw [normSq_sum_disjoint hsep hsupp c] refine Finset.sum_congr rfl (fun i _ => ?_) rw [mul_pow, sq_l2Norm] rw [hnorm] at h2 exact le_trans h2 h1 /-! ### 3. Theorem 2: Narrow Intervals for Any Fixed Finite Set of Centers (Section 6, eq. (13)) -/ /-- Continuous gap constant `C_δ = e^{-5δ/4} / (1 - e^{-δ})` from Section 6 of F04. -/ noncomputable def C_delta (δ : ℝ) : ℝ := Real.exp (-(5 * δ / 4)) / (1 - Real.exp (-δ)) lemma C_delta_pos {δ : ℝ} (hδ : 0 < δ) : 0 < C_delta δ := by unfold C_delta have h1 : Real.exp (-δ) < 1 := by rw [Real.exp_lt_one_iff]; linarith exact div_pos (Real.exp_pos _) (by linarith) /-- Uniform upper bound `E_{ij} ≤ P_D + L C_δ ≤ P_D + C_δ` for common-width intervals `I_i = [c_i - L/2, c_i + L/2]` when `0 < L ≤ min(δ/2, 1)` (Section 6 of F04). -/ lemma offDiagBound_le_fixed_center_bound {r : ℕ} {centers : Fin r → ℝ} {δ D L : ℝ} (hδ_pos : 0 < δ) (hgap : ∀ i j : Fin r, i < j → δ ≤ centers j - centers i) (hspan : ∀ i j : Fin r, i < j → centers j - centers i ≤ D) (hL_pos : 0 < L) (hL_δ : L ≤ δ / 2) (hL_1 : L ≤ 1) {i j : Fin r} (hne : i ≠ j) : offDiagBound (fun k => centers k - L / 2) (fun k => centers k + L / 2) i j ≤ P_D_bound D + C_delta δ := by -- Reduce to `i < j` by symmetry of `offDiagBound`. suffices hlt_case : ∀ p q : Fin r, p < q → offDiagBound (fun k => centers k - L / 2) (fun k => centers k + L / 2) p q ≤ P_D_bound D + C_delta δ by rcases lt_or_gt_of_ne hne with hlt | hgt · exact hlt_case i j hlt · rw [offDiagBound_symm]; exact hlt_case j i hgt intro p q hpq rw [offDiagBound_of_lt _ _ hpq] have hlen_p : (centers p + L / 2) - (centers p - L / 2) = L := by ring have hlen_q : (centers q + L / 2) - (centers q - L / 2) = L := by ring have hd_eq : (centers q - L / 2) - (centers p + L / 2) = centers q - centers p - L := by ring have hD_eq : (centers q + L / 2) - (centers p - L / 2) = centers q - centers p + L := by ring rw [hlen_p, hlen_q, hd_eq, hD_eq] unfold E_bound have hP : P_bound (centers q - centers p - L) (centers q - centers p + L) ≤ P_D_bound D := P_bound_le_P_D_bound (by linarith [hspan p q hpq]) have hd_ge : δ / 2 ≤ centers q - centers p - L := by linarith [hgap p q hpq] have hd_pos : 0 < centers q - centers p - L := by linarith have hR : R_bound L L (centers q - centers p - L) ≤ C_delta δ := by unfold R_bound C_delta rw [Real.sqrt_mul_self (le_of_lt hL_pos)] have hmon : Real.exp (-(5 * (centers q - centers p - L) / 2)) / (1 - Real.exp (-(2 * (centers q - centers p - L)))) ≤ Real.exp (-(5 * δ / 4)) / (1 - Real.exp (-δ)) := by have h1 : residualWeight (centers q - centers p - L) ≤ residualWeight (δ / 2) := by rcases eq_or_lt_of_le hd_ge with heq | hlt · rw [heq] · exact le_of_lt (residualWeight_antiOn (by positivity : (0 : ℝ) < δ / 2) hd_pos hlt) unfold residualWeight at h1 have h5 : -(5 * (δ / 2) / 2) = -(5 * δ / 4) := by ring have h2 : -(2 * (δ / 2)) = -δ := by ring rw [h5, h2] at h1 rw [mul_div_assoc (2 : ℝ), mul_div_assoc (2 : ℝ)] at h1 linarith calc L * (Real.exp (-(5 * (centers q - centers p - L) / 2)) / (1 - Real.exp (-(2 * (centers q - centers p - L))))) ≤ L * (Real.exp (-(5 * δ / 4)) / (1 - Real.exp (-δ))) := mul_le_mul_of_nonneg_left hmon (le_of_lt hL_pos) _ ≤ 1 * (Real.exp (-(5 * δ / 4)) / (1 - Real.exp (-δ))) := mul_le_mul_of_nonneg_right hL_1 (le_of_lt (C_delta_pos hδ_pos)) _ = Real.exp (-(5 * δ / 4)) / (1 - Real.exp (-δ)) := one_mul _ linarith /-- Explicit sufficient width from F04 Section 6, eq. (13): `L_suff(r, δ, D, η) = min { δ/2, (log 2)/2, 1, 4 exp(-A - (r - 1)(P_D + C_δ) - η) }`. -/ noncomputable def explicitWidthBound (r : ℕ) (δ D η : ℝ) : ℝ := min (δ / 2) (min (Real.log 2 / 2) (min 1 (4 * Real.exp (-weilConstA - ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) - η)))) lemma explicitWidthBound_pos (r : ℕ) {δ : ℝ} (hδ : 0 < δ) (D η : ℝ) : 0 < explicitWidthBound r δ D η := by unfold explicitWidthBound have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) exact lt_min (by positivity) (lt_min (by positivity) (lt_min zero_lt_one (by positivity))) /-- **Theorem 2 with explicit width formula (13) (F04 §6)**: For `r ≥ 1` distinct ordered centers `c_1 < ... < c_r` with minimum gap `δ > 0` and total span `≤ D`, and any desired margin `η > 0`, EVERY common width `L` with `0 < L ≤ explicitWidthBound r δ D η` certifies: 1. Row dominance `m(L) - ∑_{j ≠ i} E_{ij} ≥ η` for every `i`, 2. Uniform positivity `Q(∑_i φ_i) ≥ η ‖∑_i φ_i‖_2^2` for all locally balanced smooth `φ_i` supported in `[c_i - L/2, c_i + L/2]`, 3. Strict positivity `Q(∑_i φ_i) > 0` whenever `∑_i φ_i ≠ 0`. -/ theorem theorem2_fixed_centers_explicit {r : ℕ} (hr : 1 ≤ r) {centers : Fin r → ℝ} {δ D η L : ℝ} (hδ_pos : 0 < δ) (hη_pos : 0 < η) (hgap : ∀ i j : Fin r, i < j → δ ≤ centers j - centers i) (hspan : ∀ i j : Fin r, i < j → centers j - centers i ≤ D) (hL_pos : 0 < L) (hL_le : L ≤ explicitWidthBound r δ D η) : (∀ i : Fin r, η ≤ rowMargin (fun k => centers k - L / 2) (fun k => centers k + L / 2) i) ∧ (∀ φ : Fin r → TestFn, (∀ i, SupportedIn (φ i) (centers i - L / 2) (centers i + L / 2)) → (∀ i, IsBalanced (φ i)) → η * normSq (∑ i : Fin r, φ i) ≤ Q_form (∑ i : Fin r, φ i) ∧ (∑ i : Fin r, φ i ≠ 0 → 0 < Q_form (∑ i : Fin r, φ i))) := by set a := fun k : Fin r => centers k - L / 2 set b := fun k : Fin r => centers k + L / 2 have hL_δ : L ≤ δ / 2 := le_trans hL_le (min_le_left _ _) have hL_log2_half : L ≤ Real.log 2 / 2 := le_trans hL_le (le_trans (min_le_right _ _) (min_le_left _ _)) have hL_1 : L ≤ 1 := le_trans hL_le (le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_left _ _))) have hL_exp : L ≤ 4 * Real.exp (-weilConstA - ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) - η) := le_trans hL_le (le_trans (min_le_right _ _) (le_trans (min_le_right _ _) (min_le_right _ _))) have hL_log2 : L ≤ Real.log 2 := by have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) linarith have hlen : ∀ i : Fin r, b i - a i = L := fun i => by simp only [a, b]; ring have hsep : ∀ i j : Fin r, i < j → b i < a j := by intro i j hij simp only [a, b] linarith [hgap i j hij] -- Bound `m(L) ≥ log(4/L) - A ≥ (r - 1) (P_D + C_δ) + η`. have hm_ge : ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) + η ≤ m_func L := by have h1 := m_func_ge_log_four_div_sub_A hL_pos have hdiv : Real.exp (weilConstA + ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) + η) ≤ 4 / L := by rw [le_div_iff₀ hL_pos] have hinv : Real.exp (-weilConstA - ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) - η) = (Real.exp (weilConstA + ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) + η))⁻¹ := by rw [← Real.exp_neg]; congr 1; ring rw [hinv] at hL_exp have hexp_pos : 0 < Real.exp (weilConstA + ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) + η) := Real.exp_pos _ have hmul := mul_le_mul_of_nonneg_left hL_exp (le_of_lt hexp_pos) have hcancel : Real.exp (weilConstA + ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) + η) * (4 * (Real.exp (weilConstA + ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) + η))⁻¹) = 4 := by field_simp [ne_of_gt hexp_pos] linarith have hlog := Real.log_le_log (Real.exp_pos _) hdiv rw [Real.log_exp] at hlog linarith -- Deduce row dominance `rowMargin a b i ≥ η` for every `i : Fin r`. have hrow : ∀ i : Fin r, η ≤ rowMargin a b i := by intro i unfold rowMargin rw [hlen i] have hsum_le : ∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j ≤ ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) := by have hcard : (Finset.univ.filter (fun j : Fin r => j ≠ i)).card = r - 1 := by have hcompl : Finset.univ.filter (fun j : Fin r => j ≠ i) = Finset.univ.erase i := by ext j; simp [Finset.mem_erase] rw [hcompl, Finset.card_erase_of_mem (Finset.mem_univ i), Finset.card_fin] calc ∑ j ∈ Finset.univ.filter (fun j => j ≠ i), offDiagBound a b i j ≤ ∑ _j ∈ Finset.univ.filter (fun j => j ≠ i), (P_D_bound D + C_delta δ) := Finset.sum_le_sum (fun j hj => offDiagBound_le_fixed_center_bound hδ_pos hgap hspan hL_pos hL_δ hL_1 (Finset.mem_filter.mp hj).2.symm) _ = ((Finset.univ.filter (fun j : Fin r => j ≠ i)).card : ℝ) * (P_D_bound D + C_delta δ) := by rw [Finset.sum_const, nsmul_eq_mul] _ = ((r : ℝ) - 1) * (P_D_bound D + C_delta δ) := by rw [hcard, Nat.cast_sub hr, Nat.cast_one] linarith refine ⟨hrow, fun φ hsupp hbal => ?_⟩ have hM := row_dominance_implies_matrix_lower_bound hsep hrow have hpos := theorem1_uniform_positivity (fun i => by rw [hlen i]; exact hL_pos) (fun i => by rw [hlen i]; exact hL_log2) hsep hsupp hbal hM (fun _ => (1 : ℂ)) have hsum_one : (∑ i : Fin r, (1 : ℂ) • φ i) = ∑ i : Fin r, φ i := by refine Finset.sum_congr rfl (fun i _ => one_smul ℂ (φ i)) rw [hsum_one] at hpos refine ⟨hpos, fun hne => ?_⟩ exact lt_of_lt_of_le (mul_pos hη_pos (normSq_pos_of_ne_zero hne)) hpos /-- **Theorem 2 (existential statement, F04 §6)**: For any fixed finitely many distinct real centers `c_1 < ... < c_r` (`r ≥ 1`) and any margin `η > 0`, there exists `L₀ > 0` such that for every common width `L ∈ (0, L₀]`, `Q(∑_i φ_i) ≥ η ‖∑_i φ_i‖_2^2` (and hence `Q(∑_i φ_i) > 0` whenever `∑_i φ_i ≠ 0`) on all locally balanced smooth functions supported in `[c_i - L/2, c_i + L/2]`. -/ theorem theorem2_fixed_centers {r : ℕ} (hr : 1 ≤ r) (centers : Fin r → ℝ) (hmono : StrictMono centers) {η : ℝ} (hη : 0 < η) : ∃ L₀ > 0, ∀ L : ℝ, 0 < L → L ≤ L₀ → ∀ φ : Fin r → TestFn, (∀ i, SupportedIn (φ i) (centers i - L / 2) (centers i + L / 2)) → (∀ i, IsBalanced (φ i)) → η * normSq (∑ i : Fin r, φ i) ≤ Q_form (∑ i : Fin r, φ i) ∧ (∑ i : Fin r, φ i ≠ 0 → 0 < Q_form (∑ i : Fin r, φ i)) := by -- Extract minimum positive separation `δ` and finite span `D`. let pairs : Finset (Fin r × Fin r) := Finset.univ.filter (fun p => p.1 < p.2) have hδ_ex : ∃ δ > 0, ∀ i j : Fin r, i < j → δ ≤ centers j - centers i := by by_cases hne : pairs.Nonempty · refine ⟨pairs.inf' hne (fun p => centers p.2 - centers p.1), ?_, ?_⟩ · show 0 < pairs.inf' hne (fun p => centers p.2 - centers p.1) rw [Finset.lt_inf'_iff] intro p hp have hlt : p.1 < p.2 := (Finset.mem_filter.mp hp).2 linarith [hmono hlt] · intro i j hij exact Finset.inf'_le (fun p : Fin r × Fin r => centers p.2 - centers p.1) (Finset.mem_filter.mpr ⟨Finset.mem_univ (i, j), hij⟩) · refine ⟨1, zero_lt_one, fun i j hij => ?_⟩ exfalso exact hne ⟨(i, j), Finset.mem_filter.mpr ⟨Finset.mem_univ (i, j), hij⟩⟩ obtain ⟨δ, hδ_pos, hgap⟩ := hδ_ex set D := centers ⟨r - 1, by omega⟩ - centers ⟨0, by omega⟩ have hspan : ∀ i j : Fin r, i < j → centers j - centers i ≤ D := by intro i j _ have hi : centers ⟨0, by omega⟩ ≤ centers i := hmono.monotone (show (⟨0, by omega⟩ : Fin r) ≤ i from Nat.zero_le i.val) have hj : centers j ≤ centers ⟨r - 1, by omega⟩ := hmono.monotone (show j ≤ ⟨r - 1, by omega⟩ from Nat.le_sub_one_of_lt j.2) linarith refine ⟨explicitWidthBound r δ D η, explicitWidthBound_pos r hδ_pos D η, fun L hL_pos hL_le => ?_⟩ exact (theorem2_fixed_centers_explicit hr hδ_pos hη hgap hspan hL_pos hL_le).2 end F04Riemann