import Mathlib import OAI.Analysis.HardSphere.Allocation.PhysicalMixedObservation import OAI.Analysis.HardSphere.Conditioning.TagPushforward import OAI.Analysis.HardSphere.Allocation.PhysicalProjectedPrimary import OAI.Analysis.HardSphere.Conditioning.PrimaryProduct namespace OAI section noncomputable section open MeasureTheory ProbabilityTheory Set open scoped ENNReal BigOperators namespace HardSphere.Groups open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital attribute [local instance] Classical.propDecidable attribute [local instance] Comparison.permBathSpace Comparison.permBathSingleton def cellPointReference {K : ℕ} (L : Length) (v : Fin 3→Fin K) : Measure (Torus L) := (cellPathReference v).map (fun e ↦ projectPoint L (e midpointTime)) instance cellPointReference_probability {K : ℕ} (L : Length) (v : Fin 3→Fin K) : IsProbabilityMeasure (cellPointReference L v) := by unfold cellPointReference exact (Measure.isProbabilityMeasure_map_iff (((projectPoint_continuous L).measurable.comp (continuous_eval_const midpointTime).measurable).aemeasurable)).mpr inferInstance def physicalCellPost {N K : ℕ} (L : Length) (extra tag : Fin 3→Fin K) (b : Bool) : Kernel (Torus L×Configuration N L) (Torus L×Torus L×Configuration N L) := (cellExtraKernel (cellPointReference L extra) (centeredCell L (gridCenter L tag)) univ (centeredCell_measurable L _)).map (cellObservation b) theorem physical_branch_observed_reference {N K M G : ℕ} [NeZero K] {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 simp [groupAt,he] at hi | some f => simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hi obtain ⟨k,rfl⟩ := hi exact allocationPMF_support _ _ _ (ha v) f he _ lemma physical_groups_disjoint {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) (ω : ConfigurationPath N L) (a : GridAllocation N K (G*M)) (ha : ∀v,a v∈(allocationPMF (eligibleList m r R C S s₀ u v ω) (G*M)).support) (g h : Fin G) (hgh : g≠h) : Disjoint (groupUnion g a) (groupUnion h a) := by apply Finset.disjoint_left.mpr intro i hig hih obtain ⟨v,_,hiv⟩ := Finset.mem_biUnion.mp hig obtain ⟨w,_,hiw⟩ := Finset.mem_biUnion.mp hih have hv := groupAt_mem_eligible m r R C S s₀ u ω a ha g v hiv have hw := groupAt_mem_eligible m r R C S s₀ u ω a ha h w hiw have hvw : v=w := by by_contra hn exact Finset.disjoint_left.mp (eligibleList_disjoint hL hK m r R C S s₀ u ω hn) hv hw rw [←hvw] at hiw cases he : a v with | none => simp [groupAt,he] at hiv | some f => simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hiv hiw obtain ⟨k,hk⟩ := hiv obtain ⟨l,hl⟩ := hiw exact groupPosition_disjoint M G g h hgh k l (f.injective (hk.trans hl.symm)) lemma physicalAllocation_supported_ae {N K : ℕ} {L : Length} (m total : ℕ) (r R C S s₀ : ℝ) (u : Time) (ω : ConfigurationPath N L) : ∀ᵐa ∂physicalAllocationKernel (K:=K) m total r R C S s₀ u ω, ∀v,a v∈(allocationPMF (eligibleList m r R C S s₀ u v ω) total).support := by change ∀ᵐa ∂Measure.pi (fun v ↦ (allocationPMF (eligibleList m r R C S s₀ u v ω) total).toMeasure), _ apply ae_all_iff.mpr intro v exact (MeasureTheory.measurePreserving_eval (fun w ↦ (allocationPMF (eligibleList m r R C S s₀ u w ω) total).toMeasure) v).quasiMeasurePreserving.tendsto_ae (allocation_support_ae _ _) theorem sum_physical_group_tags_le {N K M G : ℕ} {L : Length} {Y : Type*} [MeasurableSpace Y] (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) (μ : Measure (ConfigurationPath N L)) [SFinite μ] (κ : Fin N→Kernel (ConfigurationPath N L×GridAllocation N K (G*M)) Y) : (∑g,allocatedTagLaw (μ.compProd (physicalAllocationKernel m (G*M) r R C S s₀ u)) (fun g p ↦ groupUnion g p.2) κ g) ≤ ∑i,κ i ∘ₘ μ.compProd (physicalAllocationKernel m (G*M) r R C S s₀ u) := by apply sum_allocatedTagLaw_le_ae · intro g i exact ((measurable_of_countable (fun a : GridAllocation N K (G*M) ↦ i∈groupUnion g a)).comp measurable_snd).setOf · apply Measure.ae_compProd_of_ae_ae (((measurable_of_countable (fun a : GridAllocation N K (G*M) ↦ ∀g h : Fin G,g≠h→Disjoint (groupUnion g a) (groupUnion h a))).comp measurable_snd).setOf) filter_upwards [] with ω filter_upwards [physicalAllocation_supported_ae m (G*M) r R C S s₀ u ω] with a ha exact fun g h hgh ↦ physical_groups_disjoint hL hK m r R C S s₀ u ω a ha g h hgh end HardSphere.Groups end end end OAI