import Mathlib import OAI.Geometry.Cannon.PlaneTopology.Crossing namespace OAI section section section noncomputable section namespace CannonPackingGeometry open Set theorem cyclic_folded_frames_positions (n:ℕ) (hn:0?_⟩ let j := fanSucc hn i have hray : fanRay L α (i.val+1)=fanRay L α j.val := fanRay_succ hn L α hclose i apply folded_frames_compatible (a:=A i) (b:=C i) (c:=B i) (A:=A j) (B:=B j) (C:=C j) (P:=0) (Q:=fanRay L α j.val) (e:=e i) (f:=e j) · intro hh have hh' := hAC i rw [hh,dist_self] at hh' exact (hL (i.val+1) (by omega)).ne' hh'.symm · calc dist (A i) (C i) = dist ((e i) (A i)) ((e i) (C i)) := ((e i).dist_eq _ _).symm _ = dist ((e j) (A j)) ((e j) (B j)) := by rw [(he i).1,(he i).2.2,(he j).1,(he j).2.1,hray] _ = dist (A j) (B j) := (e j).dist_eq _ _ · rw [orientedArea_swap] exact neg_ne_zero.mpr (harea i) · exact harea j · exact hKA i · exact hKC i · exact hKB i · exact (he i).1 · exact (he i).2.2.trans hray · exact (he j).1 · exact (he j).2.1 · rw [(he i).2.1,(he j).2.2,←hray,orientedArea_swap 0 (fanRay L α (i.val+1))] exact mul_neg_of_neg_of_pos (neg_neg_of_pos (hD i.val i.isLt).2) (by rw [hray]; exact (hD j.val j.isLt).2) theorem cyclic_fan_global_frame (n : ℕ) (hn : 0A) B (fun i=>B (fanSucc hn i)) hAB (fun i=>(hAB (fanSucc hn i)).trans (hLnext i).symm) hBC (fun _=>1) (fun _=>rfl) (fun _=>rfl) hop have heq (i j : Fin n) : e i=e j := by have H := CannonCycleOrder.eq_of_steps hn (fun i=>(e i).symm) (fun i=>by simpa only [one_mul,fanSucc,CannonCycleOrder.next] using hstep i) i j exact congrArg IsometryEquiv.symm H let i : Fin n := ⟨0,hn⟩ refine ⟨e i,(he i).1,?_⟩ intro j rw [heq i j] exact (he j).2.1 end CannonPackingGeometry end end section noncomputable section namespace CannonPackingGeometry open Set lemma sum_range_partition (a : ℕ → ℝ) (n : ℕ) {t : ℝ} (ht : 0≤t) (hn : t<∑ i∈Finset.range n,a i) : ∃ k,k simp only [Finset.range_zero,Finset.sum_empty] at hn; exact (not_lt_of_ge ht hn).elim | succ n ih => by_cases h : t<∑ i∈Finset.range n,a i · obtain ⟨k,hk,hlo,hhi⟩ := ih h exact ⟨k,by omega,hlo,hhi⟩ · exact ⟨n,by omega,le_of_not_gt h,hn⟩ lemma polar_nonnegative_arg (p : ℂ) : ∃ t : ℝ,0≤t ∧ t<2*Real.pi ∧ p=(‖p‖:ℂ)*(Circle.exp t:ℂ) := by have hpi := Real.pi_pos by_cases h : Complex.arg p<0 · refine ⟨Complex.arg p+2*Real.pi,by linarith [Complex.neg_pi_lt_arg p],by linarith,?_⟩ rw [Circle.exp_add,Circle.exp_two_pi,mul_one] simpa only [Circle.coe_exp] using (Complex.norm_mul_exp_arg_mul_I p).symm · refine ⟨Complex.arg p,le_of_not_gt h,by linarith [Complex.arg_le_pi p],?_⟩ simpa only [Circle.coe_exp] using (Complex.norm_mul_exp_arg_mul_I p).symm theorem closed_fan_cones_cover (n : ℕ) (L α : ℕ → ℝ) (hL : ∀ k≤n,0 rcases hy with rfl|rfl|rfl <;> rcases hz with rfl|rfl|rfl all_goals first | exact (hxy rfl).elim | exact (hxz rfl).elim | exact (hyz rfl).elim | exact h.1 | exact h.2.1 | exact h.2.2 | rw [hrev]; exact h.1 | rw [hrev]; exact h.2.1 | rw [hrev]; exact h.2.2 lemma TriInterior.of_vertices {a b c p x y z : ℂ} (h : TriInterior a b c p) (hx : x∈({a,b,c}:Finset ℂ)) (hy : y∈({a,b,c}:Finset ℂ)) (hz : z∈({a,b,c}:Finset ℂ)) (hxy : x≠y) (hxz : x≠z) (hyz : y≠z) : TriInterior x y z p := ⟨h.edge_positive hx hy hz hxy hxz hyz, h.edge_positive hy hz hx hyz hxy.symm hxz.symm, h.edge_positive hz hx hy hxz.symm hyz.symm hxy⟩ lemma isometry_area_ne_zero (e : ℂ≃ᵢℂ) {a b c : ℂ} (h : orientedArea a b c≠0) : orientedArea (e a) (e b) (e c)≠0 := by intro hh have H := isometry_orientedArea_product e a b c c rw [hh,zero_mul] at H exact mul_ne_zero h h H.symm end CannonPackingGeometry end end section noncomputable section namespace CannonPackingGeometry open Set theorem finite_star_ball_cover {n : ℕ} (hn : 0r+s (atN k) let al : ℕ → ℝ := fun k=>α (atN k) let d : ℕ → ℝ := fun k=>s (atN k)+s (nx (atN k)) have hL (k : ℕ) (hk : k≤n) : 0by simpa only [L,hat] using hAB i) (fun i=>by simpa only [d,hat,nx,fanSucc,CannonCycleOrder.next] using hBC i) (fun i=>by simp only [L,hat',hat]; rfl) hop obtain ⟨hclose,hR,hD⟩:=closed_euclidean_fan n L al d hL hd hal htotal hperiod hcosN obtain ⟨k,hk,h1,h2⟩:=closed_fan_cones_cover n L al hL hal htotal (e p) let i : Fin n:=⟨k,hk⟩ have hnext : fanRay L al (k+1)=e (B (nx i)) := by rw [heB] exact fanRay_succ hn L al hclose i have hcur : fanRay L al k=e (B i) := (heB i).symm have ha : 0