import Mathlib import OAI.Analysis.HardSphere.Comparison.LabelMoment namespace OAI section section noncomputable section open MeasureTheory ProbabilityTheory Set open scoped BigOperators ENNReal namespace HardSphere.Comparison lemma partial_match_eq_pow {ι : Type*} [Fintype ι] [DecidableEq ι] {A : ι→Type*} [∀i,DecidableEq (A i)] (S : Finset ι) (G : ℝ) (p : ∀i,A i×A i) : (∏i,if i∈S then (if (p i).1=(p i).2 then G else 1) else 1)= G^(S.filter (fun i ↦ (p i).1=(p i).2)).card := by have he (i : ι) : (if i∈S then (if (p i).1=(p i).2 then G else 1) else 1)= if i∈S ∧ (p i).1=(p i).2 then G else 1 := by by_cases hi : i∈S <;> simp [hi] simp_rw [he] rw [Finset.prod_ite] have hs : (Finset.univ.filter (fun i:ι ↦ i∈S ∧ (p i).1=(p i).2))= S.filter (fun i ↦ (p i).1=(p i).2) := by ext i; simp simp only [Finset.prod_const, one_pow, mul_one, hs] lemma partial_label_match_moment {ι : Type*} [Fintype ι] [DecidableEq ι] (A : ι→Type*) [∀i,Fintype (A i)] [∀i,Nonempty (A i)] [∀i,DecidableEq (A i)] [∀i,MeasurableSpace (A i)] [∀i,MeasurableSingletonClass (A i)] (S : Finset ι) (G M : ℝ) (hG : 1≤G) (hM : 0