From compcert Require Export Clightdefs.
Require Export VST.veric.SeparationLogic.
Require Export VST.msl.Extensionality.
Require Export compcert.lib.Coqlib.
Require Export VST.msl.Coqlib2 VST.veric.coqlib4 VST.floyd.coqlib3.
Require Export VST.floyd.jmeq_lemmas.
Require Export VST.floyd.find_nth_tactic.
Require Export VST.veric.juicy_extspec.
Local Open Scope logic.
(* Closed and subst. copied from closed_lemmas.v. *)
(* End of copied from closed_lemmas.v. *)
Definition obox (Delta: tycontext) (i: ident) (P: environ -> mpred): environ -> mpred :=
ALL v: _,
match ((temp_types Delta) ! i) with
| Some t => !! (tc_val' t v) --> subst i (`v) P
| _ => TT
end.
Definition odia (Delta: tycontext) (i: ident) (P: environ -> mpred): environ -> mpred :=
EX v: _,
match ((temp_types Delta) ! i) with
| Some t => !! (tc_val' t v) && subst i (`v) P
| _ => FF
end.
Definition temp_guard (Delta : tycontext) (i: ident): Prop :=
(temp_types Delta) ! i <> None.
Definition oboxopt Delta ret P :=
match ret with
| Some id => obox Delta id P
| _ => P
end.
Definition odiaopt Delta ret P :=
match ret with
| Some id => odia Delta id P
| _ => P
end.
Definition temp_guard_opt (Delta : tycontext) (i: option ident): Prop :=
match i with
| Some i => temp_guard Delta i
| None => True
end.

Lemma oboxopt_closed: forall Delta i P,
temp_guard_opt Delta i ->
closed_wrt_vars (fun id => isSome (match i with Some i' => insert_idset i' idset0 | None => idset0 end) ! id) P ->
oboxopt Delta i P = P.