Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Rodolphe Lepigre
Iris
Commits
d5229693
Commit
d5229693
authored
Jul 19, 2016
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use SOME/NONE in tests/one_shot.
parent
2966b4da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
tests/one_shot.v
tests/one_shot.v
+14
-14
No files found.
tests/one_shot.v
View file @
d5229693
...
...
@@ -5,17 +5,17 @@ From iris.proofmode Require Import invariants ghost_ownership.
Import
uPred
.
Definition
one_shot_example
:
val
:
=
λ
:
<>,
let
:
"x"
:
=
ref
(
InjL
#
0
)
in
(
let
:
"x"
:
=
ref
NONE
in
(
(* tryset *)
(
λ
:
"n"
,
CAS
"x"
(
InjL
#
0
)
(
InjR
"n"
)),
CAS
"x"
NONE
(
SOME
"n"
)),
(* check *)
(
λ
:
<>,
let
:
"y"
:
=
!
"x"
in
λ
:
<>,
match
:
"y"
with
InjL
<>
=>
#()
|
InjR
"n"
=>
NONE
=>
#()
|
SOME
"n"
=>
match
:
!
"x"
with
InjL
<>
=>
assert
:
#
false
|
InjR
"m"
=>
assert
:
"n"
=
"m"
NONE
=>
assert
:
#
false
|
SOME
"m"
=>
assert
:
"n"
=
"m"
end
end
)).
Global
Opaque
one_shot_example
.
...
...
@@ -35,8 +35,8 @@ Context (heapN N : namespace) (HN : heapN ⊥ N).
Local
Notation
iProp
:
=
(
iPropG
heap_lang
Σ
).
Definition
one_shot_inv
(
γ
:
gname
)
(
l
:
loc
)
:
iProp
:
=
(
l
↦
InjLV
#
0
★
own
γ
Pending
∨
∃
n
:
Z
,
l
↦
InjR
V
#
n
★
own
γ
(
Cinr
(
DecAgree
n
)))%
I
.
(
l
↦
NONEV
★
own
γ
Pending
∨
∃
n
:
Z
,
l
↦
SOME
V
#
n
★
own
γ
(
Cinr
(
DecAgree
n
)))%
I
.
Lemma
wp_one_shot
(
Φ
:
val
→
iProp
)
:
heap_ctx
heapN
★
(
∀
f1
f2
:
val
,
...
...
@@ -58,14 +58,14 @@ Proof.
iPvsIntro
;
iRight
;
iExists
n
;
by
iSplitL
"Hl"
.
+
wp_cas_fail
.
rewrite
/
one_shot_inv
;
eauto
10
.
-
iIntros
"!"
.
wp_seq
.
wp_focus
(!
_
)%
E
.
iInv
>
N
as
"Hγ"
.
iAssert
(
∃
v
,
l
↦
v
★
((
v
=
InjLV
#
0
★
own
γ
Pending
)
∨
∃
n
:
Z
,
v
=
InjR
V
#
n
★
own
γ
(
Cinr
(
DecAgree
n
))))%
I
with
"[-]"
as
"Hv"
.
iAssert
(
∃
v
,
l
↦
v
★
((
v
=
NONEV
★
own
γ
Pending
)
∨
∃
n
:
Z
,
v
=
SOME
V
#
n
★
own
γ
(
Cinr
(
DecAgree
n
))))%
I
with
"[-]"
as
"Hv"
.
{
iDestruct
"Hγ"
as
"[[Hl Hγ]|Hl]"
;
last
iDestruct
"Hl"
as
(
m
)
"[Hl Hγ]"
.
+
iExists
(
InjLV
#
0
)
.
iFrame
.
eauto
.
+
iExists
(
InjR
V
#
m
).
iFrame
.
eauto
.
}
+
iExists
NONEV
.
iFrame
.
eauto
.
+
iExists
(
SOME
V
#
m
).
iFrame
.
eauto
.
}
iDestruct
"Hv"
as
(
v
)
"[Hl Hv]"
.
wp_load
;
iPvsIntro
.
iAssert
(
one_shot_inv
γ
l
★
(
v
=
InjLV
#
0
∨
∃
n
:
Z
,
v
=
InjR
V
#
n
★
own
γ
(
Cinr
(
DecAgree
n
))))%
I
with
"[-]"
as
"[$ #Hv]"
.
iAssert
(
one_shot_inv
γ
l
★
(
v
=
NONEV
∨
∃
n
:
Z
,
v
=
SOME
V
#
n
★
own
γ
(
Cinr
(
DecAgree
n
))))%
I
with
"[-]"
as
"[$ #Hv]"
.
{
iDestruct
"Hv"
as
"[[% ?]|Hv]"
;
last
iDestruct
"Hv"
as
(
m
)
"[% ?]"
;
subst
.
+
iSplit
.
iLeft
;
by
iSplitL
"Hl"
.
eauto
.
+
iSplit
.
iRight
;
iExists
m
;
by
iSplitL
"Hl"
.
eauto
.
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment