-
Notifications
You must be signed in to change notification settings - Fork 296
goto-symex: keep composite quantifier bound variables as symbols #9077
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
Open
tautschnig
wants to merge
1
commit into
diffblue:develop
Choose a base branch
from
tautschnig:non-pod-bound-vars
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
16 changes: 16 additions & 0 deletions
16
regression/cbmc/Quantifiers-array-bound-var/exists_unsat.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 @@ | ||
| int main() | ||
| { | ||
| // Exercises the exists/assumption code path with an array-typed bound | ||
| // variable (renaming runs before quantifier rewriting). The quantifier is | ||
| // unsatisfiable (no array has a[0] < a[1] and a[1] < a[0]), so the | ||
| // assumption blocks every path and the assertion is vacuously unreachable; a | ||
| // dropped or mis-encoded array-typed bound variable would make it reachable | ||
| // and fail. | ||
| // clang-format off | ||
| __CPROVER_assume(__CPROVER_exists { int a[3]; a[0] < a[1] && a[1] < a[0] }); | ||
| // clang-format on | ||
|
|
||
| __CPROVER_assert(0, "unreachable: exists-assumption is unsatisfiable"); | ||
|
|
||
| return 0; | ||
| } |
12 changes: 12 additions & 0 deletions
12
regression/cbmc/Quantifiers-array-bound-var/exists_unsat.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 | ||
| exists_unsat.c | ||
|
|
||
| ^EXIT=0$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION SUCCESSFUL$ | ||
| -- | ||
| ^warning: ignoring | ||
| Exercises the exists/assumption code path with an array-typed bound variable: | ||
| the quantifier is unsatisfiable, so the assumption blocks all paths and the | ||
| assertion is vacuously unreachable. A dropped or mis-encoded bound variable | ||
| would make the assertion reachable and fail. |
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,14 @@ | ||
| int main() | ||
| { | ||
| // A universal quantifier with an array-typed bound variable. Like | ||
| // struct-typed bound variables, an array-typed bound variable must remain a | ||
| // symbol rather than being decomposed into an array expression by field | ||
| // sensitivity. | ||
| // clang-format off | ||
| __CPROVER_assert( | ||
| __CPROVER_forall { int a[3]; a[0] - a[0] == 0 }, | ||
| "holds for every array-typed bound variable"); | ||
| // clang-format on | ||
|
|
||
| return 0; | ||
| } |
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,13 @@ | ||
| int main() | ||
| { | ||
| // The body does not hold for every array (e.g. a[0] != a[1]), so | ||
| // verification must fail. This confirms the array-typed quantifier body is | ||
| // genuinely evaluated rather than the quantifier being silently dropped. | ||
| // clang-format off | ||
| __CPROVER_assert( | ||
| __CPROVER_forall { int a[3]; a[0] == a[1] }, | ||
| "does not hold for every array-typed bound variable"); | ||
| // clang-format on | ||
|
|
||
| return 0; | ||
| } |
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 | ||
| refuted.c | ||
|
|
||
| ^\[main\.assertion\.\d+\] .* does not hold for every array-typed bound variable: FAILURE$ | ||
| ^EXIT=10$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION FAILED$ | ||
| -- | ||
| ^warning: ignoring | ||
| Confirms the array-typed quantifier body is genuinely evaluated: a property | ||
| that does not hold for all arrays must be refuted. |
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 | ||
|
|
||
| ^\[main\.assertion\.\d+\] .* holds for every array-typed bound variable: SUCCESS$ | ||
| ^EXIT=0$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION SUCCESSFUL$ | ||
| -- | ||
| ^warning: ignoring | ||
| This tests that an array-typed quantifier bound variable does not trigger an | ||
| invariant violation ("quantified variable shall be a symbol"). |
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,20 @@ | ||
| struct point | ||
| { | ||
| int x; | ||
| int y; | ||
| }; | ||
|
|
||
| int main() | ||
| { | ||
| // An existential quantifier with a struct-typed bound variable exercises the | ||
| // assumption (exists) code path, where renaming happens before quantifier | ||
| // rewriting. The struct-typed bound variable must remain a symbol rather than | ||
| // being decomposed by field sensitivity during renaming. | ||
| // clang-format off | ||
| __CPROVER_assume(__CPROVER_exists { struct point p; p.x > p.y }); | ||
| // clang-format on | ||
|
|
||
| __CPROVER_assert(1 == 1, "reachable after exists-assumption"); | ||
|
|
||
| return 0; | ||
| } |
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,10 @@ | ||
| CORE | ||
| exists.c | ||
|
|
||
| ^EXIT=0$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION SUCCESSFUL$ | ||
| -- | ||
| ^warning: ignoring | ||
| Exercises the exists/assumption code path with a struct-typed bound variable, | ||
| where renaming runs before quantifier rewriting. |
22 changes: 22 additions & 0 deletions
22
regression/cbmc/Quantifiers-struct-bound-var/exists_unsat.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,22 @@ | ||
| struct point | ||
| { | ||
| int x; | ||
| int y; | ||
| }; | ||
|
|
||
| int main() | ||
| { | ||
| // Discriminating companion to exists.c on the exists/assumption path: this | ||
| // existential quantifier is unsatisfiable (no struct point p has p.x < p.y | ||
| // and p.y < p.x), so the assumption blocks every path and the assertion | ||
| // below is vacuously unreachable. If the struct-typed bound variable were | ||
| // dropped or the exists mis-encoded during renaming, the assumption would no | ||
| // longer block and the assertion would be reachable and fail. | ||
| // clang-format off | ||
| __CPROVER_assume(__CPROVER_exists { struct point p; p.x < p.y && p.y < p.x }); | ||
| // clang-format on | ||
|
|
||
| __CPROVER_assert(0, "unreachable: exists-assumption is unsatisfiable"); | ||
|
|
||
| return 0; | ||
| } |
13 changes: 13 additions & 0 deletions
13
regression/cbmc/Quantifiers-struct-bound-var/exists_unsat.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,13 @@ | ||
| CORE | ||
| exists_unsat.c | ||
|
|
||
| ^EXIT=0$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION SUCCESSFUL$ | ||
| -- | ||
| ^warning: ignoring | ||
| Discriminating companion to exists.c on the exists/assumption path: the | ||
| existential quantifier is unsatisfiable -- no struct point has p.x < p.y and | ||
| p.y < p.x -- so the assumption blocks all paths and the assertion is vacuously | ||
| unreachable. A dropped or mis-encoded bound variable would make the assertion | ||
| reachable and fail. |
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,20 @@ | ||
| struct point | ||
| { | ||
| int x; | ||
| int y; | ||
| }; | ||
|
|
||
| int main() | ||
| { | ||
| // A universal quantifier with a struct-typed bound variable exercises the | ||
| // assertion (forall) code path, where quantifier rewriting happens before | ||
| // renaming. The struct-typed bound variable must remain a symbol rather than | ||
| // being decomposed into a struct expression by field sensitivity. | ||
| // clang-format off | ||
| __CPROVER_assert( | ||
| __CPROVER_forall { struct point p; p.x - p.x == 0 }, | ||
| "holds for every struct-typed bound variable"); | ||
| // clang-format on | ||
|
|
||
| return 0; | ||
| } |
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,19 @@ | ||
| struct point | ||
| { | ||
| int x; | ||
| int y; | ||
| }; | ||
|
|
||
| int main() | ||
| { | ||
| // The body does not hold for every struct point (e.g. x != y), so | ||
| // verification must fail. This confirms that the quantifier body is genuinely | ||
| // evaluated rather than the quantifier being silently dropped. | ||
| // clang-format off | ||
| __CPROVER_assert( | ||
| __CPROVER_forall { struct point p; p.x == p.y }, | ||
| "does not hold for every struct-typed bound variable"); | ||
| // clang-format on | ||
|
|
||
| return 0; | ||
| } |
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 | ||
| refuted.c | ||
|
|
||
| ^\[main\.assertion\.\d+\] .* does not hold for every struct-typed bound variable: FAILURE$ | ||
| ^EXIT=10$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION FAILED$ | ||
| -- | ||
| ^warning: ignoring | ||
| Confirms the struct-typed quantifier body is genuinely evaluated: a property | ||
| that does not hold for all struct points must be refuted. |
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 | ||
|
|
||
| ^\[main\.assertion\.\d+\] .* holds for every struct-typed bound variable: SUCCESS$ | ||
| ^EXIT=0$ | ||
| ^SIGNAL=0$ | ||
| ^VERIFICATION SUCCESSFUL$ | ||
| -- | ||
| ^warning: ignoring | ||
| This tests that a struct-typed quantifier bound variable does not trigger an | ||
| invariant violation ("quantified variable shall be a symbol"). Field | ||
| sensitivity must not decompose the bound-variable symbol of a quantifier. |
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.