get-value call returns an expression instead of concrete value #b01:
sat
(((trans_local true true (_ bv2 2)) (ite #b10 #b01 (ite #b00 (ite #b10 #b11 #b01) (ite #b01 (ite #b10 #b10 #b00) #b01)))))
simplify results in the same way(and it probably should). How should I use get-value to get a correct result?
Here is the query:
(set-logic UFBV)
(set-option :produce-models true)
(define-fun trans_local ((x!1 (_ BitVec 2)) (x!2 Bool) (x!3 Bool)) (_ BitVec 2)
(ite (= x!1 #b10)
(ite x!2 #b01 #b00)
(ite (= x!1 #b00)
(ite (and x!2 x!3)
#b11
(ite (and (not x!2) x!3)
#b10
(ite (and (not x!2) (not x!3)) #b00 #b01)))
(ite (= x!1 #b01) (ite (and x!2 x!3) #b10 (ite (and (not x!2) x!3) #b10 #b00)) #b01)))
)
(check-sat)
(get-value ((trans_local true true (_ bv2 2))))
Your expression is not well sorted. In Z3,
define-funis essentially a macro. Z3 3.2 does not check if macro applications are well sorted. So, you did not get any error message. This has been fixed, and the fix will be available in the next release: Z3 4.0.That being said, you can get the expected result by fixing the sort error in the
get-valuestatement. I guess, you intended to write: