Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris-atomic
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
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
FP
iris-atomic
Commits
3b6db97b
Commit
3b6db97b
authored
8 years ago
by
Zhen Zhang
Browse files
Options
Downloads
Patches
Plain Diff
doOp tentative
parent
637f31c7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
srv.v
+48
-38
48 additions, 38 deletions
srv.v
with
48 additions
and
38 deletions
srv.v
+
48
−
38
View file @
3b6db97b
...
@@ -185,42 +185,52 @@ Section proof.
...
@@ -185,42 +185,52 @@ Section proof.
iApply
(
"HΦ"
with
"Ho2 Ho3 Hfrag Hx2"
).
iApply
(
"HΦ"
with
"Ho2 Ho3 Hfrag Hx2"
).
Admitted
.
Admitted
.
Definition
doOp_triple
(
f
:
val
)
p
γ
x
γ
1
γ
2
γ
3
γ
4
Q
:
iProp
Σ
:=
Definition
pinv_sub
RI
γ
x
γ
1
γ
2
γ
3
γ
4
p
Q
:=
(
RI
⊣⊢
∃
Rf
,
Rf
★
p_inv
γ
x
γ
1
γ
2
γ
3
γ
4
p
Q
)
%
I
.
atomic_triple
(
fun
_
:
()
=>
p_inv
γ
x
γ
1
γ
2
γ
3
γ
4
p
Q
★
(
own
γ
2
(
Excl
())
∨
own
γ
1
(
Excl
()))
★
□
(
∀
x
:
val
,
WP
f
x
{{
v
,
■
Q
x
v
}}
))
%
I
Lemma
doOp_spec
Φ
(
f
:
val
)
(
RI
:
iProp
Σ
)
γ
x
γ
1
γ
2
γ
3
γ
4
p
Q
`
{
TimelessP
_
RI
}:
(
fun
_
ret
=>
(
own
γ
2
(
Excl
())
∨
own
γ
1
(
Excl
()))
★
ret
=
#()
★
p_inv
γ
x
γ
1
γ
2
γ
3
γ
4
p
Q
)
%
I
heapN
⊥
N
→
pinv_sub
RI
γ
x
γ
1
γ
2
γ
3
γ
4
p
Q
→
(
nclose
heapN
)
heap_ctx
★
inv
N
RI
★
own
γ
2
(
Excl
())
★
⊤
□
(
∀
x
:
val
,
WP
f
x
{{
v
,
■
Q
x
v
}}
)
%
I
★
(
own
γ
2
(
Excl
())
-
★
Φ
#())
(
doOp
f
#
p
).
⊢
WP
doOp
f
#
p
{{
Φ
}}
.
Lemma
doOp_spec
(
f
:
val
)
p
γ
x
γ
1
γ
2
γ
3
γ
4
R
:
heapN
⊥
N
→
heap_ctx
⊢
doOp_triple
f
p
γ
x
γ
1
γ
2
γ
3
γ
4
R
.
Proof
.
Proof
.
iIntros
(
HN
)
"#Hh"
.
rewrite
/
doOp_triple
/
atomic_triple
.
iIntros
(
HN
Hsub
)
"(#Hh & #HRI & Ho2 & #Hf & HΦ)"
.
iIntros
(
P
Q
)
"#Hvs"
.
wp_seq
.
wp_let
.
wp_bind
(
!
_
)
%
E
.
iIntros
"!# HP"
.
wp_rec
.
iInv
N
as
">H"
"Hclose"
.
wp_let
.
wp_bind
(
!
_
)
%
E
.
iDestruct
(
Hsub
with
"H"
)
as
(
Rf
)
"[HRf [Hp | [Hp | [Hp | Hp]]]]"
.
iVs
(
"Hvs"
with
"HP"
)
as
(
xs
)
"[[Hp [[Ho2 | Ho1] #Hf]] Hvs']"
.
-
iDestruct
"Hp"
as
(
y
)
"(Hp & Ho1 & Ho3)"
.
-
rewrite
/
p_inv
.
wp_load
.
iVs
(
"Hclose"
with
"[HRf Hp Ho1 Ho3]"
).
iDestruct
"Hp"
as
"[Hp | [Hp | [Hp | Hp]]]"
.
{
iNext
.
iApply
Hsub
.
iExists
Rf
.
iFrame
"HRf"
.
+
iDestruct
"Hp"
as
(
y
)
"(Hp & Ho1 & Ho3)"
.
iLeft
.
iExists
y
.
by
iFrame
.
}
wp_load
.
iDestruct
"Hvs'"
as
"[_ Hvs']"
.
iVsIntro
.
wp_match
.
by
iApply
"HΦ"
.
iVs
(
"Hvs'"
$
!
#()
with
"[-]"
)
as
"HQ"
.
-
iDestruct
"Hp"
as
(
x
)
"(Hp & Hx & Ho1 & Ho4)"
.
{
iSplitL
"Ho2"
;
first
by
iLeft
.
iSplitR
;
first
auto
.
iLeft
.
iExists
y
.
by
iFrame
.
}
wp_load
.
iVsIntro
.
wp_match
.
eauto
.
iAssert
(
|=
r
=>
own
γ
x
(((
1
/
4
)
%
Qp
,
DecAgree
x
)
⋅
((
1
/
4
)
%
Qp
,
DecAgree
x
)))
%
I
with
"[Hx]"
as
"==>[Hx1 Hx2]"
.
+
iDestruct
"Hp"
as
(
x
)
"(Hp & Hx & Ho1 & Ho4)"
.
{
iDestruct
(
own_update
with
"Hx"
)
as
"Hx"
;
last
by
iAssumption
.
wp_load
.
replace
((
1
/
2
)
%
Qp
)
with
(
1
/
4
+
1
/
4
)
%
Qp
;
last
by
apply
Qp_div_S
.
iAssert
(
|=
r
=>
own
γ
x
(((
1
/
4
)
%
Qp
,
DecAgree
x
)
⋅
((
1
/
4
)
%
Qp
,
DecAgree
x
)))
%
I
with
"[Hx]"
as
"==>[Hx1 Hx2]"
.
by
apply
pair_l_frac_op
'
.
}
{
iDestruct
(
own_update
with
"Hx"
)
as
"Hx"
;
last
by
iAssumption
.
iVs
(
"Hclose"
with
"[HRf Hp Hx1 Ho2 Ho4]"
).
replace
((
1
/
2
)
%
Qp
)
with
(
1
/
4
+
1
/
4
)
%
Qp
;
last
by
apply
Qp_div_S
.
{
iNext
.
iApply
Hsub
.
iExists
Rf
.
iFrame
"HRf"
.
by
apply
pair_l_frac_op
'
.
}
iRight
.
iRight
.
iLeft
.
iExists
x
.
by
iFrame
.
}
iDestruct
"Hvs'"
as
"[Hvs' _]"
.
iVsIntro
.
wp_match
.
iVs
(
"Hvs'"
with
"[-]"
)
as
"HP"
.
wp_bind
(
f
_
).
iApply
wp_wand_r
.
{
iSplitR
"Ho1"
;
last
auto
.
iRight
.
iRight
.
iLeft
.
iExists
x
.
by
iFrame
.
}
iSplitR
;
first
by
iApply
"Hf"
.
iVsIntro
.
wp_match
.
iIntros
(
y
)
"%"
.
iInv
N
as
">H"
"Hclose"
.
iDestruct
(
Hsub
with
"H"
)
as
(
Rf
'
)
"[HRf [Hp | [Hp | [Hp | Hp]]]]"
.
+
admit
.
+
admit
.
+
iDestruct
"Hp"
as
(
x
'
)
"(Hp & Hx & Ho2 & Ho4)"
.
destruct
(
decide
(
x
=
x
'
))
as
[
->|
Hneq
];
last
by
admit
.
\ No newline at end of file
iCombine
"Hx2"
"Hx"
as
"Hx"
.
iDestruct
(
own_update
with
"Hx"
)
as
"==>Hx"
;
first
by
apply
pair_l_frac_op
.
rewrite
Qp_div_S
.
wp_store
.
iVs
(
"Hclose"
with
"[HRf Hp Hx Ho1 Ho4]"
).
{
iNext
.
iApply
Hsub
.
iExists
Rf
'
.
iFrame
"HRf"
.
iRight
.
iRight
.
iRight
.
iExists
x
'
,
y
.
by
iFrame
.
}
iVsIntro
.
by
iApply
"HΦ"
.
+
admit
.
-
admit
.
-
admit
.
Admitted
.
\ No newline at end of file
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