import Mathlib import OAI.Analysis.HardSphere.Allocation.PhysicalBranchLaw namespace OAI section noncomputable section open MeasureTheory ProbabilityTheory Set open scoped ENNReal namespace HardSphere.Groups open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital attribute [local instance] Classical.propDecidable def rawPhysicalBranch {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (μ : Measure (BridgeEndpoints N L)) [SFinite μ] (_group : Fin G) (b : Fin N→Bool) (a : GridAllocation N K (G*M)) (m : ℕ) (r R C S s₀ T : ℝ) (u : Time) := ((allocationBase μ (gridAllocationKernel hL (G*M)) b a).prod (Measure.pi fun _ : Fin N ↦ Bridge.law)).restrict (labelInteraction N L r T∩flagEvent (eligibilityFlag (K:=K) m r R C S s₀ T u) b) instance rawPhysicalBranch_sfinite {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (μ : Measure (BridgeEndpoints N L)) [SFinite μ] (g : Fin G) (b : Fin N→Bool) (a : GridAllocation N K (G*M)) (m : ℕ) (r R C S s₀ T : ℝ) (u : Time) : SFinite (rawPhysicalBranch hL μ g b a m r R C S s₀ T u) := by unfold rawPhysicalBranch; infer_instance theorem physicalBranch_reference_raw {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 simp [physicalRecoveredPath,physicalDatum,hi] def physicalRecoveredMidpoint {N K M G : ℕ} {L : Length} (g : Fin G) (a : GridAllocation N K (G*M)) (z : PhysicalDatum N K M G L×({i // i∈groupUnion g a}→ ConfigurationPath 1 L)) : Configuration N L := fun i ↦ physicalRecoveredPath g a z i midpointTime 0 lemma physicalRecoveredMidpoint_measurable {N K M G : ℕ} {L : Length} (g : Fin G) (a : GridAllocation N K (G*M)) : Measurable (physicalRecoveredMidpoint (L:=L) g a) := Measurable.of_eval fun i ↦ (measurable_pi_apply 0).comp ((continuous_eval_const midpointTime).measurable.comp ((measurable_pi_apply i).comp (physicalRecoveredPath_measurable g a))) lemma physicalRecoveredMidpoint_actual {N K M G : ℕ} {L : Length} (g : Fin G) (a : GridAllocation N K (G*M)) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) (F : ConfigurationPath N L) : physicalRecoveredMidpoint g a (physicalDatum g m r R C S s₀ u (F,a),fun i ↦ onePathAt i F)= F midpointTime := by unfold physicalRecoveredMidpoint rw [physicalRecoveredPath_actual] rfl theorem physicalBranch_midpoint_raw {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50