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

(* Specifications: *)
Lemma composite_consistent_stable:
forall (env env': composite_env)
(EXTENDS: forall id co, env!id = Some co -> env'!id = Some co)
co,
composite_consistent env co -> composite_consistent env' co.
Lemma composite_of_def_consistent:
forall env id su m a co,
composite_of_def env id su m a = OK co ->
composite_consistent env co.
Theorem build_composite_env_consistent:
forall defs env, build_composite_env defs = OK env -> composite_env_consistent env.