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.
Proof with auto.
intro A; rewrite elements_In in A.
solve [apply setd_add_In_inv in A; exact A].
Qed.

Lemma setd_rem_In_inv : M.In y (M.remove x s) -> M.In y s.