(************************************************  Transformation between data_at/data_at_ and mapsto.  ************************************************)

(* Specifications: *)
Lemma by_value_reptype: forall t, type_is_by_value t = true -> reptype t = val.
Lemma by_value_data_at_rec_volatile: forall sh t v p,
type_is_by_value t = true ->
type_is_volatile t = true ->
data_at_rec sh t v p = memory_block sh (sizeof t) p.
Lemma by_value_data_at_rec_nonvolatile: forall sh t v p,
type_is_by_value t = true ->
type_is_volatile t = false ->
data_at_rec sh t v p = mapsto sh t p (repinject t v).
Lemma by_value_data_at_rec_default_val: forall sh t p,
type_is_by_value t = true ->
size_compatible t p ->
align_compatible t p ->
data_at_rec sh t (default_val t) p = memory_block sh (sizeof t) p.
Lemma by_value_data_at_rec_nonreachable: forall sh t p v,
type_is_by_value t = true ->
size_compatible t p ->
align_compatible t p ->
~ readable_share sh ->
tc_val' t (repinject t v) ->
data_at_rec sh t v p = memory_block sh (sizeof t) p.
Lemma by_value_data_at_rec_default_val2: forall sh t b ofs,
type_is_by_value t = true ->
0 <= ofs /\ ofs + sizeof t < Ptrofs.modulus ->
align_compatible_rec cenv_cs t ofs ->
data_at_rec sh t (default_val t) (Vptr b (Ptrofs.repr ofs)) =
memory_block sh (sizeof t) (Vptr b (Ptrofs.repr ofs)).
Lemma by_value_data_at_rec_nonreachable2: forall sh t b ofs v,
type_is_by_value t = true ->
0 <= ofs /\ ofs + sizeof t < Ptrofs.modulus ->
align_compatible_rec cenv_cs t ofs ->
~ readable_share sh ->
tc_val' t (repinject t v) ->
data_at_rec sh t v (Vptr b (Ptrofs.repr ofs)) = memory_block sh (sizeof t) (Vptr b (Ptrofs.repr ofs)).