Section CoqV6Beta.
Definition trm_v6 := term srt_v6.
Definition env_v6 := env srt_v6.
(* Construction du CTS *)
Definition v6 : CTS_spec srt_v6 :=
Build_CTS_spec _ axiom_v6 rules_v6 univ_v6 (beta_rule _).
(* Construction du PTS issu du CTS *)
Definition v6_pts : PTS_sub_spec srt_v6 := cts_pts_functor _ v6.
Definition le_type : red_rule srt_v6 :=
Rule _ (Le_type _ (pts_le_type _ v6_pts)).
Definition typ_v6 : env_v6 -> trm_v6 -> trm_v6 -> Prop := typ _ v6_pts.
Definition wft_v6 : env_v6 -> trm_v6 -> Prop := wf_type _ v6_pts.
Definition wf_v6 : env_v6 -> Prop := wf _ v6_pts.
Definition v6_sn := sn srt_v6 (ctxt _ (Rule _ (head_reduct _ v6))).
Hint Unfold le_type typ_v6 wft_v6 wf_v6 v6_sn: pts.
(* Algorithme de mise en forme normale de tete Decidabilite du sous-typage pour les types bien formes *)
Proof beta_whnf srt_v6.
Proof
CR_WHNF_convert_hn srt_v6 v6_sort_dec (beta_rule srt_v6)
(church_rosser_red srt_v6) whnf.
apply Build_subtype_dec_CTS.
exact (church_rosser_red srt_v6).
exact (beta_hn_sort srt_v6).
exact (beta_hn_prod srt_v6).
exact whnf.
exact beta_conv_hnf.
exact univ_v6_dec.
Qed.
(* L'axiome:  ECC est fortement normalisant *)
Axiom
v6_normalise :
forall (e : env_v6) (t T : trm_v6), typ_v6 e t T -> v6_sn e t.
(* Subject-Reduction *)
simpl in |- *.
apply beta_sound; auto with arith pts.
simpl in |- *.
apply cumul_inv_prod.
exact v6_is_subtype_dec.
Qed.
(* Construction du type-checker *)
Proof full_cts_type_checker srt_v6 v6 v6_is_subtype_dec v6_is_norm_sound.
(* open the type-checker *)
Proof ptc_inf_ppal_type _ _ v6_algorithms.
Proof ptc_chk_wft _ _ v6_algorithms.

Lemma check_type :
forall (e : env_v6) (t T : trm_v6), wf_v6 e -> check_dec _ v6_pts e t T.