Library zoo_std.stack
Require Import zoo.prelude.
Require Import zoo.base.
Require Export zoo_std.stack__code.
Require Import zoo_std.stack__types.
Require Import zoo.options.
Implicit Type v t : val.
Section zoo۰G.
Context `{zoo۰G : !ZooG Σ}.
Definition stack۰model t vs :=
dynarray_1۰model t (reverse vs).
#[global] Instance stack۰modelーtimeless t vs :
Timeless (stack۰model t vs).
Lemma stack٠makeーspec :
{{{
True
}}}
stack٠create ()
{{{
t
, RET t;
stack۰model t []
}}}.
Lemma stack٠is_emptyーspec t vs :
{{{
stack۰model t vs
}}}
stack٠is_empty t
{{{
RET #(bool_decide (vs = []%list));
stack۰model t vs
}}}.
Lemma stack٠pushーspec t vs v :
{{{
stack۰model t vs
}}}
stack٠push t v
{{{
RET ();
stack۰model t (v :: vs)
}}}.
Lemma stack٠popーspec {t vs} v vs' :
vs = v :: vs' →
{{{
stack۰model t vs
}}}
stack٠pop t
{{{
RET v;
stack۰model t vs'
}}}.
End zoo۰G.
Require zoo_std.stack__opaque.
#[global] Opaque stack۰model.
Require Import zoo.base.
Require Export zoo_std.stack__code.
Require Import zoo_std.stack__types.
Require Import zoo.options.
Implicit Type v t : val.
Section zoo۰G.
Context `{zoo۰G : !ZooG Σ}.
Definition stack۰model t vs :=
dynarray_1۰model t (reverse vs).
#[global] Instance stack۰modelーtimeless t vs :
Timeless (stack۰model t vs).
Lemma stack٠makeーspec :
{{{
True
}}}
stack٠create ()
{{{
t
, RET t;
stack۰model t []
}}}.
Lemma stack٠is_emptyーspec t vs :
{{{
stack۰model t vs
}}}
stack٠is_empty t
{{{
RET #(bool_decide (vs = []%list));
stack۰model t vs
}}}.
Lemma stack٠pushーspec t vs v :
{{{
stack۰model t vs
}}}
stack٠push t v
{{{
RET ();
stack۰model t (v :: vs)
}}}.
Lemma stack٠popーspec {t vs} v vs' :
vs = v :: vs' →
{{{
stack۰model t vs
}}}
stack٠pop t
{{{
RET v;
stack۰model t vs'
}}}.
End zoo۰G.
Require zoo_std.stack__opaque.
#[global] Opaque stack۰model.