induction 1; intuition; simpl in *.
intuition.
intuition; subst.
econstructor; eauto.
edestruct IHrel_map; eauto.
intuition.
econstructor; eauto.
Qed.
(* a relational version of sumList *)
Inductive sumList_rel(A : Type)(rel : A -> Rat -> Prop) : list A -> Rat -> Prop :=
| slr_nil :
forall r,
r == rat0 ->
sumList_rel rel nil r
| slr_cons :
forall (ls : list A)(a : A) r1 r2 r3,
sumList_rel rel ls r1 ->
rel a r2 ->
r3 == r2 + r1 ->
sumList_rel rel (a :: ls) r3.

(* Specifications: *)
Lemma sumList_rel_distance : forall (A : Set)(ls : list A)(f1 f2 : A -> Rat -> Prop) r r1 r2,
(forall a r1 r2, In a ls -> f1 a r1 -> f2 a r2 -> (ratDistance r1 r2) <= r) ->
sumList_rel f1 ls r1 ->
sumList_rel f2 ls r2 ->
ratDistance r1 r2 <= (r * (length ls / 1)).