(** Preservation of [drop_perm] operations. *)

(* Specifications: *)
Lemma drop_unmapped_inj:
forall f m1 m2 b lo hi p m1',
mem_inj f m1 m2 ->
drop_perm m1 b lo hi p = Some m1' ->
f b = None ->
mem_inj f m1' m2.
Lemma drop_mapped_inj:
forall f m1 m2 b1 b2 delta lo hi p m1',
mem_inj f m1 m2 ->
drop_perm m1 b1 lo hi p = Some m1' ->
meminj_no_overlap f m1 ->
f b1 = Some(b2, delta) ->
exists m2',
drop_perm m2 b2 (lo + delta) (hi + delta) p = Some m2'
/\ mem_inj f m1' m2'.
Lemma drop_outside_inj: forall f m1 m2 b lo hi p m2',
mem_inj f m1 m2 ->
drop_perm m2 b lo hi p = Some m2' ->
(forall b' delta ofs' k p,
f b' = Some(b, delta) ->
perm m1 b' ofs' k p ->
lo <= ofs' + delta < hi -> False) ->
mem_inj f m1 m2'.
Lemma drop_unmapped_inj:
forall f m1 m2 b lo hi p m1',
mem_inj f m1 m2 ->
drop_perm m1 b lo hi p = Some m1' ->
f b = None ->
mem_inj f m1' m2.
Lemma drop_mapped_inj:
forall f m1 m2 b1 b2 delta lo hi p m1',
mem_inj f m1 m2 ->
drop_perm m1 b1 lo hi p = Some m1' ->
meminj_no_overlap f m1 ->
f b1 = Some(b2, delta) ->
exists m2',
drop_perm m2 b2 (lo + delta) (hi + delta) p = Some m2'
/\ mem_inj f m1' m2'.
Lemma drop_outside_inj: forall f m1 m2 b lo hi p m2',
mem_inj f m1 m2 ->
drop_perm m2 b lo hi p = Some m2' ->
(forall b' delta ofs' k p,
f b' = Some(b, delta) ->
perm m1 b' ofs' k p ->
lo <= ofs' + delta < hi -> False) ->
mem_inj f m1 m2'.