Transparent Mem.alloc.

(* Specifications: *)
Lemma val_at_alloc_1:
forall m m' lo hi nb b ofs
(Halloc: Mem.alloc m lo hi  = (m', nb))
(Hvalid: Mem.valid_block m b),
Maps.ZMap.get ofs (Maps.PMap.get b (Mem.mem_contents m)) =
Maps.ZMap.get ofs (Maps.PMap.get b (Mem.mem_contents m')).
Lemma val_at_alloc_2:
forall m m' lo hi nb ofs
(Halloc: Mem.alloc m lo hi = (m', nb)),
Maps.ZMap.get ofs (Maps.PMap.get nb (Mem.mem_contents m')) = Undef.
(*stronger version of val_at_alloc_1*)
Lemma val_at_alloc_3:
forall m m' lo hi  nb b ofs
(Halloc: Mem.alloc m lo hi = (m', nb))
(Hvalid: b <> nb),
Maps.ZMap.get ofs (Maps.PMap.get b (Mem.mem_contents m)) =
Maps.ZMap.get ofs (Maps.PMap.get b (Mem.mem_contents m')).
Lemma permission_at_alloc_1:
forall m m' lo hi nb b ofs
(Halloc: Mem.alloc m lo hi = (m', nb))
(Hvalid: Mem.valid_block m b),
forall k, permissions.permission_at m b ofs k =
permissions.permission_at m' b ofs k.
Lemma permission_at_alloc_2:
forall m m' lo sz nb ofs
(Halloc: Mem.alloc m lo sz = (m', nb))
(Hofs: (lo <= ofs < sz)%Z),
forall k, permissions.permission_at m' nb ofs k = Some Freeable.
Lemma permission_at_alloc_3:
forall m m' lo sz nb ofs
(Halloc: Mem.alloc m lo sz = (m', nb))
(Hofs: (ofs < lo \/ ofs >= sz)%Z),
forall k, permissions.permission_at m' nb ofs k = None.
Lemma permission_at_alloc_4:
forall m m' lo hi nb b ofs
(Halloc: Mem.alloc m lo hi = (m', nb))
(Hb: b <> nb),
forall k, permissions.permission_at m b ofs k =
permissions.permission_at m' b ofs k.
Lemma permission_at_free_1 :
forall m m' (lo hi : Z) b b' ofs'
(Hfree: Mem.free m b lo hi = Some m')
(Hnon_freeable: ~ Mem.perm m b' ofs' Cur Freeable),
forall k : perm_kind,
permission_at m b' ofs' k = permission_at m' b' ofs' k.
Lemma permission_at_free_2 :
forall m m' (lo hi : Z) b b' ofs'
(Hfree: Mem.free m b lo hi = Some m')
(Hb: b <> b'),
forall k : perm_kind,
permission_at m b' ofs' k = permission_at m' b' ofs' k.
Lemma permission_at_free_list_1:
forall m m' l b ofs
(Hfree: Mem.free_list m l = Some m')
(Hnon_freeable: ~ Mem.perm m b ofs Cur Freeable),
forall k : perm_kind,
permission_at m b ofs k = permission_at m' b ofs k.
Lemma mem_free_contents:
forall m m2 lo hi b
(Hfree: Mem.free m b lo hi = Some m2),
forall b' ofs,
Maps.ZMap.get ofs (Maps.PMap.get b' (Mem.mem_contents m)) =
Maps.ZMap.get ofs (Maps.PMap.get b' (Mem.mem_contents m2)).
Lemma mem_store_max:
forall chunk b ofs v m m',
Mem.store chunk m b ofs v = Some m' ->
forall b' ofs',
(getMaxPerm m) # b' ofs' = (getMaxPerm m') # b' ofs'.
Lemma mem_storebytes_cur :
forall b (ofs : Z) bytes (m m' : mem),
Mem.storebytes m b ofs bytes = Some m' ->
forall (b' : positive) (ofs' : Z),
(getCurPerm m) !! b' ofs' = (getCurPerm m') !! b' ofs'.
Lemma mem_store_cur:
forall chunk b ofs v m m',
Mem.store chunk m b ofs v = Some m' ->
forall b' ofs',
(getCurPerm m) # b' ofs' = (getCurPerm m') # b' ofs'.
Lemma mem_storev_store:
forall chunk ptr v m m',
Mem.storev chunk m ptr v = Some m' ->
exists b ofs, ptr = Vptr b ofs /\
Mem.store chunk m b (Integers.Ptrofs.intval ofs) v = Some m'.
Lemma load_valid_block:
forall (m : mem) b ofs chunk v,
Mem.load chunk m b ofs = Some v ->
Mem.valid_block m b.
Theorem alloc_access_other:
forall m1 lo hi m2 b, Mem.alloc m1 lo hi = (m2, b) ->
forall b' ofs k,
b'<>b \/ (ofs < lo \/ ofs >= hi) ->
access_at m1 (b', ofs) k = access_at m2 (b', ofs) k.
Theorem alloc_access_same:
forall m1 lo hi m2 b, Mem.alloc m1 lo hi = (m2, b) ->
forall ofs k,
lo <= ofs < hi -> access_at m2 (b,ofs) k = Some Freeable.