Section Weight.
Variable A : Type.
Variable eqA_dec : forall a b : A, {a = b} + {a <> b}.
Proof using.
intros B l; elim l; simpl in |- *; auto.
intros a l0 H c f.
rewrite <- (H (f a)).
rewrite <- (H (c + f a)).
rewrite plus_assoc_reverse; auto.
Qed.

Theorem fold_plus_permutation :
forall (B : Type) (l1 l2 : list B) (c : nat) (f : B -> nat),
permutation l1 l2 ->
fold_left (fun (a : nat) (b : B) => a + f b) l1 c =
fold_left (fun (a : nat) (b : B) => a + f b) l2 c.