Section Riemann_sum.
Context {V : ModuleSpace R_Ring}.
Definition Riemann_sum (f : R -> V) (ptd : SF_seq) : V :=
foldr plus zero (pairmap (fun x y => (scal (fst y - fst x) (f (snd y)))) (SF_h ptd,zero) (SF_t ptd)).

Lemma Riemann_sum_zero (f : R -> V) ptd :
SF_sorted Rle ptd ->
SF_h ptd = last (SF_h ptd) (SF_lx ptd) ->
Riemann_sum f ptd = zero.