Module ME := OrderedTypeFacts E.
Definition empty : t := let (s, _) := empty in s.
Definition is_empty (s : t) : bool :=
if is_empty s then true else false.
Definition mem (x : elt) (s : t) : bool :=
if mem x s then true else false.
Definition eq_dec := equal.
Definition equal (s s' : t) : bool :=
if equal s s' then true else false.
Definition subset (s s' : t) : bool :=
if subset s s' then true else false.
Definition choose (s : t) : option elt :=
match choose s with
| inleft (exist _ x _) => Some x
| inright _ => None
end.
Definition elements (s : t) : list elt := let (l, _) := elements s in l.
Hint Resolve elements_3 : core.
Definition max_elt (s : t) : option elt :=
match max_elt s with
| inleft (exist _ x _) => Some x
| inright _ => None
end.
Definition add (x : elt) (s : t) : t := let (s', _) := add x s in s'.
Definition remove (x : elt) (s : t) : t := let (s', _) := remove x s in s'.
Definition singleton (x : elt) : t := let (s, _) := singleton x in s.

Lemma singleton_2 : forall x y : elt, E.eq x y -> In y (singleton x).