I do not think that you are doing something wrong, it seems that BV2Int is an error:
x = BitVec('x', 3) prove(x <= 3) prove(BV2Int(x) <= 3)
Z3py proves the first, but gives a counter example x=0 for the second. It doesnβt sound like that. (The only explanation might be some weird thing in Python, but I don't see how.)
Also note that the model you get will depend on whether the + bit vector is treated as a signed number in Python bindings, which I believe is the case. However, BV2Int may not do this, treating it as an unsigned value. This will further complicate the situation.
In any case, it looks like BV2Int not exactly kosher; I would stay away from him until the official response from the Z3 people.
source share