-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3902 use smt solver for equations (#3904)
This PR adds the SMT solver to the equation application function. Unclear side conditions for equations (those that could not be simplified to values in isolation) are checked (two-sided) using the SMT solver in context of the known path condition. This should reduce the amount of unclear conditions, and thereby enable more simplificaitons in boooster. Fixes #3902 --------- Co-authored-by: github-actions <github-actions@github.com>
- Loading branch information
Showing
18 changed files
with
4,120 additions
and
541 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module SIMPLIFY-SMT-SYNTAX | ||
imports INT | ||
imports BOOL | ||
imports STRING | ||
|
||
// testing SMT solver use during equation application | ||
|
||
syntax Thing ::= unevaluated ( Int, Int ) [function, symbol("unevaluated")] | ||
| evaluated ( String ) [symbol("evaluated")] | ||
endmodule | ||
|
||
module SIMPLIFY-SMT | ||
imports INT | ||
imports BOOL | ||
imports SIMPLIFY-SMT-SYNTAX | ||
|
||
// contradicting requires clauses: unclear in isolation, false when checked together | ||
rule [bad-requires]: | ||
unevaluated(A, B) => evaluated("contradicting requires clause") | ||
requires A *Int B <=Int 0 andBool A <Int B andBool B <Int A // should never apply | ||
[priority(10), preserves-definedness] | ||
// unclear without SMT solver, aborting function evaluation) | ||
|
||
// Should apply with the right path conditions about A and B. | ||
rule [good-requires]: | ||
unevaluated(A, B) => evaluated("A and B have the same sign and are not zero") | ||
requires 0 <Int A *Int B | ||
[priority(20), preserves-definedness] | ||
|
||
// contradicting ensures clauses: unclear in isolation, false when checked together | ||
rule [bad-ensures]: | ||
unevaluated(A, B) => evaluated("contradicting ensures clause") | ||
ensures A <Int B andBool B <Int A // should terminate the evaluation | ||
[priority(30), preserves-definedness] | ||
// would be added to the path condition without SMT solver | ||
|
||
endmodule |
Oops, something went wrong.