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_comp_join {key: Type}{A: Type}{KE: EqDec key}:
forall ids (ge: env key A), join (restrict_env ids ge) (restrict_env_comp ids ge) ge.