Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
examples
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
Iris
examples
Commits
f09b7c99
Commit
f09b7c99
authored
8 years ago
by
Zhen Zhang
Browse files
Options
Downloads
Patches
Plain Diff
better atomic_triple'; add atomic_pair to build
parent
099eb48a
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
_CoqProject
+2
-0
2 additions, 0 deletions
_CoqProject
atomic_pair.v
+3
-2
3 additions, 2 deletions
atomic_pair.v
sync.v
+15
-10
15 additions, 10 deletions
sync.v
with
20 additions
and
12 deletions
_CoqProject
+
2
−
0
View file @
f09b7c99
...
@@ -7,3 +7,5 @@ sync_stack.v
...
@@ -7,3 +7,5 @@ sync_stack.v
treiber_stack.v
treiber_stack.v
protocol.v
protocol.v
misc.v
misc.v
atomic_pair.v
This diff is collapsed.
Click to expand it.
atomic_pair.v
+
3
−
2
View file @
f09b7c99
...
@@ -41,7 +41,7 @@ Section atomic_pair.
...
@@ -41,7 +41,7 @@ Section atomic_pair.
rewrite
/
seq_spec
.
rewrite
/
seq_spec
.
intros
Φ
l
.
intros
Φ
l
.
iIntros
"!# _"
.
wp_seq
.
iVsIntro
.
iPureIntro
.
clear
Φ
.
iIntros
"!# _"
.
wp_seq
.
iVsIntro
.
iPureIntro
.
clear
Φ
.
iIntros
(
x
Φ
g
HN
)
"(#Hh & Hg & Hα & HΦ)"
.
iIntros
(
x
Φ
g
HN
)
"(#Hh & Hg &
#
Hα & HΦ)"
.
rewrite
/
ϕ
/
α
.
rewrite
/
ϕ
/
α
.
iDestruct
"Hg"
as
(
l1
l2
x1
x2
)
"(% & % & Hl1 & Hl2)"
.
iDestruct
"Hg"
as
(
l1
l2
x1
x2
)
"(% & % & Hl1 & Hl2)"
.
iDestruct
"Hα"
as
(
a
b
)
"%"
.
iDestruct
"Hα"
as
(
a
b
)
"%"
.
...
@@ -82,7 +82,8 @@ Section atomic_pair.
...
@@ -82,7 +82,8 @@ Section atomic_pair.
wp_seq
.
wp_seq
.
wp_alloc
l1
as
"Hl1"
.
wp_alloc
l1
as
"Hl1"
.
wp_alloc
l2
as
"Hl2"
.
wp_alloc
l2
as
"Hl2"
.
iVs
(
own_alloc
(
gFullR
(
#
0
,
#
0
)
⋅
gFragR
(
#
0
,
#
0
)))
as
(
γ
)
"[HgFull HgFrag]"
;
first
by
done
.
iVs
(
own_alloc
(
gFullR
(
#
0
,
#
0
)
⋅
gFragR
(
#
0
,
#
0
)))
as
(
γ
)
"[HgFull HgFrag]"
.
{
rewrite
/
gFragR
/
gFullR
.
split
;
first
by
simpl
.
simpl
.
by
rewrite
dec_agree_idemp
.
}
rewrite
/
ϕ
.
rewrite
/
ϕ
.
iSpecialize
(
"HΦ"
$!
(
#
l1
,
#
l2
)
%
V
γ
)
.
iSpecialize
(
"HΦ"
$!
(
#
l1
,
#
l2
)
%
V
γ
)
.
rewrite
/
gFull
/
gFrag
.
rewrite
/
gFull
/
gFrag
.
...
...
This diff is collapsed.
Click to expand it.
sync.v
+
15
−
10
View file @
f09b7c99
...
@@ -117,7 +117,8 @@ Section generic.
...
@@ -117,7 +117,8 @@ Section generic.
(
β
:
val
→
A
→
A
→
val
→
iProp
Σ
)
(
β
:
val
→
A
→
A
→
val
→
iProp
Σ
)
(
Ei
Eo
:
coPset
)
(
Ei
Eo
:
coPset
)
(
f
x
:
val
)
γ
:
iProp
Σ
:=
(
f
x
:
val
)
γ
:
iProp
Σ
:=
(
∀
P
Q
,
(
∀
g
,
(
P
=
{
Eo
,
Ei
}=>
gFrag
γ
g
★
α
x
)
★
(
∀
P
Q
,
(
∀
g
,
(
P
=
{
Eo
,
Ei
}=>
gFrag
γ
g
★
□
α
x
)
★
(
gFrag
γ
g
★
□
α
x
=
{
Ei
,
Eo
}=>
P
)
★
(
∀
g'
r
,
gFrag
γ
g'
★
β
x
g
g'
r
=
{
Ei
,
Eo
}=>
Q
r
))
(
∀
g'
r
,
gFrag
γ
g'
★
β
x
g
g'
r
=
{
Ei
,
Eo
}=>
Q
r
))
-★
{{
P
}}
f
x
{{
Q
}})
%
I
.
-★
{{
P
}}
f
x
{{
Q
}})
%
I
.
...
@@ -132,7 +133,7 @@ Section generic.
...
@@ -132,7 +133,7 @@ Section generic.
∀
(
Φ
:
val
→
iProp
Σ
)
(
l
:
val
),
∀
(
Φ
:
val
→
iProp
Σ
)
(
l
:
val
),
{{
True
}}
f
l
{{
f'
,
■
(
∀
(
x
:
val
)
(
Φ
:
val
→
iProp
Σ
)
(
g
:
A
),
{{
True
}}
f
l
{{
f'
,
■
(
∀
(
x
:
val
)
(
Φ
:
val
→
iProp
Σ
)
(
g
:
A
),
heapN
⊥
N
→
heapN
⊥
N
→
heap_ctx
★
ϕ
l
g
★
α
x
★
heap_ctx
★
ϕ
l
g
★
□
α
x
★
(
∀
(
v
:
val
)
(
g'
:
A
),
ϕ
l
g'
-★
β
x
g
g'
v
-★
|
=
{
E
}=>
Φ
v
)
(
∀
(
v
:
val
)
(
g'
:
A
),
ϕ
l
g'
-★
β
x
g
g'
v
-★
|
=
{
E
}=>
Φ
v
)
⊢
WP
f'
x
@
E
{{
Φ
}}
)}}
.
⊢
WP
f'
x
@
E
{{
Φ
}}
)}}
.
...
@@ -141,11 +142,11 @@ Section generic.
...
@@ -141,11 +142,11 @@ Section generic.
heap_ctx
★
(
∀
(
l
:
val
)
(
γ
:
gname
),
ϕ
l
g
-★
gFull
γ
g
-★
gFrag
γ
g
-★
Φ
l
)
heap_ctx
★
(
∀
(
l
:
val
)
(
γ
:
gname
),
ϕ
l
g
-★
gFull
γ
g
-★
gFrag
γ
g
-★
Φ
l
)
⊢
WP
f
#
()
{{
Φ
}}
.
⊢
WP
f
#
()
{{
Φ
}}
.
Lemma
atomic_spec
(
f_cons
f_seq
:
val
)
(
ϕ
:
val
→
A
→
iProp
Σ
)
α
β
:
Lemma
atomic_spec
(
f_cons
f_seq
:
val
)
(
ϕ
:
val
→
A
→
iProp
Σ
)
α
β
Ei
:
∀
(
g0
:
A
),
∀
(
g0
:
A
),
heapN
⊥
N
→
seq_spec
f_seq
ϕ
α
β
⊤
→
cons_spec
f_cons
g0
ϕ
→
heapN
⊥
N
→
seq_spec
f_seq
ϕ
α
β
⊤
→
cons_spec
f_cons
g0
ϕ
→
heap_ctx
heap_ctx
⊢
WP
sync
f_cons
f_seq
{{
f
,
∃
γ
,
gFrag
γ
g0
★
∀
x
,
□
atomic_triple'
α
β
⊤
⊤
f
x
γ
}}
.
⊢
WP
sync
f_cons
f_seq
{{
f
,
∃
γ
,
gFrag
γ
g0
★
∀
x
,
□
atomic_triple'
α
β
Ei
⊤
f
x
γ
}}
.
Proof
.
Proof
.
iIntros
(
g0
HN
Hseq
Hcons
)
"#Hh"
.
repeat
wp_let
.
iIntros
(
g0
HN
Hseq
Hcons
)
"#Hh"
.
repeat
wp_let
.
wp_bind
(
f_cons
_)
.
iApply
Hcons
=>
//.
iFrame
"Hh"
.
wp_bind
(
f_cons
_)
.
iApply
Hcons
=>
//.
iFrame
"Hh"
.
...
@@ -170,19 +171,23 @@ Section generic.
...
@@ -170,19 +171,23 @@ Section generic.
iApply
(
"Hrefines"
with
"[]"
);
first
by
rewrite
to_of_val
.
iApply
(
"Hrefines"
with
"[]"
);
first
by
rewrite
to_of_val
.
iAlways
.
iIntros
"[HR HP]"
.
iDestruct
"HR"
as
(
g
)
"[Hϕ HgFull]"
.
iAlways
.
iIntros
"[HR HP]"
.
iDestruct
"HR"
as
(
g
)
"[Hϕ HgFull]"
.
(* we should view shift at this point *)
(* we should view shift at this point *)
iDestruct
(
"Hvss"
$!
g
)
as
"[Hvs1 Hvs2]"
.
iDestruct
(
"Hvss"
$!
g
)
as
"[Hvs1 [Hvs2 Hvs3]]"
.
iVs
(
"Hvs1"
with
"HP"
)
as
"[HgFrag Hα]"
.
iApply
pvs_wp
.
iApply
pvs_wp
.
iVsIntro
.
iVs
(
"Hvs1"
with
"HP"
)
as
"[HgFrag #Hα]"
.
iApply
H
=>
//.
(* FIXME: name *)
iVs
(
"Hvs2"
with
"[HgFrag]"
)
as
"HP"
;
first
by
iFrame
.
iFrame
"Hh Hϕ Hα"
.
iIntros
(
ret
g'
)
"Hϕ' Hβ"
.
iVsIntro
.
iApply
H
=>
//.
(* FIXME: name *)
iFrame
"Hh Hϕ"
.
iSplitR
;
first
done
.
iIntros
(
ret
g'
)
"Hϕ' Hβ"
.
iVs
(
"Hvs1"
with
"HP"
)
as
"[HgFrag _]"
.
iCombine
"HgFull"
"HgFrag"
as
"Hg"
.
iCombine
"HgFull"
"HgFrag"
as
"Hg"
.
rewrite
/
gFullR
/
gFragR
.
rewrite
/
gFullR
/
gFragR
.
iAssert
(|
=
r
=>
own
γ
(((
1
/
2
)
%
Qp
,
DecAgree
g'
)
⋅
((
1
/
2
)
%
Qp
,
DecAgree
g'
)))
%
I
with
"[Hg]"
as
"Hupd"
.
iAssert
(|
=
r
=>
own
γ
(((
1
/
2
)
%
Qp
,
DecAgree
g'
)
⋅
((
1
/
2
)
%
Qp
,
DecAgree
g'
)))
%
I
with
"[Hg]"
as
"Hupd"
.
{
iApply
(
own_update
);
last
by
iAssumption
.
apply
pair_l_frac_update
.
}
{
iApply
(
own_update
);
last
by
iAssumption
.
apply
pair_l_frac_update
.
}
iVs
"Hupd"
as
"[HgFull HgFrag]"
.
iVs
"Hupd"
as
"[HgFull HgFrag]"
.
iVs
(
"Hvs3"
$!
g'
ret
with
"[HgFrag Hβ]"
);
first
by
iFrame
.
iVsIntro
.
iSplitL
"HgFull Hϕ'"
.
iSplitL
"HgFull Hϕ'"
.
-
iExists
g'
.
by
iFrame
.
-
iExists
g'
.
by
iFrame
.
-
by
iVs
(
"Hvs2"
$!
g'
ret
with
"[HgFrag Hβ]"
);
first
by
iFram
e
.
-
don
e
.
Qed
.
Qed
.
End
generic
.
End
generic
.
...
...
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