Definition rev_cmp {A : Type} (cmp : A -> A -> comparison) :=
  fun a b => match cmp a b with Eq => Eq | Lt => Gt | Gt => Lt end.

Lemma rev_cmp_eq : forall {A : Type} (cmp : A -> A -> comparison) (x y : A), (forall x0 y0 : A, Eq = cmp x0 y0 -> x0 = y0) -> Eq = rev_cmp cmp x y -> x = y.