Section Confluence_Beta.
Inductive beta_par_red1 : env -> term -> term -> Prop :=
| par_beta :
forall (e : env) (M M' T : term),
beta_par_red1 (Ax T :: e) M M' ->
forall N N' : term,
beta_par_red1 e N N' ->
beta_par_red1 e (App (Abs T M) N) (subst N' M')
| sort_par_red_b :
forall (e : env) (s : sort), beta_par_red1 e (Srt s) (Srt s)
| ref_par_red_b :
forall (e : env) (n : nat), beta_par_red1 e (Ref n) (Ref n)
| abs_par_red_b :
forall (e : env) (M M' T T' : term),
beta_par_red1 (Ax T' :: e) M M' ->
beta_par_red1 e T T' -> beta_par_red1 e (Abs T M) (Abs T' M')
| app_par_red_b :
forall (e : env) (M M' : term),
beta_par_red1 e M M' ->
forall N N' : term,
beta_par_red1 e N N' -> beta_par_red1 e (App M N) (App M' N')
| prod_par_red_b :
forall (e : env) (M M' : term),
beta_par_red1 e M M' ->
forall N N' : term,
beta_par_red1 (Ax M' :: e) N N' ->
beta_par_red1 e (Prod M N) (Prod M' N').
Hint Resolve par_beta sort_par_red_b ref_par_red_b abs_par_red_b
app_par_red_b prod_par_red_b: pts.
simple induction M; auto with arith pts.
Qed.
Hint Resolve refl_beta_par_red1: pts.
simple induction 1; auto with arith pts; intros.
elim H0; auto with arith pts.
Qed.
simple induction 1; intros; auto with arith pts.
red in |- *; red in |- *.
apply rt_trans with (App (Abs T M') N'); auto with arith pts.
change (red beta e0 (App (Abs T M0) N0) (App (Abs T M') N')) in |- *.
auto with arith pts.
Qed.
red in |- *.
simple induction 1; auto with arith pts.
Qed.
red in |- *.
simple induction 1; simpl in |- *; intros; auto with arith pts.
rewrite distr_lift_subst; auto with arith pts.
apply par_beta; auto with arith pts.
replace (Ax (lift_rec 1 T k)) with (lift_decl 1 (Ax T) k);
auto with arith pts.
apply abs_par_red_b; auto with arith pts.
replace (Ax (lift_rec 1 T' k)) with (lift_decl 1 (Ax T') k);
auto with arith pts.
apply prod_par_red_b; auto with arith pts.
replace (Ax (lift_rec 1 M' k)) with (lift_decl 1 (Ax M') k);
auto with arith pts.
Qed.
Hint Resolve beta_par_red1_lift: pts.
simple induction v; simpl in |- *; intros; auto with arith pts.
elim (lt_eq_lt_dec n0 n); intros; auto with arith pts.
elim a; intros; auto with arith pts.
apply iter_R_lift with g; auto with arith pts.
Qed.
simple induction 2; simpl in |- *; intros; auto with arith pts.
rewrite distr_subst; auto with arith pts.
apply par_beta; auto with arith pts.
fold (subst_decl x (Ax T) n) in |- *; auto with arith pts.
elim (lt_eq_lt_dec n0 n); intros; auto with arith pts.
elim a; intros; auto with arith pts.
apply iter_R_lift with g; auto with arith pts.
elim H1; auto with arith pts.
apply abs_par_red_b; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (subst_decl x (Ax T') n :: f));
auto with arith pts.
apply R_env_hd.
simpl in |- *.
apply rd_ax.
apply beta_par_red1_subst_l with g; auto with arith pts.
elim H5; auto with arith pts.
apply prod_par_red_b; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (subst_decl x (Ax M') n :: f));
auto with arith pts.
apply R_env_hd.
simpl in |- *.
apply rd_ax.
apply beta_par_red1_subst_l with g; auto with arith pts.
elim H5; auto with arith pts.
Qed.
intros.
unfold subst in |- *.
apply beta_par_red1_subst_rec with (Ax T) (Ax T :: e) e; auto with arith pts.
Qed.
unfold confluent, commut, transp in |- *.
simple induction 1; intros.
inversion_clear H4.
elim H1 with M'0; auto with arith pts; intros.
elim H3 with N'0; auto with arith pts; intros.
exists (subst x1 x0); apply beta_par_red1_subst with T; auto with arith pts.
inversion_clear H5.
elim H1 with M'1; auto with arith pts; intros.
elim H3 with N'0; auto with arith pts; intros.
exists (subst x1 x0).
apply beta_par_red1_subst with T; auto with arith pts.
apply par_beta; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax T :: e0));
auto with arith pts.
apply
(beta_par_red1_stable_env
(fun (e : env) (x y : term) => beta_par_red1 e y x)
(Ax T' :: e0)); auto with arith pts.
inversion_clear H0.
exists (Srt s); auto with arith pts.
inversion_clear H0.
exists (Ref n); auto with arith pts.
inversion_clear H4.
elim H1 with M'0; auto with arith pts; intros.
elim H3 with T'0; auto with arith pts; intros.
exists (Abs x1 x0); auto with arith pts.
apply abs_par_red_b; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax T' :: e0));
auto with arith pts.
apply abs_par_red_b; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax T' :: e0));
auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax T :: e0));
auto with arith pts.
apply
(beta_par_red1_stable_env
(fun (e : env) (x y : term) => beta_par_red1 e y x)
(Ax T'0 :: e0)); auto with arith pts.
generalize H0 H1.
clear H0 H1.
inversion_clear H4.
intro.
inversion_clear H4.
intros.
elim H4 with (Abs T M'0); auto with arith pts; intros.
elim H3 with N'0; auto with arith pts; intros.
generalize H8.
inversion_clear H7.
clear H8; intro.
inversion_clear H8.
exists (subst x1 M'2); auto with arith pts.
apply par_beta; auto with arith pts.
apply
(beta_par_red1_stable_env
(fun (e : env) (x y : term) => beta_par_red1 e y x)
(Ax T'0 :: e0)); auto with arith pts.
apply beta_par_red1_subst with T'0; auto with arith pts.
intros.
elim H5 with M'0; auto with arith pts; intros.
elim H3 with N'0; auto with arith pts; intros.
exists (App x0 x1); auto with arith pts.
intros.
inversion_clear H4.
elim H1 with M'0; auto with arith pts; intros.
elim H3 with N'0; auto with arith pts; intros.
exists (Prod x0 x1); auto with arith pts.
apply prod_par_red_b; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax M' :: e0));
auto with arith pts.
apply prod_par_red_b; auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax M' :: e0));
auto with arith pts.
apply
(beta_par_red1_stable_env
(fun (e : env) (x y : term) => beta_par_red1 e y x)
(Ax x0 :: e0)); auto with arith pts.
apply (beta_par_red1_stable_env beta_par_red1 (Ax M'0 :: e0));
auto with arith pts.
Qed.
Proof
TML_Church_rosser (ctxt beta) beta_par_red1 confluence_beta_par_red1
beta_red_par_red1 beta_par_red1_red.
End Confluence_Beta.
Proof hn_sort beta_rule sort_beta_norm.
Proof hn_prod beta_rule prod_beta_norm.

Lemma inv_prod_beta_conv : product_inversion (conv beta).