Ltac solve_ptr_derives :=
  repeat rewrite isptr_offset_val;
  apply derives_refl.

(* Specifications: *)
Lemma field_at_Tstruct: forall sh t gfs id a v1 v2 p, nested_field_type t gfs = Tstruct id a -> JMeq v1 v2 -> field_at sh t gfs v1 p = nested_sfieldlist_at sh t gfs (co_members (get_co id)) v2 p.
Lemma field_at_Tunion: forall sh t gfs id a v1 v2 p, nested_field_type t gfs = Tunion id a -> JMeq v1 v2 -> field_at sh t gfs v1 p = nested_ufieldlist_at sh t gfs (co_members (get_co id)) v2 p.
Lemma array_at_len_1: forall sh t gfs i v v' p, JMeq v v' -> array_at sh t gfs i (i + 1) (v :: nil) p = field_at sh t (ArraySubsc i :: gfs) v' p.
Lemma split2_array_at: forall sh t gfs lo mid hi v p, lo <= mid <= hi -> Zlength v = hi - lo -> array_at sh t gfs lo hi v p = array_at sh t gfs lo mid (sublist 0 (mid-lo) v) p * array_at sh t gfs mid hi (sublist (mid-lo) (Zlength v) v) 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* array_at sh t gfs ml mr (sublist (ml-lo) (mr-lo) v) p * array_at sh t gfs mr hi (sublist (mr-lo) (hi-lo) v) p.
Lemma split3_array_at: forall sh t gfs lo mid hi v v0 p, lo <= mid < hi -> Zlength v = hi-lo -> JMeq v0 (Znth (mid-lo) v) -> array_at sh t gfs lo hi v p = array_at sh t gfs lo mid (sublist 0 (mid-lo) v) p * field_at sh t (ArraySubsc mid :: gfs) v0 p * array_at sh t gfs (mid + 1) hi (sublist (mid+1-lo) (hi-lo) v) p.
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 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 -> 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.
Lemma field_at__memory_block: forall sh t gfs p, field_at_ sh t gfs p = memory_block sh (sizeof (nested_field_type t gfs)) (field_address t gfs p).
Lemma memory_block_data_at_: forall sh t p, field_compatible t nil p -> memory_block sh (sizeof t) p = data_at_ sh t p.
Lemma withspacer_field_at__Tunion: forall sh t gfs i id a p, nested_field_type t gfs = Tunion id a -> in_members i (co_members (get_co id)) -> withspacer sh (nested_field_offset t gfs + sizeof (field_type i (co_members (get_co id)))) (nested_field_offset t gfs + sizeof (nested_field_type t gfs)) (field_at_ sh t (gfs UDOT i)) p = memory_block sh (sizeof (nested_field_type t gfs)) (field_address t gfs p).
Lemma lower_andp_val: forall (P Q: val->mpred) v, ((P && Q) v) = (P v && Q v).
Lemma compute_legal_nested_field_spec': forall t gfs, Forall Datatypes.id (compute_legal_nested_field t gfs) -> legal_nested_field t gfs.