(************************************************  Reroot lemmas  ************************************************)

(* Specifications: *)
Lemma field_at_data_at: forall sh t gfs v (p: val),
field_at sh t gfs v p =
data_at sh (nested_field_type t gfs) v (field_address t gfs p).
Lemma field_at_data_at' : forall sh t gfs v p, field_at sh t gfs v p =
!!field_compatible t gfs p &&
data_at sh (nested_field_type t gfs) v (offset_val (nested_field_offset t gfs) p).
Lemma field_at__data_at_: forall sh t gfs p,
field_at_ sh t gfs p =
data_at_ sh (nested_field_type t gfs) (field_address t gfs p).
Lemma lifted_field_at_data_at: forall sh t gfs v p,
`(field_at sh t gfs) v p =
`(data_at sh (nested_field_type t gfs)) v (`(field_address t gfs) p).
Lemma lifted_field_at__data_at_: forall sh t gfs p,
`(field_at_ sh t gfs) p =
`(data_at_ sh (nested_field_type t gfs)) (`(field_address t gfs) p).
Lemma value_fits_JMeq:
forall t t' v v',
t=t' -> JMeq v v' -> value_fits t v -> value_fits t' v'.
Lemma array_at_data_at: forall sh t gfs lo hi v p,
lo <= hi ->
array_at sh t gfs lo hi v p =
(!! field_compatible0 t (ArraySubsc lo :: gfs) p) &&
(!! field_compatible0 t (ArraySubsc hi :: gfs) p) &&
at_offset (data_at sh (nested_field_array_type t gfs lo hi) v)
(nested_field_offset t (ArraySubsc lo :: gfs)) p.
Lemma array_at_data_at':
forall sh t gfs lo hi v p,
lo <= hi ->
field_compatible0 t (ArraySubsc lo :: gfs) p ->
field_compatible0 t (ArraySubsc hi :: gfs) p ->
array_at sh t gfs lo hi v p =
data_at sh (nested_field_array_type t gfs lo hi) v
(field_address0 t (ArraySubsc lo::gfs) p).
Lemma array_at_data_at'':
forall sh t gfs lo hi v p,
lo <= hi ->
field_compatible0 t (ArraySubsc hi :: gfs) p ->
array_at sh t gfs lo hi v p =
data_at sh (nested_field_array_type t gfs lo hi) v
(field_address0 t (ArraySubsc lo::gfs) p).
Lemma array_at_data_at''':
forall sh t gfs lo hi v p t0 n a,
nested_field_type t gfs = Tarray t0 n a ->
lo <= hi <= n ->
array_at sh t gfs lo hi v p =
data_at sh (nested_field_array_type t gfs lo hi) v
(field_address0 t (ArraySubsc lo::gfs) p).
Lemma split3seg_array_at': forall sh t gfs lo ml mr hi v p,
lo <= ml ->
ml <= mr ->
mr <= hi ->
Zlength v = hi-lo ->
array_at sh t gfs lo hi v p =
array_at sh t gfs lo ml (sublist 0 (ml-lo) v) p*
data_at sh (nested_field_array_type t gfs ml mr)
(sublist (ml-lo) (mr-lo) v)
(field_address0 t (ArraySubsc ml::gfs) p) *
array_at sh t gfs mr hi (sublist (mr-lo) (hi-lo) v) p.