Section WITH_SHARE.
Variable sh: share.
Definition data_at_rec: forall t, reptype t -> val -> mpred :=
type_func (fun t => reptype t -> val -> mpred)
(fun t v p =>
if type_is_volatile t
then memory_block sh (sizeof t) p
else mapsto sh t p (repinject t v))
(fun t n a P v => array_pred 0 (Z.max 0 n) (fun i v => at_offset (P v) (sizeof t * i)) (unfold_reptype v))
(fun id a P v => struct_data_at_rec_aux sh (co_members (get_co id)) (co_members (get_co id)) (co_sizeof (get_co id)) P (unfold_reptype v))
(fun id a P v => union_data_at_rec_aux sh (co_members (get_co id)) (co_members (get_co id)) (co_sizeof (get_co id)) P (unfold_reptype v)).
End WITH_SHARE.
(************************************************  Transformation between data_at/data_at_ and mapsto.  ************************************************)
(* Lemma by_value_data_at_: forall sh t p, type_is_by_value t = true -> data_at_ sh t p = !! field_compatible t nil p && mapsto_ sh t p. *)
(************************************************  Transformation between data_at and data_at_rec. This is used in transformation between field_at and data_at.  ************************************************)

Lemma memory_block_data_at__aux1: forall i pos t,
0 <= pos /\ pos + sizeof t <= Int.modulus - Int.unsigned i ->
Int.unsigned (Int.add i (Int.repr pos)) + sizeof t <= Int.modulus.