How does Z3 handle non-linear integer arithmetic?

Yes, the decision problem for nonlinear integer arithmetic is undecidable. We can encode the Halting problem for Turing machines in nonlinear integer arithmetic. I strongly recommend the beautiful book Hilbert’s tenth problem for anybody interested in this problem. Note that, if a formula has a solution, we can always find it by brute force. That … Read more

Z3: finding all satisfying models

One way to accomplish this is using one of the APIs, along with the model generation capability. You can then use the generated model from one satisfiability check to add constraints to prevent previous model values from being used in subsequent satisfiability checks, until there are no more satisfying assignments. Of course, you have to … Read more

Difference between Z3 and coq

Coq is an interactive theorem prover (aka proof assistant). It provides a language to write mathematical definitions, algorithms and theorems. It also provides an environment for producing machine checked proofs. Coq has been used to formalize mathematical theorems, and provide the semantics of programming languages. Today, we can find many papers at POPL that used … Read more

How incremental solving works in Z3?

Yes, there are essentially two incremental modes. Stack based: using push(), pop() you create a local context, that follows a stack discipline. Assertions added under a push() are removed after a matching pop(). Furthermore, any lemmas that are derived under a push are removed. Use push()/pop() to emulate freezing a state and adding additional constraints … Read more

tech