import Mathlib import OAI.Geometry.Borsuk.Simplicial.MapChainsEquivSimplexAll import OAI.Geometry.Borsuk.Simplicial.BarycenterNeg namespace OAI namespace BorsukNine.SimplicialChains open Finset open scoped RealInnerProductSpace variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [DecidableEq E] noncomputable def refinement (R : ℝ) : ℕ → Chain (hemisphereComplex R : PreAbstractSimplicialComplex E) →ₗ[F₂] Chain (hemisphereComplex R : PreAbstractSimplicialComplex E) | 0 => LinearMap.id | r+1 => (subdivMap (hemisphereComplex R) (hemisphereComplex R) barycenter).comp (refinement R r) lemma refinement_boundary (R : ℝ) (r : ℕ) : (boundary (hemisphereComplex R : PreAbstractSimplicialComplex E)).comp (refinement R r) = (refinement R r).comp (boundary (hemisphereComplex R)) := by induction r with | zero => simp only [refinement, LinearMap.comp_id, LinearMap.id_comp] | succ r ih => rw [refinement, ← LinearMap.comp_assoc, subdivMap_boundary _ _ _ (hemisphere_subdivision_carrier R), LinearMap.comp_assoc, ih, ← LinearMap.comp_assoc] lemma refinement_augmentation (R : ℝ) (r : ℕ) : (augmentation (hemisphereComplex R : PreAbstractSimplicialComplex E)).comp (refinement R r) = augmentation (hemisphereComplex R) := by induction r with | zero => simp only [refinement, LinearMap.comp_id] | succ r ih => rw [refinement, ← LinearMap.comp_assoc, subdivMap_augmentation _ _ _ (hemisphere_subdivision_carrier R), ih] lemma refinement_norm (R : ℝ) (r : ℕ) : (normMap (hemisphereComplex R : PreAbstractSimplicialComplex E) (Equiv.neg E)).comp (refinement R r) = (refinement R r).comp (normMap (hemisphereComplex R) (Equiv.neg E)) := by induction r with | zero => simp only [refinement, LinearMap.comp_id, LinearMap.id_comp] | succ r ih => rw [refinement, ← LinearMap.comp_assoc, subdivMap_norm _ _ (Equiv.neg E) (Equiv.neg E) (hemisphere_neg R) (hemisphere_neg R) barycenter (barycenter_neg), LinearMap.comp_assoc, ih, ← LinearMap.comp_assoc] lemma refinement_degree (R : ℝ) (r d : ℕ) : degreeChains (hemisphereComplex R : PreAbstractSimplicialComplex E) d ≤ (degreeChains (hemisphereComplex R) d).comap (refinement R r) := by induction r with | zero => intro c hc; exact hc | succ r ih => intro c hc change subdivMap (hemisphereComplex R) (hemisphereComplex R) barycenter (refinement R r c) ∈ degreeChains (hemisphereComplex R) d exact subdivMap_degree (hemisphereComplex R : PreAbstractSimplicialComplex E) (hemisphereComplex R) barycenter d (ih hc) lemma refinement_mesh (R : ℝ) (r n : ℕ) {c : Chain (hemisphereComplex R : PreAbstractSimplicialComplex E)} (hc : c ∈ degreeChains (hemisphereComplex R) n) {D : ℝ} (hD : 0 ≤ D) (hmesh : ∀ s ∈ c.support, ∀ x ∈ s.val, ∀ y ∈ s.val, dist x y ≤ D) {t : {s : Finset E // s ∈ hemisphereComplex R}} (ht : t ∈ (refinement R r c).support) : ∀ x ∈ t.val, ∀ y ∈ t.val, dist x y ≤ (((n:ℝ)-1)/n)^r * D := by induction r generalizing t with | zero => simpa only [refinement, LinearMap.id_apply, pow_zero, one_mul] using hmesh t ht | succ r ih => change t ∈ (subdivMap (hemisphereComplex R) (hemisphereComplex R) barycenter (refinement R r c)).support at ht obtain ⟨s,hs,hts⟩ := support_linearMap _ _ _ _ ht rw [subdivMap_simplex _ _ _ s.property] at hts have hdeg := refinement_degree R r n hc hs change s.val.card = n at hdeg have hn : 0 < n := hdeg ▸ s.property.1.card_pos have hfac : 0 ≤ ((n:ℝ)-1)/n := by have hh : (1:ℝ) ≤ n := by exact_mod_cast hn exact div_nonneg (by linarith) (by positivity) have hh := subdivSimplex_mesh R s.val n (le_of_eq hdeg) ((((n:ℝ)-1)/n)^r * D) (mul_nonneg (pow_nonneg hfac _) hD) (ih hs) hts simpa only [pow_succ', mul_assoc] using hh omit [DecidableEq E] in lemma hemisphere_mesh_two (R : ℝ) {s : Finset E} (hs : s ∈ hemisphereComplex R) {x y : E} (hx : x ∈ s) (hy : y ∈ s) : dist x y ≤ 2 := by obtain ⟨_, _, _, unit_norm⟩ := hs calc dist x y ≤ ‖x‖ + ‖y‖ := dist_le_norm_add_norm x y _ ≤ 2 := by linarith [(unit_norm x hx).1, (unit_norm y hy).1] lemma refinement_mesh_uniform (R : ℝ) (r n d : ℕ) (hd : d ≤ n) {c : Chain (hemisphereComplex R : PreAbstractSimplicialComplex E)} (hc : c ∈ degreeChains (hemisphereComplex R) d) {t : {s : Finset E // s ∈ hemisphereComplex R}} (ht : t ∈ (refinement R r c).support) : ∀ x ∈ t.val, ∀ y ∈ t.val, dist x y ≤ (((n:ℝ)-1)/n)^r * 2 := by have hdeg := refinement_degree R r d hc ht have htpos := t.property.1.card_pos change t.val.card = d at hdeg have hdpos : 0 < d := hdeg ▸ htpos have hfac : 0 ≤ ((d:ℝ)-1)/d := by have hh : (1:ℝ) ≤ d := by exact_mod_cast hdpos exact div_nonneg (by linarith) (by positivity) have hm := refinement_mesh R r d hc (D := 2) (by norm_num) (fun simplex _ _ first_mem _ second_mem => hemisphere_mesh_two R simplex.property first_mem second_mem) ht intro x hx y hy exact (hm x hx y hy).trans (mul_le_mul_of_nonneg_right (pow_le_pow_left₀ hfac (barycenter_mesh_factor hdpos hd) r) (by norm_num)) end BorsukNine.SimplicialChains end OAI