-
Notifications
You must be signed in to change notification settings - Fork 273
SYNTHESIZER: Add enumerative loop invariant synthesizer #7430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
regression/goto-synthesizer/loop_contracts_synthesis_01/test.desc
This file contains hidden or 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
17 changes: 17 additions & 0 deletions
17
regression/goto-synthesizer/loop_contracts_synthesis_02/main.c
This file contains hidden or 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,17 @@ | ||
#define SIZE 80 | ||
|
||
void main() | ||
{ | ||
unsigned len; | ||
__CPROVER_assume(len <= SIZE); | ||
__CPROVER_assume(len >= 8); | ||
char *array = malloc(len); | ||
unsigned s = 0; | ||
|
||
for(unsigned i = 0; i < SIZE; ++i) | ||
{ | ||
if(i == len - 1) | ||
break; | ||
s += array[i]; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
regression/goto-synthesizer/loop_contracts_synthesis_02/test.desc
This file contains hidden or 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 @@ | ||
CORE | ||
main.c | ||
--pointer-check | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.pointer\_dereference.\d+\] .* SUCCESS$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
-- | ||
This test shows that loop invariants using range predicates can be correctly | ||
synthesized for programs with only pointer checks but no other assertions. |
16 changes: 16 additions & 0 deletions
16
regression/goto-synthesizer/loop_contracts_synthesis_03/main.c
This file contains hidden or 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,16 @@ | ||
#define SIZE 80 | ||
|
||
void main() | ||
{ | ||
unsigned long len; | ||
__CPROVER_assume(len <= SIZE); | ||
__CPROVER_assume(len >= 8); | ||
char *array = malloc(len); | ||
const char *end = array + len; | ||
unsigned s = 0; | ||
|
||
while(array != end) | ||
{ | ||
s += *array++; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
regression/goto-synthesizer/loop_contracts_synthesis_03/test.desc
This file contains hidden or 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,12 @@ | ||
CORE | ||
main.c | ||
--pointer-check | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.pointer\_dereference.\d+\] .* SUCCESS$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
-- | ||
This test shows that loop invariants using range predicates and same-object | ||
predicates can be correctly synthesized for programs with only pointer | ||
checks but no other assertions. |
17 changes: 17 additions & 0 deletions
17
regression/goto-synthesizer/loop_contracts_synthesis_04/main.c
This file contains hidden or 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,17 @@ | ||
#define SIZE 80 | ||
|
||
void main() | ||
{ | ||
unsigned long len; | ||
__CPROVER_assume(len <= SIZE); | ||
__CPROVER_assume(len >= 8); | ||
char *array = malloc(len); | ||
unsigned long s = 0; | ||
|
||
unsigned long j = 0; | ||
for(unsigned long i = 0; i < len; i++) | ||
{ | ||
s += array[j]; | ||
j++; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
regression/goto-synthesizer/loop_contracts_synthesis_04/test.desc
This file contains hidden or 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 @@ | ||
CORE | ||
main.c | ||
--pointer-check | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.pointer\_dereference.\d+\] .* SUCCESS$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
-- | ||
This test shows that the loop-invariant synthesizer can enumerate | ||
strengthening clauses for invariant-not-preserved violation. |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.