Documentation

CslibFrontier.Foundations.Algebra.BigOperators.IteMem

A sum of one constant on a set and another outside #

Finset.sum_ite_const_zero computes the sum of a constant on the indices satisfying a predicate. Fintype.sum_ite_mem_const: over a finite type, the sum of y on a set A and of z outside is |A| * y + (card - |A|) * z.

theorem Finset.sum_ite_const_zero {ι : Type u_1} {M : Type u_2} [AddCommMonoid M] (s : Finset ι) (p : ι → Prop) [DecidablePred p] (a : M) :
(∑ i ∈ s, if p i then a else 0) = (filter p s).card • a

A constant supported on the indices satisfying p sums to the size of that support times the constant.

theorem Fintype.sum_ite_mem_const {ι : Type u_1} {R : Type u_2} [Fintype ι] [DecidableEq ι] [Ring R] (A : Finset ι) (y z : R) :
(∑ a : ι, if a ∈ A then y else z) = ↑A.card * y + (↑(card ι) - ↑A.card) * z

The sum over a finite type of one constant on a set and another outside it.