(* 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').

(* Specifications: *)
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.
Lemma inv_cumul_cumul : forall (e : env) (x y : term), cumul_hn_inv e x y -> rt_cumul e x y.
Lemma commut_red_hnf_rt_cumul : forall e : env, commut term (rt_cumul e) (fun x y : term => red hdr e y x /\ head_normal hdr e x).
Lemma inv_cumul_conv : forall (e : env) (x y : term), conv_hn_inv hd_rule e x y -> cumul_hn_inv e x y.
Lemma equiv_inv_cumul_hn : forall (e : env) (x y : term), rt_cumul e x y -> forall x' y' : term, red hdr e x x' -> head_normal hdr e x' -> red hdr e y y' -> head_normal hdr e y' -> cumul_hn_inv e x' y'.