(*Lenb: Should Imports from sepcomp really be here?*)
(*Require Import VST.sepcomp.event_semantics. Require Import VST.sepcomp.extspec.*)
(*Lenb: Should stuff that requires Imports from sepcomp really be here?*)
Notation val_inject := Val.inject. (*as in sepcomp.mem_lemmas*)
Definition mem_lessdef m1 m2 :=
(forall b ofs len v,
Mem.loadbytes m1 b ofs len = Some v ->
exists v',
Mem.loadbytes m2 b ofs len = Some v' /\
list_forall2 memval_lessdef v v'
) /\
(forall b ofs k p,
Mem.perm m1 b ofs k p ->
Mem.perm m2 b ofs k p) /\
(Mem.nextblock m1 <=
Mem.nextblock m2)%positive.
Definition mem_lessalloc m1 m2 :=
Mem.loadbytes m1 = Mem.loadbytes m2 /\
Mem.perm m1 = Mem.perm m2 /\
(Mem.nextblock m1 <= Mem.nextblock m2)%positive.
Definition mem_equiv m1 m2 :=
Mem.loadbytes m1 = Mem.loadbytes m2 /\
Mem.perm m1 = Mem.perm m2 /\
Mem.nextblock m1 = Mem.nextblock m2.
Definition mem_equiv' m1 m2 :=
(forall x, Mem.perm_order' (access_at m1 x Cur) Readable -> contents_at m1 x = contents_at m2 x) /\
Mem.perm m1 = Mem.perm m2 /\
Mem.nextblock m1 = Mem.nextblock m2.
Definition mem_lessalloc' m1 m2 :=
(forall x, Mem.perm_order' (access_at m1 x Cur) Readable -> contents_at m1 x = contents_at m2 x) /\
Mem.perm m1 = Mem.perm m2 /\
(Mem.nextblock m1 <= Mem.nextblock m2)%positive.

Lemma mem_equiv_refl' m m' : m = m' -> mem_equiv m m'.