import Mathlib import OAI.Analysis.HardSphere.PathBounds.InteractingVisits namespace OAI section section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology BigOperators namespace HardSphere.ShiftVisits open HardSphere.Wiener HardSphere.Lattice HardSphere.CellOrbital HardSphere.BathSlice HardSphere.FreeVisits attribute [local irreducible] freeTrajectory def defectiveTotalVisits {n K : ℕ} (L : Length) (c : Torus L) (A : Finset (DiscreteTorus K)) (D : Set (ConfigurationPath 1 L)) (ω : ConfigurationPath n L) : ℕ := by classical exact ∑ i, if onePathAt i ω∈D then (pathVisitedSites L (center L c) A i ω).card else 0 lemma pathVisitedSites_onePathAt {n K : ℕ} (L : Length) (c : Torus L) (A : Finset (DiscreteTorus K)) (i : Fin n) (ω : ConfigurationPath n L) : pathVisitedSites L (center L c) A 0 (onePathAt i ω)=pathVisitedSites L (center L c) A i ω := by simp only [pathVisitedSites,pathVisitsBall,onePathAt,oneConfiguration,ContinuousMap.coe_mk] rfl lemma exp_defectiveTotalVisits {n K : ℕ} (L : Length) (c : Torus L) (A : Finset (DiscreteTorus K)) (D : Set (ConfigurationPath 1 L)) {η : ℝ} (hη : 0≤η) (ω : ConfigurationPath n L) : ENNReal.ofReal (Real.exp (η*(defectiveTotalVisits L c A D ω : ℝ)))= ∏ i, (1+singleDefect L c A η D (onePathAt i ω)) := by classical simp only [defectiveTotalVisits,Nat.cast_sum,Finset.mul_sum,Real.exp_sum, ENNReal.ofReal_prod_of_nonneg (fun _ _ ↦ (Real.exp_pos _).le)] apply Finset.prod_congr rfl intro i _ rw [singleDefect,pathVisitedSites_onePathAt] have hx : 0≤η*(if onePathAt i ω∈D then ((pathVisitedSites L (center L c) A i ω).card:ℝ) else 0) := by positivity have he : 0≤Real.exp (η*(if onePathAt i ω∈D then ((pathVisitedSites L (center L c) A i ω).card:ℝ) else 0))-1 := sub_nonneg.mpr (Real.one_le_exp_iff.mpr hx) simp only [Nat.cast_ite,Nat.cast_zero] rw [←ENNReal.ofReal_one,←ENNReal.ofReal_add zero_le_one he] congr 1 ring theorem interacting_visit_mgf {η₀ : ℝ} (hη₀ : 0≤η₀) : ∃ Cdel Cfree Csp αstar : ℝ, 0