Definition finite_idfun (f: key -> option (pshare * A)) :=
          (exists l, forall a, ~In a l -> f a = None).Definition mk_env_aux: forall f, finite_idfun f -> finMap f.Definition mk_env (f: key -> option (pshare * A))  (FIN: finite_idfun f):  env :=
   exist _ _ (mk_env_aux _ FIN).

(* Specifications: *)
Lemma env_get_mk_env: forall (f: key -> option (pshare * A)) P, env_get (mk_env f P) = f.
Lemma env_finite: forall rho, finite_idfun (env_get rho).
Lemma env_ext: forall rho1 rho2, env_get rho1 = env_get rho2 -> rho1=rho2.
Lemma env_funct: forall rho1 rho2, rho1 = rho2 -> forall id sh1 sh2 v1 v2, env_get rho1 id = Some(sh1, v1) -> env_get rho2 id = Some(sh2, v2) -> v1 = v2.
Lemma finite_idfun_empty: finite_idfun (fun _ => None).