unfold compare_clause';
repeat constructor; repeat intro.
(* irrefl *)
id_compare (clause_prio x) (clause_prio x)...
apply (Ilt_irrefl l).
(* trans *)
id_compare (clause_prio x) (clause_prio y). rewrite e.
id_compare (clause_prio y) (clause_prio z)...
id_compare (clause_prio y) (clause_prio z)...
rewrite e in l.
id_compare (clause_prio x) (clause_prio z)...
rewrite e0 in l.   contradiction (Ilt_irrefl l).
contradiction (Ilt_irrefl (Ilt_trans l l0)).
id_compare (clause_prio x) (clause_prio z)...
rewrite e in *.   contradiction (Ilt_irrefl (Ilt_trans l l0)).
contradiction (Ilt_irrefl (Ilt_trans l1 (Ilt_trans l l0))).
id_compare (clause_prio y) (clause_prio z)...
(* CompSpec *)
id_compare (clause_prio x) (clause_prio y).
do_comp clause_cspec x y...
econstructor. rewrite e.
id_compare (clause_prio y) (clause_prio y)...
contradiction (Ilt_irrefl l).
constructor... rewrite e.
id_compare (clause_prio y) (clause_prio y)...
contradiction (Ilt_irrefl l).
constructor...
id_compare (clause_prio x) (clause_prio y)...
rewrite e in l.
contradiction (Ilt_irrefl l).
contradiction (Ilt_irrefl (Ilt_trans l l0)).
constructor...
id_compare (clause_prio y) (clause_prio x)...
rewrite e in l.
contradiction (Ilt_irrefl l).
contradiction (Ilt_irrefl (Ilt_trans l l0)).
Qed.
Hint Resolve clause_cspec'.
Definition clause_length (cl : clause) : Z :=
match cl with
| PureClause gamma delta _ _ => Zlength gamma + Zlength delta
| PosSpaceClause gamma delta sigma =>
Zlength gamma + Zlength delta + Zlength sigma
| NegSpaceClause gamma sigma delta =>
Zlength gamma + Zlength sigma + Zlength delta
end%Z.
Definition compare_clause_length (cl1 cl2 : clause) :=
Zcompare (clause_length cl1) (clause_length cl2).
Definition compare_clause'1 (cl1 cl2 : clause) : comparison :=
match compare_clause_length cl1 cl2 with
| Eq => compare_clause cl1 cl2
| c => c
end.

Lemma clause_cspec'1: CompSpec' compare_clause'1.
Proof with (repeat (comp_tac || solve [econstructor; simpl; repeat comp_tac])).