import Mathlib import OAI.Probability.SKBarriers.SpinGlass.Basic namespace OAI section noncomputable section open scoped BigOperators InnerProductSpace open MeasureTheory ProbabilityTheory Filter Set namespace SK.Analytic theorem finite_unit_packing {E I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [DecidableEq I] (S : Finset I) (u : I → E) (w : E) (b e : ℝ) (hb : 0 spin (x i)/Real.sqrt n) theorem spinUnitVector_inner {n : ℕ} (x y : Config n) : ⟪spinUnitVector x,spinUnitVector y⟫_ℝ=overlap x y := by change (∑ i : Fin n,(spin (y i)/Real.sqrt n)*(spin (x i)/Real.sqrt n))=overlap x y simp only [div_mul_div_comm,← sq,Real.sq_sqrt (Nat.cast_nonneg n),← Finset.sum_div] exact congrArg (fun z : ℝ => z/(n:ℝ)) (Finset.sum_congr rfl (fun i _ => mul_comm _ _)) @[simp] theorem overlap_flip_first {n : ℕ} (x y : Config n) : overlap (flip x) y = -overlap x y := by rw [overlap_comm,overlap_flip_right,overlap_comm x y] theorem overlap_conflict_card {n : ℕ} (hn : 0 spinUnitVector (u i)) (spinUnitVector w) b e hb he heb · rw [spinUnitVector_inner,overlap_self hn] · intro i hi; rw [spinUnitVector_inner,overlap_self hn] · intro i hi j hj hij rw [spinUnitVector_inner] have h := hpair i hi j hj hij dsimp only [u] split_ifs <;> (try simp only [overlap_flip_first,overlap_flip_right,neg_neg]) <;> linarith only [(abs_le.mp h).1,(abs_le.mp h).2] · intro i hi rw [spinUnitVector_inner] dsimp only [u] split_ifs with h · simpa only [abs_of_nonneg h] using hlarge i hi · simpa only [overlap_flip_first,abs_of_neg (lt_of_not_ge h)] using hlarge i hi end SK.Analytic end end end OAI