|
mCRL2
|
Generic substitution function. More...
#include <mutable_indexed_substitution.h>
Classes | |
| struct | assignment |
| Wrapper class for internal storage and substitution updates using operator() More... | |
Public Types | |
| using | variable_type = VariableType |
| Type of variables. | |
| using | expression_type = ExpressionType |
| Type of expressions. | |
| using | argument_type = variable_type |
| using | result_type = expression_type |
Public Member Functions | |
| mutable_indexed_substitution ()=default | |
| mutable_indexed_substitution (const substitution_type &substitution, const bool variables_in_rhs_set_is_defined, const std::multiset< variable_type > &variables_in_rhs) | |
| template<class VARIABLES , class EXPRESSIONS > | |
| mutable_indexed_substitution (const VARIABLES &vars, const EXPRESSIONS &exps) | |
| const expression_type & | operator() (const variable_type &v) const |
| Application operator; applies substitution to v. | |
| template<class ResultType > | |
| void | apply (const variable_type &v, ResultType &target) const |
| Application operator; applies substitution to v. | |
| void | apply (const variable_type &v, expression_type &target, atermpp::detail::thread_aterm_pool &thread_aterm_pool) |
| Application operator; applies substitution to v. | |
| assignment | operator[] (variable_type const &v) |
| Index operator. | |
| void | clear () |
| Clear substitutions. | |
| mutable_indexed_substitution< VariableType, ExpressionType > | clone () |
| Create a clone of the rewriter in which the underlying rewriter is copied, and not passed as a shared pointer. | |
| template<IsSubstitution Substitution> | |
| bool | operator== (const Substitution &) const |
| Compare substitutions. | |
| const std::multiset< variable_type > & | variables_occurring_in_right_hand_sides () const |
| Provides a multiset containing the variables in the rhs. | |
| bool | variable_occurs_in_a_rhs (const variable &v) |
| Checks whether a variable v occurs in one of the rhs's of the current substitution. | |
| bool | size () |
| Returns the number of assigned variables in the substitution. | |
| bool | empty () |
| Returns true if the substitution is empty. | |
| std::string | to_string () const |
| string representation of the substitution. N.B. This is an expensive operation! | |
Static Public Attributes | |
| static constexpr bool | is_identity_substitution =false |
Protected Types | |
| using | substitution_type = atermpp::utilities::unordered_map< VariableType, ExpressionType > |
Protected Attributes | |
| substitution_type | m_substitution |
| Internal storage for substitutions. Required to be a container with random access through [] operator. It is essential to store the variable also in the container, as it might be that this variable is not used anywhere although it has a valid assignment. This happens for instance when the assignment is already parsed, while the expression to which it needs to be applied must still be parsed. | |
| bool | m_variables_in_rhs_set_is_defined =false |
| std::multiset< variable > | m_variables_in_rhs |
Generic substitution function.
This substitution assumes a function variable -> std::size_t, that, for each variable gives a unique index. The substitutions are stored internally as a vector, mapping std::size_t to expression. Provided that, given a variable, its index can be computed in O(1) time, insertion is O(1) amortized, and lookup is O(1). Memory required is O(n) where n is the largest index used. This substitution can maintain the variables occurring in the rhs of expressions. If it is requested that whether a variable occurs in a rhs, the substitution automatically maintains these variables. This requires time O(n log n) per rhs, where n is the size of the rhs.
Definition at line 43 of file mutable_indexed_substitution.h.
| using mcrl2::data::mutable_indexed_substitution< VariableType, ExpressionType >::argument_type = variable_type |
Definition at line 66 of file mutable_indexed_substitution.h.
| using mcrl2::data::mutable_indexed_substitution< VariableType, ExpressionType >::expression_type = ExpressionType |
Type of expressions.
Definition at line 64 of file mutable_indexed_substitution.h.
| using mcrl2::data::mutable_indexed_substitution< VariableType, ExpressionType >::result_type = expression_type |
Definition at line 67 of file mutable_indexed_substitution.h.
|
protected |
Definition at line 46 of file mutable_indexed_substitution.h.
| using mcrl2::data::mutable_indexed_substitution< VariableType, ExpressionType >::variable_type = VariableType |
Type of variables.
Definition at line 61 of file mutable_indexed_substitution.h.
|
default |
|
inline |
Definition at line 71 of file mutable_indexed_substitution.h.
|
inline |
Definition at line 82 of file mutable_indexed_substitution.h.
|
inline |
Application operator; applies substitution to v.
This must deliver an expression, and not a reference to an expression, as the expressions are stored in a vector that can be resized and moved.
| v | The variable to which the subsitution is applied. |
| target | The target into which the substitution is stored. |
Definition at line 205 of file mutable_indexed_substitution.h.
|
inline |
Application operator; applies substitution to v.
This must deliver an expression, and not a reference to an expression, as the expressions are stored in a vector that can be resized and moved.
| v | The variable to which the subsitution is applied. |
| target | The target into which the substitution is stored. |
Definition at line 186 of file mutable_indexed_substitution.h.
|
inline |
Clear substitutions.
Definition at line 225 of file mutable_indexed_substitution.h.
|
inline |
Create a clone of the rewriter in which the underlying rewriter is copied, and not passed as a shared pointer.
This is useful when the rewriter is used in different parallel processes. One rewriter can only be used sequentially.
Definition at line 237 of file mutable_indexed_substitution.h.
|
inline |
Returns true if the substitution is empty.
Definition at line 281 of file mutable_indexed_substitution.h.
|
inline |
Application operator; applies substitution to v.
| v | The variable to which the subsitution is applied. |
Definition at line 167 of file mutable_indexed_substitution.h.
|
inline |
Compare substitutions.
Definition at line 245 of file mutable_indexed_substitution.h.
|
inline |
Index operator.
Definition at line 219 of file mutable_indexed_substitution.h.
|
inline |
Returns the number of assigned variables in the substitution.
Definition at line 275 of file mutable_indexed_substitution.h.
|
inline |
string representation of the substitution. N.B. This is an expensive operation!
Definition at line 288 of file mutable_indexed_substitution.h.
|
inline |
Checks whether a variable v occurs in one of the rhs's of the current substitution.
Definition at line 268 of file mutable_indexed_substitution.h.
|
inline |
Provides a multiset containing the variables in the rhs.
Definition at line 252 of file mutable_indexed_substitution.h.
|
staticconstexpr |
Definition at line 93 of file mutable_indexed_substitution.h.
|
protected |
Internal storage for substitutions. Required to be a container with random access through [] operator. It is essential to store the variable also in the container, as it might be that this variable is not used anywhere although it has a valid assignment. This happens for instance when the assignment is already parsed, while the expression to which it needs to be applied must still be parsed.
Definition at line 54 of file mutable_indexed_substitution.h.
|
mutableprotected |
Definition at line 56 of file mutable_indexed_substitution.h.
|
mutableprotected |
Definition at line 55 of file mutable_indexed_substitution.h.