(self, _type=None, value=None)
return True
Test whether the formula is a constant.

        Optionally, check that the constant is of the given type and value.
Test whether the formula is a constant.
Test whether the formula is a constant .
def is_constant(self, _type=None, value=None):
        """Test whether the formula is a constant.

        Optionally, check that the constant is of the given type and value.
        """
        if self.node_type() not in CONSTANTS:
            if self.node_type() == ARRAY_VALUE:
                # An array value can be a constant if all its children
                # are constants
                for c in self.args():
                    if not c.is_constant():
                        return False
                if _type is not None or value is not None:
                    raise PysmtValueError("constant type and value checking " \
                                          "is not available for array values")
                return True
            return False
        if _type is not None:
            if _type.is_int_type() and self.node_type() != INT_CONSTANT:
                return False
            if _type.is_real_type() and self.node_type() != REAL_CONSTANT:
                return False
            if _type.is_bool_type() and self.node_type() != BOOL_CONSTANT:
                return False
            if _type.is_string_type() and self.node_type() != STR_CONSTANT:
                return False
            if _type.is_bv_type():
                if self.node_type() != BV_CONSTANT:
                    return False
                if self._content.payload[1] != _type.width:
                    return False

        if value is not None:
            return value == self.constant_value()
        return True
def is_constant ( self , _type = None , value = None ) : if self . node_type ( ) not in CONSTANTS : if self . node_type ( ) == ARRAY_VALUE : # An array value can be a constant if all its children # are constants for c in self . args ( ) : if not c . is_constant ( ) : return False if _type is not None or value is not None : raise PysmtValueError ( "constant type and value checking " "is not available for array values" ) return True return False if _type is not None : if _type . is_int_type ( ) and self . node_type ( ) != INT_CONSTANT : return False if _type . is_real_type ( ) and self . node_type ( ) != REAL_CONSTANT : return False if _type . is_bool_type ( ) and self . node_type ( ) != BOOL_CONSTANT : return False if _type . is_string_type ( ) and self . node_type ( ) != STR_CONSTANT : return False if _type . is_bv_type ( ) : if self . node_type ( ) != BV_CONSTANT : return False if self . _content . payload [ 1 ] != _type . width : return False if value is not None : return value == self . constant_value ( ) return True