Module Import P := Properties M.
Hint Resolve elements_spec2 : core.
Hint Immediate
min_elt_spec1 min_elt_spec2 min_elt_spec3
max_elt_spec1 max_elt_spec2 max_elt_spec3 : set.
Definition gtb x y := match E.compare x y with Gt => true | _ => false end.
Definition leb x := fun y => negb (gtb x y).
Definition elements_lt x s := List.filter (gtb x) (elements s).
Definition elements_ge x s := List.filter (leb x) (elements s).
Instance gtb_compat x : Proper (E.eq==>Logic.eq) (gtb x).
Instance leb_compat x : Proper (E.eq==>Logic.eq) (leb x).
Hint Resolve gtb_compat leb_compat : core.
Definition Above x s := forall y, In y s -> E.lt y x.
Definition Below x s := forall y, In y s -> E.lt x y.
(** Two other induction principles on sets: we can be more restrictive on the element we add at each step.  *)

Lemma set_induction_min :
forall P : t -> Type,
(forall s : t, Empty s -> P s) ->
(forall s s', P s -> forall x, Below x s -> Add x s s' -> P s') ->
forall s : t, P s.