import Mathlib import OAI.GroupTheory.SimpleAmenable.CentralCovers.RectangularAtlas import OAI.GroupTheory.SimpleAmenable.Homology.UniformConcurrentMesh import OAI.GroupTheory.SimpleAmenable.PolygonGeometry.VertexMargins namespace OAI section section open scoped symmDiff namespace SimpleAmenable open scoped commutatorElement open scoped commutatorElement section ConcurrentGeometry structure ConcurrentGeometryData (a D : ℕ) (r : CutRing) where epsilon : ℝ positive : 0 1) p refine ⟨⟨ε,hε,hr',hg,hg',U,hU,V,n,hn,(le_max_right _ _).trans (le_max_right _ _),hmesh,k,q,?_⟩⟩ intro t j have hL := hq (t,false) j have hV := hq (t,true) j simp only [p, Bool.false_eq_true, ↓reduceIte] at hL simp only [p, ↓reduceIte] at hV constructor <;> constructor <;> omega namespace ConcurrentGeometry variable {a : ℕ} {r : CutRing} (C : ConcurrentGeometry a r) theorem mesh_small : 200/(C.mesh:ℝ) (InitialCoverSystem.primitiveTests (a := a) (r := r) (coordinateWindowPrimitives C.window C.start) s).val) (coordinateRectangle a (C.margins t).lower (C.margins t).upper).val := by intro x y hxy exact and_congr (coordinateLabelWindow_resolved C.window C.start 0 _ _ (C.labels t 0).1 (C.labels t 0).2 x y hxy) (coordinateLabelWindow_resolved C.window C.start 1 _ _ (C.labels t 1).1 (C.labels t 1).2 x y hxy) end ConcurrentGeometry noncomputable def initialPatchPrimitives (r : CutRing) (n : ℕ) : Sum (Fin 5) (Fin 2 × Fin (n-1)) → Fin 5 × (CutRing × CutRing) := Sum.elim (fun j => (j,0)) (coordinateWindowPrimitives n (symmetricWindowStart r)) namespace InitialCoverSystem variable {a m M : ℕ} {r : CutRing} {hm : 2 ≤ m} (B : InitialCoverSystem a r m hm M) [Group.IsPerfect (alternatingGroup (Fin (m+1)))] structure PatchAtlas where rectangles : B.RectangularAtlas geometry : ConcurrentGeometry a r initial : ∀ u I b hb, B.PrimitiveFamilyLaw I b hb (translatedTemplate (initialPatchPrimitives r geometry.mesh) u) concurrent : ∀ t u I b hb, B.PrimitiveFamilyLaw I b hb (translatedTemplate (Sum.elim (fun j : Fin 4 => (⟨j.val+1,by omega⟩,geometry.anchors t j)) (coordinateWindowPrimitives geometry.window geometry.start)) u) end InitialCoverSystem theorem patchAtlas_eventually {a m : ℕ} {r : CutRing} {hm : 2 ≤ m} [Group.IsPerfect (alternatingGroup (Fin (m+1)))] (hlarge : 20 ≤ m+1) (hr : 0 initialPatchPrimitives r C.mesh) obtain ⟨L₃,hL₃⟩ := concurrent_chart_tables_eventually (hm := hm) hr (by omega) C.anchors (fun _ => coordinateWindowPrimitives C.window C.start) refine ⟨L₁+L₂+L₃,fun M hM B => ?_⟩ obtain ⟨A⟩ := hL₁ M (by omega) B exact ⟨⟨A,C,(fun u I b hb => hL₂ M (by omega) B () u I b hb),hL₃ M (by omega) B⟩⟩ end ConcurrentGeometry section ClosedCellTemplates theorem closedWindow_diameter (n : ℕ) (q : Fin 2 → ℤ) (cell : Fin 2 → Fin n) (x y : ℝ × ℝ) (hx : ∀ d, ordinary (windowCut n (q d) (cell d).castSucc) ≤ realCoordinate x d ∧ realCoordinate x d ≤ ordinary (windowCut n (q d) (cell d).succ)) (hy : ∀ d, ordinary (windowCut n (q d) (cell d).castSucc) ≤ realCoordinate y d ∧ realCoordinate y d ≤ ordinary (windowCut n (q d) (cell d).succ)) : dist x y ≤ 200/(n:ℝ) := by have h (d : Fin 2) : |realCoordinate x d-realCoordinate y d| ≤ 200/(n:ℝ) := by have hh := windowCut_mesh n (q d) (cell d) have hx' := hx d have hy' := hy d apply abs_le.mpr constructor <;> linarith rw [Prod.dist_eq,Real.dist_eq,Real.dist_eq,max_le_iff] exact ⟨h 0,h 1⟩ theorem windowRectangle_closed_intersection_near {a : ℕ} (ha : 0 ?_⟩ have hc (t : GenericSquare a) (ht : t ∈ (windowRectangle a n q cell).val) : dist p (windowPlanarLift q t) ≤ 200/(n:ℝ) := by apply closedWindow_diameter n q cell p (windowPlanarLift q t) hp intro k exact ⟨((windowRectangle_mem n hn q cell t).mp ht k).1, ((windowRectangle_mem n hn q cell t).mp ht k).2.le⟩ have h₁ := crossing_level_bound (ordinary (lineNormal a i).1) (ordinary (lineNormal a i).2) (ordinary c) (200/(n:ℝ)) p (windowPlanarLift q x) (windowPlanarLift q y) (by simpa only [cutForm_normal] using hcx) (by simpa only [cutForm_normal] using hcy) (hc x hx) (hc y hy) have h₂ := crossing_level_bound (ordinary (lineNormal a j).1) (ordinary (lineNormal a j).2) (ordinary d) (200/(n:ℝ)) p (windowPlanarLift q u) (windowPlanarLift q v) (by simpa only [cutForm_normal] using hdu) (by simpa only [cutForm_normal] using hdv) (hc u hu) (hc v hv) have hδ : 0 ≤ 200/(n:ℝ) := by positivity have hm₁ := mul_le_mul_of_nonneg_right (le_max_left (|ordinary (lineNormal a i).1|+|ordinary (lineNormal a i).2|) (|ordinary (lineNormal a j).1|+|ordinary (lineNormal a j).2|)) hδ have hm₂ := mul_le_mul_of_nonneg_right (le_max_right (|ordinary (lineNormal a i).1|+|ordinary (lineNormal a i).2|) (|ordinary (lineNormal a j).1|+|ordinary (lineNormal a j).2|)) hδ have hh := real_two_lines_distance_bound _ _ _ _ (ordinary c) (ordinary d) (real_lineDet_ne_zero ha i j hij) z p (by simpa only [cutForm_normal] using hz) (by simpa only [cutForm_normal] using hz') _ (by positivity) (h₁.trans hm₁) (h₂.trans hm₂) have hh' : dist z p ≤ lineIntersectionCoefficient a i j*(200/(n:ℝ)) := by simpa only [lineIntersectionCoefficient,lineDet,map_sub,map_mul,mul_assoc] using hh exact hh'.trans (mul_le_mul_of_nonneg_right (lineIntersectionCoefficient_le a i j) hδ) namespace ConcurrentGeometry variable {a : ℕ} {r : CutRing} (C : ConcurrentGeometry a r) theorem crossing_cell_template (ha : 0