import Mathlib import OAI.Probability.CriticalPercolation.ProductMeasure.TailProduct import OAI.Probability.CriticalPercolation.Gluing.RelayMoves namespace OAI section section noncomputable section open Set Function MeasureTheory ProbabilityTheory open scoped Classical ENNReal namespace CriticalPercolation.BondGraph variable {V E : Type*} (G : BondGraph V E) lemma vertexCollar_mono {S T : Set V} (hST : S⊆T) (R : ℕ) : G.vertexCollar S R⊆G.vertexCollar T R := by intro y hy obtain ⟨v,hv,hy⟩ := Set.mem_iUnion₂.mp hy exact Set.mem_iUnion₂.mpr ⟨v,hST hv,hy⟩ lemma initial_mark_subset_relay (t z : V → ℝ) (σ e ρ : ℝ) (hρ : ρ ≤ e) : relayMark t z 0 σ ρ⊆relayRegion t z σ e 0 := by intro v hv obtain ⟨ht₀,ht₁,hz⟩ := hv change |t v-(0:ℕ)| ≤ ((0:ℕ)+1)*e ∧ |z v-σ*(0:ℕ)/4| ≤ Relay.width 0 norm_num [Relay.width] at ht₀ ht₁ hz ⊢ exact ⟨by rw [abs_of_nonneg ht₀]; linarith,hz⟩ lemma relay_coordinate_scale (L R m : ℕ) (e ρ : ℝ) (he : 0 nlinarith lemma relay_collar_in_domain (t z : V → ℝ) (σ e ρ J : ℝ) (L R i : ℕ) (hσ : |σ|=1) (he : 0 ≤ e) (hρ : 0 ≤ ρ) (hJ : 26200 norm_num lemma forceOutside_induced (S : Set V) (ω : Set E) : BernoulliProduct.forceOn (G.inducedEdges S)ᶜ ∅ ω=ω∩G.inducedEdges S := by ext b by_cases hb : b∈G.inducedEdges S <;> simp [hb] def corridorRelay (t z : V → ℝ) (σ e ρ : ℝ) (L i : ℕ) : Set V := if i=0 then relayMark t z 0 σ ρ else if i ≤ L then relayRegion t z σ e i else relayMark t z (L+1/2) σ ρ lemma corridorRelay_subset (t z : V → ℝ) (σ e ρ : ℝ) (hρe : ρ ≤ e) (L i : ℕ) (hi : i ≤ L) : corridorRelay t z σ e ρ L i⊆relayRegion t z σ e i := by by_cases h0 : i=0 · subst i simpa [corridorRelay] using initial_mark_subset_relay t z σ e ρ hρe · simp only [corridorRelay,ite_eq_right h0,ite_eq_left hi,Subset.rfl] theorem coordinate_moves_relay_estimates (t z : V → ℝ) (σ e ρ J : ℝ) (L R m : ℕ) (hσ : |σ|=1) (he : 0 p)).real (G.coordinateMove t z m e y s)) : ∀ i ≤ L, G.vertexCollar (corridorRelay t z σ e ρ L i) R⊆relayDomain t z J (L+1/2) σ ∧ ∀ y∈G.vertexCollar (corridorRelay t z σ e ρ L i) R, 1-η ≤ (BernoulliProduct.law (fun _ : E => p)).real ((BernoulliProduct.forceOn (G.inducedEdges (relayDomain t z J (L+1/2) σ))ᶜ ∅) ⁻¹' G.seedHitEvent (G.vertexBall y m) (corridorRelay t z σ e ρ L (i+1))) := by obtain ⟨hρe,hsmall,hheight,htime,hlast⟩ := relay_coordinate_scale L R m e ρ he hρ heL hr intro i hi have hsub := G.vertexCollar_mono (corridorRelay_subset t z σ e ρ hρe L i hi) R refine ⟨hsub.trans (G.relay_collar_in_domain t z σ e ρ J L R i hσ he.le hρ hJ hi hsmall ht hz),?_⟩ intro y hy apply (hmove y (Relay.selectedSign (z y-σ*(i:ℝ)/4)) (Relay.selectedSign_abs _)).trans apply measureReal_mono (h₂ := measure_ne_top _ _) intro ω hω rw [Set.mem_preimage,G.forceOutside_induced] by_cases hiL : i