Corollary from_elements_OK : forall A l,
  OK (fold_left (fun acc xv => Dom.add (fst xv) acc) l Dom.empty)
     (fold_left (fun acc xv => S.add (fst xv) (snd xv) acc) l (S.empty A)).Definition from_elements A (l : list (key * A))
  : t A (List.fold_left (fun acc xv => Dom.add (fst xv) acc) l Dom.empty) :=
  exist (OK (List.fold_left (fun acc xv => Dom.add (fst xv) acc) l Dom.empty))
        (List.fold_left (fun acc xv => S.add (fst xv) (snd xv) acc) l (@S.empty A))
        (from_elements_OK l).

(* Specifications: *)
Lemma empty_spec : forall A x, find x (@empty A) = None.
Lemma is_empty_spec : forall A dom (m : t A dom), is_empty m = true <-> forall x, find x m = None.
Lemma mem_spec : forall A x dom (m : t A dom), mem x m = true <-> exists v, find x m = Some v.