import Mathlib /-! # Sharp Non-Asymptotic Finite-Diameter Alon–Boppana Bounds, Universal Dual Certificates & Tightness Witnesses This file provides a 100% self-contained Lean 4 / Mathlib formalization of **sharp finite-diameter Alon–Boppana eigenvalue lower bounds** for regular graphs with **zero girth assumptions**, powered by a **universal monotone tree-comparison dual-certificate engine**. ## Main Results 1. **Universal Monotone Dual-Certificate Engine (`alon_boppana_dual_certificate_ball`):** For *any* $d$-regular finite simple graph $G$ ($d \ge 2$, arbitrary girth/cycles), any vertex $u$, radius $k$, and any nonincreasing nonnegative sequence $a_0 \ge a_1 \ge \dots \ge a_k \ge a_{k+1} = 0$ satisfying the tree sub-eigenvalue inequalities $d a_1 \ge L a_0$ and $a_{i-1} + (d - 1) a_{i+1} \ge L a_i$ ($1 \le i \le k$), the shell-supported test function $f_u(x) = a_{\operatorname{dist}(u, x)} \mathbf{1}_{d(u,x) \le k}$ satisfies $f_u^\top A_G f_u \ge L \|f_u\|_2^2$, proved via exact telescoping dual multipliers $\alpha_i = a_i(a_i - a_{i+1}) \ge 0$, $\beta_i = a_i(a_{i-1} - a_{i+1}) \ge 0$. 2. **Exact Tree-Ball Alon–Boppana Theorem (`alon_boppana_exact_tree_ball`):** For every $d \ge 3$ and $k \ge 1$, for the exact tree-ball angle $\theta^*(d, k) \in (0, \frac{\pi}{k+2})$ solving $\sin(k \theta^*) = (d - 1)\sin((k + 2)\theta^*)$, every $d$-regular graph $G$ with two vertices at distance $\ge 2k + 2$ has at least two distinct adjacency eigenvalues $\ge 2\sqrt{d - 1}\cos(\theta^*(d, k))$. 3. **Explicit Closed-Form Phase-Shift Sharpening (`alon_boppana_explicit_phase_shift`, `alon_boppana_explicit_phase_shift_k2`):** Strictly improving Friedman's cosine bound $2\sqrt{d - 1}\cos(\frac{\pi}{k+2})$ for ALL $d \ge 3$: - All $k \ge 1$: $\lambda_2(G) \ge 2\sqrt{d - 1}\cos\!\left(\frac{\pi}{k + 2 + \frac{1}{2(d - 1)}}\right) > 2\sqrt{d - 1}\cos\!\left(\frac{\pi}{k + 2}\right)$. - All $k \ge 2$: $\lambda_2(G) \ge 2\sqrt{d - 1}\cos\!\left(\frac{\pi}{k + 2 + \frac{1}{d - 1}}\right)$. 4. **Exact Small-Diameter Radical Bounds (`alon_boppana_diam4_sqrt_d`, `alon_boppana_diam6_sqrt_2d_sub_1`, `diam6_beats_nilli_and_friedman`):** - $\operatorname{dist}(u, v) \ge 4 \implies \lambda_2(G) \ge \sqrt{d}$ (exact equality on $C_8$!). - $\operatorname{dist}(u, v) \ge 6 \implies \lambda_2(G) \ge \sqrt{2d - 1}$ (strictly beats Friedman for all $d \ge 3$ and beats/equals Nilli 1991 for all $d \ge 3$ with equality only at $d = 5$!). 5. **Girth-Driven Lower-Spectrum Bound & Bipartite Symmetry (`alon_boppana_girth_lambda_min`, `alon_boppana_triangle_free_lambda_min`, `bipartite_eigenvalue_neg`):** Whenever $B(u, k)$ contains no same-shell edges (e.g., girth $\ge 2k + 2$ or bipartite), $\lambda_{\min}(G) \le -L$, and every triangle-free $d$-regular graph has $\lambda_{\min}(G) \le -\sqrt{d}$. 6. **Exact Tightness & Ramanujan Witnesses:** - Cycle $C_8$ ($d = 2, D = 4$): exact $\lambda_2(C_8) = \sqrt{2} = \sqrt{d}$ (exact equality witness!). - 3-Cube $Q_3$ ($d = 3, D = 3$, bipartite): exact Ramanujan witness ($1 \le 2\sqrt{2}$). - Complete bipartite $K_{d,d}$ ($d$-regular, $D = 2$): exact Ramanujan witness (all non-trivial eigenvalues $0$). -/ open scoped BigOperators Matrix open Finset Real SimpleGraph Matrix namespace SharpAlonBoppanaDiameter /-! ### Section 1: Graph Adjacency Quadratic Form, Laplacian Energy & Second-Eigenvalue Principle -/ /-- Adjacency quadratic form $f^\top A_G f = \sum_{x \sim y} f(x) f(y)$. -/ def adjQuad {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (f : V → ℝ) : ℝ := ∑ x : V, ∑ y : V, if G.Adj x y then f x * f y else 0 /-- Squared $\ell^2$ norm $\|f\|_2^2 = \sum_x f(x)^2$. -/ def normSq {V : Type*} [Fintype V] (f : V → ℝ) : ℝ := ∑ x : V, (f x) ^ 2 /-- Adjacency matrix of `G` over `ℝ` is Hermitian. -/ lemma adjMatrix_isHermitian {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] : (G.adjMatrix ℝ).IsHermitian := by ext x y simp [Matrix.conjTranspose_apply, SimpleGraph.adjMatrix_apply, G.adj_comm] lemma adjQuad_eq_dotProduct_mulVec {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (f : V → ℝ) : adjQuad G f = f ⬝ᵥ (G.adjMatrix ℝ).mulVec f := by simp only [adjQuad, dotProduct, Matrix.mulVec, SimpleGraph.adjMatrix_apply] refine Finset.sum_congr rfl fun x _ => ?_ rw [Finset.mul_sum] refine Finset.sum_congr rfl fun y _ => ?_ split_ifs <;> ring lemma normSq_eq_dotProduct {V : Type*} [Fintype V] (f : V → ℝ) : normSq f = f ⬝ᵥ f := by simp only [normSq, dotProduct, sq] lemma normSq_nonneg {V : Type*} [Fintype V] (f : V → ℝ) : 0 ≤ normSq f := Finset.sum_nonneg fun _ _ => sq_nonneg _ lemma normSq_pos_of_ne_zero {V : Type*} [Fintype V] {f : V → ℝ} (hf : f ≠ 0) : 0 < normSq f := by obtain ⟨x, hx⟩ := Function.ne_iff.mp hf exact Finset.sum_pos' (fun y _ => sq_nonneg (f y)) ⟨x, Finset.mem_univ x, sq_pos_of_ne_zero hx⟩ /-- Exact Laplacian–Adjacency energy identity on any $d$-regular graph: $$2 \big(d \|f\|_2^2 - f^\top A_G f\big) = \sum_{x \sim y} (f(x) - f(y))^2.$$ -/ lemma regular_laplacian_energy_eq {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) (f : V → ℝ) : 2 * ((d : ℝ) * normSq f - adjQuad G f) = ∑ x : V, ∑ y : V, if G.Adj x y then (f x - f y) ^ 2 else 0 := by have hdeg : ∀ x : V, (∑ y : V, if G.Adj x y then (1 : ℝ) else 0) = (d : ℝ) := by intro x have hcard : (Finset.univ.filter (fun y => G.Adj x y)).card = d := by simpa [SimpleGraph.degree, SimpleGraph.neighborFinset_def] using hreg x rw [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one, hcard] have h1 : ∑ x : V, ∑ y : V, (if G.Adj x y then (f x) ^ 2 else 0) = (d : ℝ) * normSq f := by simp only [normSq, Finset.mul_sum] refine Finset.sum_congr rfl fun x _ => ?_ have : ∑ y : V, (if G.Adj x y then (f x) ^ 2 else 0) = (f x) ^ 2 * ∑ y : V, (if G.Adj x y then (1 : ℝ) else 0) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl fun y _ => by split_ifs <;> ring rw [this, hdeg x, mul_comm] have h2 : ∑ x : V, ∑ y : V, (if G.Adj x y then (f y) ^ 2 else 0) = (d : ℝ) * normSq f := by rw [Finset.sum_comm] have : ∀ y x : V, (if G.Adj x y then (f y) ^ 2 else 0) = (if G.Adj y x then (f y) ^ 2 else 0) := fun y x => by simp [G.adj_comm] simp_rw [this] exact h1 have hexp : ∑ x : V, ∑ y : V, (if G.Adj x y then (f x - f y) ^ 2 else 0) = (∑ x : V, ∑ y : V, if G.Adj x y then (f x) ^ 2 else 0) + (∑ x : V, ∑ y : V, if G.Adj x y then (f y) ^ 2 else 0) - 2 * adjQuad G f := by simp only [adjQuad, Finset.mul_sum, ← Finset.sum_add_distrib, ← Finset.sum_sub_distrib] refine Finset.sum_congr rfl fun x _ => Finset.sum_congr rfl fun y _ => ?_ split_ifs <;> ring rw [hexp, h1, h2] ring lemma adjMatrix_mulVec_const_one {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) : (G.adjMatrix ℝ).mulVec (fun _ => (1 : ℝ)) = (d : ℝ) • (fun _ => (1 : ℝ)) := by ext x simp only [Matrix.mulVec, dotProduct, SimpleGraph.adjMatrix_apply, Pi.smul_apply, smul_eq_mul, mul_one] have hcard : (Finset.univ.filter (fun y => G.Adj x y)).card = d := by simpa [SimpleGraph.degree, SimpleGraph.neighborFinset_def] using hreg x rw [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one, hcard] /-- Spectral quadratic form and Parseval inner-product expansion for `G.adjMatrix ℝ`. -/ lemma adjMatrix_spectral_expansion {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] : (∀ x : V → ℝ, x ⬝ᵥ (G.adjMatrix ℝ).mulVec x = ∑ j : V, (adjMatrix_isHermitian G).eigenvalues j * (x ⬝ᵥ ((adjMatrix_isHermitian G).eigenvectorBasis j).ofLp) ^ 2) ∧ (∀ x y : V → ℝ, x ⬝ᵥ y = ∑ j : V, (x ⬝ᵥ ((adjMatrix_isHermitian G).eigenvectorBasis j).ofLp) * (y ⬝ᵥ ((adjMatrix_isHermitian G).eigenvectorBasis j).ofLp)) := by let hA := adjMatrix_isHermitian G let e := hA.eigenvectorBasis have hrepr_vec : ∀ y : V → ℝ, y = ∑ j : V, (y ⬝ᵥ (e j).ofLp) • (e j).ofLp := by intro y let vy : EuclideanSpace ℝ V := WithLp.toLp 2 y have hcoeff : ∀ j : V, e.repr vy j = y ⬝ᵥ (e j).ofLp := by intro j rw [OrthonormalBasis.repr_apply_apply, EuclideanSpace.inner_eq_star_dotProduct] simp [vy] ext k have hk := congr_arg (fun z : EuclideanSpace ℝ V => z.ofLp k) (e.sum_repr vy).symm simpa [vy, hcoeff, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] using hk refine ⟨fun x => ?_, fun x y => ?_⟩ · have hAx : (G.adjMatrix ℝ).mulVec x = ∑ j : V, (hA.eigenvalues j * (x ⬝ᵥ (e j).ofLp)) • (e j).ofLp := by conv_lhs => rw [hrepr_vec x] rw [Matrix.mulVec_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [Matrix.mulVec_smul, hA.mulVec_eigenvectorBasis, smul_smul, mul_comm] rw [hAx, dotProduct_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [dotProduct_smul, smul_eq_mul]; ring · conv_lhs => arg 2; rw [hrepr_vec y] rw [dotProduct_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [dotProduct_smul, smul_eq_mul]; ring /-- **Spectral Second-Eigenvalue Principle:** On any $d$-regular graph $G$, if $L \le d$ and there exists a nonzero vector $f \perp \mathbf{1}$ with $f^\top A_G f \ge L \|f\|_2^2$, then the adjacency matrix $A_G$ has **at least two distinct eigenbasis indices $j_1 \ne j_2$** with eigenvalues $\ge L$ (hence the second-largest eigenvalue satisfies $\lambda_2(G) \ge L$). -/ theorem exists_two_eigenvalues_ge_of_orth_rayleigh {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) {L : ℝ} (hLd : L ≤ (d : ℝ)) {f : V → ℝ} (hf : f ≠ 0) (horth : ∑ x : V, f x = 0) (hray : L * normSq f ≤ adjQuad G f) : let hA := adjMatrix_isHermitian G ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ L ≤ hA.eigenvalues j₁ ∧ L ≤ hA.eigenvalues j₂ := by intro hA obtain ⟨hquad_repr, hinner_repr⟩ := adjMatrix_spectral_expansion G by_contra hno push Not at hno have h1_ne : (fun _ : V => (1 : ℝ)) ≠ 0 := by obtain ⟨v0, _⟩ := Function.ne_iff.mp hf intro h0; have := congr_fun h0 v0; norm_num at this have h1_dot_pos : 0 < (fun _ : V => (1 : ℝ)) ⬝ᵥ (fun _ : V => (1 : ℝ)) := by rw [← normSq_eq_dotProduct]; exact normSq_pos_of_ne_zero h1_ne have h1_eig : ∀ j : V, hA.eigenvalues j ≠ (d : ℝ) → (fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp = 0 := by intro j hne have hsymm : (G.adjMatrix ℝ)ᵀ = G.adjMatrix ℝ := G.isSymm_adjMatrix have h1 : (fun _ : V => (1 : ℝ)) ⬝ᵥ (G.adjMatrix ℝ).mulVec (hA.eigenvectorBasis j).ofLp = (G.adjMatrix ℝ).mulVec (fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp := by rw [Matrix.dotProduct_mulVec, ← Matrix.mulVec_transpose, hsymm] rw [hA.mulVec_eigenvectorBasis, adjMatrix_mulVec_const_one G hreg, dotProduct_smul, smul_dotProduct, smul_eq_mul, smul_eq_mul] at h1 have hsub : (hA.eigenvalues j - (d : ℝ)) * ((fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp) = 0 := by linarith exact (mul_eq_zero.mp hsub).resolve_left (sub_ne_zero.mpr hne) have hex_j1 : ∃ j₁ : V, (fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j₁).ofLp ≠ 0 := by by_contra hall; push Not at hall have hzero : (fun _ : V => (1 : ℝ)) ⬝ᵥ (fun _ : V => (1 : ℝ)) = 0 := by rw [hinner_repr (fun _ => 1) (fun _ => 1)] exact Finset.sum_eq_zero fun j _ => by change ((fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp) * ((fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp) = 0 rw [hall j, zero_mul] linarith obtain ⟨j₁, hj1_ne⟩ := hex_j1 have hj1_eig : hA.eigenvalues j₁ = (d : ℝ) := by by_contra hne; exact hj1_ne (h1_eig j₁ hne) have hj1_ge : L ≤ hA.eigenvalues j₁ := by rw [hj1_eig]; exact hLd have hother_lt : ∀ j : V, j ≠ j₁ → hA.eigenvalues j < L := fun j hj => hno j₁ j hj.symm hj1_ge have hf_j1_zero : f ⬝ᵥ (hA.eigenvectorBasis j₁).ofLp = 0 := by have hf1 : f ⬝ᵥ (fun _ : V => (1 : ℝ)) = 0 := by simpa [dotProduct] using horth rw [hinner_repr f (fun _ => 1)] at hf1 have hsum_single : ∑ j : V, (f ⬝ᵥ (hA.eigenvectorBasis j).ofLp) * ((fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp) = (f ⬝ᵥ (hA.eigenvectorBasis j₁).ofLp) * ((fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j₁).ofLp) := by refine Finset.sum_eq_single j₁ (fun j _ hj => ?_) (fun h => False.elim (h (Finset.mem_univ j₁))) have hne_d : hA.eigenvalues j ≠ (d : ℝ) := ne_of_lt (lt_of_lt_of_le (hother_lt j hj) hLd) rw [h1_eig j hne_d, mul_zero] change ∑ j : V, (f ⬝ᵥ (hA.eigenvectorBasis j).ofLp) * ((fun _ : V => (1 : ℝ)) ⬝ᵥ (hA.eigenvectorBasis j).ofLp) = 0 at hf1 rw [hsum_single] at hf1 exact (mul_eq_zero.mp hf1).resolve_right hj1_ne have hf_pos : 0 < f ⬝ᵥ f := by rw [← normSq_eq_dotProduct]; exact normSq_pos_of_ne_zero hf have hf2 : f ⬝ᵥ f = ∑ j : V, (f ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := by rw [hinner_repr f f]; exact Finset.sum_congr rfl fun j _ => (sq _).symm have hlt_strict : f ⬝ᵥ (G.adjMatrix ℝ).mulVec f < L * (f ⬝ᵥ f) := by have hq : f ⬝ᵥ (G.adjMatrix ℝ).mulVec f = ∑ j : V, hA.eigenvalues j * (f ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := hquad_repr f rw [hq, hf2, Finset.mul_sum] have hne_term : ∃ j : V, j ≠ j₁ ∧ 0 < (f ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := by by_contra hall; push Not at hall have hzero : ∑ j : V, (f ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 = 0 := by refine Finset.sum_eq_zero fun j _ => ?_ by_cases hj : j = j₁ · subst hj; simp [hf_j1_zero] · exact le_antisymm (hall j hj) (sq_nonneg _) linarith obtain ⟨j₀, hj0_ne, hj0_pos⟩ := hne_term refine Finset.sum_lt_sum (fun j _ => ?_) ⟨j₀, Finset.mem_univ j₀, ?_⟩ · by_cases hj : j = j₁ · subst hj; simp [hf_j1_zero] · exact mul_le_mul_of_nonneg_right (le_of_lt (hother_lt j hj)) (sq_nonneg _) · exact mul_lt_mul_of_pos_right (hother_lt j₀ hj0_ne) hj0_pos rw [adjQuad_eq_dotProduct_mulVec, normSq_eq_dotProduct] at hray linarith /-- **Rayleigh–Ritz Two-Ball Orthogonality Principle.** -/ theorem rayleigh_two_disjoint_balls {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {L : ℝ} (S₁ S₂ : Finset V) (hdisj : Disjoint S₁ S₂) (hno_edge : ∀ x ∈ S₁, ∀ y ∈ S₂, ¬ G.Adj x y) (f₁ f₂ : V → ℝ) (hsupp₁ : ∀ x, x ∉ S₁ → f₁ x = 0) (hsupp₂ : ∀ x, x ∉ S₂ → f₂ x = 0) (hsum₁ : 0 < ∑ x : V, f₁ x) (hsum₂ : 0 < ∑ x : V, f₂ x) (hray₁ : L * normSq f₁ ≤ adjQuad G f₁) (hray₂ : L * normSq f₂ ≤ adjQuad G f₂) : ∃ f : V → ℝ, f ≠ 0 ∧ (∑ x : V, f x = 0) ∧ L * normSq f ≤ adjQuad G f := by set c₁ : ℝ := ∑ x : V, f₂ x set c₂ : ℝ := ∑ x : V, f₁ x set f : V → ℝ := fun x => c₁ * f₁ x - c₂ * f₂ x have hdisj_prod : ∀ x : V, f₁ x * f₂ x = 0 := by intro x by_cases hx1 : x ∈ S₁ · rw [hsupp₂ x (Finset.disjoint_left.mp hdisj hx1), mul_zero] · rw [hsupp₁ x hx1, zero_mul] have hcross_adj : ∀ x y : V, G.Adj x y → f₁ x * f₂ y = 0 := by intro x y hxy by_cases hx1 : x ∈ S₁ · by_cases hy2 : y ∈ S₂ · exact False.elim (hno_edge x hx1 y hy2 hxy) · rw [hsupp₂ y hy2, mul_zero] · rw [hsupp₁ x hx1, zero_mul] have horth : ∑ x : V, f x = 0 := by simp only [f, Finset.sum_sub_distrib, ← Finset.mul_sum, c₁, c₂]; ring have hnorm : normSq f = c₁ ^ 2 * normSq f₁ + c₂ ^ 2 * normSq f₂ := by simp only [normSq, f, Finset.mul_sum, ← Finset.sum_add_distrib] refine Finset.sum_congr rfl fun x _ => ?_ have h0 := hdisj_prod x calc (c₁ * f₁ x - c₂ * f₂ x) ^ 2 = c₁ ^ 2 * (f₁ x) ^ 2 + c₂ ^ 2 * (f₂ x) ^ 2 - 2 * c₁ * c₂ * (f₁ x * f₂ x) := by ring _ = c₁ ^ 2 * (f₁ x) ^ 2 + c₂ ^ 2 * (f₂ x) ^ 2 := by rw [h0]; ring have hquad : adjQuad G f = c₁ ^ 2 * adjQuad G f₁ + c₂ ^ 2 * adjQuad G f₂ := by simp only [adjQuad, f, Finset.mul_sum, ← Finset.sum_add_distrib] refine Finset.sum_congr rfl fun x _ => Finset.sum_congr rfl fun y _ => ?_ split_ifs with hxy · have h1 := hcross_adj x y hxy have h2 := hcross_adj y x hxy.symm calc (c₁ * f₁ x - c₂ * f₂ x) * (c₁ * f₁ y - c₂ * f₂ y) = c₁ ^ 2 * (f₁ x * f₁ y) + c₂ ^ 2 * (f₂ x * f₂ y) - c₁ * c₂ * (f₁ x * f₂ y) - c₁ * c₂ * (f₁ y * f₂ x) := by ring _ = c₁ ^ 2 * (f₁ x * f₁ y) + c₂ ^ 2 * (f₂ x * f₂ y) := by rw [h1, h2]; ring · ring have hf1_ne : f₁ ≠ 0 := by intro h0 have hz : ∑ x : V, f₁ x = 0 := by simp [h0] linarith have hnorm_pos : 0 < normSq f := by rw [hnorm] linarith [mul_pos (sq_pos_of_pos hsum₂) (normSq_pos_of_ne_zero hf1_ne), mul_nonneg (sq_nonneg c₂) (normSq_nonneg f₂)] have hf_ne : f ≠ 0 := by intro h0 have hz : normSq f = 0 := by simp [normSq, h0] linarith refine ⟨f, hf_ne, horth, ?_⟩ rw [hnorm, hquad] linarith [mul_le_mul_of_nonneg_left hray₁ (sq_nonneg c₁), mul_le_mul_of_nonneg_left hray₂ (sq_nonneg c₂)] /-! ### Section 2: Distance Shells & Universal Monotone Dual-Certificate Engine -/ /-- Distance shell at radius `i` from `u`. -/ noncomputable def distShell {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (i : ℕ) : Finset V := by classical exact Finset.univ.filter (fun x => G.Reachable u x ∧ G.dist u x = i) /-- Closed ball of radius `k` around `u`. -/ noncomputable def distBall {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (k : ℕ) : Finset V := by classical exact Finset.univ.filter (fun x => G.Reachable u x ∧ G.dist u x ≤ k) /-- Shell-boundary ordered edge set between shell `i` and shell `i + 1`. -/ noncomputable def shellEdges {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (u : V) (i : ℕ) : Finset (V × V) := by classical exact Finset.univ.filter (fun p : V × V => p.1 ∈ distShell G u i ∧ p.2 ∈ distShell G u (i + 1) ∧ G.Adj p.1 p.2) /-- Shell-supported radial test function $f(x) = a_{\operatorname{dist}(u, x)}$ on $B(u, k)$. -/ noncomputable def radialFunc {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (k : ℕ) (a : ℕ → ℝ) (x : V) : ℝ := by classical exact if G.Reachable u x ∧ G.dist u x ≤ k then a (G.dist u x) else 0 lemma mem_distShell {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (i : ℕ) (x : V) : x ∈ distShell G u i ↔ G.Reachable u x ∧ G.dist u x = i := by classical simp [distShell] lemma mem_distBall {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (k : ℕ) (x : V) : x ∈ distBall G u k ↔ G.Reachable u x ∧ G.dist u x ≤ k := by classical simp [distBall] lemma mem_shellEdges {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (u : V) (i : ℕ) (p : V × V) : p ∈ shellEdges G u i ↔ p.1 ∈ distShell G u i ∧ p.2 ∈ distShell G u (i + 1) ∧ G.Adj p.1 p.2 := by classical simp [shellEdges] lemma radialFunc_of_mem {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (k : ℕ) (a : ℕ → ℝ) {x : V} (hx : G.Reachable u x ∧ G.dist u x ≤ k) : radialFunc G u k a x = a (G.dist u x) := by classical simp [radialFunc, hx] lemma radialFunc_of_not_mem {V : Type*} [Fintype V] (G : SimpleGraph V) (u : V) (k : ℕ) (a : ℕ → ℝ) {x : V} (hx : ¬ (G.Reachable u x ∧ G.dist u x ≤ k)) : radialFunc G u k a x = 0 := by classical simp [radialFunc, hx] lemma graph_dist_triangle {V : Type*} (G : SimpleGraph V) {u v w : V} (h1 : G.Reachable u v) (h2 : G.Reachable v w) : G.dist u w ≤ G.dist u v + G.dist v w := by obtain ⟨p, hp⟩ := h1.exists_walk_length_eq_dist obtain ⟨q, hq⟩ := h2.exists_walk_length_eq_dist calc G.dist u w ≤ (p.append q).length := SimpleGraph.dist_le (p.append q) _ = p.length + q.length := SimpleGraph.Walk.length_append p q _ = G.dist u v + G.dist v w := by rw [hp, hq] lemma dist_adj_diff_le_one {V : Type*} (G : SimpleGraph V) {u x y : V} (hx : G.Reachable u x) (hxy : G.Adj x y) : G.Reachable u y ∧ G.dist u y ≤ G.dist u x + 1 ∧ G.dist u x ≤ G.dist u y + 1 := by have hy : G.Reachable u y := hx.trans (SimpleGraph.Adj.reachable hxy) have h1 : G.dist u y ≤ G.dist u x + 1 := by have htri := graph_dist_triangle G hx (SimpleGraph.Adj.reachable hxy) have hxy_d : G.dist x y = 1 := SimpleGraph.dist_eq_one_iff_adj.mpr hxy omega have h2 : G.dist u x ≤ G.dist u y + 1 := by have htri := graph_dist_triangle G hy (SimpleGraph.Adj.reachable hxy.symm) have hyx_d : G.dist y x = 1 := SimpleGraph.dist_eq_one_iff_adj.mpr hxy.symm omega exact ⟨hy, h1, h2⟩ lemma exists_prev_shell_neighbor {V : Type*} (G : SimpleGraph V) {u x : V} {i : ℕ} (hx : G.Reachable u x) (hd : G.dist u x = i + 1) : ∃ y : V, G.Adj y x ∧ G.Reachable u y ∧ G.dist u y = i := by obtain ⟨p, hp⟩ := hx.exists_walk_length_eq_dist rw [hd] at hp have hrev_len : p.reverse.length = i + 1 := by rw [SimpleGraph.Walk.length_reverse, hp] generalize hq_eq : p.reverse = q at hrev_len cases q with | nil => simp at hrev_len | @cons _ y _ hxy r => simp only [SimpleGraph.Walk.length_cons] at hrev_len have hy_reach : G.Reachable u y := r.reverse.reachable have hy_le : G.dist u y ≤ i := by calc G.dist u y ≤ r.reverse.length := SimpleGraph.dist_le r.reverse _ = r.length := SimpleGraph.Walk.length_reverse r _ = i := by omega have hy_ge : i ≤ G.dist u y := by have hstep := (dist_adj_diff_le_one G hy_reach hxy.symm).2.1 omega exact ⟨y, hxy.symm, hy_reach, by omega⟩ /-- Shell inequality (I): $e_0 \le d \cdot n_0$. -/ private lemma shell_e0_le {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) (u : V) : ((shellEdges G u 0).card : ℝ) ≤ (d : ℝ) * ((distShell G u 0).card : ℝ) := by have hcard : (shellEdges G u 0).card ≤ d * (distShell G u 0).card := by calc (shellEdges G u 0).card ≤ ((distShell G u 0).biUnion (fun x => (G.neighborFinset x).map ⟨fun y => (x, y), fun _ _ h => (Prod.mk.inj h).2⟩)).card := by refine Finset.card_le_card fun p hp => ?_ rw [mem_shellEdges] at hp simp only [Finset.mem_biUnion, Finset.mem_map, SimpleGraph.mem_neighborFinset] exact ⟨p.1, hp.1, p.2, hp.2.2, rfl⟩ _ ≤ ∑ x ∈ distShell G u 0, (G.neighborFinset x).card := le_trans Finset.card_biUnion_le (Finset.sum_le_sum fun x _ => by simp) _ = ∑ _x ∈ distShell G u 0, d := Finset.sum_congr rfl fun x _ => hreg x _ = d * (distShell G u 0).card := by simp [Nat.mul_comm] have hcast : ((shellEdges G u 0).card : ℝ) ≤ ((d * (distShell G u 0).card : ℕ) : ℝ) := Nat.cast_le.mpr hcard simpa [Nat.cast_mul] using hcast /-- Shell inequality (II): $n_{i+1} \le e_i$. -/ private lemma shell_ni_le_ei {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (u : V) (i : ℕ) : ((distShell G u (i + 1)).card : ℝ) ≤ ((shellEdges G u i).card : ℝ) := by classical have hcard : (distShell G u (i + 1)).card ≤ (shellEdges G u i).card := by have hex : ∀ x : V, x ∈ distShell G u (i + 1) → ∃ y : V, y ∈ distShell G u i ∧ G.Adj y x := by intro x hx rw [mem_distShell] at hx obtain ⟨y, hyx, hry, hdy⟩ := exists_prev_shell_neighbor G hx.1 hx.2 exact ⟨y, (mem_distShell G u i y).mpr ⟨hry, hdy⟩, hyx⟩ let g : V → V × V := fun x => if hx : x ∈ distShell G u (i + 1) then (Classical.choose (hex x hx), x) else (u, x) refine Finset.card_le_card_of_injOn g ?_ ?_ · intro x hx rw [Finset.mem_coe] at hx simp only [Finset.mem_coe, mem_shellEdges, g, dif_pos hx] exact ⟨(Classical.choose_spec (hex x hx)).1, hx, (Classical.choose_spec (hex x hx)).2⟩ · intro x₁ hx₁ x₂ hx₂ heq simp only [Finset.mem_coe] at hx₁ hx₂ simp only [g, dif_pos hx₁, dif_pos hx₂] at heq exact (Prod.mk.inj heq).2 exact Nat.cast_le.mpr hcard /-- Shell inequality (III): $e_i + e_{i+1} \le d \cdot n_{i+1}$. -/ private lemma shell_e_sum_le {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) (u : V) (i : ℕ) : ((shellEdges G u i).card : ℝ) + ((shellEdges G u (i + 1)).card : ℝ) ≤ (d : ℝ) * ((distShell G u (i + 1)).card : ℝ) := by classical set A1' : Finset (V × V) := Finset.univ.filter (fun p : V × V => p.1 ∈ distShell G u (i + 1) ∧ p.2 ∈ distShell G u i ∧ G.Adj p.1 p.2) have hcard_swap : (shellEdges G u i).card = A1'.card := by refine Finset.card_bij (fun p _ => (p.2, p.1)) ?_ ?_ ?_ · intro p hp rw [mem_shellEdges] at hp simp only [A1', Finset.mem_filter, Finset.mem_univ, true_and] exact ⟨hp.2.1, hp.1, hp.2.2.symm⟩ · intro _ _ _ _ h; ext <;> [exact (Prod.mk.inj h).2; exact (Prod.mk.inj h).1] · intro q hq simp only [A1', Finset.mem_filter, Finset.mem_univ, true_and] at hq exact ⟨(q.2, q.1), (mem_shellEdges G u i (q.2, q.1)).mpr ⟨hq.2.1, hq.1, hq.2.2.symm⟩, rfl⟩ have hdisj : Disjoint A1' (shellEdges G u (i + 1)) := by rw [Finset.disjoint_left] intro p hp1 hp2 simp only [A1', Finset.mem_filter, Finset.mem_univ, true_and] at hp1 rw [mem_shellEdges] at hp2 have h1 := ((mem_distShell G u i p.2).mp hp1.2.1).2 have h2 := ((mem_distShell G u (i + 2) p.2).mp hp2.2.1).2 omega have hcard_le : (shellEdges G u i).card + (shellEdges G u (i + 1)).card ≤ d * (distShell G u (i + 1)).card := by rw [hcard_swap, ← Finset.card_union_of_disjoint hdisj] calc (A1' ∪ shellEdges G u (i + 1)).card ≤ ((distShell G u (i + 1)).biUnion (fun x => (G.neighborFinset x).map ⟨fun y => (x, y), fun _ _ h => (Prod.mk.inj h).2⟩)).card := by refine Finset.card_le_card fun p hp => ?_ simp only [Finset.mem_union] at hp simp only [Finset.mem_biUnion, Finset.mem_map, SimpleGraph.mem_neighborFinset] rcases hp with h1 | h2 · simp only [A1', Finset.mem_filter, Finset.mem_univ, true_and] at h1 exact ⟨p.1, h1.1, p.2, h1.2.2, rfl⟩ · rw [mem_shellEdges] at h2 exact ⟨p.1, h2.1, p.2, h2.2.2, rfl⟩ _ ≤ ∑ x ∈ distShell G u (i + 1), (G.neighborFinset x).card := le_trans Finset.card_biUnion_le (Finset.sum_le_sum fun x _ => by simp) _ = ∑ _x ∈ distShell G u (i + 1), d := Finset.sum_congr rfl fun x _ => hreg x _ = d * (distShell G u (i + 1)).card := by simp [Nat.mul_comm] have hcast : (((shellEdges G u i).card + (shellEdges G u (i + 1)).card : ℕ) : ℝ) ≤ ((d * (distShell G u (i + 1)).card : ℕ) : ℝ) := Nat.cast_le.mpr hcard_le simpa [Nat.cast_add, Nat.cast_mul] using hcast /-- Norm squared of `radialFunc` decomposed by distance shells. -/ private lemma radialFunc_normSq_eq {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (u : V) (k : ℕ) (a : ℕ → ℝ) : normSq (radialFunc G u k a) = ∑ i ∈ Finset.range (k + 1), ((distShell G u i).card : ℝ) * (a i) ^ 2 := by classical have hsplit : normSq (radialFunc G u k a) = ∑ x ∈ distBall G u k, (a (G.dist u x)) ^ 2 := by simp only [normSq] have h1 : ∀ x : V, (radialFunc G u k a x) ^ 2 = if x ∈ distBall G u k then (a (G.dist u x)) ^ 2 else 0 := by intro x by_cases hx : x ∈ distBall G u k · rw [if_pos hx, radialFunc_of_mem G u k a ((mem_distBall G u k x).mp hx)] · rw [if_neg hx, radialFunc_of_not_mem G u k a (fun h => hx ((mem_distBall G u k x).mpr h)), zero_pow two_ne_zero] simp_rw [h1, ← Finset.sum_filter] refine Finset.sum_congr (by ext x; simp) (fun _ _ => rfl) rw [hsplit] have hpart : distBall G u k = (Finset.range (k + 1)).biUnion (distShell G u) := by ext x simp only [mem_distBall, Finset.mem_biUnion, Finset.mem_range, mem_distShell] constructor · intro ⟨hr, hd⟩; exact ⟨G.dist u x, by omega, hr, rfl⟩ · rintro ⟨i, hi, hr, hd⟩; exact ⟨hr, by omega⟩ have hdisj : Set.PairwiseDisjoint (Finset.range (k + 1) : Set ℕ) (distShell G u) := by intro i _ j _ hij rw [Function.onFun, Finset.disjoint_left] intro x hxi hxj rw [mem_distShell] at hxi hxj exact hij (hxi.2.symm.trans hxj.2) rw [hpart, Finset.sum_biUnion hdisj] refine Finset.sum_congr rfl fun i _ => ?_ have hconst : ∑ x ∈ distShell G u i, (a (G.dist u x)) ^ 2 = ∑ _x ∈ distShell G u i, (a i) ^ 2 := Finset.sum_congr rfl fun x hx => by rw [((mem_distShell G u i x).mp hx).2] rw [hconst, Finset.sum_const, nsmul_eq_mul] /-- Dirichlet energy of `radialFunc` decomposed by shell-boundary edges. -/ private lemma radialFunc_energy_eq {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) (u : V) (k : ℕ) (a : ℕ → ℝ) (ha_end : a (k + 1) = 0) : (d : ℝ) * normSq (radialFunc G u k a) - adjQuad G (radialFunc G u k a) = ∑ i ∈ Finset.range (k + 1), ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := by classical set f := radialFunc G u k a have hlap := regular_laplacian_energy_eq G hreg f have hterm : ∀ x y : V, (if G.Adj x y then (f x - f y) ^ 2 else 0) = (∑ i ∈ Finset.range (k + 1), if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) + (∑ i ∈ Finset.range (k + 1), if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) := by intro x y by_cases hxy : G.Adj x y · have hyx : G.Adj y x := hxy.symm by_cases hrx : G.Reachable u x · obtain ⟨hry, hdy_le, hdx_le⟩ := dist_adj_diff_le_one G hrx hxy have hcases : G.dist u y = G.dist u x + 1 ∨ G.dist u x = G.dist u y + 1 ∨ G.dist u x = G.dist u y := by omega rcases hcases with hup | hdn | heq · have hsum2 : ∑ i ∈ Finset.range (k + 1), (if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := by refine Finset.sum_eq_zero fun i _ => if_neg ?_ rw [mem_shellEdges]; intro ⟨h1, h2, _⟩; dsimp only at h1 h2; rw [mem_distShell] at h1 h2; omega rw [hsum2, add_zero, if_pos hxy] by_cases hle : G.dist u x ≤ k · have hsum1 : ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = (a (G.dist u x) - a (G.dist u x + 1)) ^ 2 := by rw [Finset.sum_eq_single (G.dist u x)] · rw [if_pos ((mem_shellEdges G u _ _).mpr ⟨(mem_distShell G u _ x).mpr ⟨hrx, rfl⟩, (mem_distShell G u _ y).mpr ⟨hry, hup⟩, hxy⟩)] · intro i _ hne refine if_neg fun h => hne ((mem_distShell G u i x).mp ((mem_shellEdges G u i _).mp h).1).2.symm · intro hmem; exact False.elim (hmem (Finset.mem_range.mpr (by omega))) rw [hsum1] have hfx : f x = a (G.dist u x) := radialFunc_of_mem G u k a ⟨hrx, hle⟩ by_cases hle' : G.dist u y ≤ k · have hfy : f y = a (G.dist u x + 1) := by rw [show f y = a (G.dist u y) from radialFunc_of_mem G u k a ⟨hry, hle'⟩, hup] rw [hfx, hfy] · have hfy : f y = 0 := radialFunc_of_not_mem G u k a (fun h => hle' h.2) have hdx_eq : G.dist u x = k := by omega rw [hfx, hfy, hdx_eq, ha_end] · have hsum1 : ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := by refine Finset.sum_eq_zero fun i hi => if_neg fun h => ?_ have hi_lt : i < k + 1 := Finset.mem_range.mp hi have hdi := ((mem_distShell G u i x).mp ((mem_shellEdges G u i _).mp h).1).2 omega rw [hsum1] have hfx : f x = 0 := radialFunc_of_not_mem G u k a (fun h => hle h.2) have hfy : f y = 0 := radialFunc_of_not_mem G u k a (fun h => by omega) rw [hfx, hfy]; ring · have hsum1 : ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := by refine Finset.sum_eq_zero fun i _ => if_neg ?_ rw [mem_shellEdges]; intro ⟨h1, h2, _⟩; dsimp only at h1 h2; rw [mem_distShell] at h1 h2; omega rw [hsum1, zero_add, if_pos hxy] by_cases hle : G.dist u y ≤ k · have hsum2 : ∑ i ∈ Finset.range (k + 1), (if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = (a (G.dist u y) - a (G.dist u y + 1)) ^ 2 := by rw [Finset.sum_eq_single (G.dist u y)] · rw [if_pos ((mem_shellEdges G u _ _).mpr ⟨(mem_distShell G u _ y).mpr ⟨hry, rfl⟩, (mem_distShell G u _ x).mpr ⟨hrx, hdn⟩, hyx⟩)] · intro i _ hne refine if_neg fun h => hne ((mem_distShell G u i y).mp ((mem_shellEdges G u i _).mp h).1).2.symm · intro hmem; exact False.elim (hmem (Finset.mem_range.mpr (by omega))) rw [hsum2] have hfy : f y = a (G.dist u y) := radialFunc_of_mem G u k a ⟨hry, hle⟩ by_cases hle' : G.dist u x ≤ k · have hfx : f x = a (G.dist u y + 1) := by rw [show f x = a (G.dist u x) from radialFunc_of_mem G u k a ⟨hrx, hle'⟩, hdn] rw [hfx, hfy]; ring · have hfx : f x = 0 := radialFunc_of_not_mem G u k a (fun h => hle' h.2) have hdy_eq : G.dist u y = k := by omega rw [hfx, hfy, hdy_eq, ha_end]; ring · have hsum2 : ∑ i ∈ Finset.range (k + 1), (if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := by refine Finset.sum_eq_zero fun i hi => if_neg fun h => ?_ have hi_lt : i < k + 1 := Finset.mem_range.mp hi have hdi := ((mem_distShell G u i y).mp ((mem_shellEdges G u i _).mp h).1).2 omega rw [hsum2] have hfx : f x = 0 := radialFunc_of_not_mem G u k a (fun h => by omega) have hfy : f y = 0 := radialFunc_of_not_mem G u k a (fun h => hle h.2) rw [hfx, hfy]; ring · have hsum1 : ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := by refine Finset.sum_eq_zero fun i _ => if_neg ?_ rw [mem_shellEdges]; intro ⟨h1, h2, _⟩; dsimp only at h1 h2; rw [mem_distShell] at h1 h2; omega have hsum2 : ∑ i ∈ Finset.range (k + 1), (if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := by refine Finset.sum_eq_zero fun i _ => if_neg ?_ rw [mem_shellEdges]; intro ⟨h1, h2, _⟩; dsimp only at h1 h2; rw [mem_distShell] at h1 h2; omega rw [hsum1, hsum2, add_zero, if_pos hxy] by_cases hle : G.dist u x ≤ k · have hfx : f x = a (G.dist u x) := radialFunc_of_mem G u k a ⟨hrx, hle⟩ have hfy : f y = a (G.dist u x) := by rw [show f y = a (G.dist u y) from radialFunc_of_mem G u k a ⟨hry, by omega⟩, heq] rw [hfx, hfy]; ring · have hfx : f x = 0 := radialFunc_of_not_mem G u k a (fun h => hle h.2) have hfy : f y = 0 := radialFunc_of_not_mem G u k a (fun h => by omega) rw [hfx, hfy]; ring · have hry : ¬ G.Reachable u y := fun h => hrx (h.trans (SimpleGraph.Adj.reachable hyx)) have hsum1 : ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := Finset.sum_eq_zero fun i _ => if_neg fun h => hrx ((mem_distShell G u i x).mp ((mem_shellEdges G u i _).mp h).1).1 have hsum2 : ∑ i ∈ Finset.range (k + 1), (if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = 0 := Finset.sum_eq_zero fun i _ => if_neg fun h => hry ((mem_distShell G u i y).mp ((mem_shellEdges G u i _).mp h).1).1 rw [hsum1, hsum2, add_zero, if_pos hxy] have hfx : f x = 0 := radialFunc_of_not_mem G u k a (fun h => hrx h.1) have hfy : f y = 0 := radialFunc_of_not_mem G u k a (fun h => hry h.1) rw [hfx, hfy]; ring · have hyx : ¬ G.Adj y x := fun h => hxy h.symm rw [if_neg hxy] have h1 : ∀ i, (x, y) ∉ shellEdges G u i := fun i h => hxy ((mem_shellEdges G u i _).mp h).2.2 have h2 : ∀ i, (y, x) ∉ shellEdges G u i := fun i h => hyx ((mem_shellEdges G u i _).mp h).2.2 simp [h1, h2] have hsingle : ∀ i : ℕ, ∑ x : V, ∑ y : V, (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := by intro i rw [← Fintype.sum_prod_type (fun p : V × V => if p ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0)] rw [← Finset.sum_filter, Finset.filter_mem_eq_inter, Finset.univ_inter, Finset.sum_const, nsmul_eq_mul] have hcount1 : ∑ x : V, ∑ y : V, ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = ∑ i ∈ Finset.range (k + 1), ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := by calc ∑ x : V, ∑ y : V, ∑ i ∈ Finset.range (k + 1), (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = ∑ x : V, ∑ i ∈ Finset.range (k + 1), ∑ y : V, (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) := Finset.sum_congr rfl fun _ _ => Finset.sum_comm _ = ∑ i ∈ Finset.range (k + 1), ∑ x : V, ∑ y : V, (if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) := Finset.sum_comm _ = ∑ i ∈ Finset.range (k + 1), ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := Finset.sum_congr rfl fun i _ => hsingle i have hcount2 : ∑ x : V, ∑ y : V, ∑ i ∈ Finset.range (k + 1), (if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) = ∑ i ∈ Finset.range (k + 1), ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := by rw [Finset.sum_comm]; exact hcount1 have hpair : ∑ x : V, ∑ y : V, (if G.Adj x y then (f x - f y) ^ 2 else 0) = 2 * ∑ i ∈ Finset.range (k + 1), ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := by calc ∑ x : V, ∑ y : V, (if G.Adj x y then (f x - f y) ^ 2 else 0) = ∑ x : V, ((∑ y : V, ∑ i ∈ Finset.range (k + 1), if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) + (∑ y : V, ∑ i ∈ Finset.range (k + 1), if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0)) := Finset.sum_congr rfl fun x _ => by rw [Finset.sum_congr rfl fun y _ => hterm x y, Finset.sum_add_distrib] _ = (∑ x : V, ∑ y : V, ∑ i ∈ Finset.range (k + 1), if (x, y) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) + (∑ x : V, ∑ y : V, ∑ i ∈ Finset.range (k + 1), if (y, x) ∈ shellEdges G u i then (a i - a (i + 1)) ^ 2 else 0) := Finset.sum_add_distrib _ = 2 * ∑ i ∈ Finset.range (k + 1), ((shellEdges G u i).card : ℝ) * (a i - a (i + 1)) ^ 2 := by rw [hcount1, hcount2]; ring linarith /-- **Universal Monotone Tree-Comparison Dual-Certificate Engine (Vertex-Centered Ball).** For *any* $d$-regular finite simple graph $G$ ($d \ge 2$, ZERO girth assumption!), any vertex $u$, any radius $k$, and any nonincreasing nonnegative sequence $a_0 \ge a_1 \ge \dots \ge a_k \ge a_{k+1} = 0$ satisfying $$L a_0 \le d a_1, \qquad L a_i \le a_{i-1} + (d - 1) a_{i+1} \quad (1 \le i \le k),$$ the radial function $f_u(x) = a_{\operatorname{dist}(u, x)} \mathbf{1}_{\operatorname{dist}(u, x) \le k}$ satisfies $L \|f_u\|_2^2 \le f_u^\top A_G f_u$. -/ theorem alon_boppana_dual_certificate_ball {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) (u : V) (k : ℕ) (a : ℕ → ℝ) (L : ℝ) (ha_nn : ∀ i ≤ k + 1, 0 ≤ a i) (ha_dec : ∀ i ≤ k, a (i + 1) ≤ a i) (ha_end : a (k + 1) = 0) (hsub0 : L * a 0 ≤ (d : ℝ) * a 1) (hsub : ∀ i, 1 ≤ i → i ≤ k → L * a i ≤ a (i - 1) + ((d : ℝ) - 1) * a (i + 1)) : L * normSq (radialFunc G u k a) ≤ adjQuad G (radialFunc G u k a) := by set nS : ℕ → ℝ := fun i => ((distShell G u i).card : ℝ) set eS : ℕ → ℝ := fun i => ((shellEdges G u i).card : ℝ) have hnorm_eq := radialFunc_normSq_eq G u k a have henergy_eq := radialFunc_energy_eq G hreg u k a ha_end set α : ℕ → ℝ := fun i => a i * (a i - a (i + 1)) set β : ℕ → ℝ := fun i => a i * (a (i - 1) - a (i + 1)) have hα_nn : ∀ i ≤ k, 0 ≤ α i := fun i hi => mul_nonneg (ha_nn i (by omega)) (sub_nonneg.mpr (ha_dec i hi)) have hβ_nn : ∀ i, 1 ≤ i → i ≤ k → 0 ≤ β i := fun i hi1 hik => mul_nonneg (ha_nn i (by omega)) (sub_nonneg.mpr (le_trans (ha_dec i hik) (by simpa [Nat.sub_add_cancel hi1] using ha_dec (i - 1) (by omega)))) have htelescope : ∑ i ∈ Finset.range (k + 1), eS i * (a i - a (i + 1)) ^ 2 = α 0 * eS 0 + (∑ i ∈ Finset.Icc 1 k, α i * (eS (i - 1) + eS i)) - (∑ i ∈ Finset.Icc 1 k, β i * eS (i - 1)) := by have hcoeff : ∀ i, i < k → α i + α (i + 1) - β (i + 1) = (a i - a (i + 1)) ^ 2 := by intro i _; simp only [α, β, Nat.add_sub_cancel]; ring have hlast : α k = (a k - a (k + 1)) ^ 2 := by simp only [α, ha_end]; ring have hshift : ∀ g : ℕ → ℝ, ∑ i ∈ Finset.Icc 1 k, g i = ∑ i ∈ Finset.range k, g (i + 1) := by intro g refine Finset.sum_bij (fun i _ => i - 1) ?_ ?_ ?_ ?_ · intro i hi; simp only [Finset.mem_Icc] at hi; exact Finset.mem_range.mpr (by omega) · intro i₁ hi₁ i₂ hi₂ h; simp only [Finset.mem_Icc] at hi₁ hi₂; omega · intro j hj; simp only [Finset.mem_range] at hj exact ⟨j + 1, Finset.mem_Icc.mpr ⟨by omega, by omega⟩, by omega⟩ · intro i hi; simp only [Finset.mem_Icc] at hi; rw [Nat.sub_add_cancel hi.1] rw [hshift (fun i => α i * (eS (i - 1) + eS i)), hshift (fun i => β i * eS (i - 1))] simp only [Nat.add_sub_cancel] rw [Finset.sum_range_succ] have htele_sum : α 0 * eS 0 + ∑ i ∈ Finset.range k, α (i + 1) * eS (i + 1) = (∑ i ∈ Finset.range k, α i * eS i) + α k * eS k := by have h1 := Finset.sum_range_succ' (fun i => α i * eS i) k have h2 := Finset.sum_range_succ (fun i => α i * eS i) k linarith have hsplit : α 0 * eS 0 + ∑ i ∈ Finset.range k, α (i + 1) * (eS i + eS (i + 1)) = (∑ i ∈ Finset.range k, (α i + α (i + 1)) * eS i) + α k * eS k := by have hmul : ∑ i ∈ Finset.range k, α (i + 1) * (eS i + eS (i + 1)) = (∑ i ∈ Finset.range k, α (i + 1) * eS i) + (∑ i ∈ Finset.range k, α (i + 1) * eS (i + 1)) := by rw [← Finset.sum_add_distrib] exact Finset.sum_congr rfl fun i _ => mul_add _ _ _ have hadd_sum : (∑ i ∈ Finset.range k, α i * eS i) + (∑ i ∈ Finset.range k, α (i + 1) * eS i) = ∑ i ∈ Finset.range k, (α i + α (i + 1)) * eS i := by rw [← Finset.sum_add_distrib] exact Finset.sum_congr rfl fun i _ => (add_mul _ _ _).symm linarith rw [hsplit] have hsub_sum : (∑ i ∈ Finset.range k, (α i + α (i + 1)) * eS i) - (∑ i ∈ Finset.range k, β (i + 1) * eS i) = ∑ i ∈ Finset.range k, eS i * (a i - a (i + 1)) ^ 2 := by rw [← Finset.sum_sub_distrib] refine Finset.sum_congr rfl fun i hi => ?_ rw [← hcoeff i (Finset.mem_range.mp hi)]; ring rw [← hlast] linarith have hbound : ∑ i ∈ Finset.range (k + 1), eS i * (a i - a (i + 1)) ^ 2 ≤ ((d : ℝ) - L) * normSq (radialFunc G u k a) := by rw [htelescope, hnorm_eq, Finset.mul_sum] have h0 : α 0 * eS 0 ≤ ((d : ℝ) - L) * (nS 0 * (a 0) ^ 2) := by have h1 : α 0 * eS 0 ≤ α 0 * ((d : ℝ) * nS 0) := mul_le_mul_of_nonneg_left (shell_e0_le G hreg u) (hα_nn 0 (Nat.zero_le k)) have h2 : α 0 * (d : ℝ) ≤ ((d : ℝ) - L) * (a 0) ^ 2 := by simp only [α]; nlinarith [ha_nn 0 (Nat.zero_le (k + 1)), hsub0] have h3 : (α 0 * (d : ℝ)) * nS 0 ≤ (((d : ℝ) - L) * (a 0) ^ 2) * nS 0 := mul_le_mul_of_nonneg_right h2 (Nat.cast_nonneg _) linarith have hi_le : ∀ i ∈ Finset.Icc 1 k, α i * (eS (i - 1) + eS i) - β i * eS (i - 1) ≤ ((d : ℝ) - L) * (nS i * (a i) ^ 2) := by intro i hi simp only [Finset.mem_Icc] at hi have hi1 : i - 1 + 1 = i := Nat.sub_add_cancel hi.1 have hA : α i * (eS (i - 1) + eS i) ≤ α i * ((d : ℝ) * nS i) := by have hstep := shell_e_sum_le G hreg u (i - 1); rw [hi1] at hstep exact mul_le_mul_of_nonneg_left hstep (hα_nn i hi.2) have hB : β i * nS i ≤ β i * eS (i - 1) := by have hstep := shell_ni_le_ei G u (i - 1); rw [hi1] at hstep exact mul_le_mul_of_nonneg_left hstep (hβ_nn i hi.1 hi.2) have hC : ((d : ℝ) * α i - β i) ≤ ((d : ℝ) - L) * (a i) ^ 2 := by have hdiff : ((d : ℝ) - L) * (a i) ^ 2 - ((d : ℝ) * α i - β i) = a i * (a (i - 1) + ((d : ℝ) - 1) * a (i + 1) - L * a i) := by simp only [α, β]; ring have hnn : 0 ≤ a i * (a (i - 1) + ((d : ℝ) - 1) * a (i + 1) - L * a i) := mul_nonneg (ha_nn i (by omega)) (sub_nonneg.mpr (hsub i hi.1 hi.2)) linarith have hD : ((d : ℝ) * α i - β i) * nS i ≤ (((d : ℝ) - L) * (a i) ^ 2) * nS i := mul_le_mul_of_nonneg_right hC (Nat.cast_nonneg _) linarith have hsum_Icc : (∑ i ∈ Finset.Icc 1 k, α i * (eS (i - 1) + eS i)) - (∑ i ∈ Finset.Icc 1 k, β i * eS (i - 1)) ≤ ∑ i ∈ Finset.Icc 1 k, ((d : ℝ) - L) * (nS i * (a i) ^ 2) := by rw [← Finset.sum_sub_distrib] exact Finset.sum_le_sum hi_le have hsplit_rhs : ∑ i ∈ Finset.range (k + 1), ((d : ℝ) - L) * (nS i * (a i) ^ 2) = ((d : ℝ) - L) * (nS 0 * (a 0) ^ 2) + ∑ i ∈ Finset.Icc 1 k, ((d : ℝ) - L) * (nS i * (a i) ^ 2) := by rw [Finset.sum_range_succ' _ k, add_comm] congr 1 refine Finset.sum_bij (fun i _ => i + 1) ?_ ?_ ?_ ?_ · intro i hi; simp only [Finset.mem_range] at hi; exact Finset.mem_Icc.mpr ⟨by omega, by omega⟩ · intro _ _ _ _ h; omega · intro j hj; simp only [Finset.mem_Icc] at hj exact ⟨j - 1, Finset.mem_range.mpr (by omega), by omega⟩ · intro _ _; rfl linarith linarith /-! ### Section 3: Exact Tree-Ball Eigenvalue, Explicit Phase-Shift & Small-Diameter Radical Bounds -/ lemma balls_disjoint_no_edges {V : Type*} [Fintype V] (G : SimpleGraph V) {u v : V} {k : ℕ} (hfar : G.Reachable u v → 2 * k + 2 ≤ G.dist u v) : Disjoint (distBall G u k) (distBall G v k) ∧ ∀ x ∈ distBall G u k, ∀ y ∈ distBall G v k, ¬ G.Adj x y := by constructor · rw [Finset.disjoint_left] intro x hxu hxv rw [mem_distBall] at hxu hxv have huv : G.Reachable u v := hxu.1.trans hxv.1.symm have htri := graph_dist_triangle G hxu.1 hxv.1.symm rw [SimpleGraph.dist_comm (u := x) (v := v)] at htri have hge := hfar huv omega · intro x hxu y hyv hxy rw [mem_distBall] at hxu hyv have huv : G.Reachable u v := (hxu.1.trans (SimpleGraph.Adj.reachable hxy)).trans hyv.1.symm have htri1 := graph_dist_triangle G hxu.1 (SimpleGraph.Adj.reachable hxy) have htri2 := graph_dist_triangle G (hxu.1.trans (SimpleGraph.Adj.reachable hxy)) hyv.1.symm have hxy_d : G.dist x y = 1 := SimpleGraph.dist_eq_one_iff_adj.mpr hxy rw [SimpleGraph.dist_comm (u := y) (v := v)] at htri2 have hge := hfar huv omega theorem alon_boppana_from_sequence {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) {u v : V} {k : ℕ} (hfar : G.Reachable u v → 2 * k + 2 ≤ G.dist u v) (a : ℕ → ℝ) (L : ℝ) (hLd : L ≤ (d : ℝ)) (ha0_pos : 0 < a 0) (ha_nn : ∀ i ≤ k + 1, 0 ≤ a i) (ha_dec : ∀ i ≤ k, a (i + 1) ≤ a i) (ha_end : a (k + 1) = 0) (hsub0 : L * a 0 ≤ (d : ℝ) * a 1) (hsub : ∀ i, 1 ≤ i → i ≤ k → L * a i ≤ a (i - 1) + ((d : ℝ) - 1) * a (i + 1)) : let hA := adjMatrix_isHermitian G ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ L ≤ hA.eigenvalues j₁ ∧ L ≤ hA.eigenvalues j₂ := by obtain ⟨hdisj, hno_edge⟩ := balls_disjoint_no_edges G hfar have hray_u := alon_boppana_dual_certificate_ball G hreg u k a L ha_nn ha_dec ha_end hsub0 hsub have hray_v := alon_boppana_dual_certificate_ball G hreg v k a L ha_nn ha_dec ha_end hsub0 hsub have hsupp : ∀ w x, x ∉ distBall G w k → radialFunc G w k a x = 0 := fun w x hx => radialFunc_of_not_mem G w k a (fun h => hx ((mem_distBall G w k x).mpr h)) have hnn : ∀ w x, 0 ≤ radialFunc G w k a x := fun w x => by by_cases hx : G.Reachable w x ∧ G.dist w x ≤ k · rw [radialFunc_of_mem G w k a hx]; exact ha_nn _ (by omega) · rw [radialFunc_of_not_mem G w k a hx] have hsum_pos : ∀ w, 0 < ∑ x : V, radialFunc G w k a x := fun w => by refine Finset.sum_pos' (fun x _ => hnn w x) ⟨w, Finset.mem_univ w, ?_⟩ rw [radialFunc_of_mem G w k a ⟨SimpleGraph.Reachable.refl w, by simp⟩] simpa using ha0_pos obtain ⟨f, hf_ne, horth, hray⟩ := rayleigh_two_disjoint_balls G (distBall G u k) (distBall G v k) hdisj hno_edge (radialFunc G u k a) (radialFunc G v k a) (hsupp u) (hsupp v) (hsum_pos u) (hsum_pos v) hray_u hray_v exact exists_two_eigenvalues_ge_of_orth_rayleigh G hreg hLd hf_ne horth hray /-- **Exact Small-Diameter Radical Bound #1 ($D \ge 4 \implies \lambda_2(G) \ge \sqrt{d}$).** -/ theorem alon_boppana_diam4_sqrt_d {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hd : 2 ≤ d) (hreg : G.IsRegularOfDegree d) {u v : V} (hfar : G.Reachable u v → 4 ≤ G.dist u v) : let hA := adjMatrix_isHermitian G ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ Real.sqrt (d : ℝ) ≤ hA.eigenvalues j₁ ∧ Real.sqrt (d : ℝ) ≤ hA.eigenvalues j₂ := by have hd_r : (2 : ℝ) ≤ d := by exact_mod_cast hd set a : ℕ → ℝ := fun i => if i = 0 then Real.sqrt (d : ℝ) else if i = 1 then 1 else 0 have hsq : (Real.sqrt (d : ℝ)) ^ 2 = (d : ℝ) := Real.sq_sqrt (by linarith) have hge1 : (1 : ℝ) ≤ Real.sqrt (d : ℝ) := by rw [← Real.sqrt_one]; exact Real.sqrt_le_sqrt (by linarith) have hle_d : Real.sqrt (d : ℝ) ≤ (d : ℝ) := by have : Real.sqrt (d : ℝ) ≤ Real.sqrt ((d : ℝ) ^ 2) := Real.sqrt_le_sqrt (by nlinarith) rwa [Real.sqrt_sq (by linarith)] at this refine alon_boppana_from_sequence G hreg (k := 1) hfar a (Real.sqrt (d : ℝ)) hle_d (Real.sqrt_pos.mpr (by linarith)) ?_ ?_ (by simp [a]) ?_ ?_ · intro i hi; interval_cases i <;> simp [a] · intro i hi; interval_cases i · simp only [a, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte]; exact hge1 · simp [a] · simp only [a, ↓reduceIte, one_ne_zero, mul_one]; nlinarith · intro i hi1 hik have hi : i = 1 := by omega subst hi simp [a] /-- **Exact Small-Diameter Radical Bound #2 ($D \ge 6 \implies \lambda_2(G) \ge \sqrt{2d - 1}$).** -/ theorem alon_boppana_diam6_sqrt_2d_sub_1 {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hd : 2 ≤ d) (hreg : G.IsRegularOfDegree d) {u v : V} (hfar : G.Reachable u v → 6 ≤ G.dist u v) : let hA := adjMatrix_isHermitian G ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ Real.sqrt (2 * (d : ℝ) - 1) ≤ hA.eigenvalues j₁ ∧ Real.sqrt (2 * (d : ℝ) - 1) ≤ hA.eigenvalues j₂ := by have hd_r : (2 : ℝ) ≤ d := by exact_mod_cast hd set L : ℝ := Real.sqrt (2 * (d : ℝ) - 1) have hL_sq : L ^ 2 = 2 * (d : ℝ) - 1 := Real.sq_sqrt (by linarith) have hL_pos : 0 < L := Real.sqrt_pos.mpr (by linarith) have hL_gt1 : 1 < L := by rw [← Real.sqrt_one]; exact Real.sqrt_lt_sqrt zero_le_one (by linarith) have hL_le_d : L ≤ (d : ℝ) := by have : L ^ 2 ≤ (d : ℝ) ^ 2 := by rw [hL_sq]; nlinarith nlinarith set a : ℕ → ℝ := fun i => if i = 0 then (d : ℝ) * L else if i = 1 then 2 * (d : ℝ) - 1 else if i = 2 then L else 0 refine alon_boppana_from_sequence G hreg (k := 2) hfar a L hL_le_d (mul_pos (by linarith) hL_pos) ?_ ?_ (by simp [a]) ?_ ?_ · intro i hi; interval_cases i <;> simp only [a] · exact mul_nonneg (by linarith) (le_of_lt hL_pos) · norm_num; linarith · norm_num; exact le_of_lt hL_pos · norm_num · intro i hi interval_cases i · simp only [a, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte] nlinarith [hL_sq, hL_le_d, hL_pos] · simp only [a, show (1 : ℕ) + 1 = 2 by rfl, show (2 : ℕ) ≠ 0 by decide, show (2 : ℕ) ≠ 1 by decide, show (1 : ℕ) ≠ 0 by decide, ↓reduceIte] nlinarith [hL_sq, hL_gt1] · simp only [a, show (2 : ℕ) + 1 = 3 by rfl, show (3 : ℕ) ≠ 0 by decide, show (3 : ℕ) ≠ 1 by decide, show (3 : ℕ) ≠ 2 by decide, show (2 : ℕ) ≠ 0 by decide, show (2 : ℕ) ≠ 1 by decide, ↓reduceIte] exact le_of_lt hL_pos · simp only [a, ↓reduceIte, one_ne_zero]; nlinarith [hL_sq] · intro i hi1 hik interval_cases i · simp only [a, show (1 : ℕ) ≠ 0 by decide, ↓reduceIte, Nat.sub_self, show (1 : ℕ) + 1 = 2 by rfl, show (2 : ℕ) ≠ 0 by decide, show (2 : ℕ) ≠ 1 by decide] exact le_of_eq (by ring) · simp only [a, show (2 : ℕ) ≠ 0 by decide, show (2 : ℕ) ≠ 1 by decide, show (2 : ℕ) - 1 = 1 by rfl, show (1 : ℕ) ≠ 0 by decide, ↓reduceIte, show (2 : ℕ) + 1 = 3 by rfl, show (3 : ℕ) ≠ 0 by decide, show (3 : ℕ) ≠ 1 by decide, show (3 : ℕ) ≠ 2 by decide, mul_zero, add_zero] nlinarith [hL_sq] /-- **Superiority of `√(2d - 1)` over Both Friedman (1993) and Nilli (1991) at $k = 2$.** -/ theorem diam6_beats_nilli_and_friedman {d : ℕ} (hd : 3 ≤ d) : 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos (Real.pi / 4) < Real.sqrt (2 * (d : ℝ) - 1) ∧ 2 * Real.sqrt ((d : ℝ) - 1) - (2 * Real.sqrt ((d : ℝ) - 1) - 1) / 3 ≤ Real.sqrt (2 * (d : ℝ) - 1) ∧ (d ≠ 5 → 2 * Real.sqrt ((d : ℝ) - 1) - (2 * Real.sqrt ((d : ℝ) - 1) - 1) / 3 < Real.sqrt (2 * (d : ℝ) - 1)) := by have hd_r : (3 : ℝ) ≤ d := by exact_mod_cast hd have hs_nn : 0 ≤ Real.sqrt ((d : ℝ) - 1) := Real.sqrt_nonneg _ have hs_sq : (Real.sqrt ((d : ℝ) - 1)) ^ 2 = (d : ℝ) - 1 := Real.sq_sqrt (by linarith) have hR_nn : 0 ≤ Real.sqrt (2 * (d : ℝ) - 1) := Real.sqrt_nonneg _ have hR_sq : (Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 = 2 * (d : ℝ) - 1 := Real.sq_sqrt (by linarith) refine ⟨?_, ?_, ?_⟩ · rw [Real.cos_pi_div_four] have h1 : 2 * Real.sqrt ((d : ℝ) - 1) * (Real.sqrt 2 / 2) = Real.sqrt (2 * ((d : ℝ) - 1)) := by have : 2 * Real.sqrt ((d : ℝ) - 1) * (Real.sqrt 2 / 2) = Real.sqrt 2 * Real.sqrt ((d : ℝ) - 1) := by ring rw [this, ← Real.sqrt_mul zero_le_two] rw [h1] exact Real.sqrt_lt_sqrt (by linarith) (by linarith) · have hstep : 4 * Real.sqrt ((d : ℝ) - 1) ≤ (d : ℝ) + 3 := by have hsq : (4 * Real.sqrt ((d : ℝ) - 1)) ^ 2 ≤ ((d : ℝ) + 3) ^ 2 := by have : (4 * Real.sqrt ((d : ℝ) - 1)) ^ 2 = 16 * (Real.sqrt ((d : ℝ) - 1)) ^ 2 := by ring rw [this, hs_sq]; nlinarith [sq_nonneg ((d : ℝ) - 5)] nlinarith have hsq2 : (4 * Real.sqrt ((d : ℝ) - 1) + 1) ^ 2 ≤ (3 * Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 := by have : (3 * Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 = 9 * (Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 := by ring rw [this, hR_sq] nlinarith [hs_sq, hstep] nlinarith · intro hne5 have hne5_r : (d : ℝ) ≠ 5 := by exact_mod_cast hne5 have hstep : 4 * Real.sqrt ((d : ℝ) - 1) < (d : ℝ) + 3 := by have hsq : (4 * Real.sqrt ((d : ℝ) - 1)) ^ 2 < ((d : ℝ) + 3) ^ 2 := by have : (4 * Real.sqrt ((d : ℝ) - 1)) ^ 2 = 16 * (Real.sqrt ((d : ℝ) - 1)) ^ 2 := by ring rw [this, hs_sq] have hpos : 0 < ((d : ℝ) - 5) ^ 2 := sq_pos_of_ne_zero (sub_ne_zero.mpr hne5_r) nlinarith nlinarith have hsq2 : (4 * Real.sqrt ((d : ℝ) - 1) + 1) ^ 2 < (3 * Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 := by have : (3 * Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 = 9 * (Real.sqrt (2 * (d : ℝ) - 1)) ^ 2 := by ring rw [this, hR_sq] nlinarith [hs_sq, hstep] nlinarith /-! ### Section 4: Exact Tree-Ball Eigenvalue Theorem & Explicit Phase-Shift Sharpening -/ lemma exists_tree_ball_angle {d k : ℕ} (hd : 3 ≤ d) (hk : 1 ≤ k) {c : ℝ} (hc_pos : 0 < c) (hc_le : c ≤ 1) (hmargin : ((d : ℝ) - 1) * Real.sin (c * (Real.pi / ((k : ℝ) + 2 + c))) < Real.sin ((k : ℝ) * (Real.pi / ((k : ℝ) + 2 + c)))) : ∃ θ : ℝ, Real.pi / (2 * ((k : ℝ) + 2)) < θ ∧ θ < Real.pi / ((k : ℝ) + 2 + c) ∧ Real.sin ((k : ℝ) * θ) = ((d : ℝ) - 1) * Real.sin (((k : ℝ) + 2) * θ) := by have hd_r : (3 : ℝ) ≤ d := by exact_mod_cast hd have hk_r : (1 : ℝ) ≤ k := by exact_mod_cast hk set θ_lo : ℝ := Real.pi / (2 * ((k : ℝ) + 2)) set θ_hi : ℝ := Real.pi / ((k : ℝ) + 2 + c) have hlo_lt_hi : θ_lo < θ_hi := div_lt_div_of_pos_left Real.pi_pos (by linarith) (by linarith) set g : ℝ → ℝ := fun θ => Real.sin ((k : ℝ) * θ) - ((d : ℝ) - 1) * Real.sin (((k : ℝ) + 2) * θ) have hcont : ContinuousOn g (Set.Icc θ_lo θ_hi) := (by fun_prop : Continuous g).continuousOn have hg_lo : g θ_lo < 0 := by have hmul : ((k : ℝ) + 2) * θ_lo = Real.pi / 2 := by simp only [θ_lo]; field_simp [ne_of_gt (by linarith : (0 : ℝ) < (k : ℝ) + 2)] simp only [g, hmul, Real.sin_pi_div_two, mul_one] linarith [Real.sin_le_one ((k : ℝ) * θ_lo)] have hg_hi : 0 < g θ_hi := by have hmul : ((k : ℝ) + 2) * θ_hi = Real.pi - c * θ_hi := by simp only [θ_hi]; field_simp [ne_of_gt (by linarith : (0 : ℝ) < (k : ℝ) + 2 + c)]; ring simp only [g, hmul, Real.sin_pi_sub] linarith obtain ⟨θ, ⟨hθ_ge, hθ_le⟩, hgθ⟩ := intermediate_value_Icc (le_of_lt hlo_lt_hi) hcont ⟨le_of_lt hg_lo, le_of_lt hg_hi⟩ have hθ_gt : θ_lo < θ := lt_of_le_of_ne hθ_ge (fun heq => by rw [← heq] at hgθ; linarith) have hθ_lt : θ < θ_hi := lt_of_le_of_ne hθ_le (fun heq => by rw [heq] at hgθ; linarith) exact ⟨θ, hθ_gt, hθ_lt, sub_eq_zero.mp hgθ⟩ lemma jordan_phase_shift_margin {d k : ℕ} (hd : 3 ≤ d) {c : ℝ} (hc_pos : 0 < c) (hc_bound : ((d : ℝ) - 1) * c < 2 / Real.pi * min (k : ℝ) (2 + c)) (hk : 1 ≤ k) : ((d : ℝ) - 1) * Real.sin (c * (Real.pi / ((k : ℝ) + 2 + c))) < Real.sin ((k : ℝ) * (Real.pi / ((k : ℝ) + 2 + c))) := by have hd_r : (3 : ℝ) ≤ d := by exact_mod_cast hd have hk_r : (1 : ℝ) ≤ k := by exact_mod_cast hk set θ : ℝ := Real.pi / ((k : ℝ) + 2 + c) have hθ_pos : 0 < θ := div_pos Real.pi_pos (by linarith) have hsin_upper : Real.sin (c * θ) ≤ c * θ := le_of_lt (Real.sin_lt (mul_pos hc_pos hθ_pos)) have hsin_lower : 2 / Real.pi * min (k : ℝ) (2 + c) * θ ≤ Real.sin ((k : ℝ) * θ) := by have hcomp : Real.pi - (k : ℝ) * θ = (2 + c) * θ := by simp only [θ]; field_simp [ne_of_gt (by linarith : (0 : ℝ) < (k : ℝ) + 2 + c)]; ring by_cases hle : (k : ℝ) ≤ 2 + c · rw [min_eq_left hle] have hkθ_le : (k : ℝ) * θ ≤ Real.pi / 2 := by have : 2 * ((k : ℝ) * θ) ≤ (k : ℝ) * θ + (2 + c) * θ := by nlinarith linarith linarith [Real.mul_le_sin (by positivity) hkθ_le] · push Not at hle rw [min_eq_right (le_of_lt hle)] have h2θ_le : (2 + c) * θ ≤ Real.pi / 2 := by have : 2 * ((2 + c) * θ) ≤ (k : ℝ) * θ + (2 + c) * θ := by nlinarith linarith rw [show Real.sin ((k : ℝ) * θ) = Real.sin ((2 + c) * θ) by rw [← hcomp, Real.sin_pi_sub]] linarith [Real.mul_le_sin (by positivity) h2θ_le] have hstep1 := mul_le_mul_of_nonneg_left hsin_upper (by linarith : (0 : ℝ) ≤ (d : ℝ) - 1) have hstep2 := mul_lt_mul_of_pos_right hc_bound hθ_pos linarith /-- Explicit tree-ball eigenvector shell sequence. -/ private noncomputable def treeSeq (d k : ℕ) (θ : ℝ) (i : ℕ) : ℝ := if i = 0 then ((d : ℝ) / (2 * Real.sqrt ((d : ℝ) - 1) * Real.cos θ)) * Real.sin ((k : ℝ) * θ) else if i ≤ k then ((Real.sqrt ((d : ℝ) - 1)) ^ (i - 1))⁻¹ * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) else 0 private lemma treeSeq_zero (d k : ℕ) (θ : ℝ) : treeSeq d k θ 0 = ((d : ℝ) / (2 * Real.sqrt ((d : ℝ) - 1) * Real.cos θ)) * Real.sin ((k : ℝ) * θ) := by simp [treeSeq] private lemma treeSeq_pos_le {d k i : ℕ} (θ : ℝ) (hi0 : i ≠ 0) (hik : i ≤ k) : treeSeq d k θ i = ((Real.sqrt ((d : ℝ) - 1)) ^ (i - 1))⁻¹ * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) := by simp [treeSeq, hi0, hik] private lemma treeSeq_gt {d k i : ℕ} (θ : ℝ) (hi : k < i) : treeSeq d k θ i = 0 := by have hi0 : i ≠ 0 := by omega have hnot : ¬ i ≤ k := by omega simp [treeSeq, hi0, hnot] /-- Properties of the tree-ball eigenvector sequence at an exact root $\theta$ of $\sin(k\theta) = (d - 1)\sin((k + 2)\theta)$: positivity, recurrence, and strict monotonicity. -/ private lemma treeSeq_properties {d k : ℕ} (hd : 3 ≤ d) (hk : 1 ≤ k) {θ : ℝ} (hθ_pos : 0 < θ) (hθ_lt : θ < Real.pi / ((k : ℝ) + 2)) (hroot : Real.sin ((k : ℝ) * θ) = ((d : ℝ) - 1) * Real.sin (((k : ℝ) + 2) * θ)) : let L : ℝ := 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos θ L < (d : ℝ) ∧ 0 < treeSeq d k θ 0 ∧ (∀ i ≤ k + 1, 0 ≤ treeSeq d k θ i) ∧ (∀ i ≤ k, treeSeq d k θ (i + 1) ≤ treeSeq d k θ i) ∧ treeSeq d k θ (k + 1) = 0 ∧ L * treeSeq d k θ 0 ≤ (d : ℝ) * treeSeq d k θ 1 ∧ (∀ i, 1 ≤ i → i ≤ k → L * treeSeq d k θ i ≤ treeSeq d k θ (i - 1) + ((d : ℝ) - 1) * treeSeq d k θ (i + 1)) := by have hd_r : (3 : ℝ) ≤ d := by exact_mod_cast hd have hk_r : (1 : ℝ) ≤ k := by exact_mod_cast hk set s : ℝ := Real.sqrt ((d : ℝ) - 1) have hs_pos : 0 < s := Real.sqrt_pos.mpr (by linarith) have hs_sq : s ^ 2 = (d : ℝ) - 1 := Real.sq_sqrt (by linarith) have hθ_lt_pi2 : θ < Real.pi / 2 := lt_trans hθ_lt (div_lt_div_of_pos_left Real.pi_pos zero_lt_two (by linarith)) have hcos_pos : 0 < Real.cos θ := Real.cos_pos_of_mem_Ioo ⟨by linarith, hθ_lt_pi2⟩ set L : ℝ := 2 * s * Real.cos θ have hL_pos : 0 < L := mul_pos (mul_pos zero_lt_two hs_pos) hcos_pos have hL_lt_d : L < (d : ℝ) := by have h2s_lt_d : 2 * s < (d : ℝ) := by have hsq : (2 * s) ^ 2 < (d : ℝ) ^ 2 := by rw [show (2 * s) ^ 2 = 4 * s ^ 2 by ring, hs_sq]; nlinarith nlinarith nlinarith [Real.cos_le_one θ] have hk2_θ_lt : ((k : ℝ) + 2) * θ < Real.pi := by have := mul_lt_mul_of_pos_left hθ_lt (by linarith : (0 : ℝ) < (k : ℝ) + 2) rwa [mul_div_cancel₀ _ (ne_of_gt (by linarith : (0 : ℝ) < (k : ℝ) + 2))] at this have hsin_pos : ∀ i, 1 ≤ i → i ≤ k → 0 < Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) := by intro i hi1 hik apply Real.sin_pos_of_pos_of_lt_pi · exact mul_pos (by exact_mod_cast (show 0 < k + 1 - i by omega)) hθ_pos · have hle : ((k + 1 - i : ℕ) : ℝ) ≤ (k : ℝ) + 2 := by exact_mod_cast (show k + 1 - i ≤ k + 2 by omega) linarith [mul_le_mul_of_nonneg_right hle (le_of_lt hθ_pos)] have ha1_eq : treeSeq d k θ 1 = Real.sin ((k : ℝ) * θ) := by rw [treeSeq_pos_le θ one_ne_zero hk, show k + 1 - 1 = k by omega]; simp have ha0_eq : treeSeq d k θ 0 = ((d : ℝ) / L) * treeSeq d k θ 1 := by rw [treeSeq_zero, ha1_eq] have ha1_pos : 0 < treeSeq d k θ 1 := by rw [ha1_eq]; simpa [show k + 1 - 1 = k by omega] using hsin_pos 1 (le_refl 1) hk have ha0_pos : 0 < treeSeq d k θ 0 := by rw [ha0_eq]; exact mul_pos (div_pos (by linarith) hL_pos) ha1_pos have ha_nn : ∀ i ≤ k + 1, 0 ≤ treeSeq d k θ i := by intro i hi by_cases hi0 : i = 0 · subst hi0; exact le_of_lt ha0_pos · by_cases hik : i ≤ k · rw [treeSeq_pos_le θ hi0 hik] exact mul_nonneg (inv_nonneg.mpr (pow_nonneg (le_of_lt hs_pos) _)) (le_of_lt (hsin_pos i (by omega) hik)) · rw [treeSeq_gt θ (by omega)] have htrig_id : ∀ m : ℝ, Real.sin ((m + 1) * θ) + Real.sin ((m - 1) * θ) = 2 * Real.cos θ * Real.sin (m * θ) := fun m => by rw [show (m + 1) * θ = m * θ + θ by ring, show (m - 1) * θ = m * θ - θ by ring, Real.sin_add, Real.sin_sub]; ring have hroot_alt : (d : ℝ) * Real.sin ((k : ℝ) * θ) = 2 * ((d : ℝ) - 1) * Real.cos θ * Real.sin (((k : ℝ) + 1) * θ) := by have hadd := htrig_id ((k : ℝ) + 1) rw [show ((k : ℝ) + 1 + 1) * θ = ((k : ℝ) + 2) * θ by ring, show ((k : ℝ) + 1 - 1) * θ = (k : ℝ) * θ by ring] at hadd nlinarith [hroot, hadd] have hsub1 : L * treeSeq d k θ 1 = treeSeq d k θ 0 + ((d : ℝ) - 1) * treeSeq d k θ 2 := by rw [ha0_eq, ha1_eq] have ha0_simp : ((d : ℝ) / L) * Real.sin ((k : ℝ) * θ) = s * Real.sin (((k : ℝ) + 1) * θ) := by rw [div_mul_eq_mul_div, div_eq_iff (ne_of_gt hL_pos)] have : s * Real.sin (((k : ℝ) + 1) * θ) * L = 2 * s ^ 2 * Real.cos θ * Real.sin (((k : ℝ) + 1) * θ) := by simp only [L]; ring rw [this, hs_sq]; exact hroot_alt rw [ha0_simp] by_cases hk2 : 2 ≤ k · have ha2 : treeSeq d k θ 2 = s⁻¹ * Real.sin (((k : ℝ) - 1) * θ) := by rw [treeSeq_pos_le θ (by decide) hk2] have hcast : ((k + 1 - 2 : ℕ) : ℝ) = (k : ℝ) - 1 := by rw [show k + 1 - 2 = k - 1 by omega, Nat.cast_sub (by omega), Nat.cast_one] rw [hcast, show (2 : ℕ) - 1 = 1 by rfl, pow_one] rw [ha2] have hmul : ((d : ℝ) - 1) * (s⁻¹ * Real.sin (((k : ℝ) - 1) * θ)) = s * Real.sin (((k : ℝ) - 1) * θ) := by rw [← hs_sq]; field_simp [ne_of_gt hs_pos] rw [hmul, ← mul_add, htrig_id (k : ℝ)] simp only [L]; ring · have hk1 : k = 1 := by omega subst hk1 rw [treeSeq_gt θ (by omega), mul_zero, add_zero, Nat.cast_one, one_mul, show ((1 : ℝ) + 1) * θ = 2 * θ by ring, Real.sin_two_mul] simp only [L]; ring have hsub_all : ∀ i, 1 ≤ i → i ≤ k → L * treeSeq d k θ i ≤ treeSeq d k θ (i - 1) + ((d : ℝ) - 1) * treeSeq d k θ (i + 1) := by intro i hi1 hik by_cases hi : i = 1 · subst hi; exact le_of_eq hsub1 · have ha_i : treeSeq d k θ i = (s ^ (i - 1))⁻¹ * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) := treeSeq_pos_le θ (by omega) hik have ha_im1 : treeSeq d k θ (i - 1) = (s ^ (i - 2))⁻¹ * Real.sin ((((k + 1 - i : ℕ) : ℝ) + 1) * θ) := by rw [treeSeq_pos_le θ (by omega) (by omega)] have h3 : ((k + 1 - (i - 1) : ℕ) : ℝ) = ((k + 1 - i : ℕ) : ℝ) + 1 := by rw [show k + 1 - (i - 1) = (k + 1 - i) + 1 by omega]; push_cast; ring rw [show i - 1 - 1 = i - 2 by omega, h3] have ha_ip1 : treeSeq d k θ (i + 1) = (s ^ i)⁻¹ * Real.sin ((((k + 1 - i : ℕ) : ℝ) - 1) * θ) := by by_cases hik1 : i + 1 ≤ k · rw [treeSeq_pos_le θ (by omega) hik1] have h3 : ((k + 1 - (i + 1) : ℕ) : ℝ) = ((k + 1 - i : ℕ) : ℝ) - 1 := by rw [show k + 1 - (i + 1) = (k + 1 - i) - 1 by omega, Nat.cast_sub (by omega), Nat.cast_one] rw [show i + 1 - 1 = i by omega, h3] · have hik_eq : i = k := by omega rw [hik_eq, treeSeq_gt θ (by omega)] have h0 : ((k + 1 - k : ℕ) : ℝ) - 1 = 0 := by rw [show k + 1 - k = 1 by omega]; simp rw [h0, zero_mul, Real.sin_zero, mul_zero] rw [ha_i, ha_im1, ha_ip1] have hpow1 : (s ^ (i - 2))⁻¹ = s * (s ^ (i - 1))⁻¹ := by have h1 : i - 1 = (i - 2) + 1 := by omega rw [h1, pow_succ]; field_simp [ne_of_gt hs_pos] have hpow2 : ((d : ℝ) - 1) * (s ^ i)⁻¹ = s * (s ^ (i - 1))⁻¹ := by have h1 : s ^ i = s ^ (i - 1) * s := by conv_lhs => rw [show i = (i - 1) + 1 by omega] exact pow_succ s (i - 1) rw [h1, ← hs_sq]; field_simp [ne_of_gt hs_pos] rw [hpow1, ← mul_assoc ((d : ℝ) - 1), hpow2] have htr := htrig_id ((k + 1 - i : ℕ) : ℝ) exact le_of_eq (by calc L * ((s ^ (i - 1))⁻¹ * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ)) = s * (s ^ (i - 1))⁻¹ * (2 * Real.cos θ * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ)) := by simp only [L]; ring _ = s * (s ^ (i - 1))⁻¹ * (Real.sin ((((k + 1 - i : ℕ) : ℝ) + 1) * θ) + Real.sin ((((k + 1 - i : ℕ) : ℝ) - 1) * θ)) := by rw [← htr] _ = s * (s ^ (i - 1))⁻¹ * Real.sin ((((k + 1 - i : ℕ) : ℝ) + 1) * θ) + s * (s ^ (i - 1))⁻¹ * Real.sin ((((k + 1 - i : ℕ) : ℝ) - 1) * θ) := by ring) have ha_dec : ∀ i ≤ k, treeSeq d k θ (i + 1) ≤ treeSeq d k θ i := by intro i hi by_cases hi0 : i = 0 · subst hi0; rw [ha0_eq] have h1 : 1 ≤ (d : ℝ) / L := (one_le_div hL_pos).mpr (le_of_lt hL_lt_d) nlinarith · by_cases hik : i = k · rw [hik, treeSeq_gt θ (by omega)]; exact ha_nn k (by omega) · have hk2 : 2 ≤ k := by omega have ha2_lt_a1 : treeSeq d k θ 2 < treeSeq d k θ 1 := by have h1 : ((d : ℝ) - 1) * treeSeq d k θ 2 = ((L ^ 2 - (d : ℝ)) / L) * treeSeq d k θ 1 := by have h0 := hsub1; rw [ha0_eq] at h0 have hL_ne : L ≠ 0 := ne_of_gt hL_pos have hmul := congr_arg (· * L) h0 have hrew : ((d : ℝ) / L * treeSeq d k θ 1 + ((d : ℝ) - 1) * treeSeq d k θ 2) * L = (d : ℝ) * treeSeq d k θ 1 + ((d : ℝ) - 1) * treeSeq d k θ 2 * L := by rw [add_mul, mul_right_comm, div_mul_cancel₀ _ hL_ne] rw [hrew] at hmul rw [div_mul_eq_mul_div, eq_div_iff hL_ne] nlinarith have h2 : (L ^ 2 - (d : ℝ)) / L < (d : ℝ) - 1 := by rw [div_lt_iff₀ hL_pos]; nlinarith [hL_pos, hL_lt_d] have h3 : ((d : ℝ) - 1) * treeSeq d k θ 2 < ((d : ℝ) - 1) * treeSeq d k θ 1 := by rw [h1]; exact mul_lt_mul_of_pos_right h2 ha1_pos nlinarith have hA_pos : 0 < Real.sin (((k - i : ℕ) : ℝ) * θ) := by have h1 := hsin_pos (i + 1) (by omega) (by omega) rwa [show k + 1 - (i + 1) = k - i by omega] at h1 have hB_pos : 0 < Real.sin (((k - 1 : ℕ) : ℝ) * θ) := by have h1 := hsin_pos 2 (by omega) hk2 rwa [show k + 1 - 2 = k - 1 by omega] at h1 have hBA_nn : 0 ≤ Real.sin (((i - 1 : ℕ) : ℝ) * θ) := by apply Real.sin_nonneg_of_nonneg_of_le_pi (mul_nonneg (Nat.cast_nonneg _) (le_of_lt hθ_pos)) have hle : ((i - 1 : ℕ) : ℝ) ≤ (k : ℝ) + 2 := by exact_mod_cast (show i - 1 ≤ k + 2 by omega) linarith [mul_le_mul_of_nonneg_right hle (le_of_lt hθ_pos)] have hsin_θ_pos : 0 < Real.sin θ := Real.sin_pos_of_pos_of_lt_pi hθ_pos (by linarith [Real.pi_pos]) have hcross : Real.sin (((k - i : ℕ) : ℝ) * θ) * Real.sin ((k : ℝ) * θ) ≤ Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) * Real.sin (((k - 1 : ℕ) : ℝ) * θ) := by set A : ℝ := ((k - i : ℕ) : ℝ) * θ set B : ℝ := ((k - 1 : ℕ) : ℝ) * θ have hA1 : ((k + 1 - i : ℕ) : ℝ) * θ = A + θ := by rw [show k + 1 - i = (k - i) + 1 by omega]; push_cast; ring have hB1 : (k : ℝ) * θ = B + θ := by conv_lhs => rw [show k = (k - 1) + 1 by omega] push_cast; ring have hBA : ((i - 1 : ℕ) : ℝ) * θ = B - A := by have hcast : ((k - 1 : ℕ) : ℝ) = ((k - i : ℕ) : ℝ) + ((i - 1 : ℕ) : ℝ) := by exact_mod_cast (show k - 1 = (k - i) + (i - 1) by omega) simp only [A, B, hcast]; ring rw [hA1, hB1] have hid : Real.sin (A + θ) * Real.sin B - Real.sin A * Real.sin (B + θ) = Real.sin (B - A) * Real.sin θ := by rw [Real.sin_add, Real.sin_add, Real.sin_sub]; ring rw [← hBA] at hid have hprod_nn : 0 ≤ Real.sin (((i - 1 : ℕ) : ℝ) * θ) * Real.sin θ := mul_nonneg hBA_nn (le_of_lt hsin_θ_pos) linarith have hbase : Real.sin (((k - 1 : ℕ) : ℝ) * θ) < s * Real.sin ((k : ℝ) * θ) := by have ha2_eq : treeSeq d k θ 2 = s⁻¹ * Real.sin (((k - 1 : ℕ) : ℝ) * θ) := by rw [treeSeq_pos_le θ (by decide) hk2, show k + 1 - 2 = k - 1 by omega, show (2 : ℕ) - 1 = 1 by rfl, pow_one] rw [ha2_eq, ha1_eq] at ha2_lt_a1 have := mul_lt_mul_of_pos_left ha2_lt_a1 hs_pos rwa [← mul_assoc, mul_inv_cancel₀ (ne_of_gt hs_pos), one_mul] at this have hstep_ratio : Real.sin (((k - i : ℕ) : ℝ) * θ) ≤ s * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) := by have h1 : Real.sin (((k - i : ℕ) : ℝ) * θ) * Real.sin ((k : ℝ) * θ) ≤ (s * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ)) * Real.sin ((k : ℝ) * θ) := calc Real.sin (((k - i : ℕ) : ℝ) * θ) * Real.sin ((k : ℝ) * θ) ≤ Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) * Real.sin (((k - 1 : ℕ) : ℝ) * θ) := hcross _ ≤ Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) * (s * Real.sin ((k : ℝ) * θ)) := mul_le_mul_of_nonneg_left (le_of_lt hbase) (le_of_lt (hsin_pos i (by omega) hi)) _ = (s * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ)) * Real.sin ((k : ℝ) * θ) := by ring exact le_of_mul_le_mul_right h1 (by rwa [← ha1_eq]) have ha_i : treeSeq d k θ i = (s ^ (i - 1))⁻¹ * Real.sin (((k + 1 - i : ℕ) : ℝ) * θ) := treeSeq_pos_le θ hi0 hi have ha_ip1 : treeSeq d k θ (i + 1) = (s ^ i)⁻¹ * Real.sin (((k - i : ℕ) : ℝ) * θ) := by rw [treeSeq_pos_le θ (by omega) (by omega), show i + 1 - 1 = i by omega, show k + 1 - (i + 1) = k - i by omega] rw [ha_i, ha_ip1] have hpow : (s ^ (i - 1))⁻¹ = s * (s ^ i)⁻¹ := by have h1 : s ^ i = s ^ (i - 1) * s := by conv_lhs => rw [show i = (i - 1) + 1 by omega] exact pow_succ s (i - 1) rw [h1]; field_simp [ne_of_gt hs_pos] rw [hpow, mul_comm s ((s ^ i)⁻¹), mul_assoc] exact mul_le_mul_of_nonneg_left hstep_ratio (inv_nonneg.mpr (pow_nonneg (le_of_lt hs_pos) i)) refine ⟨hL_lt_d, ha0_pos, ha_nn, ha_dec, treeSeq_gt θ (by omega), ?_, hsub_all⟩ rw [ha0_eq] exact le_of_eq (by field_simp [ne_of_gt hL_pos]) /-- **Headline Theorem 2A (Exact Tree-Ball Finite-Diameter Alon–Boppana Theorem).** -/ theorem alon_boppana_exact_tree_ball {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d k : ℕ} (hd : 3 ≤ d) (hk : 1 ≤ k) (hreg : G.IsRegularOfDegree d) {u v : V} (hfar : G.Reachable u v → 2 * k + 2 ≤ G.dist u v) {θ : ℝ} (hθ_pos : 0 < θ) (hθ_lt : θ < Real.pi / ((k : ℝ) + 2)) (hroot : Real.sin ((k : ℝ) * θ) = ((d : ℝ) - 1) * Real.sin (((k : ℝ) + 2) * θ)) : let hA := adjMatrix_isHermitian G ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos θ ≤ hA.eigenvalues j₁ ∧ 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos θ ≤ hA.eigenvalues j₂ := by obtain ⟨hLd, ha0, hann, hadec, haend, hsub0, hsub⟩ := treeSeq_properties hd hk hθ_pos hθ_lt hroot exact alon_boppana_from_sequence G hreg hfar (treeSeq d k θ) _ (le_of_lt hLd) ha0 hann hadec haend hsub0 hsub /-- **Headline Theorem 2B (Closed-Form Explicit Phase-Shift Alon–Boppana Bound — Strictly Sharper than Friedman's $2\sqrt{d-1}\cos(\frac{\pi}{k+2})$ for ALL $d \ge 3, k \ge 1$).** -/ theorem alon_boppana_explicit_phase_shift {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d k : ℕ} (hd : 3 ≤ d) (hk : 1 ≤ k) (hreg : G.IsRegularOfDegree d) {u v : V} (hfar : G.Reachable u v → 2 * k + 2 ≤ G.dist u v) : let hA := adjMatrix_isHermitian G let L_sharp := 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos (Real.pi / ((k : ℝ) + 2 + 1 / (2 * ((d : ℝ) - 1)))) 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos (Real.pi / ((k : ℝ) + 2)) < L_sharp ∧ ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ L_sharp ≤ hA.eigenvalues j₁ ∧ L_sharp ≤ hA.eigenvalues j₂ := by have hd_r : (3 : ℝ) ≤ d := by exact_mod_cast hd have hk_r : (1 : ℝ) ≤ k := by exact_mod_cast hk set c : ℝ := 1 / (2 * ((d : ℝ) - 1)) have hc_pos : 0 < c := div_pos one_pos (by linarith) have hc_le1 : c ≤ 1 := by simp only [c]; rw [div_le_one (by linarith)]; linarith have hc_bound : ((d : ℝ) - 1) * c < 2 / Real.pi * min (k : ℝ) (2 + c) := by have hlhs : ((d : ℝ) - 1) * c = 1 / 2 := by simp only [c]; field_simp [ne_of_gt (by linarith : (0 : ℝ) < (d : ℝ) - 1)] have hmin : (1 : ℝ) ≤ min (k : ℝ) (2 + c) := le_min hk_r (by linarith) have h2pi : (1 : ℝ) / 2 < 2 / Real.pi := by rw [div_lt_div_iff₀ zero_lt_two Real.pi_pos]; linarith [Real.pi_lt_four] linarith [mul_le_mul_of_nonneg_left hmin (div_nonneg zero_le_two (le_of_lt Real.pi_pos))] have hmargin := jordan_phase_shift_margin hd hc_pos hc_bound hk obtain ⟨θ, hθ_lo, hθ_hi, hroot⟩ := exists_tree_ball_angle hd hk hc_pos hc_le1 hmargin have hθ_pos : 0 < θ := lt_trans (div_pos Real.pi_pos (by linarith)) hθ_lo have hhi_lt_fried : Real.pi / ((k : ℝ) + 2 + c) < Real.pi / ((k : ℝ) + 2) := div_lt_div_of_pos_left Real.pi_pos (by linarith) (by linarith) have hfried_le_pi : Real.pi / ((k : ℝ) + 2) ≤ Real.pi := div_le_self (le_of_lt Real.pi_pos) (by linarith) have hcos_gt_fried : Real.cos (Real.pi / ((k : ℝ) + 2)) < Real.cos (Real.pi / ((k : ℝ) + 2 + c)) := Real.strictAntiOn_cos ⟨div_nonneg (le_of_lt Real.pi_pos) (by linarith), le_trans (le_of_lt hhi_lt_fried) hfried_le_pi⟩ ⟨div_nonneg (le_of_lt Real.pi_pos) (by linarith), hfried_le_pi⟩ hhi_lt_fried have hcos_gt_hi : Real.cos (Real.pi / ((k : ℝ) + 2 + c)) < Real.cos θ := Real.strictAntiOn_cos ⟨le_of_lt hθ_pos, le_trans (le_of_lt (lt_trans hθ_hi hhi_lt_fried)) hfried_le_pi⟩ ⟨div_nonneg (le_of_lt Real.pi_pos) (by linarith), le_trans (le_of_lt hhi_lt_fried) hfried_le_pi⟩ hθ_hi have hs_pos : 0 < 2 * Real.sqrt ((d : ℝ) - 1) := mul_pos zero_lt_two (Real.sqrt_pos.mpr (by linarith)) obtain ⟨j₁, j₂, hne, hj₁, hj₂⟩ := alon_boppana_exact_tree_ball G hd hk hreg hfar hθ_pos (lt_trans hθ_hi hhi_lt_fried) hroot refine ⟨mul_lt_mul_of_pos_left hcos_gt_fried hs_pos, j₁, j₂, hne, le_trans (le_of_lt (mul_lt_mul_of_pos_left hcos_gt_hi hs_pos)) hj₁, le_trans (le_of_lt (mul_lt_mul_of_pos_left hcos_gt_hi hs_pos)) hj₂⟩ /-- **Headline Theorem 2C (Sharper $k \ge 2$ Explicit Phase Shift $c = \frac{1}{d - 1}$).** -/ theorem alon_boppana_explicit_phase_shift_k2 {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d k : ℕ} (hd : 3 ≤ d) (hk : 2 ≤ k) (hreg : G.IsRegularOfDegree d) {u v : V} (hfar : G.Reachable u v → 2 * k + 2 ≤ G.dist u v) : let hA := adjMatrix_isHermitian G let L_sharp := 2 * Real.sqrt ((d : ℝ) - 1) * Real.cos (Real.pi / ((k : ℝ) + 2 + 1 / ((d : ℝ) - 1))) ∃ j₁ j₂ : V, j₁ ≠ j₂ ∧ L_sharp ≤ hA.eigenvalues j₁ ∧ L_sharp ≤ hA.eigenvalues j₂ := by have hd_r : (3 : ℝ) ≤ d := by exact_mod_cast hd have hk_r : (2 : ℝ) ≤ k := by exact_mod_cast hk set c : ℝ := 1 / ((d : ℝ) - 1) have hc_pos : 0 < c := div_pos one_pos (by linarith) have hc_le1 : c ≤ 1 := by simp only [c]; rw [div_le_one (by linarith)]; linarith have hc_bound : ((d : ℝ) - 1) * c < 2 / Real.pi * min (k : ℝ) (2 + c) := by have hlhs : ((d : ℝ) - 1) * c = 1 := by simp only [c]; field_simp [ne_of_gt (by linarith : (0 : ℝ) < (d : ℝ) - 1)] have hmin : (2 : ℝ) ≤ min (k : ℝ) (2 + c) := le_min hk_r (by linarith) have h4pi : (1 : ℝ) < 2 / Real.pi * 2 := by rw [show 2 / Real.pi * 2 = 4 / Real.pi by ring, one_lt_div Real.pi_pos]; exact Real.pi_lt_four linarith [mul_le_mul_of_nonneg_left hmin (div_nonneg zero_le_two (le_of_lt Real.pi_pos))] have hmargin := jordan_phase_shift_margin hd hc_pos hc_bound (by omega) obtain ⟨θ, hθ_lo, hθ_hi, hroot⟩ := exists_tree_ball_angle hd (by omega) hc_pos hc_le1 hmargin have hθ_pos : 0 < θ := lt_trans (div_pos Real.pi_pos (by linarith)) hθ_lo have hhi_lt_fried : Real.pi / ((k : ℝ) + 2 + c) < Real.pi / ((k : ℝ) + 2) := div_lt_div_of_pos_left Real.pi_pos (by linarith) (by linarith) have hfried_le_pi : Real.pi / ((k : ℝ) + 2) ≤ Real.pi := div_le_self (le_of_lt Real.pi_pos) (by linarith) have hcos_gt_hi : Real.cos (Real.pi / ((k : ℝ) + 2 + c)) < Real.cos θ := Real.strictAntiOn_cos ⟨le_of_lt hθ_pos, le_trans (le_of_lt (lt_trans hθ_hi hhi_lt_fried)) hfried_le_pi⟩ ⟨div_nonneg (le_of_lt Real.pi_pos) (by linarith), le_trans (le_of_lt hhi_lt_fried) hfried_le_pi⟩ hθ_hi have hs_pos : 0 < 2 * Real.sqrt ((d : ℝ) - 1) := mul_pos zero_lt_two (Real.sqrt_pos.mpr (by linarith)) obtain ⟨j₁, j₂, hne, hj₁, hj₂⟩ := alon_boppana_exact_tree_ball G hd (by omega) hreg hfar hθ_pos (lt_trans hθ_hi hhi_lt_fried) hroot exact ⟨j₁, j₂, hne, le_trans (le_of_lt (mul_lt_mul_of_pos_left hcos_gt_hi hs_pos)) hj₁, le_trans (le_of_lt (mul_lt_mul_of_pos_left hcos_gt_hi hs_pos)) hj₂⟩ /-! ### Section 5: Girth-Driven Lower-Spectrum Bound & Bipartite Spectral Symmetry -/ /-- **Girth-Driven Lower-Spectrum Alon–Boppana Bound.** -/ theorem alon_boppana_girth_lambda_min {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d) (u : V) (k : ℕ) (hno_same_shell : ∀ x ∈ distBall G u k, ∀ y ∈ distBall G u k, G.Adj x y → G.dist u x ≠ G.dist u y) (a : ℕ → ℝ) (L : ℝ) (ha0_pos : 0 < a 0) (ha_nn : ∀ i ≤ k + 1, 0 ≤ a i) (ha_dec : ∀ i ≤ k, a (i + 1) ≤ a i) (ha_end : a (k + 1) = 0) (hsub0 : L * a 0 ≤ (d : ℝ) * a 1) (hsub : ∀ i, 1 ≤ i → i ≤ k → L * a i ≤ a (i - 1) + ((d : ℝ) - 1) * a (i + 1)) : let hA := adjMatrix_isHermitian G ∃ j : V, hA.eigenvalues j ≤ -L := by intro hA set f := radialFunc G u k a set g : V → ℝ := fun x => (-1 : ℝ) ^ (G.dist u x) * f x have hnorm_eq : normSq g = normSq f := by simp only [normSq, g] refine Finset.sum_congr rfl fun x _ => ?_ have hsq : ((-1 : ℝ) ^ G.dist u x) ^ 2 = 1 := by rw [← pow_mul, mul_comm (G.dist u x) 2, pow_mul, neg_one_sq, one_pow] rw [mul_pow, hsq, one_mul] have hquad_neg : adjQuad G g = -adjQuad G f := by simp only [adjQuad, g, ← Finset.sum_neg_distrib] refine Finset.sum_congr rfl fun x _ => Finset.sum_congr rfl fun y _ => ?_ by_cases hxy : G.Adj x y · rw [if_pos hxy, if_pos hxy] by_cases hx : x ∈ distBall G u k · by_cases hy : y ∈ distBall G u k · have hne := hno_same_shell x hx y hy hxy rw [mem_distBall] at hx hy obtain ⟨_, h1, h2⟩ := dist_adj_diff_le_one G hx.1 hxy have hdiff : G.dist u y = G.dist u x + 1 ∨ G.dist u x = G.dist u y + 1 := by omega rcases hdiff with hup | hdn · rw [hup, pow_succ] have hsq : (-1 : ℝ) ^ G.dist u x * (-1 : ℝ) ^ G.dist u x = 1 := by rw [← pow_add, ← two_mul, pow_mul, neg_one_sq, one_pow] calc (-1 : ℝ) ^ G.dist u x * f x * ((-1 : ℝ) ^ G.dist u x * -1 * f y) = -(((-1 : ℝ) ^ G.dist u x * (-1 : ℝ) ^ G.dist u x) * (f x * f y)) := by ring _ = -(f x * f y) := by rw [hsq, one_mul] · rw [hdn, pow_succ] have hsq : (-1 : ℝ) ^ G.dist u y * (-1 : ℝ) ^ G.dist u y = 1 := by rw [← pow_add, ← two_mul, pow_mul, neg_one_sq, one_pow] calc (-1 : ℝ) ^ G.dist u y * -1 * f x * ((-1 : ℝ) ^ G.dist u y * f y) = -(((-1 : ℝ) ^ G.dist u y * (-1 : ℝ) ^ G.dist u y) * (f x * f y)) := by ring _ = -(f x * f y) := by rw [hsq, one_mul] · have hfy : f y = 0 := radialFunc_of_not_mem G u k a (fun h => hy ((mem_distBall G u k y).mpr h)) simp [hfy] · have hfx : f x = 0 := radialFunc_of_not_mem G u k a (fun h => hx ((mem_distBall G u k x).mpr h)) simp [hfx] · simp [hxy] have hray_f := alon_boppana_dual_certificate_ball G hreg u k a L ha_nn ha_dec ha_end hsub0 hsub have hf_ne : f ≠ 0 := by intro h0 have hu0 : f u = 0 := congr_fun h0 u have h2 : f u = a 0 := by dsimp only [f] rw [radialFunc_of_mem G u k a ⟨SimpleGraph.Reachable.refl u, by simp⟩]; simp linarith have hg_pos : 0 < normSq g := by rw [hnorm_eq]; exact normSq_pos_of_ne_zero hf_ne have hray_g : adjQuad G g ≤ (-L) * normSq g := by rw [hquad_neg, hnorm_eq]; linarith by_contra hno; push Not at hno obtain ⟨hquad_repr, hinner_repr⟩ := adjMatrix_spectral_expansion G rw [adjQuad_eq_dotProduct_mulVec, normSq_eq_dotProduct] at hray_g rw [normSq_eq_dotProduct] at hg_pos have hg2 : g ⬝ᵥ g = ∑ j : V, (g ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := by rw [hinner_repr g g]; exact Finset.sum_congr rfl fun j _ => (sq _).symm have hgt : (-L) * (g ⬝ᵥ g) < g ⬝ᵥ (G.adjMatrix ℝ).mulVec g := by have hq : g ⬝ᵥ (G.adjMatrix ℝ).mulVec g = ∑ j : V, hA.eigenvalues j * (g ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := hquad_repr g rw [hq, hg2, Finset.mul_sum] have hex : ∃ j : V, 0 < (g ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 := by by_contra hall; push Not at hall have hz : ∑ j : V, (g ⬝ᵥ (hA.eigenvectorBasis j).ofLp) ^ 2 = 0 := Finset.sum_eq_zero fun j _ => le_antisymm (hall j) (sq_nonneg _) linarith obtain ⟨j₀, hj₀⟩ := hex exact Finset.sum_lt_sum (fun j _ => mul_le_mul_of_nonneg_right (le_of_lt (hno j)) (sq_nonneg _)) ⟨j₀, Finset.mem_univ j₀, mul_lt_mul_of_pos_right (hno j₀) hj₀⟩ linarith /-- **Triangle-Free Lower-Spectrum Corollary:** Every triangle-free $d$-regular graph ($d \ge 2$) has $\lambda_{\min}(G) \le -\sqrt{d}$. -/ theorem alon_boppana_triangle_free_lambda_min {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hd : 2 ≤ d) (hreg : G.IsRegularOfDegree d) (htri : ∀ x y z : V, G.Adj x y → G.Adj y z → ¬ G.Adj x z) : let hA := adjMatrix_isHermitian G ∃ j : V, hA.eigenvalues j ≤ -Real.sqrt (d : ℝ) := by obtain ⟨u⟩ := ‹Nonempty V› have hd_r : (2 : ℝ) ≤ d := by exact_mod_cast hd have hno_same : ∀ x ∈ distBall G u 1, ∀ y ∈ distBall G u 1, G.Adj x y → G.dist u x ≠ G.dist u y := by intro x hx y hy hxy heq rw [mem_distBall] at hx hy have h01 : G.dist u x = 0 ∨ G.dist u x = 1 := by omega rcases h01 with h0 | h1 · have hxu : u = x := (SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable.mp h0).resolve_right (not_not.mpr hx.1) have hyu : u = y := (SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable.mp (heq.symm.trans h0)).resolve_right (not_not.mpr hy.1) subst hxu; subst hyu; exact G.loopless.irrefl u hxy · have hux : G.Adj u x := SimpleGraph.dist_eq_one_iff_adj.mp h1 have huy : G.Adj u y := SimpleGraph.dist_eq_one_iff_adj.mp (heq.symm.trans h1) exact htri u x y hux hxy huy set a : ℕ → ℝ := fun i => if i = 0 then Real.sqrt (d : ℝ) else if i = 1 then 1 else 0 have hsq : (Real.sqrt (d : ℝ)) ^ 2 = (d : ℝ) := Real.sq_sqrt (by linarith) have hge1 : (1 : ℝ) ≤ Real.sqrt (d : ℝ) := by rw [← Real.sqrt_one]; exact Real.sqrt_le_sqrt (by linarith) refine alon_boppana_girth_lambda_min G hreg u 1 hno_same a (Real.sqrt (d : ℝ)) (Real.sqrt_pos.mpr (by linarith)) ?_ ?_ (by simp [a]) ?_ ?_ · intro i hi; interval_cases i <;> simp [a] · intro i hi; interval_cases i · simp only [a, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte]; exact hge1 · simp [a] · simp only [a, ↓reduceIte, one_ne_zero, mul_one]; nlinarith · intro i hi1 hik have hi : i = 1 := by omega subst hi simp [a] /-- **Bipartite Spectral Symmetry Theorem.** -/ theorem bipartite_eigenvalue_neg {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (c : V → Bool) (hbip : ∀ x y : V, G.Adj x y → c x ≠ c y) {μ : ℝ} {f : V → ℝ} (hf : (G.adjMatrix ℝ).mulVec f = μ • f) : let g : V → ℝ := fun x => if c x then f x else -f x (G.adjMatrix ℝ).mulVec g = (-μ) • g := by intro g ext x have hfx := congr_fun hf x simp only [Matrix.mulVec, dotProduct, SimpleGraph.adjMatrix_apply, Pi.smul_apply, smul_eq_mul] at hfx ⊢ cases hcx : c x · have hsum : ∑ y : V, (if G.Adj x y then (1 : ℝ) else 0) * g y = ∑ y : V, (if G.Adj x y then (1 : ℝ) else 0) * f y := by refine Finset.sum_congr rfl fun y _ => ?_ split_ifs with hxy · have hcy : c y = true := by have := hbip x y hxy; rw [hcx] at this; cases h : c y <;> simp_all simp [g, hcy] · ring rw [hsum, hfx]; simp [g, hcx] · have hsum : ∑ y : V, (if G.Adj x y then (1 : ℝ) else 0) * g y = -(∑ y : V, (if G.Adj x y then (1 : ℝ) else 0) * f y) := by rw [← Finset.sum_neg_distrib] refine Finset.sum_congr rfl fun y _ => ?_ split_ifs with hxy · have hcy : c y = false := by have := hbip x y hxy; rw [hcx] at this; cases h : c y <;> simp_all simp [g, hcy] · ring rw [hsum, hfx]; simp [g, hcx] /-! ### Section 6: Exact Tightness & Ramanujan Witnesses ($C_8$, $Q_3$, $K_{d,d}$) -/ /-- The 8-cycle $C_8$ on `Fin 8` (2-regular, diameter 4). -/ def cycle8 : SimpleGraph (Fin 8) where Adj i j := (i.val + 1) % 8 = j.val ∨ (j.val + 1) % 8 = i.val symm := ⟨fun _ _ h => Or.symm h⟩ loopless := ⟨fun i h => by rcases h with h | h <;> omega⟩ instance : DecidableRel cycle8.Adj := fun i j => by unfold cycle8; infer_instance lemma cycle8_isRegular : cycle8.IsRegularOfDegree 2 := by intro i simp only [SimpleGraph.degree, cycle8] fin_cases i <;> decide /-- **Exact Tightness Witness #1 (`C_8`):** The 8-cycle $C_8$ is 2-regular, has diameter 4, and has exact second eigenvalue $\sqrt{2} = \sqrt{d}$ (explicit eigenvector $f_k = \cos(k\pi/4)$ orthogonal to $\mathbf{1}$), achieving **exact equality** in `alon_boppana_diam4_sqrt_d`! -/ theorem witness_C8_exact_tightness : cycle8.IsRegularOfDegree 2 ∧ (∃ f : Fin 8 → ℝ, f ≠ 0 ∧ (∑ i : Fin 8, f i = 0) ∧ (cycle8.adjMatrix ℝ).mulVec f = Real.sqrt 2 • f) := by refine ⟨cycle8_isRegular, ?_⟩ let s : ℝ := Real.sqrt 2 / 2 let f : Fin 8 → ℝ := ![1, s, 0, -s, -1, -s, 0, s] refine ⟨f, ?_, ?_, ?_⟩ · intro h0; have := congr_fun h0 0; simp [f] at this · simp [Fin.sum_univ_eight, f] · ext i have hs2 : Real.sqrt 2 * s = 1 := by simp only [s]; nlinarith [Real.sq_sqrt (show (0 : ℝ) ≤ 2 by norm_num)] have hs_add : s + s = Real.sqrt 2 := by simp only [s]; ring simp only [Matrix.mulVec, dotProduct, SimpleGraph.adjMatrix_apply, Pi.smul_apply, smul_eq_mul, Fin.sum_univ_eight] fin_cases i <;> simp [cycle8, f] <;> linarith [hs2, hs_add] /-- The 3-dimensional hypercube $Q_3$ on `Fin 3 → Bool` (3-regular, bipartite, diameter 3). -/ def cube3 : SimpleGraph (Fin 3 → Bool) where Adj x y := (Finset.univ.filter (fun k : Fin 3 => x k ≠ y k)).card = 1 symm := ⟨fun x y h => by have heq : Finset.univ.filter (fun k : Fin 3 => y k ≠ x k) = Finset.univ.filter (fun k : Fin 3 => x k ≠ y k) := by ext k; simp [ne_comm] rw [heq]; exact h⟩ loopless := ⟨fun x h => by simp at h⟩ instance : DecidableRel cube3.Adj := fun x y => by unfold cube3; infer_instance private lemma cube3_neighborFinset (x : Fin 3 → Bool) : cube3.neighborFinset x = Finset.image (fun i : Fin 3 => Function.update x i (!x i)) Finset.univ := by ext y rw [SimpleGraph.mem_neighborFinset] simp only [Finset.mem_image, Finset.mem_univ, true_and, cube3] constructor · intro hcard obtain ⟨i, hi⟩ := Finset.card_eq_one.mp hcard refine ⟨i, ?_⟩ ext k by_cases hk : k = i · subst hk have hmem : k ∈ Finset.univ.filter (fun j : Fin 3 => x j ≠ y j) := by rw [hi]; exact Finset.mem_singleton_self k have hne : x k ≠ y k := (Finset.mem_filter.mp hmem).2 simp only [Function.update_self] cases hx : x k <;> cases hy : y k <;> simp_all · have hnot : k ∉ Finset.univ.filter (fun j : Fin 3 => x j ≠ y j) := by rw [hi]; simp [hk] simp only [Finset.mem_filter, Finset.mem_univ, true_and, not_not] at hnot simp [Function.update_of_ne hk, hnot] · rintro ⟨i, rfl⟩ have hfilt : Finset.univ.filter (fun k : Fin 3 => x k ≠ Function.update x i (!x i) k) = {i} := by ext k simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_singleton] by_cases hk : k = i · subst hk; simp · simp [hk] rw [hfilt]; simp /-- **Ramanujan Witness #2 (`Q_3`):** The 3-cube $Q_3$ is 3-regular, bipartite, and has exact non-trivial eigenvalue $1 \le 2\sqrt{3 - 1} = 2\sqrt{2}$ (strictly Ramanujan!). -/ theorem witness_Q3_ramanujan : cube3.IsRegularOfDegree 3 ∧ (∃ c : (Fin 3 → Bool) → Bool, ∀ x y, cube3.Adj x y → c x ≠ c y) ∧ (∃ f : (Fin 3 → Bool) → ℝ, f ≠ 0 ∧ (∑ x, f x = 0) ∧ (cube3.adjMatrix ℝ).mulVec f = (1 : ℝ) • f) ∧ (1 : ℝ) ≤ 2 * Real.sqrt ((3 : ℝ) - 1) := by refine ⟨?_, ?_, ?_, ?_⟩ · intro x have hinj : Set.InjOn (fun i : Fin 3 => Function.update x i (!x i)) (Set.univ : Set (Fin 3)) := by intro i _ j _ h by_contra hne have := congr_fun h i simp [Function.update_self, Function.update_of_ne hne] at this simp only [SimpleGraph.degree, cube3_neighborFinset x] rw [Finset.card_image_of_injOn (fun i _ j _ h => hinj (Set.mem_univ i) (Set.mem_univ j) h)] simp · refine ⟨fun x => xor (x 0) (xor (x 1) (x 2)), fun x y hxy => ?_⟩ have hmem : y ∈ cube3.neighborFinset x := (SimpleGraph.mem_neighborFinset cube3 x y).mpr hxy rw [cube3_neighborFinset x, Finset.mem_image] at hmem obtain ⟨i, _, rfl⟩ := hmem fin_cases i · change xor (x 0) (xor (x 1) (x 2)) ≠ xor (Function.update x 0 (!x 0) 0) (xor (Function.update x 0 (!x 0) 1) (Function.update x 0 (!x 0) 2)) simp only [Function.update_self, Function.update_of_ne (show (1 : Fin 3) ≠ 0 by decide), Function.update_of_ne (show (2 : Fin 3) ≠ 0 by decide)] cases x 0 <;> cases x 1 <;> cases x 2 <;> decide · change xor (x 0) (xor (x 1) (x 2)) ≠ xor (Function.update x 1 (!x 1) 0) (xor (Function.update x 1 (!x 1) 1) (Function.update x 1 (!x 1) 2)) simp only [Function.update_self, Function.update_of_ne (show (0 : Fin 3) ≠ 1 by decide), Function.update_of_ne (show (2 : Fin 3) ≠ 1 by decide)] cases x 0 <;> cases x 1 <;> cases x 2 <;> decide · change xor (x 0) (xor (x 1) (x 2)) ≠ xor (Function.update x 2 (!x 2) 0) (xor (Function.update x 2 (!x 2) 1) (Function.update x 2 (!x 2) 2)) simp only [Function.update_self, Function.update_of_ne (show (0 : Fin 3) ≠ 2 by decide), Function.update_of_ne (show (1 : Fin 3) ≠ 2 by decide)] cases x 0 <;> cases x 1 <;> cases x 2 <;> decide · let f : (Fin 3 → Bool) → ℝ := fun x => if x 0 then 1 else -1 refine ⟨f, ?_, ?_, ?_⟩ · intro h0; have := congr_fun h0 (fun _ => true); simp [f] at this · have hneg : ∀ x : Fin 3 → Bool, f (Function.update x 0 (!x 0)) = -f x := by intro x; simp only [f, Function.update_self]; cases x 0 <;> simp have hsum_eq : ∑ x : Fin 3 → Bool, f (Function.update x 0 (!x 0)) = ∑ x : Fin 3 → Bool, f x := Fintype.sum_equiv (Equiv.mk (fun x => Function.update x 0 (!x 0)) (fun x => Function.update x 0 (!x 0)) (fun x => by ext k; by_cases hk : k = 0 <;> simp [hk]) (fun x => by ext k; by_cases hk : k = 0 <;> simp [hk])) _ _ (fun _ => rfl) simp_rw [hneg, Finset.sum_neg_distrib] at hsum_eq linarith · ext x simp only [Matrix.mulVec, dotProduct, SimpleGraph.adjMatrix_apply, Pi.smul_apply, smul_eq_mul, one_mul] have hsum_nb : ∑ y : Fin 3 → Bool, (if cube3.Adj x y then (1 : ℝ) else 0) * f y = ∑ y ∈ cube3.neighborFinset x, f y := by have hrew : ∀ y : Fin 3 → Bool, (if cube3.Adj x y then (1 : ℝ) else 0) * f y = if y ∈ cube3.neighborFinset x then f y else 0 := fun y => by simp [SimpleGraph.mem_neighborFinset] simp_rw [hrew, ← Finset.sum_filter, Finset.filter_mem_eq_inter, Finset.univ_inter] rw [hsum_nb, cube3_neighborFinset x] have hinj : Set.InjOn (fun i : Fin 3 => Function.update x i (!x i)) (Set.univ : Set (Fin 3)) := by intro i _ j _ h; by_contra hne have := congr_fun h i; simp [Function.update_self, Function.update_of_ne hne] at this rw [Finset.sum_image (fun i _ j _ h => hinj (Set.mem_univ i) (Set.mem_univ j) h), Fin.sum_univ_three] simp only [f, Function.update_self, Function.update_of_ne (show (0 : Fin 3) ≠ 1 by decide), Function.update_of_ne (show (0 : Fin 3) ≠ 2 by decide)] cases x 0 <;> norm_num · have h1 : (1 : ℝ) ≤ Real.sqrt 2 := by rw [← Real.sqrt_one]; exact Real.sqrt_le_sqrt (by norm_num) norm_num; linarith /-- Complete bipartite graph $K_{d, d}$ on `Bool × Fin d` ($d$-regular, bipartite, diameter 2). -/ def completeBipartite (d : ℕ) : SimpleGraph (Bool × Fin d) where Adj u v := u.1 ≠ v.1 symm := ⟨fun _ _ h => Ne.symm h⟩ loopless := ⟨fun _ h => h rfl⟩ instance (d : ℕ) : DecidableRel (completeBipartite d).Adj := fun u v => by unfold completeBipartite; infer_instance /-- **Ramanujan Witness #3 (`K_{d,d}`):** For every $d \ge 2$, $K_{d,d}$ is $d$-regular, bipartite, and every vector $f$ orthogonal to both $\mathbf{1}$ and the bipartite sign vector $\chi$ lies in $\ker(A_{K_{d,d}})$ (eigenvalue $0 \in [-2\sqrt{d-1}, 2\sqrt{d-1}]$ — optimally Ramanujan!). -/ theorem witness_Kdd_ramanujan {d : ℕ} (_hd : 2 ≤ d) : (completeBipartite d).IsRegularOfDegree d ∧ (∀ f : Bool × Fin d → ℝ, (∑ i : Fin d, f (true, i) = 0) → (∑ i : Fin d, f (false, i) = 0) → ((completeBipartite d).adjMatrix ℝ).mulVec f = 0) ∧ (0 : ℝ) ≤ 2 * Real.sqrt ((d : ℝ) - 1) := by refine ⟨?_, ?_, by positivity⟩ · intro ⟨b, i⟩ have hnb : (completeBipartite d).neighborFinset (b, i) = Finset.image (fun j : Fin d => (!b, j)) Finset.univ := by ext ⟨b', j⟩ rw [SimpleGraph.mem_neighborFinset] simp only [Finset.mem_image, Finset.mem_univ, true_and, completeBipartite, Prod.mk.injEq] cases b <;> cases b' <;> simp simp only [SimpleGraph.degree, hnb] rw [Finset.card_image_of_injOn (fun _ _ _ _ h => (Prod.mk.inj h).2)] simp · intro f ht hf ext ⟨b, i⟩ simp only [Matrix.mulVec, dotProduct, SimpleGraph.adjMatrix_apply, Pi.zero_apply, Fintype.sum_prod_type, Fintype.sum_bool] cases b · simp [completeBipartite, ht] · simp [completeBipartite, hf] end SharpAlonBoppanaDiameter /-! ### Axiom Verification for All Headline Theorems -/ #print axioms SharpAlonBoppanaDiameter.exists_two_eigenvalues_ge_of_orth_rayleigh #print axioms SharpAlonBoppanaDiameter.alon_boppana_dual_certificate_ball #print axioms SharpAlonBoppanaDiameter.alon_boppana_diam4_sqrt_d #print axioms SharpAlonBoppanaDiameter.alon_boppana_diam6_sqrt_2d_sub_1 #print axioms SharpAlonBoppanaDiameter.diam6_beats_nilli_and_friedman #print axioms SharpAlonBoppanaDiameter.alon_boppana_exact_tree_ball #print axioms SharpAlonBoppanaDiameter.alon_boppana_explicit_phase_shift #print axioms SharpAlonBoppanaDiameter.alon_boppana_explicit_phase_shift_k2 #print axioms SharpAlonBoppanaDiameter.alon_boppana_girth_lambda_min #print axioms SharpAlonBoppanaDiameter.alon_boppana_triangle_free_lambda_min #print axioms SharpAlonBoppanaDiameter.bipartite_eigenvalue_neg #print axioms SharpAlonBoppanaDiameter.witness_C8_exact_tightness #print axioms SharpAlonBoppanaDiameter.witness_Q3_ramanujan #print axioms SharpAlonBoppanaDiameter.witness_Kdd_ramanujan