Fixpoint fold_left (l:list B) (a0:A) : A :=
    match l with
      | [] => a0
      | b :: l => fold_left l (f a0 b)
    end.

(* Specifications: *)
Lemma fold_left_app : forall (l l':list B)(i:A), fold_left (l++l') i = fold_left l' (fold_left l i).
Lemma fold_left_S_0 : forall (A:Type)(l:list A), fold_left (fun x _ => S x) l 0 = length l.