Section ECC.
Definition trm_ecc := term srt_ecc.
Definition env_ecc := env srt_ecc.
(* Construction du CTS *)
Definition ecc : CTS_spec srt_ecc :=
Build_CTS_spec _ axiom_ecc rules_ecc univ_ecc (beta_delta_rule _).
(* Construction du PTS issu du CTS *)
Definition ecc_pts : PTS_sub_spec srt_ecc := cts_pts_functor _ ecc.
Definition le_type : red_rule srt_ecc :=
Rule _ (Le_type _ (pts_le_type _ ecc_pts)).
Definition typ_ecc : env_ecc -> trm_ecc -> trm_ecc -> Prop := typ _ ecc_pts.
Definition wft_ecc : env_ecc -> trm_ecc -> Prop := wf_type _ ecc_pts.
Definition wf_ecc : env_ecc -> Prop := wf _ ecc_pts.
Definition ecc_sn := sn srt_ecc (ctxt _ (Rule _ (head_reduct _ ecc))).
Hint Unfold le_type typ_ecc wft_ecc wf_ecc ecc_sn: pts.
(* Algorithme de mise en forme normale de tete Decidabilite du sous-typage pour les types bien formes *)
Proof beta_delta_whnf srt_ecc.
Proof
CR_WHNF_convert_hn srt_ecc ecc_sort_dec (beta_delta_rule srt_ecc)
(church_rosser_beta_delta srt_ecc) whnf.
apply Build_subtype_dec_CTS.
exact (church_rosser_beta_delta srt_ecc).
exact (bd_hn_sort srt_ecc).
exact (bd_hn_prod srt_ecc).
exact whnf.
exact bd_conv_hnf.
exact univ_ecc_dec.
Qed.
(* L'axiome:  ECC est fortement normalisant *)
Axiom
ecc_normalise :
forall (e : env_ecc) (t T : trm_ecc), typ_ecc e t T -> ecc_sn e t.
(* Subject-Reduction *)
unfold beta_delta in |- *.
simpl in |- *.
unfold union in |- *.
apply union_sound.
apply beta_sound; auto with arith pts.
simpl in |- *.
apply cumul_inv_prod.
exact ecc_is_subtype_dec.
apply delta_sound.
Qed.

Lemma ecc_is_norm_sound : norm_sound_CTS _ ecc.