vector[Term] getValue(const vector[Term]& terms) except +
vector[Term] getModelDomainElements(Sort sort) except +
bint isModelCoreSymbol(Term v) except +
+ string getModel(const vector[Sort]& sorts,
+ const vector[Term]& consts) except +
void declareSepHeap(Sort locSort, Sort dataSort) except +
Term getValueSepHeap() except +
Term getValueSepNil() except +
"""
return self.csolver.isModelCoreSymbol(v.cterm)
+ def getModel(self, sorts, consts):
+ """Get the model
+
+ SMT-LIB:
+
+ .. code:: smtlib
+
+ (get-model)
+
+ Requires to enable option
+ :ref:`produce-models <lbl-option-produce-models>`.
+
+ :param sorts: The list of uninterpreted sorts that should be printed in
+ the model.
+ :param vars: The list of free constants that should be printed in the
+ model. A subset of these may be printed based on
+ isModelCoreSymbol.
+ :return: a string representing the model.
+ """
+
+ cdef vector[c_Sort] csorts
+ for sort in sorts:
+ csorts.push_back((<Sort?> sort).csort)
+
+ cdef vector[c_Term] cconsts
+ for const in consts:
+ cconsts.push_back((<Term?> const).cterm)
+
+ return self.csolver.getModel(csorts, cconsts)
+
def getValueSepHeap(self):
"""When using separation logic, obtain the term for the heap.
solver.isModelCoreSymbol(zero)
+def test_get_model(solver):
+ solver.setOption("produce-models", "true")
+ uSort = solver.mkUninterpretedSort("u")
+ x = solver.mkConst(uSort, "x")
+ y = solver.mkConst(uSort, "y")
+ z = solver.mkConst(uSort, "z")
+ f = solver.mkTerm(Kind.Not, solver.mkTerm(Kind.Equal, x, y))
+ solver.assertFormula(f)
+ solver.checkSat()
+ sorts = [uSort]
+ terms = [x, y]
+ solver.getModel(sorts, terms)
+ null = cvc5.Term(solver)
+ terms.append(null)
+ with pytest.raises(RuntimeError):
+ solver.getModel(sorts, terms)
+
+
+def test_get_model2(solver):
+ solver.setOption("produce-models", "true")
+ sorts = []
+ terms = []
+ with pytest.raises(RuntimeError):
+ solver.getModel(sorts, terms)
+
+
+def test_get_model3(solver):
+ solver.setOption("produce-models", "true")
+ sorts = []
+ terms = []
+ solver.checkSat()
+ solver.getModel(sorts, terms)
+ integer = solver.getIntegerSort()
+ sorts.append(integer)
+ with pytest.raises(RuntimeError):
+ solver.getModel(sorts, terms)
+
+
def test_issue5893(solver):
slv = cvc5.Solver()
bvsort4 = solver.mkBitVectorSort(4)