Library zoo_std.ref_
Require Import zoo.prelude.
Require Import zoo.base.
Require Import zoo.options.
Implicit Type l : location.
Section zoo۰G.
Context `{zoo۰G : !ZooG Σ}.
Context τ `{!iType (iPropI Σ) τ}.
Definition itype۰ref t : iProp Σ :=
∃ l,
⌜t = #l⌝ ∗
inv nroot (
∃ w,
l ↦ᵣ w ∗
τ w
).
#[global] Instance itype۰refーitype :
iType _ itype۰ref.
Lemma ref٠makeーtype v :
{{{
τ v
}}}
𝗿𝗲𝗳 v
{{{
t
, RET t;
itype۰ref t
}}}.
Lemma ref٠getーtype t :
{{{
itype۰ref t
}}}
!t
{{{
v
, RET v;
τ v
}}}.
Lemma ref٠setーtype t v :
{{{
itype۰ref t ∗
τ v
}}}
t <- v
{{{
RET ();
True
}}}.
End zoo۰G.
Require Import zoo.base.
Require Import zoo.options.
Implicit Type l : location.
Section zoo۰G.
Context `{zoo۰G : !ZooG Σ}.
Context τ `{!iType (iPropI Σ) τ}.
Definition itype۰ref t : iProp Σ :=
∃ l,
⌜t = #l⌝ ∗
inv nroot (
∃ w,
l ↦ᵣ w ∗
τ w
).
#[global] Instance itype۰refーitype :
iType _ itype۰ref.
Lemma ref٠makeーtype v :
{{{
τ v
}}}
𝗿𝗲𝗳 v
{{{
t
, RET t;
itype۰ref t
}}}.
Lemma ref٠getーtype t :
{{{
itype۰ref t
}}}
!t
{{{
v
, RET v;
τ v
}}}.
Lemma ref٠setーtype t v :
{{{
itype۰ref t ∗
τ v
}}}
t <- v
{{{
RET ();
True
}}}.
End zoo۰G.