Module EnvSL.
Definition env_mapsto: forall {key A}{KE: EqDec key} (id: key) (sh: Share.t) (v: A) , pred (env key A) := @_env_mapsto.
Arguments env_mapsto [key] [A] [KE] _ _ _ _.
Hint Resolve @emp_empty_env' : core.
Definition own_var {key: Type}{A: Type}{KE: EqDec key} (sh: pshare) (id: key) : pred (env key A) :=
exp (env_mapsto id (pshare_sh sh)).
Definition see_var {key: Type}{A: Type}{KE: EqDec key} (id: key) : pred (env key A) :=
exp (fun sh: pshare => own_var sh id).
Definition own_all {key: Type}{A: Type}{KE: EqDec key} (l: list key) : pred (env key A) :=
list_sepcon (map (own_var pfullshare) l).
Definition restrict_env {key: Type}{A: Type}{KE: EqDec key} (ids: list key) (rho:env key A) : env key A :=
mk_env _ (restrict_env'_finite ids rho).
Definition restrict_env_comp' {key: Type}{A: Type}{KE: EqDec key} (ids: list key) (rho: env key A) (id: key) : option (pshare * A) :=
if  In_dec eq_dec id ids
then None
else env_get rho id.
Definition restrict_env_comp  {key: Type}{A: Type}{KE: EqDec key} (ids: list key) (rho:env key A) : env key A:=
mk_env _ (restrict_env_comp'_finite ids rho).

Lemma restrict_env_app  {key: Type}{A: Type}{KE: EqDec key} :
forall ids1 ids2 (rho: env key A),  list_disjoint ids1 ids2 ->
join (restrict_env ids1 rho) (restrict_env ids2 rho) (restrict_env (ids1++ids2) rho).