Exemplo n.º 1
0
 def pop(self, levels=1):
     for _ in xrange(levels):
         if self.failed_pushes > 0:
             self.failed_pushes -= 1
         else:
             c = yicespy.yices_pop(self.yices)
             if c != 0:
                 raise InternalSolverError("Error in pop: %s" % \
                                           yicespy.yices_error_string())
Exemplo n.º 2
0
 def pop(self, levels=1):
     for _ in xrange(levels):
         if self.failed_pushes > 0:
             self.failed_pushes -= 1
         else:
             c = yicespy.yices_pop(self.yices)
             if c != 0:
                 raise InternalSolverError("Error in pop: %s" % \
                                           yicespy.yices_error_string())
Exemplo n.º 3
0
 def add_assertion(self, formula, named=None):
     self._assert_is_boolean(formula)
     term = self.converter.convert(formula)
     code = yicespy.yices_assert_formula(self.yices, term)
     if code != 0:
         msg = yicespy.yices_error_string()
         if code == -1 and "non-linear arithmetic" in msg:
             raise NonLinearError(formula)
         raise InternalSolverError("Yices returned non-zero code upon assert"\
                                   ": %s (code: %s)" % \
                                   (msg, code))
Exemplo n.º 4
0
 def add_assertion(self, formula, named=None):
     self._assert_is_boolean(formula)
     term = self.converter.convert(formula)
     code = yicespy.yices_assert_formula(self.yices, term)
     if code != 0:
         msg = yicespy.yices_error_string()
         if code == -1 and "non-linear arithmetic" in msg:
             raise NonLinearError(formula)
         raise InternalSolverError("Yices returned non-zero code upon assert"\
                                   ": %s (code: %s)" % \
                                   (msg, code))
Exemplo n.º 5
0
 def push(self, levels=1):
     for _ in xrange(levels):
         c = yicespy.yices_push(self.yices)
         if c != 0:
             # 4 is STATUS_UNSAT
             if yicespy.yices_context_status(self.yices) == 4:
                 # Yices fails to push if the context is in UNSAT state
                 # (It makes no sense to conjoin formulae to False)
                 # PySMT allows this and we support it by counting the
                 # spurious push calls
                 self.failed_pushes += 1
             else:
                 raise InternalSolverError("Error in push: %s" % \
                                           yicespy.yices_error_string())
Exemplo n.º 6
0
 def push(self, levels=1):
     for _ in xrange(levels):
         c = yicespy.yices_push(self.yices)
         if c != 0:
             # 4 is STATUS_UNSAT
             if yicespy.yices_context_status(self.yices) == 4:
                 # Yices fails to push if the context is in UNSAT state
                 # (It makes no sense to conjoin formulae to False)
                 # PySMT allows this and we support it by counting the
                 # spurious push calls
                 self.failed_pushes += 1
             else:
                 raise InternalSolverError("Error in push: %s" % \
                                           yicespy.yices_error_string())
Exemplo n.º 7
0
 def _check_term_result(self, res):
     if res == -1:
         err = yicespy.yices_error_string()
         raise InternalSolverError("Yices returned an error: " + err)
Exemplo n.º 8
0
 def _check_error(self, res):
     if res != 0:
         err = yicespy.yices_error_string()
         raise InternalSolverError("Yices returned an error: " + err)
Exemplo n.º 9
0
 def _check_term_result(self, res):
     if res == -1:
         err = yicespy.yices_error_string()
         raise InternalSolverError("Yices returned an error: " + err)
Exemplo n.º 10
0
 def _check_error(self, res):
     if res != 0:
         err = yicespy.yices_error_string()
         raise InternalSolverError("Yices returned an error: " + err)