import Mathlib import OAI.Analysis.HardSphere.Geometry.SubsetPointLinear namespace OAI noncomputable section open MeasureTheory Filter Set open scoped ENNReal Topology BigOperators open scoped BigOperators ComplexConjugate open MeasureTheory ProbabilityTheory Filter Set open scoped ENNReal NNReal Topology BigOperators open MeasureTheory ProbabilityTheory Real Complex open scoped ENNReal ComplexConjugate open ProbabilityTheory open MeasureTheory Filter Set open scoped ENNReal Topology open MeasureTheory Set open scoped ENNReal open MeasureTheory Filter Set open scoped ENNReal Topology BigOperators namespace HardSphere.SphericalCoordinates open scoped BigOperators lemma sector_active_capacity {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : (Fin n → Point) → E} (hF : ContDiff ℝ 1 F) {r l : ℝ} (hr : 0 simp [activeLabels] | succ n => let μ := Measure.pi (fun a ↦ volume.restrict (cube (b (σ a)) l)) let M := ∫⁻ X, ENNReal.ofReal (‖F X‖^2) ∂μ let G := fun i ↦ ∫⁻ X, ENNReal.ofReal (particleGradSq F i X) ∂μ let C := ENNReal.ofReal (Real.sqrt 3*l^3/r) have hi (i : Fin (n+1)) (hi : i∈activeLabels σ) : M≤C*G i := by obtain ⟨j,hji,hs⟩ := (mem_activeLabels σ i).mp hi obtain ⟨k,rfl⟩ := Fin.exists_succAbove_eq hji exact sector_coordinate_capacity hF hr hl (fun a ↦ b (σ a)) i k (congrArg b hs) hz calc _ = ∑ _ ∈ activeLabels σ, M := by simp only [Finset.sum_const,nsmul_eq_mul]; rfl _ ≤ ∑ i ∈ activeLabels σ, C*G i := Finset.sum_le_sum hi _ = C*∑ i ∈ activeLabels σ, G i := (Finset.mul_sum _ _ _).symm _ ≤ C*∑ i, G i := by gcongr; exact Finset.subset_univ _ _ = _ := rfl lemma activeLabels_reindex_card {I J C : Type*} [Fintype I] [Fintype J] (e : I ≃ J) (σ : I → C) : (activeLabels (σ ∘ e.symm)).card=(activeLabels σ).card := by classical have he : (activeLabels (σ ∘ e.symm)).map e.symm.toEmbedding=activeLabels σ := by ext i simp only [Finset.mem_map,Equiv.toEmbedding_apply,mem_activeLabels,Function.comp_apply] constructor · rintro ⟨j,⟨k,hkj,hσ⟩,rfl⟩ exact ⟨e.symm k,fun h ↦ hkj (e.symm.injective h),hσ⟩ · rintro ⟨k,hki,hσ⟩ refine ⟨e i,⟨e k,fun h ↦ hki (e.injective h),?_⟩,e.symm_apply_apply i⟩ simpa only [Equiv.symm_apply_apply] using hσ rw [←he,Finset.card_map] lemma finite_sector_active_capacity {I C : Type*} [Fintype I] [Fintype C] [DecidableEq I] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : (I → Point) → E} (hF : ContDiff ℝ 1 F) {r l : ℝ} (hr : 0