Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Paolo G. Giarrusso
examples
Commits
a1c9f69a
Commit
a1c9f69a
authored
Apr 10, 2018
by
Dan Frumin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update comments
parent
bc082bf8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
3 deletions
+6
-3
theories/hocap/abstract_bag.v
theories/hocap/abstract_bag.v
+1
-1
theories/hocap/exclusive_bag.v
theories/hocap/exclusive_bag.v
+1
-0
theories/hocap/fg_bag.v
theories/hocap/fg_bag.v
+1
-1
theories/hocap/shared_bag.v
theories/hocap/shared_bag.v
+3
-1
No files found.
theories/hocap/abstract_bag.v
View file @
a1c9f69a
...
@@ -15,7 +15,7 @@ Structure bag Σ `{!heapG Σ} := Bag {
...
@@ -15,7 +15,7 @@ Structure bag Σ `{!heapG Σ} := Bag {
pushBag
:
val
;
pushBag
:
val
;
popBag
:
val
;
popBag
:
val
;
(* -- predicates -- *)
(* -- predicates -- *)
(* name is used to associate
locked
with is_
lock
*)
(* name is used to associate
bag_contents
with is_
bag
*)
name
:
Type
;
name
:
Type
;
is_bag
(
N
:
namespace
)
(
γ
:
name
)
(
b
:
val
)
:
iProp
Σ
;
is_bag
(
N
:
namespace
)
(
γ
:
name
)
(
b
:
val
)
:
iProp
Σ
;
bag_contents
(
γ
:
name
)
(
X
:
gmultiset
val
)
:
iProp
Σ
;
bag_contents
(
γ
:
name
)
(
X
:
gmultiset
val
)
:
iProp
Σ
;
...
...
theories/hocap/exclusive_bag.v
View file @
a1c9f69a
...
@@ -16,6 +16,7 @@ Section proof.
...
@@ -16,6 +16,7 @@ Section proof.
Variable
b
:
bag
Σ
.
Variable
b
:
bag
Σ
.
Variable
N
:
namespace
.
Variable
N
:
namespace
.
(** An exclusive specification keeps track of the exact contents of the bag *)
Definition
bagE
(
γ
:
name
Σ
b
)
(
x
:
val
)
(
X
:
gmultiset
val
)
:
iProp
Σ
:
=
Definition
bagE
(
γ
:
name
Σ
b
)
(
x
:
val
)
(
X
:
gmultiset
val
)
:
iProp
Σ
:
=
(
is_bag
b
N
γ
x
∗
bag_contents
b
γ
X
)%
I
.
(
is_bag
b
N
γ
x
∗
bag_contents
b
γ
X
)%
I
.
...
...
theories/hocap/fg_bag.v
View file @
a1c9f69a
...
@@ -13,7 +13,7 @@ From iris.heap_lang.lib Require Import lock spin_lock.
...
@@ -13,7 +13,7 @@ From iris.heap_lang.lib Require Import lock spin_lock.
From
iris_examples
.
hocap
Require
Import
abstract_bag
.
From
iris_examples
.
hocap
Require
Import
abstract_bag
.
Set
Default
Proof
Using
"Type"
.
Set
Default
Proof
Using
"Type"
.
(**
Coars
e-grained bag implementation using
a spin lock
*)
(**
Fin
e-grained bag implementation using
CAS
*)
Definition
newBag
:
val
:
=
λ
:
<>,
Definition
newBag
:
val
:
=
λ
:
<>,
ref
NONE
.
ref
NONE
.
Definition
pushBag
:
val
:
=
rec
:
"push"
"b"
"v"
:
=
Definition
pushBag
:
val
:
=
rec
:
"push"
"b"
"v"
:
=
...
...
theories/hocap/shared_bag.v
View file @
a1c9f69a
...
@@ -17,7 +17,9 @@ Section proof.
...
@@ -17,7 +17,9 @@ Section proof.
Variable
N
:
namespace
.
Variable
N
:
namespace
.
Definition
NB
:
=
N
.@
"bag"
.
Definition
NB
:
=
N
.@
"bag"
.
Definition
NI
:
=
N
.@
"inv"
.
Definition
NI
:
=
N
.@
"inv"
.
Variable
P
:
val
→
val
→
iProp
Σ
.
(* Predicate that will be satisfied by all the elements in the bag *)
(** Predicate that will be satisfied by all the elements in the bag.
The first argument is the bag itself. *)
Variable
P
:
val
→
val
→
iProp
Σ
.
Definition
bagS_inv
(
γ
:
name
Σ
b
)
(
y
:
val
)
:
iProp
Σ
:
=
Definition
bagS_inv
(
γ
:
name
Σ
b
)
(
y
:
val
)
:
iProp
Σ
:
=
inv
NI
(
∃
X
,
bag_contents
b
γ
X
∗
[
∗
mset
]
x
∈
X
,
P
y
x
)%
I
.
inv
NI
(
∃
X
,
bag_contents
b
γ
X
∗
[
∗
mset
]
x
∈
X
,
P
y
x
)%
I
.
...
...
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