////////
CVC5_API_TRY_CATCH_END;
}
-bool Datatype::hasNestedRecursion() const
-{
- CVC5_API_TRY_CATCH_BEGIN;
- CVC5_API_CHECK_NOT_NULL;
- //////// all checks before this line
- return d_dtype->hasNestedRecursion();
- ////////
- CVC5_API_TRY_CATCH_END;
-}
bool Datatype::isNull() const
{
*/
bool isWellFounded() const;
- /**
- * 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 codomain type (Set T)
- * has nested recursion.
- *
- * @return true if this datatype has nested recursion
- */
- bool hasNestedRecursion() const;
-
/**
* @return true if this Datatype is a null object
*/
private native boolean isWellFounded(long pointer);
- /**
- * 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 codomain type (Set T)
- * has nested recursion.
- *
- * @return true if this datatype has nested recursion
- */
- public boolean hasNestedRecursion()
- {
- return hasNestedRecursion(pointer);
- }
-
- private native boolean hasNestedRecursion(long pointer);
-
/**
* @return true if this Datatype is a null object
*/
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
-/*
- * Class: io_github_cvc5_api_Datatype
- * Method: hasNestedRecursion
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL Java_io_github_cvc5_api_Datatype_hasNestedRecursion(
- JNIEnv* env, jobject, jlong pointer)
-{
- CVC5_JAVA_API_TRY_CATCH_BEGIN;
- Datatype* current = (Datatype*)pointer;
- return (jboolean)current->hasNestedRecursion();
- CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
-}
-
/*
* Class: io_github_cvc5_api_Datatype
* Method: isNull
bint isRecord() except +
bint isFinite() except +
bint isWellFounded() except +
- bint hasNestedRecursion() except +
bint isNull() except +
string toString() except +
cppclass const_iterator:
""":return: True if this datatype is well-founded (see :cpp:func:`Datatype::isWellFounded() <cvc5::api::Datatype::isWellFounded>`)."""
return self.cd.isWellFounded()
- def hasNestedRecursion(self):
- """:return: True if this datatype has nested recursion (see :cpp:func:`Datatype::hasNestedRecursion() <cvc5::api::Datatype::hasNestedRecursion>`)."""
- return self.cd.hasNestedRecursion()
-
def isNull(self):
""":return: True if this Datatype is a null object."""
return self.cd.isNull()
ASSERT_TRUE(dtsorts[0].getDatatype().isWellFounded());
ASSERT_TRUE(dtsorts[1].getDatatype().isWellFounded());
ASSERT_TRUE(dtsorts[2].getDatatype().isWellFounded());
- ASSERT_FALSE(dtsorts[0].getDatatype().hasNestedRecursion());
- ASSERT_FALSE(dtsorts[1].getDatatype().hasNestedRecursion());
- ASSERT_FALSE(dtsorts[2].getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
dtsorts[0].getDatatype()[0][0].getCodomainSort().getArrayElementSort(),
dtsorts[0]);
ASSERT_TRUE(dtsorts[0].getDatatype().isWellFounded());
- ASSERT_TRUE(dtsorts[0].getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
ASSERT_EQ(dtsorts.size(), 2);
ASSERT_TRUE(dtsorts[0].getDatatype().isWellFounded());
ASSERT_TRUE(dtsorts[1].getDatatype().isWellFounded());
- ASSERT_TRUE(dtsorts[0].getDatatype().hasNestedRecursion());
- ASSERT_TRUE(dtsorts[1].getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
ASSERT_EQ(dtsorts.size(), 2);
ASSERT_TRUE(dtsorts[0].getDatatype().isWellFounded());
ASSERT_TRUE(dtsorts[1].getDatatype().isWellFounded());
- ASSERT_TRUE(dtsorts[0].getDatatype().hasNestedRecursion());
- ASSERT_TRUE(dtsorts[1].getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
ASSERT_NO_THROW(dtsorts = d_solver.mkDatatypeSorts(dtdecls, unresTypes));
ASSERT_EQ(dtsorts.size(), 1);
ASSERT_TRUE(dtsorts[0].getDatatype().isWellFounded());
- ASSERT_TRUE(dtsorts[0].getDatatype().hasNestedRecursion());
}
TEST_F(TestApiBlackDatatype, datatypeSpecializedCons)
assertTrue(dtsorts.get(0).getDatatype().isWellFounded());
assertTrue(dtsorts.get(1).getDatatype().isWellFounded());
assertTrue(dtsorts.get(2).getDatatype().isWellFounded());
- assertFalse(dtsorts.get(0).getDatatype().hasNestedRecursion());
- assertFalse(dtsorts.get(1).getDatatype().hasNestedRecursion());
- assertFalse(dtsorts.get(2).getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
.getArrayElementSort(),
dtsorts.get(0));
assertTrue(dtsorts.get(0).getDatatype().isWellFounded());
- assertTrue(dtsorts.get(0).getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
assertEquals(dtsorts.size(), 2);
assertTrue(dtsorts.get(0).getDatatype().isWellFounded());
assertTrue(dtsorts.get(1).getDatatype().isWellFounded());
- assertTrue(dtsorts.get(0).getDatatype().hasNestedRecursion());
- assertTrue(dtsorts.get(1).getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
assertEquals(dtsorts.size(), 2);
assertTrue(dtsorts.get(0).getDatatype().isWellFounded());
assertTrue(dtsorts.get(1).getDatatype().isWellFounded());
- assertTrue(dtsorts.get(0).getDatatype().hasNestedRecursion());
- assertTrue(dtsorts.get(1).getDatatype().hasNestedRecursion());
/* Create mutual datatypes corresponding to this definition block:
* DATATYPE
dtsorts = atomic.get();
assertEquals(dtsorts.size(), 1);
assertTrue(dtsorts.get(0).getDatatype().isWellFounded());
- assertTrue(dtsorts.get(0).getDatatype().hasNestedRecursion());
}
@Test void datatypeSpecializedCons() throws CVC5ApiException
assert dtsorts[0].getDatatype().isWellFounded()
assert dtsorts[1].getDatatype().isWellFounded()
assert dtsorts[2].getDatatype().isWellFounded()
- assert not dtsorts[0].getDatatype().hasNestedRecursion()
- assert not dtsorts[1].getDatatype().hasNestedRecursion()
- assert not dtsorts[2].getDatatype().hasNestedRecursion()
# Create mutual datatypes corresponding to this definition block:
# DATATYPE
assert dtsorts[0].getDatatype()[0][0].getCodomainSort().getArrayElementSort() \
== dtsorts[0]
assert dtsorts[0].getDatatype().isWellFounded()
- assert dtsorts[0].getDatatype().hasNestedRecursion()
# Create mutual datatypes corresponding to this definition block:
# DATATYPE
assert len(dtsorts) == 2
assert dtsorts[0].getDatatype().isWellFounded()
assert dtsorts[1].getDatatype().isWellFounded()
- assert dtsorts[0].getDatatype().hasNestedRecursion()
- assert dtsorts[1].getDatatype().hasNestedRecursion()
# Create mutual datatypes corresponding to this definition block:
# DATATYPE
assert len(dtsorts) == 2
assert dtsorts[0].getDatatype().isWellFounded()
assert dtsorts[1].getDatatype().isWellFounded()
- assert dtsorts[0].getDatatype().hasNestedRecursion()
- assert dtsorts[1].getDatatype().hasNestedRecursion()
# Create mutual datatypes corresponding to this definition block:
# DATATYPE
dtsorts = solver.mkDatatypeSorts(dtdecls, unresTypes)
assert len(dtsorts) == 1
assert dtsorts[0].getDatatype().isWellFounded()
- assert dtsorts[0].getDatatype().hasNestedRecursion()
def test_datatype_specialized_cons(solver):