mem_unchanged_on,loc_out-of_bounds etc etc*)
Goal forall m b ofs p (H: ~ Mem.perm m b ofs p Nonempty), PMap.get b (Mem.mem_access m) ofs p = None.
intros. unfold Mem.perm in *.
remember (PMap.get b (Mem.mem_access m) ofs p) as pp.
destruct pp; simpl in *. exfalso. apply H. apply perm_any_N.
trivial.
Qed.
Definition isSource j m1 (b2:block) (ofs2:Z) b : option Z :=
match j b with None => None
| Some (bb,delta) => if eq_block b2 bb
then if Mem.perm_dec m1 b (ofs2 - delta) Max Nonempty
then Some (ofs2 - delta)  else None
else None
end.

(* Specifications: *)
Lemma isSource_NoneE: forall j m b2 ofs2 b1, None = isSource j m b2 ofs2 b1 ->
j b1 = None \/ (exists b, exists delta, j b1 = Some (b,delta) /\ b<>b2) \/
(exists delta, j b1 = Some(b2,delta) /\ ~ Mem.perm m b1 (ofs2-delta) Max Nonempty).
Lemma isSource_SomeE: forall j m b2 ofs2 b1 ofs1, Some ofs1 = isSource j m b2 ofs2 b1 ->
exists delta, j b1 = Some(b2,delta) /\ Mem.perm m b1 ofs1 Max Nonempty /\ ofs2=ofs1+delta.
Lemma isSource_SomeI: forall j m b2 ofs2 b1 delta,
j b1 = Some(b2,delta) -> Mem.perm m b1 (ofs2 - delta) Max Nonempty ->
isSource j m b2 ofs2 b1 = Some (ofs2-delta).
Lemma isSource_SomeI': forall j m b2 ofs1 b1 delta,
j b1 = Some(b2,delta) -> Mem.perm m b1 ofs1 Max Nonempty ->
isSource j m b2 (ofs1+delta) b1 = Some ofs1.
Lemma isSource_NoneE: forall j m b2 ofs2 b1, None = isSource j m b2 ofs2 b1 ->
j b1 = None \/ (exists b, exists delta, j b1 = Some (b,delta) /\ b<>b2) \/
(exists delta, j b1 = Some(b2,delta) /\ ~ Mem.perm m b1 (ofs2-delta) Max Nonempty).
Lemma isSource_SomeE: forall j m b2 ofs2 b1 ofs1, Some ofs1 = isSource j m b2 ofs2 b1 ->
exists delta, j b1 = Some(b2,delta) /\ Mem.perm m b1 ofs1 Max Nonempty /\ ofs2=ofs1+delta.
Lemma isSource_SomeI: forall j m b2 ofs2 b1 delta,
j b1 = Some(b2,delta) -> Mem.perm m b1 (ofs2 - delta) Max Nonempty ->
isSource j m b2 ofs2 b1 = Some (ofs2-delta).
Lemma isSource_SomeI': forall j m b2 ofs1 b1 delta,
j b1 = Some(b2,delta) -> Mem.perm m b1 ofs1 Max Nonempty ->
isSource j m b2 (ofs1+delta) b1 = Some ofs1.