import Mathlib namespace OAI section section section noncomputable section namespace CannonPackingGeometry open Set Metric lemma half_cos_pos {a : ℝ} (ha : a∈Ioo (0:ℝ) Real.pi) : 0vertex (f,k))) (f : A) (k : Fin 3) : cornerAngle vertex θ f (vertex (f,k))=θ (f,k) := by classical unfold cornerAngle rw [Finset.sum_eq_single k] · simp · intro j hj hjk simp only [ite_eq_right (fun h=>hjk (hinj f h))] · simp lemma cornerAngle_zero {V A : Type*} (vertex : A × Fin 3 → V) (θ : A × Fin 3 → ℝ) (f : A) (v : V) (h : ¬∃ k,vertex (f,k)=v) : cornerAngle vertex θ f v=0 := by classical apply Finset.sum_eq_zero intro k hk exact ite_eq_right (fun hk=>h ⟨k,hk⟩) lemma sum_cornerAngle {V A : Type*} [Fintype A] [DecidableEq V] (vertex : A × Fin 3 → V) (θ : A × Fin 3 → ℝ) (v : V) : (∑ f,cornerAngle vertex θ f v)=∑ i : A × Fin 3,if vertex i=v then θ i else 0 := by classical simp only [cornerAngle,Fintype.sum_prod_type] apply Finset.sum_congr rfl intro f hf apply Finset.sum_congr rfl intro k hk by_cases h : vertex (f,k)=v <;> simp [h] theorem intrinsic_cosine_law_fin3 (θ r : Fin 3 → ℝ) (q : ℝ) (hθ : ∀ k,θ k∈Ioo (0:ℝ) Real.pi) (hs : ∑ k,θ k=Real.pi) (hr : ∀ k,0 fin_cases j <;> fin_cases k <;> simp_all all_goals nlinarith only [hid] end CannonPackingGeometry end end end end end OAI