(self, tp)
Convert a pySMT type into a MathSAT type.
Convert a pySMT type into a MathSAT type.
Convert a pySMT type into a MathSAT type .
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
        elif tp.is_array_type():
            i = self._type_to_msat(tp.index_type)
            e = self._type_to_msat(tp.elem_type)
            msat_type = mathsat.msat_get_array_type(self.msat_env(), i, e)
            if mathsat.MSAT_ERROR_TYPE(msat_type):
                msat_msg = mathsat.msat_last_error_message(self.msat_env())
                raise InternalSolverError(msat_msg)
            return msat_type
        elif tp.is_bv_type():
            return mathsat.msat_get_bv_type(self.msat_env(), tp.width)
        elif tp.is_custom_type():
            return mathsat.msat_get_simple_type(self.msat_env(), str(tp))
        else:
            raise NotImplementedError("Usupported type for '%s'" % tp)
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 ) 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 elif tp . is_array_type ( ) : i = self . _type_to_msat ( tp . index_type ) e = self . _type_to_msat ( tp . elem_type ) msat_type = mathsat . msat_get_array_type ( self . msat_env ( ) , i , e ) if mathsat . MSAT_ERROR_TYPE ( msat_type ) : msat_msg = mathsat . msat_last_error_message ( self . msat_env ( ) ) raise InternalSolverError ( msat_msg ) return msat_type elif tp . is_bv_type ( ) : return mathsat . msat_get_bv_type ( self . msat_env ( ) , tp . width ) elif tp . is_custom_type ( ) : return mathsat . msat_get_simple_type ( self . msat_env ( ) , str ( tp ) ) else : raise NotImplementedError ( "Usupported type for '%s'" % tp )