Instance Join_stack : Join stack := Join_equiv stack.
Instance Perm_stack : Perm_alg stack := Perm_equiv stack.
Instance Sep_stack : Sep_alg stack := Sep_equiv stack.
Instance Canc_stack : Canc_alg stack := Canc_equiv stack.
Definition stack_get (s: stack) (x: option var) : val :=
match x with
| Some i => env_get s i
| None => empty_val
end.
Definition upd_stack (x : var) (v : val) (s : stack) : stack :=
env_set x v s.

Lemma stack_nil : forall s : stack, stack_get s None = empty_val.
Instance Perm_state: Perm_alg state.