Skip to content
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

How does one extend Z3 with new solvers / theories? #1764

Open
bollu opened this issue Jul 19, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@bollu
Copy link

commented Jul 19, 2018

Hello,

I was interested in understanding what the process is to extend Z3's theory, and add additional solvers for existing theories. Googling led me to StackOverflow answers which states that the plugin based architecture is deprecated.

I can't seem to find any up-to-date information about how to extend Z3.

For some context, I'm interested in plugging in isl (integer set library) into Z3 as a new solver for linear / affine constraints, and also expose some of the "extra" functionality that ISL provides, but I have no idea how to start.

Thanks!

@NikolajBjorner

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2018

For isl I would suggest cloning smt/theory_lra.cpp and smt/theory_lra.h.
Remove the code inside and stub it with your own code.
Adding solvers is a significant task, though. Not because of lack of documentation and background material, but mainly as it requires to understand well the invariants the code should maintain.
Primarily everthing is stack-based. The terms that are internalized within a scope level are only valid as long as the scope does not disappear. Theory solvers typically also maintain their own state that has to be properly scoped.
The comments in smt_theory.h provide some guidance about how the solver API is used.

NikolajBjorner added a commit to NikolajBjorner/z3 that referenced this issue Jul 29, 2018

fix Z3Prover#1762, Z3Prover#1764, Z3Prover#1768
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.