Download data/lean/OAI/Analysis/HardSphere/PathBounds/VisitCounts.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/HardSphere/PathBounds/VisitCounts.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/HardSphere/PathBounds/VisitCounts.lean
-
curl -L -o VisitCounts.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/HardSphere/PathBounds/VisitCounts.lean
9.9 kB
| import Mathlib | |
| import OAI.Analysis.HardSphere.Allocation.Allocation | |
| import OAI.Analysis.HardSphere.PathBounds.InteractingVisits | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal NNReal Topology BigOperators | |
| namespace HardSphere.FreeVisits | |
| open HardSphere.Wiener HardSphere.BathSlice HardSphere.Lattice HardSphere.CellOrbital | |
| def visitorCount {n K : β} (L : Length) (E : Set (ConfigurationPath 1 L)) | |
| (v : DiscreteTorus K) (Ο : ConfigurationPath n L) : β := by | |
| classical | |
| exact (Finset.univ.filter (fun i : Fin n β¦ onePathAt i ΟβE β§ pathVisitsBall L 12 (siteCenter L v) i Ο)).card | |
| lemma visitorCount_sum {n K : β} (L : Length) (A : Finset (DiscreteTorus K)) | |
| (E : Set (ConfigurationPath 1 L)) (Ο : ConfigurationPath n L) : | |
| (βvβA,visitorCount L E v Ο)=defectiveTotalVisits L A E Ο := by | |
| classical | |
| simp only [visitorCount,Finset.card_filter] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| by_cases hi : onePathAt i ΟβE | |
| Β· simp only [hi,true_and,pathVisitedSites,ite_eq_left,Finset.card_filter] | |
| Β· simp only [hi,false_and,ite_false,Finset.sum_const_zero,pathVisitedSites] | |
| lemma visitorCount_measurable {n K : β} (L : Length) {E : Set (ConfigurationPath 1 L)} | |
| (hE : MeasurableSet E) (v : DiscreteTorus K) : Measurable (visitorCount (n:=n) L E v) := by | |
| classical | |
| have he : visitorCount (n:=n) L E v=(fun Ο β¦ βi : Fin n, if onePathAt i ΟβE β§ pathVisitsBall L 12 (siteCenter L v) i Ο then (1:β) else 0) := by | |
| funext Ο | |
| simp only [visitorCount,Finset.card_filter] | |
| rw [he] | |
| apply Finset.measurable_fun_sum | |
| intro i _ | |
| have hi : MeasurableSet {Ο : ConfigurationPath n L | onePathAt i ΟβE} := hE.preimage (onePathAt_continuous i).measurable | |
| exact measurable_const.ite (hi.inter (pathVisitsBall_isClosed L 12 (siteCenter L v) i).measurableSet) measurable_const | |
| lemma defectiveTotalVisits_measurable {n K : β} (L : Length) (A : Finset (DiscreteTorus K)) | |
| {E : Set (ConfigurationPath 1 L)} (hE : MeasurableSet E) : Measurable (defectiveTotalVisits (n:=n) L A E) := by | |
| have he : defectiveTotalVisits (n:=n) L A E=fun Ο β¦ βvβA,visitorCount L E v Ο := by | |
| funext Ο; exact (visitorCount_sum L A E Ο).symm | |
| rw [he] | |
| exact Finset.measurable_fun_sum _ (fun v _ β¦ visitorCount_measurable L hE v) | |
| lemma joint_visitor_sum {n K : β} (L : Length) (A : Finset (DiscreteTorus K)) | |
| (E : Set (ConfigurationPath 1 L)) {H : β} {Ο : ConfigurationPath n L} | |
| (h : βvβA,Hβ€(visitorCount L E v Ο:β)) : | |
| H*(A.card:β)β€(defectiveTotalVisits L A E Ο:β) := by | |
| rw [βvisitorCount_sum L A E Ο,Nat.cast_sum] | |
| have hs := Finset.sum_le_sum h | |
| simpa only [Finset.sum_const,nsmul_eq_mul,mul_comm] using hs | |
| lemma joint_visitors_markov {n K : β} (L : Length) (A : Finset (DiscreteTorus K)) | |
| {E : Set (ConfigurationPath 1 L)} (hE : MeasurableSet E) | |
| (ΞΌ : Measure (ConfigurationPath n L)) {Ξ· H Q : β} (hΞ· : 0β€Ξ·) | |
| (hmgf : (β«β»Ο,ENNReal.ofReal (Real.exp (Ξ·*(defectiveTotalVisits L A E Ο:β))) βΞΌ)β€ | |
| ENNReal.ofReal (Real.exp (Q*(A.card:β)))) : | |
| ΞΌ {Ο | βvβA,Hβ€(visitorCount L E v Ο:β)}β€ENNReal.ofReal (Real.exp ((Q-Ξ·*H)*(A.card:β))) := by | |
| let F := fun Ο : ConfigurationPath n L β¦ ENNReal.ofReal (Real.exp (Ξ·*(defectiveTotalVisits L A E Ο:β))) | |
| have hc : Measurable (fun k : β β¦ (k:β)) := measurable_of_countable _ | |
| have hF : Measurable F := ((measurable_const.mul (hc.comp (defectiveTotalVisits_measurable L A hE))).exp).ennreal_ofReal | |
| have hp : ENNReal.ofReal (Real.exp (Ξ·*(H*(A.card:β))))β 0 := ne_of_gt (ENNReal.ofReal_pos.mpr (Real.exp_pos _)) | |
| have hm := meas_ge_le_lintegral_div (ΞΌ:=ΞΌ) hF.aemeasurable hp ENNReal.ofReal_ne_top | |
| calc | |
| _ β€ ΞΌ {Ο | ENNReal.ofReal (Real.exp (Ξ·*(H*(A.card:β))))β€F Ο} := by | |
| apply measure_mono | |
| intro Ο hΟ | |
| apply ENNReal.ofReal_le_ofReal | |
| apply Real.exp_le_exp.mpr | |
| exact mul_le_mul_of_nonneg_left (joint_visitor_sum L A E hΟ) hΞ· | |
| _ β€ _ := hm | |
| _ β€ ENNReal.ofReal (Real.exp (Q*(A.card:β)))/ENNReal.ofReal (Real.exp (Ξ·*(H*(A.card:β)))) := ENNReal.div_le_div_right hmgf _ | |
| _ = _ := by | |
| rw [βENNReal.ofReal_div_of_pos (Real.exp_pos _),βReal.exp_sub] | |
| congr 2 | |
| ring | |
| end HardSphere.FreeVisits | |
| end | |
| end | |
| section | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Set | |
| open scoped ENNReal NNReal Topology BigOperators | |
| namespace HardSphere.Groups | |
| open Wiener CellOrbital PathCutoff FreeVisits | |
| attribute [local instance] Classical.propDecidable | |
| lemma centeredCell_distance {L : Length} {c x : Torus L} (hx : xβcenteredCell L c) : | |
| torusDistance L x cβ€1 := by | |
| have hd (j : Fin 3) : dist (x j) (c j)β€(1/2:β) := by | |
| rw [dist_eq_norm,βcentered_rep_abs] | |
| exact abs_le.mpr β¨by linarith [(hx j).1], (hx j).2.leβ© | |
| unfold torusDistance | |
| apply Real.sqrt_le_one.mpr | |
| calc | |
| _ β€ β _j : Fin 3,(1/4:β) := Finset.sum_le_sum (fun j _ β¦ by nlinarith [dist_nonneg (x:=x j) (y:=c j),hd j]) | |
| _ β€ 1 := by norm_num | |
| @[simp] lemma intervalTime_zero_one (s : Time) : intervalTime 0 1 s=s := by | |
| apply Subtype.ext | |
| simp [intervalTime] | |
| lemma smallDiameter_distance {L : Length} (Ο : ConfigurationPath 1 L) | |
| (h : intervalDiameter 0 1 Οβ€1) (s q : Time) : torusDistance L (Ο s 0) (Ο q 0)β€1 := by | |
| have hh := (intervalDistance_le 0 1 s q Ο).trans h | |
| simpa only [intervalTime_zero_one] using hh | |
| def longVisitors {N : β} {L : Length} (c : Torus L) (Ο : ConfigurationPath N L) : Finset (Fin N) := | |
| Finset.univ.filter (fun i β¦ pathVisitsBall L 12 c i Ο β§ 1 < intervalDiameter 0 1 (onePathAt i Ο)) | |
| def visitors {N : β} {L : Length} (c : Torus L) (Ο : ConfigurationPath N L) : Finset (Fin N) := | |
| Finset.univ.filter (fun i β¦ pathVisitsBall L 12 c i Ο) | |
| structure Certificate {N K : β} [Nontrivial (Fin N)] {L : Length} | |
| (m : β) (r R C S sβ ell ΞΈ H D : β) (u : Time) (v : Fin 3βFin K) | |
| (Ο : ConfigurationPath N L) : Prop where | |
| low : ell*Dβ€(centeredCount L (gridCenter L v) (Ο 0):β) | |
| closeY : ((localCloseLabels L sβ (gridCenter L v) (Ο 0)).card:β)<ΞΈ*D | |
| closeZ : ((localCloseLabels L sβ (gridCenter L v) (Ο 1)).card:β)<ΞΈ*D | |
| visit : ((visitors (gridCenter L v) Ο).card:β)β€H*D | |
| regular : βi,pathVisitsBall L 12 (gridCenter L v) i ΟβRegular m r R C u S (onePathAt i Ο) | |
| long : ((longVisitors (gridCenter L v) Ο).card:β)<ΞΈ*D | |
| lemma eligible_of_not_discarded {N K : β} [Nontrivial (Fin N)] {L : Length} | |
| (m : β) (r R C S sβ : β) (u : Time) (v : Fin 3βFin K) (Ο : ConfigurationPath N L) | |
| (hreg : βi,pathVisitsBall L 12 (gridCenter L v) i ΟβRegular m r R C u S (onePathAt i Ο)) | |
| (i : Fin N) (hy : Ο 0 iβcenteredCell L (gridCenter L v)) | |
| (hY : iβlocalCloseLabels L sβ (gridCenter L v) (Ο 0)) | |
| (hZ : iβlocalCloseLabels L sβ (gridCenter L v) (Ο 1)) | |
| (hshort : iβlongVisitors (gridCenter L v) Ο) : Eligible m r R C S sβ u v i Ο := by | |
| have hyc := centeredCell_distance hy | |
| have hv : pathVisitsBall L 12 (gridCenter L v) i Ο := β¨0,by linarithβ© | |
| have hsmall : intervalDiameter 0 1 (onePathAt i Ο)β€1 := by | |
| by_contra! h | |
| exact hshort (Finset.mem_filter.mpr β¨Finset.mem_univ _,hv,hβ©) | |
| have hd (s : Time) : torusDistance L (Ο s i) (Ο 0 i)β€1 := smallDiameter_distance (onePathAt i Ο) hsmall s 0 | |
| have hc (s : Time) : torusDistance L (Ο s i) (gridCenter L v)β€2 := by | |
| have hh := torusDistance_triangle' L (Ο s i) (Ο 0 i) (gridCenter L v) | |
| linarith [hd s] | |
| have hNY : sβ<nearestParticleDistance L (Ο 0) i := by | |
| by_contra! hh | |
| apply hY | |
| exact Finset.mem_filter.mpr β¨Finset.mem_univ _,by linarith,hhβ© | |
| have hNZ : sβ<nearestParticleDistance L (Ο 1) i := by | |
| by_contra! hh | |
| apply hZ | |
| exact Finset.mem_filter.mpr β¨Finset.mem_univ _,by linarith [hc 1],hhβ© | |
| refine β¨β¨hy,by linarith [hc 1],?_β©,hreg i hv,?_β© | |
| Β· intro j hji | |
| exact β¨hNY.trans_le (nearestParticleDistance_le L (Ο 0) i j hji), | |
| hNZ.trans_le (nearestParticleDistance_le L (Ο 1) i j hji)β© | |
| Β· intro s | |
| exact (hc s).trans (by norm_num) | |
| lemma certificate_eligible_count {N K : β} [Nontrivial (Fin N)] {L : Length} | |
| (m : β) (r R C S sβ ell ΞΈ H D : β) (u : Time) (v : Fin 3βFin K) | |
| (Ο : ConfigurationPath N L) (h : Certificate m r R C S sβ ell ΞΈ H D u v Ο) : | |
| (ell-3*ΞΈ)*Dβ€((eligibleList m r R C S sβ u v Ο).card:β) := by | |
| let E := eligibleList m r R C S sβ u v Ο | |
| let A := localCloseLabels L sβ (gridCenter L v) (Ο 0) | |
| let B := localCloseLabels L sβ (gridCenter L v) (Ο 1) | |
| let T := longVisitors (gridCenter L v) Ο | |
| have hsub : Finset.univ.filter (fun i β¦ Ο 0 iβcenteredCell L (gridCenter L v))β((EβͺA)βͺB)βͺT := by | |
| intro i hi | |
| by_cases he : iβE | |
| Β· simp [he] | |
| by_cases ha : iβA | |
| Β· simp [ha] | |
| by_cases hb : iβB | |
| Β· simp [hb] | |
| by_cases ht : iβT | |
| Β· simp [ht] | |
| exfalso | |
| exact he (Finset.mem_filter.mpr β¨Finset.mem_univ _,eligible_of_not_discarded m r R C S sβ u v Ο | |
| h.regular i (Finset.mem_filter.mp hi).2 ha hb htβ©) | |
| have hcard : centeredCount L (gridCenter L v) (Ο 0)β€E.card+A.card+B.card+T.card := by | |
| apply (Finset.card_le_card hsub).trans | |
| exact (Finset.card_union_le _ _).trans (Nat.add_le_add_right | |
| ((Finset.card_union_le _ _).trans (Nat.add_le_add_right (Finset.card_union_le _ _) _)) _) | |
| have hc : (centeredCount L (gridCenter L v) (Ο 0):β)β€(E.card:β)+(A.card:β)+(B.card:β)+(T.card:β) := by exact_mod_cast hcard | |
| have h1 := h.low | |
| have h2 := h.closeY | |
| have h3 := h.closeZ | |
| have h4 := h.long | |
| change _β€(E.card:β) | |
| change (A.card:β)<ΞΈ*D at h2 | |
| change (B.card:β)<ΞΈ*D at h3 | |
| change (T.card:β)<ΞΈ*D at h4 | |
| nlinarith | |
| end HardSphere.Groups | |
| end | |
| end | |
| end | |
| end OAI | |