| | | |
| | | ``Datatype dt = s.getDatatype();`` |
| | | |
-| | | ``Term ci = dt[i].getConstructorTerm();`` |
+| | | ``Term ci = dt[i].getTerm();`` |
| | | |
| | | ``Term r = solver.mkTerm(Kind::APPLY_CONSTRUCTOR, {ci, <Term_1>, ..., <Term_n>});`` |
+--------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| | | |
| | | ``Datatype dt = s.getDatatype();`` |
| | | |
-| | | ``Term sij = dt[i].getSelector(j).getSelectorTerm();`` |
+| | | ``Term sij = dt[i].getSelector(j).getTerm();`` |
| | | |
| | | ``Term r = solver.mkTerm(Kind::APPLY_SELECTOR, {sij, t});`` |
+--------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| | | |
| | | ``Datatype dt = s.getDatatype();`` |
| | | |
-| | | ``Term c = dt[0].getConstructorTerm();`` |
+| | | ``Term c = dt[0].getTerm();`` |
| | | |
| | | ``Term r = solver.mkTerm(Kind::APPLY_CONSTRUCTOR, {c, <Term_1>, ..., <Term_n>});`` |
+--------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| | | |
| | | ``Datatype dt = s.getDatatype();`` |
| | | |
-| | | ``Term sel = dt[0].getSelector(i).getSelectorTerm();`` |
+| | | ``Term sel = dt[0].getSelector(i).getTerm();`` |
| | | |
| | | ``Term r = solver.mkTerm(Kind::APPLY_SELECTOR, {sel, t});`` |
+--------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
| | | |
| | | ``Datatype dt = s.getDatatype();`` |
| | | |
-| | | ``Term c = dt[0].getConstructorTerm();`` |
+| | | ``Term c = dt[0].getTerm();`` |
| | | |
| | | ``Term r = solver.mkTerm(Kind::APPLY_CONSTRUCTOR, {c, <Term_1>, ..., <Term_n>});`` |
+--------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
// which is equivalent to consList["cons"].getConstructor(). Note that
// "nil" is a constructor too, so it needs to be applied with
// APPLY_CONSTRUCTOR, even though it has no arguments.
- Term t = slv.mkTerm(
- APPLY_CONSTRUCTOR,
- {consList.getConstructor("cons").getConstructorTerm(),
- slv.mkInteger(0),
- slv.mkTerm(APPLY_CONSTRUCTOR,
- {consList.getConstructor("nil").getConstructorTerm()})});
+ Term t = slv.mkTerm(APPLY_CONSTRUCTOR,
+ {consList.getConstructor("cons").getTerm(),
+ slv.mkInteger(0),
+ slv.mkTerm(APPLY_CONSTRUCTOR,
+ {consList.getConstructor("nil").getTerm()})});
std::cout << "t is " << t << std::endl
<< "sort of cons is "
- << consList.getConstructor("cons").getConstructorTerm().getSort()
- << std::endl
+ << consList.getConstructor("cons").getTerm().getSort() << std::endl
<< "sort of nil is "
- << consList.getConstructor("nil").getConstructorTerm().getSort()
- << std::endl;
+ << consList.getConstructor("nil").getTerm().getSort() << std::endl;
// t2 = head(cons 0 nil), and of course this can be evaluated
//
// Here we first get the DatatypeConstructor for cons (with
// consList["cons"]) in order to get the "head" selector symbol
// to apply.
- Term t2 =
- slv.mkTerm(APPLY_SELECTOR,
- {consList["cons"].getSelector("head").getSelectorTerm(), t});
+ Term t2 = slv.mkTerm(APPLY_SELECTOR,
+ {consList["cons"].getSelector("head").getTerm(), t});
std::cout << "t2 is " << t2 << std::endl
<< "simplify(t2) is " << slv.simplify(t2) << std::endl
std::cout << "term " << a << " is of sort " << a.getSort() << std::endl;
Term head_a = slv.mkTerm(
- APPLY_SELECTOR,
- {paramConsList["cons"].getSelector("head").getSelectorTerm(), a});
- std::cout
- << "head_a is " << head_a << " of sort " << head_a.getSort() << std::endl
- << "sort of cons is "
- << paramConsList.getConstructor("cons").getConstructorTerm().getSort()
- << std::endl
- << std::endl;
+ APPLY_SELECTOR, {paramConsList["cons"].getSelector("head").getTerm(), a});
+ std::cout << "head_a is " << head_a << " of sort " << head_a.getSort()
+ << std::endl
+ << "sort of cons is "
+ << paramConsList.getConstructor("cons").getTerm().getSort()
+ << std::endl
+ << std::endl;
Term assertion = slv.mkTerm(GT, {head_a, slv.mkInteger(50)});
std::cout << "Assert " << assertion << std::endl;
// "nil" is a constructor too, so it needs to be applied with
// APPLY_CONSTRUCTOR, even though it has no arguments.
Term t = slv.mkTerm(Kind.APPLY_CONSTRUCTOR,
- consList.getConstructor("cons").getConstructorTerm(),
+ consList.getConstructor("cons").getTerm(),
slv.mkInteger(0),
- slv.mkTerm(Kind.APPLY_CONSTRUCTOR, consList.getConstructor("nil").getConstructorTerm()));
+ slv.mkTerm(Kind.APPLY_CONSTRUCTOR, consList.getConstructor("nil").getTerm()));
System.out.println("t is " + t + "\n"
- + "sort of cons is " + consList.getConstructor("cons").getConstructorTerm().getSort() + "\n"
- + "sort of nil is " + consList.getConstructor("nil").getConstructorTerm().getSort());
+ + "sort of cons is " + consList.getConstructor("cons").getTerm().getSort() + "\n"
+ + "sort of nil is " + consList.getConstructor("nil").getTerm().getSort());
// t2 = head(cons 0 nil), and of course this can be evaluated
//
// Here we first get the DatatypeConstructor for cons (with
// consList["cons"]) in order to get the "head" selector symbol
// to apply.
- Term t2 = slv.mkTerm(Kind.APPLY_SELECTOR,
- consList.getConstructor("cons").getSelector("head").getSelectorTerm(),
- t);
+ Term t2 = slv.mkTerm(
+ Kind.APPLY_SELECTOR, consList.getConstructor("cons").getSelector("head").getTerm(), t);
System.out.println("t2 is " + t2 + "\n"
+ "simplify(t2) is " + slv.simplify(t2) + "\n");
Term a = slv.mkConst(paramConsIntListSort, "a");
System.out.println("term " + a + " is of sort " + a.getSort());
- Term head_a = slv.mkTerm(Kind.APPLY_SELECTOR,
- paramConsList.getConstructor("cons").getSelector("head").getSelectorTerm(),
- a);
+ Term head_a = slv.mkTerm(
+ Kind.APPLY_SELECTOR, paramConsList.getConstructor("cons").getSelector("head").getTerm(), a);
System.out.println("head_a is " + head_a + " of sort " + head_a.getSort() + "\n"
- + "sort of cons is " + paramConsList.getConstructor("cons").getConstructorTerm().getSort()
- + "\n");
+ + "sort of cons is " + paramConsList.getConstructor("cons").getTerm().getSort() + "\n");
Term assertion = slv.mkTerm(Kind.GT, head_a, slv.mkInteger(50));
System.out.println("Assert " + assertion);
slv.assertFormula(assertion);
// (assert (forall ((x Person)) (not (set.member (mkTuple x x) ancestor))))
Term var = solver.mkVar(personSort, "x");
DatatypeConstructor constructor = tupleArity2.getDatatype().getConstructor(0);
- Term xxTuple = solver.mkTerm(APPLY_CONSTRUCTOR, constructor.getConstructorTerm(), var, var);
+ Term xxTuple = solver.mkTerm(APPLY_CONSTRUCTOR, constructor.getTerm(), var, var);
Term member = solver.mkTerm(SET_MEMBER, xxTuple, ancestor);
Term notMember = solver.mkTerm(NOT, member);
t = slv.mkTerm(
Kind.APPLY_CONSTRUCTOR,
- consList.getConstructor("cons").getConstructorTerm(),
+ consList.getConstructor("cons").getTerm(),
slv.mkInteger(0),
slv.mkTerm(
Kind.APPLY_CONSTRUCTOR,
- consList.getConstructor("nil").getConstructorTerm()))
+ consList.getConstructor("nil").getTerm()))
print("t is {}\nsort of cons is {}\n sort of nil is {}".format(
t,
- consList.getConstructor("cons").getConstructorTerm().getSort(),
- consList.getConstructor("nil").getConstructorTerm().getSort()))
+ consList.getConstructor("cons").getTerm().getSort(),
+ consList.getConstructor("nil").getTerm().getSort()))
# t2 = head(cons 0 nil), and of course this can be evaluated
#
t2 = slv.mkTerm(
Kind.APPLY_SELECTOR,
- consList["cons"].getSelector("head").getSelectorTerm(),
+ consList["cons"].getSelector("head").getTerm(),
t)
print("t2 is {}\nsimplify(t2) is {}\n\n".format(t2, slv.simplify(t2)))
head_a = slv.mkTerm(
Kind.APPLY_SELECTOR,
- paramConsList["cons"].getSelector("head").getSelectorTerm(),
+ paramConsList["cons"].getSelector("head").getTerm(),
a)
print("head_a is {} of sort {}".format(head_a, head_a.getSort()))
print("sort of cons is",
- paramConsList.getConstructor("cons").getConstructorTerm().getSort())
+ paramConsList.getConstructor("cons").getTerm().getSort())
assertion = slv.mkTerm(Kind.GT, head_a, slv.mkInteger(50))
print("Assert", assertion)
CVC5_API_TRY_CATCH_END;
}
-Term DatatypeSelector::getSelectorTerm() const
+Term DatatypeSelector::getTerm() const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_CHECK_NOT_NULL;
CVC5_API_TRY_CATCH_END;
}
-Term DatatypeConstructor::getConstructorTerm() const
+Term DatatypeConstructor::getTerm() const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_CHECK_NOT_NULL;
Sort s = mkTupleSortHelper(sorts);
Datatype dt = s.getDatatype();
internal::NodeBuilder nb(extToIntKind(APPLY_CONSTRUCTOR));
- nb << *dt[0].getConstructorTerm().d_node;
+ nb << *dt[0].getTerm().d_node;
nb.append(args);
internal::Node res = nb.constructNode();
(void)res.getType(true); /* kick off type checking */
* Get the selector operator of this datatype selector.
* @return the selector term
*/
- Term getSelectorTerm() const;
+ Term getTerm() const;
/**
* Get the updater operator of this datatype selector.
* Get the constructor operator of this datatype constructor.
* @return the constructor term
*/
- Term getConstructorTerm() const;
+ Term getTerm() const;
/**
* Get the constructor operator of this datatype constructor whose return
*
* - Arity: ``n > 0``
*
- * - ``1:`` DatatypeConstructor Term (see DatatypeConstructor::getConstructorTerm() const)
+ * - ``1:`` DatatypeConstructor Term (see DatatypeConstructor::getTerm() const)
* - ``2..n:`` Terms of the Sorts of the selectors of the constructor (the arguments to the constructor)
*
* - Create Term of this Kind with:
*
* - Arity: ``2``
*
- * - ``1:`` DatatypeSelector Term (see DatatypeSelector::getSelectorTerm() const)
+ * - ``1:`` DatatypeSelector Term (see DatatypeSelector::getTerm() const)
* - ``2:`` Term of the codomain Sort of the selector
*
* - Create Term of this Kind with:
* Get the constructor operator of this datatype constructor.
* @return the constructor term
*/
- public Term getConstructorTerm()
+ public Term getTerm()
{
- long termPointer = getConstructorTerm(pointer);
+ long termPointer = getTerm(pointer);
return new Term(solver, termPointer);
}
- private native long getConstructorTerm(long pointer);
+ private native long getTerm(long pointer);
/**
* Get the constructor operator of this datatype constructor whose return
* Get the selector operator of this datatype selector.
* @return the selector term
*/
- public Term getSelectorTerm()
+ public Term getTerm()
{
- long termPointer = getSelectorTerm(pointer);
+ long termPointer = getTerm(pointer);
return new Term(solver, termPointer);
}
- private native long getSelectorTerm(long pointer);
+ private native long getTerm(long pointer);
/**
* Get the upater operator of this datatype selector.
/*
* Class: io_github_cvc5_DatatypeConstructor
- * Method: getConstructorTerm
+ * Method: getTerm
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_DatatypeConstructor_getConstructorTerm(JNIEnv* env,
- jobject,
- jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_DatatypeConstructor_getTerm(
+ JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
DatatypeConstructor* current = (DatatypeConstructor*)pointer;
- Term* retPointer = new Term(current->getConstructorTerm());
+ Term* retPointer = new Term(current->getTerm());
return (jlong)retPointer;
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
/*
* Class: io_github_cvc5_DatatypeSelector
- * Method: getSelectorTerm
+ * Method: getTerm
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_DatatypeSelector_getSelectorTerm(JNIEnv* env,
- jobject,
- jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_DatatypeSelector_getTerm(
+ JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
DatatypeSelector* current = (DatatypeSelector*)pointer;
- Term* retPointer = new Term(current->getSelectorTerm());
+ Term* retPointer = new Term(current->getTerm());
return (jlong)retPointer;
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
DatatypeSelector operator[](size_t idx) except +
DatatypeSelector operator[](const string& name) except +
string getName() except +
- Term getConstructorTerm() except +
+ Term getTerm() except +
Term getInstantiatedConstructorTerm(const Sort& retSort) except +
Term getTesterTerm() except +
size_t getNumSelectors() except +
cdef cppclass DatatypeSelector:
DatatypeSelector() except +
string getName() except +
- Term getSelectorTerm() except +
+ Term getTerm() except +
Term getUpdaterTerm() except +
Sort getCodomainSort() except +
bint isNull() except +
"""
return self.cdc.getName().decode()
- def getConstructorTerm(self):
+ def getTerm(self):
"""
:return: The constructor operator as a term.
"""
cdef Term term = Term(self.solver)
- term.cterm = self.cdc.getConstructorTerm()
+ term.cterm = self.cdc.getTerm()
return term
def getInstantiatedConstructorTerm(self, Sort retSort):
"""
return self.cds.getName().decode()
- def getSelectorTerm(self):
+ def getTerm(self):
"""
:return: The selector opeartor of this datatype selector as a term.
"""
cdef Term term = Term(self.solver)
- term.cterm = self.cds.getSelectorTerm()
+ term.cterm = self.cds.getTerm()
return term
def getUpdaterTerm(self):
for (size_t j = 0, ncons = dt.getNumConstructors(); j < ncons; j++)
{
const cvc5::DatatypeConstructor& ctor = dt[j];
- cvc5::Term constructor = ctor.getConstructorTerm();
+ cvc5::Term constructor = ctor.getTerm();
Trace("parser-idt") << "+ define " << constructor << std::endl;
string constructorName = ctor.getName();
if(consNames.find(constructorName)==consNames.end()) {
for (size_t k = 0, nargs = ctor.getNumSelectors(); k < nargs; k++)
{
const cvc5::DatatypeSelector& sel = ctor[k];
- cvc5::Term selector = sel.getSelectorTerm();
+ cvc5::Term selector = sel.getTerm();
Trace("parser-idt") << "+++ define " << selector << std::endl;
string selectorName = sel.getName();
if(selNames.find(selectorName)==selNames.end()) {
cvc5::Term ret;
if (p.d_kind == cvc5::APPLY_SELECTOR)
{
- ret = d_solver->mkTerm(cvc5::APPLY_SELECTOR,
- {dt[0][n].getSelectorTerm(), args[0]});
+ ret =
+ d_solver->mkTerm(cvc5::APPLY_SELECTOR, {dt[0][n].getTerm(), args[0]});
}
else
{
DatatypeConstructor consConstr = d[0];
DatatypeConstructor nilConstr = d[1];
ASSERT_THROW(d[2], CVC5ApiException);
- ASSERT_NO_THROW(consConstr.getConstructorTerm());
- ASSERT_NO_THROW(nilConstr.getConstructorTerm());
+ ASSERT_NO_THROW(consConstr.getTerm());
+ ASSERT_NO_THROW(nilConstr.getTerm());
}
TEST_F(TestApiBlackDatatype, isNull)
ASSERT_TRUE(dt.isWellFounded());
// get constructor
DatatypeConstructor dcons = dt[0];
- Term consTerm = dcons.getConstructorTerm();
+ Term consTerm = dcons.getTerm();
ASSERT_EQ(dcons.getNumSelectors(), 2);
// create datatype sort to test
Term testConsTerm;
// get the specialized constructor term for list[Int]
ASSERT_NO_THROW(testConsTerm = nilc.getInstantiatedConstructorTerm(listInt));
- ASSERT_NE(testConsTerm, nilc.getConstructorTerm());
+ ASSERT_NE(testConsTerm, nilc.getTerm());
// error to get the specialized constructor term for Int
ASSERT_THROW(nilc.getInstantiatedConstructorTerm(isort), CVC5ApiException);
}
Term t1 = d_solver.mkConst(isort1, "t");
Term t0 = d_solver.mkTerm(
APPLY_SELECTOR,
- {t1.getSort().getDatatype().getSelector("s1").getSelectorTerm(), t1});
+ {t1.getSort().getDatatype().getSelector("s1").getTerm(), t1});
ASSERT_EQ(dt_sorts[0].instantiate({d_solver.getBooleanSort()}), t0.getSort());
/* Note: More tests are in datatype_api_black. */
Datatype list = listSort.getDatatype();
// list datatype constructor and selector operator terms
- Term consTerm = list.getConstructor("cons").getConstructorTerm();
- Term nilTerm = list.getConstructor("nil").getConstructorTerm();
- Term headTerm = list["cons"].getSelector("head").getSelectorTerm();
- Term tailTerm = list["cons"]["tail"].getSelectorTerm();
+ Term consTerm = list.getConstructor("cons").getTerm();
+ Term nilTerm = list.getConstructor("nil").getTerm();
+ Term headTerm = list["cons"].getSelector("head").getTerm();
+ Term tailTerm = list["cons"]["tail"].getTerm();
// mkTerm(Op op, Term term) const
ASSERT_NO_THROW(d_solver.mkTerm(APPLY_CONSTRUCTOR, {nilTerm}));
Sort consListSort = d_solver.mkDatatypeSort(consListSpec);
Datatype consList = consListSort.getDatatype();
- Term consTerm = consList.getConstructor("cons").getConstructorTerm();
- Term nilTerm = consList.getConstructor("nil").getConstructorTerm();
- Term headTerm = consList["cons"].getSelector("head").getSelectorTerm();
+ Term consTerm = consList.getConstructor("cons").getTerm();
+ Term nilTerm = consList.getConstructor("nil").getTerm();
+ Term headTerm = consList["cons"].getSelector("head").getTerm();
Term listnil = d_solver.mkTerm(APPLY_CONSTRUCTOR, {nilTerm});
Term listcons1 = d_solver.mkTerm(APPLY_CONSTRUCTOR,
Datatype consList = consListSort.getDatatype();
Term dt1 = d_solver.mkTerm(
APPLY_CONSTRUCTOR,
- {consList.getConstructor("cons").getConstructorTerm(),
+ {consList.getConstructor("cons").getTerm(),
d_solver.mkInteger(0),
d_solver.mkTerm(APPLY_CONSTRUCTOR,
- {consList.getConstructor("nil").getConstructorTerm()})});
+ {consList.getConstructor("nil").getTerm()})});
ASSERT_NO_THROW(d_solver.simplify(dt1));
Term dt2 = d_solver.mkTerm(
- APPLY_SELECTOR,
- {consList["cons"].getSelector("head").getSelectorTerm(), dt1});
+ APPLY_SELECTOR, {consList["cons"].getSelector("head").getTerm(), dt1});
ASSERT_NO_THROW(d_solver.simplify(dt2));
Term b1 = d_solver.mkVar(bvSort, "b1");
for (size_t i = 0; i < indices.size(); i++)
{
- Term selectorTerm = constructor[indices[i]].getSelectorTerm();
+ Term selectorTerm = constructor[indices[i]].getTerm();
Term selectedTerm = d_solver.mkTerm(APPLY_SELECTOR, {selectorTerm, tuple});
Term simplifiedTerm = d_solver.simplify(selectedTerm);
ASSERT_EQ(elements[indices[i]], simplifiedTerm);
Term bvl = d_solver.mkTerm(d_solver.mkOp(VARIABLE_LIST), {t452});
Term acons = d_solver.mkTerm(
d_solver.mkOp(APPLY_CONSTRUCTOR),
- {s4.getDatatype().getConstructor("_x115").getConstructorTerm(), t452});
+ {s4.getDatatype().getConstructor("_x115").getTerm(), t452});
// type exception
ASSERT_THROW(
d_solver.mkTerm(d_solver.mkOp(APPLY_CONSTRUCTOR), {bvl, acons, t452}),
dtdecl.addConstructor(cdecl);
Sort s7 = d_solver.mkDatatypeSort(dtdecl);
Sort s9 = s7.instantiate({s2});
- Term t1507 = d_solver.mkTerm(
- APPLY_CONSTRUCTOR,
- {s9.getDatatype().getConstructor("_x184").getConstructorTerm(), t7});
- ASSERT_NO_THROW(d_solver.mkTerm(APPLY_UPDATER,
- {s9.getDatatype()
- .getConstructor("_x186")
- .getSelector("_x185")
- .getSelectorTerm(),
- t1507,
- t7}));
+ Term t1507 =
+ d_solver.mkTerm(APPLY_CONSTRUCTOR,
+ {s9.getDatatype().getConstructor("_x184").getTerm(), t7});
+ ASSERT_NO_THROW(d_solver.mkTerm(
+ APPLY_UPDATER,
+ {s9.getDatatype().getConstructor("_x186").getSelector("_x185").getTerm(),
+ t1507,
+ t7}));
}
TEST_F(TestApiBlackSolver, proj_issue379)
Term t82 = d_solver.mkTerm(MATCH, {t13, t53, t53, t53, t81});
Term t325 = d_solver.mkTerm(
APPLY_SELECTOR,
- {t82.getSort().getDatatype().getSelector("_x19").getSelectorTerm(), t82});
+ {t82.getSort().getDatatype().getSelector("_x19").getTerm(), t82});
ASSERT_NO_THROW(d_solver.simplify(t325));
}
.getDatatype()
.getConstructor("_cons64")
.getSelector("_sel62")
- .getSelectorTerm();
+ .getTerm();
Term t274 = slv.mkTerm(APPLY_SELECTOR, {sel, t47});
Term t488 = slv.mkTerm(Kind::APPLY_UF, {t31, t274});
slv.assertFormula({t488});
Sort consListSort = d_solver.mkDatatypeSort(consListSpec);
Datatype consList = consListSort.getDatatype();
- Term nilTerm = consList.getConstructor("nil").getConstructorTerm();
- Term consTerm = consList.getConstructor("cons").getConstructorTerm();
- Term headTerm = consList["cons"].getSelector("head").getSelectorTerm();
+ Term nilTerm = consList.getConstructor("nil").getTerm();
+ Term consTerm = consList.getConstructor("cons").getTerm();
+ Term headTerm = consList["cons"].getSelector("head").getTerm();
Term listnil = d_solver.mkTerm(APPLY_CONSTRUCTOR, {nilTerm});
Term listcons1 = d_solver.mkTerm(APPLY_CONSTRUCTOR,
{
Sort dt_sort = create_datatype_sort();
Datatype dt = dt_sort.getDatatype();
- Sort cons_sort = dt[0].getConstructorTerm().getSort();
+ Sort cons_sort = dt[0].getTerm().getSort();
ASSERT_TRUE(cons_sort.isDatatypeConstructor());
ASSERT_NO_THROW(Sort().isDatatypeConstructor());
}
{
Sort dt_sort = create_datatype_sort();
Datatype dt = dt_sort.getDatatype();
- Sort cons_sort = dt[0][1].getSelectorTerm().getSort();
+ Sort cons_sort = dt[0][1].getTerm().getSort();
ASSERT_TRUE(cons_sort.isDatatypeSelector());
ASSERT_NO_THROW(Sort().isDatatypeSelector());
}
// get constructor
DatatypeConstructor dcons = dt[0];
- Term consTerm = dcons.getConstructorTerm();
+ Term consTerm = dcons.getTerm();
Sort consSort = consTerm.getSort();
ASSERT_TRUE(consSort.isDatatypeConstructor());
ASSERT_FALSE(consSort.isDatatypeTester());
// get selector
DatatypeSelector dselTail = dcons[1];
- Term tailTerm = dselTail.getSelectorTerm();
+ Term tailTerm = dselTail.getTerm();
ASSERT_TRUE(tailTerm.getSort().isDatatypeSelector());
ASSERT_EQ(tailTerm.getSort().getDatatypeSelectorDomainSort(), dtypeSort);
ASSERT_EQ(tailTerm.getSort().getDatatypeSelectorCodomainSort(), dtypeSort);
Term c = d_solver.mkConst(intListSort, "c");
Datatype list = listSort.getDatatype();
// list datatype constructor and selector operator terms
- Term consOpTerm = list.getConstructor("cons").getConstructorTerm();
- Term nilOpTerm = list.getConstructor("nil").getConstructorTerm();
- Term headOpTerm = list["cons"].getSelector("head").getSelectorTerm();
- Term tailOpTerm = list["cons"].getSelector("tail").getSelectorTerm();
+ Term consOpTerm = list.getConstructor("cons").getTerm();
+ Term nilOpTerm = list.getConstructor("nil").getTerm();
+ Term headOpTerm = list["cons"].getSelector("head").getTerm();
+ Term tailOpTerm = list["cons"].getSelector("tail").getTerm();
Term nilTerm = d_solver.mkTerm(APPLY_CONSTRUCTOR, {nilOpTerm});
Term consTerm = d_solver.mkTerm(APPLY_CONSTRUCTOR,
Term c = d_solver.mkConst(intListSort, "c");
Datatype list = listSort.getDatatype();
// list datatype constructor and selector operator terms
- Term consOpTerm = list.getConstructor("cons").getConstructorTerm();
- Term nilOpTerm = list.getConstructor("nil").getConstructorTerm();
- Term headOpTerm = list["cons"].getSelector("head").getSelectorTerm();
- Term tailOpTerm = list["cons"].getSelector("tail").getSelectorTerm();
+ Term consOpTerm = list.getConstructor("cons").getTerm();
+ Term nilOpTerm = list.getConstructor("nil").getTerm();
+ Term headOpTerm = list["cons"].getSelector("head").getTerm();
+ Term tailOpTerm = list["cons"].getSelector("tail").getTerm();
Term nilTerm = d_solver.mkTerm(APPLY_CONSTRUCTOR, {nilOpTerm});
Term consTerm = d_solver.mkTerm(APPLY_CONSTRUCTOR,
DatatypeConstructor consConstr = d.getConstructor(0);
DatatypeConstructor nilConstr = d.getConstructor(1);
assertThrows(CVC5ApiException.class, () -> d.getConstructor(2));
- assertDoesNotThrow(() -> consConstr.getConstructorTerm());
- assertDoesNotThrow(() -> nilConstr.getConstructorTerm());
+ assertDoesNotThrow(() -> consConstr.getTerm());
+ assertDoesNotThrow(() -> nilConstr.getTerm());
}
@Test
assertTrue(dt.isWellFounded());
// get constructor
DatatypeConstructor dcons = dt.getConstructor(0);
- Term consTerm = dcons.getConstructorTerm();
+ Term consTerm = dcons.getTerm();
assertEquals(dcons.getNumSelectors(), 2);
// create datatype sort to test
// get the specialized constructor term for list[Int]
assertDoesNotThrow(() -> atomicTerm.set(nilc.getInstantiatedConstructorTerm(listInt)));
Term testConsTerm = atomicTerm.get();
- assertNotEquals(testConsTerm, nilc.getConstructorTerm());
+ assertNotEquals(testConsTerm, nilc.getTerm());
// error to get the specialized constructor term for Int
assertThrows(CVC5ApiException.class, () -> nilc.getInstantiatedConstructorTerm(isort));
}
Sort isort1 = dt_sorts[1].instantiate(new Sort[] {d_solver.getBooleanSort()});
Term t1 = d_solver.mkConst(isort1, "t");
Term t0 = d_solver.mkTerm(APPLY_SELECTOR,
- t1.getSort().getDatatype().getConstructor("c1").getSelector("s1").getSelectorTerm(),
+ t1.getSort().getDatatype().getConstructor("c1").getSelector("s1").getTerm(),
t1);
assertEquals(dt_sorts[0].instantiate(new Sort[] {d_solver.getBooleanSort()}), t0.getSort());
Datatype list = listSort.getDatatype();
// list datatype constructor and selector operator terms
- Term consTerm = list.getConstructor("cons").getConstructorTerm();
- Term nilTerm = list.getConstructor("nil").getConstructorTerm();
- Term headTerm = list.getConstructor("cons").getSelector("head").getSelectorTerm();
- Term tailTerm = list.getConstructor("cons").getSelector("tail").getSelectorTerm();
+ Term consTerm = list.getConstructor("cons").getTerm();
+ Term nilTerm = list.getConstructor("nil").getTerm();
+ Term headTerm = list.getConstructor("cons").getSelector("head").getTerm();
+ Term tailTerm = list.getConstructor("cons").getSelector("tail").getTerm();
// mkTerm(Op op, Term term) const
assertDoesNotThrow(() -> d_solver.mkTerm(APPLY_CONSTRUCTOR, nilTerm));
Sort consListSort = d_solver.mkDatatypeSort(consListSpec);
Datatype consList = consListSort.getDatatype();
- Term consTerm = consList.getConstructor("cons").getConstructorTerm();
- Term nilTerm = consList.getConstructor("nil").getConstructorTerm();
- Term headTerm = consList.getConstructor("cons").getSelector("head").getSelectorTerm();
+ Term consTerm = consList.getConstructor("cons").getTerm();
+ Term nilTerm = consList.getConstructor("nil").getTerm();
+ Term headTerm = consList.getConstructor("cons").getSelector("head").getTerm();
Term listnil = d_solver.mkTerm(APPLY_CONSTRUCTOR, nilTerm);
Term listcons1 = d_solver.mkTerm(APPLY_CONSTRUCTOR, consTerm, d_solver.mkInteger(1), listnil);
Datatype consList = consListSort.getDatatype();
Term dt1 = d_solver.mkTerm(APPLY_CONSTRUCTOR,
- consList.getConstructor("cons").getConstructorTerm(),
+ consList.getConstructor("cons").getTerm(),
d_solver.mkInteger(0),
- d_solver.mkTerm(APPLY_CONSTRUCTOR, consList.getConstructor("nil").getConstructorTerm()));
+ d_solver.mkTerm(APPLY_CONSTRUCTOR, consList.getConstructor("nil").getTerm()));
assertDoesNotThrow(() -> d_solver.simplify(dt1));
Term dt2 = d_solver.mkTerm(
- APPLY_SELECTOR, consList.getConstructor("cons").getSelector("head").getSelectorTerm(), dt1);
+ APPLY_SELECTOR, consList.getConstructor("cons").getSelector("head").getTerm(), dt1);
assertDoesNotThrow(() -> d_solver.simplify(dt2));
Term b1 = d_solver.mkVar(bvSort, "b1");
for (int i = 0; i < indices.length; i++)
{
- Term selectorTerm = constructor.getSelector(indices[i]).getSelectorTerm();
+ Term selectorTerm = constructor.getSelector(indices[i]).getTerm();
Term selectedTerm = d_solver.mkTerm(APPLY_SELECTOR, selectorTerm, tuple);
Term simplifiedTerm = d_solver.simplify(selectedTerm);
assertEquals(elements[indices[i]], simplifiedTerm);
{
Sort dt_sort = create_datatype_sort();
Datatype dt = dt_sort.getDatatype();
- Sort cons_sort = dt.getConstructor(0).getConstructorTerm().getSort();
+ Sort cons_sort = dt.getConstructor(0).getTerm().getSort();
assertTrue(cons_sort.isDatatypeConstructor());
assertDoesNotThrow(() -> d_solver.getNullSort().isDatatypeConstructor());
}
{
Sort dt_sort = create_datatype_sort();
Datatype dt = dt_sort.getDatatype();
- Sort cons_sort = dt.getConstructor(0).getSelector(1).getSelectorTerm().getSort();
+ Sort cons_sort = dt.getConstructor(0).getSelector(1).getTerm().getSort();
assertTrue(cons_sort.isDatatypeSelector());
assertDoesNotThrow(() -> d_solver.getNullSort().isDatatypeSelector());
}
// get constructor
DatatypeConstructor dcons = dt.getConstructor(0);
- Term consTerm = dcons.getConstructorTerm();
+ Term consTerm = dcons.getTerm();
Sort consSort = consTerm.getSort();
assertTrue(consSort.isDatatypeConstructor());
assertFalse(consSort.isDatatypeTester());
// get selector
DatatypeSelector dselTail = dcons.getSelector(1);
- Term tailTerm = dselTail.getSelectorTerm();
+ Term tailTerm = dselTail.getTerm();
assertTrue(tailTerm.getSort().isDatatypeSelector());
assertEquals(tailTerm.getSort().getDatatypeSelectorDomainSort(), dtypeSort);
assertEquals(tailTerm.getSort().getDatatypeSelectorCodomainSort(), dtypeSort);
Term c = d_solver.mkConst(intListSort, "c");
Datatype list = listSort.getDatatype();
// list datatype constructor and selector operator terms
- Term consOpTerm = list.getConstructor("cons").getConstructorTerm();
- Term nilOpTerm = list.getConstructor("nil").getConstructorTerm();
+ Term consOpTerm = list.getConstructor("cons").getTerm();
+ Term nilOpTerm = list.getConstructor("nil").getTerm();
}
@Test
nilConstr = d[1]
with pytest.raises(RuntimeError):
d[2]
- consConstr.getConstructorTerm()
- nilConstr.getConstructorTerm()
+ consConstr.getTerm()
+ nilConstr.getTerm()
def test_is_null(solver):
# creating empty (null) objects.
assert dt.isWellFounded()
# get constructor
dcons = dt[0]
- consTerm = dcons.getConstructorTerm()
+ consTerm = dcons.getTerm()
assert dcons.getNumSelectors() == 2
# create datatype sort to test
testConsTerm = Term(solver)
# get the specialized constructor term for list[Int]
testConsTerm = nilc.getInstantiatedConstructorTerm(listInt)
- assert testConsTerm != nilc.getConstructorTerm()
+ assert testConsTerm != nilc.getTerm()
# error to get the specialized constructor term for Int
with pytest.raises(RuntimeError):
nilc.getInstantiatedConstructorTerm(isort)
t1 = solver.mkConst(isort1, "t")
t0 = solver.mkTerm(
Kind.APPLY_SELECTOR,
- t1.getSort().getDatatype().getSelector("s1").getSelectorTerm(),
+ t1.getSort().getDatatype().getSelector("s1").getTerm(),
t1)
assert dt_sorts[0].instantiate({solver.getBooleanSort()}) == t0.getSort()
lis = listSort.getDatatype()
# list datatype constructor and selector operator terms
- consTerm = lis.getConstructor("cons").getConstructorTerm()
- nilTerm = lis.getConstructor("nil").getConstructorTerm()
- headTerm = lis["cons"].getSelector("head").getSelectorTerm()
- tailTerm = lis["cons"]["tail"].getSelectorTerm()
+ consTerm = lis.getConstructor("cons").getTerm()
+ nilTerm = lis.getConstructor("nil").getTerm()
+ headTerm = lis["cons"].getSelector("head").getTerm()
+ tailTerm = lis["cons"]["tail"].getTerm()
# mkTerm(Op op, Term term) const
solver.mkTerm(Kind.APPLY_CONSTRUCTOR, nilTerm)
consListSort = solver.mkDatatypeSort(consListSpec)
consList = consListSort.getDatatype()
- consTerm = consList.getConstructor("cons").getConstructorTerm()
- nilTerm = consList.getConstructor("nil").getConstructorTerm()
- headTerm = consList["cons"].getSelector("head").getSelectorTerm()
+ consTerm = consList.getConstructor("cons").getTerm()
+ nilTerm = consList.getConstructor("nil").getTerm()
+ headTerm = consList["cons"].getSelector("head").getTerm()
listnil = solver.mkTerm(Kind.APPLY_CONSTRUCTOR, nilTerm)
listcons1 = solver.mkTerm(Kind.APPLY_CONSTRUCTOR, consTerm,
consList = consListSort.getDatatype()
dt1 = solver.mkTerm(
Kind.APPLY_CONSTRUCTOR,
- consList.getConstructor("cons").getConstructorTerm(),
+ consList.getConstructor("cons").getTerm(),
solver.mkInteger(0),
solver.mkTerm(
Kind.APPLY_CONSTRUCTOR,
- consList.getConstructor("nil").getConstructorTerm()))
+ consList.getConstructor("nil").getTerm()))
solver.simplify(dt1)
dt2 = solver.mkTerm(
Kind.APPLY_SELECTOR,
- consList["cons"].getSelector("head").getSelectorTerm(),
+ consList["cons"].getSelector("head").getTerm(),
dt1)
solver.simplify(dt2)
for i in indices:
- selectorTerm = constructor[i].getSelectorTerm()
+ selectorTerm = constructor[i].getTerm()
selectedTerm = solver.mkTerm(Kind.APPLY_SELECTOR, selectorTerm, tuple)
simplifiedTerm = solver.simplify(selectedTerm)
assert elements[i] == simplifiedTerm
def test_is_constructor(solver):
dt_sort = create_datatype_sort(solver)
dt = dt_sort.getDatatype()
- cons_sort = dt[0].getConstructorTerm().getSort()
+ cons_sort = dt[0].getTerm().getSort()
assert cons_sort.isDatatypeConstructor()
Sort(solver).isDatatypeConstructor()
dt = dt_sort.getDatatype()
dt0 = dt[0]
dt01 = dt0[1]
- cons_sort = dt01.getSelectorTerm().getSort()
+ cons_sort = dt01.getTerm().getSort()
assert cons_sort.isDatatypeSelector()
Sort(solver).isDatatypeSelector()
# get constructor
dcons = dt[0]
- consTerm = dcons.getConstructorTerm()
+ consTerm = dcons.getTerm()
consSort = consTerm.getSort()
assert consSort.isDatatypeConstructor()
assert not consSort.isDatatypeTester()
# get selector
dselTail = dcons[1]
- tailTerm = dselTail.getSelectorTerm()
+ tailTerm = dselTail.getTerm()
assert tailTerm.getSort().isDatatypeSelector()
assert tailTerm.getSort().getDatatypeSelectorDomainSort() == dtypeSort
assert tailTerm.getSort().getDatatypeSelectorCodomainSort() == dtypeSort
c = solver.mkConst(intListSort, "c")
list1 = listSort.getDatatype()
# list datatype constructor and selector operator terms
- consOpTerm = list1.getConstructor("cons").getConstructorTerm()
- nilOpTerm = list1.getConstructor("nil").getConstructorTerm()
- headOpTerm = list1["cons"].getSelector("head").getSelectorTerm()
- tailOpTerm = list1["cons"].getSelector("tail").getSelectorTerm()
+ consOpTerm = list1.getConstructor("cons").getTerm()
+ nilOpTerm = list1.getConstructor("nil").getTerm()
+ headOpTerm = list1["cons"].getSelector("head").getTerm()
+ tailOpTerm = list1["cons"].getSelector("tail").getTerm()
nilTerm = solver.mkTerm(Kind.APPLY_CONSTRUCTOR, nilOpTerm)
consTerm = solver.mkTerm(Kind.APPLY_CONSTRUCTOR, consOpTerm,