jConstraints-z3 is a plugin for jConstraints, adding Z3 as a constraint solver.
Z3 is not distributed along with jConstraints-z3, but is available at The Z3 Theorem Prover's website.
Note: Installing Z3 requires git
, python
, maven
, and a C++
compiler to be installed and to reside in your PATH
environment
variable.
The following instructions are taken from Leonardo de Moura's blog.
First, we have to clone Z3:
git clone https://github.com/Z3Prover/z3.git
Obtaining Z3 without Git: If you do not have Git, you can also download a source archive from Z3's website.
Next, we generate a Z3 Makefile with the --java
option.
python scripts/mk_make.py --java
Now, we build Z3
cd build
make all
Make sure to install libz3.so
and libz3java.so
(extension .dylib
in OSX) to a global library folder or to one that is contained in your
java.library.path
property (the LD_LIBRARY_PATH
for Linux and DYLD_LIBRARY_PATH
for OS X).
Install the com.microsoft.z3.jar
file from the build
directory of
your Z3 working copy into the local Maven directory:
mvn install:install-file -Dfile=com.microsoft.z3.jar -DgroupId=com.microsoft -DartifactId=z3 -Dversion=0.9 -Dpackaging=jar
- In the jConstraints-z3 folder, run
mvn install
- If the compilation was successful, the jConstraints-z3
library can be found in the JAR file
target/jconstraints-z3-[VERSION].jar
- jConstraints loads extensions automatically from the
~/.jconstraints/extensions
folder in the user's home directory. Create this directory and copycom.microsoft.z3.jar
(from Z3, see above) andjConstraints-z3-[version].jar
into this folder.
jconstraints-z3 supports setting some of the options in z3 via constructor parameters or configuration options:
z3.timeout=[timeout in millis]
z3.options=[option1]=[value1];[option2]=[value2];...
Example:
z3.timeout=2
z3.options=smt.mbqi=true;smt.macro-finder=true