(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.(* on part d'un CTS confluent, avec un algo de whnf, ... *)

  Record subtype_dec_CTS : Set := 
    {scts_cr : church_rosser red_step;
     scts_hn_sort : forall (e : env) (s : sort), head_normal hdr e (Srt s);
     scts_hn_prod :
      forall (e : env) (A B : term), head_normal hdr e (Prod A B);
     scts_whnf :
      forall (e : env) (t : term),
      sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u};
     scts_convert_hn :
      forall (e : env) (x y : term),
      sn red_step e x ->
      sn red_step e y -> decide (conv_hn_inv hd_rule e x y);
     scts_rt_univ_dec : forall s s' : sort, decide (rt_univ s s')}.

(* Specifications: *)
Theorem CR_WHNF_inv_cumul_dec : forall (e : env) (x y : term), sn red_step e x -> sn red_step e y -> decide (cumul_hn_inv e x y).
Theorem CR_WHNF_cumul_dec : forall (e : env) (x y : term), sn red_step e x -> sn red_step e y -> decide (rt_cumul e x y).
Lemma cumul_inv_prod : product_inversion rt_cumul.