(** ** Memory invariants *)
(** A stack location is private if it is not the image of a valid location and we have full rights on it. *)
Definition loc_private (F: meminj) (m m': mem) (sp: block) (ofs: Z) : Prop :=
Mem.perm m' sp ofs Cur Freeable /\
(forall b delta, F b = Some(sp, delta) -> ~Mem.perm m b (ofs - delta) Max Nonempty).
(** Likewise, for a range of locations. *)
Definition range_private (F: meminj) (m m': mem) (sp: block) (lo hi: Z) : Prop :=
forall ofs, lo <= ofs < hi -> loc_private F m m' sp ofs.

Lemma range_private_alloc_left:
forall F m m' sp' base hi sz m1 sp F1,
range_private F m m' sp' base hi ->
Mem.alloc m 0 sz = (m1, sp) ->
F1 sp = Some(sp', base) ->
(forall b, b <> sp -> F1 b = F b) ->
range_private F1 m1 m' sp' (base + Z.max sz 0) hi.