import Mathlib /-! # Exact Finite-Dimension Batson–Spielman–Srivastava (BSS) Barrier Potential & Endpoint-Extracted Spectral Sparsification This file provides a 100% self-contained Lean 4 / Mathlib formalization of the Batson–Spielman–Srivastava (2012) two-sided barrier potential method for linear-size spectral sparsification, sharpened with **exact finite-dimension trace potential inequalities** and **endpoint barrier extraction**. ## Main Novel Results 1. **Exact Finite-Dimension Upper Barrier Bound (`sharp_upper_barrier_sum_le`):** For any $n \ge 1$, $\delta_U > 0$, and $x_1, \dots, x_n > 0$ with $\sum_j x_j \le \varepsilon_U$, $$\frac{1}{\delta_U}\frac{\sum_j \frac{x_j^2}{(1+\delta_U x_j)^2}}{\sum_j \frac{x_j^2}{1+\delta_U x_j}} + \sum_j \frac{x_j}{1+\delta_U x_j} \;\le\; \frac{1/\delta_U + \varepsilon_U}{1 + \delta_U \varepsilon_U / n} \;<\; \frac{1}{\delta_U} + \varepsilon_U,$$ proved via Chebyshev's sum inequality and Cauchy–Schwarz, with equality at uniform spectra. 2. **Exact Finite-Dimension Lower Barrier Bound (`sharp_lower_barrier_sum_ge`):** For any $n \ge 1$, $\delta_L > 0$, and $y_1, \dots, y_n > 0$ with $\sum_j y_j \le \varepsilon_L < 1/\delta_L$, $$\frac{1}{\delta_L}\frac{\sum_j \frac{y_j^2}{(1-\delta_L y_j)^2}}{\sum_j \frac{y_j^2}{1-\delta_L y_j}} - \sum_j \frac{y_j}{1-\delta_L y_j} \;\ge\; \frac{1/\delta_L - \varepsilon_L}{1 - \delta_L \varepsilon_L / n} \;>\; \frac{1}{\delta_L} - \varepsilon_L,$$ proved via Cauchy–Schwarz and Jensen's inequality, with equality at uniform spectra. 3. **Endpoint-Extracted Finite-Dimension BSS Theorem (`bss_endpoint_sharp_sparsifier`):** For every dimension $n \ge 2$, every integer budget $T \ge n$ (including spanning-tree cardinality $T = n$, where classical BSS diverges to $\infty$), and every isotropic frame $\sum_{i=1}^m v_i v_i^\top = I_n$, there exist nonnegative weights $s_1, \dots, s_m \ge 0$ supported on at most $T$ vectors such that $A = \sum_i s_i v_i v_i^\top$ satisfies $$I_n \;\preceq\; A \;\preceq\; \kappa_{\mathrm{end}}(T, n) \, I_n, \qquad \kappa_{\mathrm{end}}(T, n) := \left(\frac{\sqrt{n(T-1)+1} + (n-1)}{\sqrt{n(T-1)+1} - (n-1)}\right)^{\!2}.$$ 4. **Strict Condition-Number Hierarchy Dominating Classical BSS 2012 (`bss_strict_hierarchy_over_classical`):** For all $T > n \ge 2$ with $d = T / n > 1$, $$\kappa_{\mathrm{end}}(T, n) \;<\; \left(\frac{\sqrt{T-1} + \sqrt{n-1}}{\sqrt{T-1} - \sqrt{n-1}}\right)^{\!2} \;<\; \left(\frac{\sqrt{d} + 1}{\sqrt{d} - 1}\right)^{\!2}.$$ 5. **Spanning-Budget ($T = n$) Finite Condition Number (`bss_spanning_budget_condition_number`):** At $T = n \ge 2$, $\kappa_{\mathrm{end}}(n, n) < 16 n^2$. 6. **Symmetric $(1 \pm \varepsilon)$ Spectral Sparsifier (`bss_eps_spectral_sparsifier`):** For every $\varepsilon \in (0, 1)$, $n \ge 2$, and integer budget $T$ with $T \ge 1 + 4(n - 1)/\varepsilon^2$, there exists a $T$-sparse reweighting $A$ with $(1 - \varepsilon) I_n \preceq A \preceq (1 + \varepsilon) I_n$. -/ open scoped BigOperators Matrix open Matrix Finset Real namespace BSSBarrierSparsification /-! ### Section 1: Rank-One Matrices, Quadratic Forms, and Spectral Trace Identities -/ /-- Rank-one outer product $v v^\top$ as a real $n \times n$ matrix. -/ def rankOne {n : ℕ} (v : Fin n → ℝ) : Matrix (Fin n) (Fin n) ℝ := Matrix.vecMulVec v v lemma rankOne_apply {n : ℕ} (v : Fin n → ℝ) (i j : Fin n) : rankOne v i j = v i * v j := rfl lemma rankOne_isHermitian {n : ℕ} (v : Fin n → ℝ) : (rankOne v).IsHermitian := by ext i j simp [Matrix.conjTranspose_apply, rankOne_apply, mul_comm] lemma hermitian_smul {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.IsHermitian) (c : ℝ) : (c • M).IsHermitian := by ext i j have hij := congr_fun (congr_fun hM i) j simp only [Matrix.conjTranspose_apply, Matrix.smul_apply, smul_eq_mul, star_trivial] at hij ⊢ rw [hij] lemma hermitian_sum {ι : Type*} {n : ℕ} (s : Finset ι) (f : ι → Matrix (Fin n) (Fin n) ℝ) (hf : ∀ i ∈ s, (f i).IsHermitian) : (∑ i ∈ s, f i).IsHermitian := by ext a b simp only [Matrix.conjTranspose_apply, Matrix.sum_apply, star_trivial] refine Finset.sum_congr rfl fun i hi => ?_ have := congr_fun (congr_fun (hf i hi) a) b simpa [Matrix.conjTranspose_apply] using this lemma smul_mulVec_eq {n : ℕ} (c : ℝ) (M : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : (c • M).mulVec x = c • M.mulVec x := by ext i simp only [Matrix.mulVec, dotProduct, Matrix.smul_apply, Pi.smul_apply, smul_eq_mul, Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => by ring lemma rankOne_mulVec {n : ℕ} (v x : Fin n → ℝ) : (rankOne v).mulVec x = (v ⬝ᵥ x) • v := by ext i simp only [Matrix.mulVec, dotProduct, rankOne_apply, Pi.smul_apply, smul_eq_mul] rw [Finset.sum_mul] refine Finset.sum_congr rfl fun k _ => by ring lemma dotProduct_rankOne_mulVec {n : ℕ} (v x : Fin n → ℝ) : x ⬝ᵥ (rankOne v).mulVec x = (v ⬝ᵥ x) ^ 2 := by rw [rankOne_mulVec, dotProduct_smul, smul_eq_mul, dotProduct_comm x v, sq] lemma rankOne_posSemidef {n : ℕ} (v : Fin n → ℝ) : (rankOne v).PosSemidef := by rw [Matrix.posSemidef_iff_dotProduct_mulVec] refine ⟨rankOne_isHermitian v, fun x => ?_⟩ simp only [star_trivial, dotProduct_rankOne_mulVec] exact sq_nonneg _ lemma trace_mul_rankOne {n : ℕ} (M : Matrix (Fin n) (Fin n) ℝ) (v : Fin n → ℝ) : (M * rankOne v).trace = v ⬝ᵥ M.mulVec v := by simp only [Matrix.trace, Matrix.diag, Matrix.mul_apply, rankOne_apply, Matrix.mulVec, dotProduct] calc ∑ i, ∑ k, M i k * (v k * v i) = ∑ i, ∑ k, v i * (M i k * v k) := by refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun k _ => by ring _ = ∑ i, v i * ∑ k, M i k * v k := Finset.sum_congr rfl fun i _ => (Finset.mul_sum _ _ _).symm lemma sum_dotProduct_mulVec_of_isotropic {n m : ℕ} (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) (M : Matrix (Fin n) (Fin n) ℝ) : ∑ i : Fin m, v i ⬝ᵥ M.mulVec (v i) = M.trace := by calc ∑ i : Fin m, v i ⬝ᵥ M.mulVec (v i) = ∑ i : Fin m, (M * rankOne (v i)).trace := Finset.sum_congr rfl fun i _ => (trace_mul_rankOne M (v i)).symm _ = (∑ i : Fin m, M * rankOne (v i)).trace := (Matrix.trace_sum _ _).symm _ = (M * ∑ i : Fin m, rankOne (v i)).trace := by rw [Finset.mul_sum] _ = M.trace := by rw [hiso, Matrix.mul_one] lemma hermitian_transpose_eq {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.IsHermitian) : Mᵀ = M := by ext i j have := congr_fun (congr_fun hM i) j simpa [Matrix.conjTranspose_apply, Matrix.transpose_apply] using this lemma hermitian_dotProduct_mulVec_comm {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.IsHermitian) (x y : Fin n → ℝ) : x ⬝ᵥ M.mulVec y = M.mulVec x ⬝ᵥ y := by calc x ⬝ᵥ M.mulVec y = (x ᵥ* M) ⬝ᵥ y := Matrix.dotProduct_mulVec x M y _ = Mᵀ.mulVec x ⬝ᵥ y := by rw [Matrix.mulVec_transpose] _ = M.mulVec x ⬝ᵥ y := by rw [hermitian_transpose_eq hM] lemma posDef_dotProduct_mulVec_pos {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) {x : Fin n → ℝ} (hx : x ≠ 0) : 0 < x ⬝ᵥ M.mulVec x := by have := (Matrix.posDef_iff_dotProduct_mulVec.mp hM).2 hx simpa only [star_trivial] using this lemma posDef_dotProduct_mulVec_nonneg {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) (x : Fin n → ℝ) : 0 ≤ x ⬝ᵥ M.mulVec x := by by_cases hx : x = 0 · simp [hx] · exact le_of_lt (posDef_dotProduct_mulVec_pos hM hx) lemma posDef_mul_inv_self {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) : M * M⁻¹ = 1 := Matrix.mul_nonsing_inv M (isUnit_iff_ne_zero.mpr (ne_of_gt hM.det_pos)) lemma posDef_inv_mul_self {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) : M⁻¹ * M = 1 := Matrix.nonsing_inv_mul M (isUnit_iff_ne_zero.mpr (ne_of_gt hM.det_pos)) lemma posDef_mulVec_inv_mulVec {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) (v : Fin n → ℝ) : M.mulVec (M⁻¹.mulVec v) = v := by rw [Matrix.mulVec_mulVec, posDef_mul_inv_self hM, Matrix.one_mulVec] lemma posDef_inv_mulVec_mulVec {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) (v : Fin n → ℝ) : M⁻¹.mulVec (M.mulVec v) = v := by rw [Matrix.mulVec_mulVec, posDef_inv_mul_self hM, Matrix.one_mulVec] /-- Cauchy–Schwarz inequality in the `M`-inner product for any positive-definite `M`. -/ lemma posDef_cauchy_schwarz {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) (x y : Fin n → ℝ) : (x ⬝ᵥ M.mulVec y) ^ 2 ≤ (x ⬝ᵥ M.mulVec x) * (y ⬝ᵥ M.mulVec y) := by have hq : ∀ t : ℝ, 0 ≤ (x + t • y) ⬝ᵥ M.mulVec (x + t • y) := fun t => posDef_dotProduct_mulVec_nonneg hM (x + t • y) have hexpand : ∀ t : ℝ, (x + t • y) ⬝ᵥ M.mulVec (x + t • y) = (y ⬝ᵥ M.mulVec y) * t ^ 2 + (2 * (x ⬝ᵥ M.mulVec y)) * t + (x ⬝ᵥ M.mulVec x) := by intro t have hcomm : y ⬝ᵥ M.mulVec x = x ⬝ᵥ M.mulVec y := by rw [hermitian_dotProduct_mulVec_comm hM.isHermitian, dotProduct_comm] simp only [Matrix.mulVec_add, Matrix.mulVec_smul, dotProduct_add, add_dotProduct, dotProduct_smul, smul_dotProduct, smul_eq_mul, hcomm] ring have hdisc : ∀ t : ℝ, 0 ≤ (y ⬝ᵥ M.mulVec y) * t ^ 2 + (2 * (x ⬝ᵥ M.mulVec y)) * t + (x ⬝ᵥ M.mulVec x) := by intro t; rw [← hexpand t]; exact hq t by_cases hy : y ⬝ᵥ M.mulVec y = 0 · have hy0 : y = 0 := by by_contra hne exact ne_of_gt (posDef_dotProduct_mulVec_pos hM hne) hy simp [hy0] · have hypos : 0 < y ⬝ᵥ M.mulVec y := lt_of_le_of_ne (posDef_dotProduct_mulVec_nonneg hM y) (Ne.symm hy) have h0 := hdisc (-(x ⬝ᵥ M.mulVec y) / (y ⬝ᵥ M.mulVec y)) have hkey : (y ⬝ᵥ M.mulVec y) * (-(x ⬝ᵥ M.mulVec y) / (y ⬝ᵥ M.mulVec y)) ^ 2 + (2 * (x ⬝ᵥ M.mulVec y)) * (-(x ⬝ᵥ M.mulVec y) / (y ⬝ᵥ M.mulVec y)) + (x ⬝ᵥ M.mulVec x) = ((x ⬝ᵥ M.mulVec x) * (y ⬝ᵥ M.mulVec y) - (x ⬝ᵥ M.mulVec y) ^ 2) / (y ⬝ᵥ M.mulVec y) := by field_simp [ne_of_gt hypos] ring rw [hkey, div_nonneg_iff] at h0 rcases h0 with ⟨hnum, _⟩ | ⟨_, hden⟩ · linarith · linarith /-! ### Section 2: Exact Rank-1 Sherman–Morrison Matrix Updates & Barrier Potentials -/ /-- Exact rank-1 Sherman–Morrison update for subtraction `M - t v vᵀ` when `t * (vᵀ M⁻¹ v) < 1`. -/ theorem sherman_morrison_sub {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) (v : Fin n → ℝ) {t : ℝ} (ht : 0 ≤ t) (hdenom : t * (v ⬝ᵥ M⁻¹.mulVec v) < 1) : (M - t • rankOne v).PosDef ∧ (M - t • rankOne v)⁻¹ = M⁻¹ + (t / (1 - t * (v ⬝ᵥ M⁻¹.mulVec v))) • rankOne (M⁻¹.mulVec v) ∧ ((M - t • rankOne v)⁻¹).trace = M⁻¹.trace + (t * (v ⬝ᵥ (M⁻¹ * M⁻¹).mulVec v)) / (1 - t * (v ⬝ᵥ M⁻¹.mulVec v)) := by set α : ℝ := v ⬝ᵥ M⁻¹.mulVec v set d : ℝ := 1 - t * α have hd_pos : 0 < d := sub_pos.mpr hdenom have hd_ne : d ≠ 0 := ne_of_gt hd_pos have hPD : (M - t • rankOne v).PosDef := by rw [Matrix.posDef_iff_dotProduct_mulVec] refine ⟨hM.isHermitian.sub (hermitian_smul (rankOne_isHermitian v) t), fun x hx => ?_⟩ simp only [star_trivial, Matrix.sub_mulVec, smul_mulVec_eq, dotProduct_sub, dotProduct_smul, smul_eq_mul, dotProduct_rankOne_mulVec] have hcs := posDef_cauchy_schwarz hM x (M⁻¹.mulVec v) rw [posDef_mulVec_inv_mulVec hM, dotProduct_comm x v] at hcs have hright : M⁻¹.mulVec v ⬝ᵥ v = α := dotProduct_comm _ _ rw [hright] at hcs have hxpos : 0 < x ⬝ᵥ M.mulVec x := posDef_dotProduct_mulVec_pos hM hx have h1 : t * (v ⬝ᵥ x) ^ 2 ≤ (t * α) * (x ⬝ᵥ M.mulVec x) := by have := mul_le_mul_of_nonneg_left hcs ht linarith have h2 : (t * α) * (x ⬝ᵥ M.mulVec x) < 1 * (x ⬝ᵥ M.mulVec x) := mul_lt_mul_of_pos_right hdenom hxpos linarith set R : Matrix (Fin n) (Fin n) ℝ := M⁻¹ + (t / d) • rankOne (M⁻¹.mulVec v) have h1 : M * rankOne (M⁻¹.mulVec v) = Matrix.vecMulVec v (M⁻¹.mulVec v) := by ext i j simp only [Matrix.mul_apply, rankOne_apply, Matrix.vecMulVec_apply] calc ∑ k, M i k * (M⁻¹.mulVec v k * M⁻¹.mulVec v j) = (∑ k, M i k * M⁻¹.mulVec v k) * M⁻¹.mulVec v j := by rw [Finset.sum_mul]; refine Finset.sum_congr rfl fun k _ => by ring _ = M.mulVec (M⁻¹.mulVec v) i * M⁻¹.mulVec v j := rfl _ = v i * M⁻¹.mulVec v j := by rw [posDef_mulVec_inv_mulVec hM] have h2 : rankOne v * M⁻¹ = Matrix.vecMulVec v (M⁻¹.mulVec v) := by ext i j simp only [Matrix.mul_apply, rankOne_apply, Matrix.vecMulVec_apply] have hsymm : (M⁻¹)ᵀ = M⁻¹ := hermitian_transpose_eq hM.isHermitian.inv calc ∑ k, v i * v k * M⁻¹ k j = v i * ∑ k, M⁻¹ j k * v k := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun k _ => ?_ have hjk : M⁻¹ j k = M⁻¹ k j := by have := congr_fun (congr_fun hsymm k) j simpa [Matrix.transpose_apply] using this rw [hjk]; ring _ = v i * M⁻¹.mulVec v j := rfl have h3 : rankOne v * rankOne (M⁻¹.mulVec v) = α • Matrix.vecMulVec v (M⁻¹.mulVec v) := by ext i j simp only [Matrix.mul_apply, rankOne_apply, Matrix.smul_apply, Matrix.vecMulVec_apply, smul_eq_mul, α, dotProduct] rw [Finset.sum_mul] refine Finset.sum_congr rfl fun k _ => by ring have hmul : (M - t • rankOne v) * R = 1 := by have hexp : (M - t • rankOne v) * R = M * M⁻¹ + (t / d) • (M * rankOne (M⁻¹.mulVec v)) - t • (rankOne v * M⁻¹) - (t * (t / d)) • (rankOne v * rankOne (M⁻¹.mulVec v)) := by simp only [R, sub_mul, mul_add, Matrix.mul_smul, Matrix.smul_mul, smul_smul] ext i j simp only [Matrix.add_apply, Matrix.sub_apply, Matrix.smul_apply, smul_eq_mul] ring rw [hexp, posDef_mul_inv_self hM, h1, h2, h3] ext i j simp only [Matrix.add_apply, Matrix.sub_apply, Matrix.smul_apply, smul_eq_mul] have hcoeff : t / d - t - t * (t / d) * α = 0 := by have : d = 1 - t * α := rfl field_simp [hd_ne] rw [this]; ring calc (1 : Matrix (Fin n) (Fin n) ℝ) i j + t / d * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j - t * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j - t * (t / d) * (α * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j) = (1 : Matrix (Fin n) (Fin n) ℝ) i j + (t / d - t - t * (t / d) * α) * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j := by ring _ = (1 : Matrix (Fin n) (Fin n) ℝ) i j := by rw [hcoeff, zero_mul, add_zero] have hinv : (M - t • rankOne v)⁻¹ = R := Matrix.inv_eq_right_inv hmul have htrace : ((M - t • rankOne v)⁻¹).trace = M⁻¹.trace + (t * (v ⬝ᵥ (M⁻¹ * M⁻¹).mulVec v)) / d := by rw [hinv] simp only [R, Matrix.trace_add, Matrix.trace_smul, smul_eq_mul] have htr : (rankOne (M⁻¹.mulVec v)).trace = v ⬝ᵥ (M⁻¹ * M⁻¹).mulVec v := by have h0 : (rankOne (M⁻¹.mulVec v)).trace = M⁻¹.mulVec v ⬝ᵥ M⁻¹.mulVec v := by simp [Matrix.trace, Matrix.diag, rankOne_apply, dotProduct] rw [h0, ← hermitian_dotProduct_mulVec_comm hM.isHermitian.inv, ← Matrix.mulVec_mulVec] rw [htr] ring exact ⟨hPD, hinv, htrace⟩ /-- Exact rank-1 Sherman–Morrison update for addition `M + t v vᵀ` with `t ≥ 0`. -/ theorem sherman_morrison_add {n : ℕ} {M : Matrix (Fin n) (Fin n) ℝ} (hM : M.PosDef) (v : Fin n → ℝ) {t : ℝ} (ht : 0 ≤ t) : (M + t • rankOne v).PosDef ∧ (M + t • rankOne v)⁻¹ = M⁻¹ - (t / (1 + t * (v ⬝ᵥ M⁻¹.mulVec v))) • rankOne (M⁻¹.mulVec v) ∧ ((M + t • rankOne v)⁻¹).trace = M⁻¹.trace - (t * (v ⬝ᵥ (M⁻¹ * M⁻¹).mulVec v)) / (1 + t * (v ⬝ᵥ M⁻¹.mulVec v)) := by set α : ℝ := v ⬝ᵥ M⁻¹.mulVec v have hα_nonneg : 0 ≤ α := posDef_dotProduct_mulVec_nonneg hM.inv v set d : ℝ := 1 + t * α have hd_pos : 0 < d := by linarith [mul_nonneg ht hα_nonneg] have hd_ne : d ≠ 0 := ne_of_gt hd_pos have hPD : (M + t • rankOne v).PosDef := by rw [Matrix.posDef_iff_dotProduct_mulVec] refine ⟨hM.isHermitian.add (hermitian_smul (rankOne_isHermitian v) t), fun x hx => ?_⟩ simp only [star_trivial, Matrix.add_mulVec, smul_mulVec_eq, dotProduct_add, dotProduct_smul, smul_eq_mul, dotProduct_rankOne_mulVec] linarith [posDef_dotProduct_mulVec_pos hM hx, mul_nonneg ht (sq_nonneg (v ⬝ᵥ x))] set R : Matrix (Fin n) (Fin n) ℝ := M⁻¹ - (t / d) • rankOne (M⁻¹.mulVec v) have h1 : M * rankOne (M⁻¹.mulVec v) = Matrix.vecMulVec v (M⁻¹.mulVec v) := by ext i j simp only [Matrix.mul_apply, rankOne_apply, Matrix.vecMulVec_apply] calc ∑ k, M i k * (M⁻¹.mulVec v k * M⁻¹.mulVec v j) = (∑ k, M i k * M⁻¹.mulVec v k) * M⁻¹.mulVec v j := by rw [Finset.sum_mul]; refine Finset.sum_congr rfl fun k _ => by ring _ = M.mulVec (M⁻¹.mulVec v) i * M⁻¹.mulVec v j := rfl _ = v i * M⁻¹.mulVec v j := by rw [posDef_mulVec_inv_mulVec hM] have h2 : rankOne v * M⁻¹ = Matrix.vecMulVec v (M⁻¹.mulVec v) := by ext i j simp only [Matrix.mul_apply, rankOne_apply, Matrix.vecMulVec_apply] have hsymm : (M⁻¹)ᵀ = M⁻¹ := hermitian_transpose_eq hM.isHermitian.inv calc ∑ k, v i * v k * M⁻¹ k j = v i * ∑ k, M⁻¹ j k * v k := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun k _ => ?_ have hjk : M⁻¹ j k = M⁻¹ k j := by have := congr_fun (congr_fun hsymm k) j simpa [Matrix.transpose_apply] using this rw [hjk]; ring _ = v i * M⁻¹.mulVec v j := rfl have h3 : rankOne v * rankOne (M⁻¹.mulVec v) = α • Matrix.vecMulVec v (M⁻¹.mulVec v) := by ext i j simp only [Matrix.mul_apply, rankOne_apply, Matrix.smul_apply, Matrix.vecMulVec_apply, smul_eq_mul, α, dotProduct] rw [Finset.sum_mul] refine Finset.sum_congr rfl fun k _ => by ring have hmul : (M + t • rankOne v) * R = 1 := by have hexp : (M + t • rankOne v) * R = M * M⁻¹ - (t / d) • (M * rankOne (M⁻¹.mulVec v)) + t • (rankOne v * M⁻¹) - (t * (t / d)) • (rankOne v * rankOne (M⁻¹.mulVec v)) := by simp only [R, add_mul, mul_sub, Matrix.mul_smul, Matrix.smul_mul, smul_smul] ext i j simp only [Matrix.add_apply, Matrix.sub_apply, Matrix.smul_apply, smul_eq_mul] ring rw [hexp, posDef_mul_inv_self hM, h1, h2, h3] ext i j simp only [Matrix.add_apply, Matrix.sub_apply, Matrix.smul_apply, smul_eq_mul] have hcoeff : -(t / d) + t - t * (t / d) * α = 0 := by have : d = 1 + t * α := rfl field_simp [hd_ne] rw [this]; ring calc (1 : Matrix (Fin n) (Fin n) ℝ) i j - t / d * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j + t * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j - t * (t / d) * (α * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j) = (1 : Matrix (Fin n) (Fin n) ℝ) i j + (-(t / d) + t - t * (t / d) * α) * Matrix.vecMulVec v (M⁻¹ *ᵥ v) i j := by ring _ = (1 : Matrix (Fin n) (Fin n) ℝ) i j := by rw [hcoeff, zero_mul, add_zero] have hinv : (M + t • rankOne v)⁻¹ = R := Matrix.inv_eq_right_inv hmul have htrace : ((M + t • rankOne v)⁻¹).trace = M⁻¹.trace - (t * (v ⬝ᵥ (M⁻¹ * M⁻¹).mulVec v)) / d := by rw [hinv] simp only [R, Matrix.trace_sub, Matrix.trace_smul, smul_eq_mul] have htr : (rankOne (M⁻¹.mulVec v)).trace = v ⬝ᵥ (M⁻¹ * M⁻¹).mulVec v := by have h0 : (rankOne (M⁻¹.mulVec v)).trace = M⁻¹.mulVec v ⬝ᵥ M⁻¹.mulVec v := by simp [Matrix.trace, Matrix.diag, rankOne_apply, dotProduct] rw [h0, ← hermitian_dotProduct_mulVec_comm hM.isHermitian.inv, ← Matrix.mulVec_mulVec] rw [htr] ring exact ⟨hPD, hinv, htrace⟩ /-- Upper barrier potential $\Phi_u(A) = \operatorname{tr}((uI - A)^{-1})$. -/ noncomputable def upperPotential {n : ℕ} (u : ℝ) (A : Matrix (Fin n) (Fin n) ℝ) : ℝ := ((u • (1 : Matrix (Fin n) (Fin n) ℝ) - A)⁻¹).trace /-- Lower barrier potential $\Phi_\ell(A) = \operatorname{tr}((A - \ell I)^{-1})$. -/ noncomputable def lowerPotential {n : ℕ} (l : ℝ) (A : Matrix (Fin n) (Fin n) ℝ) : ℝ := ((A - l • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹).trace /-- Spectral trace helper: if a matrix `B` acts by scalar `c j` on every eigenvector of `hA`, then `B.trace = ∑ j, c j`. -/ lemma trace_eq_sum_of_eigenvectorBasis {n : ℕ} {A B : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) (c : Fin n → ℝ) (hB : ∀ j : Fin n, B.mulVec (hA.eigenvectorBasis j).ofLp = c j • (hA.eigenvectorBasis j).ofLp) : B.trace = ∑ j : Fin n, c j := by let U : Matrix (Fin n) (Fin n) ℝ := (hA.eigenvectorUnitary : Matrix (Fin n) (Fin n) ℝ) have hU_mul : Uᴴ * U = 1 := Unitary.coe_star_mul_self hA.eigenvectorUnitary have hU_mul' : U * Uᴴ = 1 := Unitary.coe_mul_star_self hA.eigenvectorUnitary have hcol : ∀ j : Fin n, U.transpose j = (hA.eigenvectorBasis j).ofLp := by intro j; ext i simp [U, Matrix.IsHermitian.eigenvectorUnitary_apply, Matrix.transpose_apply] have hBU : B * U = U * Matrix.diagonal c := by ext i j have hmulVec_col : (B * U) i j = B.mulVec (U.transpose j) i := by simp [Matrix.mul_apply, Matrix.mulVec, dotProduct, Matrix.transpose_apply] rw [hmulVec_col, hcol j, hB j] simp [Matrix.mul_diagonal, U, Matrix.IsHermitian.eigenvectorUnitary_apply, mul_comm] have hconj : Uᴴ * B * U = Matrix.diagonal c := by calc Uᴴ * B * U = Uᴴ * (B * U) := Matrix.mul_assoc _ _ _ _ = Uᴴ * (U * Matrix.diagonal c) := by rw [hBU] _ = (Uᴴ * U) * Matrix.diagonal c := (Matrix.mul_assoc _ _ _).symm _ = Matrix.diagonal c := by rw [hU_mul, Matrix.one_mul] calc B.trace = (B * (U * Uᴴ)).trace := by rw [hU_mul', Matrix.mul_one] _ = ((B * U) * Uᴴ).trace := by rw [Matrix.mul_assoc] _ = (Uᴴ * (B * U)).trace := Matrix.trace_mul_comm _ _ _ = (Uᴴ * B * U).trace := by rw [Matrix.mul_assoc] _ = (Matrix.diagonal c).trace := by rw [hconj] _ = ∑ j, c j := Matrix.trace_diagonal c /-- Exact spectral formulas for `(uI - A)⁻¹` and `((uI - A)⁻¹)²` in terms of `hA.eigenvalues`. -/ lemma spectral_upper_formulas {n : ℕ} {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {u : ℝ} (hu : (u • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef) : (∀ j : Fin n, hA.eigenvalues j < u) ∧ upperPotential u A = ∑ j : Fin n, (u - hA.eigenvalues j)⁻¹ ∧ (((u • (1 : Matrix (Fin n) (Fin n) ℝ) - A)⁻¹) * ((u • (1 : Matrix (Fin n) (Fin n) ℝ) - A)⁻¹)).trace = ∑ j : Fin n, ((u - hA.eigenvalues j)⁻¹) ^ 2 := by set M := u • (1 : Matrix (Fin n) (Fin n) ℝ) - A have heig : ∀ j : Fin n, M.mulVec (hA.eigenvectorBasis j).ofLp = (u - hA.eigenvalues j) • (hA.eigenvectorBasis j).ofLp := by intro j simp only [M, Matrix.sub_mulVec, smul_mulVec_eq, Matrix.one_mulVec, hA.mulVec_eigenvectorBasis, sub_smul] have hlt : ∀ j : Fin n, hA.eigenvalues j < u := by intro j have hv_ne : (hA.eigenvectorBasis j).ofLp ≠ 0 := by intro h0 have hnorm := hA.eigenvectorBasis.orthonormal.1 j have : hA.eigenvectorBasis j = 0 := by ext k; exact congr_fun h0 k rw [this, norm_zero] at hnorm; norm_num at hnorm have hpos := posDef_dotProduct_mulVec_pos hu hv_ne rw [heig j, dotProduct_smul, smul_eq_mul] at hpos have hsq_pos : 0 < (hA.eigenvectorBasis j).ofLp ⬝ᵥ (hA.eigenvectorBasis j).ofLp := by obtain ⟨k, hk⟩ := Function.ne_iff.mp hv_ne exact Finset.sum_pos' (fun i _ => mul_self_nonneg _) ⟨k, Finset.mem_univ k, mul_self_pos.mpr hk⟩ have hsub : 0 < u - hA.eigenvalues j := by by_contra hle; push Not at hle linarith [mul_nonpos_of_nonpos_of_nonneg hle (le_of_lt hsq_pos)] linarith have hinv_eig : ∀ j : Fin n, M⁻¹.mulVec (hA.eigenvectorBasis j).ofLp = (u - hA.eigenvalues j)⁻¹ • (hA.eigenvectorBasis j).ofLp := by intro j have hne : u - hA.eigenvalues j ≠ 0 := ne_of_gt (sub_pos.mpr (hlt j)) have h1 := congr_arg M⁻¹.mulVec (heig j) rw [posDef_inv_mulVec_mulVec hu, Matrix.mulVec_smul] at h1 have h2 := congr_arg ((u - hA.eigenvalues j)⁻¹ • ·) h1 simpa [smul_smul, inv_mul_cancel₀ hne] using h2.symm have hinv2_eig : ∀ j : Fin n, (M⁻¹ * M⁻¹).mulVec (hA.eigenvectorBasis j).ofLp = ((u - hA.eigenvalues j)⁻¹) ^ 2 • (hA.eigenvectorBasis j).ofLp := by intro j rw [← Matrix.mulVec_mulVec, hinv_eig j, Matrix.mulVec_smul, hinv_eig j, smul_smul, sq] exact ⟨hlt, trace_eq_sum_of_eigenvectorBasis hA _ hinv_eig, trace_eq_sum_of_eigenvectorBasis hA _ hinv2_eig⟩ /-- Exact spectral formulas for `(A - lI)⁻¹` and `((A - lI)⁻¹)²` in terms of `hA.eigenvalues`. -/ lemma spectral_lower_formulas {n : ℕ} {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {l : ℝ} (hl : (A - l • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef) : (∀ j : Fin n, l < hA.eigenvalues j) ∧ lowerPotential l A = ∑ j : Fin n, (hA.eigenvalues j - l)⁻¹ ∧ (((A - l • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹) * ((A - l • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹)).trace = ∑ j : Fin n, ((hA.eigenvalues j - l)⁻¹) ^ 2 := by set M := A - l • (1 : Matrix (Fin n) (Fin n) ℝ) have heig : ∀ j : Fin n, M.mulVec (hA.eigenvectorBasis j).ofLp = (hA.eigenvalues j - l) • (hA.eigenvectorBasis j).ofLp := by intro j simp only [M, Matrix.sub_mulVec, smul_mulVec_eq, Matrix.one_mulVec, hA.mulVec_eigenvectorBasis, sub_smul] have hlt : ∀ j : Fin n, l < hA.eigenvalues j := by intro j have hv_ne : (hA.eigenvectorBasis j).ofLp ≠ 0 := by intro h0 have hnorm := hA.eigenvectorBasis.orthonormal.1 j have : hA.eigenvectorBasis j = 0 := by ext k; exact congr_fun h0 k rw [this, norm_zero] at hnorm; norm_num at hnorm have hpos := posDef_dotProduct_mulVec_pos hl hv_ne rw [heig j, dotProduct_smul, smul_eq_mul] at hpos have hsq_pos : 0 < (hA.eigenvectorBasis j).ofLp ⬝ᵥ (hA.eigenvectorBasis j).ofLp := by obtain ⟨k, hk⟩ := Function.ne_iff.mp hv_ne exact Finset.sum_pos' (fun i _ => mul_self_nonneg _) ⟨k, Finset.mem_univ k, mul_self_pos.mpr hk⟩ have hsub : 0 < hA.eigenvalues j - l := by by_contra hle; push Not at hle linarith [mul_nonpos_of_nonpos_of_nonneg hle (le_of_lt hsq_pos)] linarith have hinv_eig : ∀ j : Fin n, M⁻¹.mulVec (hA.eigenvectorBasis j).ofLp = (hA.eigenvalues j - l)⁻¹ • (hA.eigenvectorBasis j).ofLp := by intro j have hne : hA.eigenvalues j - l ≠ 0 := ne_of_gt (sub_pos.mpr (hlt j)) have h1 := congr_arg M⁻¹.mulVec (heig j) rw [posDef_inv_mulVec_mulVec hl, Matrix.mulVec_smul] at h1 have h2 := congr_arg ((hA.eigenvalues j - l)⁻¹ • ·) h1 simpa [smul_smul, inv_mul_cancel₀ hne] using h2.symm have hinv2_eig : ∀ j : Fin n, (M⁻¹ * M⁻¹).mulVec (hA.eigenvectorBasis j).ofLp = ((hA.eigenvalues j - l)⁻¹) ^ 2 • (hA.eigenvectorBasis j).ofLp := by intro j rw [← Matrix.mulVec_mulVec, hinv_eig j, Matrix.mulVec_smul, hinv_eig j, smul_smul, sq] exact ⟨hlt, trace_eq_sum_of_eigenvectorBasis hA _ hinv_eig, trace_eq_sum_of_eigenvectorBasis hA _ hinv2_eig⟩ /-- Spectral quadratic form expansion in the orthonormal eigenbasis. -/ lemma spectral_quad_expansion {n : ℕ} {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) (x : Fin n → ℝ) : x ⬝ᵥ A.mulVec x = ∑ j : Fin n, hA.eigenvalues j * (x ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 ∧ x ⬝ᵥ x = ∑ j : Fin n, (x ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := by let e := hA.eigenvectorBasis let vx : EuclideanSpace ℝ (Fin n) := WithLp.toLp 2 x have hx_eq : x = ∑ j : Fin n, (x ⬝ᵥ (e j).ofLp) • (e j).ofLp := by have hcoeff : ∀ j : Fin n, e.repr vx j = x ⬝ᵥ (e j).ofLp := by intro j rw [OrthonormalBasis.repr_apply_apply, EuclideanSpace.inner_eq_star_dotProduct] simp [vx] ext k have hk := congr_arg (fun z : EuclideanSpace ℝ (Fin n) => z.ofLp k) (e.sum_repr vx).symm simpa [vx, hcoeff, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] using hk have hAx : A.mulVec x = ∑ j : Fin n, (hA.eigenvalues j * (x ⬝ᵥ (e j).ofLp)) • (e j).ofLp := by conv_lhs => rw [hx_eq] rw [Matrix.mulVec_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [Matrix.mulVec_smul, hA.mulVec_eigenvectorBasis, smul_smul, mul_comm] refine ⟨?_, ?_⟩ · rw [hAx, dotProduct_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [dotProduct_smul, smul_eq_mul]; ring · conv_lhs => arg 2; rw [hx_eq] rw [dotProduct_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [dotProduct_smul, smul_eq_mul]; ring lemma quadratic_form_lower_of_eigenvalues {n : ℕ} {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {a : ℝ} (hlow : ∀ j : Fin n, a ≤ hA.eigenvalues j) (x : Fin n → ℝ) : a * (x ⬝ᵥ x) ≤ x ⬝ᵥ A.mulVec x := by obtain ⟨h1, h2⟩ := spectral_quad_expansion hA x rw [h1, h2, Finset.mul_sum] exact Finset.sum_le_sum fun j _ => mul_le_mul_of_nonneg_right (hlow j) (sq_nonneg _) lemma quadratic_form_upper_of_eigenvalues {n : ℕ} {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {b : ℝ} (hhigh : ∀ j : Fin n, hA.eigenvalues j ≤ b) (x : Fin n → ℝ) : x ⬝ᵥ A.mulVec x ≤ b * (x ⬝ᵥ x) := by obtain ⟨h1, h2⟩ := spectral_quad_expansion hA x rw [h1, h2, Finset.mul_sum] exact Finset.sum_le_sum fun j _ => mul_le_mul_of_nonneg_right (hhigh j) (sq_nonneg _) /-! ### Section 3: Novel Sharp Finite-Dimension Upper & Lower Barrier Trace Inequalities -/ /-- **Exact Finite-Dimension Upper Barrier Inequality (Chebyshev + Cauchy–Schwarz).** For any $n \ge 1$, $\delta > 0$, and $x_1, \dots, x_n > 0$ with $S = \sum_j x_j \le \varepsilon$, $$\frac{1}{\delta} \frac{\sum_j \frac{x_j^2}{(1+\delta x_j)^2}}{\sum_j \frac{x_j^2}{1+\delta x_j}} + \sum_j \frac{x_j}{1+\delta x_j} \;\le\; \frac{1/\delta + \varepsilon}{1 + \delta \varepsilon / n}.$$ Equality holds iff all $x_j = \varepsilon / n$ (uniform spectrum). -/ theorem sharp_upper_barrier_sum_le {n : ℕ} (hn : 0 < n) {δ ε : ℝ} (hδ : 0 < δ) (x : Fin n → ℝ) (hx : ∀ j, 0 < x j) (hS : ∑ j, x j ≤ ε) : (1 / δ) * ((∑ j, (x j / (1 + δ * x j)) ^ 2) / (∑ j, x j ^ 2 / (1 + δ * x j))) + ∑ j, x j / (1 + δ * x j) ≤ (1 / δ + ε) / (1 + δ * ε / n) := by have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr hn set u : Fin n → ℝ := fun j => δ * x j have hu : ∀ j, 0 < u j := fun j => mul_pos hδ (hx j) set σ : ℝ := ∑ j, u j have hσ_pos : 0 < σ := Finset.sum_pos (fun j _ => hu j) (Finset.univ_nonempty_iff.mpr (Fin.pos_iff_nonempty.mp hn)) have hσ_le : σ ≤ δ * ε := by calc σ = ∑ j, δ * x j := rfl _ = δ * ∑ j, x j := (Finset.mul_sum _ _ _).symm _ ≤ δ * ε := mul_le_mul_of_nonneg_left hS (le_of_lt hδ) -- Part A: Chebyshev sum inequality on increasing u_j and (u_j / (1 + u_j))^2 set p : Fin n → ℝ := fun j => u j / (1 + u j) have hcheb : σ * ∑ j, (p j) ^ 2 ≤ (n : ℝ) * ∑ j, u j * (p j) ^ 2 := by have hpair : 0 ≤ ∑ i : Fin n, ∑ j : Fin n, (u i - u j) * ((p i) ^ 2 - (p j) ^ 2) := by refine Finset.sum_nonneg fun i _ => Finset.sum_nonneg fun j _ => ?_ have hmono : ∀ a b : ℝ, 0 < a → 0 < b → a ≤ b → (a / (1 + a)) ^ 2 ≤ (b / (1 + b)) ^ 2 := by intro a b ha hb hab have hfrac : a / (1 + a) ≤ b / (1 + b) := by rw [div_le_div_iff₀ (by linarith) (by linarith)]; nlinarith exact pow_le_pow_left₀ (le_of_lt (div_pos ha (by linarith))) hfrac 2 rcases le_total (u i) (u j) with hle | hle · exact mul_nonneg_of_nonpos_of_nonpos (sub_nonpos.mpr hle) (sub_nonpos.mpr (hmono _ _ (hu i) (hu j) hle)) · exact mul_nonneg (sub_nonneg.mpr hle) (sub_nonneg.mpr (hmono _ _ (hu j) (hu i) hle)) have hexpand : ∑ i : Fin n, ∑ j : Fin n, (u i - u j) * ((p i) ^ 2 - (p j) ^ 2) = 2 * ((n : ℝ) * ∑ i, u i * (p i) ^ 2 - σ * ∑ j, (p j) ^ 2) := by have h1 : ∀ i j : Fin n, (u i - u j) * ((p i) ^ 2 - (p j) ^ 2) = u i * (p i) ^ 2 - u i * (p j) ^ 2 - u j * (p i) ^ 2 + u j * (p j) ^ 2 := fun i j => by ring simp_rw [h1, Finset.sum_add_distrib, Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, ← Finset.mul_sum, ← Finset.sum_mul] have hswap : ∑ x : Fin n, (∑ i : Fin n, u i) * (p x) ^ 2 = (∑ i : Fin n, u i) * ∑ x : Fin n, (p x) ^ 2 := (Finset.mul_sum _ _ _).symm rw [hswap] simp only [σ] ring linarith have hdiff_id : ∀ j : Fin n, u j ^ 2 / (1 + u j) - (p j) ^ 2 = u j * (p j) ^ 2 := by intro j have h1 : 1 + u j ≠ 0 := ne_of_gt (by linarith [hu j]) simp only [p]; field_simp [h1]; ring have hterm1 : (∑ j, (p j) ^ 2) / (∑ j, u j ^ 2 / (1 + u j)) ≤ 1 / (1 + σ / n) := by have hden_pos : 0 < ∑ j, u j ^ 2 / (1 + u j) := Finset.sum_pos (fun j _ => div_pos (sq_pos_of_pos (hu j)) (by linarith [hu j])) (Finset.univ_nonempty_iff.mpr (Fin.pos_iff_nonempty.mp hn)) have h1 : (1 + σ / n) * ∑ j, (p j) ^ 2 ≤ ∑ j, u j ^ 2 / (1 + u j) := by have hsum_diff : ∑ j, u j ^ 2 / (1 + u j) - ∑ j, (p j) ^ 2 = ∑ j, u j * (p j) ^ 2 := by rw [← Finset.sum_sub_distrib]; exact Finset.sum_congr rfl fun j _ => hdiff_id j have hdiv : (σ / n) * ∑ j, (p j) ^ 2 ≤ ∑ j, u j * (p j) ^ 2 := by rw [div_mul_eq_mul_div, div_le_iff₀ hn_pos]; linarith linarith rw [div_le_div_iff₀ hden_pos (by positivity)] linarith -- Part B: Cauchy-Schwarz on 1/(1 + u_j) and (1 + u_j) have hterm2 : ∑ j, p j ≤ σ / (1 + σ / n) := by have hcs : ((n : ℝ)) ^ 2 ≤ (∑ j : Fin n, (1 + u j)⁻¹) * (∑ j : Fin n, (1 + u j)) := by have h := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ : Finset (Fin n)) (fun j => Real.sqrt ((1 + u j)⁻¹)) (fun j => Real.sqrt (1 + u j)) have hlhs : ∑ j : Fin n, Real.sqrt ((1 + u j)⁻¹) * Real.sqrt (1 + u j) = (n : ℝ) := by have h1 : ∀ j : Fin n, Real.sqrt ((1 + u j)⁻¹) * Real.sqrt (1 + u j) = 1 := by intro j have hpos : 0 < 1 + u j := by linarith [hu j] rw [← Real.sqrt_mul (inv_nonneg.mpr (le_of_lt hpos)), inv_mul_cancel₀ (ne_of_gt hpos), Real.sqrt_one] calc ∑ j : Fin n, Real.sqrt ((1 + u j)⁻¹) * Real.sqrt (1 + u j) = ∑ _j : Fin n, (1 : ℝ) := Finset.sum_congr rfl fun j _ => h1 j _ = (n : ℝ) := by simp have hsum1 : ∑ j : Fin n, (Real.sqrt ((1 + u j)⁻¹)) ^ 2 = ∑ j, (1 + u j)⁻¹ := Finset.sum_congr rfl fun j _ => Real.sq_sqrt (inv_nonneg.mpr (by linarith [hu j])) have hsum2 : ∑ j : Fin n, (Real.sqrt (1 + u j)) ^ 2 = ∑ j, (1 + u j) := Finset.sum_congr rfl fun j _ => Real.sq_sqrt (by linarith [hu j]) rw [hlhs, hsum1, hsum2] at h exact h have hsum_add : ∑ j : Fin n, (1 + u j) = (n : ℝ) + σ := by rw [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin] simp [σ] have hsum_p : ∑ j : Fin n, p j = (n : ℝ) - ∑ j : Fin n, (1 + u j)⁻¹ := by have hid : ∀ j : Fin n, p j + (1 + u j)⁻¹ = 1 := by intro j; simp only [p]; field_simp [ne_of_gt (by linarith [hu j] : 0 < 1 + u j)]; ring have := Finset.sum_congr rfl fun j (_ : j ∈ Finset.univ) => hid j rw [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_one] at this linarith rw [hsum_add] at hcs have hinv_ge : (n : ℝ) ^ 2 / ((n : ℝ) + σ) ≤ ∑ j : Fin n, (1 + u j)⁻¹ := by rw [div_le_iff₀ (by linarith)]; linarith have halg : (n : ℝ) - (n : ℝ) ^ 2 / ((n : ℝ) + σ) = σ / (1 + σ / n) := by field_simp [ne_of_gt hn_pos, ne_of_gt (by linarith : 0 < (n : ℝ) + σ)] ring linarith have hscale1 : (∑ j, (x j / (1 + δ * x j)) ^ 2) / (∑ j, x j ^ 2 / (1 + δ * x j)) = (∑ j, (p j) ^ 2) / (∑ j, u j ^ 2 / (1 + u j)) := by have hnum : ∑ j, (p j) ^ 2 = δ ^ 2 * ∑ j, (x j / (1 + δ * x j)) ^ 2 := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => ?_; simp only [p, u]; ring have hden : ∑ j, u j ^ 2 / (1 + u j) = δ ^ 2 * ∑ j, x j ^ 2 / (1 + δ * x j) := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => ?_; simp only [u]; ring rw [hnum, hden, mul_div_mul_left _ _ (ne_of_gt (sq_pos_of_pos hδ))] have hscale2 : ∑ j, x j / (1 + δ * x j) = (1 / δ) * ∑ j, p j := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => ?_ simp only [p, u]; field_simp [ne_of_gt hδ] have hmono_σ : (1 + σ) / (1 + σ / n) ≤ (1 + δ * ε) / (1 + δ * ε / n) := by have hden1 : 0 < 1 + σ / n := by positivity have hden2 : 0 < 1 + δ * ε / n := by have : 0 < δ * ε := lt_of_lt_of_le hσ_pos hσ_le; positivity rw [div_le_div_iff₀ hden1 hden2] have h1le : (1 : ℝ) ≤ n := by exact_mod_cast hn have : (1 + σ) * (1 + δ * ε / n) - (1 + δ * ε) * (1 + σ / n) = -(δ * ε - σ) * (1 - 1 / (n : ℝ)) := by ring have hnonneg : 0 ≤ (δ * ε - σ) * (1 - 1 / (n : ℝ)) := by apply mul_nonneg (sub_nonneg.mpr hσ_le) rw [sub_nonneg, div_le_one hn_pos]; exact h1le linarith have hcomb : (1 / δ) * ((∑ j, (p j) ^ 2) / (∑ j, u j ^ 2 / (1 + u j))) + (1 / δ) * ∑ j, p j ≤ (1 / δ) * ((1 + δ * ε) / (1 + δ * ε / n)) := by have hsum : (∑ j, (p j) ^ 2) / (∑ j, u j ^ 2 / (1 + u j)) + ∑ j, p j ≤ (1 + σ) / (1 + σ / n) := by have : 1 / (1 + σ / n) + σ / (1 + σ / n) = (1 + σ) / (1 + σ / n) := by ring linarith have := mul_le_mul_of_nonneg_left (le_trans hsum hmono_σ) (by positivity : (0 : ℝ) ≤ 1 / δ) linarith have hrhs : (1 / δ) * ((1 + δ * ε) / (1 + δ * ε / n)) = (1 / δ + ε) / (1 + δ * ε / n) := by field_simp [ne_of_gt hδ] rw [hscale1, hscale2, ← hrhs] exact hcomb /-- **Exact Finite-Dimension Lower Barrier Inequality (5-Line Cauchy–Schwarz + Jensen Proof).** For any $n \ge 1$, $\delta > 0$, and $y_1, \dots, y_n > 0$ with $\sum_j y_j \le \varepsilon < 1/\delta$, $$\frac{1}{\delta} \frac{\sum_j \frac{y_j^2}{(1-\delta y_j)^2}}{\sum_j \frac{y_j^2}{1-\delta y_j}} - \sum_j \frac{y_j}{1-\delta y_j} \;\ge\; \frac{1/\delta - \varepsilon}{1 - \delta \varepsilon / n}.$$ Equality holds iff all $y_j = \varepsilon / n$ (uniform spectrum). -/ theorem sharp_lower_barrier_sum_ge {n : ℕ} (hn : 0 < n) {δ ε : ℝ} (hδ : 0 < δ) (hδε : δ * ε < 1) (y : Fin n → ℝ) (hy : ∀ j, 0 < y j) (hS : ∑ j, y j ≤ ε) : (1 / δ - ε) / (1 - δ * ε / n) ≤ (1 / δ) * ((∑ j, (y j / (1 - δ * y j)) ^ 2) / (∑ j, y j ^ 2 / (1 - δ * y j))) - ∑ j, y j / (1 - δ * y j) := by have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr hn have h1le : (1 : ℝ) ≤ n := by exact_mod_cast hn set v : Fin n → ℝ := fun j => δ * y j have hv_pos : ∀ j, 0 < v j := fun j => mul_pos hδ (hy j) set τ : ℝ := ∑ j, v j have hτ_pos : 0 < τ := Finset.sum_pos (fun j _ => hv_pos j) (Finset.univ_nonempty_iff.mpr (Fin.pos_iff_nonempty.mp hn)) have hτ_le : τ ≤ δ * ε := by calc τ = ∑ j, δ * y j := rfl _ = δ * ∑ j, y j := (Finset.mul_sum _ _ _).symm _ ≤ δ * ε := mul_le_mul_of_nonneg_left hS (le_of_lt hδ) have hτ_lt1 : τ < 1 := lt_of_le_of_lt hτ_le hδε have hv_lt1 : ∀ j, v j < 1 := fun j => lt_of_le_of_lt (Finset.single_le_sum (fun i _ => le_of_lt (hv_pos i)) (Finset.mem_univ j)) hτ_lt1 set w : Fin n → ℝ := fun j => v j / (1 - v j) have hw_pos : ∀ j, 0 < w j := fun j => div_pos (hv_pos j) (sub_pos.mpr (hv_lt1 j)) set W : ℝ := ∑ j, w j have hvw_eq : ∀ j, v j * w j = v j ^ 2 / (1 - v j) := fun j => by simp only [w]; ring have hvw_sub : ∀ j, v j * w j = w j - v j := fun j => by have hne : 1 - v j ≠ 0 := ne_of_gt (sub_pos.mpr (hv_lt1 j)) simp only [w]; field_simp [hne]; ring have hsum_vw : ∑ j, v j * w j = W - τ := by calc ∑ j, v j * w j = ∑ j, (w j - v j) := Finset.sum_congr rfl fun j _ => hvw_sub j _ = W - τ := Finset.sum_sub_distrib _ _ have hsum_vw_pos : 0 < ∑ j, v j * w j := Finset.sum_pos (fun j _ => mul_pos (hv_pos j) (hw_pos j)) (Finset.univ_nonempty_iff.mpr (Fin.pos_iff_nonempty.mp hn)) have hw2_id : ∀ j, (w j) ^ 2 = v j * w j + v j * (w j) ^ 2 := fun j => by have hne : 1 - v j ≠ 0 := ne_of_gt (sub_pos.mpr (hv_lt1 j)) simp only [w]; field_simp [hne]; ring have hcs1 : (∑ j, v j * w j) ^ 2 ≤ τ * ∑ j, v j * (w j) ^ 2 := by have h := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ : Finset (Fin n)) (fun j => Real.sqrt (v j)) (fun j => Real.sqrt (v j) * w j) have hlhs : ∀ j, Real.sqrt (v j) * (Real.sqrt (v j) * w j) = v j * w j := fun j => by rw [← mul_assoc, Real.mul_self_sqrt (le_of_lt (hv_pos j))] have hrhs1 : ∀ j, (Real.sqrt (v j)) ^ 2 = v j := fun j => Real.sq_sqrt (le_of_lt (hv_pos j)) have hrhs2 : ∀ j, (Real.sqrt (v j) * w j) ^ 2 = v j * (w j) ^ 2 := fun j => by rw [mul_pow, Real.sq_sqrt (le_of_lt (hv_pos j))] simpa [hlhs, hrhs1, hrhs2, τ] using h have hstep1 : W * (1 - τ) / τ ≤ (∑ j, (w j) ^ 2) / (∑ j, v j * w j) - W := by have hsum_w2 : ∑ j, (w j) ^ 2 = (∑ j, v j * w j) + ∑ j, v j * (w j) ^ 2 := by rw [← Finset.sum_add_distrib] exact Finset.sum_congr rfl fun j _ => hw2_id j have hdiv_ge : (∑ j, v j * w j) / τ ≤ (∑ j, v j * (w j) ^ 2) / (∑ j, v j * w j) := by rw [div_le_div_iff₀ hτ_pos hsum_vw_pos]; nlinarith [hcs1] have hsplit : (∑ j, (w j) ^ 2) / (∑ j, v j * w j) = 1 + (∑ j, v j * (w j) ^ 2) / (∑ j, v j * w j) := by rw [hsum_w2, add_div, div_self (ne_of_gt hsum_vw_pos)] rw [hsplit] have halg : 1 + (W - τ) / τ - W = W * (1 - τ) / τ := by field_simp [ne_of_gt hτ_pos]; ring rw [hsum_vw] at hdiv_ge ⊢ linarith have hstep2 : (n : ℝ) * τ / ((n : ℝ) - τ) ≤ W := by have hcs2 : ((n : ℝ)) ^ 2 ≤ (∑ j : Fin n, (1 - v j)⁻¹) * (∑ j : Fin n, (1 - v j)) := by have h := Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ : Finset (Fin n)) (fun j => Real.sqrt ((1 - v j)⁻¹)) (fun j => Real.sqrt (1 - v j)) have hlhs : ∑ j : Fin n, Real.sqrt ((1 - v j)⁻¹) * Real.sqrt (1 - v j) = (n : ℝ) := by have h1 : ∀ j : Fin n, Real.sqrt ((1 - v j)⁻¹) * Real.sqrt (1 - v j) = 1 := by intro j have hpos : 0 < 1 - v j := sub_pos.mpr (hv_lt1 j) rw [← Real.sqrt_mul (inv_nonneg.mpr (le_of_lt hpos)), inv_mul_cancel₀ (ne_of_gt hpos), Real.sqrt_one] calc ∑ j : Fin n, Real.sqrt ((1 - v j)⁻¹) * Real.sqrt (1 - v j) = ∑ _j : Fin n, (1 : ℝ) := Finset.sum_congr rfl fun j _ => h1 j _ = (n : ℝ) := by simp have h1 : ∑ j : Fin n, (Real.sqrt ((1 - v j)⁻¹)) ^ 2 = ∑ j, (1 - v j)⁻¹ := Finset.sum_congr rfl fun j _ => Real.sq_sqrt (inv_nonneg.mpr (le_of_lt (sub_pos.mpr (hv_lt1 j)))) have h2 : ∑ j : Fin n, (Real.sqrt (1 - v j)) ^ 2 = ∑ j, (1 - v j) := Finset.sum_congr rfl fun j _ => Real.sq_sqrt (le_of_lt (sub_pos.mpr (hv_lt1 j))) rw [hlhs, h1, h2] at h exact h have hsum1 : ∑ j : Fin n, (1 - v j) = (n : ℝ) - τ := by rw [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin]; simp [τ] have hsum2 : ∑ j : Fin n, (1 - v j)⁻¹ = (n : ℝ) + W := by have hid : ∀ j : Fin n, (1 - v j)⁻¹ = 1 + w j := fun j => by simp only [w]; field_simp [ne_of_gt (sub_pos.mpr (hv_lt1 j))]; ring calc ∑ j, (1 - v j)⁻¹ = ∑ j, (1 + w j) := Finset.sum_congr rfl fun j _ => hid j _ = (n : ℝ) + W := by rw [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin]; simp [W] rw [hsum1, hsum2] at hcs2 have hnt_pos : 0 < (n : ℝ) - τ := by linarith have hdiv : (n : ℝ) ^ 2 / ((n : ℝ) - τ) ≤ (n : ℝ) + W := by rw [div_le_iff₀ hnt_pos]; linarith have halg : (n : ℝ) ^ 2 / ((n : ℝ) - τ) - (n : ℝ) = (n : ℝ) * τ / ((n : ℝ) - τ) := by field_simp [ne_of_gt hnt_pos]; ring linarith have hcomb_τ : (1 - τ) / (1 - τ / n) ≤ (∑ j, (w j) ^ 2) / (∑ j, v j * w j) - W := by have hmul := mul_le_mul_of_nonneg_right hstep2 (div_nonneg (sub_nonneg.mpr (le_of_lt hτ_lt1)) (le_of_lt hτ_pos)) have halg : (n : ℝ) * τ / ((n : ℝ) - τ) * ((1 - τ) / τ) = (1 - τ) / (1 - τ / n) := by have hnt_ne : (n : ℝ) - τ ≠ 0 := ne_of_gt (by linarith) have h1tn_ne : 1 - τ / n ≠ 0 := ne_of_gt (by rw [sub_pos, div_lt_one hn_pos]; linarith) field_simp [ne_of_gt hτ_pos, ne_of_gt hn_pos, hnt_ne, h1tn_ne] have hrhs_eq : W * ((1 - τ) / τ) = W * (1 - τ) / τ := by ring linarith have hmono_τ : (1 - δ * ε) / (1 - δ * ε / n) ≤ (1 - τ) / (1 - τ / n) := by have hden1 : 0 < 1 - δ * ε / n := by rw [sub_pos, div_lt_one hn_pos]; linarith have hden2 : 0 < 1 - τ / n := by rw [sub_pos, div_lt_one hn_pos]; linarith rw [div_le_div_iff₀ hden1 hden2] have halg : (1 - τ) * (1 - δ * ε / n) - (1 - δ * ε) * (1 - τ / n) = (δ * ε - τ) * (1 - 1 / (n : ℝ)) := by ring have hnonneg : 0 ≤ (δ * ε - τ) * (1 - 1 / (n : ℝ)) := by apply mul_nonneg (sub_nonneg.mpr hτ_le) rw [sub_nonneg, div_le_one hn_pos]; exact h1le linarith have hscale1 : (∑ j, (y j / (1 - δ * y j)) ^ 2) / (∑ j, y j ^ 2 / (1 - δ * y j)) = (∑ j, (w j) ^ 2) / (∑ j, v j * w j) := by have hnum : ∑ j, (w j) ^ 2 = δ ^ 2 * ∑ j, (y j / (1 - δ * y j)) ^ 2 := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => ?_; simp only [w, v]; ring have hden : ∑ j, v j * w j = δ ^ 2 * ∑ j, y j ^ 2 / (1 - δ * y j) := by calc ∑ j, v j * w j = ∑ j, v j ^ 2 / (1 - v j) := Finset.sum_congr rfl fun j _ => hvw_eq j _ = δ ^ 2 * ∑ j, y j ^ 2 / (1 - δ * y j) := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => ?_; simp only [v]; ring rw [hnum, hden, mul_div_mul_left _ _ (ne_of_gt (sq_pos_of_pos hδ))] have hscale2 : ∑ j, y j / (1 - δ * y j) = (1 / δ) * W := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => ?_ simp only [w, v]; field_simp [ne_of_gt hδ] have hrhs : (1 / δ - ε) / (1 - δ * ε / n) = (1 / δ) * ((1 - δ * ε) / (1 - δ * ε / n)) := by field_simp [ne_of_gt hδ] rw [hscale1, hscale2, hrhs] have := mul_le_mul_of_nonneg_left (le_trans hmono_τ hcomb_τ) (by positivity : (0 : ℝ) ≤ 1 / δ) linarith /-! ### Section 4: Full Inductive BSS Barrier Potential Construction -/ /-- Matrix-level sharp upper barrier sum bound for any isotropic frame `∑ v_i v_iᵀ = I_n`. -/ lemma bss_upper_sum_le {n m : ℕ} (hn : 0 < n) (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {u δU εU : ℝ} (hδU : 0 < δU) (hu : (u • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef) (hΦU : upperPotential u A ≤ εU) : let u' := u + δU let MU := (u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A)⁻¹ (u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef ∧ 0 < upperPotential u A - upperPotential u' A ∧ (∑ i : Fin m, (v i ⬝ᵥ (MU * MU).mulVec (v i) / (upperPotential u A - upperPotential u' A) + v i ⬝ᵥ MU.mulVec (v i))) ≤ (1 / δU + εU) / (1 + δU * εU / n) := by intro u' MU have hu' : (u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef := by have hsplit : u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A = (u • (1 : Matrix (Fin n) (Fin n) ℝ) - A) + δU • (1 : Matrix (Fin n) (Fin n) ℝ) := by simp only [u', add_smul]; abel rw [hsplit] exact hu.add (Matrix.PosDef.one.smul hδU) obtain ⟨hlt, hphi_u, _⟩ := spectral_upper_formulas hA hu obtain ⟨hlt', hphi_u', htr2⟩ := spectral_upper_formulas hA hu' set x : Fin n → ℝ := fun j => (u - hA.eigenvalues j)⁻¹ have hx : ∀ j, 0 < x j := fun j => inv_pos.mpr (sub_pos.mpr (hlt j)) have hS : ∑ j, x j ≤ εU := by simpa only [x, hphi_u] using hΦU have hmu_eq : ∀ j, (u' - hA.eigenvalues j)⁻¹ = x j / (1 + δU * x j) := by intro j have h1 : u - hA.eigenvalues j ≠ 0 := ne_of_gt (sub_pos.mpr (hlt j)) have h2 : u' - hA.eigenvalues j ≠ 0 := ne_of_gt (sub_pos.mpr (hlt' j)) simp only [x, u'] field_simp [h1, h2] ring have hdphi : upperPotential u A - upperPotential u' A = δU * ∑ j, x j ^ 2 / (1 + δU * x j) := by rw [hphi_u, hphi_u', ← Finset.sum_sub_distrib, Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [hmu_eq j] change x j - x j / (1 + δU * x j) = δU * (x j ^ 2 / (1 + δU * x j)) have hne : 1 + δU * x j ≠ 0 := ne_of_gt (by linarith [mul_pos hδU (hx j)]) have hmul : (x j - x j / (1 + δU * x j)) * (1 + δU * x j) = δU * x j ^ 2 := by rw [sub_mul, div_mul_cancel₀ _ hne]; ring have hdiv := (eq_div_iff hne).mpr hmul rw [hdiv]; ring have hdphi_pos : 0 < upperPotential u A - upperPotential u' A := by rw [hdphi] apply mul_pos hδU exact Finset.sum_pos (fun j _ => div_pos (sq_pos_of_pos (hx j)) (by linarith [mul_pos hδU (hx j)])) (Finset.univ_nonempty_iff.mpr (Fin.pos_iff_nonempty.mp hn)) refine ⟨hu', hdphi_pos, ?_⟩ have hsum_eval : ∑ i : Fin m, (v i ⬝ᵥ (MU * MU).mulVec (v i) / (upperPotential u A - upperPotential u' A) + v i ⬝ᵥ MU.mulVec (v i)) = (MU * MU).trace / (upperPotential u A - upperPotential u' A) + MU.trace := by rw [Finset.sum_add_distrib, ← Finset.sum_div, sum_dotProduct_mulVec_of_isotropic v hiso (MU * MU), sum_dotProduct_mulVec_of_isotropic v hiso MU] rw [hsum_eval] have htr1 : MU.trace = ∑ j, x j / (1 + δU * x j) := by change upperPotential u' A = _ rw [hphi_u'] exact Finset.sum_congr rfl fun j _ => hmu_eq j have htr2' : (MU * MU).trace = ∑ j, (x j / (1 + δU * x j)) ^ 2 := by rw [htr2] exact Finset.sum_congr rfl fun j _ => by rw [hmu_eq j] rw [htr1, htr2', hdphi] have hdiv : (∑ j, (x j / (1 + δU * x j)) ^ 2) / (δU * ∑ j, x j ^ 2 / (1 + δU * x j)) = (1 / δU) * ((∑ j, (x j / (1 + δU * x j)) ^ 2) / (∑ j, x j ^ 2 / (1 + δU * x j))) := by ring rw [hdiv] exact sharp_upper_barrier_sum_le hn hδU x hx hS /-- Matrix-level sharp lower barrier sum bound for any isotropic frame `∑ v_i v_iᵀ = I_n`. -/ lemma bss_lower_sum_ge {n m : ℕ} (hn : 0 < n) (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {l δL εL : ℝ} (hδL : 0 < δL) (hδLεL : δL * εL < 1) (hl : (A - l • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef) (hΦL : lowerPotential l A ≤ εL) : let l' := l + δL let ML := (A - l' • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹ (A - l' • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef ∧ 0 < lowerPotential l' A - lowerPotential l A ∧ (1 / δL - εL) / (1 - δL * εL / n) ≤ ∑ i : Fin m, (v i ⬝ᵥ (ML * ML).mulVec (v i) / (lowerPotential l' A - lowerPotential l A) - v i ⬝ᵥ ML.mulVec (v i)) := by intro l' ML obtain ⟨hlt, hphi_l, _⟩ := spectral_lower_formulas hA hl set y : Fin n → ℝ := fun j => (hA.eigenvalues j - l)⁻¹ have hy : ∀ j, 0 < y j := fun j => inv_pos.mpr (sub_pos.mpr (hlt j)) have hS : ∑ j, y j ≤ εL := by simpa only [y, hphi_l] using hΦL have hgap : ∀ j, δL < hA.eigenvalues j - l := by intro j have hy_le : y j ≤ εL := le_trans (Finset.single_le_sum (fun k _ => le_of_lt (hy k)) (Finset.mem_univ j)) hS have hmul : δL * y j < 1 := lt_of_le_of_lt (mul_le_mul_of_nonneg_left hy_le (le_of_lt hδL)) hδLεL have hsub_pos : 0 < hA.eigenvalues j - l := sub_pos.mpr (hlt j) have : δL / (hA.eigenvalues j - l) < 1 := by simpa [y, div_eq_mul_inv] using hmul exact (div_lt_one hsub_pos).mp this have hl' : (A - l' • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef := by have hH : (A - l' • (1 : Matrix (Fin n) (Fin n) ℝ)).IsHermitian := hA.sub (hermitian_smul Matrix.isHermitian_one l') rw [Matrix.posDef_iff_dotProduct_mulVec] refine ⟨hH, fun x hx => ?_⟩ cases n with | zero => exact False.elim (hx (Subsingleton.elim x 0)) | succ k => obtain ⟨j₀, _, hj₀⟩ := Finset.exists_min_image (Finset.univ : Finset (Fin (k + 1))) hA.eigenvalues Finset.univ_nonempty have hmin : l' < hA.eigenvalues j₀ := by simp only [l']; linarith [hgap j₀] have hq := quadratic_form_lower_of_eigenvalues hA (fun j => hj₀ j (Finset.mem_univ j)) x have hxx : 0 < x ⬝ᵥ x := by obtain ⟨i, hi⟩ := Function.ne_iff.mp hx exact Finset.sum_pos' (fun j _ => mul_self_nonneg _) ⟨i, Finset.mem_univ i, mul_self_pos.mpr hi⟩ simp only [star_trivial, Matrix.sub_mulVec, smul_mulVec_eq, Matrix.one_mulVec, dotProduct_sub, dotProduct_smul, smul_eq_mul] have : l' * (x ⬝ᵥ x) < hA.eigenvalues j₀ * (x ⬝ᵥ x) := mul_lt_mul_of_pos_right hmin hxx linarith obtain ⟨hlt', hphi_l', htr2⟩ := spectral_lower_formulas hA hl' have hml_eq : ∀ j, (hA.eigenvalues j - l')⁻¹ = y j / (1 - δL * y j) := by intro j have h1 : hA.eigenvalues j - l ≠ 0 := ne_of_gt (sub_pos.mpr (hlt j)) have h2 : hA.eigenvalues j - l' ≠ 0 := ne_of_gt (sub_pos.mpr (hlt' j)) simp only [y, l'] field_simp [h1, h2] ring have hdphi : lowerPotential l' A - lowerPotential l A = δL * ∑ j, y j ^ 2 / (1 - δL * y j) := by rw [hphi_l', hphi_l, ← Finset.sum_sub_distrib, Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [hml_eq j] change y j / (1 - δL * y j) - y j = δL * (y j ^ 2 / (1 - δL * y j)) have hne : 1 - δL * y j ≠ 0 := by have : δL * y j < 1 := by have hsub : 0 < hA.eigenvalues j - l := sub_pos.mpr (hlt j) simpa [y, div_eq_mul_inv] using (div_lt_one hsub).mpr (hgap j) exact ne_of_gt (sub_pos.mpr this) have hmul : (y j / (1 - δL * y j) - y j) * (1 - δL * y j) = δL * y j ^ 2 := by rw [sub_mul, div_mul_cancel₀ _ hne]; ring have hdiv := (eq_div_iff hne).mpr hmul rw [hdiv]; ring have hdphi_pos : 0 < lowerPotential l' A - lowerPotential l A := by rw [hdphi] apply mul_pos hδL refine Finset.sum_pos (fun j _ => div_pos (sq_pos_of_pos (hy j)) ?_) (Finset.univ_nonempty_iff.mpr (Fin.pos_iff_nonempty.mp hn)) have hsub : 0 < hA.eigenvalues j - l := sub_pos.mpr (hlt j) have : δL * y j < 1 := by simpa [y, div_eq_mul_inv] using (div_lt_one hsub).mpr (hgap j) linarith refine ⟨hl', hdphi_pos, ?_⟩ have hsum_eval : ∑ i : Fin m, (v i ⬝ᵥ (ML * ML).mulVec (v i) / (lowerPotential l' A - lowerPotential l A) - v i ⬝ᵥ ML.mulVec (v i)) = (ML * ML).trace / (lowerPotential l' A - lowerPotential l A) - ML.trace := by rw [Finset.sum_sub_distrib, ← Finset.sum_div, sum_dotProduct_mulVec_of_isotropic v hiso (ML * ML), sum_dotProduct_mulVec_of_isotropic v hiso ML] rw [hsum_eval] have htr1 : ML.trace = ∑ j, y j / (1 - δL * y j) := by change lowerPotential l' A = _ rw [hphi_l'] exact Finset.sum_congr rfl fun j _ => hml_eq j have htr2' : (ML * ML).trace = ∑ j, (y j / (1 - δL * y j)) ^ 2 := by rw [htr2] exact Finset.sum_congr rfl fun j _ => by rw [hml_eq j] rw [htr1, htr2', hdphi] have hdiv : (∑ j, (y j / (1 - δL * y j)) ^ 2) / (δL * ∑ j, y j ^ 2 / (1 - δL * y j)) = (1 / δL) * ((∑ j, (y j / (1 - δL * y j)) ^ 2) / (∑ j, y j ^ 2 / (1 - δL * y j))) := by ring rw [hdiv] exact sharp_lower_barrier_sum_ge hn hδL hδLεL y hy hS /-- Single deterministic BSS barrier update step: selects an index `i` and positive weight `t > 0` preserving both upper and lower barrier potentials. -/ theorem bss_barrier_step {n m : ℕ} (hn : 0 < n) (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {u l δU δL εU εL : ℝ} (hδU : 0 < δU) (hδL : 0 < δL) (hδLεL : δL * εL < 1) (hcouple : (1 / δU + εU) / (1 + δU * εU / n) ≤ (1 / δL - εL) / (1 - δL * εL / n)) (hu : (u • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef) (hl : (A - l • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef) (hΦU : upperPotential u A ≤ εU) (hΦL : lowerPotential l A ≤ εL) : ∃ (i : Fin m) (t : ℝ), 0 < t ∧ ((u + δU) • (1 : Matrix (Fin n) (Fin n) ℝ) - (A + t • rankOne (v i))).PosDef ∧ ((A + t • rankOne (v i)) - (l + δL) • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef ∧ upperPotential (u + δU) (A + t • rankOne (v i)) ≤ εU ∧ lowerPotential (l + δL) (A + t • rankOne (v i)) ≤ εL := by set u' := u + δU set l' := l + δL set MU := (u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A)⁻¹ set ML := (A - l' • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹ obtain ⟨hu', hdU_pos, hsumU⟩ := bss_upper_sum_le hn v hiso hA hδU hu hΦU obtain ⟨hl', hdL_pos, hsumL⟩ := bss_lower_sum_ge hn v hiso hA hδL hδLεL hl hΦL set U : Fin m → ℝ := fun i => v i ⬝ᵥ (MU * MU).mulVec (v i) / (upperPotential u A - upperPotential u' A) + v i ⬝ᵥ MU.mulVec (v i) set L : Fin m → ℝ := fun i => v i ⬝ᵥ (ML * ML).mulVec (v i) / (lowerPotential l' A - lowerPotential l A) - v i ⬝ᵥ ML.mulVec (v i) have hsum_le : ∑ i : Fin m, U i ≤ ∑ i : Fin m, L i := le_trans hsumU (le_trans hcouple hsumL) set S : Finset (Fin m) := Finset.univ.filter (fun i => v i ≠ 0) have hS_ne : S.Nonempty := by by_contra hemp rw [Finset.not_nonempty_iff_eq_empty] at hemp have hall0 : ∀ i : Fin m, v i = 0 := by intro i by_contra hne have : i ∈ S := Finset.mem_filter.mpr ⟨Finset.mem_univ i, hne⟩ rw [hemp] at this; exact Finset.notMem_empty i this have hzero : (∑ i : Fin m, rankOne (v i)) = 0 := by refine Finset.sum_eq_zero fun i _ => ?_ ext a b; simp [rankOne_apply, hall0 i] rw [hiso] at hzero have h00 := congr_fun (congr_fun hzero ⟨0, hn⟩) ⟨0, hn⟩ simp at h00 have hsum_S : ∑ i ∈ S, U i ≤ ∑ i ∈ S, L i := by have hU0 : ∀ i : Fin m, v i = 0 → U i = 0 := fun i hi => by simp [U, hi] have hL0 : ∀ i : Fin m, v i = 0 → L i = 0 := fun i hi => by simp [L, hi] have h1 : ∑ i ∈ S, U i = ∑ i : Fin m, U i := by rw [← Finset.sum_filter_add_sum_filter_not Finset.univ (fun i => v i ≠ 0) U] have hz : ∑ i ∈ Finset.univ.filter (fun i => ¬ v i ≠ 0), U i = 0 := Finset.sum_eq_zero fun i hi => hU0 i (not_not.mp (Finset.mem_filter.mp hi).2) linarith have h2 : ∑ i ∈ S, L i = ∑ i : Fin m, L i := by rw [← Finset.sum_filter_add_sum_filter_not Finset.univ (fun i => v i ≠ 0) L] have hz : ∑ i ∈ Finset.univ.filter (fun i => ¬ v i ≠ 0), L i = 0 := Finset.sum_eq_zero fun i hi => hL0 i (not_not.mp (Finset.mem_filter.mp hi).2) linarith linarith have hex : ∃ i ∈ S, U i ≤ L i := by by_contra h; push Not at h have hlt := Finset.sum_lt_sum_of_nonempty hS_ne h linarith obtain ⟨i, hiS, hUL⟩ := hex have hvi_ne : v i ≠ 0 := (Finset.mem_filter.mp hiS).2 have hMU_pos : 0 < v i ⬝ᵥ MU.mulVec (v i) := posDef_dotProduct_mulVec_pos hu'.inv hvi_ne have hMU2_pos : 0 < v i ⬝ᵥ (MU * MU).mulVec (v i) := by have h1 : v i ⬝ᵥ (MU * MU).mulVec (v i) = MU.mulVec (v i) ⬝ᵥ MU.mulVec (v i) := by rw [← Matrix.mulVec_mulVec, hermitian_dotProduct_mulVec_comm hu'.isHermitian.inv] rw [h1] have hne : MU.mulVec (v i) ≠ 0 := by intro h0 have := congr_arg (u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A).mulVec h0 rw [posDef_mulVec_inv_mulVec hu', Matrix.mulVec_zero] at this exact hvi_ne this obtain ⟨k, hk⟩ := Function.ne_iff.mp hne exact Finset.sum_pos' (fun j _ => mul_self_nonneg _) ⟨k, Finset.mem_univ k, mul_self_pos.mpr hk⟩ have hU_gt : v i ⬝ᵥ MU.mulVec (v i) < U i := by have hterm : 0 < v i ⬝ᵥ (MU * MU).mulVec (v i) / (upperPotential u A - upperPotential u' A) := div_pos hMU2_pos hdU_pos simp only [U]; linarith have hU_pos : 0 < U i := lt_trans hMU_pos hU_gt set t : ℝ := (U i)⁻¹ have ht_pos : 0 < t := inv_pos.mpr hU_pos have hdenom : t * (v i ⬝ᵥ MU.mulVec (v i)) < 1 := by simp only [t]; rw [inv_mul_lt_iff₀ hU_pos, mul_one]; exact hU_gt have hsub_eq : u' • (1 : Matrix (Fin n) (Fin n) ℝ) - (A + t • rankOne (v i)) = (u' • (1 : Matrix (Fin n) (Fin n) ℝ) - A) - t • rankOne (v i) := by abel obtain ⟨hu_next, _, htrU_next⟩ := sherman_morrison_sub hu' (v i) (le_of_lt ht_pos) hdenom rw [← hsub_eq] at hu_next htrU_next have hΦU_next : upperPotential u' (A + t • rankOne (v i)) ≤ εU := by have hphi_eq : upperPotential u' (A + t • rankOne (v i)) = upperPotential u A := by change ((u' • (1 : Matrix (Fin n) (Fin n) ℝ) - (A + t • rankOne (v i)))⁻¹).trace = _ rw [htrU_next] change upperPotential u' A + t * (v i ⬝ᵥ (MU * MU).mulVec (v i)) / (1 - t * (v i ⬝ᵥ MU.mulVec (v i))) = upperPotential u A have h1mt : 1 - t * (v i ⬝ᵥ MU.mulVec (v i)) = t * (v i ⬝ᵥ (MU * MU).mulVec (v i) / (upperPotential u A - upperPotential u' A)) := by have hUt : t * U i = 1 := inv_mul_cancel₀ (ne_of_gt hU_pos) simp only [U] at hUt linarith rw [h1mt] have hne_term : v i ⬝ᵥ (MU * MU).mulVec (v i) ≠ 0 := ne_of_gt hMU2_pos have hne_t : t ≠ 0 := ne_of_gt ht_pos have hne_d : upperPotential u A - upperPotential u' A ≠ 0 := ne_of_gt hdU_pos field_simp [hne_term, hne_t, hne_d] ring linarith have hadd_eq : (A + t • rankOne (v i)) - l' • (1 : Matrix (Fin n) (Fin n) ℝ) = (A - l' • (1 : Matrix (Fin n) (Fin n) ℝ)) + t • rankOne (v i) := by abel obtain ⟨hl_next, _, htrL_next⟩ := sherman_morrison_add hl' (v i) (le_of_lt ht_pos) rw [← hadd_eq] at hl_next htrL_next have hΦL_next : lowerPotential l' (A + t • rankOne (v i)) ≤ εL := by have hphi_le : lowerPotential l' (A + t • rankOne (v i)) ≤ lowerPotential l A := by change ((A + t • rankOne (v i) - l' • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹).trace ≤ _ rw [htrL_next] change lowerPotential l' A - t * (v i ⬝ᵥ (ML * ML).mulVec (v i)) / (1 + t * (v i ⬝ᵥ ML.mulVec (v i))) ≤ lowerPotential l A have hML_nonneg : 0 ≤ v i ⬝ᵥ ML.mulVec (v i) := posDef_dotProduct_mulVec_nonneg hl'.inv (v i) have h1pt_pos : 0 < 1 + t * (v i ⬝ᵥ ML.mulVec (v i)) := by linarith [mul_nonneg (le_of_lt ht_pos) hML_nonneg] have hUt : t * U i = 1 := inv_mul_cancel₀ (ne_of_gt hU_pos) have h1_le : 1 ≤ t * L i := by calc (1 : ℝ) = t * U i := hUt.symm _ ≤ t * L i := mul_le_mul_of_nonneg_left hUL (le_of_lt ht_pos) have hkey : 1 + t * (v i ⬝ᵥ ML.mulVec (v i)) ≤ t * (v i ⬝ᵥ (ML * ML).mulVec (v i) / (lowerPotential l' A - lowerPotential l A)) := by simp only [L] at h1_le linarith have hdL_ne : lowerPotential l' A - lowerPotential l A ≠ 0 := ne_of_gt hdL_pos have hdiv_ge : lowerPotential l' A - lowerPotential l A ≤ t * (v i ⬝ᵥ (ML * ML).mulVec (v i)) / (1 + t * (v i ⬝ᵥ ML.mulVec (v i))) := by rw [le_div_iff₀ h1pt_pos] have hmul := mul_le_mul_of_nonneg_right hkey (le_of_lt hdL_pos) have hcancel : t * (v i ⬝ᵥ (ML * ML).mulVec (v i) / (lowerPotential l' A - lowerPotential l A)) * (lowerPotential l' A - lowerPotential l A) = t * (v i ⬝ᵥ (ML * ML).mulVec (v i)) := by rw [mul_assoc, div_mul_cancel₀ _ hdL_ne] linarith linarith linarith exact ⟨i, t, ht_pos, hu_next, hl_next, hΦU_next, hΦL_next⟩ /-- **General Inductive $T$-Step BSS Sparsifier Construction** with exact endpoint barrier extraction: after $T$ steps from $A_0 = 0$, the resulting matrix $A = \sum_i s_i v_i v_i^\top$ has at most $T$ nonzero weights and preserves both barrier potentials. -/ theorem bss_inductive_sparsifier {n m : ℕ} (hn : 0 < n) (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) {δU δL εU εL : ℝ} (hδU : 0 < δU) (hδL : 0 < δL) (hεU : 0 < εU) (hεL : 0 < εL) (hδLεL : δL * εL < 1) (hcouple : (1 / δU + εU) / (1 + δU * εU / n) ≤ (1 / δL - εL) / (1 - δL * εL / n)) (T : ℕ) : ∃ s : Fin m → ℝ, (∀ i, 0 ≤ s i) ∧ (Finset.univ.filter (fun i => s i ≠ 0)).card ≤ T ∧ let A := ∑ i : Fin m, s i • rankOne (v i) let uT := (n : ℝ) / εU + (T : ℝ) * δU let lT := -(n : ℝ) / εL + (T : ℝ) * δL (uT • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef ∧ (A - lT • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef ∧ upperPotential uT A ≤ εU ∧ lowerPotential lT A ≤ εL := by induction T with | zero => refine ⟨fun _ => 0, fun _ => le_refl 0, by simp, ?_⟩ have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr hn have hA0 : (∑ i : Fin m, (0 : ℝ) • rankOne (v i)) = (0 : Matrix (Fin n) (Fin n) ℝ) := by simp simp only [Nat.cast_zero, zero_mul, add_zero, hA0, sub_zero, neg_div, neg_smul, sub_neg_eq_add] have hu0_pos : 0 < (n : ℝ) / εU := div_pos hn_pos hεU have hl0_pos : 0 < (n : ℝ) / εL := div_pos hn_pos hεL have huPD : (((n : ℝ) / εU) • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef := Matrix.PosDef.one.smul hu0_pos have hlPD : (((n : ℝ) / εL) • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef := Matrix.PosDef.one.smul hl0_pos have hinv_smul : ∀ {c : ℝ}, c ≠ 0 → (c • (1 : Matrix (Fin n) (Fin n) ℝ))⁻¹ = c⁻¹ • (1 : Matrix (Fin n) (Fin n) ℝ) := by intro c hc apply Matrix.inv_eq_right_inv rw [Matrix.smul_mul, Matrix.mul_smul, smul_smul, mul_inv_cancel₀ hc, one_smul, Matrix.one_mul] have hΦU0 : upperPotential ((n : ℝ) / εU) (0 : Matrix (Fin n) (Fin n) ℝ) ≤ εU := by simp only [upperPotential, sub_zero, hinv_smul (ne_of_gt hu0_pos), Matrix.trace_smul, Matrix.trace_one, Fintype.card_fin, smul_eq_mul] have : ((n : ℝ) / εU)⁻¹ * (n : ℝ) = εU := by field_simp [ne_of_gt hn_pos, ne_of_gt hεU] linarith have hΦL0 : lowerPotential (-((n : ℝ) / εL)) (0 : Matrix (Fin n) (Fin n) ℝ) ≤ εL := by simp only [lowerPotential, zero_sub, neg_smul, neg_neg, hinv_smul (ne_of_gt hl0_pos), Matrix.trace_smul, Matrix.trace_one, Fintype.card_fin, smul_eq_mul] have : ((n : ℝ) / εL)⁻¹ * (n : ℝ) = εL := by field_simp [ne_of_gt hn_pos, ne_of_gt hεL] linarith exact ⟨huPD, by simpa using hlPD, hΦU0, hΦL0⟩ | succ k ih => obtain ⟨s, hs_nn, hcard, hu, hl, hΦU, hΦL⟩ := ih set A := ∑ i : Fin m, s i • rankOne (v i) have hA : A.IsHermitian := hermitian_sum Finset.univ _ fun i _ => hermitian_smul (rankOne_isHermitian (v i)) (s i) obtain ⟨i₀, t, ht_pos, hu', hl', hΦU', hΦL'⟩ := bss_barrier_step hn v hiso hA hδU hδL hδLεL hcouple hu hl hΦU hΦL set s' : Fin m → ℝ := fun i => if i = i₀ then s i + t else s i have hs'_nn : ∀ i, 0 ≤ s' i := fun i => by simp only [s']; split_ifs · linarith [hs_nn i] · exact hs_nn i have hcard' : (Finset.univ.filter (fun i => s' i ≠ 0)).card ≤ k + 1 := by have hsub : Finset.univ.filter (fun i => s' i ≠ 0) ⊆ insert i₀ (Finset.univ.filter (fun i => s i ≠ 0)) := by intro i hi simp only [Finset.mem_filter, Finset.mem_univ, true_and, s'] at hi by_cases heq : i = i₀ · subst heq; exact Finset.mem_insert_self i _ · rw [if_neg heq] at hi exact Finset.mem_insert_of_mem (Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩) exact le_trans (Finset.card_le_card hsub) (le_trans (Finset.card_insert_le _ _) (Nat.add_le_add_right hcard 1)) have hA' : ∑ i : Fin m, s' i • rankOne (v i) = A + t • rankOne (v i₀) := by have hdiff : ∀ i : Fin m, s' i • rankOne (v i) = s i • rankOne (v i) + (if i = i₀ then t • rankOne (v i₀) else 0) := by intro i by_cases heq : i = i₀ · subst heq; simp [s', add_smul] · simp [s', heq] calc ∑ i : Fin m, s' i • rankOne (v i) = ∑ i : Fin m, (s i • rankOne (v i) + if i = i₀ then t • rankOne (v i₀) else 0) := Finset.sum_congr rfl fun i _ => hdiff i _ = A + ∑ i : Fin m, if i = i₀ then t • rankOne (v i₀) else 0 := Finset.sum_add_distrib _ = A + t • rankOne (v i₀) := by simp have hu_cast : (n : ℝ) / εU + ((k + 1 : ℕ) : ℝ) * δU = ((n : ℝ) / εU + (k : ℝ) * δU) + δU := by push_cast; ring have hl_cast : -(n : ℝ) / εL + ((k + 1 : ℕ) : ℝ) * δL = (-(n : ℝ) / εL + (k : ℝ) * δL) + δL := by push_cast; ring refine ⟨s', hs'_nn, hcard', ?_⟩ rw [hA', hu_cast, hl_cast] exact ⟨hu', hl', hΦU', hΦL'⟩ /-- **Endpoint Barrier Extraction:** From $\Phi_u(A) \le \varepsilon_U$ and $\Phi_\ell(A) \le \varepsilon_L$, every eigenvalue of $A$ satisfies the strictly tighter endpoint bounds $\ell + 1/\varepsilon_L \le \lambda_j(A) \le u - 1/\varepsilon_U$. -/ lemma endpoint_eigenvalue_extraction {n : ℕ} {A : Matrix (Fin n) (Fin n) ℝ} (hA : A.IsHermitian) {u l εU εL : ℝ} (hεU : 0 < εU) (hεL : 0 < εL) (hu : (u • (1 : Matrix (Fin n) (Fin n) ℝ) - A).PosDef) (hl : (A - l • (1 : Matrix (Fin n) (Fin n) ℝ)).PosDef) (hΦU : upperPotential u A ≤ εU) (hΦL : lowerPotential l A ≤ εL) : (∀ j : Fin n, l + 1 / εL ≤ hA.eigenvalues j) ∧ (∀ j : Fin n, hA.eigenvalues j ≤ u - 1 / εU) := by obtain ⟨hltU, hphiU, _⟩ := spectral_upper_formulas hA hu obtain ⟨hltL, hphiL, _⟩ := spectral_lower_formulas hA hl refine ⟨fun j => ?_, fun j => ?_⟩ · have hterm_le : (hA.eigenvalues j - l)⁻¹ ≤ εL := by have h1 := Finset.single_le_sum (fun k _ => inv_nonneg.mpr (le_of_lt (sub_pos.mpr (hltL k)))) (Finset.mem_univ j) linarith have hinv := (inv_le_comm₀ (sub_pos.mpr (hltL j)) hεL).mp hterm_le rw [one_div]; linarith · have hterm_le : (u - hA.eigenvalues j)⁻¹ ≤ εU := by have h1 := Finset.single_le_sum (fun k _ => inv_nonneg.mpr (le_of_lt (sub_pos.mpr (hltU k)))) (Finset.mem_univ j) linarith have hinv := (inv_le_comm₀ (sub_pos.mpr (hltU j)) hεU).mp hterm_le rw [one_div]; linarith /-! ### Section 5: Headline Sharp Condition-Number & $(1 \pm \varepsilon)$ Sparsification Theorems -/ /-- Endpoint-extracted sharp finite-dimension BSS condition number: $$\kappa_{\mathrm{end}}(T, n) := \left(\frac{\sqrt{n(T-1)+1} + (n-1)}{\sqrt{n(T-1)+1} - (n-1)}\right)^{\!2}.$$ -/ noncomputable def kappaEndpoint (T n : ℕ) : ℝ := ((Real.sqrt ((n : ℝ) * ((T : ℝ) - 1) + 1) + ((n : ℝ) - 1)) / (Real.sqrt ((n : ℝ) * ((T : ℝ) - 1) + 1) - ((n : ℝ) - 1))) ^ 2 /-- Finite-dimension barrier condition number (without endpoint extraction): $$\kappa_{\mathrm{bar}}(T, n) := \left(\frac{\sqrt{T-1} + \sqrt{n-1}}{\sqrt{T-1} - \sqrt{n-1}}\right)^{\!2}.$$ -/ noncomputable def kappaBarrier (T n : ℕ) : ℝ := ((Real.sqrt ((T : ℝ) - 1) + Real.sqrt ((n : ℝ) - 1)) / (Real.sqrt ((T : ℝ) - 1) - Real.sqrt ((n : ℝ) - 1))) ^ 2 /-- Classical Batson–Spielman–Srivastava (2012) condition number at density $d = T / n$: $$\kappa_{\mathrm{BSS}}(d) := \left(\frac{\sqrt{d} + 1}{\sqrt{d} - 1}\right)^{\!2}.$$ -/ noncomputable def kappaClassical (d : ℝ) : ℝ := ((Real.sqrt d + 1) / (Real.sqrt d - 1)) ^ 2 /-- **Headline Theorem 1 (Endpoint-Extracted Finite-Dimension BSS Theorem — Valid for ALL $T \ge n \ge 2$!).** For every dimension $n \ge 2$, every integer budget $T \ge n$ (including spanning-tree cardinality $T = n$), and every isotropic frame $\sum_{i=1}^m v_i v_i^\top = I_n$, there exist nonnegative weights $s : \operatorname{Fin} m \to \mathbb{R}_{\ge 0}$ supported on at most $T$ vectors such that $A = \sum_{i=1}^m s_i v_i v_i^\top$ satisfies $$\forall x \in \mathbb{R}^n, \qquad x^\top x \;\le\; x^\top A x \;\le\; \kappa_{\mathrm{end}}(T, n) \, (x^\top x).$$ -/ theorem bss_endpoint_sharp_sparsifier {n m : ℕ} (hn : 2 ≤ n) (T : ℕ) (hT : n ≤ T) (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) : ∃ s : Fin m → ℝ, (∀ i, 0 ≤ s i) ∧ (Finset.univ.filter (fun i => s i ≠ 0)).card ≤ T ∧ let A := ∑ i : Fin m, s i • rankOne (v i) (∀ x : Fin n → ℝ, x ⬝ᵥ x ≤ x ⬝ᵥ A.mulVec x) ∧ (∀ x : Fin n → ℝ, x ⬝ᵥ A.mulVec x ≤ kappaEndpoint T n * (x ⬝ᵥ x)) := by have hn_pos : 0 < n := by omega have hn_r : (2 : ℝ) ≤ n := by exact_mod_cast hn have hT_r : (n : ℝ) ≤ T := by exact_mod_cast hT set D : ℝ := (n : ℝ) * ((T : ℝ) - 1) + 1 have hD_gt : ((n : ℝ) - 1) ^ 2 < D := by have : D - ((n : ℝ) - 1) ^ 2 = (n : ℝ) * ((T : ℝ) - (n : ℝ) + 1) := by ring nlinarith have hD_pos : 0 < D := lt_of_le_of_lt (sq_nonneg _) hD_gt set R : ℝ := Real.sqrt D have hR_sq : R ^ 2 = D := Real.sq_sqrt (le_of_lt hD_pos) have hR_gt_nm1 : (n : ℝ) - 1 < R := by have hsq : ((n : ℝ) - 1) ^ 2 < R ^ 2 := by rw [hR_sq]; exact hD_gt nlinarith [Real.sqrt_nonneg D] have hR_gt1 : 1 < R := by linarith have hRm1_pos : 0 < R - 1 := by linarith have hRp1_pos : 0 < R + 1 := by linarith have hRmn_pos : 0 < R - ((n : ℝ) - 1) := by linarith have hn_ne : (n : ℝ) ≠ 0 := ne_of_gt (by linarith) have hR_ne : R ≠ 0 := ne_of_gt (by linarith) set a : ℝ := (n : ℝ) / (R - 1) set b : ℝ := (n : ℝ) / (R + 1) have ha_pos : 0 < a := div_pos (by linarith) hRm1_pos have hb_pos : 0 < b := div_pos (by linarith) hRp1_pos have hb_lt1 : b < 1 := by rw [div_lt_one hRp1_pos]; linarith set δL : ℝ := 1 set εL : ℝ := b have h1mb_pos : 0 < 1 - b := sub_pos.mpr hb_lt1 have h1mbn_pos : 0 < 1 - b / n := by rw [sub_pos, div_lt_one (by linarith)]; linarith have h1pan_pos : 0 < 1 + a / n := by positivity set δU : ℝ := ((1 + a) / (1 + a / n)) / ((1 - b) / (1 - b / n)) have hδU_pos : 0 < δU := div_pos (div_pos (by linarith) h1pan_pos) (div_pos h1mb_pos h1mbn_pos) set εU : ℝ := a / δU have hεU_pos : 0 < εU := div_pos ha_pos hδU_pos have hδLεL : δL * εL < 1 := by simpa [δL, εL] using hb_lt1 have hcouple : (1 / δU + εU) / (1 + δU * εU / n) ≤ (1 / δL - εL) / (1 - δL * εL / n) := by have hprodU : δU * εU = a := mul_div_cancel₀ a (ne_of_gt hδU_pos) have h1 : (1 / δU + εU) / (1 + δU * εU / n) = ((1 + a) / (1 + a / n)) / δU := by rw [hprodU]; simp only [εU]; field_simp [ne_of_gt hδU_pos, ne_of_gt h1pan_pos] have h2 : (1 / δL - εL) / (1 - δL * εL / n) = (1 - b) / (1 - b / n) := by simp [δL, εL] rw [h1, h2] have hcancel : ((1 + a) / (1 + a / n)) / δU = (1 - b) / (1 - b / n) := by simp only [δU] field_simp [ne_of_gt h1pan_pos, ne_of_gt h1mb_pos, ne_of_gt h1mbn_pos] exact le_of_eq hcancel obtain ⟨s0, hs0_nn, hcard0, huT, hlT, hΦU, hΦL⟩ := bss_inductive_sparsifier hn_pos v hiso hδU_pos zero_lt_one hεU_pos hb_pos hδLεL hcouple T set A0 := ∑ i : Fin m, s0 i • rankOne (v i) have hA0 : A0.IsHermitian := hermitian_sum Finset.univ _ fun i _ => hermitian_smul (rankOne_isHermitian (v i)) (s0 i) obtain ⟨heigL, heigU⟩ := endpoint_eigenvalue_extraction hA0 hεU_pos hb_pos huT hlT hΦU hΦL set low : ℝ := -(n : ℝ) / εL + (T : ℝ) * δL + 1 / εL set high : ℝ := (n : ℝ) / εU + (T : ℝ) * δU - 1 / εU have hlow_eq : low = ((T : ℝ) * (n : ℝ) - ((n : ℝ) - 1) * (R + 1)) / (n : ℝ) := by simp only [low, εL, δL, b] field_simp [hn_ne]; ring have hlow_pos : 0 < low := by rw [hlow_eq] apply div_pos _ (by linarith) have hnum : (T : ℝ) * (n : ℝ) - ((n : ℝ) - 1) * (R + 1) = R * (R - ((n : ℝ) - 1)) := by have : (T : ℝ) * (n : ℝ) = D + ((n : ℝ) - 1) := by simp only [D]; ring rw [this, ← hR_sq]; ring rw [hnum]; exact mul_pos (by linarith) hRmn_pos have hratio : high / low = kappaEndpoint T n := by have h1 : (T : ℝ) * (n : ℝ) = R ^ 2 + ((n : ℝ) - 1) := by rw [hR_sq]; simp only [D]; ring have hlow_simp : low = R * (R - ((n : ℝ) - 1)) / (n : ℝ) := by rw [hlow_eq, h1]; ring have hhigh_eq : high = δU * (((T : ℝ) * (n : ℝ) + ((n : ℝ) - 1) * (R - 1)) / (n : ℝ)) := by simp only [high, εU, a] field_simp [ne_of_gt hδU_pos, hn_ne]; ring have hhigh_simp : high = δU * (R * (R + ((n : ℝ) - 1)) / (n : ℝ)) := by rw [hhigh_eq, h1]; ring have hnumU : (1 + a) / (1 + a / n) = (R + ((n : ℝ) - 1)) / R := by have ha1 : 1 + a = (R + ((n : ℝ) - 1)) / (R - 1) := by rw [eq_div_iff (ne_of_gt hRm1_pos), add_mul, one_mul] simp only [a]; rw [div_mul_cancel₀ _ (ne_of_gt hRm1_pos)]; ring have ha2 : 1 + a / n = R / (R - 1) := by have han : a / n = 1 / (R - 1) := by simp only [a]; rw [div_div, mul_comm, ← div_div, div_self hn_ne] rw [han, eq_div_iff (ne_of_gt hRm1_pos), add_mul, one_mul, div_mul_cancel₀ _ (ne_of_gt hRm1_pos)] ring rw [ha1, ha2, div_div_div_cancel_right₀ (ne_of_gt hRm1_pos)] have hdenU : (1 - b) / (1 - b / n) = (R - ((n : ℝ) - 1)) / R := by have hb1 : 1 - b = (R - ((n : ℝ) - 1)) / (R + 1) := by rw [eq_div_iff (ne_of_gt hRp1_pos), sub_mul, one_mul] simp only [b]; rw [div_mul_cancel₀ _ (ne_of_gt hRp1_pos)]; ring have hb2 : 1 - b / n = R / (R + 1) := by have hbn : b / n = 1 / (R + 1) := by simp only [b]; rw [div_div, mul_comm, ← div_div, div_self hn_ne] rw [hbn, eq_div_iff (ne_of_gt hRp1_pos), sub_mul, one_mul, div_mul_cancel₀ _ (ne_of_gt hRp1_pos)] ring rw [hb1, hb2, div_div_div_cancel_right₀ (ne_of_gt hRp1_pos)] have hδU_simp : δU = (R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1)) := by simp only [δU, hnumU, hdenU] field_simp [hR_ne, ne_of_gt hRmn_pos] rw [hhigh_simp, hlow_simp, hδU_simp] simp only [kappaEndpoint] change ((R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1))) * (R * (R + ((n : ℝ) - 1)) / (n : ℝ)) / (R * (R - ((n : ℝ) - 1)) / (n : ℝ)) = ((R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1))) ^ 2 field_simp [hR_ne, hn_ne, ne_of_gt hRmn_pos] set s : Fin m → ℝ := fun i => low⁻¹ * s0 i refine ⟨s, fun i => mul_nonneg (inv_nonneg.mpr (le_of_lt hlow_pos)) (hs0_nn i), ?_, ?_, ?_⟩ · have hsub : Finset.univ.filter (fun i => s i ≠ 0) ⊆ Finset.univ.filter (fun i => s0 i ≠ 0) := by intro i hi simp only [Finset.mem_filter, Finset.mem_univ, true_and, s] at hi ⊢ exact fun h0 => hi (by simp [h0]) exact le_trans (Finset.card_le_card hsub) hcard0 · intro x have hA_eq : ∑ i : Fin m, s i • rankOne (v i) = low⁻¹ • A0 := by simp only [s, A0, Finset.smul_sum, smul_smul] rw [hA_eq, smul_mulVec_eq, dotProduct_smul, smul_eq_mul] have hq := quadratic_form_lower_of_eigenvalues hA0 heigL x have hmul := mul_le_mul_of_nonneg_left hq (inv_nonneg.mpr (le_of_lt hlow_pos)) have hcancel : low⁻¹ * (low * (x ⬝ᵥ x)) = x ⬝ᵥ x := by rw [← mul_assoc, inv_mul_cancel₀ (ne_of_gt hlow_pos), one_mul] linarith · intro x have hA_eq : ∑ i : Fin m, s i • rankOne (v i) = low⁻¹ • A0 := by simp only [s, A0, Finset.smul_sum, smul_smul] rw [hA_eq, smul_mulVec_eq, dotProduct_smul, smul_eq_mul] have hq := quadratic_form_upper_of_eigenvalues hA0 heigU x have hmul := mul_le_mul_of_nonneg_left hq (inv_nonneg.mpr (le_of_lt hlow_pos)) have hcoeff : low⁻¹ * (high * (x ⬝ᵥ x)) = kappaEndpoint T n * (x ⬝ᵥ x) := by rw [← hratio]; ring linarith /-- **Headline Theorem 2 (Strict Condition-Number Hierarchy Dominating Classical BSS 2012).** For every dimension $n \ge 2$ and every integer budget $T > n$ (with density $d = T / n > 1$), $$\kappa_{\mathrm{end}}(T, n) \;<\; \kappa_{\mathrm{bar}}(T, n) \;<\; \kappa_{\mathrm{BSS}}(T / n).$$ -/ theorem bss_strict_hierarchy_over_classical {T n : ℕ} (hn : 2 ≤ n) (hT : n < T) : kappaEndpoint T n < kappaBarrier T n ∧ kappaBarrier T n < kappaClassical ((T : ℝ) / (n : ℝ)) := by have hn_r : (2 : ℝ) ≤ n := by exact_mod_cast hn have hT_r : (n : ℝ) < T := by exact_mod_cast hT have hdec : ∀ {r₁ r₂ : ℝ}, 1 < r₁ → r₁ < r₂ → ((r₂ + 1) / (r₂ - 1)) ^ 2 < ((r₁ + 1) / (r₁ - 1)) ^ 2 := by intro r₁ r₂ hr₁ hlt have hr₂ : 1 < r₂ := lt_trans hr₁ hlt have hfrac : (r₂ + 1) / (r₂ - 1) < (r₁ + 1) / (r₁ - 1) := by rw [div_lt_div_iff₀ (by linarith) (by linarith)]; nlinarith have hpos : 0 ≤ (r₂ + 1) / (r₂ - 1) := div_nonneg (by linarith) (by linarith) nlinarith set r_cls : ℝ := Real.sqrt ((T : ℝ) / (n : ℝ)) set r_bar : ℝ := Real.sqrt (((T : ℝ) - 1) / ((n : ℝ) - 1)) set r_end : ℝ := Real.sqrt (((n : ℝ) * ((T : ℝ) - 1) + 1) / (((n : ℝ) - 1) ^ 2)) have h1_cls : 1 < r_cls := by have : 1 < (T : ℝ) / (n : ℝ) := (one_lt_div (by linarith)).mpr hT_r rw [← Real.sqrt_one]; exact Real.sqrt_lt_sqrt zero_le_one this have hcls_bar : r_cls < r_bar := by apply Real.sqrt_lt_sqrt (by positivity) rw [div_lt_div_iff₀ (by linarith) (by linarith)] nlinarith have hbar_end : r_bar < r_end := by have hbar_nn : 0 ≤ ((T : ℝ) - 1) / ((n : ℝ) - 1) := div_nonneg (by linarith) (by linarith) have hsq_pos : 0 < ((n : ℝ) - 1) ^ 2 := sq_pos_of_pos (by linarith) apply Real.sqrt_lt_sqrt hbar_nn rw [div_lt_div_iff₀ (by linarith) hsq_pos] nlinarith have hk_end : kappaEndpoint T n = ((r_end + 1) / (r_end - 1)) ^ 2 := by have hnm1 : 0 < (n : ℝ) - 1 := by linarith have hsqrt : r_end = Real.sqrt ((n : ℝ) * ((T : ℝ) - 1) + 1) / ((n : ℝ) - 1) := by simp only [r_end] rw [Real.sqrt_div (by nlinarith), Real.sqrt_sq (le_of_lt hnm1)] rw [hsqrt] simp only [kappaEndpoint] congr 1 field_simp [ne_of_gt hnm1] have hk_bar : kappaBarrier T n = ((r_bar + 1) / (r_bar - 1)) ^ 2 := by have hnm1 : 0 < (n : ℝ) - 1 := by linarith have hsqrt : r_bar = Real.sqrt ((T : ℝ) - 1) / Real.sqrt ((n : ℝ) - 1) := by simp only [r_bar]; exact Real.sqrt_div (by linarith) _ rw [hsqrt] simp only [kappaBarrier] congr 1 field_simp [ne_of_gt (Real.sqrt_pos.mpr hnm1)] rw [hk_end, hk_bar] exact ⟨hdec (lt_trans h1_cls hcls_bar) hbar_end, hdec h1_cls hcls_bar⟩ /-- **Headline Theorem 3 (Spanning-Frame $T = n$ Finite Condition Number).** At spanning-tree cardinality $T = n \ge 2$ (where classical BSS diverges to $+\infty$), the endpoint-extracted BSS sparsifier yields a nondegenerate $n$-vector frame with condition number $\kappa_{\mathrm{end}}(n, n) < 16 n^2$. -/ theorem bss_spanning_budget_condition_number {n : ℕ} (hn : 2 ≤ n) : kappaEndpoint n n < 16 * (n : ℝ) ^ 2 := by have hn_r : (2 : ℝ) ≤ n := by exact_mod_cast hn set R : ℝ := Real.sqrt ((n : ℝ) * ((n : ℝ) - 1) + 1) have hR_sq : R ^ 2 = (n : ℝ) * ((n : ℝ) - 1) + 1 := Real.sq_sqrt (by nlinarith) have hR_lt_n : R < n := by have : R ^ 2 < (n : ℝ) ^ 2 := by rw [hR_sq]; nlinarith nlinarith [Real.sqrt_nonneg ((n : ℝ) * ((n : ℝ) - 1) + 1)] have hR_gt : (n : ℝ) - 1 < R := by have : ((n : ℝ) - 1) ^ 2 < R ^ 2 := by rw [hR_sq]; nlinarith nlinarith [Real.sqrt_nonneg ((n : ℝ) * ((n : ℝ) - 1) + 1)] have hrat : (R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1)) = (R + ((n : ℝ) - 1)) ^ 2 / (n : ℝ) := by have hprod : (R - ((n : ℝ) - 1)) * (R + ((n : ℝ) - 1)) = (n : ℝ) := by have : (R - ((n : ℝ) - 1)) * (R + ((n : ℝ) - 1)) = R ^ 2 - ((n : ℝ) - 1) ^ 2 := by ring rw [this, hR_sq]; ring field_simp [ne_of_gt (by linarith : 0 < R - ((n : ℝ) - 1)), ne_of_gt (by linarith : (0 : ℝ) < n)] nlinarith have hbound : R + ((n : ℝ) - 1) < 2 * (n : ℝ) := by linarith have hpos : 0 < R + ((n : ℝ) - 1) := by linarith have hfrac_lt : (R + ((n : ℝ) - 1)) ^ 2 / (n : ℝ) < 4 * (n : ℝ) := by rw [div_lt_iff₀ (by linarith : (0 : ℝ) < n)] nlinarith have hfrac_pos : 0 ≤ (R + ((n : ℝ) - 1)) ^ 2 / (n : ℝ) := by positivity simp only [kappaEndpoint] change ((R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1))) ^ 2 < 16 * (n : ℝ) ^ 2 rw [hrat] nlinarith /-- **Headline Theorem 4 (Symmetric $(1 \pm \varepsilon)$ Linear-Size Spectral Sparsifier).** For every $\varepsilon \in (0, 1)$, dimension $n \ge 2$, and integer budget $T$ satisfying $T \ge 1 + \frac{4(n - 1)}{\varepsilon^2}$ (strictly saving edges over classical $\frac{4n}{\varepsilon^2}$), every isotropic frame $\sum_{i=1}^m v_i v_i^\top = I_n$ admits a $T$-sparse nonnegative reweighting $A = \sum_i s_i v_i v_i^\top$ with $$(1 - \varepsilon) \, x^\top x \;\le\; x^\top A x \;\le\; (1 + \varepsilon) \, x^\top x \qquad \forall x \in \mathbb{R}^n.$$ -/ theorem bss_eps_spectral_sparsifier {n m : ℕ} (hn : 2 ≤ n) {ε : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (T : ℕ) (hT_eps : 1 + 4 * ((n : ℝ) - 1) / ε ^ 2 ≤ (T : ℝ)) (v : Fin m → Fin n → ℝ) (hiso : ∑ i : Fin m, rankOne (v i) = 1) : ∃ s : Fin m → ℝ, (∀ i, 0 ≤ s i) ∧ (Finset.univ.filter (fun i => s i ≠ 0)).card ≤ T ∧ let A := ∑ i : Fin m, s i • rankOne (v i) (∀ x : Fin n → ℝ, (1 - ε) * (x ⬝ᵥ x) ≤ x ⬝ᵥ A.mulVec x) ∧ (∀ x : Fin n → ℝ, x ⬝ᵥ A.mulVec x ≤ (1 + ε) * (x ⬝ᵥ x)) := by have hn_r : (2 : ℝ) ≤ n := by exact_mod_cast hn have hT_ge_n : n ≤ T := by have h4 : 4 * ((n : ℝ) - 1) < 4 * ((n : ℝ) - 1) / ε ^ 2 := by rw [lt_div_iff₀ (sq_pos_of_pos hε0)] have hε2 : ε ^ 2 < 1 := by nlinarith nlinarith have : (n : ℝ) ≤ T := by linarith exact_mod_cast this have hT_r : (n : ℝ) ≤ T := by exact_mod_cast hT_ge_n obtain ⟨s0, hs0_nn, hcard0, hlow0, hhigh0⟩ := bss_endpoint_sharp_sparsifier hn T hT_ge_n v hiso have hkappa_le : kappaEndpoint T n ≤ (1 + ε) / (1 - ε) := by set R : ℝ := Real.sqrt ((n : ℝ) * ((T : ℝ) - 1) + 1) have hR_sq : R ^ 2 = (n : ℝ) * ((T : ℝ) - 1) + 1 := Real.sq_sqrt (by nlinarith) have hT_sub : 4 * ((n : ℝ) - 1) / ε ^ 2 ≤ (T : ℝ) - 1 := by linarith have hR_ge : 2 * ((n : ℝ) - 1) / ε ≤ R := by have hsq : (2 * ((n : ℝ) - 1) / ε) ^ 2 ≤ R ^ 2 := by rw [hR_sq] have h1 : 4 * ((n : ℝ) - 1) ^ 2 / ε ^ 2 ≤ (n : ℝ) * (4 * ((n : ℝ) - 1) / ε ^ 2) := by have : (n : ℝ) * (4 * ((n : ℝ) - 1) / ε ^ 2) - 4 * ((n : ℝ) - 1) ^ 2 / ε ^ 2 = 4 * ((n : ℝ) - 1) / ε ^ 2 := by ring have hnn : 0 ≤ 4 * ((n : ℝ) - 1) / ε ^ 2 := div_nonneg (by linarith) (sq_nonneg ε) linarith have h2 : (n : ℝ) * (4 * ((n : ℝ) - 1) / ε ^ 2) ≤ (n : ℝ) * ((T : ℝ) - 1) := mul_le_mul_of_nonneg_left hT_sub (by linarith) have h3 : (2 * ((n : ℝ) - 1) / ε) ^ 2 = 4 * ((n : ℝ) - 1) ^ 2 / ε ^ 2 := by ring linarith have hpos1 : 0 ≤ 2 * ((n : ℝ) - 1) / ε := div_nonneg (by linarith) (le_of_lt hε0) have hpos2 : 0 ≤ R := Real.sqrt_nonneg _ nlinarith have hRmn_pos : 0 < R - ((n : ℝ) - 1) := by have : (n : ℝ) - 1 < 2 * ((n : ℝ) - 1) / ε := by rw [lt_div_iff₀ hε0]; nlinarith linarith have hfrac : (R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1)) ≤ (2 + ε) / (2 - ε) := by rw [div_le_div_iff₀ hRmn_pos (by linarith)] have hmul : 2 * ((n : ℝ) - 1) ≤ ε * R := by have := (div_le_iff₀ hε0).mp hR_ge; linarith nlinarith have hsq_le : ((2 + ε) / (2 - ε)) ^ 2 ≤ (1 + ε) / (1 - ε) := by rw [div_pow, div_le_div_iff₀ (by nlinarith) (by linarith)] have hid : (1 + ε) * (2 - ε) ^ 2 - (2 + ε) ^ 2 * (1 - ε) = 2 * ε ^ 3 := by ring have : 0 ≤ 2 * ε ^ 3 := by positivity linarith have hpos_lhs : 0 ≤ (R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1)) := div_nonneg (by linarith [Real.sqrt_nonneg ((n : ℝ) * ((T : ℝ) - 1) + 1)]) (le_of_lt hRmn_pos) simp only [kappaEndpoint] change ((R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1))) ^ 2 ≤ (1 + ε) / (1 - ε) calc ((R + ((n : ℝ) - 1)) / (R - ((n : ℝ) - 1))) ^ 2 ≤ ((2 + ε) / (2 - ε)) ^ 2 := by nlinarith _ ≤ (1 + ε) / (1 - ε) := hsq_le set s : Fin m → ℝ := fun i => (1 - ε) * s0 i refine ⟨s, fun i => mul_nonneg (by linarith) (hs0_nn i), ?_, ?_, ?_⟩ · have hsub : Finset.univ.filter (fun i => s i ≠ 0) ⊆ Finset.univ.filter (fun i => s0 i ≠ 0) := by intro i hi simp only [Finset.mem_filter, Finset.mem_univ, true_and, s] at hi ⊢ exact fun h0 => hi (by simp [h0]) exact le_trans (Finset.card_le_card hsub) hcard0 · intro x have hA_eq : ∑ i : Fin m, s i • rankOne (v i) = (1 - ε) • ∑ i : Fin m, s0 i • rankOne (v i) := by simp only [s, Finset.smul_sum, smul_smul] rw [hA_eq, smul_mulVec_eq, dotProduct_smul, smul_eq_mul] exact mul_le_mul_of_nonneg_left (hlow0 x) (by linarith) · intro x have hA_eq : ∑ i : Fin m, s i • rankOne (v i) = (1 - ε) • ∑ i : Fin m, s0 i • rankOne (v i) := by simp only [s, Finset.smul_sum, smul_smul] rw [hA_eq, smul_mulVec_eq, dotProduct_smul, smul_eq_mul] have h1 := mul_le_mul_of_nonneg_left (hhigh0 x) (by linarith : 0 ≤ 1 - ε) have h2 : (1 - ε) * kappaEndpoint T n ≤ 1 + ε := by have := mul_le_mul_of_nonneg_left hkappa_le (by linarith : 0 ≤ 1 - ε) rwa [mul_div_cancel₀ _ (ne_of_gt (sub_pos.mpr hε1))] at this have hxx : 0 ≤ x ⬝ᵥ x := Finset.sum_nonneg fun i _ => mul_self_nonneg (x i) calc (1 - ε) * (x ⬝ᵥ (∑ i, s0 i • rankOne (v i)).mulVec x) ≤ (1 - ε) * (kappaEndpoint T n * (x ⬝ᵥ x)) := h1 _ = ((1 - ε) * kappaEndpoint T n) * (x ⬝ᵥ x) := by ring _ ≤ (1 + ε) * (x ⬝ᵥ x) := mul_le_mul_of_nonneg_right h2 hxx end BSSBarrierSparsification /-! ### Axiom Verification for All Headline Theorems -/ #print axioms BSSBarrierSparsification.sherman_morrison_sub #print axioms BSSBarrierSparsification.sherman_morrison_add #print axioms BSSBarrierSparsification.sharp_upper_barrier_sum_le #print axioms BSSBarrierSparsification.sharp_lower_barrier_sum_ge #print axioms BSSBarrierSparsification.bss_barrier_step #print axioms BSSBarrierSparsification.bss_inductive_sparsifier #print axioms BSSBarrierSparsification.bss_endpoint_sharp_sparsifier #print axioms BSSBarrierSparsification.bss_strict_hierarchy_over_classical #print axioms BSSBarrierSparsification.bss_spanning_budget_condition_number #print axioms BSSBarrierSparsification.bss_eps_spectral_sparsifier