1#ifndef STORM_STORAGE_EXPRESSIONS_BASEEXPRESSION_H_
2#define STORM_STORAGE_EXPRESSIONS_BASEEXPRESSION_H_
19namespace expressions {
21class ExpressionManager;
25class ExpressionVisitor;
28class IfThenElseExpression;
29class BinaryBooleanFunctionExpression;
30class BinaryNumericalFunctionExpression;
31class BinaryRelationExpression;
32class BooleanLiteralExpression;
33class IntegerLiteralExpression;
34class RationalLiteralExpression;
35class UnaryBooleanFunctionExpression;
36class UnaryNumericalFunctionExpression;
37class VariableExpression;
38class PredicateExpression;
110 virtual uint_fast64_t
getArity()
const;
118 virtual std::shared_ptr<BaseExpression const>
getOperand(uint_fast64_t operandIndex)
const;
162 virtual bool isTrue()
const;
183 virtual void gatherVariables(std::set<storm::expressions::Variable>& variables)
const = 0;
190 virtual std::shared_ptr<BaseExpression const>
simplify()
const = 0;
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 boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const =0
Accepts the given visitor by calling its visit method.
virtual bool isBinaryRelationExpression() const
virtual bool isBooleanLiteralExpression() const
Expression toExpression() const
Converts the base expression to a proper expression.
BaseExpression & operator=(BaseExpression &&)=delete
virtual std::string const & getIdentifier() const
Retrieves the identifier associated with this expression.
virtual void gatherVariables(std::set< storm::expressions::Variable > &variables) const =0
Retrieves the set of all variables that appear in the expression.
BaseExpression(BaseExpression const &)=default
friend std::ostream & operator<<(std::ostream &stream, BaseExpression const &expression)
virtual bool isFunctionApplication() const
Checks if the expression is a function application (of any sort).
virtual std::shared_ptr< BaseExpression const > simplify() const =0
Simplifies the expression according to some simple rules.
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
BaseExpression & operator=(BaseExpression const &)=delete
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.
virtual void printToStream(std::ostream &stream) const =0
Prints the expression to the given stream.
BaseExpression(BaseExpression &&)=default
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
virtual ~BaseExpression()=default
PredicateExpression const & asPredicateExpression() const
virtual bool isIntegerLiteralExpression() const
This class is responsible for managing a set of typed variables and all expressions using these varia...
The base class of all binary expressions.
The base class of all valuations of variables.
std::map< typename VariableType< FunctionType >::type, typename CoefficientType< FunctionType >::type > Valuation