Section COMPOSITE_ENV.
Context {cs: compspecs}.
Ltac solve_field_offset_type i m :=
let H := fresh "H" in
let Hty := fresh "H" in
let Hofs := fresh "H" in
let t := fresh "t" in
let ofs := fresh "ofs" in
pose proof field_offset_field_type_match cenv_cs i m;
destruct (Ctypes.field_offset cenv_cs i m) as [ofs|?] eqn:Hofs, (Ctypes.field_type i m) as [t|?] eqn:Hty;
[clear H | inversion H | inversion H | clear H].

(* Specifications: *)
Lemma complete_legal_cosu_member: forall (cenv : composite_env) (id : ident) (t : type) (m : list (ident * type)),
In (id, t) m -> @composite_complete_legal_cosu_type cenv m = true -> @complete_legal_cosu_type cenv t = true.
Lemma complete_legal_cosu_type_field_type: forall id i,
in_members i (co_members (get_co id)) ->
complete_legal_cosu_type (field_type i (co_members (get_co id))) = true.
Lemma align_compatible_rec_Tstruct_inv': forall id a ofs,
align_compatible_rec cenv_cs (Tstruct id a) ofs ->
forall i,
in_members i (co_members (get_co id)) ->
align_compatible_rec cenv_cs (field_type i (co_members (get_co id)))
(ofs + field_offset cenv_cs i (co_members (get_co id))).
Lemma align_compatible_rec_Tunion_inv': forall id a ofs,
align_compatible_rec cenv_cs (Tunion id a) ofs ->
forall i,
in_members i (co_members (get_co id)) ->
align_compatible_rec cenv_cs (field_type i (co_members (get_co id))) ofs.
Lemma field_offset_aligned: forall i m,
(alignof (field_type i m) | field_offset cenv_cs i m).
Lemma alignof_composite_hd_divide: forall i t m, (alignof t | alignof_composite cenv_cs ((i, t) :: m)).
Lemma alignof_composite_tl_divide: forall i t m, (alignof_composite cenv_cs m | alignof_composite cenv_cs ((i, t) :: m)).
Lemma alignof_field_type_divide_alignof: forall i m,
in_members i m ->
(alignof (field_type i m) | alignof_composite cenv_cs m).
(* if sizeof Tvoid = 0, this lemma can be nicer. *)
Lemma field_offset_in_range: forall i m,
in_members i m ->
0 <= field_offset cenv_cs i m /\ field_offset cenv_cs i m + sizeof (field_type i m) <= sizeof_struct cenv_cs 0 m.
(* if sizeof Tvoid = 0, this lemma can be nicer. *)
Lemma sizeof_union_in_members: forall i m,
in_members i m ->
sizeof (field_type i m) <= sizeof_union cenv_cs m.