Ltac app_pred_unfold :=
match goal with
H : context[app_pred (exist ?F ?f ?p) ?phi] |- _ =>
change (app_pred (exist F f p) phi) with (f phi) in H; cbv beta in H
| |- context[app_pred (exist ?F ?f ?p) ?phi] =>
change (app_pred (exist F f p) phi) with (f phi); cbv beta
end.

Lemma data_at_unfold_readable CS sh b ofs phi length :
readable_share sh ->
app_pred (@data_at_ CS sh (Tarray (Tpointer Tvoid noattr) (Z.of_nat length) noattr) (Vptr b ofs)) phi ->
forall loc,
if adr_range_dec (b, Ptrofs.intval ofs) (size_chunk Mptr * Z.of_nat length)%Z loc then
exists p v,
phi @ loc =
YES
sh p (VAL v) NoneP
else
identity (phi @ loc).