Sums and products from lists #
This file provides basic definitions for List.prod, List.sum,
which calculate the product and sum of elements of a list
and List.alternatingProd, List.alternatingSum, their alternating counterparts.
The alternating sum of a list.
Equations
Instances For
The alternating product of a list.
Equations
Instances For
theorem
List.prod_induction_nonempty
{M : Type u_2}
[MulOneClass M]
{l : List M}
(p : M → Prop)
(hom : ∀ (a b : M), p a → p b → p (a * b))
(hl : l ≠ [])
(base : ∀ x ∈ l, p x)
:
p l.prod
theorem
List.sum_induction_nonempty
{M : Type u_2}
[AddZeroClass M]
{l : List M}
(p : M → Prop)
(hom : ∀ (a b : M), p a → p b → p (a + b))
(hl : l ≠ [])
(base : ∀ x ∈ l, p x)
:
p l.sum
@[simp]
@[simp]