Hint Rewrite mapsto_force_ptr: norm.
(******************************************  Definition of at_offset.  at_offset is the elementary definition. All useful lemmas about at_offset will be proved here.  ******************************************)
Definition at_offset (P: val -> mpred) (z: Z): val -> mpred :=
fun v => P (offset_val z v).
Arguments at_offset P z v : simpl never.

(* Specifications: *)
Lemma at_offset_eq: forall P z v,
at_offset P z v = P (offset_val z v).
Lemma lifted_at_offset_eq: forall (P: val -> mpred) z v,
`(at_offset P z) v = `P (`(offset_val z) v).
Lemma at_offset_eq2: forall pos pos' P,
forall p, at_offset P (pos + pos') p = at_offset P pos' (offset_val pos p).
Lemma at_offset_eq3: forall P z b ofs,
at_offset P z (Vptr b (Ptrofs.repr ofs)) = P (Vptr b (Ptrofs.repr (ofs + z))).
Lemma at_offset_derives: forall P Q p , (forall p, P p |-- Q p) -> forall pos, at_offset P pos p |-- at_offset Q pos p.
Definition spacer (sh: share) (be: Z) (ed: Z) : val -> mpred :=
if Z.eq_dec (ed - be) 0
then fun _ => emp
else
at_offset (memory_block sh (ed - be)) be.