(************************************************  nested_field app  ************************************************)

(* Specifications: *)
Lemma nested_field_type_nested_field_type: forall t gfs0 gfs1,
nested_field_type (nested_field_type t gfs0) gfs1 = nested_field_type t (gfs1 ++ gfs0).
Lemma legal_nested_field0_shrink: forall t gfs0 gfs1,
legal_nested_field0 t (gfs1 ++ gfs0) -> legal_nested_field0 t gfs0.
Lemma legal_nested_field0_shrink1: forall t gfs0 gfs1,
gfs1 <> nil ->
legal_nested_field0 t (gfs1 ++ gfs0) -> legal_nested_field t gfs0.
Lemma legal_nested_field_app: forall t gfs0 gfs1,
legal_nested_field t (gfs1 ++ gfs0) -> legal_nested_field (nested_field_type t gfs0) gfs1.
Lemma legal_nested_field0_app: forall t gfs0 gfs1,
legal_nested_field0 t (gfs1 ++ gfs0) -> legal_nested_field0 (nested_field_type t gfs0) gfs1.
Lemma legal_nested_field_app_inv: forall t gfs0 gfs1,
legal_nested_field t gfs0 ->
legal_nested_field (nested_field_type t gfs0) gfs1 ->
legal_nested_field t (gfs1 ++ gfs0).
Lemma legal_nested_field0_app_inv: forall t gfs0 gfs1,
legal_nested_field t gfs0 ->
legal_nested_field0 (nested_field_type t gfs0) gfs1 ->
legal_nested_field0 t (gfs1 ++ gfs0).
Lemma nested_field_offset_app: forall t gfs0 gfs1,
legal_nested_field t (gfs1 ++ gfs0) ->
nested_field_offset t (gfs1 ++ gfs0) = nested_field_offset t gfs0 +
nested_field_offset (nested_field_type t gfs0) gfs1.
Lemma nested_field_offset0_app: forall t gfs0 gfs1,
legal_nested_field0 t (gfs1 ++ gfs0) ->
nested_field_offset t (gfs1 ++ gfs0) = nested_field_offset t gfs0 +
nested_field_offset (nested_field_type t gfs0) gfs1.
(* Lemma size_1_compatible: forall t, sizeof t = 1 -> forall p, size_compatible t p. *)
Lemma size_0_compatible: forall t, sizeof t = 0 -> forall p, size_compatible t p.
(* Lemma align_1_compatible: forall t, alignof t = 1 -> forall p, align_compatible t p. *)
Lemma size_compatible_nested_field: forall t gfs p,
legal_nested_field t gfs ->
complete_legal_cosu_type t = true ->
size_compatible t p ->
size_compatible (nested_field_type t gfs) (offset_val (nested_field_offset t gfs) p).
Lemma size_compatible_nested_field_array: forall t gfs lo hi p,
legal_nested_field0 t (ArraySubsc lo :: gfs) ->
legal_nested_field0 t (ArraySubsc hi :: gfs) ->
complete_legal_cosu_type t = true ->
size_compatible t p ->
size_compatible (nested_field_array_type t gfs lo hi)
(offset_val (nested_field_offset t (ArraySubsc lo :: gfs)) p).
Lemma align_compatible_nested_field: forall t gfs p,
legal_nested_field t gfs ->
size_compatible t p ->
align_compatible t p ->
complete_legal_cosu_type t = true ->
align_compatible (nested_field_type t gfs) (offset_val (nested_field_offset t gfs) p).
Lemma align_compatible_nested_field_array: forall t gfs lo hi p,
legal_nested_field0 t (ArraySubsc lo :: gfs) ->
legal_nested_field0 t (ArraySubsc hi :: gfs) ->
size_compatible t p ->
align_compatible t p ->
complete_legal_cosu_type t = true ->
align_compatible (nested_field_array_type t gfs lo hi)
(offset_val (nested_field_offset t (ArraySubsc lo :: gfs)) p).
Lemma field_compatible_nested_field: forall t gfs p,
field_compatible t gfs p ->
field_compatible (nested_field_type t gfs) nil (offset_val (nested_field_offset t gfs) p).
Lemma field_compatible0_nested_field_array: forall t gfs lo hi p,
field_compatible0 t (ArraySubsc lo :: gfs) p ->
field_compatible0 t (ArraySubsc hi :: gfs) p ->
lo <= hi ->
field_compatible (nested_field_array_type t gfs lo hi) nil (offset_val (nested_field_offset t (ArraySubsc lo :: gfs)) p).
Lemma field_compatible_isptr :
forall t path p, field_compatible t path p -> isptr p.