Module L := FMapList.Raw E.(** Not exactly pretty nor perfect, but should suffice as a first naive implem. 
    Anyway, map2 isn't in Ocaml...
  *)

  Definition anti_elements (A:Type)(l:list (key*A)) := L.fold (@add _) l (empty _).Definition map2 (A B C:Type)(f:option A->option B -> option C)(m:t A)(m':t B) : t C := 
    anti_elements (L.map2 f (elements m) (elements m')).

(* Specifications: *)
Lemma add_spec : forall (A:Type)(m:t A) x y e, find x (add y e m) = if E.eq_dec x y then Some e else find x m.
Lemma anti_elements_mapsto_aux : forall (A:Type)(l:list (key*A)) m k e, NoDupA (eq_key (A:=A)) l -> (forall x, L.PX.In x l -> In x m -> False) -> (MapsTo k e (L.fold (@add _) l m) <-> L.PX.MapsTo k e l \/ MapsTo k e m).
Lemma anti_elements_mapsto : forall (A:Type) l k e, NoDupA (eq_key (A:=A)) l -> (MapsTo k e (anti_elements l) <-> L.PX.MapsTo k e l).
Lemma find_anti_elements : forall (A:Type)(l: list (key*A)) x, sort (@lt_key _) l -> find x (anti_elements l) = L.find x l.
Lemma find_elements : forall (A:Type)(m: t A) x, L.find x (elements m) = find x m.
Lemma elements_in : forall (A:Type)(s:t A) x, L.PX.In x (elements s) <-> In x s.
Lemma map2_1 : forall (A B C:Type)(m: t A)(m': t B)(x:key) (f:option A->option B ->option C), In x m \/ In x m' -> find x (map2 f m m') = f (find x m) (find x m').
Lemma map2_2 : forall (A B C:Type)(m: t A)(m': t B)(x:key) (f:option A->option B ->option C), In x (map2 f m m') -> In x m \/ In x m'.