Definition field_address t gfs p :=
  if (field_compatible_dec t gfs p)
  then offset_val (nested_field_offset t gfs) p
  else Vundef.Definition field_address0 t gfs p :=
  if (field_compatible0_dec t gfs p)
  then offset_val (nested_field_offset t gfs) p
  else Vundef.

(* Specifications: *)
Lemma field_address_isptr: forall t path c, field_compatible t path c -> isptr (field_address t path c).
Lemma field_address0_isptr: forall t path c, field_compatible0 t path c -> isptr (field_address0 t path c).
Lemma field_address_clarify: forall t path c, is_pointer_or_null (field_address t path c) -> field_address t path c = offset_val (nested_field_offset t path) c.
Lemma field_address0_clarify: forall t path c, is_pointer_or_null (field_address0 t path c) -> field_address0 t path c = offset_val (nested_field_offset t path) c.
Lemma field_compatible_field_compatible0: forall (t : type) (gfs : list gfield) (p : val), field_compatible t gfs p -> field_compatible0 t gfs p.
Lemma field_compatible_field_compatible0': forall (t : type) (i : Z) (gfs : list gfield) (p : val), field_compatible t (ArraySubsc i :: gfs) p <-> field_compatible0 t (ArraySubsc i :: gfs) p /\ field_compatible0 t (ArraySubsc (i + 1) :: gfs) p.
Lemma field_compatible0_range: forall i lo hi t gfs p, lo <= i <= hi -> field_compatible0 t (ArraySubsc lo :: gfs) p -> field_compatible0 t (ArraySubsc hi :: gfs) p -> field_compatible0 t (ArraySubsc i :: gfs) p.
Lemma field_compatible_range: forall i lo hi t gfs p, lo <= i < hi -> field_compatible0 t (ArraySubsc lo :: gfs) p -> field_compatible0 t (ArraySubsc hi :: gfs) p -> field_compatible t (ArraySubsc i :: gfs) p.
Lemma is_pointer_or_null_field_compatible: forall t path c, is_pointer_or_null (field_address t path c) -> field_compatible t path c.
Lemma nested_field_type_ArraySubsc: forall t i gfs, nested_field_type t (ArraySubsc i :: gfs) = nested_field_type t (ArraySubsc 0 :: gfs).
Lemma gfield_type_nested_pred: forall {atom_pred: type -> bool}, atom_pred Tvoid = true -> forall (t: type) (gf: gfield), nested_pred atom_pred t = true -> nested_pred atom_pred (gfield_type t gf) = true.
Lemma gfield_array_type_nested_pred: forall {atom_pred: type -> bool}, (forall t n m a, 0 <= m -> atom_pred (Tarray t n a) = true -> atom_pred (Tarray t m (no_alignas_attr a)) = true) -> forall (t: type) lo hi, lo <= hi -> legal_field0 t (ArraySubsc lo) -> nested_pred atom_pred t = true -> nested_pred atom_pred (gfield_array_type t lo hi) = true.
Lemma gfield_type_complete_legal_cosu_type: forall (t: type) (gf: gfield), legal_field t gf -> complete_legal_cosu_type t = true -> complete_legal_cosu_type (gfield_type t gf) = true.
Lemma gfield_array_type_complete_legal_cosu_type: forall (t: type) lo hi, legal_field0 t (ArraySubsc lo) -> complete_legal_cosu_type t = true -> complete_legal_cosu_type (gfield_array_type t lo hi) = true.
Lemma nested_field_type_complete_legal_cosu_type: forall (t: type) (gfs: list gfield), complete_legal_cosu_type t = true -> legal_nested_field t gfs -> complete_legal_cosu_type (nested_field_type t gfs) = true.
Lemma nested_field_array_type_complete_legal_cosu_type: forall (t: type) (gfs: list gfield) lo hi, complete_legal_cosu_type t = true -> legal_nested_field0 t (ArraySubsc lo :: gfs) -> complete_legal_cosu_type (nested_field_array_type t gfs lo hi) = true.
Lemma nested_field_type_nest_pred: forall {atom_pred: type -> bool}, atom_pred Tvoid = true -> forall (t: type) (gfs: list gfield), nested_pred atom_pred t = true -> nested_pred atom_pred (nested_field_type t gfs) = true.
Lemma nested_field_array_type_nest_pred: forall {atom_pred: type -> bool}, atom_pred Tvoid = true -> (forall t n m a, 0 <= m -> atom_pred (Tarray t n a) = true -> atom_pred (Tarray t m (no_alignas_attr a)) = true) -> forall (t: type) gfs lo hi, lo <= hi -> legal_nested_field0 t (ArraySubsc lo :: gfs) -> nested_pred atom_pred t = true -> nested_pred atom_pred (nested_field_array_type t gfs lo hi) = true.
Lemma legal_nested_field0_field: forall t gfs, legal_nested_field t gfs -> legal_nested_field0 t gfs.
Lemma gfield_offset_in_range: forall t gf, legal_field t gf -> complete_legal_cosu_type t = true -> 0 <= gfield_offset t gf /\ gfield_offset t gf + sizeof (gfield_type t gf) <= sizeof t.
Lemma gfield_array_offset_in_range: forall t lo hi, legal_field0 t (ArraySubsc lo) -> legal_field0 t (ArraySubsc hi) -> complete_legal_cosu_type t = true -> 0 <= gfield_offset t (ArraySubsc lo) /\ gfield_offset t (ArraySubsc lo) + sizeof (gfield_array_type t lo hi) <= sizeof t.
Lemma gfield0_offset_in_range: forall t gf, legal_field0 t gf -> complete_legal_cosu_type t = true -> 0 <= gfield_offset t gf /\ gfield_offset t gf <= sizeof t.
Lemma nested_field_offset_in_range: forall t gfs, legal_nested_field t gfs -> complete_legal_cosu_type t = true -> 0 <= nested_field_offset t gfs /\ (nested_field_offset t gfs) + sizeof (nested_field_type t gfs) <= sizeof t.
Lemma nested_field_array_offset_in_range: forall t gfs lo hi, legal_nested_field0 t (ArraySubsc lo :: gfs) -> legal_nested_field0 t (ArraySubsc hi :: gfs) -> complete_legal_cosu_type t = true -> 0 <= nested_field_offset t (ArraySubsc lo :: gfs) /\ nested_field_offset t (ArraySubsc lo :: gfs) + sizeof (nested_field_array_type t gfs lo hi) <= sizeof t.
Lemma nested_field0_offset_in_range: forall (t : type) (gfs : list gfield), legal_nested_field0 t gfs -> complete_legal_cosu_type t = true -> 0 <= nested_field_offset t gfs <= sizeof t.
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_field_shrink: forall t gfs0 gfs1, legal_nested_field t (gfs1 ++ gfs0) -> legal_nested_field t 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_0_compatible: forall t, sizeof t = 0 -> forall p, size_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.
Lemma field_compatible0_isptr : forall t path p, field_compatible0 t path p -> isptr p.
Lemma field_compatible_legal_nested_field: forall (t : type) (path : list gfield) (p : val), field_compatible t path p -> legal_nested_field t path.
Lemma field_compatible_legal_nested_field0: forall (t : type) (path : list gfield) (p : val), field_compatible t path p -> legal_nested_field0 t path.
Lemma field_compatible0_legal_nested_field0: forall (t : type) (path : list gfield) (p : val), field_compatible0 t path p -> legal_nested_field0 t path.
Lemma field_compatible_field_address: forall t gfs p, field_compatible t gfs p -> field_address t gfs p = offset_val (nested_field_offset t gfs) p.
Lemma field_compatible0_field_address0: forall t gfs p, field_compatible0 t gfs p -> field_address0 t gfs p = offset_val (nested_field_offset t gfs) p.
Lemma field_compatible_shrink: forall t_root gfsB gfsA a, field_compatible t_root (gfsB ++ gfsA) a -> field_compatible t_root gfsA a.
Lemma field_compatible0_shrink: forall t_root gfsB gfsA a, field_compatible0 t_root (gfsB ++ gfsA) a -> field_compatible0 t_root gfsA a.
Lemma field_compatible0_shrink1: forall t_root gfsB gfsA a, gfsB <> nil -> field_compatible0 t_root (gfsB ++ gfsA) a -> field_compatible t_root gfsA a.
Lemma field_compatible_app: forall gfsB t_root gfsA a, field_compatible t_root (gfsB ++ gfsA) a -> field_compatible (nested_field_type t_root gfsA) gfsB (field_address t_root gfsA a).
Lemma field_compatible0_app1: forall gfsB t_root gfsA a (NEQ: gfsB <> nil), field_compatible0 t_root (gfsB ++ gfsA) a -> field_compatible0 (nested_field_type t_root gfsA) gfsB (field_address t_root gfsA a).
Lemma field_compatible_app_inv': forall gfsB t_root gfsA a, field_compatible t_root gfsA a -> legal_nested_field (nested_field_type t_root gfsA) gfsB -> field_compatible t_root (gfsB ++ gfsA) a.
Lemma field_compatible0_app_inv': forall gfsB t_root gfsA a, field_compatible t_root gfsA a -> legal_nested_field0 (nested_field_type t_root gfsA) gfsB -> field_compatible0 t_root (gfsB ++ gfsA) a.
Lemma field_compatible_app_inv: forall gfsB t_root gfsA a, field_compatible t_root gfsA a -> field_compatible (nested_field_type t_root gfsA) gfsB (field_address t_root gfsA a) -> field_compatible t_root (gfsB ++ gfsA) a.
Lemma field_compatible0_app_inv: forall gfsB t_root gfsA a, field_compatible t_root gfsA a -> field_compatible0 (nested_field_type t_root gfsA) gfsB (field_address t_root gfsA a) -> field_compatible0 t_root (gfsB ++ gfsA) a.
Lemma field_address_app: forall t_root gfsA gfsB a, field_address t_root (gfsB ++ gfsA) a = field_address (nested_field_type t_root gfsA) gfsB (field_address t_root gfsA a).
Lemma field_address0_app: forall t_root gfsA gfsB a (NEQ: gfsB <> nil), field_address0 t_root (gfsB ++ gfsA) a = field_address0 (nested_field_type t_root gfsA) gfsB (field_address t_root gfsA a).
Lemma nested_field_type_preserves_change_composite: forall {cs_from cs_to} {CCE: change_composite_env cs_from cs_to} (t: type), cs_preserve_type cs_from cs_to (coeq _ _) t = true -> forall gfs, cs_preserve_type cs_from cs_to (coeq cs_from cs_to) (@nested_field_type cs_to t gfs) = true.
Lemma nested_field_type_change_composite: forall {cs_from cs_to} {CCE: change_composite_env cs_from cs_to} (t: type), cs_preserve_type cs_from cs_to (coeq _ _) t = true -> forall gfs, @nested_field_type cs_from t gfs = @nested_field_type cs_to t gfs.
Lemma legal_nested_field_change_composite: forall {cs_from cs_to} {CCE: change_composite_env cs_from cs_to} (t: type), cs_preserve_type cs_from cs_to (coeq _ _) t = true -> forall gfs, @legal_nested_field cs_from t gfs <-> @legal_nested_field cs_to t gfs.
Lemma field_compatible_change_composite: forall {cs_from cs_to} {CCE: change_composite_env cs_from cs_to} (t: type), cs_preserve_type cs_from cs_to (coeq _ _) t = true -> forall gfs p, @field_compatible cs_from t gfs p <-> @field_compatible cs_to t gfs p.
Lemma nested_field_offset_change_composite: forall {cs_from cs_to} {CCE: change_composite_env cs_from cs_to} (t: type), cs_preserve_type cs_from cs_to (coeq _ _) t = true -> forall gfs, @legal_nested_field cs_from t gfs -> @legal_nested_field cs_to t gfs -> @nested_field_offset cs_from t gfs = @nested_field_offset cs_to t gfs.
Lemma lvar_size_compatible: forall {cs: compspecs} id t v rho, locald_denote (lvar id t v) rho -> sizeof t < Ptrofs.modulus -> size_compatible t v.
Lemma lvar_field_compatible: forall {cs: compspecs} id t v rho, locald_denote (lvar id t v) rho -> complete_legal_cosu_type t = true -> is_aligned cenv_cs ha_env_cs la_env_cs t 0 = true -> sizeof t < Ptrofs.modulus -> field_compatible t nil v.
Lemma compute_in_members_e: forall i al, compute_in_members i al = true -> in_members i al.
Lemma field_compatible_nullval: forall CS t f P, @field_compatible CS t f nullval -> P.
Lemma field_compatible_nullval1: forall (CS: compspecs) t fld p, @field_compatible CS t fld p -> p <> nullval.
Lemma field_compatible_nullval2: forall (CS: compspecs) t fld p, @field_compatible CS t fld p -> nullval <> p.