z3py unconstrainted variables #7096
-
In SMT-LIB the following is straight forward but how to introduce unconstrained variables to the z3py Solver()?
returning
In z3py we have
which is not the same because it returns just
Ideas on how to introduce unconstrained variables into Solver()? Thanks David |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is related to this C++ API question. https://stackoverflow.com/questions/24457469/z3-c-api-get-value-of-a-const-with-no-constraints I'm curious as to the Python solution. David |
Beta Was this translation helpful? Give feedback.
-
Here is the answer: a = Int('a')
b = Int('b')
s1=Solver()
s1.add(a>10)
s1.check()
# Curious eval() updates the model to force a value for that variable!
s1.model().eval(a,True)
s1.model().eval(b,True)
print(s1.model()) results in
|
Beta Was this translation helpful? Give feedback.
Here is the answer:
results in