import Mathlib
import OAI.GroupTheory.SimpleAmenable.Amenability.BarrierLineGeometry
namespace OAI
section
section
open scoped symmDiff
namespace SimpleAmenable
open scoped commutatorElement
open scoped commutatorElement
section BarrierAlgorithm
open Classical Set
noncomputable def barrierSitePoint {a m D : ℕ} {v : ℝ×ℝ} (z : FlagSite a m D v) : ℝ×ℝ :=
z.val.2.val
theorem flagSite_eq_of_track_point {a m D : ℕ} {v : ℝ×ℝ}
{z w : FlagSite a m D v} (ht : z.val.1=w.val.1)
(hp : barrierSitePoint z=barrierSitePoint w) : z=w := by
apply Subtype.ext
exact Prod.ext ht (Subtype.ext hp)
noncomputable def barrierMarkedParameters {a m : ℕ} (ha : 0 z.val.1=i ∧ barrierSitePoint z∈squareInterior ∧
cutForm a j (barrierSitePoint z)=ordinary c)).image
(fun z => barrierLineParameter j (barrierSitePoint z))
noncomputable def barrierSubdivision {a m : ℕ} (ha : 0 ConsecutiveSubdivision (barrierSubdivision ha i j c M) st.1 st.2 ∧
barrierActivation ha i j c b st.1=true)
theorem barrierActivation_at_site {a m : ℕ} (ha : 0 l.1) (fun l => l.2.val)
(sampledBarriers ha i N M b) := by
rintro p ⟨l,st,hst,t,ht,rfl⟩
exact ⟨l,cutForm_barrierLinePoint a l.1 l.2.val t⟩
noncomputable def sampledPolygonPartition {a m : ℕ} (ha : 0 barrierLinePoint a j c t)
fin_cases j <;> simp only [barrierLinePoint] <;> fun_prop
theorem sampledBarriers_closed {a m : ℕ} (ha : 0