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

\item \self Given a 4-bit bitvector $x$, we want to check whether it is possible that $x \cdot 2 > x \cdot 4 $.
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", 4)
solver.add(UGT(bvX * 2,bvX * 4))
result = solver.check()
print(result)
if result == sat:
print(solver.model())
print(solver.model().evaluate(bvX * 2))
print(solver.model().evaluate(bvX * 4))
\end{pythonSourceCode}
\vskip3em