-
Notifications
You must be signed in to change notification settings - Fork 18
Nonlin LA preds #790
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
base: master
Are you sure you want to change the base?
Nonlin LA preds #790
Conversation
d89fbf6 to
b1f40d9
Compare
b1f40d9 to
b300ed9
Compare
|
The code fails with this input Here's the output: |
c0605cd to
78b01bc
Compare
|
For our limited form of axioms this might actually be just enough. One thing is missing before I can put this to our production: To be sure that we're running the correct version, I'd need to have the version information from opensmt. See issue #800 . |
46d12d9 to
8acd08a
Compare
2810c10 to
32f3743
Compare
|
Ok, I think generally PR is over Though, we definitely need some sort of error handling, LANonLinearException produces errors with different format under different complilers rn. Should it be a different issue though? |
f765dab to
8399ba1
Compare
…olver, updated multiplication asserts
8399ba1 to
c974f2b
Compare
c974f2b to
469252e
Compare
0a88022 to
469252e
Compare
| { | ||
| assert(logic.isAtom(tr)); | ||
| assert(logic.isLeq(tr)); | ||
| auto [cons, sum] = logic.leqToConstantAndTerm(tr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| auto [cons, sum] = logic.leqToConstantAndTerm(tr); | |
| [[maybe_unused]] auto const [cons, sum] = logic.leqToConstantAndTerm(tr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also change the name of the function to assertIsProperLeq with [[maybe_unused]] PTRef tr
| assert(!logic.isTimes(sum) || ((logic.isNumVar(logic.getPterm(sum)[0]) && logic.isOne(logic.mkNeg(logic.getPterm(sum)[1]))) || | ||
| (logic.isNumVar(logic.getPterm(sum)[1]) && logic.isOne(logic.mkNeg(logic.getPterm(sum)[0]))))); | ||
| assert(logic.isPlus(sum) or logic.isTimesLin(sum) or logic.isMonomial(sum)); | ||
| (void) cons; (void)sum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (void) cons; (void)sum; |
|
|
||
| LVRef LASolver::getLAVar_single(PTRef expr_in) { | ||
|
|
||
| if (logic.isTimesNonlin(expr_in)) { throw NonLinException(logic.pp(expr_in)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do a function for this? Like logic.checkIsNotNonlin. Then, for example, changing the error message would be necessary to update in just one place.
| return newSymb(fname, rsort, args, SymConf::Default); | ||
| return newSymbImpl(fname, rsort, args, SymConf::Default, false); | ||
| } | ||
| SymRef newInternalSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add also the variant with the default config, as done in the case of newSymb.
| // Constructs a new symbol. | ||
| SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig); | ||
|
|
||
| SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig) { | |
| SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig = SymConf::Default) { |
| SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args) { | ||
| return newSymb(fname, rsort, args, SymConf::Default); | ||
| return newSymbImpl(fname, rsort, args, SymConf::Default, false); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
| SymRef SymStore::newSymbImpl(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig, | ||
| bool isInternal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I studied a bit Symbol.h, I believe we should integrate an internal flag into SymbolConfig (e.g. similarly to isInterpreted) instead of this isInternal parameter. This would be compatible with the existing code, allowing to use it also with declareFun etc. Connected to this, I think we should remove SymConf and instead allow graceful construction of SymbolConfig, possibly also adding some getters. For example, I see that noScoping implies isInterpreted (I dunno why, though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part of the code is very much historical, to put it nicely. noScoping would probably mean that the symbol is a reserved word. that could well be the reason why it's isInterpreted. I'm not convinced that the choices I made when introducing those fields were very informed. I encourage you to look at them with a critical eye.
Allows to create nonlin functions
Removed all of the constraints for the creation of nonlin predicates inside of the functions.
Only the assertions are checked for nonlinearity