(* not useful? *)

(* Specifications: *)
(* (* TODO: remove this lemma? It is not used anywhere. *)
Lemma readable_share_join:
forall sh1 sh2 sh,
sepalg.join sh1 sh2 sh ->
readable_share sh1 -> readable_share sh.
Lemma field_at__share_join{cs: compspecs}:
forall sh1 sh2 sh t gfs p,
sepalg.join sh1 sh2 sh ->
field_at_ sh1 t gfs p * field_at_ sh2 t gfs p = field_at_ sh t gfs p.
Lemma nonreadable_memory_block_data_at: forall  {cs: compspecs} sh t v p,
~ readable_share sh ->
field_compatible t nil p ->
value_fits t v ->
memory_block sh (sizeof t) p = data_at sh t v p.
Lemma nonreadable_field_at_eq {cs: compspecs} :
forall sh t gfs v v' p,
~ readable_share sh ->
(value_fits (nested_field_type t gfs) v <-> value_fits (nested_field_type t gfs) v') ->
field_at sh t gfs v p = field_at sh t gfs v' p.
Lemma nonreadable_readable_memory_block_data_at_join
{cs: compspecs}:
forall ash bsh psh t v p,
sepalg.join ash bsh psh ->
~ readable_share ash ->
memory_block ash (sizeof t) p * data_at bsh t v p = data_at psh t v p.
(* Lemma nonreadable_data_at_rec_eq {cs: compspecs} : forall sh t v v' p, ~readable_share sh -> field_compatible t nil p -> data_at_rec sh t v p = data_at_rec sh t v' p. *)
Lemma nonreadable_data_at_eq {cs: compspecs}:
forall sh t v v' p, ~readable_share sh ->
(value_fits t v <-> value_fits t v') ->
data_at sh t v p = data_at sh t v' p.
Lemma field_at_share_join_W {cs: compspecs}:
forall sh1 sh2 sh t gfs v1 v2 p,
sepalg.join sh1 sh2 sh ->
writable_share sh1 ->
field_at sh1 t gfs v1 p * field_at sh2 t gfs v2 p |-- field_at sh t gfs v1 p.
Lemma data_at_share_join_W {cs: compspecs}:
forall sh1 sh2 sh t v1 v2 p,
sepalg.join sh1 sh2 sh ->
writable_share sh1 ->
data_at sh1 t v1 p * data_at sh2 t v2 p |-- data_at sh t v1 p.
Lemma value_fits_Tint_trivial {cs: compspecs} :
forall s a  i, value_fits (Tint I32 s a) (Vint i).
(* TODO: move all change type lemmas into one file. Also those change compspecs lemmas. *)
Lemma data_at_tuint_tint {cs: compspecs}: forall sh v p, data_at sh tuint v p = data_at sh tint v p.
Lemma mapsto_field_at {cs: compspecs} sh t gfs v v' p:
type_is_by_value (nested_field_type t gfs) = true ->
type_is_volatile (nested_field_type t gfs) = false ->
field_compatible t gfs p ->
JMeq v v' ->
mapsto sh (nested_field_type t gfs) (field_address t gfs p) v = field_at sh t gfs v' p.
Lemma mapsto_field_at_ramify {cs: compspecs} sh t gfs v v' w w' p:
type_is_by_value (nested_field_type t gfs) = true ->
type_is_volatile (nested_field_type t gfs) = false ->
JMeq v v' ->
JMeq w w' ->
field_at sh t gfs v' p |--
mapsto sh (nested_field_type t gfs) (field_address t gfs p) v *
(mapsto sh (nested_field_type t gfs) (field_address t gfs p) w -*
field_at sh t gfs w' p).
Lemma mapsto_data_at {cs: compspecs} sh t v v' p :  (* not needed here *)
type_is_by_value t = true ->
type_is_volatile t = false ->
isptr p ->
size_compatible t p ->
align_compatible t p ->
complete_legal_cosu_type t = true ->
JMeq v v' ->
mapsto sh t p v = data_at sh t v' p.
Lemma mapsto_data_at' {cs: compspecs} sh t v v' p:
type_is_by_value t = true ->
type_is_volatile t = false ->
field_compatible t nil p ->
JMeq v v' ->
mapsto sh t p v = data_at sh t v' p.
Lemma headptr_field_compatible: forall {cs: compspecs} t path p,
headptr p ->
complete_legal_cosu_type t = true ->
legal_nested_field t path ->
sizeof t < Ptrofs.modulus ->
align_compatible_rec cenv_cs t 0 ->
field_compatible t path p.