import Mathlib import OAI.GroupTheory.SimpleAmenable.PolygonGeometry.InactiveQuadrantAction import OAI.GroupTheory.SimpleAmenable.PolygonGeometry.InactiveQuadrantAnchors import OAI.GroupTheory.SimpleAmenable.PolygonGeometry.ConcurrentInwardModel import OAI.GroupTheory.SimpleAmenable.PolygonGeometry.InwardMargins namespace OAI open scoped symmDiff namespace SimpleAmenable open scoped commutatorElement section InactiveNeighborhoodActions theorem strict_rectangle_ball (l v : Fin 2 → ℝ) (z : ℝ × ℝ) (hz : ∀ k, l k realCoordinate y k) := by fin_cases k · exact continuous_fst · exact continuous_snd exact (isOpen_lt continuous_const hc).inter (isOpen_lt hc continuous_const) obtain ⟨δ,hδ,hball⟩ := Metric.isOpen_iff.mp hO z (Set.mem_iInter.mpr hz) exact ⟨δ,hδ,fun y hy => Set.mem_iInter.mp (hball hy)⟩ namespace InitialCoverSystem.RectangularAtlas variable {a m M : ℕ} {r : CutRing} {hm : 2 ≤ m} {B : InitialCoverSystem a r m hm M} [Group.IsPerfect (alternatingGroup (Fin (m+1)))] (A : B.RectangularAtlas) theorem inactive_near_action_neighborhood (hlarge : 20 ≤ m+1) (hr : 0 (primitiveTests (a := a) (r := r) (coordinateWindowPrimitives n q) e).val) (coordinateRectangle a L V).val → ∀ f : TrackStar (Fin (m+1)) →* BoundedRelationCover M (alternatingGenerator a r m hm), B.AlignedSmallSupported f → SmallControlled B.c f (B.windowSector (by omega) n (A.rectangles n) q (coordinateRectangle a L V)) → ∀ (I : ControlAlphabet (Fin (m+1))) (s : UniversalExtension (alternatingGroup I.val)), ∀ x ∈ f.range, A.slope (by omega) d v (universalMap (subtypeAlternatingHom I.val) s)*x* (A.slope (by omega) d v (universalMap (subtypeAlternatingHom I.val) s))⁻¹ = (if positive then B.c (subtypeAlternatingHom I.val (universalProjection _ s)) else 1)*x* (if positive then B.c (subtypeAlternatingHom I.val (universalProjection _ s)) else 1)⁻¹ := by obtain ⟨u,positive,hline,hsign,hquad⟩ := inactive_slope_quadrant_anchor a d (integralCutForm a (slopeDirection d) v) A.radius z hinactive hnear obtain ⟨δ,hδ,hball⟩ := strict_rectangle_ball (fun k => ordinary (pointCoordinate u k)+ordinary (signQuadrantLower A.radius d positive k)) (fun k => ordinary (pointCoordinate u k)+ordinary (signQuadrantUpper A.radius d positive k)) z hquad refine ⟨δ,hδ,positive,hsign,?_⟩ intro L V hLV hclip hsmall n q hW f hf hc I s x hx have hL : dist (ordinary (L 0),ordinary (L 1)) z<δ := by rw [Prod.dist_eq,Real.dist_eq,Real.dist_eq,max_lt_iff] exact ⟨(hsmall 0).1,(hsmall 1).1⟩ have hV : dist (ordinary (V 0),ordinary (V 1)) z<δ := by rw [Prod.dist_eq,Real.dist_eq,Real.dist_eq,max_lt_iff] exact ⟨(hsmall 0).2,(hsmall 1).2⟩ have hlo (k : Fin 2) := (hball (ordinary (L 0),ordinary (L 1)) hL k).1.le have hup (k : Fin 2) := (hball (ordinary (V 0),ordinary (V 1)) hV k).2.le exact A.inactive_quadrant_action hlarge hr d v u positive hline.symm L V hLV hclip (fun k => by have he : realCoordinate (ordinary (L 0),ordinary (L 1)) k=ordinary (L k) := by fin_cases k <;> rfl simpa only [he] using hlo k) (fun k => by have he : realCoordinate (ordinary (V 0),ordinary (V 1)) k=ordinary (V k) := by fin_cases k <;> rfl simpa only [he] using hup k) n q hW f hf hc I s x hx end InitialCoverSystem.RectangularAtlas end InactiveNeighborhoodActions namespace ConcurrentGeometry variable {a : ℕ} {r : CutRing} (C : ConcurrentGeometry a r) {ι : Type*} def InwardChartNeighborhood (t : VertexType (commonVertexDenominator a)) (u : CutRing × CutRing) (z : ℝ × ℝ) : Prop := ∀ y : ℝ × ℝ, dist y z axisDirection d.1) let K : Sum ι (Fin 2 × Bool) → CutRing := Sum.elim c (fun d => if d.2 then 1 else 0) obtain ⟨t,u,hcell,hactive⟩ := C.simultaneous_active_neighborhood ha J K z have hb (k : Fin 2) (hk : realCoordinate z k=0 ∨ realCoordinate z k=1) : ∃ b : Bool, cutForm a (J (.inr (k,b))) z=ordinary (K (.inr (k,b))) := by have haxis : cutForm a (axisDirection k) z=realCoordinate z k := by fin_cases k <;> rfl rcases hk with hk | hk · exact ⟨false,by simpa only [J,K,Sum.elim_inr,Bool.false_eq_true,↓reduceIte,map_zero,haxis] using hk⟩ · exact ⟨true,by simpa only [J,K,Sum.elim_inr,↓reduceIte,map_one,haxis] using hk⟩ refine ⟨⟨(t,u),hcell,(fun i hi => (hactive (.inl i) hi).1), (fun i hi => (hactive (.inl i) hi).2),?_,?_⟩⟩ · intro k hk obtain ⟨b,hb⟩ := hb k hk have he := congrArg ordinary (hactive (.inr (k,b)) hb).1 have haxis : cutForm a (axisDirection k) z=realCoordinate z k := by fin_cases k <;> rfl change ordinary (integralCutForm a (axisDirection k) (u+C.anchors t (axisDirection k)))=_ at he rw [integralCutForm_axis] at he exact he.trans (by simpa only [J,Sum.elim_inr,haxis] using hb.symm) · intro k hk obtain ⟨b,hb⟩ := hb k hk exact (hactive (.inr (k,b)) hb).2 namespace InwardChart variable {C} {j : ι → Fin 4} {c : ι → CutRing} {z : ℝ × ℝ} (T : C.InwardChart j c z) theorem canonical_mem (hr : 0 ⟨(T.neighborhood p.val hp k).1.le,(T.neighborhood p.val hp k).2⟩) theorem assignment_realized [Finite ι] (hr : 0 cutPolygon a (j i) (c i)) q= polygonAssignment (fun i => C.localDecision T.vertex T.offset z (j i) (c i)) p := C.localDecision_assignment_realized hr T.vertex T.offset j c z hz₁ hz₂ T.active_anchor T.boundary_anchor T.active_bound T.boundary_bound p hp N hN hz theorem local_decisions_eq (hr : 0 C.localDecision T.vertex T.offset z (j i) (c i)) p= polygonAssignment (localCutFamily j c z) p := by classical have hy : p.val=(Int.fract p.val.1,Int.fract p.val.2) := by rw [Int.fract_eq_self.mpr p.property.1,Int.fract_eq_self.mpr p.property.2.1] have hcell k := (T.neighborhood p.val hp k).imp le_of_lt le_of_lt funext i apply decide_eq_decide.mpr by_cases hi : cutForm a (j i) z=ordinary (c i) · have hd := C.positiveDecision_planar hr T.vertex T.offset (j i) (T.active_bound i hi) p p.val hy hcell rw [T.active_anchor i hi] at hd simp only [localDecision,localCutFamily,ite_eq_left hi] change (p ∉ (C.positiveDecision T.vertex T.offset (j i)).val) ↔ cutForm a (j i) p.val C.localDecision T.vertex T.offset z (j i) (c i)) (polygonFormalMask (fun i => cutPolygon a (j i) (c i)) (R i)) theorem polygons_assignment_realized [Finite ι] {κ : Type*} (hr : 0 halfPlane a (j i) (c i)) (R k).val) (p : GenericSquare a) (hp : p ∈ (C.inwardMargin T.vertex T.offset z).val) (N : Set (ℝ × ℝ)) (hN : IsOpen N) (hz : z ∈ N) : ∃ q : GenericSquare a, q.val ∈ N ∧ polygonAssignment R q=polygonAssignment (T.polygons R) p := by obtain ⟨q,hq,he⟩ := T.assignment_realized hr hz₁ hz₂ p hp N hN hz refine ⟨q,hq,?_⟩ funext k apply decide_eq_decide.mpr change (q ∈ (R k).val) ↔ polygonAssignment (fun i => C.localDecision T.vertex T.offset z (j i) (c i)) p ∈ polygonFormalMask (fun i => cutPolygon a (j i) (c i)) (R k) rw [← he] exact (polygonFormalMask_mem _ (R k) (hR k) q).symm theorem polygons_locally_eq [Finite ι] {κ : Type*} (hr : 0 halfPlane a (j i) (c i)) (R k).val) : ∃ N : Set (ℝ × ℝ), IsOpen N ∧ z ∈ N ∧ ∀ p : GenericSquare a, p.val ∈ N → p ∈ (C.inwardMargin T.vertex T.offset z).val ∧ ∀ k, p ∈ (T.polygons R k).val ↔ p ∈ (R k).val := by obtain ⟨O,hO,hz,hlocal⟩ := localPolygonFamily_locally_eq j c z R hR refine ⟨O ∩ Metric.ball z (C.epsilon/2),hO.inter Metric.isOpen_ball, ⟨hz,by simp only [Metric.mem_ball,dist_self]; linarith [C.positive]⟩,?_⟩ intro p hp refine ⟨T.canonical_mem hr p hp.2,fun k => ?_⟩ have he := T.local_decisions_eq hr p hp.2 change polygonAssignment (fun i => C.localDecision T.vertex T.offset z (j i) (c i)) p ∈ polygonFormalMask (fun i => cutPolygon a (j i) (c i)) (R k) ↔ _ rw [he] exact hlocal p hp.1 k end InwardChart end ConcurrentGeometry end SimpleAmenable end OAI