Is there an UnsignedIntSort in Z3?

前端 未结 2 1346
情深已故
情深已故 2021-01-22 12:31

I am using functions in my solver to model discrete time. The problem is that right now we use functions like z3.Function(\'f\', IntSort(), IntSort()) and negative

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-22 12:49

    There is no unsigned sort in SMT or Z3, because bit-vectors can trivially be used for this purpose. Bit-vectors hemselves are neither unsigned nor signed, but they are strings of bits. Signed and unsigned semantics are then implemented in separate functions, i.e., there is no generic less-than operator for bit-vectors, but there are bvult and bvslt for unsigned and signed less-than. Thus, as long as you stick to the unsigned flavours of all BV functions, you will always preserve unsigned semantics.

    Also, in models, bit-vectors are usually provided as bit-strings (in binary or hex), i.e., there are no negative values. Insofar, in your application, you can always assume all bit-vectors are unsigned until you start using the *s* functions.

提交回复
热议问题