unfold compare_clause'1;
repeat constructor; repeat intro.
(* irrefl *)
rewrite (comp_refl _ clause_cspec) in H;   unfold compare_clause_length in *;
destruct x; simpl in *;
rewrite Zcompare_refl in H; repeat (rewrite comp_refl in H; auto); congruence.
(* trans *)
remember (compare_clause_length x y) as j; destruct j.
remember (compare_clause_length y z) as j; destruct j.
replace (compare_clause_length x z) with Eq...
symmetry in Heqj,Heqj0|-*.
clear - Heqj Heqj0.
apply Zcompare_Eq_iff_eq.
apply Zcompare_Eq_eq in Heqj.
apply Zcompare_Eq_eq in Heqj0.
congruence.
unfold compare_clause_length in *.
symmetry in Heqj; apply Zcompare_Eq_eq in Heqj. rewrite Heqj. rewrite <- Heqj0; auto.
unfold compare_clause_length in *.
symmetry in Heqj; apply Zcompare_Eq_eq in Heqj. rewrite Heqj. rewrite <- Heqj0; auto.
remember (compare_clause_length y z) as j; destruct j.
unfold compare_clause_length in *.
symmetry in Heqj0; apply Zcompare_Eq_eq in Heqj0. rewrite <- Heqj0. rewrite <- Heqj; auto.
replace (compare_clause_length x z) with Lt; auto.
unfold compare_clause_length in *.
symmetry in Heqj,Heqj0|-*.
eapply Zcompare_Lt_trans; eauto.
inversion H0.
inversion H.
(* CompSpec *)
remember (compare_clause_length x y) as j; destruct j.
do_comp clause_cspec x y...
econstructor.
unfold compare_clause_length in *.
symmetry in Heqj.
apply Zcompare_Eq_eq in Heqj. rewrite Heqj.
rewrite Zcompare_refl. auto.
constructor; auto. rewrite <- Heqj; auto.
constructor; auto.
replace (compare_clause_length y x) with Lt; auto.
symmetry in Heqj|-*; apply Zcompare_Gt_Lt_antisym; auto.
Qed.
Hint Resolve clause_cspec'1.
Module OrderedClause <: OrderedType
with Definition t:=clause
with Definition compare:=compare_clause'.
Definition t := clause.
Definition eq : clause -> clause -> Prop := Logic.eq.

Lemma mem_add_spec:
forall x s, mem_add x s = if mem x s then None else Some (add x s).