(* 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')}.
Variable the_scts : subtype_dec_CTS.
(* open it *)
Let CR : church_rosser red_step := scts_cr the_scts.
Let shn_sort := scts_hn_sort the_scts.
Let shn_prod := scts_hn_prod the_scts.
Let whnf :
forall (e : env) (t : term),
sn red_step e t -> {u : term | red hdr e t u &  head_normal hdr e u} :=
scts_whnf the_scts.
Let conv_hn_dec :
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_convert_hn the_scts.
Let rt_univ_dec : forall s s' : sort, decide (rt_univ s s') :=
scts_rt_univ_dec the_scts.
Hint Resolve shn_sort shn_prod: pts.
Let inv_cumul_hn := equiv_inv_cumul_hn CR shn_sort shn_prod.
Let f (tr : env * (term * term)) :=
match tr with
| (e, (t1, t2)) => (e, t1, (e, t2))
end.

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