CVC5_API_CHECK_NOT_NULL;
CVC5_API_CHECK_SORT(sort);
CVC5_API_ARG_CHECK_EXPECTED(!sort.isNull(), sort)
- << "non-null range sort for selector";
+ << "non-null codomain sort for selector";
//////// all checks before this line
d_ctor->addArg(name, *sort.d_type);
////////
CVC5_API_TRY_CATCH_END;
}
-Sort DatatypeSelector::getRangeSort() const
+Sort DatatypeSelector::getCodomainSort() const
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_CHECK_NOT_NULL;
/**
* Add datatype selector declaration.
* @param name the name of the datatype selector declaration to add
- * @param sort the range sort of the datatype selector declaration to add
+ * @param sort the codomain sort of the datatype selector declaration to add
*/
void addSelector(const std::string& name, const Sort& sort);
/**
- * Add datatype selector declaration whose range type is the datatype itself.
+ * Add datatype selector declaration whose codomain type is the datatype
+ * itself.
* @param name the name of the datatype selector declaration to add
*/
void addSelectorSelf(const std::string& name);
*/
Term getUpdaterTerm() const;
- /** @return the range sort of this selector. */
- Sort getRangeSort() const;
+ /** @return the codomain sort of this selector. */
+ Sort getCodomainSort() const;
/**
* @return true if this DatatypeSelector is a null object
* Does this datatype have nested recursion? This method returns false if a
* value of this datatype includes a subterm of its type that is nested
* beneath a non-datatype type constructor. For example, a datatype
- * T containing a constructor having a selector with range type (Set T) has
- * nested recursion.
+ * T containing a constructor having a selector with codomain type (Set T)
+ * has nested recursion.
*
* @return true if this datatype has nested recursion
*/
* Does this datatype have nested recursion? This method returns false if a
* value of this datatype includes a subterm of its type that is nested
* beneath a non-datatype type constructor. For example, a datatype
- * T containing a constructor having a selector with range type (Set T) has
- * nested recursion.
+ * T containing a constructor having a selector with codomain type (Set T)
+ * has nested recursion.
*
* @return true if this datatype has nested recursion
*/
/**
* Add datatype selector declaration.
* @param name the name of the datatype selector declaration to add
- * @param sort the range sort of the datatype selector declaration to add
+ * @param sort the codomain sort of the datatype selector declaration to add
*/
public void addSelector(String name, Sort sort)
{
private native void addSelector(long pointer, String name, long sortPointer);
/**
- * Add datatype selector declaration whose range type is the datatype itself.
+ * Add datatype selector declaration whose codomain type is the datatype
+ * itself.
* @param name the name of the datatype selector declaration to add
*/
public void addSelectorSelf(String name)
private native long getUpdaterTerm(long pointer);
- /** @return the range sort of this selector. */
- public Sort getRangeSort()
+ /** @return the codomain sort of this selector. */
+ public Sort getCodomainSort()
{
- long sortPointer = getRangeSort(pointer);
+ long sortPointer = getCodomainSort(pointer);
return new Sort(solver, sortPointer);
}
- private native long getRangeSort(long pointer);
+ private native long getCodomainSort(long pointer);
/**
* @return true if this DatatypeSelector is a null object
/*
* Class: io_github_cvc5_api_DatatypeSelector
- * Method: getRangeSort
+ * Method: getCodomainSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_api_DatatypeSelector_getRangeSort(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_api_DatatypeSelector_getCodomainSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
DatatypeSelector* current = (DatatypeSelector*)pointer;
- Sort* retPointer = new Sort(current->getRangeSort());
+ Sort* retPointer = new Sort(current->getCodomainSort());
return (jlong)retPointer;
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
string getName() except +
Term getSelectorTerm() except +
Term getUpdaterTerm() except +
- Sort getRangeSort() except +
+ Sort getCodomainSort() except +
bint isNull() except +
string toString() except +
Add datatype selector declaration.
:param name: the name of the datatype selector declaration to add.
- :param sort: the range sort of the datatype selector declaration to add.
+ :param sort: the codomain sort of the datatype selector declaration
+ to add.
"""
self.cddc.addSelector(name.encode(), sort.csort)
def addSelectorSelf(self, str name):
"""
- Add datatype selector declaration whose range sort is the datatype itself.
+ Add datatype selector declaration whose codomain sort is the
+ datatype itself.
:param name: the name of the datatype selector declaration to add.
"""
term.cterm = self.cds.getUpdaterTerm()
return term
- def getRangeSort(self):
+ def getCodomainSort(self):
"""
- :return: the range sort of this selector.
+ :return: the codomain sort of this selector.
"""
cdef Sort sort = Sort(self.solver)
- sort.csort = self.cds.getRangeSort()
+ sort.csort = self.cds.getCodomainSort()
return sort
def isNull(self):
DatatypeSelector dtsTreeNodeLeft = dtcTreeNode[0];
ASSERT_EQ(dtsTreeNodeLeft.getName(), "left");
// argument type should have resolved to be recursive
- ASSERT_TRUE(dtsTreeNodeLeft.getRangeSort().isDatatype());
- ASSERT_EQ(dtsTreeNodeLeft.getRangeSort(), dtsorts[0]);
+ ASSERT_TRUE(dtsTreeNodeLeft.getCodomainSort().isDatatype());
+ ASSERT_EQ(dtsTreeNodeLeft.getCodomainSort(), dtsorts[0]);
// fails due to empty datatype
std::vector<DatatypeDecl> dtdeclsBad;
// get selector
DatatypeSelector dselTail = dcons[1];
ASSERT_EQ(dselTail.getName(), std::string("tail"));
- ASSERT_EQ(dselTail.getRangeSort(), dtypeSort);
+ ASSERT_EQ(dselTail.getCodomainSort(), dtypeSort);
// get selector from datatype
ASSERT_NO_THROW(dt.getSelector("head"));
// this is not well-founded due to non-simple recursion
ASSERT_NO_THROW(dtsorts = d_solver.mkDatatypeSorts(dtdecls, unresTypes));
ASSERT_EQ(dtsorts.size(), 1);
- ASSERT_TRUE(dtsorts[0].getDatatype()[0][0].getRangeSort().isArray());
- ASSERT_EQ(dtsorts[0].getDatatype()[0][0].getRangeSort().getArrayElementSort(),
- dtsorts[0]);
+ ASSERT_TRUE(dtsorts[0].getDatatype()[0][0].getCodomainSort().isArray());
+ ASSERT_EQ(
+ dtsorts[0].getDatatype()[0][0].getCodomainSort().getArrayElementSort(),
+ dtsorts[0]);
ASSERT_TRUE(dtsorts[0].getDatatype().isWellFounded());
ASSERT_TRUE(dtsorts[0].getDatatype().hasNestedRecursion());
DatatypeSelector dtsTreeNodeLeft = dtcTreeNode.getSelector(0);
assertEquals(dtsTreeNodeLeft.getName(), "left");
// argument type should have resolved to be recursive
- assertTrue(dtsTreeNodeLeft.getRangeSort().isDatatype());
- assertEquals(dtsTreeNodeLeft.getRangeSort(), dtsorts.get(0));
+ assertTrue(dtsTreeNodeLeft.getCodomainSort().isDatatype());
+ assertEquals(dtsTreeNodeLeft.getCodomainSort(), dtsorts.get(0));
// fails due to empty datatype
List<DatatypeDecl> dtdeclsBad = new ArrayList<>();
// get selector
DatatypeSelector dselTail = dcons.getSelector(1);
assertEquals(dselTail.getName(), "tail");
- assertEquals(dselTail.getRangeSort(), dtypeSort);
+ assertEquals(dselTail.getCodomainSort(), dtypeSort);
// possible to construct null datatype declarations if not using solver
assertThrows(CVC5ApiException.class, () -> d_solver.getNullDatatypeDecl().getName());
dtsorts = atomic.get();
assertEquals(dtsorts.size(), 1);
assertTrue(
- dtsorts.get(0).getDatatype().getConstructor(0).getSelector(0).getRangeSort().isArray());
+ dtsorts.get(0).getDatatype().getConstructor(0).getSelector(0).getCodomainSort().isArray());
assertEquals(dtsorts.get(0)
.getDatatype()
.getConstructor(0)
.getSelector(0)
- .getRangeSort()
+ .getCodomainSort()
.getArrayElementSort(),
dtsorts.get(0));
assertTrue(dtsorts.get(0).getDatatype().isWellFounded());
dtsTreeNodeLeft = dtcTreeNode[0]
assert dtsTreeNodeLeft.getName() == "left"
# argument type should have resolved to be recursive
- assert dtsTreeNodeLeft.getRangeSort().isDatatype()
- assert dtsTreeNodeLeft.getRangeSort() == dtsorts[0]
+ assert dtsTreeNodeLeft.getCodomainSort().isDatatype()
+ assert dtsTreeNodeLeft.getCodomainSort() == dtsorts[0]
# fails due to empty datatype
dtdeclsBad = []
# get selector
dselTail = dcons[1]
assert dselTail.getName() == "tail"
- assert dselTail.getRangeSort() == dtypeSort
+ assert dselTail.getCodomainSort() == dtypeSort
# get selector from datatype
dt.getSelector("head")
# this is not well-founded due to non-simple recursion
dtsorts = solver.mkDatatypeSorts(dtdecls, unresTypes)
assert len(dtsorts) == 1
- assert dtsorts[0].getDatatype()[0][0].getRangeSort().isArray()
- assert dtsorts[0].getDatatype()[0][0].getRangeSort().getArrayElementSort() \
+ assert dtsorts[0].getDatatype()[0][0].getCodomainSort().isArray()
+ assert dtsorts[0].getDatatype()[0][0].getCodomainSort().getArrayElementSort() \
== dtsorts[0]
assert dtsorts[0].getDatatype().isWellFounded()
assert dtsorts[0].getDatatype().hasNestedRecursion()