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.