CVC5_API_KIND_CHECK_EXPECTED(kind == PI || kind == REGEXP_EMPTY
|| kind == REGEXP_SIGMA || kind == SEP_EMP,
kind)
- << "PI or REGEXP_EMPTY or REGEXP_SIGMA";
+ << "PI, REGEXP_EMPTY, REGEXP_SIGMA or SEP_EMP";
//////// all checks before this line
Node res;
cvc5::Kind k = extToIntKind(kind);
CVC5_API_TRY_CATCH_END;
}
+Term Solver::mkSepEmp() const
+{
+ CVC5_API_TRY_CATCH_BEGIN;
+ //////// all checks before this line
+ Node res = getNodeManager()->mkNullaryOperator(d_nodeMgr->booleanType(),
+ cvc5::Kind::SEP_EMP);
+ (void)res.getType(true); /* kick off type checking */
+ return Term(this, res);
+ ////////
+ CVC5_API_TRY_CATCH_END;
+}
+
Term Solver::mkSepNil(const Sort& sort) const
{
CVC5_API_TRY_CATCH_BEGIN;
*/
Term mkEmptyBag(const Sort& sort) const;
+ /**
+ * Create a separation logic empty term.
+ * @return the separation logic empty term
+ */
+ Term mkSepEmp() const;
+
/**
* Create a separation logic nil term.
* @param sort the sort of the nil term
private native long mkEmptyBag(long pointer, long sortPointer);
+ /**
+ * Create a separation logic empty term.
+ * @return the separation logic empty term
+ */
+ public Term mkSepEmp()
+ {
+ long termPointer = mkSepEmp(pointer);
+ return new Term(this, termPointer);
+ }
+
+ private native long mkSepEmp(long pointer);
+
/**
* Create a separation logic nil term.
* @param sort the sort of the nil term
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
+/*
+ * Class: cvc5_Solver
+ * Method: mkSepEmp
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_cvc5_Solver_mkSepEmp(JNIEnv* env,
+ jobject,
+ jlong pointer)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ Term* retPointer = new Term(solver->mkSepEmp());
+ return reinterpret_cast<jlong>(retPointer);
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: cvc5_Solver
* Method: mkSepNil
DatatypeDecl* ret = new DatatypeDecl();
return reinterpret_cast<jlong>(ret);
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
-}
\ No newline at end of file
+}
Term mkRegexpSigma() except +
Term mkEmptySet(Sort s) except +
Term mkEmptyBag(Sort s) except +
+ Term mkSepEmp() except +
Term mkSepNil(Sort sort) except +
Term mkString(const string& s) except +
Term mkString(const wstring& s) except +
term.cterm = self.csolver.mkEmptyBag(s.csort)
return term
+ def mkSepEmp(self):
+ """Create a separation logic empty term.
+
+ :return: the separation logic empty term
+ """
+ cdef Term term = Term(self)
+ term.cterm = self.csolver.mkSepEmp()
+ return term
+
def mkSepNil(self, Sort sort):
"""Create a separation logic nil term.
}
void Smt2::addSepOperators() {
+ defineVar("sep.emp", d_solver->mkSepEmp());
+ // the Boolean sort is a placeholder here since we don't have type info
+ // without type annotation
+ defineVar("sep.nil", d_solver->mkSepNil(d_solver->getBooleanSort()));
addOperator(api::SEP_STAR, "sep");
addOperator(api::SEP_PTO, "pto");
addOperator(api::SEP_WAND, "wand");
- addOperator(api::SEP_EMP, "emp");
Parser::addOperator(api::SEP_STAR);
Parser::addOperator(api::SEP_PTO);
Parser::addOperator(api::SEP_WAND);
- Parser::addOperator(api::SEP_EMP);
}
void Smt2::addCoreSymbols()
if (d_logic.areTranscendentalsUsed())
{
- defineVar("real.pi", d_solver->mkTerm(api::PI));
+ defineVar("real.pi", d_solver->mkPi());
addTranscendentalOperators();
}
if (!strictModeEnabled())
addFloatingPointOperators();
}
- if (d_logic.isTheoryEnabled(theory::THEORY_SEP)) {
- // the Boolean sort is a placeholder here since we don't have type info
- // without type annotation
- defineVar("sep.nil", d_solver->mkSepNil(d_solver->getBooleanSort()));
- defineVar("sep.emp", d_solver->mkTerm(api::SEP_EMP));
-
+ if (d_logic.isTheoryEnabled(theory::THEORY_SEP))
+ {
addSepOperators();
}
solver.mkTerm(kinds.StringInRegexp, s, solver.mkRegexpSigma())
+def test_mk_sep_emp(solver):
+ solver.mkSepEmp();
+
+
def test_mk_sep_nil(solver):
solver.mkSepNil(solver.getBooleanSort())
with pytest.raises(RuntimeError):
assertDoesNotThrow(() -> d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpSigma()));
}
+ @Test void mkSepEmp()
+ {
+ assertDoesNotThrow(() -> d_solver.mkSepEmp());
+ }
+
@Test void mkSepNil()
{
assertDoesNotThrow(() -> d_solver.mkSepNil(d_solver.getBooleanSort()));
+ "\"Z\")))",
projection.toString());
}
-}
\ No newline at end of file
+}
d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpSigma()));
}
+TEST_F(TestApiBlackSolver, mkSepEmp) { ASSERT_NO_THROW(d_solver.mkSepEmp()); }
+
TEST_F(TestApiBlackSolver, mkSepNil)
{
ASSERT_NO_THROW(d_solver.mkSepNil(d_solver.getBooleanSort()));