Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris-coq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan
iris-coq
Commits
2e2f1aca
Commit
2e2f1aca
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Tweak masks of atomic triples.
parent
43ffab85
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
heap_lang/lib/incrementer.v
+2
-3
2 additions, 3 deletions
heap_lang/lib/incrementer.v
program_logic/atomic.v
+6
-6
6 additions, 6 deletions
program_logic/atomic.v
tests/incrementer_client.v
+7
-5
7 additions, 5 deletions
tests/incrementer_client.v
with
15 additions
and
14 deletions
heap_lang/lib/incrementer.v
+
2
−
3
View file @
2e2f1aca
...
...
@@ -10,14 +10,13 @@ Definition incr : val :=
Global
Opaque
incr
.
Section
incr
.
Context
`{
!
heapG
Σ
}
(
N
:
namespace
)
.
Context
`{
!
heapG
Σ
}
.
(* TODO: Can we have a more WP-style definition and avoid the equality? *)
Lemma
incr_atomic_spec
(
l
:
loc
)
:
heapN
⊥
N
→
heap_ctx
⊢
⟨⟨
x
:
Z
,
l
↦
#
x
⟩⟩
incr
#
l
@
⊤
,
heapN
⟨⟨
v
,
v
=
#
x
∧
l
↦
#
(
x
+
1
)
⟩⟩
.
Proof
.
iIntros
(
HN
)
"#? !#"
;
iIntros
(
P
Q
)
"#Hvs HP"
.
iIntros
"#? !#"
;
iIntros
(
P
Q
)
"#Hvs HP"
.
iLöb
as
"IH"
.
wp_rec
.
wp_bind
(
!
_)
%
E
.
iMod
(
"Hvs"
with
"HP"
)
as
(
x
)
"[Hl [Hclose _]]"
.
...
...
This diff is collapsed.
Click to expand it.
program_logic/atomic.v
+
6
−
6
View file @
2e2f1aca
...
...
@@ -8,7 +8,7 @@ Definition atomic_shift `{invG Σ} {A B}
(
P
:
iProp
Σ
)
(
Φ
:
B
→
iProp
Σ
)
:
iProp
Σ
:=
(
□
(
P
=
{
Eo
,
Ei
}
=★
∃
x
:
A
,
α
x
★
((
α
x
=
{
Ei
,
Eo
}
=★
P
)
∧
(
∀
v
,
β
x
v
=
{
Ei
,
Eo
}
=★
Φ
v
)))
)
%
I
.
α
x
★
((
α
x
=
{
Ei
,
Eo
}
=★
P
)
∧
∀
v
,
β
x
v
=
{
Ei
,
Eo
}
=★
Φ
v
)))
%
I
.
Definition
atomic_triple
`{
irisG
Λ
Σ
}
{
A
}
(
Eo
Ei
:
coPset
)
(* inside/outside masks *)
...
...
@@ -16,24 +16,24 @@ Definition atomic_triple `{irisG Λ Σ} {A}
(
e
:
expr
Λ
)
(
β
:
A
→
val
Λ
→
iProp
Σ
)
:
iProp
Σ
:=
(* atomic post-condition *)
(
□
∀
P
Φ
,
atomic_shift
E
i
E
o
α
β
P
Φ
-★
atomic_shift
E
o
E
i
α
β
P
Φ
-★
P
-★
WP
e
{{
Φ
}})
%
I
.
Notation
"⟨⟨ x , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
:=
(
atomic_triple
E
i
E
o
(
λ
x
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
atomic_triple
E
o
E
i
(
λ
x
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
at
level
20
,
x
at
level
0
,
α
,
e
,
β
at
level
200
,
format
"⟨⟨ x , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
)
:
uPred_scope
.
Notation
"⟨⟨ x : A , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
:=
(
atomic_triple
E
i
E
o
(
λ
x
:
A
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
atomic_triple
E
o
E
i
(
λ
x
:
A
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
at
level
20
,
x
at
level
0
,
α
,
e
,
β
at
level
200
,
format
"⟨⟨ x : A , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
)
:
uPred_scope
.
Notation
"⟨⟨ x , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
:=
(
True
⊢
atomic_triple
E
i
E
o
(
λ
x
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
True
⊢
atomic_triple
E
o
E
i
(
λ
x
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
at
level
20
,
x
at
level
0
,
α
,
e
,
β
at
level
200
,
format
"⟨⟨ x , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
)
:
C_scope
.
Notation
"⟨⟨ x : A , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
:=
(
True
⊢
atomic_triple
E
i
E
o
(
λ
x
:
A
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
True
⊢
atomic_triple
E
o
E
i
(
λ
x
:
A
,
α
)
e
%
E
(
λ
x
v
,
β
))
(
at
level
20
,
x
at
level
0
,
α
,
e
,
β
at
level
200
,
format
"⟨⟨ x : A , α ⟩ ⟩ e @ Eo , Ei ⟨⟨ v , β ⟩ ⟩"
)
:
C_scope
.
...
...
This diff is collapsed.
Click to expand it.
tests/incrementer_client.v
+
7
−
5
View file @
2e2f1aca
...
...
@@ -8,13 +8,15 @@ Definition incr_2 : val := λ: "x",
!
"l"
.
Section
incr_2
.
Context
`{
!
heapG
Σ
,
!
spawnG
Σ
}
(
N
:
namespace
)
.
Context
`{
!
heapG
Σ
,
!
spawnG
Σ
}
.
Let
N
:=
nroot
.
@
"test"
.
(* prove that incr is safe w.r.t. data race. TODO: prove a stronger post-condition *)
Lemma
incr_2_safe
(
x
:
Z
)
:
heapN
⊥
N
→
heap_ctx
⊢
WP
incr_2
#
x
{{
_,
True
}}
.
heap_ctx
⊢
WP
incr_2
#
x
{{
_,
True
}}
.
Proof
.
iIntros
(?)
"#Hh"
.
wp_let
.
wp_alloc
l
as
"Hl"
.
iIntros
"#Hh"
.
wp_let
.
wp_alloc
l
as
"Hl"
.
iMod
(
inv_alloc
N
_
(
∃
y
:
Z
,
l
↦
#
y
)
%
I
with
"[Hl]"
)
as
"#?"
;
first
eauto
.
wp_let
.
wp_apply
(
wp_par
(
λ
_,
True
%
I
)
(
λ
_,
True
%
I
)
with
"[$Hh]"
)
.
(* prove worker triple *)
...
...
@@ -30,8 +32,8 @@ Section incr_2.
iIntros
(
v
)
"[% Hl]"
;
subst
.
iMod
"Hclose'"
.
iMod
(
"Hclose"
with
"[Hl]"
);
eauto
.
}
repeat
iSplitL
.
-
by
iApply
(
incr_atomic_spec
N
with
"Hh * Hvs"
)
.
-
by
iApply
(
incr_atomic_spec
N
with
"Hh * Hvs"
)
.
-
iApply
(
incr_atomic_spec
with
"Hh * Hvs"
)
;
auto
with
ndisj
.
-
iApply
(
incr_atomic_spec
with
"Hh * Hvs"
)
;
auto
with
ndisj
.
-
iIntros
(
v1
v2
)
"_ !>"
.
wp_seq
.
iInv
N
as
(
y
)
">Hl"
"Hclose"
.
wp_load
.
iApply
"Hclose"
;
eauto
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment