Section STABILITY.
Variables env env': composite_env.
Hypothesis extends: forall id co, env!id = Some co -> env'!id = Some co.
End STABILITY.
(** It follows that the sizes and alignments contained in the composite environment produced by [build_composite_env] are consistent with the sizes and alignments of the members of the composite types. *)
Record composite_consistent (env: composite_env) (co: composite) : Prop := {
co_consistent_complete:
complete_members env (co_members co) = true;
co_consistent_alignof:
co_alignof co = align_attr (co_attr co) (alignof_composite env (co_members co));
co_consistent_sizeof:
co_sizeof co = align (sizeof_composite env (co_su co) (co_members co)) (co_alignof co);
co_consistent_rank:
co_rank co = rank_members env (co_members co)
}.
Definition composite_env_consistent (env: composite_env) : Prop :=
forall id co, env!id = Some co -> composite_consistent env co.
(** Moreover, every composite definition is reflected in the composite environment. *)
(** As a corollay, in a consistent environment, the rank of a composite type is strictly greater than the ranks of its member types. *)
Remark rank_type_members:
forall ce id t m, In (id, t) m -> (rank_type ce t <= rank_members ce m)%nat.

Lemma rank_struct_member:
forall ce id a co id1 t1,
composite_env_consistent ce ->
ce!id = Some co ->
In (id1, t1) (co_members co) ->
(rank_type ce t1 < rank_type ce (Tstruct id a))%nat.