Makes all symbols in mk* functions optional.
CVC5_API_TRY_CATCH_END;
}
-Sort Solver::mkParamSort(const std::string& symbol) const
+Sort Solver::mkParamSort(const std::optional<std::string>& symbol) const
{
CVC5_API_TRY_CATCH_BEGIN;
//////// all checks before this line
- return Sort(this,
- getNodeManager()->mkSort(
- symbol, internal::NodeManager::SORT_FLAG_PLACEHOLDER));
+
+ internal::TypeNode tn =
+ symbol ? getNodeManager()->mkSort(
+ *symbol, internal::NodeManager::SORT_FLAG_PLACEHOLDER)
+ : getNodeManager()->mkSort(
+ internal::NodeManager::SORT_FLAG_PLACEHOLDER);
+ return Sort(this, tn);
////////
CVC5_API_TRY_CATCH_END;
}
CVC5_API_TRY_CATCH_END;
}
-Sort Solver::mkUninterpretedSort(const std::string& symbol) const
+Sort Solver::mkUninterpretedSort(const std::optional<std::string>& symbol) const
{
CVC5_API_TRY_CATCH_BEGIN;
//////// all checks before this line
- return Sort(this, getNodeManager()->mkSort(symbol));
+ internal::TypeNode tn =
+ symbol ? getNodeManager()->mkSort(*symbol) : getNodeManager()->mkSort();
+ return Sort(this, tn);
////////
CVC5_API_TRY_CATCH_END;
}
CVC5_API_TRY_CATCH_END;
}
-Sort Solver::mkUninterpretedSortConstructorSort(const std::string& symbol,
- size_t arity) const
+Sort Solver::mkUninterpretedSortConstructorSort(
+ size_t arity, const std::optional<std::string>& symbol) const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_ARG_CHECK_EXPECTED(arity > 0, arity) << "an arity > 0";
//////// all checks before this line
- return Sort(this, getNodeManager()->mkSortConstructor(symbol, arity));
+ if (symbol)
+ {
+ return Sort(this, getNodeManager()->mkSortConstructor(*symbol, arity));
+ }
+ return Sort(this, getNodeManager()->mkSortConstructor("", arity));
////////
CVC5_API_TRY_CATCH_END;
}
/* Create constants */
/* -------------------------------------------------------------------------- */
-Term Solver::mkConst(const Sort& sort, const std::string& symbol) const
-{
- CVC5_API_TRY_CATCH_BEGIN;
- CVC5_API_SOLVER_CHECK_SORT(sort);
- //////// all checks before this line
- internal::Node res = d_nodeMgr->mkVar(symbol, *sort.d_type);
- (void)res.getType(true); /* kick off type checking */
- increment_vars_consts_stats(sort, false);
- return Term(this, res);
- ////////
- CVC5_API_TRY_CATCH_END;
-}
-
-Term Solver::mkConst(const Sort& sort) const
+Term Solver::mkConst(const Sort& sort,
+ const std::optional<std::string>& symbol) const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_SOLVER_CHECK_SORT(sort);
//////// all checks before this line
- internal::Node res = d_nodeMgr->mkVar(*sort.d_type);
+ internal::Node res = symbol ? d_nodeMgr->mkVar(*symbol, *sort.d_type)
+ : d_nodeMgr->mkVar(*sort.d_type);
(void)res.getType(true); /* kick off type checking */
increment_vars_consts_stats(sort, false);
return Term(this, res);
/* Create variables */
/* -------------------------------------------------------------------------- */
-Term Solver::mkVar(const Sort& sort, const std::string& symbol) const
+Term Solver::mkVar(const Sort& sort,
+ const std::optional<std::string>& symbol) const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_SOLVER_CHECK_SORT(sort);
//////// all checks before this line
- internal::Node res = symbol.empty()
- ? d_nodeMgr->mkBoundVar(*sort.d_type)
- : d_nodeMgr->mkBoundVar(symbol, *sort.d_type);
+ internal::Node res = symbol ? d_nodeMgr->mkBoundVar(*symbol, *sort.d_type)
+ : d_nodeMgr->mkBoundVar(*sort.d_type);
(void)res.getType(true); /* kick off type checking */
increment_vars_consts_stats(sort, true);
return Term(this, res);
* @param symbol the name of the sort
* @return the sort parameter
*/
- Sort mkParamSort(const std::string& symbol) const;
+ Sort mkParamSort(
+ const std::optional<std::string>& symbol = std::nullopt) const;
/**
* Create a predicate sort.
* @param symbol the name of the sort
* @return the uninterpreted sort
*/
- Sort mkUninterpretedSort(const std::string& symbol) const;
+ Sort mkUninterpretedSort(
+ const std::optional<std::string>& symbol = std::nullopt) const;
/**
* Create an unresolved sort.
* @param arity the arity of the sort (must be > 0)
* @return the uninterpreted sort constructor sort
*/
- Sort mkUninterpretedSortConstructorSort(const std::string& symbol,
- size_t arity) const;
+ Sort mkUninterpretedSortConstructorSort(
+ size_t arity,
+ const std::optional<std::string>& symbol = std::nullopt) const;
/**
* Create a tuple sort.
* \endverbatim
*
* @param sort the sort of the constant
- * @param symbol the name of the constant
+ * @param symbol the name of the constant (optional)
* @return the first-order constant
*/
- Term mkConst(const Sort& sort, const std::string& symbol) const;
- /**
- * Create (first-order) constant (0-arity function symbol), with a default
- * symbol name.
- *
- * @param sort the sort of the constant
- * @return the first-order constant
- */
- Term mkConst(const Sort& sort) const;
+ Term mkConst(const Sort& sort,
+ const std::optional<std::string>& symbol = std::nullopt) const;
/**
* Create a bound variable to be used in a binder (i.e. a quantifier, a
* lambda, or a witness binder).
* @param sort the sort of the variable
- * @param symbol the name of the variable
+ * @param symbol the name of the variable (optional)
* @return the variable
*/
- Term mkVar(const Sort& sort, const std::string& symbol = std::string()) const;
+ Term mkVar(const Sort& sort,
+ const std::optional<std::string>& symbol = std::nullopt) const;
/* .................................................................... */
/* Create datatype constructor declarations */
private native long mkParamSort(long pointer, String symbol);
+ /**
+ * Create a sort parameter.
+ *
+ * @apiNote This method is experimental and may change in future versions.
+ *
+ * @return the sort parameter
+ */
+ public Sort mkParamSort()
+ {
+ long sortPointer = mkParamSort(pointer);
+ return new Sort(this, sortPointer);
+ }
+
+ private native long mkParamSort(long pointer);
+
/**
* Create a predicate sort.
* @param sorts the list of sorts of the predicate
private native long mkUninterpretedSort(long pointer, String symbol);
+ /**
+ * Create an uninterpreted sort.
+ * @return the uninterpreted sort
+ */
+ public Sort mkUninterpretedSort()
+ {
+ long sortPointer = mkUninterpretedSort(pointer);
+ return new Sort(this, sortPointer);
+ }
+
+ private native long mkUninterpretedSort(long pointer);
+
/**
* Create an unresolved sort.
*
* An uninterpreted sort constructor is an uninterpreted sort with
* arity > 0.
*
+ * @param arity the arity of the sort (must be > 0)
* @param symbol the symbol of the sort
+ * @return the sort constructor sort
+ * @throws CVC5ApiException
+ */
+ public Sort mkUninterpretedSortConstructorSort(int arity, String symbol) throws CVC5ApiException
+ {
+ Utils.validateUnsigned(arity, "arity");
+ long sortPointer = mkUninterpretedSortConstructorSort(pointer, arity, symbol);
+ return new Sort(this, sortPointer);
+ }
+
+ private native long mkUninterpretedSortConstructorSort(long pointer, int arity, String symbol);
+
+ /**
+ * Create a sort constructor sort.
+ *
+ * An uninterpreted sort constructor is an uninterpreted sort with
+ * arity > 0.
+ *
* @param arity the arity of the sort (must be > 0)
* @return the sort constructor sort
* @throws CVC5ApiException
*/
- public Sort mkUninterpretedSortConstructorSort(String symbol, int arity) throws CVC5ApiException
+ public Sort mkUninterpretedSortConstructorSort(int arity) throws CVC5ApiException
{
Utils.validateUnsigned(arity, "arity");
- long sortPointer = mkUninterpretedSortConstructorSort(pointer, symbol, arity);
+ long sortPointer = mkUninterpretedSortConstructorSort(pointer, arity);
return new Sort(this, sortPointer);
}
- private native long mkUninterpretedSortConstructorSort(long pointer, String symbol, int arity);
+ private native long mkUninterpretedSortConstructorSort(long pointer, int arity);
/**
* Create a tuple sort.
* Method: mkParamSort
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkParamSort(
- JNIEnv* env, jobject, jlong pointer, jstring jSymbol)
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_mkParamSort__JLjava_lang_String_2(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jstring jSymbol)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
+/*
+ * Class: io_github_cvc5_Solver
+ * Method: mkParamSort
+ * Signature: (JL)J
+ */
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkParamSort__J(JNIEnv* env,
+ jobject,
+ jlong pointer)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ Sort* retPointer = new Sort(solver->mkParamSort());
+ return reinterpret_cast<jlong>(retPointer);
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: io_github_cvc5_Solver
* Method: mkPredicateSort
* Method: mkUninterpretedSort
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkUninterpretedSort(
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_mkUninterpretedSort__JLjava_lang_String_2(
JNIEnv* env, jobject, jlong pointer, jstring jSymbol)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
+/*
+ * Class: io_github_cvc5_Solver
+ * Method: mkUninterpretedSort
+ * Signature: (JL)J
+ */
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkUninterpretedSort__J(
+ JNIEnv* env, jobject, jlong pointer)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ Sort* sort = new Sort(solver->mkUninterpretedSort());
+ return reinterpret_cast<jlong>(sort);
+
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: io_github_cvc5_Solver
* Method: mkUnresolvedSort
/*
* Class: io_github_cvc5_Solver
* Method: mkUninterpretedSortConstructorSort
- * Signature: (JLjava/lang/String;I)J
+ * Signature: (JLIjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_mkUninterpretedSortConstructorSort(
- JNIEnv* env, jobject, jlong pointer, jstring jSymbol, jint arity)
+Java_io_github_cvc5_Solver_mkUninterpretedSortConstructorSort__JILjava_lang_String_2(
+ JNIEnv* env, jobject, jlong pointer, jint arity, jstring jSymbol)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
const char* s = env->GetStringUTFChars(jSymbol, nullptr);
std::string cSymbol(s);
Sort* retPointer = new Sort(
- solver->mkUninterpretedSortConstructorSort(cSymbol, (size_t)arity));
+ solver->mkUninterpretedSortConstructorSort((size_t)arity, cSymbol));
env->ReleaseStringUTFChars(jSymbol, s);
return reinterpret_cast<jlong>(retPointer);
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
+/*
+ * Class: io_github_cvc5_Solver
+ * Method: mkUninterpretedSortConstructorSort
+ * Signature: (JLI)J
+ */
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_mkUninterpretedSortConstructorSort__JI(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jint arity)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ Sort* retPointer =
+ new Sort(solver->mkUninterpretedSortConstructorSort((size_t)arity));
+ return reinterpret_cast<jlong>(retPointer);
+
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: io_github_cvc5_Solver
* Method: mkTupleSort
const set[Sort]& unresolvedSorts) except +
Sort mkFunctionSort(Sort domain, Sort codomain) except +
Sort mkFunctionSort(const vector[Sort]& sorts, Sort codomain) except +
+ Sort mkParamSort() except +
Sort mkParamSort(const string& symbol) except +
Sort mkPredicateSort(const vector[Sort]& sorts) except +
Sort mkRecordSort(const vector[pair[string, Sort]]& fields) except +
Sort mkSetSort(Sort elemSort) except +
Sort mkBagSort(Sort elemSort) except +
Sort mkSequenceSort(Sort elemSort) except +
+ Sort mkUninterpretedSort() except +
Sort mkUninterpretedSort(const string& symbol) except +
Sort mkUnresolvedSort(const string& symbol, size_t arity) except +
- Sort mkUninterpretedSortConstructorSort(const string& symbol, size_t arity) except +
+ Sort mkUninterpretedSortConstructorSort(size_t arity) except +
+ Sort mkUninterpretedSortConstructorSort(size_t arity, const string& symbol) except +
Sort mkTupleSort(const vector[Sort]& sorts) except +
Term mkTerm(Op op) except +
Term mkTerm(Op op, const vector[Term]& children) except +
codomain.csort)
return sort
- def mkParamSort(self, symbolname):
+ def mkParamSort(self, str symbolname = None):
""" Create a sort parameter.
.. warning:: This method is experimental and may change in future
:return: the sort parameter
"""
cdef Sort sort = Sort(self)
- sort.csort = self.csolver.mkParamSort(symbolname.encode())
+ if symbolname is None:
+ sort.csort = self.csolver.mkParamSort()
+ else:
+ sort.csort = self.csolver.mkParamSort(symbolname.encode())
return sort
@expand_list_arg(num_req_args=0)
sort.csort = self.csolver.mkSequenceSort(elemSort.csort)
return sort
- def mkUninterpretedSort(self, str name):
+ def mkUninterpretedSort(self, str name = None):
"""Create an uninterpreted sort.
:param symbol: the name of the sort
:return: the uninterpreted sort
"""
cdef Sort sort = Sort(self)
- sort.csort = self.csolver.mkUninterpretedSort(name.encode())
+ if name is None:
+ sort.csort = self.csolver.mkUninterpretedSort()
+ else:
+ sort.csort = self.csolver.mkUninterpretedSort(name.encode())
return sort
def mkUnresolvedSort(self, str name, size_t arity = 0):
sort.csort = self.csolver.mkUnresolvedSort(name.encode(), arity)
return sort
- def mkUninterpretedSortConstructorSort(self, str symbol, size_t arity):
+ def mkUninterpretedSortConstructorSort(self, size_t arity, str symbol = None):
"""Create a sort constructor sort.
An uninterpreted sort constructor is an uninterpreted sort with
:return: the sort constructor sort
"""
cdef Sort sort = Sort(self)
- sort.csort = self.csolver.mkUninterpretedSortConstructorSort(
- symbol.encode(), arity)
+ if symbol is None:
+ sort.csort = self.csolver.mkUninterpretedSortConstructorSort(arity)
+ else:
+ sort.csort = self.csolver.mkUninterpretedSortConstructorSort(
+ arity, symbol.encode())
return sort
@expand_list_arg(num_req_args=0)
{
Trace("parser") << "newSortConstructor(" << name << ", " << arity << ")"
<< std::endl;
- cvc5::Sort type = d_solver->mkUninterpretedSortConstructorSort(name, arity);
+ cvc5::Sort type = d_solver->mkUninterpretedSortConstructorSort(arity, name);
defineType(name, vector<cvc5::Sort>(arity), type);
return type;
}
size_t arity)
{
cvc5::Sort unresolved =
- d_solver->mkUninterpretedSortConstructorSort(name, arity);
+ d_solver->mkUninterpretedSortConstructorSort(arity, name);
defineType(name, vector<cvc5::Sort>(arity), unresolved);
d_unresolved.insert(unresolved);
return unresolved;
Trace("parser") << "newSortConstructor(P)(" << name << ", " << params.size()
<< ")" << std::endl;
cvc5::Sort unresolved =
- d_solver->mkUninterpretedSortConstructorSort(name, params.size());
+ d_solver->mkUninterpretedSortConstructorSort(params.size(), name);
defineType(name, params, unresolved);
cvc5::Sort t = getSort(name, params);
d_unresolved.insert(unresolved);
* END;
*/
unresTypes.clear();
- Sort unresList5 = d_solver.mkUninterpretedSortConstructorSort("list5", 1);
+ Sort unresList5 = d_solver.mkUninterpretedSortConstructorSort(1, "list5");
unresTypes.insert(unresList5);
std::vector<Sort> v;
*/
// Make unresolved types as placeholders
std::set<Sort> unresTypes;
- Sort unresList = d_solver.mkUninterpretedSortConstructorSort("plist", 1);
+ Sort unresList = d_solver.mkUninterpretedSortConstructorSort(1, "plist");
unresTypes.insert(unresList);
std::vector<Sort> v;
{
Sort s1 = d_solver.getBooleanSort();
- Sort u1 = d_solver.mkUninterpretedSortConstructorSort("_x0", 1);
- Sort u2 = d_solver.mkUninterpretedSortConstructorSort("_x1", 1);
+ Sort u1 = d_solver.mkUninterpretedSortConstructorSort(1, "_x0");
+ Sort u2 = d_solver.mkUninterpretedSortConstructorSort(1);
Sort p1 = d_solver.mkParamSort("_x4");
Sort p2 = d_solver.mkParamSort("_x27");
Sort p3 = d_solver.mkParamSort("_x3");
TEST_F(TestApiBlackSolver, mkUninterpretedSortConstructorSort)
{
- ASSERT_NO_THROW(d_solver.mkUninterpretedSortConstructorSort("s", 2));
- ASSERT_NO_THROW(d_solver.mkUninterpretedSortConstructorSort("", 2));
- ASSERT_THROW(d_solver.mkUninterpretedSortConstructorSort("", 0),
+ ASSERT_NO_THROW(d_solver.mkUninterpretedSortConstructorSort(2, "s"));
+ ASSERT_NO_THROW(d_solver.mkUninterpretedSortConstructorSort(2, ""));
+ ASSERT_THROW(d_solver.mkUninterpretedSortConstructorSort(0),
CVC5ApiException);
}
Sort un_sort = d_solver.mkUninterpretedSort("asdf");
ASSERT_TRUE(un_sort.isUninterpretedSort());
ASSERT_NO_THROW(Sort().isUninterpretedSort());
+ Sort un_sort2 = d_solver.mkUninterpretedSort();
+ ASSERT_TRUE(un_sort2.isUninterpretedSort());
}
TEST_F(TestApiBlackSort, isUninterpretedSortConstructor)
{
- Sort sc_sort = d_solver.mkUninterpretedSortConstructorSort("asdf", 1);
+ Sort sc_sort = d_solver.mkUninterpretedSortConstructorSort(1, "asdf");
ASSERT_TRUE(sc_sort.isUninterpretedSortConstructor());
ASSERT_NO_THROW(Sort().isUninterpretedSortConstructor());
+ Sort sc_sort2 = d_solver.mkUninterpretedSortConstructorSort(2);
+ ASSERT_TRUE(sc_sort2.isUninterpretedSortConstructor());
}
TEST_F(TestApiBlackSort, getDatatype)
ASSERT_THROW(dtypeSort.instantiate({d_solver.getIntegerSort()}),
CVC5ApiException);
// instantiate uninterpreted sort constructor
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 1);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(1, "s");
ASSERT_NO_THROW(sortConsSort.instantiate({d_solver.getIntegerSort()}));
}
paramDtypeSort.instantiate({d_solver.getIntegerSort()});
ASSERT_TRUE(instParamDtypeSort.isInstantiated());
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 1);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(1, "s");
ASSERT_FALSE(sortConsSort.isInstantiated());
Sort instSortConsSort = sortConsSort.instantiate({d_solver.getIntegerSort()});
ASSERT_TRUE(instSortConsSort.isInstantiated());
ASSERT_EQ(instSorts[1], boolSort);
// uninterpreted sort constructor sort instantiation
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 4);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(4, "s");
ASSERT_THROW(sortConsSort.getInstantiatedParameters(), CVC5ApiException);
Sort instSortConsSort =
Sort realSort = d_solver.getRealSort();
Sort boolSort = d_solver.getBooleanSort();
Sort bvSort = d_solver.mkBitVectorSort(8);
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 4);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(4, "s");
ASSERT_THROW(sortConsSort.getUninterpretedSortConstructor(),
CVC5ApiException);
Sort instSortConsSort =
TEST_F(TestApiBlackSort, getFunctionArity)
{
- Sort funSort = d_solver.mkFunctionSort(d_solver.mkUninterpretedSort("u"),
+ Sort funSort = d_solver.mkFunctionSort(d_solver.mkUninterpretedSort(),
d_solver.getIntegerSort());
ASSERT_NO_THROW(funSort.getFunctionArity());
Sort bvSort = d_solver.mkBitVectorSort(32);
TEST_F(TestApiBlackSort, getUninterpretedSortConstructorName)
{
- Sort sSort = d_solver.mkUninterpretedSortConstructorSort("s", 2);
+ Sort sSort = d_solver.mkUninterpretedSortConstructorSort(2, "s");
ASSERT_NO_THROW(sSort.getSymbol());
Sort bvSort = d_solver.mkBitVectorSort(32);
ASSERT_THROW(bvSort.getSymbol(), CVC5ApiException);
TEST_F(TestApiBlackSort, getUninterpretedSortConstructorArity)
{
- Sort sSort = d_solver.mkUninterpretedSortConstructorSort("s", 2);
+ Sort sSort = d_solver.mkUninterpretedSortConstructorSort(2, "s");
ASSERT_NO_THROW(sSort.getUninterpretedSortConstructorArity());
Sort bvSort = d_solver.mkBitVectorSort(32);
ASSERT_THROW(bvSort.getUninterpretedSortConstructorArity(), CVC5ApiException);
* END;
*/
unresTypes.clear();
- Sort unresList5 = d_solver.mkUninterpretedSortConstructorSort("list5", 1);
+ Sort unresList5 = d_solver.mkUninterpretedSortConstructorSort(1, "list5");
unresTypes.add(unresList5);
List<Sort> v = new ArrayList<>();
*/
// Make unresolved types as placeholders
Set<Sort> unresTypes = new HashSet<>();
- Sort unresList = d_solver.mkUninterpretedSortConstructorSort("plist", 1);
+ Sort unresList = d_solver.mkUninterpretedSortConstructorSort(1, "plist");
unresTypes.add(unresList);
List<Sort> v = new ArrayList<>();
@Test
void eq()
{
- Sort u_sort = d_solver.mkUninterpretedSort("u");
+ Sort u_sort = d_solver.mkUninterpretedSort();
Term x = d_solver.mkConst(u_sort, "x");
d_solver.assertFormula(x.eqTerm(x));
Result res;
@Test
void isUnsat()
{
- Sort u_sort = d_solver.mkUninterpretedSort("u");
+ Sort u_sort = d_solver.mkUninterpretedSort();
Term x = d_solver.mkConst(u_sort, "x");
d_solver.assertFormula(x.eqTerm(x).notTerm());
Result res = d_solver.checkSat();
@Test
void mkUninterpretedSortConstructorSort() throws CVC5ApiException
{
- assertDoesNotThrow(() -> d_solver.mkUninterpretedSortConstructorSort("s", 2));
- assertDoesNotThrow(() -> d_solver.mkUninterpretedSortConstructorSort("", 2));
- assertThrows(CVC5ApiException.class, () -> d_solver.mkUninterpretedSortConstructorSort("", 0));
+ assertDoesNotThrow(() -> d_solver.mkUninterpretedSortConstructorSort(2, "s"));
+ assertDoesNotThrow(() -> d_solver.mkUninterpretedSortConstructorSort(2));
+ assertThrows(CVC5ApiException.class, () -> d_solver.mkUninterpretedSortConstructorSort(0));
}
@Test
@Test
void isUninterpretedSortSortConstructor() throws CVC5ApiException
{
- Sort sc_sort = d_solver.mkUninterpretedSortConstructorSort("asdf", 1);
+ Sort sc_sort = d_solver.mkUninterpretedSortConstructorSort(1, "asdf");
assertTrue(sc_sort.isUninterpretedSortConstructor());
assertDoesNotThrow(() -> d_solver.getNullSort().isUninterpretedSortConstructor());
}
assertThrows(CVC5ApiException.class,
() -> dtypeSort.instantiate(new Sort[] {d_solver.getIntegerSort()}));
// instantiate uninterpreted sort constructor
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 1);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(1, "s");
assertDoesNotThrow(() -> sortConsSort.instantiate(new Sort[] {d_solver.getIntegerSort()}));
}
Sort instParamDtypeSort = paramDtypeSort.instantiate(new Sort[] {d_solver.getIntegerSort()});
assertTrue(instParamDtypeSort.isInstantiated());
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 1);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(1, "s");
assertFalse(sortConsSort.isInstantiated());
Sort instSortConsSort = sortConsSort.instantiate(new Sort[] {d_solver.getIntegerSort()});
assertTrue(instSortConsSort.isInstantiated());
assertEquals(instSorts[1], boolSort);
// uninterpreted sort constructor sort instantiation
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 4);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(4, "s");
assertThrows(CVC5ApiException.class, () -> sortConsSort.getInstantiatedParameters());
Sort instSortConsSort =
Sort realSort = d_solver.getRealSort();
Sort boolSort = d_solver.getBooleanSort();
Sort bvSort = d_solver.mkBitVectorSort(8);
- Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort("s", 4);
+ Sort sortConsSort = d_solver.mkUninterpretedSortConstructorSort(4);
assertThrows(CVC5ApiException.class, () -> sortConsSort.getUninterpretedSortConstructor());
Sort instSortConsSort =
sortConsSort.instantiate(new Sort[] {boolSort, intSort, bvSort, realSort});
@Test
void getUninterpretedSortConstructorName() throws CVC5ApiException
{
- Sort sSort = d_solver.mkUninterpretedSortConstructorSort("s", 2);
+ Sort sSort = d_solver.mkUninterpretedSortConstructorSort(2);
assertDoesNotThrow(() -> sSort.getSymbol());
Sort bvSort = d_solver.mkBitVectorSort(32);
assertThrows(CVC5ApiException.class, () -> bvSort.getSymbol());
@Test
void getUninterpretedSortConstructorArity() throws CVC5ApiException
{
- Sort sSort = d_solver.mkUninterpretedSortConstructorSort("s", 2);
+ Sort sSort = d_solver.mkUninterpretedSortConstructorSort(2, "s");
assertDoesNotThrow(() -> sSort.getUninterpretedSortConstructorArity());
Sort bvSort = d_solver.mkBitVectorSort(32);
assertThrows(CVC5ApiException.class, () -> bvSort.getUninterpretedSortConstructorArity());
# list5[X] = cons(car: X, cdr: list5[list5[X]]) | nil
# END
unresTypes.clear()
- unresList5 = solver.mkUninterpretedSortConstructorSort("list5", 1)
+ unresList5 = solver.mkUninterpretedSortConstructorSort(1, "list5")
unresTypes.add(unresList5)
v = []
# Make unresolved types as placeholders
unresTypes = set([])
- unresList = solver.mkUninterpretedSortConstructorSort("plist", 1)
+ unresList = solver.mkUninterpretedSortConstructorSort(1, "plist")
unresTypes.add(unresList)
v = []
def test_mk_sort_constructor_sort(solver):
- solver.mkUninterpretedSortConstructorSort("s", 2)
- solver.mkUninterpretedSortConstructorSort("", 2)
+ solver.mkUninterpretedSortConstructorSort(2, "s")
+ solver.mkUninterpretedSortConstructorSort(2)
with pytest.raises(RuntimeError):
- solver.mkUninterpretedSortConstructorSort("", 0)
+ solver.mkUninterpretedSortConstructorSort(0)
def test_mk_tuple_sort(solver):
def test_is_sort_constructor(solver):
- sc_sort = solver.mkUninterpretedSortConstructorSort("asdf", 1)
+ sc_sort = solver.mkUninterpretedSortConstructorSort(1, "asdf")
assert sc_sort.isUninterpretedSortConstructor()
Sort(solver).isUninterpretedSortConstructor()
with pytest.raises(RuntimeError):
dtypeSort.instantiate([solver.getIntegerSort()])
# instantiate uninterpreted sort constructor
- sortConsSort = solver.mkUninterpretedSortConstructorSort("s", 1)
+ sortConsSort = solver.mkUninterpretedSortConstructorSort(1, "s")
sortConsSort.instantiate([solver.getIntegerSort()])
def test_is_instantiated(solver):
instParamDtypeSort = paramDtypeSort.instantiate([solver.getIntegerSort()]);
assert instParamDtypeSort.isInstantiated()
- sortConsSort = solver.mkUninterpretedSortConstructorSort("s", 1)
+ sortConsSort = solver.mkUninterpretedSortConstructorSort(1, "s")
assert not sortConsSort.isInstantiated()
instSortConsSort = sortConsSort.instantiate([solver.getIntegerSort()])
assert instSortConsSort.isInstantiated()
assert instSorts[1] == boolSort
# uninterpreted sort constructor sort instantiation
- sortConsSort = solver.mkUninterpretedSortConstructorSort("s", 4)
+ sortConsSort = solver.mkUninterpretedSortConstructorSort(4, "s")
with pytest.raises(RuntimeError):
sortConsSort.getInstantiatedParameters()
realSort = solver.getRealSort()
boolSort = solver.getBooleanSort()
bvSort = solver.mkBitVectorSort(8)
- sortConsSort = solver.mkUninterpretedSortConstructorSort("s", 4)
+ sortConsSort = solver.mkUninterpretedSortConstructorSort(4, "s")
with pytest.raises(RuntimeError):
sortConsSort.getUninterpretedSortConstructor()
instSortConsSort = \
def test_get_uninterpreted_sort_constructor_name(solver):
- sSort = solver.mkUninterpretedSortConstructorSort("s", 2)
+ sSort = solver.mkUninterpretedSortConstructorSort(2, "s")
sSort.getSymbol()
bvSort = solver.mkBitVectorSort(32)
with pytest.raises(RuntimeError):
def test_get_uninterpreted_sort_constructor_arity(solver):
- sSort = solver.mkUninterpretedSortConstructorSort("s", 2)
+ sSort = solver.mkUninterpretedSortConstructorSort(2, "s")
sSort.getUninterpretedSortConstructorArity()
bvSort = solver.mkBitVectorSort(32)
with pytest.raises(RuntimeError):