Module VSM := VSM.
Proof with simpl; auto.
intros; induction l... rewrite IHl; clear IHl.
remember (nonreflex_atom a) as b; destruct b...
destruct a; simpl in *.
assert (expr_cmp e e0 = Eq).
remember (expr_cmp e e0) as b; destruct b; try reflexivity.
inversion Heqb. inversion Heqb. clear Heqb.
symmetry in H; apply comp_eq in H; auto. rewrite H.
extensionality s; apply prop_ext; split; simpl; auto.
intros [H1 H2]; auto. split; auto. apply var_eq_refl.
Qed.
Proof with simpl; auto.
intros; unfold normalize_atoms; rewrite listd_sort_uniq...
induction l... rewrite <-order_eqv_sound, <-IHl...
Qed.
(* todo: make the following lems more general *)
Proof with simpl; auto; try solve[congruence].
intro H1. apply setd_fold_left...
intros c cls s0 H2 H3. apply setd_add...
unfold setd; rewrite empty_set_elems...
rewrite (@listd_unfold_inter clause state) in H1.
destruct H1; auto.
Qed.
Proof with auto; try congruence.
unfold rev_cmp; destruct (f a1 a2)...
Qed.
Proof with simpl; auto; try solve[congruence].
induction l...
remember (rev_cmp compare_clause c' a) as b; destruct b...
inversion 1; subst... cut (c' = c \/ In c l)... inversion 1...
Qed.
Proof with simpl; auto.
unfold rev_cmp. rewrite comp_refl; auto.
Qed.
Proof with simpl; auto; try solve[congruence].
induction l... intro H1.
generalize compare_clause_refl as H2; intros.
remember (rev_cmp compare_clause a c) as b; destruct b.
generalize Heqb; apply rev_cmp_eq in Heqb; rewrite Heqb.  intro Hx; apply comp_eq in Hx; auto.
right; apply IHl. generalize (in_insert_uniq _ _ _ H1) as H3.
inversion 1; subst...
right; apply IHl. generalize (in_insert_uniq _ _ _ H1) as H3.
inversion 1; subst...
Qed.
End CL_Sound.
(* some general lemmas about positives: not sure where to put these so they go here for now *)

Lemma positive_base_case: forall n, 0 = nat_of_P n - 1 -> n=1%positive.