Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing universe for uninterpreted sort #7121

Closed
wintersteiger opened this issue Feb 14, 2024 · 1 comment
Closed

Missing universe for uninterpreted sort #7121

wintersteiger opened this issue Feb 14, 2024 · 1 comment

Comments

@wintersteiger
Copy link
Contributor

There seem to be some combinations of circumstances in which the uninterpreted sorts and their universes are not in the model. In the example below, both x and y are assigned the same mysort!val!0, but model.sorts() is empty and model.get_universe(S) says None. It's the solve-eqs tactic that solves the problem, so I suspect the bug must be around that area. (If the ~ is taken off of the constraint, it goes all the way through to the SMT solver and the model is correct.)

from z3 import *

z3.set_param("model", True)
z3.set_param("model.completion", True)

ctx = z3.Context(model=True)
slvr = z3.Solver(ctx=ctx)
slvr.set("model", True)
slvr.set("model.completion", True)

S = z3.DeclareSort("mysort", ctx)
x = z3.Const("x", S)
y = z3.Const("y", S)
slvr.append(~(x != y))

print("Solver: " + str(slvr))
print("Result: " + str(slvr.check()))
model = slvr.model()
print("Model: " + str(model))
print("Sorts: " + str(model.sorts()))
print("Universe: " + str(model.get_universe(S)))

print("Eval: " + str(model.eval(x, True)))

produces

Solver: [Not(x != y)]
Result: sat
Model: [y = mysort!val!0, x = mysort!val!0]
Sorts: []
Universe: None
Eval: mysort!val!0
@wintersteiger
Copy link
Contributor Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant