Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
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
Gaëtan Gilbert
Iris
Commits
bc0339ec
Commit
bc0339ec
authored
1 year ago
by
Robbert Krebbers
Committed by
Ralf Jung
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Test that lock `Σ`s can be found in adequacy.
parent
af0a091b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/heap_lang.ref
+0
-15
0 additions, 15 deletions
tests/heap_lang.ref
tests/heap_lang.v
+58
-37
58 additions, 37 deletions
tests/heap_lang.v
with
58 additions
and
52 deletions
tests/heap_lang.ref
+
0
−
15
View file @
bc0339ec
...
@@ -304,18 +304,3 @@ goal 2 is:
...
@@ -304,18 +304,3 @@ goal 2 is:
The command has indeed failed with message:
The command has indeed failed with message:
Tactic failure: wp_cmpxchg_suc: cannot find 'CmpXchg' in
Tactic failure: wp_cmpxchg_suc: cannot find 'CmpXchg' in
(#() #()).
(#() #()).
"wp_spin_lock_client"
: string
1 goal
Σ : gFunctors
heapGS0 : heapGS Σ
spin_lockG0 : spin_lockG Σ
loc : locations.loc
lock : val
γ : lock_name
============================
"Hislock" : is_lock γ lock (∃ v : val, loc ↦ v)
--------------------------------------□
WP let: "lock" := lock in acquire "lock";; #loc <- #42;; release "lock"
{{ _, True }}
This diff is collapsed.
Click to expand it.
tests/heap_lang.v
+
58
−
37
View file @
bc0339ec
...
@@ -514,52 +514,73 @@ Proof.
...
@@ -514,52 +514,73 @@ Proof.
wp_alloc
l
.
wp_load
.
wp_store
.
wp_load
.
auto
.
wp_alloc
l
.
wp_load
.
wp_store
.
wp_load
.
auto
.
Qed
.
Qed
.
(** Just making sure the lock typeclass actually works. *)
(** Make sure the lock type class works to write generic clients and
Section
lock
.
specifications. *)
Section
lock_gen
.
Context
`{
!
lock
}
.
Context
`{
!
lock
}
.
Definition
lock_client
:
val
:=
Definition
lock_client_gen
:
expr
:=
λ
:
"loc"
"lock"
,
let
:
"l"
:=
ref
#
10
in
acquire
"lock"
;;
let
:
"lock"
:=
newlock
#
()
in
"loc"
<-
#
42
;;
acquire
"lock"
;;
release
"lock"
.
"l"
<-
#
42
;;
release
"lock"
.
Context
`{
!
heapGS
Σ
,
!
lockG
Σ
}
.
Lemma
wp_lock_client_gen
`{
!
heapGS
Σ
,
!
lockG
Σ
}
:
⊢
WP
lock_client_gen
{{
_,
True
}}
.
Lemma
wp_lock_client
loc
lock
γ
:
is_lock
γ
lock
(
∃
v
,
loc
↦
v
)
-∗
WP
lock_client
#
loc
lock
{{
_,
True
}}
.
Proof
.
Proof
.
iIntros
"#Hislock"
.
unfold
lock_client_gen
.
wp_alloc
l
as
"Hl"
.
wp_lam
.
wp_smart_apply
(
acquire_spec
with
"Hislock"
)
as
"[Hlocked [%v Hloc]]"
.
wp_smart_apply
(
newlock_spec
(
∃
n
:
Z
,
l
↦
#
n
)
with
"[Hl]"
)
as
(
lk
γ
)
"#Hlock"
;
first
by
eauto
.
wp_smart_apply
(
acquire_spec
with
"Hlock"
)
as
"(Hlocked & %v & Hloc)"
.
wp_store
.
wp_store
.
wp_smart_apply
(
release_spec
with
"[$Hlocked Hloc]"
)
.
wp_smart_apply
(
release_spec
with
"[$Hlock $Hlocked Hloc]"
);
by
eauto
.
{
iFrame
"Hislock"
.
eauto
.
}
eauto
.
Qed
.
Qed
.
End
lock
.
End
lock_gen
.
Section
spin_lock
.
Local
Existing
Instance
spin_lock
.
Definition
spin_lock_client
:
val
:=
(** Make sure the lock type class works to write clients and
λ
:
"loc"
"lock"
,
specifications for specific locks (here: spin lock). *)
acquire
"lock"
;;
Section
lock_gen
.
"loc"
<-
#
42
;;
Local
Existing
Instance
spin_lock
.
release
"lock"
.
(* Making sure that using [spin_lockG] here works, not just [lockG]. *)
Definition
lock_client_spin
:
expr
:=
Context
`{
!
heapGS
Σ
,
!
spin_lockG
Σ
}
.
let
:
"l"
:=
ref
#
10
in
let
:
"lock"
:=
newlock
#
()
in
acquire
"lock"
;;
"l"
<-
#
42
;;
release
"lock"
.
Check
"wp_spin_lock_client"
.
Lemma
wp_lock_client_spin
`{
!
heapGS
Σ
,
!
lockG
Σ
}
:
Lemma
wp_spin_lock_client
loc
lock
γ
:
⊢
WP
lock_client_spin
{{
_,
True
}}
.
is_lock
γ
lock
(
∃
v
,
loc
↦
v
)
-∗
WP
spin_lock_client
#
loc
lock
{{
_,
True
}}
.
Proof
.
Proof
.
iIntros
"#Hislock"
.
wp_lam
.
simpl
.
Show
.
unfold
lock_client_spin
.
wp_alloc
l
as
"Hl"
.
wp_smart_apply
(
acquire_spec
with
"Hislock"
)
as
"[Hlocked [%v Hloc]]"
.
wp_smart_apply
(
newlock_spec
(
∃
n
:
Z
,
l
↦
#
n
)
with
"[Hl]"
)
as
(
lk
γ
)
"#Hlock"
;
first
by
eauto
.
wp_smart_apply
(
acquire_spec
with
"Hlock"
)
as
"(Hlocked & %v & Hloc)"
.
wp_store
.
wp_store
.
wp_smart_apply
(
release_spec
with
"[$Hlocked Hloc]"
)
.
wp_smart_apply
(
release_spec
with
"[$Hlock $Hlocked Hloc]"
);
by
eauto
.
{
iFrame
"Hislock"
.
eauto
.
}
Qed
.
eauto
.
End
lock_gen
.
(** Making sure we the [lockG] conditions are resolved when using adequacy. For
the generic client, we need to instantiate it with a specific lock for that to
make sense. *)
Section
lock_adequacy
.
Local
Existing
Instance
spin_lock
.
Lemma
lock_client_gen_adequate
σ
:
adequate
NotStuck
lock_client_gen
σ
(
λ
_
_,
True
)
.
Proof
.
set
(
Σ
:=
#
[
heapΣ
;
spin_lockΣ
])
.
apply
(
heap_adequacy
Σ
);
iIntros
(?)
"_"
.
iApply
wp_lock_client_gen
.
Qed
.
Lemma
lock_client_spin_adequate
σ
:
adequate
NotStuck
lock_client_spin
σ
(
λ
_
_,
True
)
.
Proof
.
set
(
Σ
:=
#
[
heapΣ
;
spin_lockΣ
])
.
apply
(
heap_adequacy
Σ
);
iIntros
(?)
"_"
.
iApply
wp_lock_client_gen
.
Qed
.
Qed
.
End
spin_lock
.
End
lock_adequacy
.
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