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
941beab9
Commit
941beab9
authored
1 year ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
rw_lock: add Proper instances
parent
cbec132e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iris_heap_lang/lib/rw_lock.v
+25
-1
25 additions, 1 deletion
iris_heap_lang/lib/rw_lock.v
with
25 additions
and
1 deletion
iris_heap_lang/lib/rw_lock.v
+
25
−
1
View file @
941beab9
From
iris
.
base_logic
.
lib
Require
Export
invariants
.
From
iris
.
bi
.
lib
Require
Export
fractional
.
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 reader-writer lock.
...
...
@@ -63,3 +63,27 @@ Class rwlock `{!heapGS_gen hlc Σ} := RwLock {
{{{
RET
#
();
True
}}};
}
.
Global
Hint
Mode
rwlock
+
+
+
:
typeclass_instances
.
Global
Instance
is_rw_lock_contractive
`{
!
heapGS_gen
hlc
Σ
,
!
rwlock
}
γ
lk
:
∀
n
,
Proper
(
pointwise_relation
_
(
dist_later
n
)
==>
dist
n
)
(
is_rw_lock
γ
lk
)
.
Proof
.
intros
n
Φ1
Φ2
HΦ
.
set
(
Φ1'
:=
λ
ne
(
q
:
leibnizO
Qp
),
Φ1
q
)
.
set
(
Φ2'
:=
λ
ne
(
q
:
leibnizO
Qp
),
Φ2
q
)
.
assert
(
Next
Φ1'
≡
{
n
}
≡
Next
Φ2'
)
as
HΦ'
.
{
constructor
=>
m
?
q
/=.
specialize
(
HΦ
q
)
.
by
eapply
dist_later_dist_lt
.
}
clear
HΦ
.
revert
n
HΦ'
.
eapply
(
uPred
.
internal_eq_entails
(
M
:=
iResUR
Σ
))
.
rewrite
later_equivI
.
iIntros
"#HΦ"
.
iApply
prop_ext
.
iModIntro
.
iSplit
;
iIntros
"H"
;
iApply
(
is_rw_lock_iff
with
"H"
);
iIntros
"!> !> %q"
.
all
:
rewrite
ofe_morO_equivI
;
iSpecialize
(
"HΦ"
$!
q
)
.
all
:
change
(
Φ1
q
)
with
(
Φ1'
q
);
change
(
Φ2
q
)
with
(
Φ2'
q
)
.
all
:
iRewrite
"HΦ"
;
auto
.
Qed
.
Global
Instance
is_rw_lock_proper
`{
!
heapGS_gen
hlc
Σ
,
!
rwlock
}
γ
lk
:
Proper
(
pointwise_relation
_
(
≡
)
==>
(
≡
))
(
is_rw_lock
γ
lk
)
.
Proof
.
intros
Φ1
Φ2
HΦ
.
apply
equiv_dist
=>
n
.
apply
is_rw_lock_contractive
=>
q
.
constructor
=>
m
_
.
move
:
(
HΦ
q
)
=>
/
equiv_dist
.
auto
.
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