Repository navigation
Keep short-circuit paths in statement-expression quantifier bodies - #9221
Open
tautschnig wants to merge 1 commit into
Open
tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
When the body of __CPROVER_exists or __CPROVER_forall is a statement
expression, convert_statement_expression converts the body to a goto
program and collects "path condition implies value" for every path that
reaches the final expression. goto_convert converts that final
expression statement with its value unused. For a final expression such
as q < 4 && ({ ... }), the front end produces q < 4 ? ({ ... }) : false,
and with the value unused the false branch disappears: the path on which
q < 4 does not hold jumps past the final expression and contributes
nothing. The body a && b thus became a ==> b, and false exists and
forall assertions verified.
Assign the value of the final expression to a fresh temporary and use
that temporary as the final expression, so that both branches are
converted with their values used and every path reaches the final
expression.
A path that still bypasses the final expression, for example via a jump
past it, now results in an error: treating such a path as true is unsound
for assertions, treating it as false is unsound for assumptions.
The new test is tagged broken-z3-smt-backend like the other quantifier
tests, as Z3 returns a quantified expression as model value for these
properties.
Fixes diffblue#9189
Co-authored-by: Kiro <[email protected]>
tautschnig
requested review from
kroening,
peterschrammel and
remi-delmas-3000
as code owners
October 20, 2026 19:38
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9221 +/- ##
===========================================
- Coverage 80.91% 80.91% -0.01%
===========================================
Files 1718 1718
Lines 190266 190292 +26
Branches 73 73
===========================================
+ Hits 153952 153966 +14
- Misses 36314 36326 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When the body of __CPROVER_exists or __CPROVER_forall is a statement
expression, convert_statement_expression converts the body to a goto
program and collects "path condition implies value" for every path that
reaches the final expression. goto_convert converts that final
expression statement with its value unused. For a final expression such
as q < 4 && ({ ... }), the front end produces q < 4 ? ({ ... }) : false,
and with the value unused the false branch disappears: the path on which
q < 4 does not hold jumps past the final expression and contributes
nothing. The body a && b thus became a ==> b, and false exists and
forall assertions verified.
Assign the value of the final expression to a fresh temporary and use
that temporary as the final expression, so that both branches are
converted with their values used and every path reaches the final
expression.
A path that still bypasses the final expression, for example via a jump
past it, now results in an error: treating such a path as true is unsound
for assertions, treating it as false is unsound for assumptions.
The new test is tagged broken-z3-smt-backend like the other quantifier
tests, as Z3 returns a quantified expression as model value for these
properties.
Fixes #9189