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. *)

Theorem build_composite_env_charact:
forall id su m a defs env,
build_composite_env defs = OK env ->
In (Composite id su m a) defs ->
exists co, env!id = Some co /\ co_members co = m /\ co_attr co = a /\ co_su co = su.