Section SetLems.
Variables (s : M.t) (x y : clause).
Proof with auto.
rewrite M.add_spec; intuition.
Qed.
Proof with auto.
rewrite M.add_spec; intuition.
Qed.
Proof with auto.
apply prop_ext; split.
intro A. assert (B : exists z, OrderedClause.eq y z /\ In z (M.elements s0)).
unfold OrderedClause.eq. eauto.
rewrite <- SetoidList.InA_alt, M.elements_spec1 in B. auto.
rewrite <- M.elements_spec1, SetoidList.InA_alt; intros [z [A B]].
subst; auto.
Qed.
case_eq (M.elements M.empty); intros; auto.
destruct (M.elements_spec1 M.empty e) as [? _].
absurd (M.In e M.empty).
apply M.empty_spec.
apply H0.
rewrite H; constructor.
auto.
Qed.

Lemma setd_add_In_inv_elems :
In y (M.elements (M.add x s)) -> x = y \/ M.In y s.