(* interpretation is invariant under context weakening *)
(* under assumption that the interpreted term is well-formed *)

Definition wf i t := 
  match t with 
    Pts n _ => n < size (keyx i) 
  | Var n => n < size (varx i)
  end.

(* Specifications: *)
Lemma sc_wf i j ts : sub_ctx i j -> all (wf i) ts -> all (wf j) ts.
Lemma sc_interp i j ts : sub_ctx i j -> all (wf i) ts -> interp i ts = interp j ts.
Lemma valid_wf i ts : valid (interp i ts) -> all (wf i) ts.
Lemma wf_kfree i n ts : all (wf i) ts -> all (wf i) (kfree n ts).
Lemma wf_vfree i n ts : all (wf i) ts -> all (wf i) (vfree n ts).
Lemma has_getkeys ts n : n \in getkeys ts = has (key n) ts.