(* Does not hold, since readonlyLD refers to Cur permissions Lemma external_call_readonlyLD: forall (ef : external_function) (F V : Type) (ge : Genv.t F V) (vargs : list val) (m1 : mem) (t : trace) (vres : val) (m2 : mem), external_call ef ge vargs m1 t vres m2 -> forall b, Mem.valid_block m1 b -> readonlyLD m1 b m2. *)
Definition val_has_type_opt' (v: option val) (ty: typ) :=
match v with
| None => True
| Some v' => Val.has_type v' ty
end.
Definition val_has_type_opt (v: option val) (sig: signature) :=
val_has_type_opt' v (proj_sig_res sig).
Definition is_vundef (v : val) : bool :=
match v with
| Vundef => true
| _ => false
end.
Definition vals_def (vs : list val) :=
List.forallb (fun v => negb (is_vundef v)) vs.
Definition genv2blocksBool {F V : Type} (ge : Genv.t F V):=
(fun b =>
match Genv.invert_symbol ge b with
Some id => true
| None => false
end,
fun b => match Genv.find_var_info ge b with
Some gv => true
| None => false
end).
Definition isGlobalBlock {F V : Type} (ge : Genv.t F V) :=
fun b => (fst (genv2blocksBool ge)) b || (snd (genv2blocksBool ge)) b.

Lemma invert_symbol_isGlobal: forall {V F} (ge : Genv.t F V) b x,
Genv.invert_symbol ge b = Some x -> isGlobalBlock ge b = true.