Definition expr_closed_wrt_lvars (S: ident -> Prop) (e: expr) : Prop :=
  forall (cs: compspecs) rho ve',
     (forall i, S i \/ Map.get (ve_of rho) i = Map.get ve' i) ->
     eval_expr e rho = eval_expr e (mkEnviron (ge_of rho) ve' (te_of rho)).Definition lvalue_closed_wrt_lvars (S: ident -> Prop) (e: expr) : Prop :=
  forall (cs: compspecs) rho ve',
     (forall i, S i \/ Map.get (ve_of rho) i = Map.get ve' i) ->
     eval_lvalue e rho = eval_lvalue e (mkEnviron (ge_of rho) ve'  (te_of rho)).

(* Specifications: *)
Lemma closed_wrt_cmp_ptr : forall {cs: compspecs} S e1 e2 c, expr_closed_wrt_vars S e1 -> expr_closed_wrt_vars S e2 -> closed_wrt_vars S (`(cmp_ptr_no_mem c) (eval_expr e1) (eval_expr e2)).
Lemma closed_wrtl_cmp_ptr : forall {cs: compspecs} S e1 e2 c, expr_closed_wrt_lvars S e1 -> expr_closed_wrt_lvars S e2 -> closed_wrt_lvars S (`(cmp_ptr_no_mem c) (eval_expr e1) (eval_expr e2)).
Lemma closed_wrt_eval_id: forall S i, ~ S i -> closed_wrt_vars S (eval_id i).
Lemma closed_wrtl_eval_id: forall S i, closed_wrt_lvars S (eval_id i).
Lemma closed_wrt_temp: forall S i v, ~ S i -> closed_wrt_vars S (locald_denote (temp i v)).
Lemma closed_wrtl_temp: forall S i v, closed_wrt_lvars S (locald_denote (temp i v)).
Lemma closed_wrt_get_result1 : forall (S: ident -> Prop) i , ~ S i -> closed_wrt_vars S (get_result1 i).
Lemma closed_wrtl_get_result1 : forall (S: ident -> Prop) i , closed_wrt_lvars S (get_result1 i).
Lemma closed_wrt_tc_FF: forall {cs: compspecs} S e, closed_wrt_vars S (denote_tc_assert (tc_FF e)).
Lemma closed_wrtl_tc_FF: forall {cs: compspecs} S e, closed_wrt_lvars S (denote_tc_assert (tc_FF e)).
Lemma closed_wrt_tc_TT: forall {cs: compspecs} S, closed_wrt_vars S (denote_tc_assert (tc_TT)).
Lemma closed_wrtl_tc_TT: forall {cs: compspecs} S, closed_wrt_lvars S (denote_tc_assert (tc_TT)).
Lemma closed_wrt_andp: forall S (P Q: environ->mpred), closed_wrt_vars S P -> closed_wrt_vars S Q -> closed_wrt_vars S (P && Q).
Lemma closed_wrtl_andp: forall S (P Q: environ->mpred), closed_wrt_lvars S P -> closed_wrt_lvars S Q -> closed_wrt_lvars S (P && Q).
Lemma closed_wrt_exp: forall {A} S (P: A -> environ->mpred), (forall a, closed_wrt_vars S (P a)) -> closed_wrt_vars S (exp P).
Lemma closed_wrtl_exp: forall {A} S (P: A -> environ->mpred), (forall a, closed_wrt_lvars S (P a)) -> closed_wrt_lvars S (exp P).
Lemma closed_wrt_sepcon: forall S (P Q: environ->mpred), closed_wrt_vars S P -> closed_wrt_vars S Q -> closed_wrt_vars S (P * Q).
Lemma closed_wrtl_sepcon: forall S (P Q: environ->mpred), closed_wrt_lvars S P -> closed_wrt_lvars S Q -> closed_wrt_lvars S (P * Q).
Lemma closed_wrt_emp {A} {ND: NatDed A} {SL: SepLog A}: forall S, closed_wrt_vars S emp.
Lemma closed_wrtl_emp {A} {ND: NatDed A} {SL: SepLog A}: forall S, closed_wrt_lvars S emp.
Lemma closed_wrt_allp: forall A S P, (forall x: A, closed_wrt_vars S (P x)) -> closed_wrt_vars S (allp P).
Lemma closed_wrtl_allp: forall A S P, (forall x: A, closed_wrt_lvars S (P x)) -> closed_wrt_lvars S (allp P).
Lemma closed_wrt_globvars: forall S gv v, closed_wrt_vars S (globvars2pred gv v).
Lemma closed_wrtl_globvars: forall S gv v, closed_wrt_lvars S (globvars2pred gv v).
Lemma closed_wrt_main_pre: forall prog u v S, closed_wrt_vars S (main_pre prog u v).
Lemma closed_wrtl_main_pre: forall prog u v S, closed_wrt_lvars S (main_pre prog u v).
Lemma closed_wrt_main_pre_ext: forall {Espec : OracleKind} prog z u v S, closed_wrt_vars S (main_pre_ext prog z u v).
Lemma closed_wrtl_main_pre_ext: forall {Espec : OracleKind} prog z u v S, closed_wrt_lvars S (main_pre_ext prog z u v).
Lemma closed_wrt_not1: forall (i j: ident), i<>j -> not (eq i j).
Lemma closed_wrt_tc_andp: forall {cs: compspecs} S a b, closed_wrt_vars S (denote_tc_assert a) -> closed_wrt_vars S (denote_tc_assert b) -> closed_wrt_vars S (denote_tc_assert (tc_andp a b)).
Lemma closed_wrt_tc_orp: forall {cs: compspecs} S a b, closed_wrt_vars S (denote_tc_assert a) -> closed_wrt_vars S (denote_tc_assert b) -> closed_wrt_vars S (denote_tc_assert (tc_orp a b)).
Lemma closed_wrt_tc_bool: forall {cs: compspecs} S b e, closed_wrt_vars S (denote_tc_assert (tc_bool b e)).
Lemma closed_wrt_tc_int_or_ptr_type: forall {cs: compspecs} S t, closed_wrt_vars S (denote_tc_assert (tc_int_or_ptr_type t)).
Lemma closed_wrtl_tc_andp: forall {cs: compspecs} S a b, closed_wrt_lvars S (denote_tc_assert a) -> closed_wrt_lvars S (denote_tc_assert b) -> closed_wrt_lvars S (denote_tc_assert (tc_andp a b)).
Lemma closed_wrtl_tc_orp: forall {cs: compspecs} S a b, closed_wrt_lvars S (denote_tc_assert a) -> closed_wrt_lvars S (denote_tc_assert b) -> closed_wrt_lvars S (denote_tc_assert (tc_orp a b)).
Lemma closed_wrtl_tc_bool: forall {cs: compspecs} S b e, closed_wrt_lvars S (denote_tc_assert (tc_bool b e)).
Lemma closed_wrt_tc_test_eq: forall {cs: compspecs} S e e', expr_closed_wrt_vars S e -> expr_closed_wrt_vars S e' -> closed_wrt_vars S (denote_tc_assert (tc_test_eq e e')).
Lemma closed_wrtl_tc_test_eq: forall {cs: compspecs} S e e', expr_closed_wrt_lvars S e -> expr_closed_wrt_lvars S e' -> closed_wrt_lvars S (denote_tc_assert (tc_test_eq e e')).
Lemma closed_wrt_tc_test_order: forall {cs: compspecs} S e e', expr_closed_wrt_vars S e -> expr_closed_wrt_vars S e' -> closed_wrt_vars S (denote_tc_assert (tc_test_order e e')).
Lemma closed_wrtl_tc_test_order: forall {cs: compspecs} S e e', expr_closed_wrt_lvars S e -> expr_closed_wrt_lvars S e' -> closed_wrt_lvars S (denote_tc_assert (tc_test_order e e')).
Lemma expr_closed_const_int: forall {cs: compspecs} S i t, expr_closed_wrt_vars S (Econst_int i t).
Lemma expr_closedl_const_int: forall S i t, expr_closed_wrt_lvars S (Econst_int i t).
Lemma closed_wrt_tc_iszero: forall {cs: compspecs} S e, expr_closed_wrt_vars S e -> closed_wrt_vars S (expr2.denote_tc_assert (tc_iszero e)).
Lemma closed_wrtl_tc_iszero: forall {cs: compspecs} S e, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (expr2.denote_tc_assert (tc_iszero e)).
Lemma closed_wrt_tc_isptr: forall {cs: compspecs} S e, expr_closed_wrt_vars S e -> closed_wrt_vars S (denote_tc_assert (tc_isptr e)).
Lemma closed_wrtl_tc_isptr: forall {cs: compspecs} S e, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (denote_tc_assert (tc_isptr e)).
Lemma closed_wrt_tc_isint: forall {cs: compspecs} S e, expr_closed_wrt_vars S e -> closed_wrt_vars S (denote_tc_assert (tc_isint e)).
Lemma closed_wrtl_tc_isint: forall {cs: compspecs} S e, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (denote_tc_assert (tc_isint e)).
Lemma closed_wrt_tc_islong: forall {cs: compspecs} S e, expr_closed_wrt_vars S e -> closed_wrt_vars S (denote_tc_assert (tc_islong e)).
Lemma closed_wrtl_tc_islong: forall {cs: compspecs} S e, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (denote_tc_assert (tc_islong e)).
Lemma closed_wrt_isCastResultType: forall {cs: compspecs} S e t t0, expr_closed_wrt_vars S e -> closed_wrt_vars S (denote_tc_assert (isCastResultType (implicit_deref t) t0 e)).
Lemma closed_wrtl_tc_Zge: forall {cs: compspecs} S e i, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (denote_tc_assert (tc_Zge e i)).
Lemma closed_wrtl_tc_Zle: forall {cs: compspecs} S e i, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (denote_tc_assert (tc_Zle e i)).
Lemma closed_wrtl_isCastResultType: forall {cs: compspecs} S e t t0, expr_closed_wrt_lvars S e -> closed_wrt_lvars S (denote_tc_assert (isCastResultType (implicit_deref t) t0 e)).
Lemma closed_wrt_tc_temp_id : forall {cs: compspecs} Delta S e id t, expr_closed_wrt_vars S e -> expr_closed_wrt_vars S (Etempvar id t) -> closed_wrt_vars S (tc_temp_id id t Delta e).
Lemma closed_wrtl_tc_temp_id : forall {cs: compspecs} Delta S e id t, expr_closed_wrt_lvars S e -> expr_closed_wrt_lvars S (Etempvar id t) -> closed_wrt_lvars S (tc_temp_id id t Delta e).
Lemma expr_closed_tempvar: forall {cs: compspecs} S i t, ~ S i -> expr_closed_wrt_vars S (Etempvar i t).
Lemma expr_closedl_tempvar: forall S i t, expr_closed_wrt_lvars S (Etempvar i t).