Library zoo_persistent.pstack
Require Import zoo.prelude.
Require Import zoo.base.
Require Import zoo_std.option.
Require Export zoo_persistent.pstack__code.
Require Import zoo_persistent.pstack__types.
Require Import zoo.options.
Implicit Type v t : val.
Section zoo۰G.
Context `{zoo۰G : !ZooG Σ}.
Definition pstack۰model t vs : iProp Σ :=
list۰model t vs.
#[global] Instance pstack۰modelーtimeless t vs :
Timeless (pstack۰model t vs).
#[global] Instance pstack۰modelーpersistent t vs :
Persistent (pstack۰model t vs).
Lemma pstack۰modelーnil :
⊢ pstack۰model pstack٠empty [].
Lemma pstack٠is_emptyーspec t vs :
{{{
pstack۰model t vs
}}}
pstack٠is_empty t
{{{
RET #(bool_decide (vs = []%list));
True
}}}.
Lemma pstack٠pushーspec t vs v :
{{{
pstack۰model t vs
}}}
pstack٠push t v
{{{
t'
, RET t';
pstack۰model t' (v :: vs)
}}}.
Lemma pstack٠popーspec t vs :
{{{
pstack۰model t vs
}}}
pstack٠pop t
{{{
o
, RET o;
match o with
| None ⇒
⌜vs = []⌝
| Some p ⇒
∃ v vs' t',
⌜vs = v :: vs'⌝ ∗
⌜p = (v, t')%V⌝ ∗
pstack۰model t' vs'
end
}}}.
End zoo۰G.
Require zoo_persistent.pstack__opaque.
#[global] Opaque pstack۰model.
Require Import zoo.base.
Require Import zoo_std.option.
Require Export zoo_persistent.pstack__code.
Require Import zoo_persistent.pstack__types.
Require Import zoo.options.
Implicit Type v t : val.
Section zoo۰G.
Context `{zoo۰G : !ZooG Σ}.
Definition pstack۰model t vs : iProp Σ :=
list۰model t vs.
#[global] Instance pstack۰modelーtimeless t vs :
Timeless (pstack۰model t vs).
#[global] Instance pstack۰modelーpersistent t vs :
Persistent (pstack۰model t vs).
Lemma pstack۰modelーnil :
⊢ pstack۰model pstack٠empty [].
Lemma pstack٠is_emptyーspec t vs :
{{{
pstack۰model t vs
}}}
pstack٠is_empty t
{{{
RET #(bool_decide (vs = []%list));
True
}}}.
Lemma pstack٠pushーspec t vs v :
{{{
pstack۰model t vs
}}}
pstack٠push t v
{{{
t'
, RET t';
pstack۰model t' (v :: vs)
}}}.
Lemma pstack٠popーspec t vs :
{{{
pstack۰model t vs
}}}
pstack٠pop t
{{{
o
, RET o;
match o with
| None ⇒
⌜vs = []⌝
| Some p ⇒
∃ v vs' t',
⌜vs = v :: vs'⌝ ∗
⌜p = (v, t')%V⌝ ∗
pstack۰model t' vs'
end
}}}.
End zoo۰G.
Require zoo_persistent.pstack__opaque.
#[global] Opaque pstack۰model.