12#ifndef MCRL2_DATA_REPLACE_CAPTURE_AVOIDING_WITH_AN_IDENTIFIER_GENERATOR_H
13#define MCRL2_DATA_REPLACE_CAPTURE_AVOIDING_WITH_AN_IDENTIFIER_GENERATOR_H
24template <
typename Substitution,
typename IdentifierGenerator>
30 std::vector<data::assignment>
m_undo;
45 if (
m_sigma.variable_occurs_in_a_rhs(v))
70 template <
typename VariableContainer>
71 VariableContainer
push(
const VariableContainer& container)
73 std::vector<data::variable> result;
76 result.push_back(
bind(v));
78 return VariableContainer(result.begin(), result.end());
81 template <
typename VariableContainer>
82 void pop(
const VariableContainer& container)
91template <
typename Substitution,
typename IdentifierGenerator>
95 if (!contains(V, v) &&
sigma(v) == v)
101 id_generator.add_identifier(v.
name());
104 while (
sigma(w) != w || contains(V, w))
113template <
typename Substitution,
typename IdentifierGenerator,
typename VariableContainer>
114VariableContainer
update_substitution(Substitution&
sigma,
const VariableContainer& v,
const std::multiset<data::variable>& V, IdentifierGenerator& id_generator)
116 std::vector<data::variable> result;
117 for (
typename VariableContainer::const_iterator i = v.begin(); i != v.end(); ++i)
121 return VariableContainer(result.begin(), result.end());
125template<
template<
class>
class Builder,
126 template<
template<
class>
class,
class,
class,
class>
class Binder, class Substitution, class IdentifierGenerator>
128 :
public Binder<Builder, replace_capture_avoiding_variables_builder_with_an_identifier_generator<Builder, Binder, Substitution, IdentifierGenerator>, Substitution, IdentifierGenerator>
130 typedef Binder<Builder, replace_capture_avoiding_variables_builder_with_an_identifier_generator<Builder, Binder, Substitution, IdentifierGenerator>, Substitution, IdentifierGenerator>
super;
137 IdentifierGenerator& id_generator)
143template<
template<
class>
class Builder,
144 template<
template<
class>
class,
class,
class,
class>
class Binder, class Substitution, class IdentifierGenerator>
145replace_capture_avoiding_variables_builder_with_an_identifier_generator<Builder, Binder, Substitution, IdentifierGenerator>
147 IdentifierGenerator& id_generator)
150 sigma, id_generator);
158template<
template<
class>
class Builder,
class Derived,
class Substitution,
class IdentifierGenerator>
168 substitution_updater_with_an_identifier_generator <Substitution, IdentifierGenerator>
update_sigma;
172 IdentifierGenerator& id_generator_)
186 const auto& assignments = atermpp::container_cast<data::assignment_list>(x.
declarations());
187 std::vector<data::variable> tmp;
190 tmp.push_back(a.lhs());
200 std::vector<data::assignment> a;
201 std::vector<data::variable>::const_iterator j = v.begin();
205 apply(rhs, i->rhs());
260template <
typename T,
typename Substitution,
typename IdentifierGenerator>
263 IdentifierGenerator& id_generator,
264 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
267 data::detail::apply_replace_capture_avoiding_variables_builder_with_an_identifier_generator<data::data_expression_builder, data::detail::add_capture_avoiding_replacement_with_an_identifier_generator>(
sigma, id_generator).update(x);
279template <
typename T,
typename Substitution,
typename IdentifierGenerator>
282 IdentifierGenerator& id_generator,
283 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
287 data::detail::apply_replace_capture_avoiding_variables_builder_with_an_identifier_generator<data::data_expression_builder, data::detail::add_capture_avoiding_replacement_with_an_identifier_generator>(
sigma, id_generator).apply(result, x);
const variable_list & variables() const
const data_expression & body() const
\brief Assignment of a data expression to a variable
const data_expression & rhs() const
const variable & lhs() const
substitution_updater_with_an_identifier_generator(Substitution &sigma, IdentifierGenerator &id_generator)
data::variable bind(const data::variable &v)
void pop(const VariableContainer &container)
void pop(const data::variable &)
Substitution & substitution()
VariableContainer push(const VariableContainer &container)
std::vector< data::assignment > m_undo
IdentifierGenerator & m_id_generator
data::variable push(const data::variable &v)
existential quantification.
universal quantification.
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.
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
data::variable update_substitution(Substitution &sigma, const data::variable &v, const std::multiset< data::variable > &V, IdentifierGenerator &id_generator)
replace_capture_avoiding_variables_builder_with_an_identifier_generator< Builder, Binder, Substitution, IdentifierGenerator > apply_replace_capture_avoiding_variables_builder_with_an_identifier_generator(Substitution &sigma, IdentifierGenerator &id_generator)
void make_where_clause(atermpp::aterm &t, const ARGUMENTS &... args)
void make_lambda(atermpp::aterm &result, ARGUMENTS... arguments)
void replace_variables_capture_avoiding_with_an_identifier_generator(T &x, Substitution &sigma, IdentifierGenerator &id_generator, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
void make_forall(atermpp::aterm &result, ARGUMENTS... arguments)
atermpp::term_list< assignment > assignment_list
\brief list of assignments
void make_exists(atermpp::aterm &result, ARGUMENTS... arguments)
bool contains(const atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable > &c, const typename atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable >::key_type &v, const std::size_t thread_index=0)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void apply(T &result, const data::lambda &x)
void apply(T &result, const data::forall &x)
void apply(T &result, const variable &v)
add_capture_avoiding_replacement_with_an_identifier_generator(Substitution &sigma_, IdentifierGenerator &id_generator_)
void apply(T &result, const data::where_clause &x)
substitution_updater_with_an_identifier_generator< Substitution, IdentifierGenerator > update_sigma
void apply(T &, data_equation &)
void apply(T &result, const data::exists &x)
replace_capture_avoiding_variables_builder_with_an_identifier_generator(Substitution &sigma, IdentifierGenerator &id_generator)
Binder< Builder, replace_capture_avoiding_variables_builder_with_an_identifier_generator< Builder, Binder, Substitution, IdentifierGenerator >, Substitution, IdentifierGenerator > super