Section Ordre_de_Normalisation.
Definition value := (env * term)%type.
Inductive subterm : value -> value -> Prop :=
| sbtrm_abs_l :
forall (e : env) (A M : term), subterm (e, A) (e, Abs A M)
| sbtrm_abs_r :
forall (e : env) (A A' M : term),
subterm (Ax A' :: e, M) (e, Abs A M)
| sbtrm_app_l :
forall (e : env) (u v : term), subterm (e, u) (e, App u v)
| sbtrm_app_r :
forall (e : env) (u v : term), subterm (e, v) (e, App u v)
| sbtrm_prod_l :
forall (e : env) (A B : term), subterm (e, A) (e, Prod A B)
| sbtrm_prod_r :
forall (e : env) (A A' B : term),
subterm (Ax A' :: e, B) (e, Prod A B).
Hint Resolve sbtrm_abs_l sbtrm_abs_r sbtrm_app_l sbtrm_app_r sbtrm_prod_l
sbtrm_prod_r: pts.
red in |- *.
simple destruct a.
intros.
generalize e.
elim t; intros; apply Acc_intro; intros.
inversion_clear H.
inversion_clear H.
inversion_clear H1; auto with pts.
inversion_clear H1; auto with pts.
inversion_clear H1; auto with pts.
Qed.
Inductive R_exp : value -> value -> Prop :=
Rex_intro :
forall (e : env) (x y : term), ctxt R e x y -> R_exp (e, y) (e, x).
Hint Resolve Rex_intro: pts.
red in |- *.
simple induction 1; intros; inversion_clear H1 || inversion_clear H0.
exists (e, Abs y0 M); auto with pts.
exists (e, Abs A y0); auto with pts.
apply Rex_intro.
apply ctx_abs_r.
apply stable_ctx with (fun (_ : env) (x y : term) => y = A) (Ax A' :: e);
auto with pts.
exists (e, App y0 v); auto with pts.
exists (e, App u y0); auto with pts.
exists (e, Prod y0 B); auto with pts.
exists (e, Prod A y0); auto with pts.
apply Rex_intro.
apply ctx_prod_r.
apply stable_ctx with (fun (_ : env) (x y : term) => y = A) (Ax A' :: e);
auto with pts.
Qed.
unfold sn, transp in |- *.
simple induction 1; intros.
apply Acc_intro; intros.
elim commut_subterm_R_exp with (e, x) (f, u) (f, y); intros; auto with pts.
inversion_clear H4 in H5.
apply H1 with y0; auto with pts.
Qed.
Definition ord_norm1 : value -> value -> Prop := union value subterm R_exp.
Definition ord_norm : value -> value -> Prop := clos_trans value ord_norm1.

Lemma ord_norm_intro :
forall (e f : env) (x y z : term),
subterm (f, y) (e, x) -> red R f y z -> ord_norm (f, z) (e, x).