Documentation

CslibFrontier.Foundations.Data.Finset.UniqueTail

At most one selected tail of a nonnegative finite sum #

If at most one index is selected, summing the selected tails counts each nonnegative summand at most once. This pointwise fact needs no probabilistic independence. Its compression consumer uses uniqueness of the actual first-overflow index.

theorem Finset.sum_ite_Ico_le_sum_range {M : Type u_1} [AddCommMonoid M] [Preorder M] [AddLeftMono M] (m : ℕ) (P : ℕ → Prop) [DecidablePred P] {f : ℕ → M} (hf : ∀ i < m, 0 ≤ f i) (hunique : ∀ j < m, ∀ k < m, P j → P k → j = k) :
(∑ j ∈ range m, if P j then ∑ i ∈ Ico j m, f i else 0) ≤ ∑ i ∈ range m, f i

If at most one starting index is selected, its nonnegative tail is bounded by the full sum. The endpoint m is excluded from both sums.