(** specialized versions analyzing only keys (resp. elements) *)
Definition filter_dom (f : key -> bool) := filter (fun k _ => f k).
Definition filter_range (f : elt -> bool) := filter (fun _ => f).
Definition for_all_dom (f : key -> bool) := for_all (fun k _ => f k).
Definition for_all_range (f : elt -> bool) := for_all (fun _ => f).
Definition exists_dom (f : key -> bool) := exists_ (fun k _ => f k).
Definition exists_range (f : elt -> bool) := exists_ (fun _ => f).
Definition partition_dom (f : key -> bool) := partition (fun k _ => f k).
Definition partition_range (f : elt -> bool) := partition (fun _ => f).
End Elt.
Add Parametric Morphism elt : (@cardinal elt)
with signature Equal ==> eq as cardinal_m.
Add Parametric Morphism elt : (@Partition elt)
with signature Equal ==> Equal ==> Equal ==> iff as Partition_m.
Add Parametric Morphism elt : (@update elt)
with signature Equal ==> Equal ==> Equal as update_m.
Add Parametric Morphism elt : (@restrict elt)
with signature Equal ==> Equal ==> Equal as restrict_m.
Add Parametric Morphism elt : (@diff elt)
with signature Equal ==> Equal ==> Equal as diff_m.
End WProperties_fun.
(** * Same Properties for self-contained weak maps and for full maps *)
Module WProperties (M:WS) := WProperties_fun M.E M.
Module Properties := WProperties.
(** * Properties specific to maps with ordered keys *)
Module OrdProperties (M:S).
Module Import ME := OrderedTypeFacts M.E.
Module Import O:=KeyOrderedType M.E.
Module Import P:=Properties M.
Section Elt.
Variable elt:Type.
Notation eqke := (@eqke elt).
Notation eqk := (@eqk elt).
Notation ltk := (@ltk elt).
Notation cardinal := (@cardinal elt).
Notation Equal := (@Equal elt).
Notation Add := (@Add elt).
Definition Above x (m:t elt) := forall y, In y m -> E.lt y x.
Definition Below x (m:t elt) := forall y, In y m -> E.lt x y.
Section Elements.

(* Specifications: *)
Lemma sort_equivlistA_eqlistA : forall l l' : list (key*elt),
sort ltk l -> sort ltk l' -> equivlistA eqke l l' -> eqlistA eqke l l'.