Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris
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
Tej Chajed
iris
Commits
75c9df64
Commit
75c9df64
authored
2 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
make tada_lock_state exclusive
parent
c9169b9d
No related branches found
Branches containing commit
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/logatom_lock.v
+28
-8
28 additions, 8 deletions
iris_heap_lang/lib/logatom_lock.v
with
28 additions
and
8 deletions
iris_heap_lang/lib/logatom_lock.v
+
28
−
8
View file @
75c9df64
...
...
@@ -32,13 +32,26 @@ Section tada.
}
.
Definition
tada_lock_state
(
γ
:
tada_lock_name
)
(
s
:
state
)
:
iProp
Σ
:=
ghost_var
γ
.(
tada_lock_name_state
)
(
1
/
2
)
s
∗
ghost_var
γ
.(
tada_lock_name_state
)
(
3
/
4
)
s
∗
if
s
is
Locked
then
l
.(
locked
)
γ
.(
tada_lock_name_lock
)
∗
ghost_var
γ
.(
tada_lock_name_state
)
(
1
/
2
)
Locked
l
.(
locked
)
γ
.(
tada_lock_name_lock
)
∗
ghost_var
γ
.(
tada_lock_name_state
)
(
1
/
4
)
Locked
else
True
.
Definition
tada_is_lock
(
γ
:
tada_lock_name
)
(
lk
:
val
)
:
iProp
Σ
:=
l
.(
is_lock
)
γ
.(
tada_lock_name_lock
)
lk
(
ghost_var
γ
.(
tada_lock_name_state
)
(
1
/
2
)
Free
)
.
(
ghost_var
γ
.(
tada_lock_name_state
)
(
1
/
4
)
Free
)
.
Global
Instance
tada_is_lock_persistent
γ
lk
:
Persistent
(
tada_is_lock
γ
lk
)
.
Proof
.
apply
_
.
Qed
.
Global
Instance
tada_lock_state_timeless
γ
s
:
Timeless
(
tada_lock_state
γ
s
)
.
Proof
.
destruct
s
;
apply
_
.
Qed
.
Lemma
tada_lock_state_exclusive
γ
s1
s2
:
tada_lock_state
γ
s1
-∗
tada_lock_state
γ
s2
-∗
False
.
Proof
.
iIntros
"[Hvar1 _] [Hvar2 _]"
.
iDestruct
(
ghost_var_valid_2
with
"Hvar1 Hvar2"
)
as
%
[
Hval
_]
.
exfalso
.
done
.
Qed
.
Lemma
newlock_tada_spec
:
{{{
True
}}}
...
...
@@ -46,7 +59,10 @@ Section tada.
{{{
lk
γ
,
RET
lk
;
tada_is_lock
γ
lk
∗
tada_lock_state
γ
Free
}}}
.
Proof
.
iIntros
(
Φ
)
"_ HΦ"
.
iMod
(
ghost_var_alloc
Free
)
as
(
γvar
)
"[Hvar1 Hvar2]"
.
iMod
(
ghost_var_alloc
Free
)
as
(
γvar
)
"Hvar"
.
replace
1
%
Qp
with
(
3
/
4
+
1
/
4
)
%
Qp
;
last
first
.
{
rewrite
Qp_three_quarter_quarter
//.
}
iDestruct
"Hvar"
as
"[Hvar1 Hvar2]"
.
wp_apply
(
l
.(
newlock_spec
)
with
"Hvar2"
)
.
iIntros
(
lk
γlock
)
"Hlock"
.
iApply
(
"HΦ"
$!
lk
(
TadaLockName
_
_))
.
...
...
@@ -64,7 +80,8 @@ Section tada.
iIntros
"[Hlocked Hvar1]"
.
iMod
"AU"
as
(
s
)
"[[Hvar2 _] [_ Hclose]]"
.
iDestruct
(
ghost_var_agree
with
"Hvar1 Hvar2"
)
as
%<-.
iMod
(
ghost_var_update_halves
Locked
with
"Hvar1 Hvar2"
)
as
"[Hvar1 Hvar2]"
.
iMod
(
ghost_var_update_2
Locked
with
"Hvar1 Hvar2"
)
as
"[Hvar1 Hvar2]"
.
{
rewrite
Qp_quarter_three_quarter
//.
}
iMod
(
"Hclose"
with
"[$Hvar2 $Hlocked $Hvar1]"
)
.
done
.
Qed
.
...
...
@@ -76,10 +93,13 @@ Section tada.
Proof
.
iIntros
"#Hislock %Φ AU"
.
iApply
fupd_wp
.
iMod
"AU"
as
"[[Hvar1 [Hlocked Hvar2]] [_ Hclose]]"
.
iMod
(
ghost_var_update_halves
Free
with
"Hvar1 Hvar2"
)
as
"[Hvar1 Hvar2]"
.
iMod
(
"Hclose"
with
"[$Hvar2]"
)
.
iModIntro
.
wp_apply
(
l
.(
release_spec
)
with
"[$Hislock $Hlocked $Hvar1]"
)
.
iMod
(
ghost_var_update_2
Free
with
"Hvar1 Hvar2"
)
as
"[Hvar1 Hvar2]"
.
{
rewrite
Qp_three_quarter_quarter
//.
}
iMod
(
"Hclose"
with
"[$Hvar1]"
)
.
iModIntro
.
wp_apply
(
l
.(
release_spec
)
with
"[$Hislock $Hlocked $Hvar2]"
)
.
auto
.
Qed
.
End
tada
.
Typeclasses
Opaque
tada_is_lock
tada_lock_state
.
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