Download data/lean/OAI/Probability/BinarySweep/SparseBounds/FewSparse.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 10.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/SparseBounds/FewSparse.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/BinarySweep/SparseBounds/FewSparse.lean
-
curl -L -o FewSparse.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/SparseBounds/FewSparse.lean
10.3 kB
| import Mathlib | |
| import OAI.Probability.BinarySweep.TensorBounds.SignedPlacement | |
| import OAI.Probability.BinarySweep.SparseBounds.FewSparseBases | |
| import OAI.Probability.BinarySweep.SparseBounds.FewSparseNumerics | |
| import OAI.Probability.BinarySweep.Trajectories.EndpointGood | |
| namespace OAI | |
| noncomputable section | |
| section | |
| open scoped BigOperators Classical | |
| namespace BinaryCoordinateSweeps | |
| section | |
| open Sparse Young Irrep | |
| theorem centeredEndpointHS_few_sparse {b r h k : β} {bits : Fin b β β} | |
| (hb : 1 β€ b) (hbB : b β€ 16000) (hd : βj, r β€ bits j β§ bits j β€ 2*r) | |
| (hL : (10:β)^26 β€ Real.log (gridSize bits)) (hk : 1 β€ k) | |
| (htail : ((k+h:β):β) β€ (gridSize bits:β)^(1599/1600:β)) (hh : h β€ 100000*k) | |
| (H : PathFamily bits h) : | |
| (βx : Placement H k 0, βy : Placement H k (Fin.last b), | |
| (centeredEndpointKernel H 0 (fun i => ((x i).val,(y i).val)))^2) β€ | |
| Real.exp (-(k:β)*Real.log (gridSize bits)/1000000000000) := by | |
| let L := Real.log (gridSize bits) | |
| let Ξ· := Real.exp (-L/160000) | |
| have hs : (0:β) < gridSize bits := by exact_mod_cast gridSize_pos bits | |
| have hL0 : 0 β€ L := (by positivity : (0:β) β€ 10^26).trans hL | |
| obtain β¨hΞ·1,hgβ© := few_eta_good b hbB hL | |
| have hv := few_vertex_base b h k hs hbB hL htail | |
| have hx := few_line_base h h k hs hL htail (by omega) | |
| have hy := few_line_base k h k hs hL htail (by omega) | |
| have he (a : β) (ha : 0 < a) : Real.exp (-L/a) β€ 1 := by | |
| rw [Real.exp_le_one_iff] | |
| exact div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr hL0) ha.le | |
| obtain β¨ht,htv,htlβ© := few_cutoff_bounds b k hb hbB | |
| have hbound := centeredEndpointKernel_few_hs H (fun j => (hd j).2) | |
| (Real.exp_pos (-L/160000)) hΞ·1 (hg.trans (he _ (by norm_num))) | |
| (k/4+1) (k/(8*b)+1) ht (hv.trans (he _ (by norm_num))) | |
| (hx.trans (he _ (by norm_num))) (hy.trans (he _ (by norm_num))) | |
| apply hbound.trans | |
| apply few_hs_scalar b h k (k/4+1) (k/(8*b)+1) | |
| (fun j => (Fintype.card (GridOutside bits j)+1:β)^β2*(k:β)/((2^bits j:β)*Ξ·)ββ) | |
| hbB hk (by exact_mod_cast hh) hL htv htl (by positivity) hg (by positivity) hv | |
| (by positivity) hx (by positivity) hy (fun _ => by positivity) | |
| intro j | |
| convert adaptive_count_small (Fintype.card (GridOutside bits j)) k hs hL | |
| (outside_card_add_one_le bits j) (few_axis_eta_large hbB hd hL j) using 1 | |
| push_cast | |
| rfl | |
| theorem conditional_specht_few_sparse {b r h k : β} {bits : Fin b β β} | |
| (hb : 1 β€ b) (hbB : b β€ 16000) (hd : βj, r β€ bits j β§ bits j β€ 2*r) | |
| (hL : (10:β)^26 β€ Real.log (gridSize bits)) (hk : 1 β€ k) | |
| (htail : ((k+h:β):β) β€ (gridSize bits:β)^(1599/1600:β)) (hh : h β€ 100000*k) | |
| (H : PathFamily bits h) (ΞΌ : YoungDiagram) (e : Cell ΞΌ β FreeSlot H 0) | |
| (a : Tail ΞΌ β Fin k) : | |
| evenMoment 1 (groupAverage ((hilbertSpecht ΞΌ).comp e.symm.permCongrHom.toMonoidHom) | |
| (fun g => (conditionalGroupLaw H 0 g:β))) β€ | |
| Real.exp (-(k:β)*Real.log (gridSize bits)/1000000000000) := | |
| (conditional_specht_hs H ΞΌ e a 0).trans | |
| (centeredEndpointHS_few_sparse hb hbB hd hL hk htail hh H) | |
| end | |
| lemma sparse_tail_le_quarter {s : β} (hs : 0 < s) (hL : (10:β)^26 β€ Real.log s) : | |
| s^(1599/1600:β) β€ s/4 := by | |
| have hc : (4:β) β€ Real.exp (Real.log s/1600) := | |
| (show (4:β) β€ Real.log s/1600+1 from by linarith).trans (Real.add_one_le_exp _) | |
| apply (le_div_iffβ (by norm_num : (0:β)<4)).mpr | |
| calc | |
| _ β€ Real.exp ((1599/1600:β)*Real.log s)*Real.exp (Real.log s/1600) := by | |
| rw [Real.rpow_def_of_pos hs] | |
| simpa only [mul_comm (Real.log s)] using mul_le_mul_of_nonneg_left hc | |
| (Real.exp_pos ((1599/1600:β)*Real.log s)).le | |
| _ = s := by rw [βReal.exp_add,show (1599/1600:β)*Real.log s+Real.log s/1600=Real.log s by ring,Real.exp_log hs] | |
| lemma few_sparse_sign_geometry {b h k : β} {bits : Fin b β β} | |
| (hL : (10:β)^26 β€ Real.log (gridSize bits)) | |
| (htail : ((k+h:β):β) β€ (gridSize bits:β)^(1599/1600:β)) | |
| (j : Fin b) (hj : 2 β€ bits j) : | |
| h+k+Fintype.card (GridOutside bits j) < gridSize bits := by | |
| have hs : (0:β) < gridSize bits := by exact_mod_cast gridSize_pos bits | |
| have hquarter := htail.trans (sparse_tail_le_quarter hs hL) | |
| have ha : 4 β€ 2^bits j := (show 4=2^2 by norm_num) βΈ Nat.pow_le_pow_right (by omega : 1 β€ 2) hj | |
| have ho : 4*Fintype.card (GridOutside bits j) β€ gridSize bits := by | |
| have he := outside_card_mul_axis bits j | |
| nlinarith [Nat.mul_le_mul_left (Fintype.card (GridOutside bits j)) ha] | |
| have hoR : (4:β)*Fintype.card (GridOutside bits j) β€ gridSize bits := by exact_mod_cast ho | |
| have hl : ((h+k+Fintype.card (GridOutside bits j):β):β) < gridSize bits := by | |
| push_cast at hquarter β’ | |
| linarith | |
| exact_mod_cast hl | |
| lemma many_sparse_sign_geometry {b h k : β} {bits : Fin b β β} | |
| (hbase : ((k+h:β):β)*(βj : Fin b, (1:β)/Fintype.card (GridOutside bits j)) < 1) | |
| (j : Fin b) : h+k < Fintype.card (GridOutside bits j) := by | |
| have hp : (0:β) < Fintype.card (GridOutside bits j) := by exact_mod_cast Fintype.card_pos | |
| have he : (1:β)/Fintype.card (GridOutside bits j) β€ | |
| βj : Fin b, (1:β)/Fintype.card (GridOutside bits j) := | |
| Finset.single_le_sum (f := fun j : Fin b => (1:β)/Fintype.card (GridOutside bits j)) (fun _ _ => by positivity) (Finset.mem_univ j) | |
| have hh := (mul_le_mul_of_nonneg_left he (show (0:β) β€ (k+h:β) by positivity)).trans_lt hbase | |
| rw [mul_one_div] at hh | |
| have hl := (div_lt_one hp).mp hh | |
| simpa only [Nat.add_comm] using (show k+h < Fintype.card (GridOutside bits j) by exact_mod_cast hl) | |
| end BinaryCoordinateSweeps | |
| end | |
| open scoped BigOperators Classical | |
| open Filter Topology | |
| namespace BinaryCoordinateSweeps | |
| instance finitePathFamily {b h : β} {bits : Fin b β β} : Finite (PathFamily bits h) := | |
| Finite.of_injective PathFamily.position (by | |
| intro H J he | |
| cases H | |
| cases J | |
| cases he | |
| rfl) | |
| def sparseEndpointBound {b h : β} {bits : Fin b β β} (H : PathFamily bits h) (k : β) (z : β) : Prop := | |
| (βx : Placement H k 0, βy : Placement H k (Fin.last b), | |
| (centeredEndpointKernel H z (fun i => ((x i).val,(y i).val)))^2) β€ | |
| Real.exp (-(k:β)*Real.log (gridSize bits)/2000000000000) β§ | |
| signedCenteredHS H k z β€ Real.exp (-(k:β)*Real.log (gridSize bits)/2000000000000) | |
| lemma sparseEndpointBound_eventually {b r h k : β} {bits : Fin b β β} | |
| (hb : 1 β€ b) (hbB : b β€ 16000) (hr : 2 β€ r) (hd : βj, r β€ bits j β§ bits j β€ 2*r) | |
| (hL : (10:β)^26 β€ Real.log (gridSize bits)) (hk : 1 β€ k) | |
| (htail : ((k+h:β):β) β€ (gridSize bits:β)^(1599/1600:β)) (hh : h β€ 100000*k) | |
| (H : PathFamily bits h) : βαΆ z in π 0, sparseEndpointBound H k z := by | |
| have hbound := centeredEndpointHS_few_sparse hb hbB hd hL hk htail hh H | |
| have hstrict : (βx : Placement H k 0, βy : Placement H k (Fin.last b), | |
| (centeredEndpointKernel H 0 (fun i => ((x i).val,(y i).val)))^2) < | |
| Real.exp (-(k:β)*Real.log (gridSize bits)/2000000000000) := by | |
| apply hbound.trans_lt (Real.exp_lt_exp.mpr ?_) | |
| have hkR : (0:β) < k := by exact_mod_cast hk | |
| have hKL : 0 < (k:β)*Real.log (gridSize bits) := mul_pos hkR (by linarith) | |
| linarith | |
| let j : Fin b := β¨0,by omegaβ© | |
| have hgeom := few_sparse_sign_geometry hL htail j (hr.trans (hd j).1) | |
| have hzero : signedCenteredHS H k 0=0 := signedCenteredHS_zero H k 0 (fun l hl x y => | |
| signedPlacementEntry_zero_few H j (by omega) x y) | |
| have hsigned : signedCenteredHS H k 0 < Real.exp (-(k:β)*Real.log (gridSize bits)/2000000000000) := by | |
| rw [hzero] | |
| exact Real.exp_pos _ | |
| filter_upwards [(continuousAt_centeredEndpointHS H k).eventually_lt continuousAt_const hstrict, (continuousAt_signedCenteredHS H k).eventually_lt continuousAt_const hsigned] with z h1 h2 | |
| exact β¨h1.le,h2.leβ© | |
| theorem sparse_finite_radius (r : β) (hr : 2 β€ r) : | |
| β Ξ΄ : β, 0 < Ξ΄ β§ β b : β, 1 β€ b β b β€ 16000 β | |
| βbits : Fin b β β, (βj, r β€ bits j β§ bits j β€ 2*r) β | |
| βh k : β, h β€ gridSize bits β k β€ gridSize bits β | |
| (10:β)^26 β€ Real.log (gridSize bits) β 1 β€ k β | |
| ((k+h:β):β) β€ (gridSize bits:β)^(1599/1600:β) β h β€ 100000*k β | |
| βH : PathFamily bits h, βz : β, 0 β€ z β z β€ Ξ΄ β sparseEndpointBound H k z := by | |
| have hev : βαΆ z : β in π 0, | |
| βb : Fin 16001, βds : Fin b.val β Fin (2*r+1), | |
| βh : Fin (gridSize (fun j => (ds j).val)+1), | |
| βk : Fin (gridSize (fun j => (ds j).val)+1), | |
| βH : PathFamily (fun j => (ds j).val) h.val, | |
| (1 β€ b.val β§ (βj, r β€ (ds j).val) β§ | |
| (10:β)^26 β€ Real.log (gridSize (fun j => (ds j).val)) β§ 1 β€ k.val β§ | |
| ((k.val+h.val:β):β) β€ (gridSize (fun j => (ds j).val):β)^(1599/1600:β) β§ | |
| h.val β€ 100000*k.val) β sparseEndpointBound H k.val z := by | |
| apply eventually_all.mpr | |
| intro b | |
| apply eventually_all.mpr | |
| intro ds | |
| apply eventually_all.mpr | |
| intro h | |
| apply eventually_all.mpr | |
| intro k | |
| apply eventually_all.mpr | |
| intro H | |
| by_cases hc : 1 β€ b.val β§ (βj, r β€ (ds j).val) β§ | |
| (10:β)^26 β€ Real.log (gridSize (fun j => (ds j).val)) β§ 1 β€ k.val β§ | |
| ((k.val+h.val:β):β) β€ (gridSize (fun j => (ds j).val):β)^(1599/1600:β) β§ | |
| h.val β€ 100000*k.val | |
| Β· filter_upwards [sparseEndpointBound_eventually hc.1 (by omega) hr (fun j => β¨hc.2.1 j,by have := (ds j).isLt; omegaβ©) hc.2.2.1 hc.2.2.2.1 hc.2.2.2.2.1 hc.2.2.2.2.2 H] with z hz | |
| exact fun _ => hz | |
| Β· exact Eventually.of_forall (fun _ h => False.elim (hc h)) | |
| obtain β¨Ξ΅,hΞ΅,heβ© := Metric.eventually_nhds_iff.mp hev | |
| refine β¨Ξ΅/2,by linarith,?_β© | |
| intro b hb hbB bits hd h k hh hk hL hk0 htail hholes H z hz hze | |
| have hdist : dist z 0 < Ξ΅ := by rw [Real.dist_eq,sub_zero,abs_of_nonneg hz]; linarith | |
| exact he hdist β¨b,by omegaβ© (fun j => β¨bits j,(hd j).2.trans_lt (Nat.lt_succ_self _)β©) | |
| β¨h,by change h < gridSize bits+1; omegaβ© β¨k,by change k < gridSize bits+1; omegaβ© H β¨hb,fun j => (hd j).1,hL,hk0,htail,hholesβ© | |
| end BinaryCoordinateSweeps | |
| end | |
| end OAI | |