(** Properties of [cenv_for]. *)

Definition cenv_for_gen (atk: VSet.t) (vars: list (ident * type)) : compilenv :=
  List.fold_right (add_local_variable atk) VSet.empty vars.Remark add_local_variable_charact:
  forall id ty atk cenv id1,
  VSet.In id1 (add_local_variable atk (id, ty) cenv) <->
  VSet.In id1 cenv \/ exists chunk, access_mode ty = By_value chunk /\ id = id1 /\ VSet.mem id atk = false.

(* Specifications: *)
Lemma cenv_for_gen_domain: forall atk id vars, VSet.In id (cenv_for_gen atk vars) -> In id (var_names vars).
Lemma cenv_for_gen_by_value: forall atk id ty vars, In (id, ty) vars -> list_norepet (var_names vars) -> VSet.In id (cenv_for_gen atk vars) -> exists chunk, access_mode ty = By_value chunk.
Lemma cenv_for_gen_compat: forall atk id vars, VSet.In id (cenv_for_gen atk vars) -> VSet.mem id atk = false.