(** ** Specifications written using equivalences *)
Section IffSpec.
Variable elt elt' elt'': Type.
Implicit Type m: t elt.
Implicit Type x y z: key.
Implicit Type e: elt.

(* Specifications: *)
Lemma In_iff : forall m x y, E.eq x y -> (In x m <-> In y m).
Lemma MapsTo_iff : forall m x y e, E.eq x y -> (MapsTo x e m <-> MapsTo y e m).
Lemma mem_in_iff : forall m x, In x m <-> mem x m = true.
Lemma not_mem_in_iff : forall m x, ~In x m <-> mem x m = false.
Lemma In_dec : forall m x, { In x m } + { ~ In x m }.
Lemma find_mapsto_iff : forall m x e, MapsTo x e m <-> find x m = Some e.
Lemma not_find_in_iff : forall m x, ~In x m <-> find x m = None.
Lemma in_find_iff : forall m x, In x m <-> find x m <> None.
Lemma equal_iff : forall m m' cmp, Equivb cmp m m' <-> equal cmp m m' = true.
Lemma empty_mapsto_iff : forall x e, MapsTo x e (empty elt) <-> False.
Lemma empty_in_iff : forall x, In x (empty elt) <-> False.
Lemma is_empty_iff : forall m, Empty m <-> is_empty m = true.
Lemma add_mapsto_iff : forall m x y e e',
MapsTo y e' (add x e m) <->
(E.eq x y /\ e=e') \/
(~E.eq x y /\ MapsTo y e' m).
Lemma add_in_iff : forall m x y e, In y (add x e m) <-> E.eq x y \/ In y m.
Lemma add_neq_mapsto_iff : forall m x y e e',
~ E.eq x y -> (MapsTo y e' (add x e m)  <-> MapsTo y e' m).
Lemma add_neq_in_iff : forall m x y e,
~ E.eq x y -> (In y (add x e m)  <-> In y m).
Lemma remove_mapsto_iff : forall m x y e,
MapsTo y e (remove x m) <-> ~E.eq x y /\ MapsTo y e m.
Lemma remove_in_iff : forall m x y, In y (remove x m) <-> ~E.eq x y /\ In y m.
Lemma remove_neq_mapsto_iff : forall m x y e,
~ E.eq x y -> (MapsTo y e (remove x m)  <-> MapsTo y e m).
Lemma remove_neq_in_iff : forall m x y,
~ E.eq x y -> (In y (remove x m)  <-> In y m).
Lemma elements_mapsto_iff : forall m x e,
MapsTo x e m <-> InA (@eq_key_elt _) (x,e) (elements m).
Lemma elements_in_iff : forall m x,
In x m <-> exists e, InA (@eq_key_elt _) (x,e) (elements m).
Lemma map_mapsto_iff : forall m x b (f : elt -> elt'),
MapsTo x b (map f m) <-> exists a, b = f a /\ MapsTo x a m.
Lemma map_in_iff : forall m x (f : elt -> elt'),
In x (map f m) <-> In x m.
Lemma mapi_in_iff : forall m x (f:key->elt->elt'),
In x (mapi f m) <-> In x m.