Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::expressions::PredicateExpression Class Reference

The base class of all binary expressions. More...

#include <PredicateExpression.h>

Inheritance diagram for storm::expressions::PredicateExpression:
Collaboration diagram for storm::expressions::PredicateExpression:

Public Types

enum class  PredicateType { AtLeastOneOf , AtMostOneOf , ExactlyOneOf }
 

Public Member Functions

 PredicateExpression (ExpressionManager const &manager, Type const &type, std::vector< std::shared_ptr< BaseExpression const > > const &operands, PredicateType predicateType)
 
 PredicateExpression (PredicateExpression const &other)=default
 
PredicateExpressionoperator= (PredicateExpression const &other)=delete
 
 PredicateExpression (PredicateExpression &&)=default
 
PredicateExpressionoperator= (PredicateExpression &&)=delete
 
virtual ~PredicateExpression ()=default
 
virtual storm::expressions::OperatorType getOperator () const override
 Retrieves the operator of a function application.
 
virtual bool evaluateAsBool (Valuation const *valuation=nullptr) const override
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting boolean value.
 
virtual std::shared_ptr< BaseExpression const > simplify () const override
 Simplifies the expression according to some simple rules.
 
virtual boost::any accept (ExpressionVisitor &visitor, boost::any const &data) const override
 Accepts the given visitor by calling its visit method.
 
virtual bool isPredicateExpression () const override
 
virtual bool isFunctionApplication () const override
 Checks if the expression is a function application (of any sort).
 
virtual bool containsVariables () const override
 Retrieves whether the expression contains a variable.
 
virtual uint_fast64_t getArity () const override
 Returns the arity of the expression.
 
virtual std::shared_ptr< BaseExpression const > getOperand (uint_fast64_t operandIndex) const override
 Retrieves the given operand from the expression.
 
virtual void gatherVariables (std::set< storm::expressions::Variable > &variables) const override
 Retrieves the set of all variables that appear in the expression.
 
PredicateType getPredicateType () const
 Retrieves the relation associated with the expression.
 
- Public Member Functions inherited from storm::expressions::BaseExpression
 BaseExpression (ExpressionManager const &manager, Type const &type)
 Constructs a base expression with the given return type.
 
 BaseExpression (BaseExpression const &)=default
 
BaseExpressionoperator= (BaseExpression const &)=delete
 
 BaseExpression (BaseExpression &&)=default
 
BaseExpressionoperator= (BaseExpression &&)=delete
 
virtual ~BaseExpression ()=default
 
Expression toExpression () const
 Converts the base expression to a proper expression.
 
virtual int_fast64_t evaluateAsInt (Valuation const *valuation=nullptr) const
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting integer value.
 
virtual double evaluateAsDouble (Valuation const *valuation=nullptr) const
 Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting double value.
 
virtual storm::RationalNumber evaluateAsRational () const
 Evaluates the expression and returns the resulting rational number.
 
virtual std::string const & getIdentifier () const
 Retrieves the identifier associated with this expression.
 
virtual bool isLiteral () const
 Retrieves whether the expression is a literal.
 
virtual bool isVariable () const
 Retrieves whether the expression is a variable.
 
virtual bool isTrue () const
 Checks if the expression is equal to the boolean literal true.
 
virtual bool isFalse () const
 Checks if the expression is equal to the boolean literal false.
 
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)
 
bool hasNumericalType () const
 Retrieves whether the expression has a numerical type, i.e., integer or double.
 
bool hasIntegerType () const
 Retrieves whether the expression has an integer type.
 
bool hasBitVectorType () const
 Retrieves whether the expression has a bitvector type.
 
bool hasBooleanType () const
 Retrieves whether the expression has a boolean type.
 
bool hasRationalType () const
 Retrieves whether the expression has a rational return type.
 
std::shared_ptr< BaseExpression const > getSharedPointer () const
 Retrieves a shared pointer to this expression.
 
ExpressionManager const & getManager () const
 Retrieves the manager responsible for this expression.
 
Type const & getType () const
 Retrieves the type of the expression.
 
virtual bool isIfThenElseExpression () const
 
IfThenElseExpression const & asIfThenElseExpression () const
 
virtual bool isBinaryBooleanFunctionExpression () const
 
BinaryBooleanFunctionExpression const & asBinaryBooleanFunctionExpression () const
 
virtual bool isBinaryNumericalFunctionExpression () const
 
BinaryNumericalFunctionExpression const & asBinaryNumericalFunctionExpression () const
 
virtual bool isBinaryRelationExpression () const
 
BinaryRelationExpression const & asBinaryRelationExpression () const
 
virtual bool isBooleanLiteralExpression () const
 
BooleanLiteralExpression const & asBooleanLiteralExpression () const
 
virtual bool isIntegerLiteralExpression () const
 
IntegerLiteralExpression const & asIntegerLiteralExpression () const
 
virtual bool isRationalLiteralExpression () const
 
RationalLiteralExpression const & asRationalLiteralExpression () const
 
virtual bool isUnaryBooleanFunctionExpression () const
 
UnaryBooleanFunctionExpression const & asUnaryBooleanFunctionExpression () const
 
virtual bool isUnaryNumericalFunctionExpression () const
 
UnaryNumericalFunctionExpression const & asUnaryNumericalFunctionExpression () const
 
virtual bool isVariableExpression () const
 
VariableExpression const & asVariableExpression () const
 
PredicateExpression const & asPredicateExpression () const
 

Protected Member Functions

virtual void printToStream (std::ostream &stream) const override
 Prints the expression to the given stream.
 

Detailed Description

The base class of all binary expressions.

Definition at line 11 of file PredicateExpression.h.

Member Enumeration Documentation

◆ PredicateType

Enumerator
AtLeastOneOf 
AtMostOneOf 
ExactlyOneOf 

Definition at line 13 of file PredicateExpression.h.

Constructor & Destructor Documentation

◆ PredicateExpression() [1/3]

storm::expressions::PredicateExpression::PredicateExpression ( ExpressionManager const &  manager,
Type const &  type,
std::vector< std::shared_ptr< BaseExpression const > > const &  operands,
PredicateType  predicateType 
)

Definition at line 24 of file PredicateExpression.cpp.

◆ PredicateExpression() [2/3]

storm::expressions::PredicateExpression::PredicateExpression ( PredicateExpression const &  other)
default

◆ PredicateExpression() [3/3]

storm::expressions::PredicateExpression::PredicateExpression ( PredicateExpression &&  )
default

◆ ~PredicateExpression()

virtual storm::expressions::PredicateExpression::~PredicateExpression ( )
virtualdefault

Member Function Documentation

◆ accept()

boost::any storm::expressions::PredicateExpression::accept ( ExpressionVisitor visitor,
boost::any const &  data 
) const
overridevirtual

Accepts the given visitor by calling its visit method.

Parameters
visitorThe visitor that is to be accepted.

Implements storm::expressions::BaseExpression.

Definition at line 99 of file PredicateExpression.cpp.

◆ containsVariables()

bool storm::expressions::PredicateExpression::containsVariables ( ) const
overridevirtual

Retrieves whether the expression contains a variable.

Returns
True iff the expression contains a variable.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 111 of file PredicateExpression.cpp.

◆ evaluateAsBool()

bool storm::expressions::PredicateExpression::evaluateAsBool ( Valuation const *  valuation = nullptr) const
overridevirtual

Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting boolean value.

If the return type of the expression is not a boolean an exception is thrown.

Parameters
valuationThe valuation of unknowns under which to evaluate the expression.
Returns
The boolean value of the expression under the given valuation.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 33 of file PredicateExpression.cpp.

◆ gatherVariables()

void storm::expressions::PredicateExpression::gatherVariables ( std::set< storm::expressions::Variable > &  variables) const
overridevirtual

Retrieves the set of all variables that appear in the expression.

Parameters
Theset into which all variables in this expresson are inserted.

Implements storm::expressions::BaseExpression.

Definition at line 129 of file PredicateExpression.cpp.

◆ getArity()

uint_fast64_t storm::expressions::PredicateExpression::getArity ( ) const
overridevirtual

Returns the arity of the expression.

Returns
The arity of the expression.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 120 of file PredicateExpression.cpp.

◆ getOperand()

std::shared_ptr< BaseExpression const > storm::expressions::PredicateExpression::getOperand ( uint_fast64_t  operandIndex) const
overridevirtual

Retrieves the given operand from the expression.

Parameters
operandIndexThe index of the operand to retrieve. This must be lower than the arity of the expression.
Returns
The operand at the given index.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 124 of file PredicateExpression.cpp.

◆ getOperator()

storm::expressions::OperatorType storm::expressions::PredicateExpression::getOperator ( ) const
overridevirtual

Retrieves the operator of a function application.

This is only legal to call if the expression is function application.

Returns
The operator associated with the function application.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 29 of file PredicateExpression.cpp.

◆ getPredicateType()

PredicateExpression::PredicateType storm::expressions::PredicateExpression::getPredicateType ( ) const

Retrieves the relation associated with the expression.

Returns
The relation associated with the expression.

Definition at line 140 of file PredicateExpression.cpp.

◆ isFunctionApplication()

bool storm::expressions::PredicateExpression::isFunctionApplication ( ) const
overridevirtual

Checks if the expression is a function application (of any sort).

Returns
True iff the expression is a function application.

Reimplemented from storm::expressions::BaseExpression.

Definition at line 107 of file PredicateExpression.cpp.

◆ isPredicateExpression()

bool storm::expressions::PredicateExpression::isPredicateExpression ( ) const
overridevirtual

Reimplemented from storm::expressions::BaseExpression.

Definition at line 103 of file PredicateExpression.cpp.

◆ operator=() [1/2]

PredicateExpression & storm::expressions::PredicateExpression::operator= ( PredicateExpression &&  )
delete

◆ operator=() [2/2]

PredicateExpression & storm::expressions::PredicateExpression::operator= ( PredicateExpression const &  other)
delete

◆ printToStream()

void storm::expressions::PredicateExpression::printToStream ( std::ostream &  stream) const
overrideprotectedvirtual

Prints the expression to the given stream.

Parameters
streamThe stream to which to write the expression.

Implements storm::expressions::BaseExpression.

Definition at line 144 of file PredicateExpression.cpp.

◆ simplify()

std::shared_ptr< BaseExpression const > storm::expressions::PredicateExpression::simplify ( ) const
overridevirtual

Simplifies the expression according to some simple rules.

Returns
A pointer to the simplified expression.

Implements storm::expressions::BaseExpression.

Definition at line 52 of file PredicateExpression.cpp.


The documentation for this class was generated from the following files: