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.
If elements of a list commute with each other, then their product does not depend on the order of elements.
If elements of a list additively commute with each other, then their sum does not depend on the order of elements.
Summing the count of x
over a list filtered by some p
is just countP
applied to p
The members of l.ranges
have no duplicate
Alias of List.ranges_flatten
.
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
.
Alias of List.drop_take_succ_flatten_eq_getElem
.
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
.
A morphism into the opposite monoid acts on the product by acting on the reversed elements.