math / data /lean /OAI /Analysis /HardSphere /PathBounds /VisitCounts.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
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