Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambda-rust
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
Model registry
Operate
Environments
Monitor
Service Desk
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
Iris
lambda-rust
Commits
533a4ee3
There was a problem fetching the pipeline summary.
Commit
533a4ee3
authored
7 years ago
by
Hai Dang
Browse files
Options
Downloads
Patches
Plain Diff
WIP: rwlock code read lock acquire
parent
f6252a2b
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
opam
+1
-1
1 addition, 1 deletion
opam
theories/lang/lock.v
+5
-5
5 additions, 5 deletions
theories/lang/lock.v
theories/typing/lib/rwlock/rwlock_code.v
+27
-16
27 additions, 16 deletions
theories/typing/lib/rwlock/rwlock_code.v
with
33 additions
and
22 deletions
opam
+
1
−
1
View file @
533a4ee3
...
@@ -10,5 +10,5 @@ build: [make "-j%{jobs}%"]
...
@@ -10,5 +10,5 @@ build: [make "-j%{jobs}%"]
install: [make "install"]
install: [make "install"]
remove: [ "sh" "-c" "rm -rf '%{lib}%/coq/user-contrib/lrust'" ]
remove: [ "sh" "-c" "rm -rf '%{lib}%/coq/user-contrib/lrust'" ]
depends: [
depends: [
"coq-gpfsl" { (= "dev.2018-06-0
3.1.8d7b20
4c") | (= "dev") }
"coq-gpfsl" { (= "dev.2018-06-0
4.0.f12ff2
4c") | (= "dev") }
]
]
This diff is collapsed.
Click to expand it.
theories/lang/lock.v
+
5
−
5
View file @
533a4ee3
...
@@ -136,17 +136,17 @@ Section proof.
...
@@ -136,17 +136,17 @@ Section proof.
iIntros
(??)
"#Hproto !# * HP HΦ"
.
iIntros
(??)
"#Hproto !# * HP HΦ"
.
wp_rec
.
iMod
(
"Hproto"
with
"HP"
)
as
(
γ
R0
Vb
)
"(#[Eq lc] & inv & Hclose)"
.
wp_rec
.
iMod
(
"Hproto"
with
"HP"
)
as
(
γ
R0
Vb
)
"(#[Eq lc] & inv & Hclose)"
.
iDestruct
"lc"
as
(?)
"lc"
.
iDestruct
"lc"
as
(?)
"lc"
.
iMod
(
rel_True_intro
True
%
I
tid
with
"[//]"
)
as
"rTrue"
.
iMod
(
rel_True_intro
True
%
I
tid
with
"[//]"
)
as
"
#
rTrue"
.
iApply
(
GPS_PPRaw_CAS_int_simple
(
lock_interp
R0
)
_
_
_
_
_
iApply
(
GPS_PPRaw_CAS_int_simple
(
lock_interp
R0
)
_
_
_
_
_
(
Z_of_bool
false
)
#
true
()
(
λ
_,
R0
)
%
I
(
λ
_
_,
True
)
%
I
(
Z_of_bool
false
)
#
true
()
True
%
I
(
λ
_,
R0
)
%
I
(
λ
_
_,
True
)
%
I
with
"[$lc $inv
rTrue
]"
);[
done
|
by
left
|
done
|
by
right
|
by
left
|..]
.
with
"[$lc $inv]"
);[
done
|
by
left
|
done
|
by
right
|
by
left
|..]
.
{
iSplitL
""
;
[|
iSplitL
""
];
[
iNext
;
iModIntro
..|]
.
{
iSplitL
""
;
[|
iSplitL
""
];
[
iNext
;
iModIntro
..|]
.
-
iIntros
(??
_)
.
by
iApply
lock_interp_comparable
.
-
iIntros
(??
_)
.
by
iApply
lock_interp_comparable
.
-
by
iIntros
(??)
"_ #$"
.
-
by
iIntros
(??)
"_ #$"
.
-
iNext
.
rewrite
/=
-
(
bi
.
True_sep'
(
∀
_,
_)
%
I
)
.
-
iFrame
"rTrue"
.
iNext
.
rewrite
/=
-
(
bi
.
True_sep'
(
∀
_,
_)
%
I
)
.
iApply
(
rel_sep_objectively
with
"[$rTrue]"
)
.
iApply
(
rel_sep_objectively
with
"[$rTrue]"
)
.
iModIntro
.
iIntros
([]
_)
.
iSplit
;
[|
by
iIntros
(?)
"??"
]
.
iModIntro
.
iIntros
([]
_)
.
iSplit
;
[|
by
iIntros
(?)
"??"
]
.
iIntros
"F _"
.
iModIntro
.
rewrite
/
lock_interp
/=.
iIntros
"
_
F _"
.
iModIntro
.
rewrite
/
lock_interp
/=.
iExists
()
.
iSplitL
""
;
[
done
|]
.
iDestruct
"F"
as
(
b
)
"[Eq R0]"
.
iExists
()
.
iSplitL
""
;
[
done
|]
.
iDestruct
"F"
as
(
b
)
"[Eq R0]"
.
iDestruct
"Eq"
as
%
Eq
.
destruct
b
;
[
by
inversion
Eq
|]
.
iDestruct
"Eq"
as
%
Eq
.
destruct
b
;
[
by
inversion
Eq
|]
.
iFrame
"R0"
.
iSplit
;
by
iExists
true
.
}
iFrame
"R0"
.
iSplit
;
by
iExists
true
.
}
...
...
This diff is collapsed.
Click to expand it.
theories/typing/lib/rwlock/rwlock_code.v
+
27
−
16
View file @
533a4ee3
...
@@ -193,27 +193,32 @@ Section rwlock_functions.
...
@@ -193,27 +193,32 @@ Section rwlock_functions.
-
wp_op
.
wp_bind
(
CAS
_
_
_
_
_
_)
.
-
wp_op
.
wp_bind
(
CAS
_
_
_
_
_
_)
.
iMod
(
at_bor_acc
with
"LFT Hinv Hβtok1"
)
as
(
Vb'
)
"[INV Hclose'']"
;
[
done
..|]
.
iMod
(
at_bor_acc
with
"LFT Hinv Hβtok1"
)
as
(
Vb'
)
"[INV Hclose'']"
;
[
done
..|]
.
iDestruct
(
rwlock_proto_inv_split
with
"INV"
)
as
"[mst INV]"
.
iDestruct
(
rwlock_proto_inv_split
with
"INV"
)
as
"[mst INV]"
.
iDestruct
"mst"
as
(
st3
)
">mst"
.
iDestruct
(
bi
.
later_exist_2
with
"mst"
)
as
">mst"
.
set
Q
:
()
→
vProp
Σ
:=
set
Q
:
()
→
vProp
Σ
:=
(
λ
_,
(
∃
st
,
▷
rwown
γs
(
main_st
st
))
∗
(
λ
_,
(
∃
st
,
rwown
γs
(
main_st
st
))
∗
(
qβ
/
2
).[
β
]
∗
(
qβ
/
2
).[
β
]
∗
(
∃
qν
ν
,
(
qν
).[
ν
]
∗
(
∃
qν
ν
,
(
qν
).[
ν
]
∗
tyS
(
β
⊓
ν
)
∗
tyS
(
β
⊓
ν
)
∗
rwown
γs
(
reading_st
qν
ν
)
∗
rwown
γs
(
reading_st
qν
ν
)
∗
((
1
).[
ν
]
=
{
↑
lftN
∪
↑
histN
,
↑
histN
}
▷=∗
[
†
ν
])))
%
I
.
((
1
).[
ν
]
=
{
↑
lftN
∪
↑
histN
,
↑
histN
}
▷=∗
[
†
ν
])))
%
I
.
set
R
:
()
→
lit
→
vProp
Σ
:=
set
R
:
()
→
lit
→
vProp
Σ
:=
(
λ
_
_,
True
)
%
I
.
(
λ
_
_,
(
∃
st
,
▷
rwown
γs
(
main_st
st
))
∗
(
qβ
/
2
).[
β
])
%
I
.
set
P
:
vProp
Σ
:=
(
(
∃
st
,
rwown
γs
(
main_st
st
))
∗
<
obj
>
(
qβ
/
2
).[
β
])
%
I
.
iMod
(
rel_True_intro
True
%
I
tid
with
"[//]"
)
as
"rTrue"
.
iMod
(
rel_True_intro
True
%
I
tid
with
"[//]"
)
as
"
#
rTrue"
.
iApply
(
GPS_PPRaw_CAS_int_simple
(
rwlock_interp
γs
β
tyO
tyS
)
_
_
_
_
_
iApply
(
GPS_PPRaw_CAS_int_simple
(
rwlock_interp
γs
β
tyO
tyS
)
_
_
_
_
_
(
Z_of_rwlock_st
st2
)
#
(
Z_of_rwlock_st
st2
+
1
)
()
Q
R
_
_
Vb'
(
Z_of_rwlock_st
st2
)
#
(
Z_of_rwlock_st
st2
+
1
)
()
P
Q
R
_
_
Vb'
with
"[$PP $INV mst Hβtok2 rTrue]"
);
with
"[$PP $INV mst Hβtok2 rTrue]"
);
[
solve_ndisj
|
by
left
|
done
|
by
right
|
by
left
|
iSplitL
""
;
last
iSplitL
""
|..]
.
[
solve_ndisj
|
by
left
|
done
|
by
right
|
by
left
|
iSplitL
""
;
last
iSplitL
""
|..]
.
{
iIntros
"!> !>"
(???)
.
by
iApply
rwlock_interp_comparable
.
}
{
iIntros
"!> !>"
(???)
.
by
iApply
rwlock_interp_comparable
.
}
{
iIntros
"!> !>"
(???)
.
by
iApply
rwlock_interp_duplicable
.
}
{
iIntros
"!> !>"
(???)
.
by
iApply
rwlock_interp_duplicable
.
}
{
simpl
.
iNext
.
rewrite
/=
-
(
bi
.
True_sep'
(
∀
_
:
(),
_)
%
I
)
.
{
simpl
.
iSplitL
""
;
last
first
.
iApply
(
rel_sep_objectively
with
"[$rTrue mst Hβtok2]"
)
.
{
rewrite
-
(
bi
.
True_sep'
P
)
.
iModIntro
.
iDestruct
(
monPred_objectively_elim
with
"Hβtok2"
)
as
"Hβtok2"
.
iApply
(
rel_sep_objectively
with
"[$rTrue mst Hβtok2]"
)
.
iIntros
([]
_)
.
iSplit
;
[|
iIntros
(?)
"_ _"
;
iFrame
"Hβtok2"
;
by
iExists
_]
.
iModIntro
.
by
iFrame
.
}
iNext
.
rewrite
-
(
bi
.
True_sep'
(
∀
_
:
(),
_)
%
I
)
.
iApply
(
rel_sep_objectively
with
"[$rTrue]"
)
.
iModIntro
.
iIntros
([]
_)
.
iSplit
;
[|
by
iIntros
(?)
"_ _"
]
.
iIntros
"[mst Hβtok2]"
.
iDestruct
"mst"
as
(
st3
)
"mst"
.
iDestruct
(
monPred_objectively_elim
with
"Hβtok2"
)
as
"Hβtok2"
.
iDestruct
1
as
(
st2'
)
"[Eqst INT]"
.
iDestruct
"Eqst"
as
%
Eqst
.
iDestruct
1
as
(
st2'
)
"[Eqst INT]"
.
iDestruct
"Eqst"
as
%
Eqst
.
destruct
st2'
as
[[[]|[[
ν
q
]
n
]]|]
.
destruct
st2'
as
[[[]|[[
ν
q
]
n
]]|]
.
-
exfalso
.
clear
-
Eqst
Hm1
.
simpl
in
Eqst
.
inversion
Eqst
as
[
Eq1
]
.
-
exfalso
.
clear
-
Eqst
Hm1
.
simpl
in
Eqst
.
inversion
Eqst
as
[
Eq1
]
.
...
@@ -241,7 +246,8 @@ Section rwlock_functions.
...
@@ -241,7 +246,8 @@ Section rwlock_functions.
set
st'
:
rwlock_st
:=
Some
(
inr
(
ν
,
(
1
/
2
)
%
Qp
,
1
%
positive
))
.
set
st'
:
rwlock_st
:=
Some
(
inr
(
ν
,
(
1
/
2
)
%
Qp
,
1
%
positive
))
.
iMod
(
rwown_update_write_read
ν
γs
with
"mst sst"
)
as
"(mst'&sst'& rst)"
.
iMod
(
rwown_update_write_read
ν
γs
with
"mst sst"
)
as
"(mst'&sst'& rst)"
.
iDestruct
(
lft_intersect_acc
with
"Hβtok2 Htok2"
)
as
(
q
)
"[Htok Hclose]"
.
iDestruct
(
lft_intersect_acc
with
"Hβtok2 Htok2"
)
as
(
q
)
"[Htok Hclose]"
.
iApply
(
fupd_mask_mono
(
↑
lftN
∪
↑
histN
))
.
apply
union_subseteq
;
split
;
solve_ndisj
.
iApply
(
fupd_mask_mono
(
↑
lftN
∪
↑
histN
))
.
apply
union_subseteq
;
split
;
solve_ndisj
.
iMod
(
rebor
_
_
(
β
⊓
ν
)
with
"LFT [] Hst"
)
as
"[Hst Hh]"
;
iMod
(
rebor
_
_
(
β
⊓
ν
)
with
"LFT [] Hst"
)
as
"[Hst Hh]"
;
[
apply
union_subseteq_l
|
iApply
lft_intersect_incl_l
|]
.
[
apply
union_subseteq_l
|
iApply
lft_intersect_incl_l
|]
.
iMod
(
"Share"
with
"[%] Hst Htok"
)
as
"[#Hshr Htok]"
.
apply
union_subseteq_l
.
iMod
(
"Share"
with
"[%] Hst Htok"
)
as
"[#Hshr Htok]"
.
apply
union_subseteq_l
.
...
@@ -257,7 +263,7 @@ Section rwlock_functions.
...
@@ -257,7 +263,7 @@ Section rwlock_functions.
iNext
.
simpl
.
iNext
.
simpl
.
iIntros
(
b
v'
[])
iIntros
(
b
v'
[])
"(INV & _ &[([%%] & _ & mst & Hβtok2 & Hβ) | ([% Neq] &
PP' & R
)])"
.
"(INV & _ &[([%%] & _ & mst & Hβtok2 & Hβ) | ([% Neq] &
_ & _ & P
)])"
.
+
subst
b
v'
.
iDestruct
"Hβ"
as
(
q'
ν
)
"(Hν & Hshr & Hreading & H†)"
.
+
subst
b
v'
.
iDestruct
"Hβ"
as
(
q'
ν
)
"(Hν & Hshr & Hreading & H†)"
.
iMod
(
"Hclose''"
with
"[mst INV]"
)
as
"Hβtok1"
.
iMod
(
"Hclose''"
with
"[mst INV]"
)
as
"Hβtok1"
.
{
iIntros
"Vb'"
.
iSpecialize
(
"INV"
with
"Vb'"
)
.
iFrame
"INV"
.
{
iIntros
"Vb'"
.
iSpecialize
(
"INV"
with
"Vb'"
)
.
iFrame
"INV"
.
...
@@ -279,15 +285,20 @@ Section rwlock_functions.
...
@@ -279,15 +285,20 @@ Section rwlock_functions.
iApply
(
type_sum_assign
(
option
$
rwlockreadguard
α
ty
));
[
solve_typing
..|]
.
iApply
(
type_sum_assign
(
option
$
rwlockreadguard
α
ty
));
[
solve_typing
..|]
.
simpl
.
iApply
type_jump
;
solve_typing
.
simpl
.
iApply
type_jump
;
solve_typing
.
+
subst
b
.
+
subst
b
.
iDestruct
(
acq_sep_elim
with
"R"
)
as
"[mst Hβtok2]"
.
iDestruct
(
rel_sep_elim
with
"P"
)
as
"[mst Hβtok2]"
.
iDestruct
(
acq_embed_elim
with
"Hβtok2"
)
as
"Hβtok2"
.
iDestruct
(
rel_exist
with
"mst"
)
as
(
st'
)
"mst"
.
iMod
(
"Hclose''"
with
"[Hlx Hownst Hst]"
)
as
"Hβtok1"
;
first
by
iExists
_;
iFrame
.
iDestruct
(
rel_embed_elim
with
"mst"
)
as
"mst"
.
iDestruct
(
rel_objectively_elim
with
"Hβtok2"
)
as
"Hβtok2"
.
iDestruct
(
monPred_objectively_elim
with
"Hβtok2"
)
as
"Hβtok2"
.
iMod
(
"Hclose''"
with
"[INV mst]"
)
as
"Hβtok1"
.
{
iIntros
"Vb'"
.
iDestruct
(
"INV"
with
"Vb'"
)
as
"$"
.
by
iExists
_
.
}
iModIntro
.
wp_case
.
iMod
(
"Hclose'"
with
"[$]"
)
as
"Hα"
.
iModIntro
.
wp_case
.
iMod
(
"Hclose'"
with
"[$]"
)
as
"Hα"
.
iMod
(
"Hclose"
with
"Hα HL"
)
as
"HL"
.
iMod
(
"Hclose"
with
"Hα HL"
)
as
"HL"
.
iSpecialize
(
"Hk"
with
"[]"
);
first
solve_typing
.
iSpecialize
(
"Hk"
with
"[]"
);
first
solve_typing
.
iApply
(
"Hk"
$!
[
#
]
with
"Hna HL"
)
.
iApply
(
"Hk"
$!
[
#
]
with
"Hna HL"
)
.
rewrite
2
!
tctx_interp_cons
tctx_interp_singleton
!
tctx_hasty_val
.
iFrame
.
rewrite
2
!
tctx_interp_cons
tctx_interp_singleton
!
tctx_hasty_val
.
iFrame
.
iExists
_
.
iSplit
.
done
.
simpl
.
eauto
.
iExists
_
.
iSplit
.
done
.
iExists
_
.
iFrame
"Hαβ"
.
iExists
_,_,_,_
.
iFrame
"EqO EqS Hinv"
.
by
iExists
_
.
Qed
.
Qed
.
(* Acquiring a write lock. *)
(* Acquiring a write lock. *)
...
...
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