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.
30 lines
761 B
30 lines
761 B
\item \self
|
|
Consider the following script. What are the outputs of the
|
|
two calls to \texttt{solver.check()}? Explain your answers.
|
|
In particular, elaborate the difference of using an \texttt{Int()} and a \texttt{BitVec()} for the variables.
|
|
|
|
\vskip7em
|
|
|
|
\begin{pythonSourceCode}
|
|
from z3 import *
|
|
|
|
solver = Solver()
|
|
|
|
intX = Int("intX")
|
|
bvX = BitVec("bvX", 2)
|
|
|
|
solver.push()
|
|
solver.add(bvX + 1 < bvX - 1)
|
|
result = solver.check()
|
|
print(result)
|
|
if result == sat:
|
|
print(solver.model())
|
|
solver.pop()
|
|
|
|
solver.push()
|
|
solver.add(intX + 1 < intX - 1)
|
|
result = solver.check()
|
|
print(result)
|
|
if result == sat:
|
|
print(solver.model())
|
|
\end{pythonSourceCode}
|