2#include <boost/any.hpp>
13namespace expressions {
47 STORM_LOG_THROW(
false, storm::exceptions::InvalidTypeException,
"Unable to evaluate expression as integer.");
51 STORM_LOG_THROW(
false, storm::exceptions::InvalidTypeException,
"Unable to evaluate expression as boolean.");
55 STORM_LOG_THROW(
false, storm::exceptions::InvalidTypeException,
"Unable to evaluate expression as double.");
69 "Unable to access operand " << operandIndex <<
" in expression '" << *
this <<
"' of arity 0.");
73 STORM_LOG_THROW(
false, storm::exceptions::InvalidAccessException,
"Unable to access identifier of non-constant, non-variable expression.");
77 STORM_LOG_THROW(
false, storm::exceptions::InvalidAccessException,
"Unable to access operator of non-function application expression.");
114 return this->shared_from_this();
The base class of all expression classes.
BinaryNumericalFunctionExpression const & asBinaryNumericalFunctionExpression() const
bool hasBooleanType() const
Retrieves whether the expression has a boolean type.
virtual bool isUnaryBooleanFunctionExpression() const
virtual storm::RationalNumber evaluateAsRational() const
Evaluates the expression and returns the resulting rational number.
virtual bool isBinaryRelationExpression() const
virtual bool isBooleanLiteralExpression() const
Expression toExpression() const
Converts the base expression to a proper expression.
virtual std::string const & getIdentifier() const
Retrieves the identifier associated with this expression.
virtual bool isFunctionApplication() const
Checks if the expression is a function application (of any sort).
BooleanLiteralExpression const & asBooleanLiteralExpression() const
virtual bool isFalse() const
Checks if the expression is equal to the boolean literal false.
virtual bool isBinaryBooleanFunctionExpression() const
ExpressionManager const & getManager() const
Retrieves the manager responsible for this expression.
virtual double evaluateAsDouble(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
IntegerLiteralExpression const & asIntegerLiteralExpression() const
virtual bool isBinaryNumericalFunctionExpression() const
virtual std::shared_ptr< BaseExpression const > getOperand(uint_fast64_t operandIndex) const
Retrieves the given operand from the expression.
std::shared_ptr< BaseExpression const > reduceNesting() const
Tries to flatten the syntax tree of the expression, e.g., 1 + (2 + (3 + 4)) becomes (1 + 2) + (3 + 4)
virtual bool isVariable() const
Retrieves whether the expression is a variable.
bool hasIntegerType() const
Retrieves whether the expression has an integer type.
bool hasBitVectorType() const
Retrieves whether the expression has a bitvector type.
virtual bool isIfThenElseExpression() const
virtual bool evaluateAsBool(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
virtual bool isLiteral() const
Retrieves whether the expression is a literal.
bool hasRationalType() const
Retrieves whether the expression has a rational return type.
RationalLiteralExpression const & asRationalLiteralExpression() const
virtual bool isVariableExpression() const
virtual bool isUnaryNumericalFunctionExpression() const
bool hasNumericalType() const
Retrieves whether the expression has a numerical type, i.e., integer or double.
virtual bool isTrue() const
Checks if the expression is equal to the boolean literal true.
VariableExpression const & asVariableExpression() const
Type const & getType() const
Retrieves the type of the expression.
IfThenElseExpression const & asIfThenElseExpression() const
BinaryBooleanFunctionExpression const & asBinaryBooleanFunctionExpression() const
virtual bool isPredicateExpression() const
std::shared_ptr< BaseExpression const > getSharedPointer() const
Retrieves a shared pointer to this expression.
UnaryBooleanFunctionExpression const & asUnaryBooleanFunctionExpression() const
BinaryRelationExpression const & asBinaryRelationExpression() const
virtual uint_fast64_t getArity() const
Returns the arity of the expression.
BaseExpression(ExpressionManager const &manager, Type const &type)
Constructs a base expression with the given return type.
virtual void printToStream(std::ostream &stream) const =0
Prints the expression to the given stream.
virtual bool containsVariables() const
Retrieves whether the expression contains a variable.
virtual OperatorType getOperator() const
Retrieves the operator of a function application.
UnaryNumericalFunctionExpression const & asUnaryNumericalFunctionExpression() const
virtual int_fast64_t evaluateAsInt(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
virtual bool isRationalLiteralExpression() const
PredicateExpression const & asPredicateExpression() const
virtual bool isIntegerLiteralExpression() const
std::shared_ptr< BaseExpression const > const & getBaseExpressionPointer() const
Retrieves a pointer to the base expression underlying this expression object.
This class is responsible for managing a set of typed variables and all expressions using these varia...
The base class of all binary expressions.
Expression reduceNesting(Expression const &expression)
Reduces the nesting in the given expression.
RationalNumberType toRationalNumber(Expression const &expression)
bool isBooleanType() const
Checks whether this type is a boolean type.
bool isIntegerType() const
Checks whether this type is an integral type.
bool isNumericalType() const
Checks whether this type is a numerical type.
bool isRationalType() const
Checks whether this type is a rational type.
bool isBitVectorType() const
Checks whether this type is a bitvector type.
The base class of all valuations of variables.
#define STORM_LOG_THROW(cond, exception, message)
std::ostream & operator<<(std::ostream &stream, BaseExpression const &expression)