Module KeyDecidableType(D:DecidableType).
Local Open Scope signature_scope.
Local Notation key := D.t.
Definition eqk {elt} : relation (key*elt) := D.eq @@1.
Definition eqke {elt} : relation (key*elt) := D.eq * Logic.eq.
Hint Unfold eqk eqke : core.
(** eqk, eqke are equalities *)
Instance eqk_equiv {elt} : Equivalence (@eqk elt) := _.
Instance eqke_equiv {elt} : Equivalence (@eqke elt) := _.
(** eqke is stricter than eqk *)
Instance eqke_eqk {elt} : subrelation (@eqke elt) (@eqk elt).
Hint Resolve InA_eqke_eqk : core.
Definition MapsTo {elt} (k:key)(e:elt):= InA eqke (k,e).
Definition In {elt} k m := exists e:elt, MapsTo k e m.
Hint Unfold MapsTo In : core.
(* Alternative formulations for [In k l] *)

Lemma In_cons {elt} k p (l:list (key*elt)) :
In k (p::l) <-> D.eq k (fst p) \/ In k l.