You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
539 B

2 months ago
  1. \item \lect
  2. Given a 2-bit bitvector $x$, we want to check whether it is possible that $x + 1 < x - 1$.
  3. The following python script returns \texttt{sat}. Explain the error in the script and expand it such that it correctly prints \texttt{unsat}.
  4. \vskip7em
  5. \begin{pythonSourceCode}
  6. from z3 import *
  7. solver = Solver()
  8. bvX = BitVec("bvX", 2)
  9. solver.add(bvX + 1 < bvX - 1)
  10. result = solver.check()
  11. print(result)
  12. if result == sat:
  13. print(solver.model())
  14. \end{pythonSourceCode}