Global Notation "a # b" := (Maps.PMap.get b a) (at level 1).

(* 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.
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_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.
Lemma initial_invariant0: forall pmap c, DryHybridMachine.invariant (mkPool c (pmap, empty_map)).
Lemma updThreadC_invariant: forall (tp : t) i c (ctn : containsThread tp i) (Hinv : invariant tp), invariant (updThreadC ctn c).
Lemma mem_compatible_add: forall tp i (cnti: containsThread tp i) c pmap vf arg pmap2 m (Hcomp: mem_compatible (addThread (updThread cnti c pmap) vf arg pmap2) m), mem_compatible (updThread cnti c pmap) m.
Lemma mem_compatible_remlock: forall tp m addr (Hinv: lr_valid (lockRes tp)) (Hcomp: mem_compatible tp m), mem_compatible (remLockSet tp addr) m.
Lemma remLock_inv: forall ds a, invariant ds -> invariant (remLockSet ds a).
Lemma invariant_add: forall tp i (cnti: containsThread tp i) c pmap1 pmap2 vf arg (Hinv: invariant (addThread (updThread cnti c pmap1) vf arg pmap2)), invariant (updThread cnti c pmap1).
Lemma init_thread: forall m m' pmap f arg tp i (Hinit: init_mach pmap m tp m' f arg), containsThread tp i -> i = 0.
Lemma getThreadR_init: forall pmap m m' f arg tp (Hinit: init_mach pmap m tp m' f arg) (cnt: containsThread tp 0), getThreadR cnt = (getCurPerm m', empty_map).
Lemma init_lockRes_empty: forall m m' pmap f arg tp laddr (Hinit: init_mach pmap m tp m' f arg), lockRes tp laddr = None.
Lemma initial_invariant: forall m m' pmap f arg tp (Hinit: init_mach pmap m tp m' f arg), invariant tp.