* Method: newSolver
* Signature: ()J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_newSolver(JNIEnv*,
- jobject)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_newSolver(JNIEnv*, jobject)
{
Solver* solver = new Solver();
return reinterpret_cast<jlong>(solver);
* Method: deletePointer
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_io_github_cvc5_Solver_deletePointer(JNIEnv*, jclass, jlong pointer)
+JNIEXPORT void JNICALL Java_io_github_cvc5_Solver_deletePointer(JNIEnv* env,
+ jclass,
+ jlong pointer)
{
+ const std::vector<jobject>& refs = globalReferences[pointer];
+ for (jobject ref : refs)
+ {
+ env->DeleteGlobalRef(ref);
+ }
+ globalReferences.erase(pointer);
delete (reinterpret_cast<Solver*>(pointer));
}
* Method: getNullSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_getNullSort(JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getNullSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getBooleanSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getBooleanSort(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getBooleanSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getIntegerSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getIntegerSort(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getIntegerSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getRealSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_getRealSort(JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getRealSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getRegExpSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getRegExpSort(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getRegExpSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getStringSort
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getStringSort(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getStringSort(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkArraySort(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong indexSortPointer,
- jlong elementSortPointer)
+ jobject,
+ jlong pointer,
+ jlong indexSortPointer,
+ jlong elementSortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkDatatypeSorts
* Signature: (J[J)[J
*/
-JNIEXPORT jlongArray JNICALL
-Java_io_github_cvc5_Solver_mkDatatypeSorts(JNIEnv* env,
- jobject,
- jlong pointer,
- jlongArray jDecls)
+JNIEXPORT jlongArray JNICALL Java_io_github_cvc5_Solver_mkDatatypeSorts(
+ JNIEnv* env, jobject, jlong pointer, jlongArray jDecls)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkTerm
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkTerm__JI(
- JNIEnv* env, jobject, jlong pointer, jint kindValue)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkTerm__JI(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jint kindValue)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTerm__JIJJ(JNIEnv* env,
- jobject,
- jlong pointer,
- jint kindValue,
- jlong child1Pointer,
- jlong child2Pointer)
+ jobject,
+ jlong pointer,
+ jint kindValue,
+ jlong child1Pointer,
+ jlong child2Pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTerm__JIJJJ(JNIEnv* env,
- jobject,
- jlong pointer,
- jint kindValue,
- jlong child1Pointer,
- jlong child2Pointer,
- jlong child3Pointer)
+ jobject,
+ jlong pointer,
+ jint kindValue,
+ jlong child1Pointer,
+ jlong child2Pointer,
+ jlong child3Pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTerm__JI_3J(JNIEnv* env,
- jobject,
- jlong pointer,
- jint kindValue,
- jlongArray childrenPointers)
+ jobject,
+ jlong pointer,
+ jint kindValue,
+ jlongArray childrenPointers)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkTerm
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkTerm__JJ(
- JNIEnv* env, jobject, jlong pointer, jlong opPointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkTerm__JJ(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong opPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTerm__JJJJ(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong opPointer,
- jlong child1Pointer,
- jlong child2Pointer)
+ jobject,
+ jlong pointer,
+ jlong opPointer,
+ jlong child1Pointer,
+ jlong child2Pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTerm__JJJJJ(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong opPointer,
- jlong child1Pointer,
- jlong child2Pointer,
- jlong child3Pointer)
+ jobject,
+ jlong pointer,
+ jlong opPointer,
+ jlong child1Pointer,
+ jlong child2Pointer,
+ jlong child3Pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTerm__JJ_3J(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong opPointer,
- jlongArray childrenPointers)
+ jobject,
+ jlong pointer,
+ jlong opPointer,
+ jlongArray childrenPointers)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkTuple(JNIEnv* env,
- jobject,
- jlong pointer,
- jlongArray sortPointers,
- jlongArray termPointers)
+ jobject,
+ jlong pointer,
+ jlongArray sortPointers,
+ jlongArray termPointers)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkOp__JI(JNIEnv* env,
- jobject,
- jlong pointer,
- jint kindValue)
+ jobject,
+ jlong pointer,
+ jint kindValue)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkOp
* Signature: (JILjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_mkOp__JILjava_lang_String_2(
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkOp__JILjava_lang_String_2(
JNIEnv* env, jobject, jlong pointer, jint kindValue, jstring jArg)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkTrue(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkFalse(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (JZ)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkBoolean(JNIEnv* env,
- jobject,
- jlong pointer,
- jboolean val)
+ jobject,
+ jlong pointer,
+ jboolean val)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkPi(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_mkInteger__JLjava_lang_String_2(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jS)
+ jobject,
+ jlong pointer,
+ jstring jS)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkInteger
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkInteger__JJ(
- JNIEnv* env, jobject, jlong pointer, jlong val)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkInteger__JJ(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong val)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkReal
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_mkReal__JLjava_lang_String_2(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jS)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkReal__JLjava_lang_String_2(
+ JNIEnv* env, jobject, jlong pointer, jstring jS)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkRealValue
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRealValue(
- JNIEnv* env, jobject, jlong pointer, jlong val)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRealValue(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong val)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkRegexpNone
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRegexpNone(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRegexpNone(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkRegexpAll
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_mkRegexpAll(JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRegexpAll(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkRegexpAllchar
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRegexpAllchar(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_mkRegexpAllchar(JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkEmptySet
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkEmptySet(
- JNIEnv* env, jobject, jlong pointer, jlong sortPointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkEmptySet(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong sortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkEmptyBag
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkEmptyBag(
- JNIEnv* env, jobject, jlong pointer, jlong sortPointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkEmptyBag(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong sortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkSepEmp(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkSepNil
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkSepNil(
- JNIEnv* env, jobject, jlong pointer, jlong sortPointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkSepNil(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong sortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkRoundingMode
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRoundingMode(
- JNIEnv* env, jobject, jlong pointer, jint rm)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkRoundingMode(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jint rm)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: mkDatatypeConstructorDecl
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_mkDatatypeConstructorDecl(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jName)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_mkDatatypeConstructorDecl(
+ JNIEnv* env, jobject, jlong pointer, jstring jName)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: simplify
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_simplify(
- JNIEnv* env, jobject, jlong pointer, jlong termPointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_simplify(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jlong termPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_checkSat(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: declareFun
* Signature: (JLjava/lang/String;[JJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_declareFun(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jSymbol,
- jlongArray jSorts,
- jlong sortPointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_declareFun(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jstring jSymbol,
+ jlongArray jSorts,
+ jlong sortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: defineFun
* Signature: (JLjava/lang/String;[JJJZ)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_defineFun(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jSymbol,
- jlongArray jVars,
- jlong sortPointer,
- jlong termPointer,
- jboolean global)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_defineFun(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jstring jSymbol,
+ jlongArray jVars,
+ jlong sortPointer,
+ jlong termPointer,
+ jboolean global)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_defineFunRec__JJ_3JJZ(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong funPointer,
- jlongArray jVars,
- jlong termPointer,
- jboolean global)
+ jobject,
+ jlong pointer,
+ jlong funPointer,
+ jlongArray jVars,
+ jlong termPointer,
+ jboolean global)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT void JNICALL
Java_io_github_cvc5_Solver_defineFunsRec(JNIEnv* env,
- jobject,
- jlong pointer,
- jlongArray jFuns,
- jobjectArray jVars,
- jlongArray jTerms,
- jboolean global)
+ jobject,
+ jlong pointer,
+ jlongArray jFuns,
+ jobjectArray jVars,
+ jlongArray jTerms,
+ jboolean global)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getAssertions
* Signature: (J)[J
*/
-JNIEXPORT jlongArray JNICALL Java_io_github_cvc5_Solver_getAssertions(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlongArray JNICALL
+Java_io_github_cvc5_Solver_getAssertions(JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (JLjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_io_github_cvc5_Solver_getInfo(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jFlag)
+ jobject,
+ jlong pointer,
+ jstring jFlag)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getOption
* Signature: (JLjava/lang/String;)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL Java_io_github_cvc5_Solver_getOption(
- JNIEnv* env, jobject, jlong pointer, jstring jOption)
+JNIEXPORT jstring JNICALL Java_io_github_cvc5_Solver_getOption(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jstring jOption)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getOptionNames
* Signature: (J)[Ljava/lang/String;
*/
-JNIEXPORT jobjectArray JNICALL Java_io_github_cvc5_Solver_getOptionNames(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jobjectArray JNICALL
+Java_io_github_cvc5_Solver_getOptionNames(JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getDriverOptions
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getDriverOptions(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_getDriverOptions(JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getDifficulty
* Signature: (J)Ljava/util/Map;
*/
-JNIEXPORT jobject JNICALL Java_io_github_cvc5_Solver_getDifficulty(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jobject JNICALL
+Java_io_github_cvc5_Solver_getDifficulty(JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_io_github_cvc5_Solver_getProof(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getModelDomainElements
* Signature: (JJ)[J
*/
-JNIEXPORT jlongArray JNICALL
-Java_io_github_cvc5_Solver_getModelDomainElements(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong sortPointer)
+JNIEXPORT jlongArray JNICALL Java_io_github_cvc5_Solver_getModelDomainElements(
+ JNIEnv* env, jobject, jlong pointer, jlong sortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jstring JNICALL
Java_io_github_cvc5_Solver_getModel(JNIEnv* env,
- jobject,
- jlong pointer,
- jlongArray sortPointers,
- jlongArray varPointers)
+ jobject,
+ jlong pointer,
+ jlongArray sortPointers,
+ jlongArray varPointers)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_getQuantifierEliminationDisjunct(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong qPointer)
+ jobject,
+ jlong pointer,
+ jlong qPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT void JNICALL
Java_io_github_cvc5_Solver_declareSepHeap(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong locSortPointer,
- jlong dataSortPointer)
+ jobject,
+ jlong pointer,
+ jlong locSortPointer,
+ jlong dataSortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getValueSepHeap
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getValueSepHeap(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_getValueSepHeap(JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getValueSepNil
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getValueSepNil(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getValueSepNil(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: declarePool
* Signature: (Ljava/lang/String;J[J])J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_declarePool(
- JNIEnv* env, jobject, jlong pointer, jstring jsymbol, jlong sort, jlongArray initValuePointers)
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_declarePool(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jstring jsymbol,
+ jlong sort,
+ jlongArray initValuePointers)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
const char* s = env->GetStringUTFChars(jsymbol, nullptr);
std::string symbol(s);
Sort* sortptr = reinterpret_cast<Sort*>(sort);
- std::vector<Term> initValue = getObjectsFromPointers<Term>(env, initValuePointers);
+ std::vector<Term> initValue =
+ getObjectsFromPointers<Term>(env, initValuePointers);
Term* retPointer = new Term(solver->declarePool(symbol, *sortptr, initValue));
return reinterpret_cast<jlong>(retPointer);
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
+/*
+ * Class: io_github_cvc5_Solver
+ * Method: declareOracleFun
+ * Signature: (JLjava/lang/String;[JJLio/github/cvc5/IOracle;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_Solver_declareOracleFun(JNIEnv* env,
+ jobject jSolver,
+ jlong pointer,
+ jstring jSymbol,
+ jlongArray sortPointers,
+ jlong sortPointer,
+ jobject oracle)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+ jobject solverReference = env->NewGlobalRef(jSolver);
+ globalReferences[pointer].push_back(solverReference);
+ jobject oracleReference = env->NewGlobalRef(oracle);
+ globalReferences[pointer].push_back(oracleReference);
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ const char* s = env->GetStringUTFChars(jSymbol, nullptr);
+ std::string cSymbol(s);
+ Sort* sort = reinterpret_cast<Sort*>(sortPointer);
+ std::vector<Sort> sorts = getObjectsFromPointers<Sort>(env, sortPointers);
+ std::function<Term(std::vector<Term>)> fn =
+ [env, solverReference, oracleReference](std::vector<Term> input) {
+ Term term = applyOracle(env, solverReference, oracleReference, input);
+ return term;
+ };
+ Term* retPointer =
+ new Term(solver->declareOracleFun(cSymbol, sorts, *sort, fn));
+ return reinterpret_cast<jlong>(retPointer);
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: io_github_cvc5_Solver
* Method: pop
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_io_github_cvc5_Solver_pop(JNIEnv* env,
- jobject,
- jlong pointer,
- jint nscopes)
+ jobject,
+ jlong pointer,
+ jint nscopes)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_getInterpolant__JJJ(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong conjPointer,
- jlong grammarPointer)
+ jobject,
+ jlong pointer,
+ jlong conjPointer,
+ jlong grammarPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT jlong JNICALL
Java_io_github_cvc5_Solver_getAbduct__JJJ(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong conjPointer,
- jlong grammarPointer)
+ jobject,
+ jlong pointer,
+ jlong conjPointer,
+ jlong grammarPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getAbductNext
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getAbductNext(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getAbductNext(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getInstantiations
* Signature: (J[J[J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_io_github_cvc5_Solver_getInstantiations(JNIEnv* env,
- jobject,
- jlong pointer)
+JNIEXPORT jstring JNICALL Java_io_github_cvc5_Solver_getInstantiations(
+ JNIEnv* env, jobject, jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_io_github_cvc5_Solver_push(JNIEnv* env,
- jobject,
- jlong pointer,
- jint nscopes)
+ jobject,
+ jlong pointer,
+ jint nscopes)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: resetAssertions
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_io_github_cvc5_Solver_resetAssertions(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT void JNICALL Java_io_github_cvc5_Solver_resetAssertions(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_io_github_cvc5_Solver_setLogic(JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jLogic)
+ jobject,
+ jlong pointer,
+ jstring jLogic)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
* Signature: (JLjava/lang/String;[JJ)J
*/
JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_synthFun__JLjava_lang_String_2_3JJ(
- JNIEnv* env,
- jobject,
- jlong pointer,
- jstring jSymbol,
- jlongArray jVars,
- jlong sortPointer)
+Java_io_github_cvc5_Solver_synthFun__JLjava_lang_String_2_3JJ(JNIEnv* env,
+ jobject,
+ jlong pointer,
+ jstring jSymbol,
+ jlongArray jVars,
+ jlong sortPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
*/
JNIEXPORT void JNICALL
Java_io_github_cvc5_Solver_addSygusInvConstraint(JNIEnv* env,
- jobject,
- jlong pointer,
- jlong invPointer,
- jlong prePointer,
- jlong transPointer,
- jlong postPointer)
+ jobject,
+ jlong pointer,
+ jlong invPointer,
+ jlong prePointer,
+ jlong transPointer,
+ jlong postPointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_checkSynth(JNIEnv* env,
- jobject,
- jlong pointer)
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: checkSynthNext
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_checkSynthNext(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_checkSynthNext(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Method: getStatistics
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getStatistics(
- JNIEnv* env, jobject, jlong pointer)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getStatistics(JNIEnv* env,
+ jobject,
+ jlong pointer)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Solver* solver = reinterpret_cast<Solver*>(pointer);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getNullTerm(JNIEnv* env,
- jobject,
- jlong)
+ jobject,
+ jlong)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Term* ret = new Term();
* Method: getNullResult
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_io_github_cvc5_Solver_getNullResult(JNIEnv* env, jobject, jlong)
+JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getNullResult(JNIEnv* env,
+ jobject,
+ jlong)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Result* ret = new Result();
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_io_github_cvc5_Solver_getNullOp(JNIEnv* env,
- jobject,
- jlong)
+ jobject,
+ jlong)
{
CVC5_JAVA_API_TRY_CATCH_BEGIN;
Op* ret = new Op();
// list datatype
Sort sort = d_solver.mkParamSort("T");
- DatatypeDecl listDecl =
- d_solver.mkDatatypeDecl("paramlist", new Sort[] {sort});
+ DatatypeDecl listDecl = d_solver.mkDatatypeDecl("paramlist", new Sort[] {sort});
DatatypeConstructorDecl cons = d_solver.mkDatatypeConstructorDecl("cons");
DatatypeConstructorDecl nil = d_solver.mkDatatypeConstructorDecl("nil");
cons.addSelector("head", sort);
new Term[] {d_solver.mkBitVector(3, "101", 2)}));
assertThrows(CVC5ApiException.class,
()
- -> d_solver.mkTuple(new Sort[] {d_solver.getRealSort()},
- new Term[] {d_solver.mkInteger("5")}));
+ -> d_solver.mkTuple(
+ new Sort[] {d_solver.getRealSort()}, new Term[] {d_solver.mkInteger("5")}));
assertThrows(CVC5ApiException.class,
() -> d_solver.mkTuple(new Sort[] {}, new Term[] {d_solver.mkBitVector(3, "101", 2)}));
Term x = d_solver.mkConst(intSort, "x");
Term y = d_solver.mkConst(intSort, "y");
// declare a pool with initial value { 0, x, y }
- Term p = d_solver.declarePool("p", intSort, new Term[]{zero, x, y});
+ Term p = d_solver.declarePool("p", intSort, new Term[] {zero, x, y});
// pool should have the same sort
assertEquals(p.getSort(), setSort);
}
assertDoesNotThrow(() -> d_solver.getValue(sum));
assertDoesNotThrow(() -> d_solver.getValue(p_f_y));
- Term[] b = d_solver.getValue(new Term[]{x, y, z});
+ Term[] b = d_solver.getValue(new Term[] {x, y, z});
Solver slv = new Solver();
assertThrows(CVC5ApiException.class, () -> slv.getValue(x));
}
@Test
- void mkGrammar() throws CVC5ApiException {
+ void mkGrammar() throws CVC5ApiException
+ {
Term nullTerm = d_solver.getNullTerm();
Term boolTerm = d_solver.mkBoolean(true);
Term boolVar = d_solver.mkVar(d_solver.getBooleanSort());
Term intVar = d_solver.mkVar(d_solver.getIntegerSort());
- assertDoesNotThrow(
- () -> d_solver.mkGrammar(new Term[] {}, new Term[] {intVar}));
- assertDoesNotThrow(
- () -> d_solver.mkGrammar(new Term[] {boolVar}, new Term[] {intVar}));
+ assertDoesNotThrow(() -> d_solver.mkGrammar(new Term[] {}, new Term[] {intVar}));
+ assertDoesNotThrow(() -> d_solver.mkGrammar(new Term[] {boolVar}, new Term[] {intVar}));
- assertThrows(CVC5ApiException.class,
- () -> d_solver.mkGrammar(new Term[] {}, new Term[] {}));
- assertThrows(CVC5ApiException.class,
- () -> d_solver.mkGrammar(new Term[] {}, new Term[] {nullTerm}));
- assertThrows(CVC5ApiException.class,
- () -> d_solver.mkGrammar(new Term[] {}, new Term[] {boolTerm}));
+ assertThrows(CVC5ApiException.class, () -> d_solver.mkGrammar(new Term[] {}, new Term[] {}));
+ assertThrows(
+ CVC5ApiException.class, () -> d_solver.mkGrammar(new Term[] {}, new Term[] {nullTerm}));
+ assertThrows(
+ CVC5ApiException.class, () -> d_solver.mkGrammar(new Term[] {}, new Term[] {boolTerm}));
assertThrows(CVC5ApiException.class,
() -> d_solver.mkGrammar(new Term[] {boolTerm}, new Term[] {intVar}));
slv.setOption("sygus", "true");
Term boolVar2 = slv.mkVar(slv.getBooleanSort());
Term intVar2 = slv.mkVar(slv.getIntegerSort());
- assertDoesNotThrow(
- () -> slv.mkGrammar(new Term[] {boolVar2}, new Term[] {intVar2}));
+ assertDoesNotThrow(() -> slv.mkGrammar(new Term[] {boolVar2}, new Term[] {intVar2}));
- assertThrows(CVC5ApiException.class,
- () -> slv.mkGrammar(new Term[] {boolVar}, new Term[] {intVar2}));
- assertThrows(CVC5ApiException.class,
- () -> slv.mkGrammar(new Term[] {boolVar2}, new Term[] {intVar}));
+ assertThrows(
+ CVC5ApiException.class, () -> slv.mkGrammar(new Term[] {boolVar}, new Term[] {intVar2}));
+ assertThrows(
+ CVC5ApiException.class, () -> slv.mkGrammar(new Term[] {boolVar2}, new Term[] {intVar}));
slv.close();
}
+ "(set.singleton \"Z\")))",
projection.toString());
}
+
+ @Test
+ void declareOracleFunError() throws CVC5ApiException
+ {
+ Sort iSort = d_solver.getIntegerSort();
+ // cannot declare without option
+ assertThrows(CVC5ApiException.class,
+ ()
+ -> d_solver.declareOracleFun(
+ "f", new Sort[] {iSort}, iSort, (input) -> d_solver.mkInteger(0)));
+ d_solver.setOption("oracles", "true");
+ Sort nullSort = d_solver.getNullSort();
+ // bad sort
+ assertThrows(CVC5ApiException.class,
+ ()
+ -> d_solver.declareOracleFun(
+ "f", new Sort[] {nullSort}, iSort, (input) -> d_solver.mkInteger(0)));
+ }
+
+ @Test
+ void declareOracleFunUnsat() throws CVC5ApiException
+ {
+ d_solver.setOption("oracles", "true");
+ Sort iSort = d_solver.getIntegerSort();
+ // f is the function implementing (lambda ((x Int)) (+ x 1))
+ Term f = d_solver.declareOracleFun("f", new Sort[] {iSort}, iSort, (input) -> {
+ if (input[0].getIntegerValue().signum() > -1)
+ {
+ return d_solver.mkInteger(input[0].getIntegerValue().add(new BigInteger("1")).toString());
+ }
+ return d_solver.mkInteger(0);
+ });
+ Term three = d_solver.mkInteger(3);
+ Term five = d_solver.mkInteger(5);
+ Term eq =
+ d_solver.mkTerm(EQUAL, new Term[] {d_solver.mkTerm(APPLY_UF, new Term[] {f, three}), five});
+ d_solver.assertFormula(eq);
+ // (f 3) = 5
+ assertTrue(d_solver.checkSat().isUnsat());
+ }
+
+ @Test
+ void declareOracleFunSat() throws CVC5ApiException
+ {
+ d_solver.setOption("oracles", "true");
+ d_solver.setOption("produce-models", "true");
+ Sort iSort = d_solver.getIntegerSort();
+
+ // f is the function implementing (lambda ((x Int)) (% x 10))
+ Term f = d_solver.declareOracleFun("f", new Sort[] {iSort}, iSort, (input) -> {
+ if (input[0].getIntegerValue().signum() > -1)
+ {
+ return d_solver.mkInteger(input[0].getIntegerValue().mod(new BigInteger("10")).toString());
+ }
+ return d_solver.mkInteger(0);
+ });
+ Term seven = d_solver.mkInteger(7);
+ Term x = d_solver.mkConst(iSort, "x");
+ Term lb = d_solver.mkTerm(Kind.GEQ, new Term[] {x, d_solver.mkInteger(0)});
+ d_solver.assertFormula(lb);
+ Term ub = d_solver.mkTerm(Kind.LEQ, new Term[] {x, d_solver.mkInteger(100)});
+ d_solver.assertFormula(ub);
+ Term eq = d_solver.mkTerm(
+ Kind.EQUAL, new Term[] {d_solver.mkTerm(APPLY_UF, new Term[] {f, x}), seven});
+ d_solver.assertFormula(eq);
+ // x >= 0 ^ x <= 100 ^ (f x) = 7
+ assertTrue(d_solver.checkSat().isSat());
+ Term xval = d_solver.getValue(x);
+ assertTrue(xval.getIntegerValue().signum() > -1);
+ assertTrue(xval.getIntegerValue().mod(new BigInteger("10")).equals(new BigInteger("7")));
+ }
+
+ @Test
+ void declareOracleFunSat2() throws CVC5ApiException
+ {
+ d_solver.setOption("oracles", "true");
+ d_solver.setOption("produce-models", "true");
+ Sort iSort = d_solver.getIntegerSort();
+ Sort bSort = d_solver.getBooleanSort();
+ // eq is the function implementing (lambda ((x Int) (y Int)) (= x y))
+ Term eq = d_solver.declareOracleFun("eq", new Sort[] {iSort, iSort}, bSort, (input) -> {
+ return d_solver.mkBoolean(input[0].equals(input[1]));
+ });
+ Term x = d_solver.mkConst(iSort, "x");
+ Term y = d_solver.mkConst(iSort, "y");
+ Term neq = d_solver.mkTerm(
+ Kind.NOT, new Term[] {d_solver.mkTerm(Kind.APPLY_UF, new Term[] {eq, x, y})});
+ d_solver.assertFormula(neq);
+ // (not (eq x y))
+ assertTrue(d_solver.checkSat().isSat());
+ Term xval = d_solver.getValue(x);
+ Term yval = d_solver.getValue(y);
+ assertFalse(xval.equals(yval));
+ }
}