-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4881964
commit f4fa1a7
Showing
2 changed files
with
69 additions
and
0 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,67 @@ | ||
// RUN: %parallel-boogie "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
var {:layer 0,1} x: int; | ||
|
||
yield procedure {:layer 0} Incr(); | ||
refines both action {:layer 1} _ { | ||
x := x + 1; | ||
} | ||
|
||
yield right procedure {:layer 1} A() | ||
modifies x; | ||
ensures {:layer 1} x == old(x) + 2; | ||
{ | ||
par Incr() | Incr(); | ||
} | ||
|
||
yield right procedure {:layer 1} B() | ||
modifies x; | ||
ensures {:layer 1} x == old(x) + 4; | ||
{ | ||
par A() | A(); | ||
} | ||
|
||
yield right procedure {:layer 1} R1(i: int) | ||
modifies x; | ||
requires {:layer 1} 0 <= i; | ||
ensures {:layer 1} x == old(x) + i; | ||
{ | ||
if (i == 0) { | ||
return; | ||
} | ||
par Incr() | R1(i-1); | ||
} | ||
|
||
yield right procedure {:layer 1} R2(i: int) | ||
modifies x; | ||
requires {:layer 1} 0 <= i; | ||
ensures {:layer 1} x == old(x) + i; | ||
{ | ||
if (i == 0) { | ||
return; | ||
} | ||
par R2(i-1) | Incr(); | ||
} | ||
|
||
yield right procedure {:layer 1} M1(i: int) | ||
modifies x; | ||
requires {:layer 1} 0 <= i; | ||
ensures {:layer 1} x == old(x) + i; | ||
{ | ||
if (i == 0) { | ||
return; | ||
} | ||
par Incr() | M2(i-1); | ||
} | ||
|
||
yield right procedure {:layer 1} M2(i: int) | ||
modifies x; | ||
requires {:layer 1} 0 <= i; | ||
ensures {:layer 1} x == old(x) + i; | ||
{ | ||
if (i == 0) { | ||
return; | ||
} | ||
par M1(i-1) | Incr(); | ||
} |
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 @@ | ||
|
||
Boogie program verifier finished with 6 verified, 0 errors |