(* inversion de rt_cumul *)

  Inductive cumul_hn_inv : env -> term -> term -> Prop :=
    | cuhi_srt :
        forall (e : env) (s s' : sort),
        rt_univ s s' -> cumul_hn_inv e (Srt s) (Srt s')
    | cuhi_ref : forall (e : env) (n : nat), cumul_hn_inv e (Ref n) (Ref n)
    | cuhi_abs :
        forall (e : env) (A A' M M' : term),
        conv hdr e A A' ->
        conv hdr (Ax A' :: e) M M' -> cumul_hn_inv e (Abs A M) (Abs A' M')
    | cuhi_app :
        forall (e : env) (u u' v v' : term),
        conv hdr e u u' ->
        conv hdr e v v' -> cumul_hn_inv e (App u v) (App u' v')
    | cuhi_prod :
        forall (e : env) (A A' B B' : term),
        rt_cumul e A' A ->
        rt_cumul (Ax A' :: e) B B' -> cumul_hn_inv e (Prod A B) (Prod A' B').(* inversion de rt_cumul *)

  Inductive cumul_hn_inv : env -> term -> term -> Prop :=
    | cuhi_srt :
        forall (e : env) (s s' : sort),
        rt_univ s s' -> cumul_hn_inv e (Srt s) (Srt s')
    | cuhi_ref : forall (e : env) (n : nat), cumul_hn_inv e (Ref n) (Ref n)
    | cuhi_abs :
        forall (e : env) (A A' M M' : term),
        conv hdr e A A' ->
        conv hdr (Ax A' :: e) M M' -> cumul_hn_inv e (Abs A M) (Abs A' M')
    | cuhi_app :
        forall (e : env) (u u' v v' : term),
        conv hdr e u u' ->
        conv hdr e v v' -> cumul_hn_inv e (App u v) (App u' v')
    | cuhi_prod :
        forall (e : env) (A A' B B' : term),
        rt_cumul e A' A ->
        rt_cumul (Ax A' :: e) B B' -> cumul_hn_inv e (Prod A B) (Prod A' B').(* inversion de rt_cumul *)

  Inductive cumul_hn_inv : env -> term -> term -> Prop :=
    | cuhi_srt :
        forall (e : env) (s s' : sort),
        rt_univ s s' -> cumul_hn_inv e (Srt s) (Srt s')
    | cuhi_ref : forall (e : env) (n : nat), cumul_hn_inv e (Ref n) (Ref n)
    | cuhi_abs :
        forall (e : env) (A A' M M' : term),
        conv hdr e A A' ->
        conv hdr (Ax A' :: e) M M' -> cumul_hn_inv e (Abs A M) (Abs A' M')
    | cuhi_app :
        forall (e : env) (u u' v v' : term),
        conv hdr e u u' ->
        conv hdr e v v' -> cumul_hn_inv e (App u v) (App u' v')
    | cuhi_prod :
        forall (e : env) (A A' B B' : term),
        rt_cumul e A' A ->
        rt_cumul (Ax A' :: e) B B' -> cumul_hn_inv e (Prod A B) (Prod A' B').(* inversion de rt_cumul *)

  Inductive cumul_hn_inv : env -> term -> term -> Prop :=
    | cuhi_srt :
        forall (e : env) (s s' : sort),
        rt_univ s s' -> cumul_hn_inv e (Srt s) (Srt s')
    | cuhi_ref : forall (e : env) (n : nat), cumul_hn_inv e (Ref n) (Ref n)
    | cuhi_abs :
        forall (e : env) (A A' M M' : term),
        conv hdr e A A' ->
        conv hdr (Ax A' :: e) M M' -> cumul_hn_inv e (Abs A M) (Abs A' M')
    | cuhi_app :
        forall (e : env) (u u' v v' : term),
        conv hdr e u u' ->
        conv hdr e v v' -> cumul_hn_inv e (App u v) (App u' v')
    | cuhi_prod :
        forall (e : env) (A A' B B' : term),
        rt_cumul e A' A ->
        rt_cumul (Ax A' :: e) B B' -> cumul_hn_inv e (Prod A B) (Prod A' B').(* inversion de rt_cumul *)

  Inductive cumul_hn_inv : env -> term -> term -> Prop :=
    | cuhi_srt :
        forall (e : env) (s s' : sort),
        rt_univ s s' -> cumul_hn_inv e (Srt s) (Srt s')
    | cuhi_ref : forall (e : env) (n : nat), cumul_hn_inv e (Ref n) (Ref n)
    | cuhi_abs :
        forall (e : env) (A A' M M' : term),
        conv hdr e A A' ->
        conv hdr (Ax A' :: e) M M' -> cumul_hn_inv e (Abs A M) (Abs A' M')
    | cuhi_app :
        forall (e : env) (u u' v v' : term),
        conv hdr e u u' ->
        conv hdr e v v' -> cumul_hn_inv e (App u v) (App u' v')
    | cuhi_prod :
        forall (e : env) (A A' B B' : term),
        rt_cumul e A' A ->
        rt_cumul (Ax A' :: e) B B' -> cumul_hn_inv e (Prod A B) (Prod A' B').(* inversion de rt_cumul *)

  Inductive cumul_hn_inv : env -> term -> term -> Prop :=
    | cuhi_srt :
        forall (e : env) (s s' : sort),
        rt_univ s s' -> cumul_hn_inv e (Srt s) (Srt s')
    | cuhi_ref : forall (e : env) (n : nat), cumul_hn_inv e (Ref n) (Ref n)
    | cuhi_abs :
        forall (e : env) (A A' M M' : term),
        conv hdr e A A' ->
        conv hdr (Ax A' :: e) M M' -> cumul_hn_inv e (Abs A M) (Abs A' M')
    | cuhi_app :
        forall (e : env) (u u' v v' : term),
        conv hdr e u u' ->
        conv hdr e v v' -> cumul_hn_inv e (App u v) (App u' v')
    | cuhi_prod :
        forall (e : env) (A A' B B' : term),
        rt_cumul e A' A ->
        rt_cumul (Ax A' :: e) B B' -> cumul_hn_inv e (Prod A B) (Prod A' B').

Lemma inv_cumul_trans : forall (e : env) (x y z : term), cumul_hn_inv e x y -> cumul_hn_inv e y z -> cumul_hn_inv e x z.