import Mathlib /-! # Winding-Number Twisted States (Exact $n = 5$ Threshold), Half-Circle Exponential Sync & Exact Strogatz–Mirollo Phase Transitions This file provides a 100% self-contained Lean 4 / Mathlib formalization of: 1. **Exact $C_n$ $q$-Twisted Equilibria, Complete Fourier Jacobian Spectrum & Wiley–Strogatz–Girvan Stability Dichotomy** (`cycleTwisted_is_equilibrium`, `cycleTwisted_orderParam_zero`, `cycleTwisted_jacobian_eigenvalue`, `wiley_strogatz_girvan_dichotomy`). 2. **Exact $n = 5$ Minimal Cycle Threshold** (`cos_two_pi_div_five_exact`, `twisted_stability_exact_n5_threshold`): $C_3$ and $C_4$ admit NO linearly stable nontrivial twisted states, while $C_5$ admits strictly linearly stable $q = \pm 1$ twisted states with $\cos(2\pi/5) = \frac{\sqrt{5}-1}{4} > 0$ and $R = 0$ (and $q=1$ is stable for all $n \ge 5$). 3. **Open-Semicircle Uniqueness & Exact Half-Circle Exponential Synchronization** (`open_semicircle_unique_equilibrium`, `half_circle_exponential_sync`, `completeGraph_diameter_contraction_rate`). 4. **Exact Strogatz–Mirollo Continuum Order-Parameter Phase Transitions & Bifurcation Laws**: - **Lorentzian / Cauchy** $g_\gamma(\omega) = \frac{\gamma}{\pi(\omega^2+\gamma^2)}$: exact closed-form integral, $K_c = 2\gamma$, $R(K) = \sqrt{1 - 2\gamma/K}$, exact $\beta = 1/2$ pitchfork scaling (`lorentzian_self_consistency_integral`, `lorentzian_exact_critical_coupling_and_branch`). - **Uniform on $[-\Delta, \Delta]$**: exact $K_c = \frac{4\Delta}{\pi}$, vertical jump to $R_c = \frac{\pi}{4}$, exact parametric curve $(K(\alpha), R(\alpha))$, strict monotonicity, and near-critical scaling (`uniform_self_consistency_integral`, `uniform_exact_Kc_and_first_order_jump`). - **Symmetric Bimodal** $\frac{1}{2}(\delta_{-\Delta} + \delta_{+\Delta})$: exact saddle-node jump from $0$ to $1/\sqrt{2}$ at $K_c = 2\Delta$ and exact branches $R_\pm(K) = \sqrt{\frac{1 \pm \sqrt{1-(2\Delta/K)^2}}{2}}$ (`bimodal_exact_Kc_and_branches`). -/ open scoped BigOperators open Finset Real Filter Topology namespace TwistedBifurcation /-! ## Section 1: Cycle $C_n$ $q$-Twisted Equilibria & Exact Fourier Spectrum -/ /-- Next vertex on $C_n$. -/ def cycNext {n : ℕ} (i : Fin n) : Fin n := ⟨(i.val + 1) % n, Nat.mod_lt _ (Nat.pos_of_ne_zero (by intro h; subst h; exact Fin.elim0 i))⟩ /-- Previous vertex on $C_n$. -/ def cycPrev {n : ℕ} (i : Fin n) : Fin n := ⟨(i.val + n - 1) % n, Nat.mod_lt _ (Nat.pos_of_ne_zero (by intro h; subst h; exact Fin.elim0 i))⟩ /-- The $q$-twisted phase configuration on $C_n$: $\theta_k^{(q)} = \frac{2\pi q k}{n}$. -/ noncomputable def twistedPhase (n : ℕ) (q : ℤ) (k : Fin n) : ℝ := 2 * Real.pi * (q : ℝ) * (k.val : ℝ) / (n : ℝ) /-- Homogeneous Kuramoto vector field on $C_n$ with coupling $K$: $F_k(\theta) = K\sin(\theta_{k+1} - \theta_k) + K\sin(\theta_{k-1} - \theta_k)$. -/ noncomputable def cycleHomogRHS {n : ℕ} (K : ℝ) (θ : Fin n → ℝ) (k : Fin n) : ℝ := K * Real.sin (θ (cycNext k) - θ k) + K * Real.sin (θ (cycPrev k) - θ k) /-- Linearized Jacobian action at $\theta^{(q)}$ on $C_n$: $(J_{n,q,K} v)_k = K\cos(\frac{2\pi q}{n})(v_{k+1} + v_{k-1} - 2 v_k)$. -/ noncomputable def cycleTwistedJacobian {n : ℕ} (q : ℤ) (K : ℝ) (v : Fin n → ℝ) (k : Fin n) : ℝ := K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) * (v (cycNext k) + v (cycPrev k) - 2 * v k) /-- Exact Hessian quadratic form $v^\top (-J_{n,q,K}) v = K\cos(\frac{2\pi q}{n})\sum_k (v_{k+1}-v_k)^2$. -/ noncomputable def cycleTwistedHessianQuad {n : ℕ} (q : ℤ) (K : ℝ) (v : Fin n → ℝ) : ℝ := K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) * ∑ k : Fin n, (v (cycNext k) - v k) ^ 2 /-- Exact eigenvalue formula $\lambda_m(n, q, K) = -2 K \cos(\frac{2\pi q}{n})(1 - \cos\frac{2\pi m}{n})$. -/ noncomputable def twistedEigenvalue (n : ℕ) (q m : ℤ) (K : ℝ) : ℝ := -2 * K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) * (1 - Real.cos (2 * Real.pi * (m : ℝ) / (n : ℝ))) lemma twistedPhase_step_next {n : ℕ} (hn : 0 < n) (q : ℤ) (k : Fin n) : Real.sin (twistedPhase n q (cycNext k) - twistedPhase n q k) = Real.sin (2 * Real.pi * (q : ℝ) / (n : ℝ)) ∧ Real.cos (twistedPhase n q (cycNext k) - twistedPhase n q k) = Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) := by have hnR : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) have hk := k.isLt unfold twistedPhase cycNext dsimp only by_cases hlt : k.val + 1 < n · rw [Nat.mod_eq_of_lt hlt] have hdiff : 2 * Real.pi * (q : ℝ) * ((k.val + 1 : ℕ) : ℝ) / (n : ℝ) - 2 * Real.pi * (q : ℝ) * (k.val : ℝ) / (n : ℝ) = 2 * Real.pi * (q : ℝ) / (n : ℝ) := by push_cast; field_simp [hnR]; ring rw [hdiff]; exact ⟨rfl, rfl⟩ · have hlast : k.val + 1 = n := by omega rw [hlast, Nat.mod_self] have hdiff : 2 * Real.pi * (q : ℝ) * ((0 : ℕ) : ℝ) / (n : ℝ) - 2 * Real.pi * (q : ℝ) * (k.val : ℝ) / (n : ℝ) = 2 * Real.pi * (q : ℝ) / (n : ℝ) + (-q : ℤ) * (2 * Real.pi) := by have hk_cast : (k.val : ℝ) = (n : ℝ) - 1 := by have : k.val + 1 = n := hlast have h' : (k.val : ℝ) + 1 = (n : ℝ) := by exact_mod_cast this linarith push_cast rw [hk_cast] field_simp [hnR]; ring rw [hdiff, Real.sin_add_int_mul_two_pi, Real.cos_add_int_mul_two_pi] exact ⟨rfl, rfl⟩ lemma twistedPhase_step_prev {n : ℕ} (hn : 0 < n) (q : ℤ) (k : Fin n) : Real.sin (twistedPhase n q (cycPrev k) - twistedPhase n q k) = -Real.sin (2 * Real.pi * (q : ℝ) / (n : ℝ)) ∧ Real.cos (twistedPhase n q (cycPrev k) - twistedPhase n q k) = Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) := by have hprev : cycNext (cycPrev k) = k := by ext simp only [cycNext, cycPrev] have hk := k.isLt by_cases h0 : k.val = 0 · rw [h0, zero_add] have hmod : (n - 1) % n = n - 1 := Nat.mod_eq_of_lt (by omega) rw [hmod, show n - 1 + 1 = n by omega, Nat.mod_self] · have h1 : (k.val + n - 1) % n = k.val - 1 := by have : k.val + n - 1 = (k.val - 1) + n := by omega rw [this, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] rw [h1] have : k.val - 1 + 1 = k.val := by omega rw [this, Nat.mod_eq_of_lt hk] have h := twistedPhase_step_next hn q (cycPrev k) rw [hprev] at h constructor · rw [← neg_sub (twistedPhase n q k) (twistedPhase n q (cycPrev k)), Real.sin_neg, h.1] · rw [← neg_sub (twistedPhase n q k) (twistedPhase n q (cycPrev k)), Real.cos_neg, h.2] /-- **Every $q$-twisted state is an exact equilibrium on $C_n$.** -/ theorem cycleTwisted_is_equilibrium {n : ℕ} (hn : 3 ≤ n) (q : ℤ) (K : ℝ) : ∀ k : Fin n, cycleHomogRHS K (twistedPhase n q) k = 0 := by intro k unfold cycleHomogRHS rw [(twistedPhase_step_next (by omega) q k).1, (twistedPhase_step_prev (by omega) q k).1] ring /-- **Exact Order-Parameter Vanishing of Nontrivial Twisted States:** For $n \ge 1$ and $q \in \mathbb{Z}$ with $n \nmid q$, the $q$-twisted state $\theta^{(q)}$ has zero order parameter: $\sum_k \cos(\theta_k^{(q)}) = 0$ and $\sum_k \sin(\theta_k^{(q)}) = 0$. -/ theorem cycleTwisted_orderParam_zero {n : ℕ} (hn : 0 < n) (q : ℤ) (hndiv : ¬((n : ℤ) ∣ q)) : (∑ k : Fin n, Real.cos (twistedPhase n q k)) = 0 ∧ (∑ k : Fin n, Real.sin (twistedPhase n q k)) = 0 := by have hnR : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) set α : ℝ := 2 * Real.pi * (q : ℝ) / (n : ℝ) have hsin_ne : Real.sin (α / 2) ≠ 0 := by intro hzero rw [Real.sin_eq_zero_iff] at hzero rcases hzero with ⟨m, hm⟩ have hpi : Real.pi ≠ 0 := ne_of_gt Real.pi_pos have hq : (q : ℝ) = (m : ℝ) * (n : ℝ) := by dsimp [α] at hm have h1 : (m : ℝ) * Real.pi = Real.pi * ((q : ℝ) / (n : ℝ)) := by rw [hm]; ring have h2 : (m : ℝ) = (q : ℝ) / (n : ℝ) := mul_left_cancel₀ hpi (by linarith) field_simp [hnR] at h2 linarith have hqZ : q = m * (n : ℤ) := by exact_mod_cast hq exact hndiv ⟨m, by rw [hqZ, mul_comm]⟩ -- Telescoping trigonometric sums via Finset.sum_range_sub have hcos_sum : ∑ k : Fin n, Real.cos (twistedPhase n q k) = ∑ k ∈ Finset.range n, Real.cos ((k : ℝ) * α) := by rw [← Fin.sum_univ_eq_sum_range (fun k : ℕ => Real.cos ((k : ℝ) * α)) n] refine Finset.sum_congr rfl fun k _ => ?_ unfold twistedPhase; congr 1; dsimp [α]; ring have hsin_sum : ∑ k : Fin n, Real.sin (twistedPhase n q k) = ∑ k ∈ Finset.range n, Real.sin ((k : ℝ) * α) := by rw [← Fin.sum_univ_eq_sum_range (fun k : ℕ => Real.sin ((k : ℝ) * α)) n] refine Finset.sum_congr rfl fun k _ => ?_ unfold twistedPhase; congr 1; dsimp [α]; ring have hcos_zero : ∑ k ∈ Finset.range n, Real.cos ((k : ℝ) * α) = 0 := by have hmul : 2 * Real.sin (α / 2) * ∑ k ∈ Finset.range n, Real.cos ((k : ℝ) * α) = 0 := by rw [Finset.mul_sum] have hterm : ∀ k ∈ Finset.range n, 2 * Real.sin (α / 2) * Real.cos ((k : ℝ) * α) = Real.sin (((k + 1 : ℕ) : ℝ) * α - α / 2) - Real.sin ((k : ℝ) * α - α / 2) := by intro k _ have h1 : (((k + 1 : ℕ) : ℝ) * α - α / 2) = (k : ℝ) * α + α / 2 := by push_cast; ring rw [h1, Real.sin_add, Real.sin_sub]; ring rw [Finset.sum_congr rfl hterm, Finset.sum_range_sub (fun k => Real.sin ((k : ℝ) * α - α / 2))] simp only [Nat.cast_zero, zero_mul, zero_sub] have hnα : (n : ℝ) * α - α / 2 = (-(α / 2)) + (q : ℤ) * (2 * Real.pi) := by dsimp [α]; field_simp [hnR]; ring rw [hnα, Real.sin_add_int_mul_two_pi]; ring exact (mul_eq_zero.mp hmul).resolve_left (mul_ne_zero two_ne_zero hsin_ne) have hsin_zero : ∑ k ∈ Finset.range n, Real.sin ((k : ℝ) * α) = 0 := by have hmul : 2 * Real.sin (α / 2) * ∑ k ∈ Finset.range n, Real.sin ((k : ℝ) * α) = 0 := by rw [Finset.mul_sum] have hterm : ∀ k ∈ Finset.range n, 2 * Real.sin (α / 2) * Real.sin ((k : ℝ) * α) = Real.cos ((k : ℝ) * α - α / 2) - Real.cos (((k + 1 : ℕ) : ℝ) * α - α / 2) := by intro k _ have h1 : (((k + 1 : ℕ) : ℝ) * α - α / 2) = (k : ℝ) * α + α / 2 := by push_cast; ring rw [h1, Real.cos_sub, Real.cos_add]; ring rw [Finset.sum_congr rfl hterm] have htele : ∑ k ∈ Finset.range n, (Real.cos ((k : ℝ) * α - α / 2) - Real.cos (((k + 1 : ℕ) : ℝ) * α - α / 2)) = -(∑ k ∈ Finset.range n, (Real.cos (((k + 1 : ℕ) : ℝ) * α - α / 2) - Real.cos ((k : ℝ) * α - α / 2))) := by rw [← Finset.sum_neg_distrib] refine Finset.sum_congr rfl fun k _ => by ring rw [htele, Finset.sum_range_sub (fun k => Real.cos ((k : ℝ) * α - α / 2))] simp only [Nat.cast_zero, zero_mul, zero_sub] have hnα : (n : ℝ) * α - α / 2 = (-(α / 2)) + (q : ℤ) * (2 * Real.pi) := by dsimp [α]; field_simp [hnR]; ring rw [hnα, Real.cos_add_int_mul_two_pi]; ring exact (mul_eq_zero.mp hmul).resolve_left (mul_ne_zero two_ne_zero hsin_ne) exact ⟨hcos_sum.trans hcos_zero, hsin_sum.trans hsin_zero⟩ /-- **Exact Linearization Derivative Theorem:** The directional derivative of `cycleHomogRHS K` at $\theta^{(q)}$ along $v$ equals `cycleTwistedJacobian q K v`. -/ theorem cycleTwisted_directional_deriv {n : ℕ} (hn : 3 ≤ n) (q : ℤ) (K : ℝ) (v : Fin n → ℝ) (k : Fin n) : HasDerivAt (fun t : ℝ => cycleHomogRHS K (fun j => twistedPhase n q j + t * v j) k) (cycleTwistedJacobian q K v k) 0 := by unfold cycleHomogRHS cycleTwistedJacobian have h1 : HasDerivAt (fun t : ℝ => (twistedPhase n q (cycNext k) + t * v (cycNext k)) - (twistedPhase n q k + t * v k)) (v (cycNext k) - v k) 0 := by have ha : HasDerivAt (fun t : ℝ => twistedPhase n q (cycNext k) + t * v (cycNext k)) (v (cycNext k)) 0 := by have h := ((hasDerivAt_id (0 : ℝ)).mul_const (v (cycNext k))).const_add (twistedPhase n q (cycNext k)) have hv : 1 * v (cycNext k) = v (cycNext k) := one_mul _ rwa [hv] at h have hb : HasDerivAt (fun t : ℝ => twistedPhase n q k + t * v k) (v k) 0 := by have h := ((hasDerivAt_id (0 : ℝ)).mul_const (v k)).const_add (twistedPhase n q k) have hv : 1 * v k = v k := one_mul _ rwa [hv] at h exact ha.fun_sub hb have h2 : HasDerivAt (fun t : ℝ => (twistedPhase n q (cycPrev k) + t * v (cycPrev k)) - (twistedPhase n q k + t * v k)) (v (cycPrev k) - v k) 0 := by have ha : HasDerivAt (fun t : ℝ => twistedPhase n q (cycPrev k) + t * v (cycPrev k)) (v (cycPrev k)) 0 := by have h := ((hasDerivAt_id (0 : ℝ)).mul_const (v (cycPrev k))).const_add (twistedPhase n q (cycPrev k)) have hv : 1 * v (cycPrev k) = v (cycPrev k) := one_mul _ rwa [hv] at h have hb : HasDerivAt (fun t : ℝ => twistedPhase n q k + t * v k) (v k) 0 := by have h := ((hasDerivAt_id (0 : ℝ)).mul_const (v k)).const_add (twistedPhase n q k) have hv : 1 * v k = v k := one_mul _ rwa [hv] at h exact ha.fun_sub hb have hd := (h1.sin.const_mul K).fun_add (h2.sin.const_mul K) have hval : K * (Real.cos ((twistedPhase n q (cycNext k) + 0 * v (cycNext k)) - (twistedPhase n q k + 0 * v k)) * (v (cycNext k) - v k)) + K * (Real.cos ((twistedPhase n q (cycPrev k) + 0 * v (cycPrev k)) - (twistedPhase n q k + 0 * v k)) * (v (cycPrev k) - v k)) = K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) * (v (cycNext k) + v (cycPrev k) - 2 * v k) := by simp only [zero_mul, add_zero] rw [(twistedPhase_step_next (by omega) q k).2, (twistedPhase_step_prev (by omega) q k).2] ring rwa [hval] at hd /-- **Exact Fourier Eigenvalue Spectrum of $J(\theta^{(q)})$ on $C_n$:** Both Fourier modes $c^{(m)}_k = \cos(2\pi m k / n)$ and $s^{(m)}_k = \sin(2\pi m k / n)$ are exact eigenvectors of $J(\theta^{(q)})$ with exact eigenvalue $$\lambda_m(n, q, K) = -2 K \cos\!\left(\frac{2\pi q}{n}\right)\left(1 - \cos\frac{2\pi m}{n}\right).$$ -/ theorem cycleTwisted_jacobian_eigenvalue {n : ℕ} (hn : 3 ≤ n) (q m : ℤ) (K : ℝ) (k : Fin n) : cycleTwistedJacobian q K (fun j => Real.cos (twistedPhase n m j)) k = twistedEigenvalue n q m K * Real.cos (twistedPhase n m k) ∧ cycleTwistedJacobian q K (fun j => Real.sin (twistedPhase n m j)) k = twistedEigenvalue n q m K * Real.sin (twistedPhase n m k) := by have hnext := twistedPhase_step_next (by omega) m k have hprev := twistedPhase_step_prev (by omega) m k set φ := twistedPhase n m k set β := 2 * Real.pi * (m : ℝ) / (n : ℝ) have hcos_next : Real.cos (twistedPhase n m (cycNext k)) = Real.cos (φ + β) := by have h : twistedPhase n m (cycNext k) = φ + (twistedPhase n m (cycNext k) - φ) := by ring rw [h, Real.cos_add, hnext.1, hnext.2, Real.cos_add] have hcos_prev : Real.cos (twistedPhase n m (cycPrev k)) = Real.cos (φ - β) := by have h : twistedPhase n m (cycPrev k) = φ + (twistedPhase n m (cycPrev k) - φ) := by ring rw [h, Real.cos_add, hprev.1, hprev.2, Real.cos_sub]; ring have hsin_next : Real.sin (twistedPhase n m (cycNext k)) = Real.sin (φ + β) := by have h : twistedPhase n m (cycNext k) = φ + (twistedPhase n m (cycNext k) - φ) := by ring rw [h, Real.sin_add, hnext.1, hnext.2, Real.sin_add] have hsin_prev : Real.sin (twistedPhase n m (cycPrev k)) = Real.sin (φ - β) := by have h : twistedPhase n m (cycPrev k) = φ + (twistedPhase n m (cycPrev k) - φ) := by ring rw [h, Real.sin_add, hprev.1, hprev.2, Real.sin_sub]; ring unfold cycleTwistedJacobian twistedEigenvalue dsimp only constructor · rw [hcos_next, hcos_prev, Real.cos_add, Real.cos_sub] dsimp [φ, β]; ring · rw [hsin_next, hsin_prev, Real.sin_add, Real.sin_sub] dsimp [φ, β]; ring /-- Exact identity relating the Jacobian bilinear form to the Hessian quadratic form: $-v^\top J(\theta^{(q)}) v = K \cos(2\pi q/n) \sum_k (v_{k+1} - v_k)^2$. -/ theorem cycleTwisted_hessian_quad_eq {n : ℕ} (q : ℤ) (K : ℝ) (v : Fin n → ℝ) : -(∑ k : Fin n, v k * cycleTwistedJacobian q K v k) = cycleTwistedHessianQuad q K v := by unfold cycleTwistedJacobian cycleTwistedHessianQuad set c := K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) let e : Fin n ≃ Fin n := { toFun := cycNext invFun := cycPrev left_inv := fun i => by ext; simp only [cycPrev, cycNext]; have hi := i.isLt by_cases h : i.val + 1 < n · rw [Nat.mod_eq_of_lt h] have : i.val + 1 + n - 1 = i.val + n := by omega rw [this, Nat.add_mod_right, Nat.mod_eq_of_lt hi] · have : i.val + 1 = n := by omega rw [this, Nat.mod_self, zero_add, Nat.mod_eq_of_lt (by omega)]; omega right_inv := fun i => by ext; simp only [cycPrev, cycNext]; have hi := i.isLt by_cases h : i.val = 0 · rw [h, zero_add] have hmod : (n - 1) % n = n - 1 := Nat.mod_eq_of_lt (by omega) rw [hmod, show n - 1 + 1 = n by omega, Nat.mod_self] · have h1 : (i.val + n - 1) % n = i.val - 1 := by have : i.val + n - 1 = (i.val - 1) + n := by omega rw [this, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] rw [h1]; have : i.val - 1 + 1 = i.val := by omega rw [this, Nat.mod_eq_of_lt hi] } have hshift : ∑ k : Fin n, v k * v (cycPrev k) = ∑ k : Fin n, v (cycNext k) * v k := by calc ∑ k : Fin n, v k * v (cycPrev k) = ∑ k : Fin n, v (e k) * v (cycPrev (e k)) := (Equiv.sum_comp e _).symm _ = ∑ k : Fin n, v (cycNext k) * v k := by refine Finset.sum_congr rfl fun k _ => ?_ exact congrArg (fun x => v (cycNext k) * v x) (e.left_inv k) have hsq_shift : ∑ k : Fin n, (v (cycNext k)) ^ 2 = ∑ k : Fin n, (v k) ^ 2 := Equiv.sum_comp e (fun k => (v k) ^ 2) have hlhs : ∑ k : Fin n, v k * (c * (v (cycNext k) + v (cycPrev k) - 2 * v k)) = c * ((∑ k : Fin n, v k * v (cycNext k)) + (∑ k : Fin n, v k * v (cycPrev k)) - 2 * ∑ k : Fin n, (v k) ^ 2) := by calc ∑ k : Fin n, v k * (c * (v (cycNext k) + v (cycPrev k) - 2 * v k)) = ∑ k : Fin n, c * (v k * v (cycNext k) + v k * v (cycPrev k) - 2 * (v k) ^ 2) := Finset.sum_congr rfl fun k _ => by ring _ = c * ∑ k : Fin n, (v k * v (cycNext k) + v k * v (cycPrev k) - 2 * (v k) ^ 2) := by rw [Finset.mul_sum] _ = c * ((∑ k : Fin n, v k * v (cycNext k)) + (∑ k : Fin n, v k * v (cycPrev k)) - 2 * ∑ k : Fin n, (v k) ^ 2) := by rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, ← Finset.mul_sum] have hrhs : ∑ k : Fin n, (v (cycNext k) - v k) ^ 2 = (∑ k : Fin n, (v (cycNext k)) ^ 2) - 2 * (∑ k : Fin n, v (cycNext k) * v k) + (∑ k : Fin n, (v k) ^ 2) := by have h1 : ∀ k : Fin n, (v (cycNext k) - v k) ^ 2 = (v (cycNext k)) ^ 2 - 2 * (v (cycNext k) * v k) + (v k) ^ 2 := fun k => by ring simp_rw [h1, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] have hcomm : ∑ k : Fin n, v k * v (cycNext k) = ∑ k : Fin n, v (cycNext k) * v k := Finset.sum_congr rfl fun k _ => mul_comm _ _ rw [hlhs, hrhs, hshift, hsq_shift, hcomm] ring /-! ## Section 2: Wiley–Strogatz–Girvan Stability Dichotomy & Exact $n = 5$ Threshold -/ lemma one_sub_cos_two_pi_mul_pos {n : ℕ} (hn : 3 ≤ n) (m : Fin n) (hm : m.val ≠ 0) : 0 < 1 - Real.cos (2 * Real.pi * (m.val : ℝ) / (n : ℝ)) := by have hnR : (0 : ℝ) < (n : ℝ) := Nat.cast_pos.mpr (by omega) have hm_pos : (0 : ℝ) < (m.val : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hm) have hm_lt : (m.val : ℝ) < (n : ℝ) := Nat.cast_lt.mpr m.isLt have hθ_pos : 0 < 2 * Real.pi * (m.val : ℝ) / (n : ℝ) := by positivity have hθ_lt : 2 * Real.pi * (m.val : ℝ) / (n : ℝ) < 2 * Real.pi := by rw [div_lt_iff₀ hnR]; nlinarith [Real.pi_pos] have hlt1 : Real.cos (2 * Real.pi * (m.val : ℝ) / (n : ℝ)) < 1 := by by_contra hge push Not at hge have heq : Real.cos (2 * Real.pi * (m.val : ℝ) / (n : ℝ)) = 1 := le_antisymm (Real.cos_le_one _) hge rw [Real.cos_eq_one_iff] at heq rcases heq with ⟨k, hk⟩ have hpi : 0 < 2 * Real.pi := by positivity have hk_pos : (0 : ℝ) < (k : ℝ) := by nlinarith have hk_lt : (k : ℝ) < 1 := by nlinarith have hk1 : (0 : ℤ) < k := by exact_mod_cast hk_pos have hk2 : k < (1 : ℤ) := by exact_mod_cast hk_lt omega linarith /-- **Exact Wiley–Strogatz–Girvan Stability Dichotomy:** For $n \ge 3$, $K > 0$, and $q \in \mathbb{Z}$: 1. All nontrivial Jacobian eigenvalues $\lambda_m(n, q, K)$ ($1 \le m \le n - 1$) are strictly negative **if and only if** $\cos(2\pi q / n) > 0$. 2. For any winding number $q \in \mathbb{Z}$ with $2 |q| \le n$, $\cos(2\pi q / n) > 0 \iff 4 |q| < n$ (i.e. $|q| < n / 4$). -/ theorem wiley_strogatz_girvan_dichotomy {n : ℕ} (hn : 3 ≤ n) (q : ℤ) (K : ℝ) (hK : 0 < K) : ((∀ m : Fin n, m.val ≠ 0 → twistedEigenvalue n q (m.val : ℤ) K < 0) ↔ 0 < Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ))) ∧ (2 * |q| ≤ (n : ℤ) → (0 < Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) ↔ 4 * |q| < (n : ℤ))) := by constructor · constructor · intro hall have h1 := hall ⟨1, by omega⟩ (by norm_num) unfold twistedEigenvalue at h1 simp only [Int.cast_natCast] at h1 have hpos := one_sub_cos_two_pi_mul_pos hn ⟨1, by omega⟩ (by norm_num) dsimp only at hpos by_contra hle push Not at hle have hnn : 0 ≤ (-2 * K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ))) * (1 - Real.cos (2 * Real.pi * ((1 : ℕ) : ℝ) / (n : ℝ))) := mul_nonneg (by nlinarith) hpos.le linarith · intro hcos m hm unfold twistedEigenvalue have hpos := one_sub_cos_two_pi_mul_pos hn m hm have hprod : 0 < 2 * K * Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) * (1 - Real.cos (2 * Real.pi * (m.val : ℝ) / (n : ℝ))) := by positivity simp only [Int.cast_natCast] linarith · intro hhalf have hnR : (0 : ℝ) < (n : ℝ) := Nat.cast_pos.mpr (by omega) have hcos_abs : Real.cos (2 * Real.pi * (q : ℝ) / (n : ℝ)) = Real.cos (2 * Real.pi * (|q| : ℝ) / (n : ℝ)) := by rcases le_or_gt 0 (q : ℝ) with hq | hq · rw [abs_of_nonneg hq] · rw [abs_of_neg hq] have : 2 * Real.pi * -(q : ℝ) / (n : ℝ) = -(2 * Real.pi * (q : ℝ) / (n : ℝ)) := by ring rw [this, Real.cos_neg] rw [hcos_abs] set θ := 2 * Real.pi * (|q| : ℝ) / (n : ℝ) have hθ_nonneg : 0 ≤ θ := by have : (0 : ℝ) ≤ (|q| : ℝ) := by exact_mod_cast abs_nonneg q positivity have hθ_le_pi : θ ≤ Real.pi := by have hhalfR : 2 * (|q| : ℝ) ≤ (n : ℝ) := by exact_mod_cast hhalf dsimp [θ] rw [div_le_iff₀ hnR] nlinarith [Real.pi_pos] constructor · intro hpos by_contra hge push Not at hge have hgeR : (n : ℝ) ≤ 4 * (|q| : ℝ) := by exact_mod_cast hge have hθ_ge : Real.pi / 2 ≤ θ := by dsimp [θ]; rw [le_div_iff₀ hnR]; nlinarith [Real.pi_pos] have hcos_nonpos : Real.cos θ ≤ 0 := Real.cos_nonpos_of_pi_div_two_le_of_le hθ_ge (by linarith [Real.pi_pos]) linarith · intro hlt have hltR : 4 * (|q| : ℝ) < (n : ℝ) := by exact_mod_cast hlt have hθ_lt : θ < Real.pi / 2 := by dsimp [θ]; rw [div_lt_iff₀ hnR]; nlinarith [Real.pi_pos] exact Real.cos_pos_of_mem_Ioo ⟨by linarith [Real.pi_pos], hθ_lt⟩ /-- **Exact Radical Value of $\cos(2\pi/5)$:** $\cos(2\pi/5) = \frac{\sqrt{5}-1}{4} > 0$, proved directly from the 5th-roots sum $1 + 2\cos(2\pi/5) + 2\cos(4\pi/5) = 0$. -/ theorem cos_two_pi_div_five_exact : Real.cos (2 * Real.pi / 5) = (Real.sqrt 5 - 1) / 4 ∧ 0 < Real.cos (2 * Real.pi / 5) := by have hsum := (cycleTwisted_orderParam_zero (n := 5) (by norm_num) 1 (by norm_num)).1 rw [Fin.sum_univ_five] at hsum unfold twistedPhase at hsum simp only [Int.cast_one, Nat.cast_ofNat, Fin.val_zero, Fin.val_one, Fin.val_two, Nat.cast_zero, Nat.cast_one] at hsum have h0 : Real.cos (2 * Real.pi * 1 * 0 / 5) = 1 := by norm_num have h1 : Real.cos (2 * Real.pi * 1 * 1 / 5) = Real.cos (2 * Real.pi / 5) := by ring_nf have h2 : Real.cos (2 * Real.pi * 1 * 2 / 5) = Real.cos (2 * (2 * Real.pi / 5)) := by ring_nf have h3 : Real.cos (2 * Real.pi * 1 * ((3 : Fin 5).val : ℝ) / 5) = Real.cos (2 * (2 * Real.pi / 5)) := by have : 2 * Real.pi * 1 * ((3 : Fin 5).val : ℝ) / 5 = -(2 * (2 * Real.pi / 5)) + 2 * Real.pi := by norm_num; ring rw [this, Real.cos_add_two_pi, Real.cos_neg] have h4 : Real.cos (2 * Real.pi * 1 * ((4 : Fin 5).val : ℝ) / 5) = Real.cos (2 * Real.pi / 5) := by have : 2 * Real.pi * 1 * ((4 : Fin 5).val : ℝ) / 5 = -(2 * Real.pi / 5) + 2 * Real.pi := by norm_num; ring rw [this, Real.cos_add_two_pi, Real.cos_neg] rw [h0, h1, h2, h3, h4, Real.cos_two_mul] at hsum set c := Real.cos (2 * Real.pi / 5) have hquad : 4 * c ^ 2 + 2 * c - 1 = 0 := by linarith have hc_pos : 0 < c := by refine Real.cos_pos_of_mem_Ioo ⟨by linarith [Real.pi_pos], by linarith [Real.pi_pos]⟩ have hsq : (4 * c + 1) ^ 2 = 5 := by nlinarith have h4c : 4 * c + 1 = Real.sqrt 5 := by rw [← Real.sqrt_sq (by linarith : 0 ≤ 4 * c + 1), hsq] exact ⟨by linarith, hc_pos⟩ /-- **Exact $n = 5$ Minimal Cycle Threshold Theorem:** 1. On $C_3$, NO nontrivial $q$-twisted state ($q \in \{1, 2\}$) is linearly stable (all have $\cos(2\pi q/3) = -1/2 < 0$, hence $\lambda_1 > 0$). 2. On $C_4$, NO nontrivial $q$-twisted state ($q \in \{1, 2, 3\}$) is linearly stable (all have $\cos(2\pi q/4) \le 0$, hence $\lambda_1 \ge 0$). 3. On $C_5$, the $q = 1$ and $q = 4$ twisted states ARE strictly linearly stable with $\cos(2\pi/5) = \frac{\sqrt{5}-1}{4} > 0$, all nontrivial eigenvalues strictly negative, positive-definite Hessian on non-constant perturbations, and $R = 0$. 4. For every $n \ge 5$, the $q = 1$ twisted state on $C_n$ is strictly linearly stable. -/ theorem twisted_stability_exact_n5_threshold (K : ℝ) (hK : 0 < K) : (∀ q : ℤ, q = 1 ∨ q = 2 → 0 < twistedEigenvalue 3 q 1 K) ∧ (∀ q : ℤ, q = 1 ∨ q = 2 ∨ q = 3 → 0 ≤ twistedEigenvalue 4 q 1 K) ∧ (∀ q : ℤ, q = 1 ∨ q = 4 → (∀ m : Fin 5, m.val ≠ 0 → twistedEigenvalue 5 q (m.val : ℤ) K < 0)) ∧ (∀ n : ℕ, 5 ≤ n → ∀ m : Fin n, m.val ≠ 0 → twistedEigenvalue n 1 (m.val : ℤ) K < 0) := by refine ⟨?_, ?_, ?_, ?_⟩ · intro q hq have hcos : Real.cos (2 * Real.pi * (q : ℝ) / 3) = -(1 / 2 : ℝ) := by rcases hq with rfl | rfl · have : 2 * Real.pi * ((1 : ℤ) : ℝ) / 3 = Real.pi - Real.pi / 3 := by push_cast; ring rw [this, Real.cos_pi_sub, Real.cos_pi_div_three] · have : 2 * Real.pi * ((2 : ℤ) : ℝ) / 3 = Real.pi / 3 + Real.pi := by push_cast; ring rw [this, Real.cos_add_pi, Real.cos_pi_div_three] unfold twistedEigenvalue have h1 : (0 : ℝ) < 1 - Real.cos (2 * Real.pi * ((1 : ℤ) : ℝ) / 3) := by simpa using one_sub_cos_two_pi_mul_pos (n := 3) (le_refl 3) ⟨1, by norm_num⟩ (by norm_num) simp only [Nat.cast_ofNat] rw [hcos]; nlinarith · intro q hq have hcos : Real.cos (2 * Real.pi * (q : ℝ) / 4) ≤ 0 := by rcases hq with rfl | rfl | rfl · have : 2 * Real.pi * ((1 : ℤ) : ℝ) / 4 = Real.pi / 2 := by push_cast; ring rw [this, Real.cos_pi_div_two] · have : 2 * Real.pi * ((2 : ℤ) : ℝ) / 4 = Real.pi := by push_cast; ring rw [this, Real.cos_pi]; norm_num · have : 2 * Real.pi * ((3 : ℤ) : ℝ) / 4 = Real.pi / 2 + Real.pi := by push_cast; ring rw [this, Real.cos_add_pi, Real.cos_pi_div_two]; norm_num unfold twistedEigenvalue have h1 : (0 : ℝ) < 1 - Real.cos (2 * Real.pi * ((1 : ℤ) : ℝ) / 4) := by simpa using one_sub_cos_two_pi_mul_pos (n := 4) (by norm_num) ⟨1, by norm_num⟩ (by norm_num) simp only [Nat.cast_ofNat] have hrew : -2 * K * Real.cos (2 * Real.pi * (q : ℝ) / 4) * (1 - Real.cos (2 * Real.pi * ((1 : ℤ) : ℝ) / 4)) = (2 * K * (-Real.cos (2 * Real.pi * (q : ℝ) / 4))) * (1 - Real.cos (2 * Real.pi * ((1 : ℤ) : ℝ) / 4)) := by ring rw [hrew] exact mul_nonneg (by nlinarith) h1.le · intro q hq rw [(wiley_strogatz_girvan_dichotomy (n := 5) (by norm_num) q K hK).1] rcases hq with rfl | rfl · have : 2 * Real.pi * ((1 : ℤ) : ℝ) / ((5 : ℕ) : ℝ) = 2 * Real.pi / 5 := by push_cast; ring rw [this]; exact cos_two_pi_div_five_exact.2 · have : 2 * Real.pi * ((4 : ℤ) : ℝ) / ((5 : ℕ) : ℝ) = -(2 * Real.pi / 5) + 2 * Real.pi := by push_cast; ring rw [this, Real.cos_add_two_pi, Real.cos_neg]; exact cos_two_pi_div_five_exact.2 · intro n hn rw [(wiley_strogatz_girvan_dichotomy (by omega) 1 K hK).1] rw [(wiley_strogatz_girvan_dichotomy (by omega) 1 K hK).2 (by simp; omega)] simp; omega /-! ## Section 3: Open-Semicircle Uniqueness & Exact Half-Circle Exponential Synchronization -/ /-- Weighted undirected graph structure (self-contained copy for standalone compilation). -/ structure WGraph (n : ℕ) where weight : Fin n → Fin n → ℝ symm : ∀ i j, weight i j = weight j i nonneg : ∀ i j, 0 ≤ weight i j diag_zero : ∀ i, weight i i = 0 /-- Homogeneous Kuramoto vector field $F_i(\theta) = \sum_j a_{ij}\sin(\theta_j - \theta_i)$. -/ noncomputable def homogRHS {n : ℕ} (G : WGraph n) (θ : Fin n → ℝ) (i : Fin n) : ℝ := ∑ j : Fin n, G.weight i j * Real.sin (θ j - θ i) /-- Graph Laplacian quadratic form $v^\top L_G v = \frac{1}{2}\sum_{i,j} a_{ij}(v_j - v_i)^2$. -/ noncomputable def lapQuad {n : ℕ} (G : WGraph n) (v : Fin n → ℝ) : ℝ := (1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (v j - v i) ^ 2 /-- Connectivity of a weighted graph via positive edge cut across every nontrivial bipartition. -/ def IsConnectedGraph {n : ℕ} (G : WGraph n) : Prop := ∀ S : Finset (Fin n), S.Nonempty → Sᶜ.Nonempty → ∃ i ∈ S, ∃ j ∈ Sᶜ, 0 < G.weight i j /-- **Open-Semicircle Uniqueness of Homogeneous Equilibria:** On ANY connected weighted graph $G$, any homogeneous equilibrium $\theta$ confined to an open arc of length $< \pi$ ($\forall i\, j, \theta_j - \theta_i < \pi$) MUST be fully synchronized ($\forall i\, j, \theta_i = \theta_j$). -/ theorem open_semicircle_unique_equilibrium {n : ℕ} (hn : 0 < n) (G : WGraph n) (hconn : IsConnectedGraph G) (θ : Fin n → ℝ) (heq : ∀ i : Fin n, homogRHS G θ i = 0) (harc : ∀ i j : Fin n, θ j - θ i < Real.pi) : ∀ i j : Fin n, θ i = θ j := by have huniv : (Finset.univ : Finset (Fin n)).Nonempty := ⟨⟨0, hn⟩, Finset.mem_univ _⟩ obtain ⟨i_max, _, hi_max⟩ := Finset.exists_max_image Finset.univ θ huniv set M := θ i_max set S := Finset.univ.filter (fun i : Fin n => θ i = M) have hS_ne : S.Nonempty := ⟨i_max, by simp [S, M]⟩ by_contra hnot push Not at hnot rcases hnot with ⟨a, b, hab⟩ have hSc_ne : Sᶜ.Nonempty := by by_cases ha : θ a = M · exact ⟨b, by simp [S]; intro hb; exact hab (ha.trans hb.symm)⟩ · exact ⟨a, by simp [S, ha]⟩ obtain ⟨i, hiS, j, hjSc, hwij⟩ := hconn S hS_ne hSc_ne have hiM : θ i = M := (Finset.mem_filter.mp hiS).2 have hj_lt : θ j < M := lt_of_le_of_ne (hi_max j (Finset.mem_univ j)) (by simpa [S] using hjSc) -- Every term a_{ik} sin(θ_k - θ_i) <= 0, and term k = j is strictly < 0! have hterm_nonpos : ∀ k : Fin n, G.weight i k * Real.sin (θ k - θ i) ≤ 0 := by intro k have hk_le : θ k - θ i ≤ 0 := by linarith [hi_max k (Finset.mem_univ k)] have hk_gt : -Real.pi < θ k - θ i := by linarith [harc k i] have hsin : Real.sin (θ k - θ i) ≤ 0 := by have hpos : 0 ≤ -(θ k - θ i) := by linarith have hle : -(θ k - θ i) ≤ Real.pi := by linarith have := Real.sin_nonneg_of_nonneg_of_le_pi hpos hle rw [Real.sin_neg] at this; linarith exact mul_nonpos_of_nonneg_of_nonpos (G.nonneg i k) hsin have hj_neg : G.weight i j * Real.sin (θ j - θ i) < 0 := by have h1 : 0 < θ i - θ j := by linarith have h2 : θ i - θ j < Real.pi := harc j i have hsin : 0 < Real.sin (θ i - θ j) := Real.sin_pos_of_pos_of_lt_pi h1 h2 have hsin' : Real.sin (θ j - θ i) < 0 := by rw [← neg_sub (θ i) (θ j), Real.sin_neg]; linarith exact mul_neg_of_pos_of_neg hwij hsin' have hsum_neg : homogRHS G θ i < 0 := by unfold homogRHS rw [← Finset.add_sum_erase _ _ (Finset.mem_univ j)] have hrest : ∑ k ∈ Finset.univ.erase j, G.weight i k * Real.sin (θ k - θ i) ≤ 0 := Finset.sum_nonpos fun k _ => hterm_nonpos k linarith linarith [heq i] /-- Concavity secant lower bound on $[0, \gamma] \subseteq [0, \pi]$. -/ lemma sin_ge_secant {γ x : ℝ} (hγ0 : 0 < γ) (hγpi : γ ≤ Real.pi) (hx0 : 0 ≤ x) (hxγ : x ≤ γ) : (Real.sin γ / γ) * x ≤ Real.sin x := by rcases eq_or_lt_of_le hx0 with rfl | hx_pos · simp · have hgx : ∀ t ∈ Set.Icc 0 Real.pi, 0 ≤ Real.sin t - t * Real.cos t := by have hmono : MonotoneOn (fun t : ℝ => Real.sin t - t * Real.cos t) (Set.Icc 0 Real.pi) := by refine monotoneOn_of_deriv_nonneg (convex_Icc 0 Real.pi) ?_ ?_ ?_ · exact (Real.continuous_sin.sub (continuous_id.mul Real.continuous_cos)).continuousOn · exact (Real.differentiable_sin.sub (differentiable_id.mul Real.differentiable_cos)).differentiableOn · intro t ht rw [interior_Icc] at ht have hd : HasDerivAt (fun s : ℝ => Real.sin s - s * Real.cos s) (t * Real.sin t) t := by have hid : HasDerivAt (fun s : ℝ => s) 1 t := hasDerivAt_id t have h1 := (Real.hasDerivAt_sin t).fun_sub (hid.fun_mul (Real.hasDerivAt_cos t)) have hv : Real.cos t - (1 * Real.cos t + t * -Real.sin t) = t * Real.sin t := by ring rwa [hv] at h1 rw [hd.deriv] exact mul_nonneg ht.1.le (Real.sin_nonneg_of_nonneg_of_le_pi ht.1.le ht.2.le) intro t ht have h0 := hmono ⟨le_refl 0, Real.pi_pos.le⟩ ht ht.1 simpa using h0 have hanti : AntitoneOn (fun t : ℝ => Real.sin t / t) (Set.Ioc 0 Real.pi) := by refine antitoneOn_of_deriv_nonpos (convex_Ioc 0 Real.pi) ?_ ?_ ?_ · exact Real.continuous_sin.continuousOn.div continuousOn_id fun t ht => ne_of_gt ht.1 · exact Real.differentiable_sin.differentiableOn.div differentiableOn_id fun t ht => ne_of_gt (interior_subset ht).1 · intro t ht rw [interior_Ioc] at ht have hd : HasDerivAt (fun s : ℝ => Real.sin s / s) ((Real.cos t * t - Real.sin t * 1) / t ^ 2) t := (Real.hasDerivAt_sin t).fun_div (hasDerivAt_id t) (ne_of_gt ht.1) rw [hd.deriv] have hle := hgx t ⟨ht.1.le, ht.2.le⟩ exact div_nonpos_of_nonpos_of_nonneg (by linarith) (sq_nonneg t) have hle := hanti ⟨hx_pos, hxγ.trans hγpi⟩ ⟨hγ0, hγpi⟩ hxγ exact (le_div_iff₀ hx_pos).mp hle /-- Phase variance energy $W(\theta) = \frac{1}{2}\sum_i (\theta_i - \bar\theta)^2$. -/ noncomputable def phaseVariance {n : ℕ} (θ : Fin n → ℝ) : ℝ := (1 / 2 : ℝ) * ∑ i : Fin n, (θ i - (∑ k : Fin n, θ k) / (n : ℝ)) ^ 2 /-- **Exact Half-Circle Exponential Synchronization on Any Connected Graph:** Let $\theta : \mathbb{R} \to \mathrm{Fin}\, n \to \mathbb{R}$ solve the homogeneous Kuramoto ODE $\dot\theta_i(t) = \sum_j a_{ij}\sin(\theta_j(t) - \theta_i(t))$ on $[0, T]$ on a weighted graph $G$ with algebraic connectivity $\lambda_2$ ($v^\top L_G v \ge \lambda_2 \|v\|_2^2$ for $v \perp \mathbf{1}$), remaining in an arc of length $\le \gamma \in (0, \pi)$ on $[0, T]$. Then the phase variance contracts exponentially at exact rate $2 \lambda_2 \frac{\sin\gamma}{\gamma}$: $$W(\theta(t)) \;\le\; W(\theta(0)) \exp\!\left(-2 \lambda_2 \frac{\sin\gamma}{\gamma} t\right) \qquad \forall t \in [0, T].$$ -/ theorem half_circle_exponential_sync {n : ℕ} (hn : 0 < n) (G : WGraph n) (θ : ℝ → Fin n → ℝ) {T γ lam2 : ℝ} (hT : 0 ≤ T) (hγ0 : 0 < γ) (hγpi : γ < Real.pi) (hode : ∀ t ∈ Set.Icc 0 T, ∀ i : Fin n, HasDerivAt (fun s => θ s i) (homogRHS G (θ t) i) t) (harc : ∀ t ∈ Set.Icc 0 T, ∀ i j : Fin n, |θ t j - θ t i| ≤ γ) (hlam2 : ∀ v : Fin n → ℝ, (∑ i : Fin n, v i) = 0 → lam2 * (∑ i : Fin n, (v i) ^ 2) ≤ lapQuad G v) : ∀ t ∈ Set.Icc 0 T, phaseVariance (θ t) ≤ phaseVariance (θ 0) * Real.exp (-(2 * lam2 * (Real.sin γ / γ)) * t) := by have hnR : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) set α := 2 * lam2 * (Real.sin γ / γ) -- Show f(t) = exp(α t) * W(θ t) has derivative <= 0 on [0, T] have hderiv_W : ∀ t ∈ Set.Icc 0 T, HasDerivAt (fun s => phaseVariance (θ s)) (-(1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i)) t := by intro t ht -- Mean phase derivative is 0 because sum homogRHS = 0 have hsum_F : ∑ i : Fin n, homogRHS G (θ t) i = 0 := by unfold homogRHS set S := ∑ i : Fin n, ∑ j : Fin n, G.weight i j * Real.sin (θ t j - θ t i) have hswap : S = -S := by calc S = ∑ j : Fin n, ∑ i : Fin n, G.weight i j * Real.sin (θ t j - θ t i) := Finset.sum_comm _ = ∑ j : Fin n, ∑ i : Fin n, -(G.weight j i * Real.sin (θ t i - θ t j)) := by refine Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun i _ => ?_ rw [G.symm i j, ← neg_sub (θ t i) (θ t j), Real.sin_neg]; ring _ = -S := by simp_rw [Finset.sum_neg_distrib]; rfl linarith have hbar : HasDerivAt (fun s => (∑ k : Fin n, θ s k) / (n : ℝ)) 0 t := by have hsum_d : HasDerivAt (fun s => ∑ k : Fin n, θ s k) (∑ k : Fin n, homogRHS G (θ t) k) t := HasDerivAt.fun_sum fun k _ => hode t ht k have hs := hsum_d.div_const (n : ℝ) rw [hsum_F, zero_div] at hs exact hs have hW_raw : HasDerivAt (fun s => phaseVariance (θ s)) (∑ i : Fin n, (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) * homogRHS G (θ t) i) t := by unfold phaseVariance have hsum : HasDerivAt (fun s => ∑ i : Fin n, (θ s i - (∑ k : Fin n, θ s k) / (n : ℝ)) ^ 2) (∑ i : Fin n, 2 * (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) * homogRHS G (θ t) i) t := by refine HasDerivAt.fun_sum fun i _ => ?_ have hd := ((hode t ht i).fun_sub hbar).pow 2 have hv : ((2 : ℕ) : ℝ) * (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) ^ (2 - 1) * (homogRHS G (θ t) i - 0) = 2 * (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) * homogRHS G (θ t) i := by norm_num rwa [hv] at hd have hmul := hsum.const_mul (1 / 2 : ℝ) have hv : (1 / 2 : ℝ) * ∑ i : Fin n, 2 * (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) * homogRHS G (θ t) i = ∑ i : Fin n, (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) * homogRHS G (θ t) i := by rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun i _ => by ring rwa [hv] at hmul have hsymm : ∑ i : Fin n, (θ t i - (∑ k : Fin n, θ t k) / (n : ℝ)) * homogRHS G (θ t) i = -(1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i) := by set u : Fin n → ℝ := fun i => θ t i - (∑ k : Fin n, θ t k) / (n : ℝ) have hmul : ∑ i : Fin n, u i * homogRHS G (θ t) i = ∑ i : Fin n, ∑ j : Fin n, G.weight i j * u i * Real.sin (θ t j - θ t i) := by refine Finset.sum_congr rfl fun i _ => ?_ unfold homogRHS; rw [Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => by ring rw [hmul] set X := ∑ i : Fin n, ∑ j : Fin n, G.weight i j * u i * Real.sin (θ t j - θ t i) have hswap : X = -(∑ i : Fin n, ∑ j : Fin n, G.weight i j * u j * Real.sin (θ t j - θ t i)) := by calc X = ∑ j : Fin n, ∑ i : Fin n, G.weight i j * u i * Real.sin (θ t j - θ t i) := Finset.sum_comm _ = ∑ j : Fin n, ∑ i : Fin n, -(G.weight j i * u i * Real.sin (θ t i - θ t j)) := by refine Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun i _ => ?_ rw [G.symm i j, ← neg_sub (θ t i) (θ t j), Real.sin_neg]; ring _ = -(∑ j : Fin n, ∑ i : Fin n, G.weight j i * u i * Real.sin (θ t i - θ t j)) := by simp_rw [Finset.sum_neg_distrib] have hdiff : ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i) = (∑ i : Fin n, ∑ j : Fin n, G.weight i j * u j * Real.sin (θ t j - θ t i)) - X := by rw [← Finset.sum_sub_distrib] refine Finset.sum_congr rfl fun i _ => ?_ rw [← Finset.sum_sub_distrib] refine Finset.sum_congr rfl fun j _ => ?_ dsimp [u]; ring linarith rwa [hsymm] at hW_raw have hderiv_nonpos : ∀ t ∈ Set.Icc 0 T, HasDerivAt (fun s => Real.exp (α * s) * phaseVariance (θ s)) (Real.exp (α * t) * (α * phaseVariance (θ t) - (1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i))) t ∧ Real.exp (α * t) * (α * phaseVariance (θ t) - (1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i)) ≤ 0 := by intro t ht have hexp : HasDerivAt (fun s => Real.exp (α * s)) (Real.exp (α * t) * α) t := by have hlin : HasDerivAt (fun s => α * s) α t := by have h := (hasDerivAt_id t).const_mul α have hv : α * 1 = α := mul_one α rwa [hv] at h exact hlin.exp have hprod := hexp.fun_mul (hderiv_W t ht) have hval : Real.exp (α * t) * α * phaseVariance (θ t) + Real.exp (α * t) * (-(1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i)) = Real.exp (α * t) * (α * phaseVariance (θ t) - (1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i)) := by ring refine ⟨by rwa [hval] at hprod, ?_⟩ refine mul_nonpos_of_nonneg_of_nonpos (Real.exp_pos _).le ?_ set u : Fin n → ℝ := fun i => θ t i - (∑ k : Fin n, θ t k) / (n : ℝ) have husum : ∑ i : Fin n, u i = 0 := by simp only [u, Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] field_simp [hnR]; ring have hpoint : ∀ i j : Fin n, (Real.sin γ / γ) * (u j - u i) ^ 2 ≤ (θ t j - θ t i) * Real.sin (θ t j - θ t i) := by intro i j rw [show u j - u i = θ t j - θ t i by dsimp [u]; ring] by_cases hpos : 0 ≤ θ t j - θ t i · have hsec := sin_ge_secant hγ0 hγpi.le hpos (abs_le.mp (harc t ht i j)).2 nlinarith · push Not at hpos have hsec := sin_ge_secant hγ0 hγpi.le (x := -(θ t j - θ t i)) (by linarith) (by linarith [(abs_le.mp (harc t ht i j)).1]) rw [Real.sin_neg] at hsec; nlinarith have hquad_le : (Real.sin γ / γ) * lapQuad G u ≤ (1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i) := by unfold lapQuad have hrw : (Real.sin γ / γ) * ((1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * (u j - u i) ^ 2) = (1 / 2 : ℝ) * ∑ i : Fin n, ∑ j : Fin n, G.weight i j * ((Real.sin γ / γ) * (u j - u i) ^ 2) := by rw [← mul_assoc, mul_comm (Real.sin γ / γ) (1 / 2 : ℝ), mul_assoc, Finset.mul_sum] congr 1; refine Finset.sum_congr rfl fun i _ => ?_ rw [Finset.mul_sum]; refine Finset.sum_congr rfl fun j _ => by ring rw [hrw] refine mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun i _ => Finset.sum_le_sum fun j _ => ?_) (by norm_num) calc G.weight i j * ((Real.sin γ / γ) * (u j - u i) ^ 2) ≤ G.weight i j * ((θ t j - θ t i) * Real.sin (θ t j - θ t i)) := mul_le_mul_of_nonneg_left (hpoint i j) (G.nonneg i j) _ = G.weight i j * (θ t j - θ t i) * Real.sin (θ t j - θ t i) := by ring have hsin_nonneg : 0 ≤ Real.sin γ / γ := div_nonneg (Real.sin_nonneg_of_nonneg_of_le_pi hγ0.le hγpi.le) hγ0.le have hspec := mul_le_mul_of_nonneg_left (hlam2 u husum) hsin_nonneg have hαW : α * phaseVariance (θ t) = (Real.sin γ / γ) * (lam2 * ∑ i : Fin n, (u i) ^ 2) := by unfold phaseVariance; dsimp [α, u]; ring linarith -- Apply Mean Value Theorem (antitoneOn_of_deriv_nonpos) to g(s) = exp(α s) * W(θ s) on [0, T] have hanti : AntitoneOn (fun s => Real.exp (α * s) * phaseVariance (θ s)) (Set.Icc 0 T) := by refine antitoneOn_of_deriv_nonpos (convex_Icc 0 T) ?_ ?_ ?_ · exact fun t ht => (hderiv_nonpos t ht).1.continuousAt.continuousWithinAt · exact fun t ht => (hderiv_nonpos t (interior_subset ht)).1.differentiableAt.differentiableWithinAt · intro t ht rw [(hderiv_nonpos t (interior_subset ht)).1.deriv] exact (hderiv_nonpos t (interior_subset ht)).2 intro t ht have hle := hanti ⟨le_refl 0, hT⟩ ht ht.1 simp only [mul_zero, Real.exp_zero, one_mul] at hle have hmul := mul_le_mul_of_nonneg_left hle (Real.exp_pos (-(α * t))).le rw [← mul_assoc, ← Real.exp_add, neg_add_cancel, Real.exp_zero, one_mul] at hmul calc phaseVariance (θ t) ≤ Real.exp (-(α * t)) * phaseVariance (θ 0) := hmul _ = phaseVariance (θ 0) * Real.exp (-α * t) := by rw [mul_comm]; congr 2; ring /-- **Exact Complete-Graph Half-Circle Phase-Diameter Contraction Rate:** For $K_n$ with uniform coupling $K > 0$ and any configuration $\theta$ with maximizer $i^*$ and minimizer $j^*$ satisfying $\theta_{i^*} - \theta_{j^*} \le \gamma < \pi$: $$F_{i^*}(\theta) - F_{j^*}(\theta) \;\le\; -K n \sin(\theta_{i^*} - \theta_{j^*}) \;\le\; -K n \frac{\sin\gamma}{\gamma} (\theta_{i^*} - \theta_{j^*}).$$ -/ theorem completeGraph_diameter_contraction_rate {n : ℕ} (K : ℝ) (hK : 0 ≤ K) (θ : Fin n → ℝ) (i_max j_min : Fin n) {γ : ℝ} (hγ0 : 0 < γ) (hγpi : γ < Real.pi) (hmax : ∀ k : Fin n, θ k ≤ θ i_max) (hmin : ∀ k : Fin n, θ j_min ≤ θ k) (harc : θ i_max - θ j_min ≤ γ) : (∑ k : Fin n, K * Real.sin (θ k - θ i_max)) - (∑ k : Fin n, K * Real.sin (θ k - θ j_min)) ≤ -K * (n : ℝ) * (Real.sin γ / γ) * (θ i_max - θ j_min) := by set M := θ i_max set m := θ j_min have hMm : 0 ≤ M - m := by linarith [hmax j_min] have hhalf_le : (M - m) / 2 ≤ Real.pi / 2 := by linarith have hsin_nonneg : 0 ≤ Real.sin ((M - m) / 2) := Real.sin_nonneg_of_nonneg_of_le_pi (by linarith) (by linarith) have hterm : ∀ k : Fin n, Real.sin (θ k - M) - Real.sin (θ k - m) ≤ -Real.sin (M - m) := by intro k have hid : Real.sin (θ k - M) - Real.sin (θ k - m) = -2 * Real.sin ((M - m) / 2) * Real.cos (θ k - (M + m) / 2) := by have h1 : θ k - M = (θ k - (M + m) / 2) - (M - m) / 2 := by ring have h2 : θ k - m = (θ k - (M + m) / 2) + (M - m) / 2 := by ring rw [h1, h2, Real.sin_sub, Real.sin_add]; ring rw [hid] have hcos_ge : Real.cos ((M - m) / 2) ≤ Real.cos (θ k - (M + m) / 2) := by have habs : |θ k - (M + m) / 2| ≤ (M - m) / 2 := by rw [abs_le]; constructor <;> linarith [hmax k, hmin k] have h1 : Real.cos (θ k - (M + m) / 2) = Real.cos |θ k - (M + m) / 2| := by rcases le_or_gt 0 (θ k - (M + m) / 2) with h | h · rw [abs_of_nonneg h] · rw [abs_of_neg h, Real.cos_neg] rw [h1] exact Real.antitoneOn_cos ⟨abs_nonneg _, habs.trans (by linarith)⟩ ⟨by linarith, by linarith⟩ habs have hdouble : Real.sin (M - m) = 2 * Real.sin ((M - m) / 2) * Real.cos ((M - m) / 2) := by have : M - m = 2 * ((M - m) / 2) := by ring conv_lhs => rw [this, Real.sin_two_mul] rw [hdouble] nlinarith have hsum_le : (∑ k : Fin n, K * Real.sin (θ k - M)) - (∑ k : Fin n, K * Real.sin (θ k - m)) ≤ -K * (n : ℝ) * Real.sin (M - m) := by rw [← Finset.sum_sub_distrib] calc ∑ k : Fin n, (K * Real.sin (θ k - M) - K * Real.sin (θ k - m)) = ∑ k : Fin n, K * (Real.sin (θ k - M) - Real.sin (θ k - m)) := Finset.sum_congr rfl fun k _ => by ring _ ≤ ∑ _k : Fin n, K * (-Real.sin (M - m)) := Finset.sum_le_sum fun k _ => mul_le_mul_of_nonneg_left (hterm k) hK _ = -K * (n : ℝ) * Real.sin (M - m) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]; ring have hsec := sin_ge_secant hγ0 hγpi.le hMm harc have hKn : 0 ≤ K * (n : ℝ) := by positivity nlinarith /-! ## Section 4: Exact Strogatz–Mirollo Continuum Order-Parameter Phase Transitions -/ /-- **Exact Lorentzian / Cauchy Self-Consistency Integral:** For every $\gamma > 0$ and $a \ge 0$, $$\int_{-\pi/2}^{\pi/2} \frac{\gamma}{\pi}\frac{\cos^2\phi}{\gamma^2 + a^2\sin^2\phi}\, d\phi \;=\; \frac{1}{\sqrt{\gamma^2 + a^2} + \gamma}.$$ -/ theorem lorentzian_self_consistency_integral {γ a : ℝ} (hγ : 0 < γ) (ha : 0 ≤ a) : ∫ φ in (-(Real.pi / 2))..(Real.pi / 2), (γ / Real.pi) * (Real.cos φ) ^ 2 / (γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2) = 1 / (Real.sqrt (γ ^ 2 + a ^ 2) + γ) := by have hpi : 0 < Real.pi := Real.pi_pos have hden_pos : ∀ φ : ℝ, 0 < γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2 := fun φ => by positivity have hcont : Continuous (fun φ : ℝ => (γ / Real.pi) * (Real.cos φ) ^ 2 / (γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2)) := by refine Continuous.div ?_ ?_ fun φ => ne_of_gt (hden_pos φ) · exact continuous_const.mul (Real.continuous_cos.pow 2) · exact continuous_const.add (continuous_const.mul (Real.continuous_sin.pow 2)) rcases eq_or_lt_of_le ha with rfl | ha_pos · -- Case a = 0: direct elementary antiderivative (1 / (2 π γ)) * (φ + sin φ cos φ) have hsimp : ∀ φ : ℝ, (γ / Real.pi) * (Real.cos φ) ^ 2 / (γ ^ 2 + 0 ^ 2 * (Real.sin φ) ^ 2) = (1 / (Real.pi * γ)) * (Real.cos φ) ^ 2 := by intro φ; field_simp [ne_of_gt hγ, ne_of_gt hpi]; ring simp_rw [hsimp] have hderiv : ∀ φ ∈ Set.uIcc (-(Real.pi / 2)) (Real.pi / 2), HasDerivAt (fun x : ℝ => (1 / (2 * Real.pi * γ)) * (x + Real.sin x * Real.cos x)) ((1 / (Real.pi * γ)) * (Real.cos φ) ^ 2) φ := by intro φ _ have hd1 : HasDerivAt (fun x : ℝ => x + Real.sin x * Real.cos x) (1 + (Real.cos φ * Real.cos φ + Real.sin φ * (-Real.sin φ))) φ := (hasDerivAt_id φ).fun_add ((Real.hasDerivAt_sin φ).fun_mul (Real.hasDerivAt_cos φ)) have hd2 := hd1.const_mul (1 / (2 * Real.pi * γ)) have hval : (1 / (2 * Real.pi * γ)) * (1 + (Real.cos φ * Real.cos φ + Real.sin φ * (-Real.sin φ))) = (1 / (Real.pi * γ)) * (Real.cos φ) ^ 2 := by have hsc := Real.sin_sq_add_cos_sq φ have h2c : 1 + (Real.cos φ * Real.cos φ + Real.sin φ * (-Real.sin φ)) = 2 * (Real.cos φ) ^ 2 := by nlinarith rw [h2c]; field_simp [ne_of_gt hγ, ne_of_gt hpi] rwa [hval] at hd2 rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv (by exact (continuous_const.mul (Real.continuous_cos.pow 2)).intervalIntegrable _ _)] simp only [Real.cos_pi_div_two, Real.cos_neg, mul_zero, add_zero, zero_pow two_ne_zero, Real.sqrt_sq hγ.le] field_simp [ne_of_gt hγ, ne_of_gt hpi]; ring · -- Case a > 0: explicit antiderivative F(φ) = (γ/(π a^2)) * ((s/γ) arctan((s/γ) tan φ) - φ) set s := Real.sqrt (γ ^ 2 + a ^ 2) have hs_pos : 0 < s := Real.sqrt_pos.mpr (by positivity) have hs_sq : s ^ 2 = γ ^ 2 + a ^ 2 := Real.sq_sqrt (by positivity) set F : ℝ → ℝ := fun φ => (γ / (Real.pi * a ^ 2)) * ((s / γ) * Real.arctan ((s / γ) * Real.tan φ) - φ) have hderiv : ∀ φ ∈ Set.Ioo (-(Real.pi / 2)) (Real.pi / 2), HasDerivAt F ((γ / Real.pi) * (Real.cos φ) ^ 2 / (γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2)) φ := by intro φ hφ have hcos_pos : 0 < Real.cos φ := Real.cos_pos_of_mem_Ioo hφ have hcos_ne : Real.cos φ ≠ 0 := ne_of_gt hcos_pos have htan : HasDerivAt Real.tan (1 / (Real.cos φ) ^ 2) φ := Real.hasDerivAt_tan hcos_ne have harg : HasDerivAt (fun x => (s / γ) * Real.tan x) ((s / γ) * (1 / (Real.cos φ) ^ 2)) φ := htan.const_mul (s / γ) have hatan := (Real.hasDerivAt_arctan ((s / γ) * Real.tan φ)).comp φ harg have hF := ((hatan.const_mul (s / γ)).fun_sub (hasDerivAt_id φ)).const_mul (γ / (Real.pi * a ^ 2)) have hval : (γ / (Real.pi * a ^ 2)) * ((s / γ) * (1 / (1 + ((s / γ) * Real.tan φ) ^ 2) * ((s / γ) * (1 / (Real.cos φ) ^ 2))) - 1) = (γ / Real.pi) * (Real.cos φ) ^ 2 / (γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2) := by rw [Real.tan_eq_sin_div_cos] have hden1 : 1 + (s / γ * (Real.sin φ / Real.cos φ)) ^ 2 = (γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2) / (γ ^ 2 * (Real.cos φ) ^ 2) := by have hsc := Real.sin_sq_add_cos_sq φ field_simp [ne_of_gt hγ, hcos_ne] nlinarith [hs_sq] rw [hden1] have hden2 : γ ^ 2 + a ^ 2 * (Real.sin φ) ^ 2 ≠ 0 := ne_of_gt (hden_pos φ) field_simp [ne_of_gt hγ, ne_of_gt hpi, ne_of_gt ha_pos, hcos_ne, hden2] have hsc := Real.sin_sq_add_cos_sq φ nlinarith [hs_sq] exact hF.congr_deriv hval have htend_right : Tendsto F (𝓝[<] (Real.pi / 2)) (𝓝 ((γ / (Real.pi * a ^ 2)) * ((s / γ) * (Real.pi / 2) - Real.pi / 2))) := by have htan_top : Tendsto Real.tan (𝓝[<] (Real.pi / 2)) atTop := Real.tendsto_tan_pi_div_two have hmul_top : Tendsto (fun φ => (s / γ) * Real.tan φ) (𝓝[<] (Real.pi / 2)) atTop := Filter.Tendsto.const_mul_atTop (div_pos hs_pos hγ) htan_top have hatan : Tendsto (fun φ => Real.arctan ((s / γ) * Real.tan φ)) (𝓝[<] (Real.pi / 2)) (𝓝 (Real.pi / 2)) := (Real.tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp hmul_top have hid : Tendsto (fun φ : ℝ => φ) (𝓝[<] (Real.pi / 2)) (𝓝 (Real.pi / 2)) := continuous_id.continuousWithinAt exact ((hatan.const_mul (s / γ)).sub hid).const_mul (γ / (Real.pi * a ^ 2)) have htend_left : Tendsto F (𝓝[>] (-(Real.pi / 2))) (𝓝 ((γ / (Real.pi * a ^ 2)) * ((s / γ) * (-(Real.pi / 2)) - -(Real.pi / 2)))) := by have htan_bot : Tendsto Real.tan (𝓝[>] (-(Real.pi / 2))) atBot := Real.tendsto_tan_neg_pi_div_two have hmul_bot : Tendsto (fun φ => (s / γ) * Real.tan φ) (𝓝[>] (-(Real.pi / 2))) atBot := Filter.Tendsto.const_mul_atBot (div_pos hs_pos hγ) htan_bot have hatan : Tendsto (fun φ => Real.arctan ((s / γ) * Real.tan φ)) (𝓝[>] (-(Real.pi / 2))) (𝓝 (-(Real.pi / 2))) := (Real.tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp hmul_bot have hid : Tendsto (fun φ : ℝ => φ) (𝓝[>] (-(Real.pi / 2))) (𝓝 (-(Real.pi / 2))) := continuous_id.continuousWithinAt exact ((hatan.const_mul (s / γ)).sub hid).const_mul (γ / (Real.pi * a ^ 2)) rw [intervalIntegral.integral_eq_sub_of_hasDerivAt_of_tendsto (by linarith) hderiv (hcont.intervalIntegrable _ _) htend_left htend_right] have hsγ : s + γ ≠ 0 := ne_of_gt (by positivity) field_simp [ne_of_gt hγ, ne_of_gt hpi, ne_of_gt ha_pos, hsγ] nlinarith [hs_sq] /-- **Exact Strogatz–Mirollo Lorentzian Critical Coupling $K_c = 2\gamma$ & Square-Root Branch:** For $\gamma > 0$ and $K > 0$: 1. A positive solution $R > 0$ to the Lorentzian self-consistency equation $1 = K \int_{-\pi/2}^{\pi/2} \frac{\gamma}{\pi}\frac{\cos^2\phi}{\gamma^2 + (KR)^2\sin^2\phi}\, d\phi$ exists **if and only if** $K > 2\gamma$; 2. For $K > 2\gamma$, the unique positive solution is $R(K) = \sqrt{1 - \frac{2\gamma}{K}}$, with exact critical pitchfork exponent $\beta = 1/2$: $R(K) = \frac{\sqrt{K - 2\gamma}}{\sqrt{K}}$, and $\lim_{K \to (2\gamma)^+} \frac{R(K)}{\sqrt{K - 2\gamma}} = \frac{1}{\sqrt{2\gamma}}$. -/ theorem lorentzian_exact_critical_coupling_and_branch {γ : ℝ} (hγ : 0 < γ) : (∀ K : ℝ, 0 < K → ∀ R : ℝ, 0 < R → (1 = K * ∫ φ in (-(Real.pi / 2))..(Real.pi / 2), (γ / Real.pi) * (Real.cos φ) ^ 2 / (γ ^ 2 + (K * R) ^ 2 * (Real.sin φ) ^ 2) ↔ 2 * γ < K ∧ R = Real.sqrt (1 - 2 * γ / K))) ∧ Tendsto (fun K : ℝ => Real.sqrt (1 - 2 * γ / K) / Real.sqrt (K - 2 * γ)) (𝓝[>] (2 * γ)) (𝓝 (1 / Real.sqrt (2 * γ))) := by constructor · intro K hK R hR rw [lorentzian_self_consistency_integral hγ (mul_pos hK hR).le] set s := Real.sqrt (γ ^ 2 + (K * R) ^ 2) have hs_gt : γ < s := by have hlt : γ ^ 2 < γ ^ 2 + (K * R) ^ 2 := lt_add_of_pos_right _ (sq_pos_of_pos (mul_pos hK hR)) calc γ = Real.sqrt (γ ^ 2) := (Real.sqrt_sq hγ.le).symm _ < Real.sqrt (γ ^ 2 + (K * R) ^ 2) := Real.sqrt_lt_sqrt (sq_nonneg γ) hlt have hsγ_pos : 0 < s + γ := by linarith constructor · intro heq have hK_eq : K = s + γ := by have h1 : K / (s + γ) = 1 := by rw [div_eq_mul_one_div]; exact heq.symm exact ((div_eq_one_iff_eq (ne_of_gt hsγ_pos)).mp h1) have hKgt : 2 * γ < K := by linarith have hKRsq : (K * R) ^ 2 = K * (K - 2 * γ) := by have hs_sq : s ^ 2 = γ ^ 2 + (K * R) ^ 2 := Real.sq_sqrt (by positivity) have hsub : s = K - γ := by linarith rw [hsub] at hs_sq; nlinarith have hRsq : R ^ 2 = 1 - 2 * γ / K := by field_simp [ne_of_gt hK] at hKRsq ⊢ nlinarith exact ⟨hKgt, by rw [← hRsq, Real.sqrt_sq hR.le]⟩ · rintro ⟨hKgt, rfl⟩ have h1sub : 0 < 1 - 2 * γ / K := by rw [sub_pos, div_lt_one hK]; exact hKgt have hKRsq : (K * Real.sqrt (1 - 2 * γ / K)) ^ 2 = K ^ 2 - 2 * γ * K := by rw [mul_pow, Real.sq_sqrt h1sub.le] field_simp [ne_of_gt hK] have hs_val : s = K - γ := by have hsq : γ ^ 2 + (K * Real.sqrt (1 - 2 * γ / K)) ^ 2 = (K - γ) ^ 2 := by rw [hKRsq]; ring dsimp [s] rw [hsq, Real.sqrt_sq (by linarith)] rw [hs_val] field_simp [ne_of_gt hK] ring · -- Limit as K -> (2γ)+ of sqrt(1 - 2γ/K) / sqrt(K - 2γ) = 1 / sqrt(K) -> 1 / sqrt(2γ) have hcont : ContinuousAt (fun K : ℝ => 1 / Real.sqrt K) (2 * γ) := continuousAt_const.div (Real.continuous_sqrt.continuousAt) (ne_of_gt (Real.sqrt_pos.mpr (by positivity))) have htend : Tendsto (fun K : ℝ => 1 / Real.sqrt K) (𝓝[>] (2 * γ)) (𝓝 (1 / Real.sqrt (2 * γ))) := hcont.tendsto.mono_left nhdsWithin_le_nhds refine htend.congr' ?_ filter_upwards [self_mem_nhdsWithin] with K (hK : 2 * γ < K) have hKpos : 0 < K := by linarith have hsub : 0 < K - 2 * γ := by linarith have hrew : 1 - 2 * γ / K = (K - 2 * γ) / K := by field_simp [ne_of_gt hKpos] rw [hrew, Real.sqrt_div hsub.le] field_simp [ne_of_gt (Real.sqrt_pos.mpr hsub), ne_of_gt (Real.sqrt_pos.mpr hKpos)] /-- **Exact Uniform Distribution Self-Consistency Integral:** For $\alpha \in [0, \pi/2]$, $\int_{-\alpha}^{\alpha} \cos^2\phi\, d\phi = \alpha + \sin\alpha\cos\alpha$. -/ theorem uniform_self_consistency_integral (α : ℝ) : ∫ φ in (-α)..α, (Real.cos φ) ^ 2 = α + Real.sin α * Real.cos α := by have hderiv : ∀ φ ∈ Set.uIcc (-α) α, HasDerivAt (fun x : ℝ => (1 / 2 : ℝ) * (x + Real.sin x * Real.cos x)) ((Real.cos φ) ^ 2) φ := by intro φ _ have hd := ((hasDerivAt_id φ).fun_add ((Real.hasDerivAt_sin φ).fun_mul (Real.hasDerivAt_cos φ))).const_mul (1 / 2 : ℝ) have hv : (1 / 2 : ℝ) * (1 + (Real.cos φ * Real.cos φ + Real.sin φ * (-Real.sin φ))) = (Real.cos φ) ^ 2 := by have := Real.sin_sq_add_cos_sq φ; nlinarith rwa [hv] at hd rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv ((Real.continuous_cos.pow 2).intervalIntegrable _ _)] simp only [Real.sin_neg, Real.cos_neg]; ring /-- Uniform self-consistency map: for $a = KR > 0$ and half-width $\Delta > 0$, $\Phi_{\mathrm{unif}}(a, \Delta) = \frac{a}{2\Delta} \int_{-\alpha}^{\alpha} \cos^2\phi\, d\phi$ where $\alpha = \pi/2$ if $a \le \Delta$ and $\alpha = \arcsin(\Delta / a)$ if $a \ge \Delta$. -/ noncomputable def uniformPhi (Δ a : ℝ) : ℝ := if a ≤ Δ then (a / (2 * Δ)) * (∫ φ in (-(Real.pi / 2))..(Real.pi / 2), (Real.cos φ) ^ 2) else (a / (2 * Δ)) * (∫ φ in (-Real.arcsin (Δ / a))..(Real.arcsin (Δ / a)), (Real.cos φ) ^ 2) /-- **Exact Strogatz–Mirollo Uniform Distribution Critical Coupling $K_c = 4\Delta/\pi$, Vertical First-Order Jump to $R_c = \pi/4$, & Exact Parametric Curve:** 1. For $K < 4\Delta/\pi$, NO positive solution $R > 0$ to $R = \Phi_{\mathrm{unif}}(\Delta, K R)$ exists; 2. At $K = 4\Delta/\pi$, EVERY $R \in (0, \pi/4]$ satisfies $R = \Phi_{\mathrm{unif}}(\Delta, K R)$ (exact vertical jump from $0$ to $\pi/4$!); 3. For every $\alpha \in (0, \pi/2]$, the exact parametric pair $$K(\alpha) = \frac{2\Delta}{\alpha + \sin\alpha\cos\alpha}, \qquad R(\alpha) = \frac{\alpha + \sin\alpha\cos\alpha}{2\sin\alpha}$$ satisfies $R(\alpha) = \Phi_{\mathrm{unif}}(\Delta, K(\alpha) R(\alpha))$, with $K(\alpha) \ge \frac{4\Delta}{\pi}$, $R(\alpha) \in [\frac{\pi}{4}, 1)$, $K(\pi/2) = \frac{4\Delta}{\pi}$, and $R(\pi/2) = \frac{\pi}{4}$. -/ theorem uniform_exact_Kc_and_first_order_jump {Δ : ℝ} (hΔ : 0 < Δ) : (∀ K : ℝ, 0 < K → K < 4 * Δ / Real.pi → ∀ R : ℝ, 0 < R → uniformPhi Δ (K * R) ≠ R) ∧ (∀ R : ℝ, 0 < R → R ≤ Real.pi / 4 → uniformPhi Δ ((4 * Δ / Real.pi) * R) = R) ∧ (∀ α : ℝ, 0 < α → α ≤ Real.pi / 2 → let K := 2 * Δ / (α + Real.sin α * Real.cos α) let R := (α + Real.sin α * Real.cos α) / (2 * Real.sin α) uniformPhi Δ (K * R) = R ∧ 4 * Δ / Real.pi ≤ K ∧ Real.pi / 4 ≤ R ∧ R < 1) := by have hpi : 0 < Real.pi := Real.pi_pos -- Auxiliary: f(α) = α + sin α cos α is strictly increasing on [0, π/2] with f(0) = 0, f(π/2) = π/2 have hf_inc : ∀ α : ℝ, 0 < α → α ≤ Real.pi / 2 → 0 < α + Real.sin α * Real.cos α ∧ α + Real.sin α * Real.cos α ≤ Real.pi / 2 := by intro α hα0 hαpi have hsin : 0 < Real.sin α := Real.sin_pos_of_pos_of_lt_pi hα0 (by linarith) have hcos : 0 ≤ Real.cos α := Real.cos_nonneg_of_mem_Icc ⟨by linarith, hαpi⟩ have hpos : 0 < α + Real.sin α * Real.cos α := by nlinarith -- Antitone/monotone check: g(x) = x + sin x cos x has derivative 2 cos^2 x >= 0 have hmono : MonotoneOn (fun x : ℝ => x + Real.sin x * Real.cos x) (Set.Icc 0 (Real.pi / 2)) := by refine monotoneOn_of_deriv_nonneg (convex_Icc 0 (Real.pi / 2)) ?_ ?_ ?_ · exact (continuous_id.add (Real.continuous_sin.mul Real.continuous_cos)).continuousOn · exact (differentiable_id.add (Real.differentiable_sin.mul Real.differentiable_cos)).differentiableOn · intro x _ have hd : HasDerivAt (fun t : ℝ => t + Real.sin t * Real.cos t) (2 * (Real.cos x) ^ 2) x := by have h := (hasDerivAt_id x).fun_add ((Real.hasDerivAt_sin x).fun_mul (Real.hasDerivAt_cos x)) have hv : 1 + (Real.cos x * Real.cos x + Real.sin x * (-Real.sin x)) = 2 * (Real.cos x) ^ 2 := by have := Real.sin_sq_add_cos_sq x; nlinarith rwa [hv] at h rw [hd.deriv]; positivity have hle := hmono ⟨hα0.le, hαpi⟩ ⟨by linarith, le_refl _⟩ hαpi simp only [Real.cos_pi_div_two, mul_zero, add_zero] at hle exact ⟨hpos, hle⟩ -- Auxiliary: α + sin α cos α < 2 sin α for α ∈ (0, π/2] have hlt_two_sin : ∀ α : ℝ, 0 < α → α ≤ Real.pi / 2 → α + Real.sin α * Real.cos α < 2 * Real.sin α := by intro α hα0 hαpi -- h(x) = 2 sin x - x - sin x cos x has h(0) = 0 and h'(x) = 2 cos x (1 - cos x) > 0 on (0, π/2) have hstrict : StrictMonoOn (fun x : ℝ => 2 * Real.sin x - x - Real.sin x * Real.cos x) (Set.Icc 0 (Real.pi / 2)) := by refine strictMonoOn_of_deriv_pos (convex_Icc 0 (Real.pi / 2)) ?_ ?_ · exact (((continuous_const.mul Real.continuous_sin).sub continuous_id).sub (Real.continuous_sin.mul Real.continuous_cos)).continuousOn · intro x hx rw [interior_Icc] at hx have hd : HasDerivAt (fun t : ℝ => 2 * Real.sin t - t - Real.sin t * Real.cos t) (2 * Real.cos x * (1 - Real.cos x)) x := by have h := (((Real.hasDerivAt_sin x).const_mul 2).fun_sub (hasDerivAt_id x)).fun_sub ((Real.hasDerivAt_sin x).fun_mul (Real.hasDerivAt_cos x)) have hv : 2 * Real.cos x - 1 - (Real.cos x * Real.cos x + Real.sin x * (-Real.sin x)) = 2 * Real.cos x * (1 - Real.cos x) := by have := Real.sin_sq_add_cos_sq x; nlinarith rwa [hv] at h rw [hd.deriv] have hcpos : 0 < Real.cos x := Real.cos_pos_of_mem_Ioo ⟨by linarith [hx.1], hx.2⟩ have hclt1 : Real.cos x < 1 := by have := Real.strictAntiOn_cos ⟨le_refl 0, Real.pi_pos.le⟩ ⟨hx.1.le, by linarith [hx.2]⟩ hx.1 simpa using this nlinarith have hgt := hstrict ⟨le_refl 0, by linarith⟩ ⟨hα0.le, hαpi⟩ hα0 simp only [Real.sin_zero, mul_zero, sub_zero] at hgt linarith -- Auxiliary: (π/2) sin α <= α + sin α cos α on (0, π/2] -- Proved because (α + sin α cos α) / sin α is antitone on (0, π/2]! have hge_pi_div_four : ∀ α : ℝ, 0 < α → α ≤ Real.pi / 2 → (Real.pi / 2) * Real.sin α ≤ α + Real.sin α * Real.cos α := by intro α hα0 hαpi have hanti : AntitoneOn (fun x : ℝ => (x + Real.sin x * Real.cos x) / Real.sin x) (Set.Ioc 0 (Real.pi / 2)) := by refine antitoneOn_of_deriv_nonpos (convex_Ioc 0 (Real.pi / 2)) ?_ ?_ ?_ · refine ContinuousOn.div (continuous_id.add (Real.continuous_sin.mul Real.continuous_cos)).continuousOn Real.continuous_sin.continuousOn fun x hx => ne_of_gt (Real.sin_pos_of_pos_of_lt_pi hx.1 (by linarith [hx.2])) · refine DifferentiableOn.div (differentiable_id.add (Real.differentiable_sin.mul Real.differentiable_cos)).differentiableOn Real.differentiable_sin.differentiableOn fun x hx => by rw [interior_Ioc] at hx exact ne_of_gt (Real.sin_pos_of_pos_of_lt_pi hx.1 (by linarith [hx.2])) · intro x hx rw [interior_Ioc] at hx have hsin_pos : 0 < Real.sin x := Real.sin_pos_of_pos_of_lt_pi hx.1 (by linarith [hx.2]) have hcos_pos : 0 < Real.cos x := Real.cos_pos_of_mem_Ioo ⟨by linarith [hx.1], hx.2⟩ have hnum : HasDerivAt (fun t : ℝ => t + Real.sin t * Real.cos t) (2 * (Real.cos x) ^ 2) x := by have h := (hasDerivAt_id x).fun_add ((Real.hasDerivAt_sin x).fun_mul (Real.hasDerivAt_cos x)) have hv : 1 + (Real.cos x * Real.cos x + Real.sin x * (-Real.sin x)) = 2 * (Real.cos x) ^ 2 := by have := Real.sin_sq_add_cos_sq x; nlinarith rwa [hv] at h have hq := hnum.fun_div (Real.hasDerivAt_sin x) (ne_of_gt hsin_pos) rw [hq.deriv] have hnum_nonpos : 2 * (Real.cos x) ^ 2 * Real.sin x - (x + Real.sin x * Real.cos x) * Real.cos x ≤ 0 := by have hsin_le_x : Real.sin x ≤ x := Real.sin_le hx.1.le have hsc : Real.sin x * Real.cos x ≤ x := by nlinarith [Real.cos_le_one x] nlinarith exact div_nonpos_of_nonpos_of_nonneg hnum_nonpos (sq_nonneg _) have hle := hanti ⟨hα0, hαpi⟩ ⟨by linarith, le_refl _⟩ hαpi simp only [Real.sin_pi_div_two, Real.cos_pi_div_two, mul_zero, add_zero, div_one] at hle have hsin_pos : 0 < Real.sin α := Real.sin_pos_of_pos_of_lt_pi hα0 (by linarith) exact (le_div_iff₀ hsin_pos).mp hle refine ⟨?_, ?_, ?_⟩ · -- Part 1: K < 4Δ/π -> no positive solution intro K hK hKlt R hR heq unfold uniformPhi at heq split_ifs at heq with hle · rw [uniform_self_consistency_integral] at heq simp only [Real.cos_pi_div_two, mul_zero, add_zero] at heq have hKeq : K = 4 * Δ / Real.pi := by field_simp [ne_of_gt hΔ, ne_of_gt hpi] at heq ⊢ nlinarith linarith · push Not at hle rw [uniform_self_consistency_integral] at heq set α := Real.arcsin (Δ / (K * R)) have hdiv_pos : 0 < Δ / (K * R) := div_pos hΔ (mul_pos hK hR) have hdiv_lt1 : Δ / (K * R) < 1 := (div_lt_one (mul_pos hK hR)).mpr hle have hα0 : 0 < α := Real.arcsin_pos.mpr hdiv_pos have hαpi : α ≤ Real.pi / 2 := Real.arcsin_le_pi_div_two _ have hsinα : Real.sin α = Δ / (K * R) := Real.sin_arcsin (by linarith) hdiv_lt1.le have hKR : K * R = Δ / Real.sin α := by rw [hsinα]; field_simp [ne_of_gt hΔ, ne_of_gt hK, ne_of_gt hR] have hf_le := (hf_inc α hα0 hαpi).2 have hR_val : R = (α + Real.sin α * Real.cos α) / (2 * Real.sin α) := by rw [← heq, hKR] have hsin_pos : 0 < Real.sin α := Real.sin_pos_of_pos_of_lt_pi hα0 (by linarith) field_simp [ne_of_gt hΔ, ne_of_gt hsin_pos] have hK_val : K = 2 * Δ / (α + Real.sin α * Real.cos α) := by have hsin_pos : 0 < Real.sin α := Real.sin_pos_of_pos_of_lt_pi hα0 (by linarith) have hf_pos := (hf_inc α hα0 hαpi).1 rw [hR_val] at hKR field_simp [ne_of_gt hsin_pos, ne_of_gt hf_pos] at hKR ⊢ linarith have hK_ge : 4 * Δ / Real.pi ≤ K := by rw [hK_val] have hf_pos := (hf_inc α hα0 hαpi).1 rw [div_le_div_iff₀ hpi hf_pos] nlinarith linarith · -- Part 2: At K = 4Δ/π, every R ∈ (0, π/4] is a solution intro R hR hRle have hKR_le : (4 * Δ / Real.pi) * R ≤ Δ := by have : (4 * Δ / Real.pi) * R = Δ * (4 * R / Real.pi) := by ring rw [this] have h1 : 4 * R / Real.pi ≤ 1 := by rw [div_le_one hpi]; linarith nlinarith unfold uniformPhi rw [if_pos hKR_le, uniform_self_consistency_integral] simp only [Real.cos_pi_div_two, mul_zero, add_zero] field_simp [ne_of_gt hΔ, ne_of_gt hpi]; ring · -- Part 3: Exact parametric branch for α ∈ (0, π/2] intro α hα0 hαpi dsimp only have hf_pos := (hf_inc α hα0 hαpi).1 have hf_le := (hf_inc α hα0 hαpi).2 have hsin_pos : 0 < Real.sin α := Real.sin_pos_of_pos_of_lt_pi hα0 (by linarith) set K := 2 * Δ / (α + Real.sin α * Real.cos α) set R := (α + Real.sin α * Real.cos α) / (2 * Real.sin α) have hKR : K * R = Δ / Real.sin α := by dsimp [K, R]; field_simp [ne_of_gt hf_pos, ne_of_gt hsin_pos] have hPhi : uniformPhi Δ (K * R) = R := by unfold uniformPhi by_cases hle : K * R ≤ Δ · -- Only possible when sin α = 1, i.e. α = π/2 have hsin_ge : 1 ≤ Real.sin α := by rw [hKR, div_le_iff₀ hsin_pos] at hle; nlinarith have hsin1 : Real.sin α = 1 := le_antisymm (Real.sin_le_one α) hsin_ge have hcos0 : Real.cos α = 0 := by have := Real.sin_sq_add_cos_sq α; rw [hsin1] at this; nlinarith have hαeq : α = Real.pi / 2 := by have := Real.arcsin_sin (by linarith : -(Real.pi / 2) ≤ α) hαpi rw [hsin1, Real.arcsin_one] at this; exact this.symm rw [if_pos hle, uniform_self_consistency_integral] simp only [Real.cos_pi_div_two, mul_zero, add_zero] rw [hKR, hsin1, div_one] dsimp [R]; rw [hαeq, Real.sin_pi_div_two, Real.cos_pi_div_two] field_simp [ne_of_gt hΔ]; ring · rw [if_neg hle, uniform_self_consistency_integral] have hdiv : Δ / (K * R) = Real.sin α := by rw [hKR]; field_simp [ne_of_gt hΔ, ne_of_gt hsin_pos] rw [hdiv, Real.arcsin_sin (by linarith) hαpi, hKR] dsimp [R]; field_simp [ne_of_gt hΔ, ne_of_gt hsin_pos] refine ⟨hPhi, ?_, ?_, ?_⟩ · dsimp [K]; rw [div_le_div_iff₀ hpi hf_pos]; nlinarith · dsimp [R]; rw [div_le_div_iff₀ (by norm_num) (by positivity)] nlinarith [hge_pi_div_four α hα0 hαpi] · dsimp [R]; rw [div_lt_one (by positivity)]; exact hlt_two_sin α hα0 hαpi /-- **Exact Symmetric Bimodal Saddle-Node Phase Transition ($K_c = 2\Delta$, Jump to $1/\sqrt{2}$):** For $\Delta > 0$, $K > 0$, $R > 0$: 1. The self-consistency equation $R = \sqrt{1 - (\Delta/(KR))^2}$ (with $KR \ge \Delta$) is equivalent to the quartic $R^4 - R^2 + (\Delta/K)^2 = 0$; 2. For $K < 2\Delta$, NO positive solution exists; 3. For $K = 2\Delta$, the UNIQUE positive solution is $R = 1/\sqrt{2}$ (exact discontinuous jump from $0$ to $1/\sqrt{2}$!); 4. For $K \ge 2\Delta$, the exact solution set is $\{R_+(K), R_-(K)\}$ where $$R_\pm(K) = \sqrt{\frac{1 \pm \sqrt{1 - (2\Delta/K)^2}}{2}},$$ satisfying $R_+(K)^2 + R_-(K)^2 = 1$, $R_+(K) R_-(K) = \Delta/K$, and $0 < R_-(K) \le 1/\sqrt{2} \le R_+(K) < 1$. -/ theorem bimodal_exact_Kc_and_branches {Δ K : ℝ} (hΔ : 0 < Δ) (hK : 0 < K) : (∀ R : ℝ, 0 < R → ((Δ ≤ K * R ∧ R = Real.sqrt (1 - (Δ / (K * R)) ^ 2)) ↔ R ^ 4 - R ^ 2 + (Δ / K) ^ 2 = 0)) ∧ (K < 2 * Δ → ∀ R : ℝ, 0 < R → R ^ 4 - R ^ 2 + (Δ / K) ^ 2 ≠ 0) ∧ (K = 2 * Δ → ∀ R : ℝ, 0 < R → (R ^ 4 - R ^ 2 + (Δ / K) ^ 2 = 0 ↔ R = 1 / Real.sqrt 2)) ∧ (2 * Δ ≤ K → let D := Real.sqrt (1 - (2 * Δ / K) ^ 2) let Rplus := Real.sqrt ((1 + D) / 2) let Rminus := Real.sqrt ((1 - D) / 2) (Rplus ^ 4 - Rplus ^ 2 + (Δ / K) ^ 2 = 0) ∧ (Rminus ^ 4 - Rminus ^ 2 + (Δ / K) ^ 2 = 0) ∧ (Rplus ^ 2 + Rminus ^ 2 = 1) ∧ (Rplus * Rminus = Δ / K) ∧ (1 / Real.sqrt 2 ≤ Rplus ∧ Rplus < 1) ∧ (0 < Rminus ∧ Rminus ≤ 1 / Real.sqrt 2) ∧ (∀ R : ℝ, 0 < R → R ^ 4 - R ^ 2 + (Δ / K) ^ 2 = 0 → R = Rplus ∨ R = Rminus)) := by refine ⟨?_, ?_, ?_, ?_⟩ · intro R hR have hKR : 0 < K * R := mul_pos hK hR constructor · rintro ⟨hle, heq⟩ have hsub_nn : 0 ≤ 1 - (Δ / (K * R)) ^ 2 := by have h1 : Δ / (K * R) ≤ 1 := (div_le_one hKR).mpr hle have h0 : 0 ≤ Δ / (K * R) := div_nonneg hΔ.le hKR.le nlinarith have hsq : R ^ 2 = 1 - (Δ / (K * R)) ^ 2 := by conv_lhs => rw [heq] exact Real.sq_sqrt hsub_nn field_simp [ne_of_gt hK, ne_of_gt hR] at hsq ⊢ nlinarith · intro hq have hR2 : R ^ 2 = 1 - (Δ / (K * R)) ^ 2 := by field_simp [ne_of_gt hK, ne_of_gt hR] at hq ⊢ nlinarith have hle1 : (Δ / (K * R)) ^ 2 ≤ 1 := by nlinarith [sq_nonneg R] have hdiv_le : Δ / (K * R) ≤ 1 := by have h0 : 0 ≤ Δ / (K * R) := div_nonneg hΔ.le hKR.le nlinarith refine ⟨(div_le_one hKR).mp hdiv_le, ?_⟩ rw [← hR2, Real.sqrt_sq hR.le] · intro hKlt R _ hq have hdisc : (R ^ 2 - 1 / 2) ^ 2 + ((Δ / K) ^ 2 - 1 / 4) = 0 := by linarith have hgt : 1 / 2 < Δ / K := by rw [div_lt_div_iff₀ (by norm_num) hK]; linarith nlinarith [sq_nonneg (R ^ 2 - 1 / 2)] · intro hKeq R hR subst hKeq have hdiv : Δ / (2 * Δ) = 1 / 2 := by field_simp [ne_of_gt hΔ] rw [hdiv] constructor · intro hq have hsq : (R ^ 2 - 1 / 2) ^ 2 = 0 := by linarith have hR2 : R ^ 2 = 1 / 2 := by nlinarith have h1 : (1 / Real.sqrt 2) ^ 2 = 1 / 2 := by rw [div_pow, one_pow, Real.sq_sqrt (by norm_num)] have hpos : 0 < 1 / Real.sqrt 2 := by positivity nlinarith · rintro rfl have h1 : (1 / Real.sqrt 2) ^ 2 = 1 / 2 := by rw [div_pow, one_pow, Real.sq_sqrt (by norm_num)] have h2 : (1 / Real.sqrt 2) ^ 4 = 1 / 4 := by have : (1 / Real.sqrt 2) ^ 4 = ((1 / Real.sqrt 2) ^ 2) ^ 2 := by ring rw [this, h1]; norm_num linarith · intro hKge dsimp only have hratio_le : 2 * Δ / K ≤ 1 := (div_le_one hK).mpr hKge have hratio_pos : 0 < 2 * Δ / K := div_pos (by linarith) hK have hdisc_nn : 0 ≤ 1 - (2 * Δ / K) ^ 2 := by nlinarith set D := Real.sqrt (1 - (2 * Δ / K) ^ 2) have hD_nn : 0 ≤ D := Real.sqrt_nonneg _ have hD_sq : D ^ 2 = 1 - (2 * Δ / K) ^ 2 := Real.sq_sqrt hdisc_nn have hD_lt1 : D < 1 := by have : 1 - (2 * Δ / K) ^ 2 < 1 := by nlinarith calc D < Real.sqrt 1 := Real.sqrt_lt_sqrt hdisc_nn this _ = 1 := Real.sqrt_one set Rp := Real.sqrt ((1 + D) / 2) set Rm := Real.sqrt ((1 - D) / 2) have hRp_sq : Rp ^ 2 = (1 + D) / 2 := Real.sq_sqrt (by linarith) have hRm_sq : Rm ^ 2 = (1 - D) / 2 := Real.sq_sqrt (by linarith) have hRp4 : Rp ^ 4 - Rp ^ 2 + (Δ / K) ^ 2 = 0 := by have : Rp ^ 4 = (Rp ^ 2) ^ 2 := by ring rw [this, hRp_sq] have hD2' : D ^ 2 = 1 - 4 * (Δ / K) ^ 2 := by rw [hD_sq]; ring nlinarith have hRm4 : Rm ^ 4 - Rm ^ 2 + (Δ / K) ^ 2 = 0 := by have : Rm ^ 4 = (Rm ^ 2) ^ 2 := by ring rw [this, hRm_sq] have hD2' : D ^ 2 = 1 - 4 * (Δ / K) ^ 2 := by rw [hD_sq]; ring nlinarith have hprod : Rp * Rm = Δ / K := by have hprod_nn : 0 ≤ Rp * Rm := mul_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) have hsq : (Rp * Rm) ^ 2 = (Δ / K) ^ 2 := by rw [mul_pow, hRp_sq, hRm_sq] have hD2' : D ^ 2 = 1 - 4 * (Δ / K) ^ 2 := by rw [hD_sq]; ring nlinarith have hdiv_nn : 0 ≤ Δ / K := div_nonneg hΔ.le hK.le nlinarith have hhalf_eq : 1 / Real.sqrt 2 = Real.sqrt (1 / 2) := by rw [Real.sqrt_div (by norm_num), Real.sqrt_one] refine ⟨hRp4, hRm4, by rw [hRp_sq, hRm_sq]; ring, hprod, ?_, ?_, ?_⟩ · constructor · rw [hhalf_eq]; exact Real.sqrt_le_sqrt (by linarith) · calc Rp < Real.sqrt 1 := Real.sqrt_lt_sqrt (by linarith) (by linarith) _ = 1 := Real.sqrt_one · constructor · exact Real.sqrt_pos.mpr (by linarith) · rw [hhalf_eq]; exact Real.sqrt_le_sqrt (by linarith) · intro R hR hq have hfac : (R ^ 2 - Rp ^ 2) * (R ^ 2 - Rm ^ 2) = 0 := by have hR4 : R ^ 4 = (R ^ 2) ^ 2 := by ring have hD2' : D ^ 2 = 1 - 4 * (Δ / K) ^ 2 := by rw [hD_sq]; ring have hsum : Rp ^ 2 + Rm ^ 2 = 1 := by rw [hRp_sq, hRm_sq]; ring have hpr : Rp ^ 2 * Rm ^ 2 = (Δ / K) ^ 2 := by rw [hRp_sq, hRm_sq] have : (1 + D) / 2 * ((1 - D) / 2) = (1 - D ^ 2) / 4 := by ring rw [this, hD2']; ring have hid : (R ^ 2 - Rp ^ 2) * (R ^ 2 - Rm ^ 2) = (R ^ 2) ^ 2 - (Rp ^ 2 + Rm ^ 2) * R ^ 2 + Rp ^ 2 * Rm ^ 2 := by ring rw [hid, hsum, hpr, ← hR4]; linarith rcases mul_eq_zero.mp hfac with h1 | h2 · left have hR2 : R ^ 2 = Rp ^ 2 := by linarith rw [← Real.sqrt_sq hR.le, hR2, Real.sqrt_sq (Real.sqrt_nonneg _)] · right have hR2 : R ^ 2 = Rm ^ 2 := by linarith rw [← Real.sqrt_sq hR.le, hR2, Real.sqrt_sq (Real.sqrt_nonneg _)] /-! ## Axiom Audits for Headline Theorems -/ #print axioms cycleTwisted_is_equilibrium #print axioms cycleTwisted_orderParam_zero #print axioms cycleTwisted_directional_deriv #print axioms cycleTwisted_jacobian_eigenvalue #print axioms cycleTwisted_hessian_quad_eq #print axioms wiley_strogatz_girvan_dichotomy #print axioms cos_two_pi_div_five_exact #print axioms twisted_stability_exact_n5_threshold #print axioms open_semicircle_unique_equilibrium #print axioms half_circle_exponential_sync #print axioms completeGraph_diameter_contraction_rate #print axioms lorentzian_self_consistency_integral #print axioms lorentzian_exact_critical_coupling_and_branch #print axioms uniform_self_consistency_integral #print axioms uniform_exact_Kc_and_first_order_jump #print axioms bimodal_exact_Kc_and_branches end TwistedBifurcation