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.

Lemma subterm_sn :
forall (e : env) (t : term),
sn (ctxt R) e t ->
forall (f : env) (u : term), subterm (f, u) (e, t) -> sn (ctxt R) f u.