-
Notifications
You must be signed in to change notification settings - Fork 43
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 #1003 from GaloisInc/lb/specs
uc-crux-llvm: User-provided specifications for functions
- Loading branch information
Showing
43 changed files
with
1,811 additions
and
146 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
crucible-syntax/test-data/simulator-tests/override-nondet-test-0.cbl
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,8 @@ | ||
(defun @main () Integer | ||
(start start: | ||
(let x (fresh Integer)) | ||
(let y (fresh Integer)) | ||
(let z (funcall @nondetBranchesTest 0 x y)) | ||
(assert! (equal? z x) "should be true!") | ||
(return z)) | ||
) |
4 changes: 4 additions & 0 deletions
4
crucible-syntax/test-data/simulator-tests/override-nondet-test-0.out.good
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,4 @@ | ||
==== Begin Simulation ==== | ||
|
||
==== Finish Simulation ==== | ||
==== No proof obligations ==== |
8 changes: 8 additions & 0 deletions
8
crucible-syntax/test-data/simulator-tests/override-nondet-test-1.cbl
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,8 @@ | ||
(defun @main () Integer | ||
(start start: | ||
(let x (fresh Integer)) | ||
(let y (fresh Integer)) | ||
(let z (funcall @nondetBranchesTest 1 x y)) | ||
(assert! (equal? z y) "should be true!") | ||
(return z)) | ||
) |
4 changes: 4 additions & 0 deletions
4
crucible-syntax/test-data/simulator-tests/override-nondet-test-1.out.good
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,4 @@ | ||
==== Begin Simulation ==== | ||
|
||
==== Finish Simulation ==== | ||
==== No proof obligations ==== |
11 changes: 11 additions & 0 deletions
11
crucible-syntax/test-data/simulator-tests/override-nondet-test-both.cbl
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,11 @@ | ||
(defun @main () Integer | ||
(start start: | ||
(let w (fresh Integer)) | ||
(let x (fresh Integer)) | ||
(let y (fresh Integer)) | ||
(assume! (or (equal? w 0) (equal? w 1)) "w is 0 or 1") | ||
(let z (funcall @nondetBranchesTest w x y)) | ||
(assert! (or (equal? z x) (equal? z y)) "should be true!") | ||
(assert! (or (equal? x y) (not (and (equal? z x) (equal? z y)))) "should be true!") | ||
(return z)) | ||
) |
72 changes: 72 additions & 0 deletions
72
crucible-syntax/test-data/simulator-tests/override-nondet-test-both.out.good
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,72 @@ | ||
==== Begin Simulation ==== | ||
|
||
==== Finish Simulation ==== | ||
==== Proof obligations ==== | ||
Assuming: | ||
* in main test-data/simulator-tests/override-nondet-test-both.cbl:6:5: w is 0 or 1 | ||
not (and (not (eq 0 cw@0:i)) (not (eq 1 cw@0:i))) | ||
* The branch in main from test-data/simulator-tests/override-nondet-test-both.cbl:7:12 to after branch 0 | ||
not (and (eq 0 cw@0:i) (eq 0 cnondetBranchesZ@11:i)) | ||
* The branch in nondetBranchesTest from after branch 0 to after branch 1 | ||
not (and (eq 1 cw@0:i) (eq 1 cnondetBranchesZ@11:i)) | ||
* The branch in nondetBranchesTest from after branch 1 to default branch | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v16 = eq 2 cnondetBranchesZ@11:i | ||
in and (not (eq 0 cw@0:i)) (not (eq 1 cw@0:i)) v16 | ||
Prove: | ||
default branch: error: in nondetBranchesTest | ||
fall-through branch | ||
false | ||
PROVED | ||
Assuming: | ||
* in main test-data/simulator-tests/override-nondet-test-both.cbl:6:5: w is 0 or 1 | ||
not (and (not (eq 0 cw@0:i)) (not (eq 1 cw@0:i))) | ||
* The branch in main from test-data/simulator-tests/override-nondet-test-both.cbl:7:12 to after branch 0 | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v7 = eq 0 cw@0:i | ||
-- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v12 = eq 0 cnondetBranchesZ@11:i | ||
in not (and v7 v12 (not (and v7 v12))) | ||
* The branch in nondetBranchesTest from after branch 0 to second branch | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:10:5 | ||
v43 = and (not (and (eq 0 cw@0:i) (eq 0 cnondetBranchesZ@11:i))) (not (and (eq 1 cw@0:i) (eq 1 cnondetBranchesZ@11:i))) | ||
in not v43 | ||
* The branch in main from test-data/simulator-tests/override-nondet-test-both.cbl:7:12 to first branch | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v7 = eq 0 cw@0:i | ||
-- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v12 = eq 0 cnondetBranchesZ@11:i | ||
in not (and v7 v12 (not (and v7 v12))) | ||
Prove: | ||
test-data/simulator-tests/override-nondet-test-both.cbl:8:5: error: in main | ||
should be true! | ||
let -- after branch 2 | ||
v28 = ite (and (eq 0 cw@0:i) (eq 0 cnondetBranchesZ@11:i)) cx@1:i cy@2:i | ||
in not (and (not (eq v28 cx@1:i)) (not (eq v28 cy@2:i))) | ||
PROVED | ||
Assuming: | ||
* in main test-data/simulator-tests/override-nondet-test-both.cbl:6:5: w is 0 or 1 | ||
not (and (not (eq 0 cw@0:i)) (not (eq 1 cw@0:i))) | ||
* The branch in main from test-data/simulator-tests/override-nondet-test-both.cbl:7:12 to after branch 0 | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v7 = eq 0 cw@0:i | ||
-- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v12 = eq 0 cnondetBranchesZ@11:i | ||
in not (and v7 v12 (not (and v7 v12))) | ||
* The branch in nondetBranchesTest from after branch 0 to second branch | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:10:5 | ||
v54 = and (not (and (eq 0 cw@0:i) (eq 0 cnondetBranchesZ@11:i))) (not (and (eq 1 cw@0:i) (eq 1 cnondetBranchesZ@11:i))) | ||
in not v54 | ||
* The branch in main from test-data/simulator-tests/override-nondet-test-both.cbl:7:12 to first branch | ||
let -- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v7 = eq 0 cw@0:i | ||
-- test-data/simulator-tests/override-nondet-test-both.cbl:7:12 | ||
v12 = eq 0 cnondetBranchesZ@11:i | ||
in not (and v7 v12 (not (and v7 v12))) | ||
Prove: | ||
test-data/simulator-tests/override-nondet-test-both.cbl:9:5: error: in main | ||
should be true! | ||
let -- after branch 2 | ||
v28 = ite (and (eq 0 cw@0:i) (eq 0 cnondetBranchesZ@11:i)) cx@1:i cy@2:i | ||
in not (and (eq v28 cx@1:i) (eq v28 cy@2:i) (not (eq cx@1:i cy@2:i))) | ||
PROVED |
9 changes: 9 additions & 0 deletions
9
crucible-syntax/test-data/simulator-tests/override-nondet-test-neither.cbl
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,9 @@ | ||
(defun @main () Integer | ||
(start start: | ||
(let w (fresh Integer)) | ||
(let x (fresh Integer)) | ||
(let y (fresh Integer)) | ||
(assume! (and (not (equal? w 0)) (not (equal? w 1))) "w is not 0 or 1") | ||
(let z (funcall @nondetBranchesTest w x y)) | ||
(return z)) | ||
) |
20 changes: 20 additions & 0 deletions
20
crucible-syntax/test-data/simulator-tests/override-nondet-test-neither.out.good
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,20 @@ | ||
==== Begin Simulation ==== | ||
|
||
==== Finish Simulation ==== | ||
==== Proof obligations ==== | ||
Assuming: | ||
* in main test-data/simulator-tests/override-nondet-test-neither.cbl:6:5: w is not 0 or 1 | ||
and (not (eq 0 cw@0:i)) (not (eq 1 cw@0:i)) | ||
* The branch in main from test-data/simulator-tests/override-nondet-test-neither.cbl:7:12 to after branch 0 | ||
not (and (eq 0 cw@0:i) (eq 0 cnondetBranchesZ@12:i)) | ||
* The branch in nondetBranchesTest from after branch 0 to after branch 1 | ||
not (and (eq 1 cw@0:i) (eq 1 cnondetBranchesZ@12:i)) | ||
* The branch in nondetBranchesTest from after branch 1 to default branch | ||
let -- test-data/simulator-tests/override-nondet-test-neither.cbl:7:12 | ||
v17 = eq 2 cnondetBranchesZ@12:i | ||
in and (not (eq 0 cw@0:i)) (not (eq 1 cw@0:i)) v17 | ||
Prove: | ||
default branch: error: in nondetBranchesTest | ||
fall-through branch | ||
false | ||
COUNTEREXAMPLE |
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
Oops, something went wrong.