sosy-lab / java-smt

JavaSMT - Unified Java API for SMT solvers.
Apache License 2.0
182 stars 46 forks source link

More conversions between types #152

Closed PhilippWendler closed 4 years ago

PhilippWendler commented 5 years ago

Currently the API does not offer a possibility to convert for example between bitvector formulas and integer formulas, although at least MathSAT has support for this. The only type conversions offered are between floats and anything else via FloatingPointFormulaManager.cast* (but only conversions between floats and bitvectors are actually implemented), and between integers and rationals (because integers can be used in place of rationals).

We should

kfriedberger commented 5 years ago

Possible conversions are defined by SMTlib. We might need to check whether or how far the solvers support them.

I would suggest to allow the following conversions:

from \ to Int Real FP BV
Int :heavy_check_mark:= :heavy_check_mark:= real2fp :heavy_check_mark:nat2bv
Real :heavy_check_mark:floor :heavy_check_mark:= real2fp via Int or FP?
FP via Real? fp2real, NaN/Inf? fp2fp :heavy_check_mark:ieee_fp2bv
BV :heavy_check_mark:bv2nat :heavy_check_mark:bv2nat :heavy_check_mark:ieee_bv2fp :heavy_check_mark:extend/extract

and lets ignore Bool and Array theory. Some conversions are lossless, others use rounding and lose information.

Related commits:

kfriedberger commented 4 years ago

This seems to be sufficiently supported until now. Lets close this issue until we need more conversions.