Closed garganti closed 1 year ago
Interesting idea. Enum sort is available in several solvers. We just need to find a common basis for an implementation.
Overall, we could start with a few solvers supporting enumertion logic, and if we know enough about this kind of logic, then extend it to other solvers, based on a sub-set of datatype-logic.
Lets start with collecting some API examples:
Next step: We need to refine that information and test simple examples. :-)
I started with an initial interface, which is quite simple and understandable. We just need to wire the internals for each solver.
I've created a branch for this. Also, @RSoegtrop will take a look.
The new release JavaSMT 4.0.0 contains the requested enumeration theory, at least for some SMT solvers. We would be happy to get feedback or reports if there are any further issues.
It would be good if java-smt could support enum types (datatypes). An enum type has a name and a set of symbols. Variables can then be declared of that type and basic operations like = and
distinct
can be performed on formulas of that variables. Enum types are supported by SMT_LIB format (pag 61 of the language ref manual):Most of the solvers support them natively. For instance Z3, the following command creates a type
S
with three possible values:(declare-datatypes () ((S A B C)))
which has the corresponding java type in the APIs (DatatypeExpr)Other solvers have similar APIs. For instance yices:
type_t yices_new_scalar_type(uint32_t card)