Definition bind {A B} (aopt: option A) (f: A -> option B): option B :=
  match aopt with None => None | Some a => f a end.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_Znth {d: Inhabitant A} xs ys l (C: combinelist xs ys = Some l) i (L:0 <= i < Zlength l): Znth i l = f (Znth i xs) (Znth i ys).