I have two SMT2-Lib scripts using reals that are morally equivalent. The only difference is that bit vectors are also used, and the other is not.
Here's the version that uses both real and bit vectors:
; uses both reals and bit-vectors (set-option :produce-models true) (define-fun s2 () Real (root-obj (+ (^ x 2) (- 2)) 2)) (define-fun s3 () Real 0.0) (define-fun s6 () Real (/ 1.0 1.0)) (declare-fun s0 () (_ BitVec 1)) (declare-fun s1 () (_ BitVec 1)) (assert (let ((s4 (- s3 s2))) (let ((s5 (ite (=
Here's a morally equivalent script, using Bool instead of a bit vector of size 1, otherwise it is essentially the same:
; uses reals only (set-option :produce-models true) (define-fun s2 () Real (root-obj (+ (^ x 2) (- 2)) 2)) (define-fun s3 () Real 0.0) (define-fun s6 () Real (/ 1.0 1.0)) (declare-fun s0 () (Bool)) (declare-fun s1 () (Bool)) (assert (let ((s4 (- s3 s2))) (let ((s5 (ite s1 s2 s4))) (let ((s7 (+ s5 s6))) (let ((s8 (- s5 s6))) (let ((s9 (ite s0 s7 s8))) (let ((s10 (ite (>= s9 s3)
For the former, I get unknown from z3 (v4.1 on Mac), and the latter nicely produces sat and model.
While SMT-Lib2 does not allow mixing reals and bit vectors, I thought that Z3 handles these combinations just fine. Am I mistaken? Is there a workaround?
(Note that these are generated scripts, so just using Bool instead of (_ BitVec 1) is quite expensive, as it requires very few changes elsewhere.)
source share