Section SetDenoteLems.
Context (B : Type). Variables (f : clause -> pred B) (b : pred B).
Variable (h : M.t -> clause -> M.t).
Variable (H : forall c cls s, setd f inter b cls s -> f c s ->
setd f inter b (h cls c) s).
Proof with simpl; auto.
revert cls0; induction l... intros s0 [A C] D; apply IHl...
Qed.
Proof with simpl; auto.
rewrite M.fold_spec; intros; apply setd_fold_left; auto.
Qed.
Proof with auto.
intros H1 H2. unfold setd.
apply listd_In_pred; [ | auto]; intros e H3.
assert (H4: M.In e cls1 \/ M.In e cls2) by
(rewrite elements_In in H3; apply M.union_spec; auto).
do 2 rewrite <-elements_In in H4.
destruct H4 as [H4|H4];
[apply listd_In_inv_pred with (l := M.elements cls1)|
apply listd_In_inv_pred with (l := M.elements cls2)]...
Qed.
Proof with auto.
intros A C.
rewrite setd_base_separate.
rewrite setd_base_separate in A.
destruct A as [A' A]. split; auto.
clear A'.
apply listd_In_pred; [| auto].
intros a D.
generalize (setd_add_In_inv_elems cls _ _ D); intros [E | F].
rewrite <- E... rewrite <- M.elements_spec1, SetoidList.InA_alt in F.
destruct F as [y [F G]]; subst y.
solve [apply (listd_In_inv_pred f _ _ _ A G)].
Qed.
Proof with auto.
intro A; apply listd_In_pred; [|auto]; intros a C.
apply listd_In_inv_pred with (l := M.elements cls)...
apply setd_rem_In_inv_elems with (x := c)...
Qed.

Lemma setd_filter bf cls s :
setd f inter TT cls s -> setd f inter TT (M.filter bf cls) s.