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
2b21312d
Commit
2b21312d
authored
8 years ago
by
Zhen Zhang
Browse files
Options
Downloads
Patches
Plain Diff
Drop the hated cons
parent
ade8f525
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
atomic_sync.v
+11
-17
11 additions, 17 deletions
atomic_sync.v
with
11 additions
and
17 deletions
atomic_sync.v
+
11
−
17
View file @
2b21312d
...
@@ -28,8 +28,7 @@ Section atomic_sync.
...
@@ -28,8 +28,7 @@ Section atomic_sync.
(
f
x
)
(
P
x
)
(
fun
_
=>
Q
x
))
%
I
.
(
f
x
)
(
P
x
)
(
fun
_
=>
Q
x
))
%
I
.
Definition
sync
(
mk_syncer
:
val
)
:
val
:=
Definition
sync
(
mk_syncer
:
val
)
:
val
:=
λ
:
"f_cons"
"f_seq"
,
λ
:
"f_cons"
"f_seq"
"l"
,
let
:
"l"
:=
"f_cons"
#
()
in
let
:
"s"
:=
mk_syncer
#
()
in
let
:
"s"
:=
mk_syncer
#
()
in
"s"
(
"f_seq"
"l"
)
.
"s"
(
"f_seq"
"l"
)
.
...
@@ -41,11 +40,6 @@ Section atomic_sync.
...
@@ -41,11 +40,6 @@ Section atomic_sync.
(
∀
(
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
{{
Φ
}}
)}}
.
Definition
cons_spec
(
f
:
val
)
(
g
:
A
)
ϕ
:=
∀
Φ
:
val
→
iProp
Σ
,
heapN
⊥
N
→
heap_ctx
★
(
∀
(
l
:
val
)
(
γ
:
gname
),
ϕ
l
g
-★
gHalf
γ
g
-★
gHalf
γ
g
-★
Φ
l
)
⊢
WP
f
#
()
{{
Φ
}}
.
Definition
synced
R
(
f'
f
:
val
)
:=
Definition
synced
R
(
f'
f
:
val
)
:=
(
□
∀
P
Q
(
x
:
val
),
({{
R
★
P
x
}}
f
x
{{
v
,
R
★
Q
x
v
}})
→
({{
P
x
}}
f'
x
{{
v
,
Q
x
v
}}))
%
I
.
(
□
∀
P
Q
(
x
:
val
),
({{
R
★
P
x
}}
f
x
{{
v
,
R
★
Q
x
v
}})
→
({{
P
x
}}
f'
x
{{
v
,
Q
x
v
}}))
%
I
.
...
@@ -57,19 +51,19 @@ Section atomic_sync.
...
@@ -57,19 +51,19 @@ Section atomic_sync.
heapN
⊥
N
→
heapN
⊥
N
→
heap_ctx
★
R
★
(
∀
s
,
□
(
is_syncer
R
s
)
-★
Φ
s
)
⊢
WP
mk_syncer
#
()
{{
Φ
}}
.
heap_ctx
★
R
★
(
∀
s
,
□
(
is_syncer
R
s
)
-★
Φ
s
)
⊢
WP
mk_syncer
#
()
{{
Φ
}}
.
Lemma
atomic_spec
(
mk_syncer
f_cons
f_seq
:
val
)
(
ϕ
:
val
→
A
→
iProp
Σ
)
α
β
Ei
:
Lemma
atomic_spec
(
mk_syncer
f_cons
f_seq
l
:
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
ϕ
α
β
⊤
→
mk_syncer_spec
mk_syncer
→
mk_syncer_spec
mk_syncer
→
heap_ctx
heap_ctx
★
ϕ
l
g0
⊢
WP
(
sync
mk_syncer
)
f_cons
f_seq
{{
f
,
∃
γ
,
gHalf
γ
g0
★
∀
x
,
□
atomic_triple'
α
β
Ei
⊤
f
x
γ
}}
.
⊢
WP
(
sync
mk_syncer
)
f_cons
f_seq
l
{{
f
,
∃
γ
,
gHalf
γ
g0
★
∀
x
,
□
atomic_triple'
α
β
Ei
⊤
f
x
γ
}}
.
Proof
.
Proof
.
iIntros
(
g0
HN
Hseq
Hcons
Hsync
)
"#Hh
"
.
repeat
wp_let
.
iIntros
(
g0
HN
Hseq
Hsync
)
"
[
#Hh
Hϕ]"
.
wp_bind
(
f_cons
_)
.
iApply
Hcons
=>
//.
iFrame
"Hh
"
.
iVs
(
own_alloc
(((
1
/
2
)
%
Qp
,
DecAgree
g0
)
⋅
((
1
/
2
)
%
Qp
,
DecAgree
g0
)))
as
(
γ
)
"[Hg1 Hg2]
"
.
iIntros
(
l
γ
)
"Hϕ HFull HFrag"
.
{
by
rewrite
pair_op
dec_agree_idemp
.
}
wp_let
.
wp_bind
(
mk_syncer
_)
.
repeat
wp_let
.
wp_bind
(
mk_syncer
_)
.
iApply
(
Hsync
(
∃
g
:
A
,
ϕ
l
g
★
gHalf
γ
g
)
%
I
)=>
//.
iFrame
"Hh"
.
iApply
(
Hsync
(
∃
g
:
A
,
ϕ
l
g
★
gHalf
γ
g
)
%
I
)=>
//.
iFrame
"Hh"
.
iSplitL
"H
Full
Hϕ"
.
iSplitL
"H
g1
Hϕ"
.
{
iExists
g0
.
by
iFrame
.
}
{
iExists
g0
.
by
iFrame
.
}
iIntros
(
s
)
"#Hsyncer"
.
iIntros
(
s
)
"#Hsyncer"
.
wp_let
.
wp_bind
(
f_seq
_)
.
iApply
wp_wand_r
.
wp_let
.
wp_bind
(
f_seq
_)
.
iApply
wp_wand_r
.
...
@@ -100,7 +94,7 @@ Section atomic_sync.
...
@@ -100,7 +94,7 @@ Section atomic_sync.
iAssert
(|
=
r
=>
own
γ
(((
1
/
2
)
%
Qp
,
DecAgree
g'
)
⋅
((
1
/
2
)
%
Qp
,
DecAgree
g'
)))
%
I
iAssert
(|
=
r
=>
own
γ
(((
1
/
2
)
%
Qp
,
DecAgree
g'
)
⋅
((
1
/
2
)
%
Qp
,
DecAgree
g'
)))
%
I
with
"[Hg]"
as
"==>[Hg1 Hg2]"
.
with
"[Hg]"
as
"==>[Hg1 Hg2]"
.
{
iApply
own_update
;
last
by
iAssumption
.
{
iApply
own_update
;
last
by
iAssumption
.
apply
cmra_update_exclusive
.
by
rewrite
pair_op
dec_agree_idemp
.
}
apply
cmra_update_exclusive
.
by
rewrite
pair_op
dec_agree_idemp
.
}
iVs
(
"Hvs2"
with
"[Hg1 Hβ]"
)
.
iVs
(
"Hvs2"
with
"[Hg1 Hβ]"
)
.
{
iExists
g'
.
iFrame
.
}
{
iExists
g'
.
iFrame
.
}
iVsIntro
.
iSplitL
"Hg2 Hϕ'"
.
iVsIntro
.
iSplitL
"Hg2 Hϕ'"
.
...
...
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