12#ifndef MCRL2_LPS_REPLACE_H
13#define MCRL2_LPS_REPLACE_H
31template <
typename T,
typename Substitution>
33 const Substitution&
sigma,
35 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
38 data::detail::make_replace_sort_expressions_builder<lps::sort_expression_builder>(
sigma, innermost).update(x);
41template <
typename T,
typename Substitution>
43 const Substitution&
sigma,
45 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
49 data::detail::make_replace_sort_expressions_builder<lps::sort_expression_builder>(
sigma, innermost).apply(result, x);
53template <
typename T,
typename Substitution>
55 const Substitution&
sigma,
57 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
60 data::detail::make_replace_data_expressions_builder<lps::data_expression_builder>(
sigma, innermost).update(x);
63template <
typename T,
typename Substitution>
65 const Substitution&
sigma,
67 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
71 data::detail::make_replace_data_expressions_builder<lps::data_expression_builder>(
sigma, innermost).apply(result, x);
76template <
typename T,
typename Substitution>
78 const Substitution&
sigma,
79 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
82 core::make_update_apply_builder<lps::data_expression_builder>(
sigma).update(x);
85template <
typename T,
typename Substitution>
87 const Substitution&
sigma,
88 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
92 core::make_update_apply_builder<lps::data_expression_builder>(
sigma).apply(result, x);
96template <
typename T,
typename Substitution>
98 const Substitution&
sigma,
99 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
102 core::make_update_apply_builder<lps::variable_builder>(
sigma).update(x);
105template <
typename T,
typename Substitution>
107 const Substitution&
sigma,
108 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
112 core::make_update_apply_builder<lps::variable_builder>(
sigma).apply(result, x);
118template <
typename T,
typename Substitution>
120 const Substitution&
sigma,
121 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
125 data::detail::make_replace_free_variables_builder<lps::data_expression_builder, lps::add_data_variable_builder_binding>(
sigma).update(x);
130template <
typename T,
typename Substitution>
132 const Substitution&
sigma,
133 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
138 data::detail::make_replace_free_variables_builder<lps::data_expression_builder, lps::add_data_variable_builder_binding>(
sigma).apply(result, x);
144template <
typename T,
typename Substitution,
typename VariableContainer>
146 const Substitution&
sigma,
147 const VariableContainer& bound_variables,
148 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
152 data::detail::make_replace_free_variables_builder<lps::data_expression_builder, lps::add_data_variable_builder_binding>(
sigma).update(x, bound_variables);
157template <
typename T,
typename Substitution,
typename VariableContainer>
159 const Substitution&
sigma,
160 const VariableContainer& bound_variables,
161 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* =
nullptr
166 data::detail::make_replace_free_variables_builder<lps::data_expression_builder, lps::add_data_variable_builder_binding>(
sigma).apply(result, x, bound_variables);
174template <
template <
class>
class Builder,
template <
template <
class>
class,
class>
class Binder, class Substitution>
175struct replace_process_parameter_builder:
public Binder<Builder, replace_process_parameter_builder<Builder, Binder, Substitution> >
177 typedef Binder<Builder, replace_process_parameter_builder<Builder, Binder, Substitution> > super;
182 using super::is_bound;
183 using super::bound_variables;
184 using super::increase_bind_count;
189 explicit replace_process_parameter_builder(Substitution sigma_)
193 template <
typename VariableContainer>
194 replace_process_parameter_builder(Substitution sigma_,
const VariableContainer& bound_variables)
197 increase_bind_count(bound_variables);
200 void apply(data::variable& result,
const data::variable& x)
202 if (bound_variables().
count(x) == count)
204 result = atermpp::down_cast<data::variable>(
sigma(x));
211 void apply(T& result,
const data::variable& x)
213 if (bound_variables().
count(x) == count)
218 result =
static_cast<data::data_expression
>(x);
222 void apply(T& result,
const data::assignment& x)
226 data::data_expression rhs;
228 data::make_assignment(result, lhs, rhs);
231 void update(lps::deadlock_summand& x)
237 void update(lps::action_summand& x)
241 data::assignment_list assignments;
242 super::apply(assignments, x.assignments());
243 x.assignments() = assignments;
246 void update(lps::linear_process& x)
250 data::variable_list process_parameters;
251 super::apply(process_parameters, x.process_parameters());
252 x.process_parameters() = process_parameters;
256template <
template <
class>
class Builder,
template <
template <
class>
class,
class>
class Binder, class Substitution>
257replace_process_parameter_builder<Builder, Binder, Substitution>
258make_replace_process_parameters_builder(Substitution
sigma)
260 return replace_process_parameter_builder<Builder, Binder, Substitution>(
sigma);
267template <
typename Substitution>
268void replace_process_parameters(specification& spec, Substitution
sigma)
270 lps::detail::make_replace_process_parameters_builder<lps::data_expression_builder, lps::add_data_variable_builder_binding>(
sigma).update(spec);
275void replace_summand_variables(specification& spec, data::mutable_map_substitution<>&
sigma)
277 data::set_identifier_generator id_generator;
280 id_generator.add_identifier(v.name());
283 for (action_summand& s: spec.process().action_summands())
290 for (deadlock_summand& s: spec.process().deadlock_summands())
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
add your file description here.
add your file description here.
function_symbol count(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
void replace_all_variables(T &x, const Substitution &sigma, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
std::set< data::variable > substitution_variables(const Substitution &)
Returns the variables appearing in the right hand sides of the substitution.
void replace_sort_expressions(T &x, const Substitution &sigma, bool innermost, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
void replace_data_expressions(T &x, const Substitution &sigma, bool innermost, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
void replace_free_variables(T &x, const Substitution &sigma, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
bool is_simple_substitution(const Substitution &)
Returns true if the substitution sigma satisfies the property that FV(sigma(x)) is included in {x} fo...
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)
void replace_variables(T &x, const Substitution &sigma, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
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)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
add your file description here.