3
votes

I would like to construct an SMT formula having a number of assertions over integer linear arithmetic and Boolean variables as well as some assertions over real non-linear arithmetic and again Boolean variables. The assertions over integers and reals share only the Boolean variables. As an example, consider the following formula:

(declare-fun b () Bool)
(assert (= b true))

(declare-fun x () Int)
(declare-fun y () Int)
(declare-fun z () Int)
(assert (or (not b) (>= (+ x y) (- x (+ (* 2 z) 1)))))

(declare-fun r () Real)
(assert (or (not b) (= (+ (* r r) (* 3 r) (- 4)) 0)))

If I feed z3 with this formula, it immediately reports "unknown". But if I remove the integer part of it, I get the solution right away, which satisfies the constraint with variable "r". I presume this means that the non-linear constraint on its own is not hard for the solver. The issue should be in mixing (linear) constraints over integers and (non-linear) constraints over reals.

So my question is the following. What is the correct way to handle this kind of mixed formulas using z3 (if there is any)? My understanding of DPLL(T) is that it should be able to deal with such formulas using different theory solvers for different constraints. Please, correct me if I am wrong.

1
From my experience, non-linear arithmetic handler in Z3 is rather fragile, and can work or not depending on whether a pre-processing pass succeeds. In many cases you would be better off performing linearization on your side (e.g. replacing non-linear arithmetic with intervalization)George Karpenkov
Thank you! So you believe the problem has nothing to do theory mixing?Alexey Ignatiev
yes, that's what I think.George Karpenkov
There are two reasonable interpretations of which theories are involved in the above: the theory of mixed real and Integer, or the union of the theory of reals and the the theory of integers. AFAIK all SMT solvers interpret this as the theory of mixed reals and integers. QF non-linear mixed integer and real theory subsumes Hilbert's 10th problem. So there is one theory involved, it is undecidable, and it is outside of what the nlsat algorithm solves. You are likely outside of the guards for "do I apply nlsat?" and hitting a linear mixed solver. (Christoph, how can Alexey confirm that?)Tim
OK, thanks! I known about undecidability of non-linear integer arithmetic. But I am not an expert in SMT. So I though that a typical SMT solver should somehow be able to detect, which theory an assertion belongs to, and use the corresponding theory solver for that assertion (e.g. in my case linear integers solver for first assertion and non-linear reals solver for the second assertion). This was my understanding of how DPLL(T) works. But maybe in practice it is not the case (or my understanding is simply wrong) and SMT solvers try to use one theory solver for all assertions if that's possible.Alexey Ignatiev

1 Answers