1

I want to transform the bitvector theory into int theory in Z3, and when encounter the "bvnot" operation, I relpace it with "not", here is a simple example:

(assert (= (bvnot (ite (bvsle t0 #x0a) #b1 #b0)) #b1)) and after transformation : (assert (= (not (ite (< t0 10) 1 0)) 1))

However, Z3 reported error with this assertion: invalid function application for not, sort mismatch on argument at position 1, expected Bool but given Int

How can I convert int sort to boolean sort? Tanhks!

Jin

J.Huang
  • 35
  • 5

1 Answers1

0

You already have everything in place, but the constants 1 and 0 are not Boolean values; the corresponding values are true and false, i.e., this should work:

(assert (= (not (ite (< t0 10) true false)) true))
Christoph Wintersteiger
  • 8,234
  • 1
  • 16
  • 30
  • yes, that works! but I want to know whether there are some converting functions to convert int sort into boolean sort, like int2bv or bv2int, which convert int sort and bitvector into each other. Thanks! – J.Huang Dec 21 '14 at 05:45
  • No there are not such functions, because there is no generally agreed upon way of how to perform this conversion, e.g., it is not clear whether '3' is the same as 'true' or 'false'. In your case, the preferred way of implementing the conversion is exactly as you did it. (And if we were to add it as a function, that's exactly what we would do internally.) – Christoph Wintersteiger Dec 29 '14 at 12:16