(******************************************  Definitions of spacer and withspacer  Comment: spacer only has offset_zero property but does not have local_facts and isptr property.  ******************************************)
(* Arguments spacer sh be ed / _ . *)
Definition withspacer sh (be: Z) (ed: Z) P (p: val): mpred :=
if Z.eq_dec (ed - be) 0
then P p
else P p * spacer sh be ed p.

(* Specifications: *)
Lemma withspacer_spacer: forall sh be ed P p,
withspacer sh be ed P p = spacer sh be ed p * P p.
Lemma withspacer_ramif_Q: forall sh be ed P p,
withspacer sh be ed P p |-- P p *
allp ((fun Q => Q p) -* (fun Q => withspacer sh be ed Q p)).
Lemma spacer_offset_zero:
forall sh be ed v, spacer sh be ed v = spacer sh be ed (offset_val 0 v).
Lemma withspacer_add:
forall sh pos be ed P p,
withspacer sh (pos + be) (pos + ed) (fun p0 => P (offset_val pos p)) p =
withspacer sh be ed P (offset_val pos p).
Lemma offset_val_preserve_isptr: forall p pos, !! (isptr (offset_val pos p)) |-- !! (isptr p).
Lemma at_offset_preserve_local_facts: forall P pos, (forall p, P p |-- !!(isptr p)) -> (forall p, at_offset P pos p |-- !!(isptr p)).
Lemma withspacer_preserve_local_facts: forall sh be ed P, (forall p, P p |-- !! (isptr p)) -> (forall p, withspacer sh be ed P p |-- !! (isptr p)).
Transparent memory_block.
Lemma spacer_memory_block:
forall sh be ed v, isptr v ->
spacer sh be ed v = memory_block sh (ed - be) (offset_val be v).
Lemma spacer_sepcon_memory_block: forall sh ofs lo hi b i,
0 <= lo ->
0 <= ofs ->
lo <= hi < Ptrofs.modulus ->
Ptrofs.unsigned i + ofs + hi < Ptrofs.modulus ->
spacer sh (ofs + lo) (ofs + hi) (Vptr b i) * memory_block sh lo (offset_val ofs (Vptr b i)) = memory_block sh hi (offset_val ofs (Vptr b i)).