Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Iris
examples
Commits
2b21312d
Commit
2b21312d
authored
Oct 11, 2016
by
Zhen Zhang
Browse files
Drop the hated cons
parent
ade8f525
Changes
1
Show whitespace changes
Inline
Side-by-side
atomic_sync.v
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
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment