import Mathlib import OAI.Probability.Ballisticity.Coupling.SeedOrder namespace OAI section open MeasureTheory ProbabilityTheory Filter open scoped ENNReal NNReal BigOperators Topology Classical namespace DirectionalTransience lemma exists_atom_probability {A : Type*} [MeasurableSpace A] [Countable A] [MeasurableSingletonClass A] (μ : Measure A) [IsProbabilityMeasure μ] : ∃ x, μ {x} ≠ 0 := by by_contra! hn have hz : μ=0 := Measure.ext_of_singleton fun x => by simp [hn x] have h := measure_univ (μ:=μ) simp only [hz,Measure.coe_zero,Pi.zero_apply] at h exact zero_ne_one h lemma seedOrdered_trans {d : ℕ} (f : Direction d) (s : ℤ) (g h : ℝ) (μ ρ σ : Measure (Lattice d)) [IsProbabilityMeasure ρ] (h₁ : SeedOrdered f s g μ ρ) (h₂ : SeedOrdered f s h ρ σ) : SeedOrdered f s (g+h) μ σ := by obtain ⟨y,hy⟩ := exists_atom_probability ρ intro x hx z hz have hxy := h₁ x hx y hy have hyz := h₂ y hy z hz nlinarith lemma seedStateStep_ordered {d : ℕ} (e f : Direction d) (a s : ℤ) (k H : ℕ) (θ z b j c g g' : ℝ) (q : SeedState e a) (ω : Environment d) (hs : s=1 ∨ s= -1) (hq : 0 seedAdvance e a H (SeedCentral f H θ z) (seedCentralInput e f a s k q i) ω have hm (i : ℕ) (hi : i (seedEndpointRaw e H R p.1.measure p.2 Set.univ).toReal) := by let : MeasurableSpace (Environment d) := rowSigma S exact ((Measure.measurable_coe MeasurableSet.univ).comp ((seedEndpointRaw_joint_rows e hH R {x | signedHeight e x=a} S hS).comp (((SeedProfile.measurable_supported e a).comp measurable_fst).prodMk measurable_snd))).ennreal_toReal lemma seedSplitTest_joint_rows {d : ℕ} (e f : Direction d) (a s : ℤ) {H : ℕ} (hH : 0 seedStateStep e f a s k H θ z b j p.1 p.2) := by let : MeasurableSpace (Environment d) := rowSigma S have ht : MeasurableSet {p : SeedState e a × Environment d | p.1.1