-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_rdcss.v
71 lines (58 loc) · 2.09 KB
/
spec_rdcss.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From iris.base_logic.lib Require Import invariants.
From smr.program_logic Require Import atomic.
From smr.lang Require Import proofmode notation.
From iris.prelude Require Import options.
Definition RdcssT Σ : Type :=
∀ (γ : gname) (n : val), iProp Σ.
Definition IsRdcssT Σ (N : namespace) : Type :=
∀ (γ : gname) (l_n : loc), iProp Σ.
Section spec.
Context `{!heapGS Σ}.
Context (rdcssN : namespace).
Variables
(new_rdcss : val)
(get : val)
(rdcss : val).
Variables
(Rdcss : RdcssT Σ)
(IsRdcss : IsRdcssT Σ rdcssN).
Definition new_rdcss_spec' : Prop :=
⊢ ∀ (n : val),
⌜rdcssN ## inv_heapN⌝ → inv_heap_inv -∗
{{{ True }}}
new_rdcss n
{{{ (γ : gname) l_n, RET #l_n; IsRdcss γ l_n ∗ Rdcss γ n }}}.
Definition get_spec' : Prop :=
⊢ ∀ γ (l_n : loc),
IsRdcss γ l_n -∗
<<{ ∀∀ (n : val), Rdcss γ n }>>
get #l_n @ ⊤,↑rdcssN,∅
<<{ Rdcss γ n | RET n }>>.
Definition rdcss_spec' : Prop :=
⊢ ∀ γ (l_n l_m : loc) (m1 n1 n2 : val),
⌜val_is_unboxed (InjLV n1)⌝ →
⌜val_is_unboxed m1⌝ →
IsRdcss γ l_n -∗
<<{ ∀∀ (m n : val), l_m ↦_(λ _, True) m ∗ Rdcss γ n }>>
rdcss #l_m #l_n m1 n1 n2 @ ⊤,(↑rdcssN ∪ ↑inv_heapN),∅
<<{ l_m ↦_(λ _, True) m ∗ Rdcss γ (if decide (m = m1 ∧ n = n1) then n2 else n) | RET n }>>.
End spec.
Record rdcss_code : Type := RdcssCode {
new_rdcss : val;
get : val;
rdcss : val;
}.
Record rdcss_spec_record {Σ} `{!heapGS Σ} {rdcssN : namespace}
: Type := RdcssSpec {
rdcss_spec_code :> rdcss_code;
Rdcss : RdcssT Σ;
IsRdcss : IsRdcssT Σ rdcssN;
Rdcss_Timeless : ∀ γ n, Timeless (Rdcss γ n);
IsRdcss_Persistent : ∀ γ l_n, Persistent (IsRdcss γ l_n);
new_rdcss_spec : new_rdcss_spec' rdcssN rdcss_spec_code.(new_rdcss) Rdcss IsRdcss;
get_spec : get_spec' rdcssN rdcss_spec_code.(get) Rdcss IsRdcss;
rdcss_spec : rdcss_spec' rdcssN rdcss_spec_code.(rdcss) Rdcss IsRdcss;
}.
Global Arguments rdcss_spec_record : clear implicits.
Global Arguments rdcss_spec_record _ {_} _ : assert.
Global Existing Instances Rdcss_Timeless IsRdcss_Persistent.