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
2b0886b9
Commit
2b0886b9
authored
1 year ago
by
Robbert Krebbers
Committed by
Ralf Jung
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Derive `is_lock_contractive`.
parent
9c9a2f09
No related branches found
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
iris_heap_lang/lib/lock.v
+12
-4
12 additions, 4 deletions
iris_heap_lang/lib/lock.v
iris_heap_lang/lib/spin_lock.v
+1
-2
1 addition, 2 deletions
iris_heap_lang/lib/spin_lock.v
iris_heap_lang/lib/ticket_lock.v
+1
-2
1 addition, 2 deletions
iris_heap_lang/lib/ticket_lock.v
with
14 additions
and
8 deletions
iris_heap_lang/lib/lock.v
+
12
−
4
View file @
2b0886b9
From
iris
.
base_logic
.
lib
Require
Export
invariants
.
From
iris
.
heap_lang
Require
Import
pr
imitive_laws
notation
.
From
iris
.
heap_lang
Require
Import
pr
oofmode
notation
.
From
iris
.
prelude
Require
Import
options
.
(** A general interface for a lock.
...
...
@@ -28,7 +28,6 @@ Class lock `{!heapGS_gen hlc Σ} := Lock {
is_lock
(
γ
:
lock_name
)
(
lock
:
val
)
(
R
:
iProp
Σ
)
:
iProp
Σ
;
locked
(
γ
:
lock_name
)
:
iProp
Σ
;
(** * General properties of the predicates *)
is_lock_ne
γ
lk
:>
Contractive
(
is_lock
γ
lk
);
is_lock_persistent
γ
lk
R
:>
Persistent
(
is_lock
γ
lk
R
);
is_lock_iff
γ
lk
R1
R2
:
is_lock
γ
lk
R1
-∗
▷
□
(
R1
↔
R2
)
-∗
is_lock
γ
lk
R2
;
...
...
@@ -44,5 +43,14 @@ Class lock `{!heapGS_gen hlc Σ} := Lock {
}
.
Global
Hint
Mode
lock
+
+
+
:
typeclass_instances
.
Global
Instance
is_lock_proper
hlc
Σ
`{
!
heapGS_gen
hlc
Σ
}
(
L
:
lock
)
γ
lk
:
Proper
((
≡
)
==>
(
≡
))
(
L
.(
is_lock
)
γ
lk
)
:=
ne_proper
_
.
Global
Instance
is_lock_contractive
`{
!
heapGS_gen
hlc
Σ
,
!
lock
}
γ
lk
:
Contractive
(
is_lock
γ
lk
)
.
Proof
.
apply
(
uPred
.
contractive_internal_eq
(
M
:=
iResUR
Σ
))
.
iIntros
(
P
Q
)
"#HPQ"
.
iApply
prop_ext
.
iIntros
"!>"
.
iSplit
;
iIntros
"H"
;
iApply
(
is_lock_iff
with
"H"
);
iNext
;
iRewrite
"HPQ"
;
auto
.
Qed
.
Global
Instance
is_lock_proper
`{
!
heapGS_gen
hlc
Σ
,
!
lock
}
γ
lk
:
Proper
((
≡
)
==>
(
≡
))
(
is_lock
γ
lk
)
:=
ne_proper
_
.
This diff is collapsed.
Click to expand it.
iris_heap_lang/lib/spin_lock.v
+
1
−
2
View file @
2b0886b9
...
...
@@ -92,8 +92,7 @@ Section proof.
Qed
.
End
proof
.
Program
Definition
spin_lock
`{
!
heapGS_gen
hlc
Σ
,
!
lockG
Σ
}
:
lock
:=
Definition
spin_lock
`{
!
heapGS_gen
hlc
Σ
,
!
lockG
Σ
}
:
lock
:=
{|
lock
.
locked_exclusive
:=
locked_exclusive
;
lock
.
is_lock_iff
:=
is_lock_iff
;
lock
.
newlock_spec
:=
newlock_spec
;
lock
.
acquire_spec
:=
acquire_spec
;
lock
.
release_spec
:=
release_spec
|}
.
Next
Obligation
.
intros
.
rewrite
/
is_lock
/
lock_inv
.
solve_contractive
.
Qed
.
This diff is collapsed.
Click to expand it.
iris_heap_lang/lib/ticket_lock.v
+
1
−
2
View file @
2b0886b9
...
...
@@ -163,8 +163,7 @@ Section proof.
Qed
.
End
proof
.
Program
Definition
ticket_lock
`{
!
heapGS_gen
hlc
Σ
,
!
tlockG
Σ
}
:
lock
:=
Definition
ticket_lock
`{
!
heapGS_gen
hlc
Σ
,
!
tlockG
Σ
}
:
lock
:=
{|
lock
.
locked_exclusive
:=
locked_exclusive
;
lock
.
is_lock_iff
:=
is_lock_iff
;
lock
.
newlock_spec
:=
newlock_spec
;
lock
.
acquire_spec
:=
acquire_spec
;
lock
.
release_spec
:=
release_spec
|}
.
Next
Obligation
.
intros
.
rewrite
/
is_lock
/
lock_inv
.
solve_contractive
.
Qed
.
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