mCRL2
Loading...
Searching...
No Matches
replace_capture_avoiding_with_an_identifier_generator.h
Go to the documentation of this file.
1// Author(s): Jan Friso Groote
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_LPS_REPLACE_CAPTURE_AVOIDING_WITH_AN_IDENTIFIER_GENERATOR_H
13#define MCRL2_LPS_REPLACE_CAPTURE_AVOIDING_WITH_AN_IDENTIFIER_GENERATOR_H
14
16#include "mcrl2/lps/builder.h"
18
19namespace mcrl2 {
20
21namespace lps {
22
23namespace detail {
24
25// Below code for capture avoiding subsitutions with an identifier generator are provided.
26
27template<template<class> class Builder, class Derived, class Substitution, class IdentifierGenerator>
29 : public process::detail::add_capture_avoiding_replacement_with_an_identifier_generator<Builder, Derived, Substitution, IdentifierGenerator>
30{
32 using super::enter;
33 using super::leave;
34 using super::apply;
35 using super::update;
37
38 add_capture_avoiding_replacement_with_an_identifier_generator(Substitution& sigma, IdentifierGenerator& id_generator)
39 : super(sigma, id_generator)
40 {
41 }
42
43 template<typename ActionSummand>
44 void do_action_summand(ActionSummand& x, const data::variable_list& v)
45 {
46 x.summation_variables() = v;
47 x.condition() = apply(x.condition());
48 x.multi_action() = apply(x.multi_action());
49 x.assignments() = apply(x.assignments());
50 }
51
53 {
56 update_sigma.pop(v);
57 }
58
60 {
64 update_sigma.pop(v);
65 }
66
68 {
70 x.summation_variables() = v;
71 x.condition() = apply(x.condition());
72 update(x.deadlock());
73 update_sigma.pop(v);
74 }
75
76 template<typename LinearProcess>
77 void do_linear_process(LinearProcess& x)
78 {
79 data::variable_list v = update_sigma.push(x.process_parameters());
80 x.process_parameters() = v;
81 update(x.action_summands());
82 update(x.deadlock_summands());
83 update_sigma.pop(v);
84 }
85
87 {
89 }
90
92 {
94 }
95
96 template<typename Specification>
97 void do_specification(Specification& x)
98 {
99 std::set<data::variable> v = update_sigma(x.global_variables());
100 x.global_variables() = v;
101 update(x.process());
102 x.action_labels() = apply(x.action_labels());
103 x.initial_process() = apply(x.initial_process());
104 update_sigma.pop(v);
105 }
106
108 {
110 }
111
113 {
115 }
116
118 {
121 update_sigma.pop(v);
122 return result;
123 }
124};
125
126} // namespace detail
127
128//--- start generated lps replace_capture_avoiding_with_identifier_generator code ---//
137
138template <typename T, typename Substitution, typename IdentifierGenerator>
140 Substitution& sigma,
141 IdentifierGenerator& id_generator,
142 typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
143 )
144{
145 data::detail::apply_replace_capture_avoiding_variables_builder_with_an_identifier_generator<lps::data_expression_builder, lps::detail::add_capture_avoiding_replacement_with_an_identifier_generator>(sigma, id_generator).update(x);
146}
147
157template <typename T, typename Substitution, typename IdentifierGenerator>
159 Substitution& sigma,
160 IdentifierGenerator& id_generator,
161 typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr
162 )
163{
164 T result;
165 data::detail::apply_replace_capture_avoiding_variables_builder_with_an_identifier_generator<lps::data_expression_builder, lps::detail::add_capture_avoiding_replacement_with_an_identifier_generator>(sigma, id_generator).apply(result, x);
166 return result;
167}
168//--- end generated lps replace_capture_avoiding_with_identifier_generator code ---//
169
170} // namespace lps
171
172} // namespace mcrl2
173
174#endif // MCRL2_LPS_REPLACE_CAPTURE_AVOIDING_WITH_AN_IDENTIFIER_GENERATOR_H
LPS summand containing a multi-action.
LPS summand containing a deadlock.
const lps::deadlock & deadlock() const
Returns the deadlock of this summand.
Linear process specification.
LPS summand containing a multi-action.
const stochastic_distribution & distribution() const
Returns the distribution of this summand.
\brief A stochastic distribution
const data::variable_list & variables() const
const data::data_expression & distribution() const
const data::data_expression & condition() const
Returns the condition expression.
Definition summand.h:60
data::variable_list & summation_variables()
Returns the sequence of summation variables.
Definition summand.h:46
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
add your file description here.
add your file description here.
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)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
process::detail::add_capture_avoiding_replacement_with_an_identifier_generator< Builder, Derived, Substitution, IdentifierGenerator > super
substitution_updater_with_an_identifier_generator< Substitution, IdentifierGenerator > update_sigma