Definition mem_rmap_cohere m phi :=
contents_cohere m phi /\
access_cohere m phi /\
max_access_cohere m phi /\ alloc_cohere m phi.

(* Specifications: *)
Lemma age_to_cohere:
forall m phi n,
mem_rmap_cohere m phi -> mem_rmap_cohere m (age_to.age_to n phi).
Lemma set_ghost_cohere:
forall m phi g H,
mem_rmap_cohere m phi ->
mem_rmap_cohere m (initial_world.set_ghost phi g H).
Lemma mem_evolve_cohere:
forall jm m' phi',
mem_evolve (m_dry jm) m' ->
compcert_rmaps.RML.R.resource_at phi' =
juicy_mem_lemmas.rebuild_juicy_mem_fmap jm m' ->
mem_rmap_cohere m' phi'.
Lemma whole_program_sequential_safety:
forall {CS: compspecs} {Espec: OracleKind} (initial_oracle: OK_ty)
(dryspec: ext_spec OK_ty)
(dessicate : forall (ef : external_function) jm,
ext_spec_type OK_spec ef ->
ext_spec_type dryspec ef)
(JDE: juicy_dry_ext_spec _ (@JE_spec OK_ty OK_spec) dryspec dessicate)
(DME: ext_spec_mem_evolve _ dryspec)
prog V G m,
@semax_prog Espec (*NullExtension.Espec*) CS prog V G ->
Genv.init_mem prog = Some m ->
exists b, exists q, exists m',
Genv.find_symbol (Genv.globalenv prog) (prog_main prog) = Some b /\
initial_core  (cl_core_sem (globalenv prog))
0 m q m' (Vptr b Ptrofs.zero) nil /\
forall n,
@dry_safeN _ _ _ OK_ty (genv_symb_injective)
(coresem_extract_cenv  (cl_core_sem (globalenv prog))
(prog_comp_env prog))
forall {CS: compspecs} (prog: program) (V: varspecs) (G: funspecs) ora m f f_id f_b f_body args,
let ge := Genv.globalenv prog in
let ext_link := ext_link_prog prog in
let spec := add_funspecs NullExtension.Espec ext_link G in
let tys := sig_args (ef_sig f) in
let rty := sig_res (ef_sig f) in
let sem := juicy_core_sem (cl_core_sem (Build_genv ge (prog_comp_env prog))) in
@semax_prog spec CS prog V G ->
fun_id ext_link f = Some f_id ->
Genv.find_symbol ge f_id = Some f_b ->
Genv.find_funct  ge (Vptr f_b Ptrofs.zero) = Some f_body ->
forall x : ext_spec_type (@OK_spec spec) f,
ext_spec_pre (@OK_spec spec) f x (genv_symb_injective ge) tys args ora m ->
exists q,
initial_core sem
0 (*additional temporary argument - TODO (Santiago): FIXME*)
m q m
(Vptr f_b Ptrofs.zero) args /\
forall n, safeN_(genv_symb := @genv_symb_injective _ _)(Hrel := juicy_extspec.Hrel) (coresem_extract_cenv sem (prog_comp_env prog))
(upd_exit (@OK_spec spec) x (genv_symb_injective ge)) ge n ora q m.