Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joshua Yanovski
iris-coq
Commits
a1e93de9
Commit
a1e93de9
authored
Jul 18, 2016
by
Robbert Krebbers
Browse files
Use option in spawn.
parent
98d7ce9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
heap_lang/lib/spawn.v
View file @
a1e93de9
...
...
@@ -5,13 +5,13 @@ Import uPred.
Definition
spawn
:
val
:=
λ
:
"f"
,
let:
"c"
:=
ref
(
InjL
#
0
)
in
Fork
(
"c"
<-
InjR
(
"f"
#()))
;;
"c"
.
let:
"c"
:=
ref
NONE
in
Fork
(
"c"
<-
SOME
(
"f"
#()))
;;
"c"
.
Definition
join
:
val
:=
rec:
"join"
"c"
:=
match:
!
"c"
with
InjR
"x"
=>
"x"
|
InjL
<>
=>
"join"
"c"
SOME
"x"
=>
"x"
|
NONE
=>
"join"
"c"
end
.
Global
Opaque
spawn
join
.
...
...
@@ -33,8 +33,8 @@ Context (heapN N : namespace).
Local
Notation
iProp
:=
(
iPropG
heap_lang
Σ
).
Definition
spawn_inv
(
γ
:
gname
)
(
l
:
loc
)
(
Ψ
:
val
→
iProp
)
:
iProp
:=
(
∃
lv
,
l
↦
lv
★
(
lv
=
InjLV
#
0
∨
∃
v
,
lv
=
InjR
V
v
★
(
Ψ
v
∨
own
γ
(
Excl
()))))
%
I
.
(
∃
lv
,
l
↦
lv
★
(
lv
=
NONEV
∨
∃
v
,
lv
=
SOME
V
v
★
(
Ψ
v
∨
own
γ
(
Excl
()))))
%
I
.
Definition
join_handle
(
l
:
loc
)
(
Ψ
:
val
→
iProp
)
:
iProp
:=
(
heapN
⊥
N
★
∃
γ
,
heap_ctx
heapN
★
own
γ
(
Excl
())
★
...
...
@@ -60,13 +60,13 @@ Proof.
wp_let
.
wp_alloc
l
as
"Hl"
.
wp_let
.
iPvs
(
own_alloc
(
Excl
()))
as
(
γ
)
"Hγ"
;
first
done
.
iPvs
(
inv_alloc
N
_
(
spawn_inv
γ
l
Ψ
)
with
"[Hl]"
)
as
"#?"
;
first
done
.
{
iNext
.
iExists
(
InjLV
#
0
)
.
iFrame
;
eauto
.
}
{
iNext
.
iExists
NONEV
.
iFrame
;
eauto
.
}
wp_apply
wp_fork
.
iSplitR
"Hf"
.
-
iPvsIntro
.
wp_seq
.
iPvsIntro
.
iApply
"HΦ"
.
rewrite
/
join_handle
.
eauto
.
-
wp_focus
(
f
_
).
iApply
wp_wand_l
.
iFrame
"Hf"
;
iIntros
(
v
)
"Hv"
.
iInv
N
as
(
v
'
)
"[Hl _]"
;
first
wp_done
.
wp_store
.
iPvsIntro
.
iSplit
;
[
iNext
|
done
].
iExists
(
InjR
V
v
).
iFrame
.
eauto
.
iExists
(
SOME
V
v
).
iFrame
.
eauto
.
Qed
.
Lemma
join_spec
(
Ψ
:
val
→
iProp
)
l
(
Φ
:
val
→
iProp
)
:
...
...
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