Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
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
Package Registry
Model registry
Operate
Terraform modules
Monitor
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
Simcha van Collem
Iris
Commits
7527bd61
Commit
7527bd61
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Rename "inc" of counter into "incr".
parent
3f678b90
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
heap_lang/lib/counter.v
+8
-8
8 additions, 8 deletions
heap_lang/lib/counter.v
tests/counter.v
+6
-6
6 additions, 6 deletions
tests/counter.v
with
14 additions
and
14 deletions
heap_lang/lib/counter.v
+
8
−
8
View file @
7527bd61
...
@@ -5,12 +5,12 @@ From iris.algebra Require Import frac auth.
...
@@ -5,12 +5,12 @@ From iris.algebra Require Import frac auth.
From
iris
.
heap_lang
Require
Import
proofmode
notation
.
From
iris
.
heap_lang
Require
Import
proofmode
notation
.
Definition
newcounter
:
val
:=
λ
:
<>
,
ref
#
0
.
Definition
newcounter
:
val
:=
λ
:
<>
,
ref
#
0
.
Definition
inc
:
val
:=
Definition
inc
r
:
val
:=
rec
:
"inc"
"l"
:=
rec
:
"inc
r
"
"l"
:=
let
:
"n"
:=
!
"l"
in
let
:
"n"
:=
!
"l"
in
if
:
CAS
"l"
"n"
(
#
1
+
"n"
)
then
#
()
else
"inc"
"l"
.
if
:
CAS
"l"
"n"
(
#
1
+
"n"
)
then
#
()
else
"inc
r
"
"l"
.
Definition
read
:
val
:=
λ
:
"l"
,
!
"l"
.
Definition
read
:
val
:=
λ
:
"l"
,
!
"l"
.
Global
Opaque
newcounter
inc
get
.
Global
Opaque
newcounter
inc
r
get
.
(** Monotone counter *)
(** Monotone counter *)
Class
mcounterG
Σ
:=
MCounterG
{
mcounter_inG
:>
inG
Σ
(
authR
mnatUR
)
}
.
Class
mcounterG
Σ
:=
MCounterG
{
mcounter_inG
:>
inG
Σ
(
authR
mnatUR
)
}
.
...
@@ -44,8 +44,8 @@ Section mono_proof.
...
@@ -44,8 +44,8 @@ Section mono_proof.
iModIntro
.
iApply
"HΦ"
.
rewrite
/
mcounter
;
eauto
10
.
iModIntro
.
iApply
"HΦ"
.
rewrite
/
mcounter
;
eauto
10
.
Qed
.
Qed
.
Lemma
inc_mono_spec
l
n
:
Lemma
inc
r
_mono_spec
l
n
:
{{{
mcounter
l
n
}}}
inc
#
l
{{{
RET
#
();
mcounter
l
(
S
n
)
}}}
.
{{{
mcounter
l
n
}}}
inc
r
#
l
{{{
RET
#
();
mcounter
l
(
S
n
)
}}}
.
Proof
.
Proof
.
iIntros
(
Φ
)
"Hl HΦ"
.
iLöb
as
"IH"
.
wp_rec
.
iIntros
(
Φ
)
"Hl HΦ"
.
iLöb
as
"IH"
.
wp_rec
.
iDestruct
"Hl"
as
(
γ
)
"(% & #? & #Hinv & Hγf)"
.
iDestruct
"Hl"
as
(
γ
)
"(% & #? & #Hinv & Hγf)"
.
...
@@ -122,8 +122,8 @@ Section contrib_spec.
...
@@ -122,8 +122,8 @@ Section contrib_spec.
iModIntro
.
iApply
"HΦ"
.
rewrite
/
ccounter_ctx
/
ccounter
;
eauto
10
.
iModIntro
.
iApply
"HΦ"
.
rewrite
/
ccounter_ctx
/
ccounter
;
eauto
10
.
Qed
.
Qed
.
Lemma
inc_contrib_spec
γ
l
q
n
:
Lemma
inc
r
_contrib_spec
γ
l
q
n
:
{{{
ccounter_ctx
γ
l
∗
ccounter
γ
q
n
}}}
inc
#
l
{{{
ccounter_ctx
γ
l
∗
ccounter
γ
q
n
}}}
inc
r
#
l
{{{
RET
#
();
ccounter
γ
q
(
S
n
)
}}}
.
{{{
RET
#
();
ccounter
γ
q
(
S
n
)
}}}
.
Proof
.
Proof
.
iIntros
(
Φ
)
"(#(%&?&?) & Hγf) HΦ"
.
iLöb
as
"IH"
.
wp_rec
.
iIntros
(
Φ
)
"(#(%&?&?) & Hγf) HΦ"
.
iLöb
as
"IH"
.
wp_rec
.
...
...
This diff is collapsed.
Click to expand it.
tests/counter.v
+
6
−
6
View file @
7527bd61
...
@@ -11,12 +11,12 @@ From iris.heap_lang Require Import proofmode notation.
...
@@ -11,12 +11,12 @@ From iris.heap_lang Require Import proofmode notation.
Import
uPred
.
Import
uPred
.
Definition
newcounter
:
val
:=
λ
:
<>
,
ref
#
0
.
Definition
newcounter
:
val
:=
λ
:
<>
,
ref
#
0
.
Definition
inc
:
val
:=
Definition
inc
r
:
val
:=
rec
:
"inc"
"l"
:=
rec
:
"inc
r
"
"l"
:=
let
:
"n"
:=
!
"l"
in
let
:
"n"
:=
!
"l"
in
if
:
CAS
"l"
"n"
(
#
1
+
"n"
)
then
#
()
else
"inc"
"l"
.
if
:
CAS
"l"
"n"
(
#
1
+
"n"
)
then
#
()
else
"inc
r
"
"l"
.
Definition
read
:
val
:=
λ
:
"l"
,
!
"l"
.
Definition
read
:
val
:=
λ
:
"l"
,
!
"l"
.
Global
Opaque
newcounter
inc
read
.
Global
Opaque
newcounter
inc
r
read
.
(** The CMRA we need. *)
(** The CMRA we need. *)
Inductive
M
:=
Auth
:
nat
→
M
|
Frag
:
nat
→
M
|
Bot
.
Inductive
M
:=
Auth
:
nat
→
M
|
Frag
:
nat
→
M
|
Bot
.
...
@@ -103,8 +103,8 @@ Proof.
...
@@ -103,8 +103,8 @@ Proof.
iModIntro
.
rewrite
/
C
;
eauto
10
.
iModIntro
.
rewrite
/
C
;
eauto
10
.
Qed
.
Qed
.
Lemma
inc_spec
l
n
:
Lemma
inc
r
_spec
l
n
:
{{
C
l
n
}}
inc
#
l
{{
v
,
v
=
#
()
∧
C
l
(
S
n
)
}}
.
{{
C
l
n
}}
inc
r
#
l
{{
v
,
v
=
#
()
∧
C
l
(
S
n
)
}}
.
Proof
.
Proof
.
iIntros
"!# Hl /="
.
iLöb
as
"IH"
.
wp_rec
.
iIntros
"!# Hl /="
.
iLöb
as
"IH"
.
wp_rec
.
iDestruct
"Hl"
as
(
N
γ
)
"(% & #Hh & #Hinv & Hγf)"
.
iDestruct
"Hl"
as
(
N
γ
)
"(% & #Hh & #Hinv & Hγf)"
.
...
...
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