(* Lemma field_compatible_complete_type: forall t path p, field_compatible t path p -> complete_type cenv_cs t = true.  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).  End COMPOSITE_ENV. (* Arguments nested_field_offset2 {cs} t gfs /. Arguments nested_field_type2 {cs} t gfs /. *)
(* Hint Resolve field_address_isptr. *)
Hint Resolve is_pointer_or_null_field_compatible.
(* Hint Extern 1 (complete_type _ _ = true) => (eapply field_compatible_complete_type; eassumption). *)
Hint Extern 1 (isptr _) => (eapply field_compatible_isptr; eassumption).
Hint Extern 1 (isptr _) => (eapply field_compatible0_isptr; eassumption).
Hint Extern 1 (legal_nested_field _ _) => (eapply field_compatible_legal_nested_field; eassumption).
Hint Extern 1 (legal_nested_field0 _ _) => (eapply field_compatible_legal_nested_field0; eassumption).
Hint Extern 1 (legal_nested_field0 _ _) => (eapply field_compatible0_legal_nested_field0; eassumption).

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.