0

I tried to run the code below (taken directly from how to print output in hexadecimal format, who claimed it worked):

(set-logic QF_BV)
(set-info :smt-lib-version 2.0)

(declare-const val1  (_ BitVec 16))
(declare-const val2  (_ BitVec 16))

(declare-const gen_mul  (_ BitVec 16))
(declare-const eval1  (_ BitVec 32))
(declare-const eval2  (_ BitVec 32))
(declare-const org_mul  (_ BitVec 32))
(declare-const rem17 (_ BitVec 32))
(declare-const res (_ BitVec 16))

(assert (= gen_mul (bvmul val1 val2)))
(assert (= eval1 (concat #x0000 val1)))
(assert (= eval2 (concat #x0000 val2)))
(assert (= org_mul (bvmul eval1 eval2)))
(assert (= rem17 (bvurem org_mul #x00010001)))
(assert (= res ((_ extract 15 0) rem17)))
(assert (= val1 #xb621))
(assert (= val2 #xd620))
(check-sat)

(get-value (val1))
(get-value (val2))
(get-value (org_mul))
(get-value (gen_mul))
(get-value (eval1))
(get-value (eval2))
(get-value (org_mul))
(get-value (rem17))
(get-value (res))
(exit)

I tried running ./boolector ex.smt2, and got the following error: boolector: ex.smt2:4:2: expected command at 'declare-const'

Does anyone know what is wrong with this?

lightning
  • 389
  • 1
  • 9

1 Answers1

1

It appears Boolector doesn't support declare-const. Instead use declare-fun. That is, instead of writing:

(declare-const val1  (_ BitVec 16))

Write:

(declare-fun val1 () (_ BitVec 16))

Note the extra pair of parentheses after the name. You need to do this for each declare-const, but otherwise no other change should be necessary.

Strictly speaking this is a boolector shortcoming since declare-const is part of the SMTLib spec. See Section 4.2.3 of http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf. Notifying them might be a good idea.

alias
  • 28,120
  • 2
  • 23
  • 40