(*
Lemma gvar_globals_only:
  forall i v rho, gvar i v rho -> gvar i v (globals_only rho).
Proof.
unfold gvar; intros.
unfold Map.get in *.
destruct (ve_of rho i) as [[? ?]|] eqn:?; try contradiction.
unfold globals_only.
simpl. auto.
Qed.
Hint Resolve gvar_globals_only.
*)

Ltac safe_auto_with_closed :=
   (* won't instantiate evars by accident *)
 match goal with |- ?A =>
          solve [first [has_evar A | auto 50 with closed]]
 end.

Lemma subst_eval_expr_eq: forall {cs: compspecs} j v e, subst j v (eval_expr e) = subst_eval_expr j v e with subst_eval_lvalue_eq: forall {cs: compspecs} j v e, subst j v (eval_lvalue e) = subst_eval_lvalue j v e.