Sums and products from lists #
This file provides basic 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.
Alias of List.prod_flatten.
Alias of List.sum_flatten.
We'd like to state this as L.headI * L.tail.prod = L.prod, but because L.headI relies on an
inhabited instance to return a garbage value on the empty list, this is not possible.
Instead, we write the statement in terms of (L.get? 0).getD 1.
We'd like to state this as L.headI + L.tail.sum = L.sum, but because L.headI
relies on an inhabited instance to return a garbage value on the empty list, this is not possible.
Instead, we write the statement in terms of (L.get? 0).getD 0.
Same as get?_zero_mul_tail_prod, but avoiding the List.headI garbage complication by
requiring the list to be nonempty.
Same as get?_zero_add_tail_sum, but avoiding the List.headI garbage complication
by requiring the list to be nonempty.
A variant of prod_range_succ which pulls off the first term in the product rather than the
last.
A variant of sum_range_succ which pulls off the first term in the sum rather than the last.
A non-commutative variant of List.prod_reverse
A non-commutative variant of List.sum_reverse
This is the List.sum version of add_neg
Cancellation of a telescoping sum.
Alternative version of List.sum_set when the list is over a group
Several lemmas about sum/head/tail for List ℕ.
These are hard to generalize well, as they rely on the fact that default ℕ = 0.
If desired, we could add a class stating that default = 0.
Alias of List.length_flatMap.
Alias of List.countP_flatMap.
Alias of List.count_flatMap.
In a flatten, taking the first elements up to an index which is the sum of the lengths of the
first i sublists, is the same as taking the flatten of the first i sublists.
Alias of List.take_sum_flatten.
In a flatten, taking the first elements up to an index which is the sum of the lengths of the
first i sublists, is the same as taking the flatten of the first i sublists.
In a flatten, dropping all the elements up to an index which is the sum of the lengths of the
first i sublists, is the same as taking the join after dropping the first i sublists.
Alias of List.drop_sum_flatten.
In a flatten, dropping all the elements up to an index which is the sum of the lengths of the
first i sublists, is the same as taking the join after dropping the first i sublists.