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 sub_sort_env_indep : forall (R : Subtyping_rule) (e : env) (s1 s2 : sort), Rule (Le_type R) e (Srt s1) (Srt s2) -> forall f : env, Rule (Le_type R) f (Srt s1) (Srt s2).