1

I'm passing the symbolic output of a symbolic execution engine to Z3 in SMT-LIB 2 format. I need it to truncate integers like they would be in C. So that (assert (= 1 (/ 3 2))) would be SAT.

These formulas might also have floats, so not all divisions should truncate. Just division of ints.

How does one do this?

HiDefender
  • 2,088
  • 2
  • 14
  • 31

1 Answers1

3

Integer division is simply called div:

(assert (= 1 (div 3 2)))
(check-sat)

This produces:

sat
alias
  • 28,120
  • 2
  • 23
  • 40