(* core load and coherence properties *)

(* Specifications: *)
Lemma writable_perm:
forall b i jm, writable (b,i) (m_phi jm) -> Mem.perm (m_dry jm) b i Cur Writable.
Lemma valid_access_None: forall m ch b b' ofs ofs' p,
Mem.valid_access m ch b ofs p
-> adr_range (b, ofs) (size_chunk ch) (b', ofs')
-> access_at m (b', ofs') Cur = None
-> False.
Lemma core_load_getN: forall ch v b ofs bl phi m,
contents_cohere m phi
-> (core_load' ch (b, ofs) v bl)%pred phi
-> bl = Mem.getN (size_chunk_nat ch) ofs (PMap.get b (Mem.mem_contents m)).
Lemma core_load_valid: forall ch v b ofs m phi,
(core_load ch (b, ofs) v)%pred phi
-> access_cohere m phi
-> Mem.valid_access m ch b ofs Readable.
Lemma core_load_load': forall ch b ofs v m,
core_load ch (b, ofs) v (m_phi m) -> Mem.load ch (m_dry m) b ofs = Some v.
Lemma Zminus_lem: forall z1 z2, z1 <= z2 -> nat_of_Z (z2 - z1) = O -> z1=z2.
Lemma nat_of_Z_lem1: forall n z, S n = nat_of_Z z -> n = nat_of_Z (z - 1).
Lemma nat_of_Z_lem2: forall n z1 z2, S n = nat_of_Z (z1 - z2) -> n = nat_of_Z (z1 - z2 - 1).
Lemma load_core_load: forall ch b ofs v m,
Mem.load ch (m_dry m) b ofs = Some v ->
(forall z, ofs <= z < ofs + size_chunk ch ->
perm_order'' (perm_of_res (m_phi m @ (b,z))) (Some Readable)) ->
core_load ch (b, ofs) v (m_phi m).
Lemma core_load_load: forall ch b ofs v m,
(forall z, ofs <= z < ofs + size_chunk ch ->
perm_order'' (perm_of_res (m_phi m @ (b,z))) (Some Readable)) ->
(core_load ch (b, ofs) v (m_phi m) <-> Mem.load ch (m_dry m) b ofs = Some v).