Section CombineList.
Variable A: Type.
Variable f: A -> A -> A.
Fixpoint combinelist xs ys :=
match xs, ys with
nil, nil => Some nil
| (u::us),(v::vs) => bind (combinelist us vs) (fun l => Some (f u v :: l))
| _, _ => None
end.

Lemma combinelist_char_nth: forall xs ys l, combinelist xs ys = Some l ->
forall i d, (0 <= i < length l)%nat -> nth i l d = f (nth i xs d) (nth i ys d).