Download data/lean/OAI/Probability/SKBarriers/Dynamics/ConflictPacking.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.99 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKBarriers/Dynamics/ConflictPacking.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKBarriers/Dynamics/ConflictPacking.lean
-
curl -L -o ConflictPacking.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKBarriers/Dynamics/ConflictPacking.lean
4.99 kB
| import Mathlib | |
| import OAI.Probability.SKBarriers.SpinGlass.Basic | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open scoped BigOperators | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| namespace SK.Analytic | |
| open scoped InnerProductSpace | |
| theorem unit_conflict_packing {E : Type*} [NormedAddCommGroup E] [InnerProductSpace β E] | |
| {d : β} (hd : 0 < d) (u : Fin d β E) (w : E) {a b : β} | |
| (hb : 0 < b) (ha : 0 β€ a) (hab : a < b^2/2) | |
| (hu : β i, βu iβ = 1) (hw : βwβ = 1) | |
| (hoff : β i j, i β j β βͺu i,u jβ«_β β€ a) | |
| (hconf : β i, b < βͺu i,wβ«_β) : (d:β) < 2/b^2 := by | |
| classical | |
| let U := β i, u i | |
| have hdR : 0 < (d:β) := by exact_mod_cast hd | |
| have hsum : (d:β)*b < βͺU,wβ«_β := by | |
| dsimp only [U] | |
| rw [sum_inner] | |
| have H := Finset.sum_lt_sum_of_nonempty (s := (Finset.univ : Finset (Fin d))) | |
| (Finset.univ_nonempty_iff.mpr β¨β¨0,hdβ©β©) (fun i _ => hconf i) | |
| simpa only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] using H | |
| have hCS : βͺU,wβ«_β β€ βUβ := by simpa only [hw,mul_one] using real_inner_le_norm U w | |
| have hdiag (i : Fin d) : (β j : Fin d, βͺu i,u jβ«_β) β€ 1+((d:β)-1)*a := by | |
| have H := Finset.sum_le_sum (s := (Finset.univ : Finset (Fin d))) | |
| (g := fun j => if i=j then (1:β) else a) (fun j _ => show βͺu i,u jβ«_β β€ (if i=j then 1 else a) from by | |
| by_cases hij : i=j | |
| Β· subst j; simp only [ite_true,real_inner_self_eq_norm_sq,hu,one_pow,le_refl] | |
| Β· simp only [ite_eq_right hij]; exact hoff i j hij) | |
| have he : (β j : Fin d, if i=j then (1:β) else a) = 1+((d:β)-1)*a := by | |
| have hh (j : Fin d) : (if i=j then (1:β) else a) = a+(if i=j then 1-a else 0) := by split_ifs <;> ring | |
| simp_rw [hh] | |
| simp only [Finset.sum_add_distrib,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul, | |
| Finset.sum_ite_eq,Finset.mem_univ,ite_true] | |
| ring | |
| rwa [he] at H | |
| have hnorm : βUβ^2 β€ (d:β)+(d:β)*((d:β)-1)*a := by | |
| rw [β real_inner_self_eq_norm_sq] | |
| dsimp only [U] | |
| rw [sum_inner] | |
| simp_rw [inner_sum] | |
| have H := Finset.sum_le_sum (fun i (_ : i β (Finset.univ : Finset (Fin d))) => hdiag i) | |
| simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] at H | |
| nlinarith [H] | |
| have hqlt : ((d:β)*b)^2 < βUβ^2 := sq_lt_sqβ (by positivity) (norm_nonneg _) |>.mpr (hsum.trans_le hCS) | |
| have hdb : (d:β)*b^2 < 1+((d:β)-1)*a := by | |
| have H : (d:β)*((d:β)*b^2) < (d:β)*(1+((d:β)-1)*a) := by nlinarith [hqlt,hnorm] | |
| exact (mul_lt_mul_iff_rightβ hdR).mp H | |
| have hdiff : b^2-a > b^2/2 := by linarith | |
| have H : (d:β)*(b^2-a) < 1-a := by nlinarith [hdb] | |
| have H' : (d:β)*(b^2/2) < 1 := by nlinarith [mul_lt_mul_of_pos_left hdiff hdR,H] | |
| apply (lt_div_iffβ (sq_pos_of_pos hb)).mpr | |
| nlinarith | |
| def configVector {n : β} (x : Config n) : EuclideanSpace β (Fin n) := | |
| WithLp.toLp 2 (fun i => spin (x i)/Real.sqrt (n:β)) | |
| theorem configVector_inner {n : β} (hn : 0 < n) (x y : Config n) : | |
| βͺconfigVector x,configVector yβ«_β = overlap x y := by | |
| rw [configVector,configVector,EuclideanSpace.inner_toLp_toLp] | |
| simp only [dotProduct,Pi.star_apply,star_trivial] | |
| have hn0 : 0 β€ (n:β) := by positivity | |
| have he (i : Fin n) : spin (y i)/Real.sqrt (n:β)*(spin (x i)/Real.sqrt (n:β)) = | |
| (spin (x i)*spin (y i))/(n:β) := by | |
| rw [div_mul_div_comm,Real.mul_self_sqrt hn0,mul_comm (spin (y i))] | |
| simp_rw [he] | |
| rw [β Finset.sum_div] | |
| rfl | |
| theorem configVector_norm {n : β} (hn : 0 < n) (x : Config n) : βconfigVector xβ = 1 := by | |
| have H := configVector_inner hn x x | |
| rw [real_inner_self_eq_norm_sq,overlap_self hn] at H | |
| nlinarith [norm_nonneg (configVector x)] | |
| theorem config_conflict_packing {n d : β} (hn : 0 < n) (hd : 0 < d) | |
| (x : Fin d β Config n) (w : Config n) {a b : β} | |
| (hb : 0 < b) (ha : 0 β€ a) (hab : a < b^2/2) | |
| (hoff : β i j, i β j β |overlap (x i) (x j)| β€ a) | |
| (hconf : β i, b < |overlap (x i) w|) : (d:β) < 2/b^2 := by | |
| let u : Fin d β EuclideanSpace β (Fin n) := fun i => | |
| if 0 β€ overlap (x i) w then configVector (x i) else -configVector (x i) | |
| apply unit_conflict_packing hd u (configVector w) hb ha hab | |
| Β· intro i | |
| dsimp only [u] | |
| split_ifs <;> simp only [norm_neg,configVector_norm hn] | |
| Β· exact configVector_norm hn w | |
| Β· intro i j hij | |
| have H := hoff i j hij | |
| have HP := (le_abs_self (overlap (x i) (x j))).trans H | |
| have HN := (neg_le_abs (overlap (x i) (x j))).trans H | |
| dsimp only [u] | |
| split_ifs <;> simp only [inner_neg_left,inner_neg_right,configVector_inner hn,neg_neg] <;> assumption | |
| Β· intro i | |
| dsimp only [u] | |
| split_ifs with hs | |
| Β· simpa only [configVector_inner hn,abs_of_nonneg hs] using hconf i | |
| Β· simpa only [inner_neg_left,configVector_inner hn,abs_of_neg (lt_of_not_ge hs)] using hconf i | |
| end SK.Analytic | |
| end | |
| end | |
| end | |
| end OAI | |