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 from_elements_spec : forall A (l : list (key * A)), NoDupA (X.eq@@1)%signature l ->
forall x v, find x (from_elements l) = Some v <-> InA (X.eq * eq)%signature (x, v) l.