Section shorthands.
Variables (x y: e).
Definition Elt: Prop := Ecmp _ x y = Lt.
Definition Egt: Prop := Ecmp _ x y = Gt.
Definition Ele: Prop := Ecmp _ x y <> Gt.
Definition Ege: Prop := Ecmp _ x y <> Lt.
Definition Eltb: bool := match Ecmp _ x y with Lt => true | _ => false end.
Definition Egtb: bool := match Ecmp _ x y with Gt => true | _ => false end.
Definition Eleb: bool := match Ecmp _ x y with Gt => false | _ => true end.
Definition Egeb: bool := match Ecmp _ x y with Lt => false | _ => true end.
Proof with auto.
assert (Ecmp e x x = CompOpp (Ecmp e x x)).
apply Ecmp_sym.
destruct (Ecmp e x x); try discriminate...
Qed.
Proof with auto.
intros x y z.
unfold Ele.
case_eq (Ecmp e y z); intros.
apply Ecmp_eq_trans_r with y...
apply Ecmp_trans with y...
elimtype False...
Qed.
Proof with auto.
intros x y z.
unfold Ege.
case_eq (Ecmp e x y); intros.
apply Ecmp_eq_trans_l with y...
elimtype False...
apply Ecmp_trans with y...
Qed.
Proof with try assumption.
apply Build_preorder.
unfold reflexive.
intros.
unfold Ele.
rewrite Ecmp_refl.
intro.
discriminate.
unfold transitive.
intros.
unfold Ele.
case_eq (Ecmp e x z); do 2 intro; try discriminate.
apply H0.
apply Ecmp_ge_gt_trans with x...
apply Ele_Ege...
Qed.
Proof with try assumption.
apply Build_preorder.
unfold reflexive.
intros.
unfold Ege.
rewrite Ecmp_refl.
discriminate.
unfold transitive.
intros.
unfold Ege.
case_eq (Ecmp e x z); do 2 intro; try discriminate.
apply H0.
apply Ecmp_le_lt_trans with x...
apply Ege_Ele...
Qed.
Hint Immediate Ege_preorder EO.
Proof with try firstorder.
intros.
destruct H0.
constructor...
repeat intro.
apply -> H.
apply preord_trans with y...
Qed.
Proof with auto.
intros. apply preorder_impl with Ele...
intros. apply Eleb_true.
Qed.

Lemma Egeb_preorder: preorder _ (fun x y => Egeb x y = true).