Buckets:
| import Mathlib | |
| import OAI.Combinatorics.RamseyFive.Geometry.Q | |
| namespace OAI | |
| open MeasureTheory ProbabilityTheory | |
| open scoped BigOperators NNReal | |
| namespace SharpRamseyFive.CellVariance | |
| open Module SharpRamseyFive.ProjectiveIncidence | |
| open scoped BigOperators LinearAlgebra.Projectivization Classical | |
| lemma sum_shift_square {I : Type*} [Fintype I] (f : I → ℝ) (a b : ℝ) : | |
| (∑ i,(f i-b)^2) ≤ 2*(∑ i,(f i-a)^2)+2*Fintype.card I*(a-b)^2 := by | |
| calc | |
| _ ≤ ∑ i,(2*(f i-a)^2+2*(a-b)^2) := Finset.sum_le_sum fun i _ => by | |
| nlinarith [sq_nonneg ((f i-a)-(a-b))] | |
| _ = _ := by simp only [Finset.sum_add_distrib,← Finset.mul_sum, | |
| Finset.sum_const,Finset.card_univ,nsmul_eq_mul]; ring | |
| variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] | |
| [Finite K] [FiniteDimensional K V] | |
| [Fintype (ℙ K V)] [Fintype (ℙ K (Module.Dual K V))] | |
| noncomputable def cellMass (C : Finset (ℙ K V)) (δ : ℝ) (b : ℙ K (Module.Dual K V)) : ℝ := | |
| δ*(C.filter fun a => Incident a b).card | |
| omit [Finite K] [FiniteDimensional K V] [Fintype (ℙ K (Module.Dual K V))] in | |
| lemma weight_indicator (C : Finset (ℙ K V)) (δ : ℝ) (b : ℙ K (Module.Dual K V)) : | |
| weightOnHyperplane (fun a => if a ∈ C then δ else 0) b = cellMass C δ b := by | |
| simp only [weightOnHyperplane,mul_ite,mul_zero,Finset.sum_ite_mem,Finset.univ_inter] | |
| rw [← Finset.sum_mul] | |
| have he : (∑ a ∈ C,incidenceEntry a b) = ((C.filter fun a => Incident a b).card:ℝ) := by | |
| exact Finset.sum_boole _ _ | |
| rw [he,cellMass,mul_comm] | |
| theorem cell_variance {d : ℕ} (hdim : finrank K V = d+1) (hd : 1 ≤ d) | |
| (C : Finset (ℙ K V)) (δ : ℝ) : | |
| ∑ b,(cellMass C δ b - δ*C.card/(Nat.card K:ℝ))^2 ≤ | |
| 4*δ^2*(Nat.card K:ℝ)^(d-1)*C.card := by | |
| let q : ℝ := Nat.card K | |
| let N : ℝ := Q (Nat.card K) d | |
| let c : ℝ := C.card | |
| let p : ℝ := (Q (Nat.card K) (d-1):ℝ)/N | |
| have hq : 1 ≤ q := by dsimp [q]; exact_mod_cast (Finite.one_lt_card (α:=K)).le | |
| have hN : 0 < N := by dsimp [N]; exact_mod_cast Q_pos (Nat.card K) d | |
| have hc : 0 ≤ c := by dsimp [c]; positivity | |
| have hcN : c ≤ N := by | |
| dsimp [c,N] | |
| exact_mod_cast (C.card_le_univ.trans_eq (card_points hdim)) | |
| have hp : p-1/q = -(1/(q*N)) := by | |
| dsimp [p] | |
| have hr : N = q*(Q (Nat.card K) (d-1):ℝ)+1 := by | |
| dsimp [N,q] | |
| exact_mod_cast Q_recurrence (q:=Nat.card K) hd | |
| field_simp | |
| nlinarith | |
| let w : ℙ K V → ℝ := fun a => if a ∈ C then δ else 0 | |
| have hsum : (∑ a,w a) = δ*c := by simp [w,c,Finset.sum_ite_mem,mul_comm] | |
| have hsq : (∑ a,w a^2) = δ^2*c := by simp [w,c,Finset.sum_ite_mem,mul_comm] | |
| have hv := incidence_variance hdim hd w | |
| rw [hsum,hsq] at hv | |
| simp_rw [show ∀ b,weightOnHyperplane w b = cellMass C δ b from fun b => weight_indicator C δ b] at hv | |
| change (∑ b,(cellMass C δ b-p*(δ*c))^2) ≤ q^(d-1)*(δ^2*c) at hv | |
| have he : p*(δ*c)-δ*c/q = -(δ*c/(q*N)) := by | |
| calc | |
| _ = (p-1/q)*(δ*c) := by ring | |
| _ = _ := by rw [hp]; ring | |
| have hcor : N*(p*(δ*c)-δ*c/q)^2 ≤ δ^2*c := by | |
| rw [he] | |
| have heq : N*(-(δ*c/(q*N)))^2 = δ^2*c^2/(q^2*N) := by | |
| have hq0 : q ≠ 0 := by linarith | |
| field_simp | |
| rw [heq] | |
| apply (div_le_iff₀ (by positivity : 0 < q^2*N)).mpr | |
| have hq2 : 1 ≤ q^2 := by nlinarith | |
| have hbound : c ≤ q^2*N := hcN.trans (by nlinarith) | |
| have hh := mul_le_mul_of_nonneg_left hbound (mul_nonneg (sq_nonneg δ) hc) | |
| nlinarith | |
| have hpow : 1 ≤ q^(d-1) := one_le_pow₀ hq | |
| have hs := sum_shift_square (cellMass C δ) (p*(δ*c)) (δ*c/q) | |
| rw [card_hyperplanes hdim] at hs | |
| change (∑ b,(cellMass C δ b-δ*c/q)^2) ≤ 2*(∑ b,(cellMass C δ b-p*(δ*c))^2)+ | |
| 2*N*(p*(δ*c)-δ*c/q)^2 at hs | |
| change (∑ b,(cellMass C δ b-δ*c/q)^2) ≤ 4*δ^2*q^(d-1)*c | |
| have hh := mul_le_mul_of_nonneg_right hpow (mul_nonneg (sq_nonneg δ) hc) | |
| nlinarith | |
| end SharpRamseyFive.CellVariance | |
| end OAI | |
Xet Storage Details
- Size:
- 3.92 kB
- Xet hash:
- 59585577f9e0b2f0f59fe74b6340e14c424c6dba9210e531bbb8a86f7f74ec16
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.