def _type_to_msat(self, tp): if tp.is_bool_type(): return self.boolType elif tp.is_real_type(): return self.realType elif tp.is_int_type(): return self.intType elif tp.is_function_type(): stps = [self._type_to_msat(x) for x in tp.param_types] rtp = self._type_to_msat(tp.return_type) return mathsat.msat_get_function_type(self.msat_env, stps, rtp) else: assert tp.is_bv_type(), "Usupported type for '%s'" % tp return mathsat.msat_get_bv_type(self.msat_env, tp.width)
def _type_to_msat(self, tp): """Convert a pySMT type into a MathSAT type.""" if tp.is_bool_type(): return self.boolType elif tp.is_real_type(): return self.realType elif tp.is_int_type(): return self.intType elif tp.is_function_type(): stps = [self._type_to_msat(x) for x in tp.param_types] rtp = self._type_to_msat(tp.return_type) msat_type = mathsat.msat_get_function_type(self.msat_env(), stps, rtp) if mathsat.MSAT_ERROR_TYPE(msat_type): msat_msg = mathsat.msat_last_error_message(self.msat_env()) raise InternalSolverError(msat_msg) return msat_type else: assert tp.is_bv_type(), "Usupported type for '%s'" % tp return mathsat.msat_get_bv_type(self.msat_env(), tp.width)