(* ---------------------------------------------------------------------------- *)
(* Type preservation. *)

Lemma term_substitution:
forall n E2 t2 T2,
j n E2 t2 T2 ->
forall x T1 E,
E2 = insert x T1 E ->
forall m t1,
j m E t1 T1 ->
forall k,
k >= m + n ->
j k E (subst t1 x t2) T2.