Definition R_lift :=
    forall (d1 : decl) (g e : env) (t u : term),
    R e t u ->
    forall (k : nat) (f : env),
    ins_in_env g d1 k e f -> R f (lift_rec 1 t k) (lift_rec 1 u k).Definition R_subst :=
    forall (s : term) (d1 : decl) (g e : env) (t u : term),
    R e t u ->
    forall (n : nat) (f : env),
    sub_in_env g d1 s n e f -> R_rt R f (subst_rec s t n) (subst_rec s u n).Definition R_stable_env :=
    forall (R' : red_rule) (e : env) (x y : term),
    R e x y -> forall f : env, R_in_env R' e f -> R f x y.Record product_inversion : Prop := 
    {inv_prod_l :
      forall (e : env) (A B C D : term), R e (Prod A B) (Prod C D) -> R e C A;
     inv_prod_r :
      forall (e : env) (A B C D : term),
      R e (Prod A B) (Prod C D) -> R (Ax C :: e) B D}.Record product_inversion : Prop := 
    {inv_prod_l :
      forall (e : env) (A B C D : term), R e (Prod A B) (Prod C D) -> R e C A;
     inv_prod_r :
      forall (e : env) (A B C D : term),
      R e (Prod A B) (Prod C D) -> R (Ax C :: e) B D}.Record product_inversion : Prop := 
    {inv_prod_l :
      forall (e : env) (A B C D : term), R e (Prod A B) (Prod C D) -> R e C A;
     inv_prod_r :
      forall (e : env) (A B C D : term),
      R e (Prod A B) (Prod C D) -> R (Ax C :: e) B D}.Record Basic_rule : Type := 
    {Rule : red_rule;
     R_lifts : R_lift Rule;
     R_substs : R_subst Rule;
     R_stable : R_stable_env Rule}.Record Basic_rule : Type := 
    {Rule : red_rule;
     R_lifts : R_lift Rule;
     R_substs : R_subst Rule;
     R_stable : R_stable_env Rule}.Record Basic_rule : Type := 
    {Rule : red_rule;
     R_lifts : R_lift Rule;
     R_substs : R_subst Rule;
     R_stable : R_stable_env Rule}.Record Basic_rule : Type := 
    {Rule : red_rule;
     R_lifts : R_lift Rule;
     R_substs : R_subst Rule;
     R_stable : R_stable_env Rule}.Record Basic_rule : Type := 
    {Rule : red_rule;
     R_lifts : R_lift Rule;
     R_substs : R_subst Rule;
     R_stable : R_stable_env Rule}.(* A subtyping rule is a relation which is a Basic_rule and a preorder
 *)
  Record Subtyping_rule : Type := 
    {Le_type : Basic_rule;
     preord : forall e : env, preorder term (Rule Le_type e)}.(* A subtyping rule is a relation which is a Basic_rule and a preorder
 *)
  Record Subtyping_rule : Type := 
    {Le_type : Basic_rule;
     preord : forall e : env, preorder term (Rule Le_type e)}.(* A subtyping rule is a relation which is a Basic_rule and a preorder
 *)
  Record Subtyping_rule : Type := 
    {Le_type : Basic_rule;
     preord : forall e : env, preorder term (Rule Le_type e)}.

Lemma iter_R_lift : forall R : red_rule, R_lift R -> forall (n : nat) (e f : env), trunc n f e -> forall t u : term, R e t u -> R f (lift n t) (lift n u).