Sums and products from lists #
This file provides further results about List.prod, List.sum,
which calculate the product and sum of elements of a list
and List.alternatingProd, List.alternatingSum, their alternating counterparts.
theorem
List.Perm.sum_eq'
{M : Type u_4}
[AddMonoid M]
{lโ lโ : List M}
(h : lโ.Perm lโ)
(hc : Pairwise AddCommute lโ)
:
If elements of a list additively commute with each other, then their sum does not depend on the order of elements.
theorem
List.sum_map_count_dedup_filter_eq_countP
{ฮฑ : Type u_2}
[DecidableEq ฮฑ]
(p : ฮฑ โ Bool)
(l : List ฮฑ)
:
Summing the count of x over a list filtered by some p is just countP applied to p
theorem
List.drop_take_succ_flatten_eq_getElem
{ฮฑ : Type u_2}
(L : List (List ฮฑ))
(i : โ)
(h : i < L.length)
:
In a flatten of sublists, taking the slice between the indices A and B - 1 gives back the
original sublist of index i if A is the sum of the lengths of sublists of index < i, and
B is the sum of the lengths of sublists of index โค i.
theorem
List.Sublist.prod_dvd_prod
{M : Type u_4}
[CommMonoid M]
{lโ lโ : List M}
(h : lโ.Sublist lโ)
: