Section Iter.
Context {I T : Type}.
Context (op : T -> T -> T).
Context (x0 : T).
Context (neutral_l : forall x, op x0 x = x).
Context (neutral_r : forall x, op x x0 = x).
Context (assoc : forall x y z, op x (op y z) = op (op x y) z).
Fixpoint iter (l : list I) (f : I -> T) :=
match l with
| nil => x0
| cons h l' => op (f h) (iter l' f)
end.
Definition iter' (l : list I) (f : I -> T) :=
fold_right (fun i acc => op (f i) acc) x0 l.

Lemma iter_cat l1 l2 f :
iter (l1 ++ l2) f = op (iter l1 f) (iter l2 f).