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_map {A : Type} (l : list (option A)) f :
(forall x, In x l -> x = Some (f x)) ->
option_list_map l = Some (map f l).