Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Iris
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
Abhishek Anand
Iris
Commits
5f0b7f09
Commit
5f0b7f09
authored
6 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
a direct-style proof of the incr_spec
parent
45c5fb3a
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
theories/heap_lang/lib/increment.v
+28
-0
28 additions, 0 deletions
theories/heap_lang/lib/increment.v
with
28 additions
and
0 deletions
theories/heap_lang/lib/increment.v
+
28
−
0
View file @
5f0b7f09
...
...
@@ -49,6 +49,34 @@ Section increment.
then
"oldv"
(* return old value if success *)
else
"incr"
"l"
.
(** A proof of the incr specification that unfolds the definition
of atomic accessors. Useful for introducing them as a concept,
but see below for a shorter proof. *)
Lemma
incr_spec_direct
(
l
:
loc
)
:
<<<
∀
(
v
:
Z
),
l
↦
#
v
>>>
incr
#
l
@
⊤
<<<
l
↦
#
(
v
+
1
),
RET
#
v
>>>.
Proof
.
iApply
wp_atomic_intro
.
iIntros
(
Φ
)
"AU"
.
iLöb
as
"IH"
.
wp_lam
.
wp_apply
load_spec
;
first
by
iAccu
.
(* Prove the atomic update for load *)
iAuIntro
.
rewrite
/
atomic_acc
.
iMod
"AU"
as
(
v
)
"[Hl [Hclose _]]"
.
iModIntro
.
iExists
_,
_
.
iFrame
"Hl"
.
iSplit
.
{
(* proving abort case *)
done
.
}
iIntros
"Hl"
.
iMod
(
"Hclose"
with
"Hl"
)
as
"AU"
.
iIntros
"!> _"
.
(* Now go on *)
wp_apply
cas_spec
;
[
done
|
iAccu
|]
.
(* Prove the atomic update for CAS *)
iAuIntro
.
rewrite
/
atomic_acc
.
iMod
"AU"
as
(
w
)
"[Hl Hclose]"
.
iModIntro
.
iExists
_
.
iFrame
"Hl"
.
iSplit
.
{
iDestruct
"Hclose"
as
"[? _]"
.
done
.
}
iIntros
"Hl"
.
destruct
(
decide
(
#
w
=
#
v
))
as
[[
=
->
]|
Hx
]
.
-
iDestruct
"Hclose"
as
"[_ Hclose]"
.
iMod
(
"Hclose"
with
"Hl"
)
as
"HΦ"
.
iIntros
"!> _"
.
wp_if
.
by
iApply
"HΦ"
.
-
iDestruct
"Hclose"
as
"[Hclose _]"
.
iMod
(
"Hclose"
with
"Hl"
)
as
"AU"
.
iIntros
"!> _"
.
wp_if
.
iApply
"IH"
.
done
.
Qed
.
(** A proof of the incr specification that uses lemmas to avoid reasining
with the definition of atomic accessors. *)
Lemma
incr_spec
(
l
:
loc
)
:
<<<
∀
(
v
:
Z
),
l
↦
#
v
>>>
incr
#
l
@
⊤
<<<
l
↦
#
(
v
+
1
),
RET
#
v
>>>.
Proof
.
...
...
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