12#ifndef MCRL2_DATA_REPLACE_CAPTURE_AVOIDING_H
13#define MCRL2_DATA_REPLACE_CAPTURE_AVOIDING_H
26template <
typename Substitution>
31 std::map<variable, std::list<variable>>
updates;
51 if (i->second.empty())
58 template <
typename VariableContainer>
66 return add_fresh_variable_assignment(v);
72 template <
typename VariableContainer>
86 return i->second.back();
95template <
typename Substitution>
98 std::vector<std::string> updates;
99 for (
const auto& p:
sigma.updates)
106template <
template <
class>
class Builder,
template <
template <
class>
class,
class,
class>
class Binder, class Substitution>
109 typedef Binder<Builder, replace_capture_avoiding_variables_builder<Builder, Binder, Substitution>, Substitution>
super;
120template <
template <
class>
class Builder,
template <
template <
class>
class,
class,
class>
class Binder, class Substitution>
121replace_capture_avoiding_variables_builder<Builder, Binder, Substitution>
127template <
template <
class>
class Builder,
class Derived,
class Substitution>
151 data::make_assignment(r, a.lhs(), [&](data_expression& r){ apply(r, a.rhs() ); } );
165 const auto& declarations = atermpp::container_cast<data::assignment_list>(x.
declarations());
168 declarations.begin(),
172 const data::variable& v = a.lhs();
173 const data_expression& x1 = a.rhs();
175 data::variable v1 = sigma.add_fresh_variable_assignment(v);
176 data::data_expression rhs;
178 return assignment(v1, rhs);
182 apply(body, x.
body());
189 sigma.remove_fresh_variable_assignment(v);
198 apply(body, x.
body());
208 apply(body, x.
body());
218 apply(body, x.
body());
237template <
typename T,
typename Substitution>
241 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
245 data::detail::apply_replace_capture_avoiding_variables_builder<data::data_expression_builder, data::detail::add_capture_avoiding_replacement>(sigma1).update(x);
252template <
typename T,
typename Substitution>
256 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
261 data::detail::apply_replace_capture_avoiding_variables_builder<data::data_expression_builder, data::detail::add_capture_avoiding_replacement>(sigma1).apply(result, x);
268template <
typename T,
typename Substitution>
271 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
286template <
typename T,
typename Substitution>
289 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
const variable_list & variables() const
const data_expression & body() const
\brief Assignment of a data expression to a variable
const variable & lhs() const
existential quantification.
universal quantification.
void add_identifiers(const std::set< core::identifier_string > &ids)
Add a set of identifiers to the context.
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
void remove_identifier(const core::identifier_string &s) override
Removes one occurrence of the identifier s from the context.
void add_identifier(const core::identifier_string &s) override
Adds the identifier s to the context.
const core::identifier_string & name() const
const sort_expression & sort() const
\brief A where expression
const data_expression & body() const
const assignment_expression_list & declarations() const
Standard exception class for reporting runtime errors.
add your file description here.
add your file description here.
Search functions of the data library.
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
std::string print_list(const Container &v, const std::string &message="", bool print_index=false, bool boundary_spaces=true)
Creates a string representation of a container.
replace_capture_avoiding_variables_builder< Builder, Binder, Substitution > apply_replace_capture_avoiding_variables_builder(capture_avoiding_substitution_updater< Substitution > &sigma)
std::ostream & operator<<(std::ostream &os, smt_solver_type s)
standard conversion from solvert type to stream
void find_identifiers(const T &x, OutputIterator o)
void make_where_clause(atermpp::aterm &t, const ARGUMENTS &... args)
std::set< data::variable > substitution_variables(const Substitution &)
Returns the variables appearing in the right hand sides of the substitution.
std::string pp(const abstraction &x)
void make_lambda(atermpp::aterm &result, ARGUMENTS... arguments)
void make_forall(atermpp::aterm &result, ARGUMENTS... arguments)
atermpp::term_list< variable > variable_list
\brief list of variables
void replace_variables_capture_avoiding(T &x, Substitution &sigma, data::set_identifier_generator &id_generator, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
atermpp::term_list< assignment > assignment_list
\brief list of assignments
void make_exists(atermpp::aterm &result, ARGUMENTS... arguments)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void apply(atermpp::term_list< T > &result, const assignment_list &x)
void apply(T &result, const data::exists &x)
void apply(T &result, const variable &v)
void apply(T &result, const data::lambda &x)
capture_avoiding_substitution_updater< Substitution > & sigma
void apply(T &, data_equation &)
void apply(T &result, const data::forall &x)
void apply(T &result, const data::where_clause &x)
add_capture_avoiding_replacement(capture_avoiding_substitution_updater< Substitution > &sigma_)
void remove_fresh_variable_assignments(const VariableContainer &variables)
data::set_identifier_generator & id_generator
variable add_fresh_variable_assignment(const variable &v)
data_expression operator()(const variable &x)
std::map< variable, std::list< variable > > updates
capture_avoiding_substitution_updater(Substitution &sigma_, data::set_identifier_generator &id_generator_)
variable_list add_fresh_variable_assignments(const VariableContainer &variables)
void remove_fresh_variable_assignment(const variable &v)
replace_capture_avoiding_variables_builder(capture_avoiding_substitution_updater< Substitution > &sigma)
Binder< Builder, replace_capture_avoiding_variables_builder< Builder, Binder, Substitution >, Substitution > super