Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Iris
Iris
Commits
bb8c2f55
Commit
bb8c2f55
authored
Sep 07, 2016
by
Robbert Krebbers
Browse files
Use bool instead of int in barrier implementation.
parent
ba7cf95f
Pipeline
#2671
passed with stage
in 9 minutes and 16 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
heap_lang/lib/barrier/barrier.v
View file @
bb8c2f55
From
iris
.
heap_lang
Require
Export
notation
.
Definition
newbarrier
:
val
:
=
λ
:
<>,
ref
#
0
.
Definition
signal
:
val
:
=
λ
:
"x"
,
"x"
<-
#
1
.
Definition
newbarrier
:
val
:
=
λ
:
<>,
ref
#
false
.
Definition
signal
:
val
:
=
λ
:
"x"
,
"x"
<-
#
true
.
Definition
wait
:
val
:
=
rec
:
"wait"
"x"
:
=
if
:
!
"x"
=
#
1
then
#()
else
"wait"
"x"
.
rec
:
"wait"
"x"
:
=
if
:
!
"x"
then
#()
else
"wait"
"x"
.
Global
Opaque
newbarrier
signal
wait
.
heap_lang/lib/barrier/proof.v
View file @
bb8c2f55
...
...
@@ -28,7 +28,7 @@ Definition ress (P : iProp Σ) (I : gset gname) : iProp Σ :=
▷
(
P
-
★
[
★
set
]
i
∈
I
,
Ψ
i
)
★
[
★
set
]
i
∈
I
,
saved_prop_own
i
(
Ψ
i
))%
I
.
Coercion
state_to_val
(
s
:
state
)
:
val
:
=
match
s
with
State
Low
_
=>
#
0
|
State
High
_
=>
#
1
end
.
match
s
with
State
Low
_
=>
#
false
|
State
High
_
=>
#
true
end
.
Arguments
state_to_val
!
_
/
:
simpl
nomatch
.
Definition
state_to_prop
(
s
:
state
)
(
P
:
iProp
Σ
)
:
iProp
Σ
:
=
...
...
@@ -145,7 +145,7 @@ Proof.
{
iSplit
;
first
done
.
iNext
.
rewrite
{
2
}/
barrier_inv
/=.
by
iFrame
.
}
iAssert
(
sts_ownS
γ
(
i_states
i
)
{[
Change
i
]})%
I
with
"==>[Hγ]"
as
"Hγ"
.
{
iApply
(
sts_own_weaken
with
"Hγ"
)
;
eauto
using
i_states_closed
.
}
iVsIntro
.
wp_op
=>
?
;
simplify_eq
;
wp_if
.
iVsIntro
.
wp_if
.
iApply
(
"IH"
with
"Hγ [HQR] HΦ"
).
auto
.
-
(* a High state: the comparison succeeds, and we perform a transition and
return to the client *)
...
...
@@ -157,7 +157,7 @@ Proof.
{
iSplit
;
[
iPureIntro
;
by
eauto
using
wait_step
|].
iNext
.
rewrite
{
2
}/
barrier_inv
/=
;
iFrame
"Hl"
.
iExists
Ψ
;
iFrame
.
auto
.
}
iPoseProof
(
saved_prop_agree
i
Q
(
Ψ
i
)
with
"[#]"
)
as
"Heq"
;
first
by
auto
.
iVsIntro
.
wp_op
=>
?
;
simplify_eq
/=
;
wp_if
.
iVsIntro
.
wp_if
.
iVsIntro
.
iApply
"HΦ"
.
iApply
"HQR"
.
by
iRewrite
"Heq"
.
Qed
.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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