Definition is_aligned cenv ha_env la_env (t: type) (ofs: Z): bool := is_aligned_aux (legal_alignas_type cenv ha_env la_env t) (hardware_alignof ha_env t) ofs.Definition legal_alignas_env_sound (cenv: composite_env) (ha_env: PTree.t Z) (la_env: PTree.t legal_alignas_obs): Prop :=
    forall ofs t,
      complete_legal_cosu_type cenv t = true ->
      is_aligned cenv ha_env la_env t ofs = true ->
      align_compatible_rec cenv t ofs.Definition legal_alignas_obs: Type := bool.Fixpoint legal_alignas_members (la_env: PTree.t bool) (m: members): bool :=
  match m with
  | nil => true
  | (_, t) :: m' => (legal_alignas_type la_env t) && (legal_alignas_members la_env m')
  end.Definition legal_alignas_composite (la_env: PTree.t bool) (co: composite): bool :=
  legal_alignas_members la_env (co_members co).Definition legal_alignas_env: PTree.t bool :=
  let l := composite_reorder.rebuild_composite_elements cenv in
  fold_right (fun (ic: positive * composite) (T0: PTree.t bool) => let (i, co) := ic in let T := T0 in PTree.set i (legal_alignas_composite T co) T) (PTree.empty _) l.Module LegalAlignas := LegalAlignasStrict.Module LegalAlignasDefs := LegalAlignasDefsGen (LegalAlignas).

(* Specifications: *)
Theorem legal_alignas_env_consistency: forall (cenv: composite_env) (ha_env: PTree.t Z), composite_env_consistent cenv -> legal_alignas_env_consistent cenv ha_env (legal_alignas_env cenv ha_env).
Theorem legal_alignas_env_completeness: forall (cenv: composite_env) (ha_env: PTree.t Z), legal_alignas_env_complete cenv (legal_alignas_env cenv ha_env).
Lemma by_value_sound: forall t ofs, is_aligned cenv ha_env la_env t ofs = true -> (exists ch, access_mode t = By_value ch) -> align_compatible_rec cenv t ofs.
Theorem legal_alignas_soundness: legal_alignas_env_sound cenv ha_env la_env.