CVC5_API_TRY_CATCH_END;
}
-bool Sort::isFirstClass() const
-{
- CVC5_API_TRY_CATCH_BEGIN;
- //////// all checks before this line
- return d_type->isFirstClass();
- ////////
- CVC5_API_TRY_CATCH_END;
-}
-
Datatype Sort::getDatatype() const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_RECOVERABLE_CHECK(d_slv->isSmtModeSat())
<< "Cannot get value unless after a SAT or UNKNOWN response.";
CVC5_API_SOLVER_CHECK_TERM(term);
- CVC5_API_RECOVERABLE_CHECK(term.getSort().isFirstClass())
+ CVC5_API_RECOVERABLE_CHECK(term.getSort().getTypeNode().isFirstClass())
<< "Cannot get value of a term that is not first class.";
CVC5_API_RECOVERABLE_CHECK(!term.getSort().isDatatype()
|| term.getSort().getDatatype().isWellFounded())
<< "Cannot get value unless after a SAT or UNKNOWN response.";
for (const Term& t : terms)
{
- CVC5_API_RECOVERABLE_CHECK(t.getSort().isFirstClass())
+ CVC5_API_RECOVERABLE_CHECK(t.getSort().getTypeNode().isFirstClass())
<< "Cannot get value of a term that is not first class.";
CVC5_API_RECOVERABLE_CHECK(!t.getSort().isDatatype()
|| t.getSort().getDatatype().isWellFounded())
*/
bool isSortConstructor() const;
- /**
- * Is this a first-class sort?
- * First-class sorts are sorts for which:
- * 1. we handle equalities between terms of that type, and
- * 2. they are allowed to be parameters of parametric sorts (e.g. index or
- * element sorts of arrays).
- *
- * Examples of sorts that are not first-class include sort constructor sorts
- * and regular expression sorts.
- *
- * @return true if this is a first-class sort
- */
- bool isFirstClass() const;
-
/**
* @return the underlying datatype of a datatype sort
*/
this->d_solver == s.d_solver, "sort", sorts, i) \
<< "a sort associated with the solver this object is associated " \
"with"; \
- CVC5_API_ARG_CHECK_EXPECTED(s.isFirstClass(), s) \
+ CVC5_API_ARG_CHECK_EXPECTED(s.getTypeNode().isFirstClass(), s) \
<< "first-class sort as domain sort"; \
i += 1; \
} \
private native boolean isSortConstructor(long pointer);
- /**
- * Is this a first-class sort?
- * First-class sorts are sorts for which:
- * (1) we handle equalities between terms of that type, and
- * (2) they are allowed to be parameters of parametric sorts (e.g. index or
- * element sorts of arrays).
- *
- * Examples of sorts that are not first-class include sort constructor sorts
- * and regular expression sorts.
- *
- * @return true if this is a first-class sort
- */
- public boolean isFirstClass()
- {
- return isFirstClass(pointer);
- }
-
- private native boolean isFirstClass(long pointer);
-
/**
* @return the underlying datatype of a datatype sort
*/
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, static_cast<jboolean>(false));
}
-/*
- * Class: io_github_cvc5_api_Sort
- * Method: isFirstClass
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_io_github_cvc5_api_Sort_isFirstClass(JNIEnv* env, jobject, jlong pointer)
-{
- CVC5_JAVA_API_TRY_CATCH_BEGIN;
- Sort* current = reinterpret_cast<Sort*>(pointer);
- return static_cast<jboolean>(current->isFirstClass());
- CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, static_cast<jboolean>(false));
-}
-
/*
* Class: io_github_cvc5_api_Sort
* Method: getDatatype
bint isSequence() except +
bint isUninterpretedSort() except +
bint isSortConstructor() except +
- bint isFirstClass() except +
Datatype getDatatype() except +
Sort instantiate(const vector[Sort]& params) except +
Sort substitute(const vector[Sort] & es, const vector[Sort] & reps) except +
"""
return self.csort.isSortConstructor()
- def isFirstClass(self):
- """
- Is this a first-class sort?
- First-class sorts are sorts for which:
-
- 1. we handle equalities between terms of that type, and
- 2. they are allowed to be parameters of parametric sorts
- (e.g. index or element sorts of arrays).
-
- Examples of sorts that are not first-class include sort constructor
- sorts and regular expression sorts.
-
- :return: True if the sort is a first-class sort.
- """
- return self.csort.isFirstClass()
-
def getDatatype(self):
"""
:return: the underlying datatype of a datatype sort
ASSERT_NO_THROW(Sort().isSortConstructor());
}
-TEST_F(TestApiBlackSort, isFirstClass)
-{
- Sort fun_sort = d_solver.mkFunctionSort(d_solver.getRealSort(),
- d_solver.getIntegerSort());
- ASSERT_TRUE(d_solver.getIntegerSort().isFirstClass());
- ASSERT_TRUE(fun_sort.isFirstClass());
- Sort reSort = d_solver.getRegExpSort();
- ASSERT_FALSE(reSort.isFirstClass());
- ASSERT_NO_THROW(Sort().isFirstClass());
-}
-
TEST_F(TestApiBlackSort, getDatatype)
{
Sort dtypeSort = create_datatype_sort();
assertDoesNotThrow(() -> d_solver.getNullSort().isSortConstructor());
}
- @Test void isFirstClass()
- {
- Sort fun_sort = d_solver.mkFunctionSort(d_solver.getRealSort(), d_solver.getIntegerSort());
- assertTrue(d_solver.getIntegerSort().isFirstClass());
- assertTrue(fun_sort.isFirstClass());
- Sort reSort = d_solver.getRegExpSort();
- assertFalse(reSort.isFirstClass());
- assertDoesNotThrow(() -> d_solver.getNullSort().isFirstClass());
- }
-
@Test void getDatatype() throws CVC5ApiException
{
Sort dtypeSort = create_datatype_sort();
Sort(solver).isSortConstructor()
-def test_is_first_class(solver):
- fun_sort = solver.mkFunctionSort(solver.getRealSort(),
- solver.getIntegerSort())
- assert solver.getIntegerSort().isFirstClass()
- assert fun_sort.isFirstClass()
- reSort = solver.getRegExpSort()
- assert not reSort.isFirstClass()
- Sort(solver).isFirstClass()
-
-
def test_get_datatype(solver):
dtypeSort = create_datatype_sort(solver)
dtypeSort.getDatatype()