Definition eq_dec := N_as_OT.eq_dec.
End NUsualOrderedType.
(** The module of maps over [N] keys based on [IntMap] *)
Module MapIntMap <: S with Module E:=NUsualOrderedType.
Module E:=NUsualOrderedType.
Module ME:=OrderedTypeFacts(E).
Module PE:=KeyOrderedType(E).
Definition key := N.
Definition t := Map.
Section A.
Variable A:Type.
Definition empty : t A := M0 A.
Definition is_empty (m : t A) : bool :=
MapEmptyp _ (MapCanonicalize _ m).
Definition find (x:key)(m: t A) : option A := MapGet _ m x.
Definition mem (x:key)(m: t A) : bool :=
match find x m with
| Some _ => true
| None => false
end.
Definition add (x:key)(v:A)(m:t A) : t A := MapPut _ m x v.
Definition remove (x:key)(m:t A) : t A := MapRemove _ m x.
Definition elements (m : t A) : list (N*A) := alist_of_Map _ m.
Definition cardinal (m : t A) : nat := MapCard _ m.
Definition MapsTo (x:key)(v:A)(m:t A) := find x m = Some v.
Definition In (x:key)(m:t A) := exists e:A, MapsTo x e m.
Definition Empty m := forall (a : key)(e:A) , ~ MapsTo a e m.
Definition eq_key (p p':key*A) := E.eq (fst p) (fst p').
Definition eq_key_elt (p p':key*A) :=
E.eq (fst p) (fst p') /\ (snd p) = (snd p').
Definition lt_key (p p':key*A) := E.lt (fst p) (fst p').

(* Specifications: *)
Lemma Empty_alt : forall m, Empty m <-> forall a, find a m = None.
Section Spec.