Definition vis mu := fun b => locBlocksSrc mu b || frgnBlocksSrc mu b.
Definition visTgt mu := fun b => locBlocksTgt mu b || frgnBlocksTgt mu b.
Inductive reach (m:mem) (B:block -> Prop): list (block * Z) -> block -> Prop :=
reach_nil: forall b, B b -> reach m B nil b
| reach_cons: forall b L b' z off n q,
reach m B L b' ->
Mem.perm m b' z Cur Readable ->
ZMap.get z (PMap.get b' (Mem.mem_contents m)) =
Fragment (Vptr b off) q n ->
reach m B ((b',z)::L) b.
Fixpoint reach' (m:mem) (B:block -> Prop) (L:list (block * Z)): block -> Prop:=
match L with
nil => B
| l::L => match l with
(b',z) => match ZMap.get z (PMap.get b' (Mem.mem_contents m))
with Fragment (Vptr b off) q  n => fun bb => bb = b /\
Mem.perm m b' z Cur Readable /\
reach' m B L b'
| _ => fun bb => False
end
end
end.

Lemma reach_reach': forall m B L b1, reach m B L b1 <-> reach' m B L b1.
Fixpoint reach'' (m:mem) (B:block -> bool) (L:list (block * Z)): block -> bool:=
match L with
nil => B
| l::L => match l with
(b',z) => match ZMap.get z (PMap.get b' (Mem.mem_contents m))
with Fragment (Vptr b off) q  n => fun bb => eq_block bb b &&
Mem.perm_dec m b' z Cur Readable  &&
reach'' m B L b'
| _ => fun bb => false
end
end
end.