Definition field_at (sh: Share.t) (t: type) (gfs: list gfield) (v: reptype (nested_field_type t gfs)) (p: val): mpred :=
!! (field_compatible t gfs p) &&
at_offset (data_at_rec sh (nested_field_type t gfs) v) (nested_field_offset t gfs) p.
Arguments field_at sh t gfs v p : simpl never.
Definition field_at_ (sh: Share.t) (t: type) (gfs: list gfield) (p: val): mpred :=
field_at sh t gfs (default_val (nested_field_type t gfs)) p.
Arguments field_at_ sh t gfs p : simpl never.
Definition data_at (sh: Share.t) (t: type) (v: reptype t) := field_at sh t nil v.
Definition data_at_ (sh: Share.t) (t: type) := field_at_ sh t nil.
Definition nested_reptype_structlist t gfs (m: members) :=
compact_prod (map (fun it => reptype (nested_field_type t (StructField (fst it) :: gfs))) m).
Definition nested_reptype_unionlist t gfs (m: members) :=
compact_sum (map (fun it => reptype (nested_field_type t (UnionField (fst it) :: gfs))) m).

(* Specifications: *)
Lemma nested_reptype_structlist_lemma: forall t gfs id a,
nested_field_type t gfs = Tstruct id a ->
reptype (nested_field_type t gfs) = nested_reptype_structlist t gfs (co_members (get_co id)).
Lemma field_at_compatible':
forall sh t path v c,
field_at sh t path v c =
!! field_compatible t path c && field_at sh t path v c.
Lemma field_at__local_facts: forall sh t gfs p,
field_at_ sh t gfs p |-- !! field_compatible t gfs p.
Lemma data_at_local_facts:
forall sh t v p, data_at sh t v p |-- !! (field_compatible t nil p /\ value_fits t v).
Lemma array_at_local_facts: forall sh t gfs lo hi v p,
array_at sh t gfs lo hi v p |--
!! (field_compatible0 t (ArraySubsc lo :: gfs) p
/\ field_compatible0 t (ArraySubsc hi :: gfs) p
/\ Zlength v = hi - lo
/\ Forall (value_fits (nested_field_type t (ArraySubsc 0 :: gfs))) v).
Lemma array_at__local_facts: forall sh t gfs lo hi p,
array_at_ sh t gfs lo hi p |--
!! (field_compatible0 t (ArraySubsc lo :: gfs) p
/\ field_compatible0 t (ArraySubsc hi :: gfs) p).
Lemma field_at_isptr: forall sh t gfs v p,
field_at sh t gfs v p = (!! isptr p) && field_at sh t gfs v p.
Lemma field_at__isptr: forall sh t gfs p,
field_at_ sh t gfs p = (!! isptr p) && field_at_ sh t gfs p.
Lemma field_at__offset_zero: forall sh t gfs p,
field_at_ sh t gfs p = field_at_ sh t gfs (offset_val 0 p).
Lemma data_at_isptr: forall sh t v p, data_at sh t v p = !!(isptr p) && data_at sh t v p.
Lemma data_at_offset_zero: forall sh t v p, data_at sh t v p = data_at sh t v (offset_val 0 p).
Lemma data_at__isptr: forall sh t p, data_at_ sh t p = !!(isptr p) && data_at_ sh t p.
Lemma data_at__offset_zero: forall sh t p, data_at_ sh t p = data_at_ sh t (offset_val 0 p).
Lemma array_at_ext: forall sh t gfs lo hi v0 v1 p,
Zlength v0 = Zlength v1 ->
(forall i u0 u1,
lo <= i < hi ->
JMeq u0 (Znth (i-lo) v0) ->
JMeq u1 (Znth (i-lo) v1) ->
field_at sh t (ArraySubsc i :: gfs) u0 p =
field_at sh t (ArraySubsc i :: gfs) u1 p) ->
array_at sh t gfs lo hi v0 p = array_at sh t gfs lo hi v1 p.