Definition precondition_closed (f: function) {A: TypeTree}
(P: forall ts, dependent_type_functor_rec ts (AssertTT A) mpred) : Prop :=
forall ts x,
closed_wrt_vars (not_a_param (fn_params f)) (P ts x) /\
closed_wrt_lvars (is_a_local (fn_vars f)) (P ts x).

Lemma close_precondition_e:
forall f (A: TypeTree) (P:  forall ts, dependent_type_functor_rec ts (AssertTT A) mpred),
precondition_closed f P ->
forall ts x rho,
close_precondition (fn_params f) (fn_vars f) (P ts x) rho |-- P ts x rho.