Definition option_bind {A B: Type} (f : A -> option B) (x : option A) :=
match x with | None => None | Some y => f y end.
Fixpoint option_list_map {A : Type} (l : list (option A)) : option (list A) :=
match l with
| nil => Some nil
| Some h :: t => option_map (cons h) (option_list_map t)
| _ => None
end.

Lemma option_list_map_Some {A : Type} (l : list (option A)) v:
option_list_map l = Some v ->
forall x, In x l -> exists vx, x = Some vx.