forked from boogie-org/boogie
-
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.
Merge pull request boogie-org#141 from amaurremi/master
Pass over Rustan's PR#140 comments. Added lambda-lifting tests.
- Loading branch information
Showing
8 changed files
with
79 additions
and
38 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
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
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
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,52 @@ | ||
// RUN: %boogie -noinfer "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
procedure ReducingLambdaBodies() { | ||
var a, b: int; | ||
var f, g: [int]int; | ||
|
||
f := (lambda x: int :: a + b); | ||
g := (lambda x: int :: b + a); | ||
assert f == g; // should pass | ||
|
||
f := (lambda x: int :: x + a); | ||
g := (lambda x: int :: a + x); | ||
assert f == g; // should fail | ||
} | ||
|
||
procedure ReducingLambdaBodies2() { | ||
var a, b: int; | ||
var f, g: [int]int; | ||
var f2, g2: [int,int]int; | ||
|
||
f := (lambda x: int :: x + a); | ||
g := (lambda x: int :: a + x); | ||
assert f != g; // should fail | ||
} | ||
|
||
procedure ReducingLambdaBodies3() { | ||
var a, b: int; | ||
var f, g: [int,int]int; | ||
f := (lambda x, y: int :: x + y); | ||
g := (lambda x, y: int :: y + x); | ||
assert f == g; // should fail | ||
} | ||
|
||
procedure MultibleBoundVars() { | ||
var a, b: int; | ||
var f, g: [int,int,bool]bool; | ||
f := (lambda x: int, y: int, z: bool :: if y == (a - b) then x + (a + b * a) > b else z == (a > b)); | ||
g := (lambda x: int, y: int, z: bool :: if y == (b + a - 2*b) then x + (a * b + a) > b else z == (b < a)); | ||
assert f == g; // should pass | ||
} | ||
|
||
function g(int,int) : int; | ||
|
||
procedure Triggers'(w: int, w': int) { | ||
var a,b : [int]bool; | ||
a := (lambda x:int :: (forall u:int :: { g(u,w) } x == g(u,w))); | ||
b := (lambda y:int :: (forall v:int :: { g(v,w') } y == g(v,w'))); | ||
assert w == w' ==> a == b; | ||
b := (lambda y:int :: (forall v:int :: y == g(v,w'))); | ||
assert w == w' ==> a == b; // should fail because triggers are different | ||
} |
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,14 @@ | ||
LambdaLifting.bpl(14,2): Error BP5001: This assertion might not hold. | ||
Execution trace: | ||
LambdaLifting.bpl(8,4): anon0 | ||
LambdaLifting.bpl(24,2): Error BP5001: This assertion might not hold. | ||
Execution trace: | ||
LambdaLifting.bpl(22,4): anon0 | ||
LambdaLifting.bpl(32,2): Error BP5001: This assertion might not hold. | ||
Execution trace: | ||
LambdaLifting.bpl(30,4): anon0 | ||
LambdaLifting.bpl(51,2): Error BP5001: This assertion might not hold. | ||
Execution trace: | ||
LambdaLifting.bpl(47,4): anon0 | ||
|
||
Boogie program verifier finished with 1 verified, 4 errors |