Definition lexprodx {B A : Type} (f: A -> B) (R1: B -> B -> Prop)
  (R2: B -> A -> A -> Prop)
  (x y : A) : Prop :=
     R1 (f x) (f y) \/ f x = f y /\ R2 (f x) x y.

Lemma lexprodx_eq: forall B A f R1 R2 x y, lexprodx f R1 R2 x y <-> lexprod B (fun _ => A) R1 R2 (existT (fun _:B => A) (f x) x) (existT (fun _:B => A) (f y) y).