-
Notifications
You must be signed in to change notification settings - Fork 53
Add support for indexed functions #507
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?
Conversation
…like "extract" for bitvectors
…ends for Bitwuzla, CVC5, MathSAT, Princess and Z3
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.
My first thought was that we can actually model all indices as plain IntegerFormula-based arguments and just revert this encoding on usage. Seperating the concept of arguments into "args and indices" while still having methods that allow both, seems weird.
For example, BV_ROTATE_LEFT
exists in two versions, one with integer-based shift (modeled as index), one with IntegerFormula-based shift (modeled as argument).
Please give some more reason to model indices separatelly.
/** | ||
* @return List of indices for the function | ||
*/ | ||
ImmutableList<Integer> getIndices(); |
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.
Please extend the documentation for this interface method.
Here, we need some strong argument and description for differentiation between args and indices.
Hello Karlheinz,
I think this could work too, and in fact this seems to be close to what Princess is doing. There are a few caveats:
These issues can probably be solved, but I think from the user's perspective it would be less disruptive to simply extend
The difference between indices/parameters and arguments is that arguments can be any formula, while indices need to be constant values. So, for instance, in If we treat the indices as regular formulas this might cause issues as visitors would then have to remember that only constant values are allowed in this position. |
Hello,
this PR will add support for indexed functions to the JavaSMT API. In indexed functions take additional arguments that are not terms, but have to be constant. One example is
(_ extract i j)
for bitvector, which takes two more parametersi
andj
to specify the range of bits that should be returned. Whileextract
is available inBitvectorFormulaManager
and we can create the term in JavaSMT, we've so far lacked a way to access the indices in the visitor.In this PR we will address the problem by adding a new method
ImmutableList<Integer> getIndices()
to theFunctionDeclaration
API and implementing it for all solvers. In theFormulaVisitor
the method can then be used to get the values of the parameters from the function symbol:Open issues