Is it possible to cast a bitvector of one bit into a boolean variable in SMTLib2?

て烟熏妆下的殇ゞ 提交于 2019-12-01 21:22:18

Create an equality between the extraction of the third bit and a bit-vector with value 1 (and one bit).

E.g,

(declare-const x (_ BitVec 5))
(assert (= #b1 ((_ extract 2 2) x)))
(check-sat)
(get-model)

produces

sat
(model
  (define-fun x () (_ BitVec 5)
    #b00100)
)

What you are doing is just fine; it's just that bit0 is a reserved name. Just call it something else. (mybit0 would work, or some other unreserved name.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!