1

when I call z3 with the following piece of code

    (declare-const x Real)
    (assert (> x (* -1.79769 (^ 10.0 308.0))))
    (check-sat)
    (get-model)

then I get the following, expected (and right) answer:

    sat
    (model 
      (define-fun x () Real
        (+ 1.0 (* (- (/ 179769.0 100000.0)) (^ 10.0 308.0))))
    )

But sometimes I need to solve more complex problems where I need to specify a logic to get the right result, like AUFNIRA (which supports both integer/real and linear/non-linear arithmetics).

But none of these specific logics support the representation of scientific notation I used here by typing values like (* -1.7 (^ 10.0 308.0)) (which just represents -1.7e308 in the common scientific notation).

In particular, if I just add a set-logic command obtaining the code below

    (set-logic AUFNIRA)
    (declare-const x Real)
    (assert (> x (* -1.79769 (^ 10.0 308.0))))
    (check-sat)
    (get-model)

then I get the following error

    (error "line 3 column 38: unknown function/constant ^")
    sat
    (model 
    )

(note the empty model).

My question is: how is it possible that without specifying a logic the solver supports the power operator ^ and returns the right solution, but if I try to specify any logic then this error is returned?

I mean, if it works when no logic is specified it means that some logic must contain it, am I right? If yes, which logic does contain this operator?

According to this question I have tried all of the following logics:

BOOL, LIA, LRA, NIA, NRA, QF_LRA, QF_NIA, QF_NRA, QF_UFLIA, QF_UFLRA, QF_UFNIA, QF_UFNRA, UFLIRA, UFLRA, UFNIA, AUFNIRA

(yes, even the trivially unrelated one) but none of them seems to support the power operator. How is this possible?

Thank you

Community
  • 1
  • 1
Kubuntuer82
  • 1,487
  • 3
  • 18
  • 40

1 Answers1

1

The SMT-LIB logics are specified in smtlib.org. The power operator is not part of any SMT-LIB logics so the parser rejects such operators. The expectation when specifying an SMT-LIB logic is that the solver behaves according to the supported fragments. For operators, such as ^ there are no general decision procedure unless the second argument is a non-negative integer.

Nikolaj Bjorner
  • 8,229
  • 14
  • 15
  • Hi Nikolaj, many thanks for your answer. I understand what you mean, but if the `^` operator is rejected by all logics, then why does it work when no logic is specified? You say that probably it worked because the second argument is a non-negative integer, but in this case all logics like AUFNIRA should accept it, am I wrong? – Kubuntuer82 Sep 20 '16 at 20:02
  • When no logic is specified, Z3 enables all features, including those that are not part of any logics or theories. – Christoph Wintersteiger Oct 26 '16 at 12:26
  • Many thanks Cristoph for your further clarifying comment. – Kubuntuer82 Dec 05 '16 at 13:21
  • Hi Christoph, your answer is very interesting and caused another question coming up in my mind: you are mentioning 'features' saying that all of them are enabled when no logic is specified. Have such features corresponding objects in the Python API? If yes, I guess they could be activated manually, e.g. something like **s = z3.Solver() ; s.enableFeature(z3.features.powerOp)** ... is this correct? – Kubuntuer82 Dec 08 '16 at 12:26