Proof using.
intros A B f l1 l2 H; elim H; simpl in |- *; auto.
intros a b l; auto.
repeat rewrite <- app_ass.
apply permutation_app_comp; auto.
intros k3 l4 l5 H0 H1 H2 H3; apply permutation_trans with (1 := H1); auto.
Qed.

(* Permutation is compatible with fold_left *)
Theorem fold_left_permutation :
forall (A B : Type) (f : A -> B -> A),
(forall (a : A) (b1 b2 : B), f (f a b1) b2 = f (f a b2) b1) ->
forall (a : A) (l1 l2 : list B),
permutation l1 l2 -> fold_left f l1 a = fold_left f l2 a.