diff options
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/cvc4cpp.cpp | 11 | ||||
-rw-r--r-- | src/api/cvc4cpp.h | 9 | ||||
-rw-r--r-- | src/api/python/cvc4.pxd | 1 | ||||
-rw-r--r-- | src/api/python/cvc4.pxi | 3 |
4 files changed, 24 insertions, 0 deletions
diff --git a/src/api/cvc4cpp.cpp b/src/api/cvc4cpp.cpp index c0e6bad5f..566bcc3c7 100644 --- a/src/api/cvc4cpp.cpp +++ b/src/api/cvc4cpp.cpp @@ -5194,6 +5194,17 @@ Term Solver::getQuantifierEliminationDisjunct(api::Term q) const CVC4_API_SOLVER_TRY_CATCH_END; } +void Solver::declareSeparationHeap(api::Sort locSort, api::Sort dataSort) const +{ + CVC4_API_SOLVER_TRY_CATCH_BEGIN; + CVC4_API_CHECK( + d_smtEngine->getLogicInfo().isTheoryEnabled(theory::THEORY_SEP)) + << "Cannot obtain separation logic expressions if not using the " + "separation logic theory."; + d_smtEngine->declareSepHeap(locSort.getTypeNode(), dataSort.getTypeNode()); + CVC4_API_SOLVER_TRY_CATCH_END; +} + Term Solver::getSeparationHeap() const { CVC4_API_SOLVER_TRY_CATCH_BEGIN; diff --git a/src/api/cvc4cpp.h b/src/api/cvc4cpp.h index 13d4f6e23..db57af121 100644 --- a/src/api/cvc4cpp.h +++ b/src/api/cvc4cpp.h @@ -3158,6 +3158,15 @@ class CVC4_PUBLIC Solver Term getQuantifierEliminationDisjunct(api::Term q) const; /** + * When using separation logic, this sets the location sort and the + * datatype sort to the given ones. This method should be invoked exactly + * once, before any separation logic constraints are provided. + * @param locSort The location sort of the heap + * @param dataSort The data sort of the heap + */ + void declareSeparationHeap(api::Sort locSort, api::Sort dataSort) const; + + /** * When using separation logic, obtain the term for the heap. * @return The term for the heap */ diff --git a/src/api/python/cvc4.pxd b/src/api/python/cvc4.pxd index 13f4606da..29f997394 100644 --- a/src/api/python/cvc4.pxd +++ b/src/api/python/cvc4.pxd @@ -235,6 +235,7 @@ cdef extern from "api/cvc4cpp.h" namespace "CVC4::api": vector[Term] getUnsatCore() except + Term getValue(Term term) except + vector[Term] getValue(const vector[Term]& terms) except + + void declareSeparationHeap(Sort locSort, Sort dataSort) except + Term getSeparationHeap() except + Term getSeparationNilTerm() except + void pop(uint32_t nscopes) except + diff --git a/src/api/python/cvc4.pxi b/src/api/python/cvc4.pxi index 16f454311..f945228dd 100644 --- a/src/api/python/cvc4.pxi +++ b/src/api/python/cvc4.pxi @@ -1122,6 +1122,9 @@ cdef class Solver: term.cterm = self.csolver.getSeparationHeap() return term + def declareSeparationHeap(self, Sort locType, Sort dataType): + self.csolver.declareSeparationHeap(locType.csort, dataType.csort) + def getSeparationNilTerm(self): cdef Term term = Term(self) term.cterm = self.csolver.getSeparationNilTerm() |