(** Library for reasoning about wellfounded relations *)
Section LT_WF_REL.
(* This Section is copied from the Coq library, which unfortunately uses Set instead of Type for Variable A, so just modified the one word. *)
Variable A : Type.
Variable R : A -> A -> Prop.
(* Relational form of inversion *)
Variable F : A -> nat -> Prop.
Definition inv_lt_rel x y := exists2 n, F x n & (forall m, F y m -> n < m).
Hypothesis F_compat : forall x y:A, R x y -> inv_lt_rel x y.
Remark acc_lt_rel : forall x:A, (exists n, F x n) -> Acc R x.

Theorem well_founded_inv_lt_rel_compat : well_founded R.
End LT_WF_REL.