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 well_founded_lexprodx: forall B A (f: A -> B) R1 R2,
well_founded R1 -> (forall n, well_founded (R2 n)) ->
well_founded (lexprodx f R1 R2).