Definition msubst_extract_local (Delta: tycontext) (T1: PTree.t val) (T2: PTree.t (type * val)) (GV: option globals) (x: localdef): Prop :=
match x with
| temp i u =>
match T1 ! i with
| Some v => u = v
| None => False
end
| lvar i ti u =>
match T2 ! i with
| Some (tj, v) =>
if eqb_type ti tj
then u = v
else False
| _ => False
end
| gvars gv =>
match GV with
| Some gv0 => gv0 = gv
| _ => False
end
end.
Definition msubst_extract_locals (Delta: tycontext) (T1: PTree.t val) (T2: PTree.t (type * val)) (GV: option globals) := VST_floyd_map (msubst_extract_local Delta T1 T2 GV).

Lemma localdef_local_facts_inv: forall Delta P T1 T2 GV R x,
msubst_extract_local Delta T1 T2 GV x ->
local (tc_environ Delta) && PROPx P (LOCALx (LocalD T1 T2 GV) (SEPx R)) |-- local (locald_denote x).