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.

Lemma beta_par_red1_subst :
forall (e : env) (x y t u T : term),
beta_par_red1 (Ax T :: e) t u ->
beta_par_red1 e x y -> beta_par_red1 e (subst x t) (subst y u).