mCRL2
Loading...
Searching...
No Matches
replace_capture_avoiding.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_MODAL_FORMULA_REPLACE_CAPTURE_AVOIDING_H
13#define MCRL2_MODAL_FORMULA_REPLACE_CAPTURE_AVOIDING_H
14
18
19namespace mcrl2 {
20
21namespace action_formulas {
22
23namespace detail {
24
25template <template <class> class Builder, class Derived, class Substitution>
27{
29 using super::enter;
30 using super::leave;
31 using super::update;
32 using super::apply;
33 using super::sigma;
34
36 : super(sigma)
37 { }
38
39 template <class T>
40 void apply(T& result, const forall& x)
41 {
42 data::variable_list v1 = sigma.add_fresh_variable_assignments(x.variables());
43 action_formula body;
44 apply(body, x.body());
45 action_formulas::make_forall(result, v1, body);
46 sigma.remove_fresh_variable_assignments(x.variables());
47 }
48
49 template <class T>
50 void apply(T& result, const exists& x)
51 {
52 data::variable_list v1 = sigma.add_fresh_variable_assignments(x.variables());
53 action_formula body;
54 apply(body, x.body());
55 action_formulas::make_exists(result, v1, body);
56 sigma.remove_fresh_variable_assignments(x.variables());
57 }
58};
59
60} // namespace detail
61
62//--- start generated action_formulas replace_capture_avoiding code ---//
67template <typename T, typename Substitution>
69 Substitution& sigma,
71 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
72)
73{
75 data::detail::apply_replace_capture_avoiding_variables_builder<action_formulas::data_expression_builder, action_formulas::detail::add_capture_avoiding_replacement>(sigma1).update(x);
76}
77
82template <typename T, typename Substitution>
84 Substitution& sigma,
86 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
87)
88{
90 T result;
91 data::detail::apply_replace_capture_avoiding_variables_builder<action_formulas::data_expression_builder, action_formulas::detail::add_capture_avoiding_replacement>(sigma1).apply(result, x);
92 return result;
93}
94
98template <typename T, typename Substitution>
100 Substitution& sigma,
101 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
102)
103{
106 for (const data::variable& v: substitution_variables(sigma))
107 {
108 id_generator.add_identifier(v.name());
109 }
111}
112
116template <typename T, typename Substitution>
118 Substitution& sigma,
119 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
120)
121{
124 for (const data::variable& v: substitution_variables(sigma))
125 {
126 id_generator.add_identifier(v.name());
127 }
129}
130//--- end generated action_formulas replace_capture_avoiding code ---//
131
132} // namespace action_formulas
133
134} // namespace mcrl2
135
136namespace mcrl2 {
137
138namespace regular_formulas {
139
140namespace detail {
141
142template <template <class> class Builder, class Derived, class Substitution>
144{
146 using super::enter;
147 using super::leave;
148 using super::update;
149 using super::apply;
150 using super::sigma;
151
153 : super(sigma)
154 { }
155};
156
157} // namespace detail
158
159//--- start generated regular_formulas replace_capture_avoiding code ---//
164template <typename T, typename Substitution>
166 Substitution& sigma,
167 data::set_identifier_generator& id_generator,
168 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
169)
170{
172 data::detail::apply_replace_capture_avoiding_variables_builder<regular_formulas::data_expression_builder, regular_formulas::detail::add_capture_avoiding_replacement>(sigma1).update(x);
173}
174
179template <typename T, typename Substitution>
181 Substitution& sigma,
182 data::set_identifier_generator& id_generator,
183 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
184)
185{
187 T result;
188 data::detail::apply_replace_capture_avoiding_variables_builder<regular_formulas::data_expression_builder, regular_formulas::detail::add_capture_avoiding_replacement>(sigma1).apply(result, x);
189 return result;
190}
191
195template <typename T, typename Substitution>
197 Substitution& sigma,
198 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
199)
200{
203 for (const data::variable& v: substitution_variables(sigma))
204 {
205 id_generator.add_identifier(v.name());
206 }
208}
209
213template <typename T, typename Substitution>
215 Substitution& sigma,
216 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
217)
218{
221 for (const data::variable& v: substitution_variables(sigma))
222 {
223 id_generator.add_identifier(v.name());
224 }
226}
227//--- end generated regular_formulas replace_capture_avoiding code ---//
228
229} // namespace regular_formulas
230
231} // namespace mcrl2
232
233namespace mcrl2 {
234
235namespace state_formulas {
236
237namespace detail {
238
239template <template <class> class Builder, class Derived, class Substitution>
241{
243 using super::enter;
244 using super::leave;
245 using super::update;
246 using super::apply;
247 using super::sigma;
248
250 : super(sigma)
251 { }
252
254 {
255 data::variable_list v1 = sigma.add_fresh_variable_assignments(x.variables());
256 state_formula result = forall(v1, (*this)(x.body()));
257 sigma.remove_fresh_variable_assignments(x.variables());
258 return result;
259 }
260
262 {
263 data::variable_list v1 = sigma.add_fresh_variable_assignments(x.variables());
264 state_formula result = exists(v1, (*this)(x.body()));
265 sigma.remove_fresh_variable_assignments(x.variables());
266 return result;
267 }
268};
269
270} // namespace detail
271
272//--- start generated state_formulas replace_capture_avoiding code ---//
277template <typename T, typename Substitution>
279 Substitution& sigma,
280 data::set_identifier_generator& id_generator,
281 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
282)
283{
285 data::detail::apply_replace_capture_avoiding_variables_builder<state_formulas::data_expression_builder, state_formulas::detail::add_capture_avoiding_replacement>(sigma1).update(x);
286}
287
292template <typename T, typename Substitution>
294 Substitution& sigma,
295 data::set_identifier_generator& id_generator,
296 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
297)
298{
300 T result;
301 data::detail::apply_replace_capture_avoiding_variables_builder<state_formulas::data_expression_builder, state_formulas::detail::add_capture_avoiding_replacement>(sigma1).apply(result, x);
302 return result;
303}
304
308template <typename T, typename Substitution>
310 Substitution& sigma,
311 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
312)
313{
316 for (const data::variable& v: substitution_variables(sigma))
317 {
318 id_generator.add_identifier(v.name());
319 }
321}
322
326template <typename T, typename Substitution>
328 Substitution& sigma,
329 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
330)
331{
334 for (const data::variable& v: substitution_variables(sigma))
335 {
336 id_generator.add_identifier(v.name());
337 }
339}
340//--- end generated state_formulas replace_capture_avoiding code ---//
341
342} // namespace state_formulas
343
344} // namespace mcrl2
345
346#endif // MCRL2_MODAL_FORMULA_REPLACE_CAPTURE_AVOIDING_H
\brief The existential quantification operator for action formulas
const data::variable_list & variables() const
const action_formula & body() const
\brief The universal quantification operator for action formulas
const action_formula & body() const
const data::variable_list & variables() const
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 add_identifier(const core::identifier_string &s) override
Adds the identifier s to the context.
\brief A data variable
Definition variable.h:28
\brief The existential quantification operator for state formulas
const state_formula & body() const
const data::variable_list & variables() const
\brief The universal quantification operator for state formulas
const state_formula & body() const
const data::variable_list & variables() const
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
add your file description here.
add your file description here.
add your file description here.
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 make_exists(atermpp::aterm &t, const ARGUMENTS &... args)
void make_forall(atermpp::aterm &t, const ARGUMENTS &... args)
void find_identifiers(const T &x, OutputIterator o)
Definition find.h:96
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 find_identifiers(const T &x, OutputIterator o)
Definition find.h:231
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 find_identifiers(const T &x, OutputIterator o)
Definition find.h:366
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
lps::detail::add_capture_avoiding_replacement< Builder, Derived, Substitution > super
add_capture_avoiding_replacement(data::detail::capture_avoiding_substitution_updater< Substitution > &sigma)
void apply(atermpp::term_list< T > &result, const assignment_list &x)
capture_avoiding_substitution_updater< Substitution > & sigma
capture_avoiding_substitution_updater< Substitution > & sigma
add_capture_avoiding_replacement(data::detail::capture_avoiding_substitution_updater< Substitution > &sigma)
action_formulas::detail::add_capture_avoiding_replacement< Builder, Derived, Substitution > super
add_capture_avoiding_replacement(data::detail::capture_avoiding_substitution_updater< Substitution > &sigma)
capture_avoiding_substitution_updater< Substitution > & sigma
data::detail::add_capture_avoiding_replacement< Builder, Derived, Substitution > super