import Mathlib import OAI.Probability.BinarySweep.Conditional.PlacementCycleMoment import OAI.Probability.BinarySweep.Conditional.WeightedCycle namespace OAI noncomputable section open scoped BigOperators Classical namespace BinaryCoordinateSweeps open Irrep Representation variable {b h k r : ℕ} {bits : Fin b → ℕ} (H : PathFamily bits h) {A W : Type*} [Fintype A] [NormedAddCommGroup W] [InnerProductSpace ℂ W] [FiniteDimensional ℂ W] (e : A ⊕ Fin k ≃ FreeSlot H 0) (σ : Representation ℂ (Equiv.Perm A) W) lemma placement_weighted_cycle_bound_pos (hd : ∀j, bits j≤2*r) {z : ℝ} (hz : 0≤z) (hzr : z≤linePerturbationRadius r) {N : ℕ} (hN : 0 exact placementFiberMoment_nonneg H e σ z q _ _ · intro j _; exact hedge x j · apply Finset.prod_nonneg intro j _ unfold placementEdge split_ifs <;> exact placementKernel_nonneg H hz hz1 _ _ _ = Real.exp B * (∑x : Fin (2*q) → Placement H k 0, ∏j, placementEdge H z (rev j) (x j) (x (finRotate (2*q) j))* Real.exp (-placementEdgeCost H z (rev j) (x j) (x (finRotate (2*q) j))/((2*q:ℕ):ℝ))) := by simp_rw [Finset.prod_mul_distrib,hconst] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ ring _ ≤ Real.exp B * Real.exp (-pathCost H+Real.log 4*k*b) := mul_le_mul_of_nonneg_left (placement_weighted_cycle_bound_pos H hd hz hzr (by omega) rev) (Real.exp_pos B).le _ = _ := by rw [←Real.exp_add]; congr 1; ring end BinaryCoordinateSweeps end end OAI