simple induction 1; intros.
inversion_clear H0; auto with arith pts.
right; split.
exists u; auto with arith pts.
inversion_clear H0.
generalize H1.
inversion_clear H2; auto with arith pts.
inversion_clear H0; auto with arith pts.
inversion_clear H2; auto with arith pts.
elim H1 with f0; auto with arith pts; intros.
right; intros.
inversion_clear H4.
elim H2 with g; auto with arith pts.
simple induction 1; split; auto with arith pts; intros.
exists x; auto with arith pts.
Qed.
End RuleOper.
Hint Unfold R_rt: pts.
Hint Resolve rd_ax rd_def R_env_hd R_env_tl: pts.
Section Rule_Props.
Variable R : red_rule.
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}.
End Rule_Props.
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)}.

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).