End GLOBALENV_PRINCIPLES.
(** ** Properties of the operations over global environments *)

(* Specifications: *)
Theorem public_symbol_exists:
forall ge id, public_symbol ge id = true -> exists b, find_symbol ge id = Some b.
Theorem shift_symbol_address:
forall ge id ofs delta,
symbol_address ge id (Ptrofs.add ofs delta) = Val.offset_ptr (symbol_address ge id ofs) delta.
Theorem shift_symbol_address_32:
forall ge id ofs n,
Archi.ptr64 = false ->
symbol_address ge id (Ptrofs.add ofs (Ptrofs.of_int n)) = Val.add (symbol_address ge id ofs) (Vint n).
Theorem shift_symbol_address_64:
forall ge id ofs n,
Archi.ptr64 = true ->
symbol_address ge id (Ptrofs.add ofs (Ptrofs.of_int64 n)) = Val.addl (symbol_address ge id ofs) (Vlong n).
Theorem find_funct_inv:
forall ge v f,
find_funct ge v = Some f -> exists b, v = Vptr b Ptrofs.zero.
Theorem find_funct_find_funct_ptr:
forall ge b,
find_funct ge (Vptr b Ptrofs.zero) = find_funct_ptr ge b.
Theorem find_funct_ptr_iff:
forall ge b f, find_funct_ptr ge b = Some f <-> find_def ge b = Some (Gfun f).
Theorem find_var_info_iff:
forall ge b v, find_var_info ge b = Some v <-> find_def ge b = Some (Gvar v).
Theorem find_def_symbol:
forall p id g,
(prog_defmap p)!id = Some g <-> exists b, find_symbol (globalenv p) id = Some b /\ find_def (globalenv p) b = Some g.
Theorem find_symbol_exists:
forall p id g,
In (id, g) (prog_defs p) ->
exists b, find_symbol (globalenv p) id = Some b.
Theorem find_symbol_inversion : forall p x b,
find_symbol (globalenv p) x = Some b ->
In x (prog_defs_names p).
Theorem find_def_inversion:
forall p b g,
find_def (globalenv p) b = Some g ->
exists id, In (id, g) (prog_defs p).
Corollary find_funct_ptr_inversion:
forall p b f,
find_funct_ptr (globalenv p) b = Some f ->
exists id, In (id, Gfun f) (prog_defs p).
Corollary find_funct_inversion:
forall p v f,
find_funct (globalenv p) v = Some f ->
exists id, In (id, Gfun f) (prog_defs p).
Theorem find_funct_ptr_prop:
forall (P: F -> Prop) p b f,
(forall id f, In (id, Gfun f) (prog_defs p) -> P f) ->
find_funct_ptr (globalenv p) b = Some f ->
P f.
Theorem find_funct_prop:
forall (P: F -> Prop) p v f,
(forall id f, In (id, Gfun f) (prog_defs p) -> P f) ->
find_funct (globalenv p) v = Some f ->
P f.
Theorem global_addresses_distinct:
forall ge id1 id2 b1 b2,
id1 <> id2 ->
find_symbol ge id1 = Some b1 ->
find_symbol ge id2 = Some b2 ->
b1 <> b2.
Theorem invert_find_symbol:
forall ge id b,
invert_symbol ge b = Some id -> find_symbol ge id = Some b.
Theorem find_invert_symbol:
forall ge id b,
find_symbol ge id = Some b -> invert_symbol ge b = Some id.
Theorem public_symbol_exists:
forall ge id, public_symbol ge id = true -> exists b, find_symbol ge id = Some b.
Theorem shift_symbol_address:
forall ge id ofs delta,
symbol_address ge id (Ptrofs.add ofs delta) = Val.offset_ptr (symbol_address ge id ofs) delta.
Theorem shift_symbol_address_32:
forall ge id ofs n,
Archi.ptr64 = false ->
symbol_address ge id (Ptrofs.add ofs (Ptrofs.of_int n)) = Val.add (symbol_address ge id ofs) (Vint n).
Theorem shift_symbol_address_64:
forall ge id ofs n,
Archi.ptr64 = true ->
symbol_address ge id (Ptrofs.add ofs (Ptrofs.of_int64 n)) = Val.addl (symbol_address ge id ofs) (Vlong n).
Theorem find_funct_inv:
forall ge v f,
find_funct ge v = Some f -> exists b, v = Vptr b Ptrofs.zero.
Theorem find_funct_find_funct_ptr:
forall ge b,
find_funct ge (Vptr b Ptrofs.zero) = find_funct_ptr ge b.
Theorem find_funct_ptr_iff:
forall ge b f, find_funct_ptr ge b = Some f <-> find_def ge b = Some (Gfun f).
Theorem find_var_info_iff:
forall ge b v, find_var_info ge b = Some v <-> find_def ge b = Some (Gvar v).
Theorem find_def_symbol:
forall p id g,
(prog_defmap p)!id = Some g <-> exists b, find_symbol (globalenv p) id = Some b /\ find_def (globalenv p) b = Some g.
Theorem find_symbol_exists:
forall p id g,
In (id, g) (prog_defs p) ->
exists b, find_symbol (globalenv p) id = Some b.
Theorem find_symbol_inversion : forall p x b,
find_symbol (globalenv p) x = Some b ->
In x (prog_defs_names p).
Theorem find_def_inversion:
forall p b g,
find_def (globalenv p) b = Some g ->
exists id, In (id, g) (prog_defs p).
Corollary find_funct_ptr_inversion:
forall p b f,
find_funct_ptr (globalenv p) b = Some f ->
exists id, In (id, Gfun f) (prog_defs p).
Corollary find_funct_inversion:
forall p v f,
find_funct (globalenv p) v = Some f ->
exists id, In (id, Gfun f) (prog_defs p).
Theorem find_funct_ptr_prop:
forall (P: F -> Prop) p b f,
(forall id f, In (id, Gfun f) (prog_defs p) -> P f) ->
find_funct_ptr (globalenv p) b = Some f ->
P f.
Theorem find_funct_prop:
forall (P: F -> Prop) p v f,
(forall id f, In (id, Gfun f) (prog_defs p) -> P f) ->
find_funct (globalenv p) v = Some f ->
P f.
Theorem global_addresses_distinct:
forall ge id1 id2 b1 b2,
id1 <> id2 ->
find_symbol ge id1 = Some b1 ->
find_symbol ge id2 = Some b2 ->
b1 <> b2.
Theorem invert_find_symbol:
forall ge id b,
invert_symbol ge b = Some id -> find_symbol ge id = Some b.
Theorem find_invert_symbol:
forall ge id b,
find_symbol ge id = Some b -> invert_symbol ge b = Some id.