Open Eladkay opened 1 month ago
More differences:
set_param
for global options:
z3.set_param("unsat_core", True)
z3.set_param("model", True)
z3.set_param("model_validate", True)
z3.set_param("model.completion", True)
This is not supported in CVC5 and I don't see an obvious alternative.
Solver.from_string
:
s = z3.Solver()
s.from_string("\n".join(query))
This is also not supported in CVC5 and in fact I'm not aware of any way to process SMTLIB programmatically in CVC5 (maybe I'm wrong though).
Model.sorts
that returns the list of sorts involved in the model:
z3sort_names = set(s.name() for s in z3sorts) | set(self.sorts.keys())
Not in CVC5.
Model.get_universe(SortRef)
returning all elements in the interpretation:
univ = z3model.get_universe(z3sort)
may return:
[node!val!4,
node!val!2,
node!val!5,
node!val!3,
node!val!0,
node!val!1]
Not in CVC5.
Two examples of differences of the CVC5 API to the Z3 API:
This function tries to block a model from a solver:
Z3 defines
model.decls()
as functions that need to be called, even for constants having arity 0. CVC5 does not even define thearity
method on constants (requiring thegetattr
trick above) nor thename
method (requiring the use ofstr
).For expressions that are of a datatype (ADT) sort, you can get the name of the constructor in Z3 like so:
In CVC5, this throws:
Probably because constructors are not considered uninterpreted function applications.