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

(* Specifications: *)
Lemma term_weakening:
forall n E t T,
j n E t T ->
forall x U E',
insert x U E = E' ->
j n E' (shift x t) T.
Lemma type_weakening:
forall n E t T,
j n E t T ->
forall x E' T',
map (shift x) E = E' ->
shift x T = T' ->
j n E' t T'.
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.