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.

Lemma rev_cmp_eq {A:Type} (f : A -> A -> comparison) (a1 a2 : A) :
Eq = rev_cmp f a1 a2 -> rev_cmp f a1 a2 = f a1 a2.