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
634 B

\item \lect
Given a 2-bit bitvector $x$, we want to check whether it is possible that $x + 1 < x - 1$.
The following python script returns \texttt{sat}. Explain the error in the script and expand it such that it correctly prints \texttt{unsat}.
\vskip7em
\begin{pythonSourceCode}
from z3 import *
solver = Solver()
bvX = BitVec("bvX", 2)
solver.add(bvX + 1 < bvX - 1)
solver.add(BVAddNoOverflow(bvX, 1, True))
solver.add(BVSubNoUnderflow(bvX, 1, True))
result = solver.check()
print(result)
if result == sat:
print(solver.model())
\end{pythonSourceCode}