-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dune tests for currently working examples
- Loading branch information
1 parent
8d7d3ac
commit e8b6210
Showing
26 changed files
with
191 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./counter.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./counter_monotonic.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,66 @@ | ||
module IntTp : Library.Type { | ||
rep type T = Int | ||
field c: Int | ||
|
||
pred counter(x: Ref; v: Int) { | ||
own(x, c, v, 1.0) | ||
} | ||
|
||
module IntSetRA = Library.SetRA[IntTp] | ||
proc incr(x: Ref, implicit ghost v: Int) | ||
atomic requires counter(x, v) | ||
atomic ensures counter(x, v + 1) | ||
{ | ||
var phi: AtomicToken := bindAU(); | ||
|
||
var v1: Int; | ||
|
||
type T = Int | ||
ghost var v2: Int := openAU(phi); | ||
|
||
field c: T | ||
unfold counter(x, v2); | ||
v1 := x.c; | ||
fold counter(x, v2); | ||
|
||
abortAU(phi); | ||
|
||
var new_v1 : Int := v1 + 1; | ||
|
||
type Something = data { case onething(a: Int); case nothing } | ||
var v3: Int := openAU(phi); | ||
|
||
pred counter(x: Ref; v: Int) { | ||
own(x, c, 0, 1.0) | ||
unfold counter(x,v3); | ||
|
||
var res: Bool := cas(x.c, v1, new_v1); | ||
|
||
{! | ||
if (res) { | ||
fold counter(x, new_v1); | ||
commitAU(phi); | ||
} else { | ||
fold counter(x, v3); | ||
abortAU(phi); | ||
} | ||
!} | ||
|
||
if (!res) { | ||
var v4: Int := openAU(phi); | ||
incr(x); | ||
commitAU(phi); | ||
} | ||
} | ||
|
||
proc incr(x: Ref) | ||
requires counter(x, 0) | ||
ensures counter(x, 1) | ||
proc read(x: Ref, implicit ghost v: Int) | ||
returns (v2: Int) | ||
atomic requires counter(x, v) | ||
atomic ensures counter(x, v) && v2 == v | ||
ensures v2 == v | ||
|
||
{ | ||
var v: Something = onething(5); | ||
// var res: Bool := CAS(x.c, IntSetRA.set_constr({||}), IntSetRA.set_constr({||})); | ||
var res: Bool := CAS(x.c, 0, 1); | ||
var phi: AtomicToken := bindAU(); | ||
|
||
var v1: Int := openAU(phi); | ||
unfold counter(x, v1); | ||
|
||
var v3: Int := x.c; | ||
|
||
fold counter(x, v1); | ||
commitAU(phi, v3); | ||
|
||
return v3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./counter_no_inv.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(cram | ||
(deps | ||
%{project_root}/bin/raven.exe | ||
%{project_root}/lib/library/resource_algebra.rav | ||
(:rav | ||
(glob_files_rec *.rav)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(cram | ||
(deps | ||
%{project_root}/bin/raven.exe | ||
%{project_root}/lib/library/resource_algebra.rav | ||
(:rav | ||
(glob_files_rec *.rav)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./spin-lock.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./ccm_instances.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(cram | ||
(deps | ||
%{project_root}/bin/raven.exe | ||
%{project_root}/lib/library/resource_algebra.rav | ||
(:rav | ||
(glob_files_rec *.rav)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./flows_ra.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./give-up_sequential.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./single-node_working.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(cram | ||
(deps | ||
%{project_root}/bin/raven.exe | ||
%{project_root}/lib/library/resource_algebra.rav | ||
(:rav | ||
(glob_files_rec *.rav)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./treiber_stack_atomics.rav | ||
Verification successful. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$ dune exec -- raven --shh ./array-max.rav | ||
Verification successful. |
Oops, something went wrong.