Definition max_inv mf := forall b ofs, Mem.valid_block mf b ->
                                    permission_at mf b ofs Max = Some Freeable.

(* Specifications: *)
Lemma max_inv_store: forall m m' chunk b ofs v pmap (Hlt: permMapLt pmap (getMaxPerm m)) (Hmax: max_inv m) (Hstore: Mem.store chunk (restrPermMap Hlt) b ofs v = Some m'), max_inv m'.
Lemma sim_valid_access: forall (mf m1f : mem) (b1 b2 : block) (ofs : Z) (Hm1f: m1f = makeCurMax mf) (HmaxF: max_inv mf) (Hvalidb2: Mem.valid_block mf b2) (Halign: (4 | ofs)%Z), Mem.valid_access m1f Mint32 b2 ofs Freeable.
Lemma setPermBlock_lt: forall pmap m b ofs sz p (Hinv: max_inv m) (Hvalid: Mem.valid_block m b) (Hlt: permMapLt pmap (getMaxPerm m)), permMapLt (setPermBlock p b ofs pmap sz) (getMaxPerm m).
Lemma setN_inside: forall (vl : list memval) (c : ZMap.t memval) (ofs0 ofs: Z), Intv.In ofs0 (ofs, (ofs + Z.of_nat (length vl))%Z) -> ZMap.get ofs0 (Mem.setN vl ofs c) = List.nth (Z.to_nat (ofs0 - ofs)%Z) vl Undef.