12#ifndef MCRL2_LPS_MULTI_ACTION_H
13#define MCRL2_LPS_MULTI_ACTION_H
40 const process::action_list&
actions()
const
42 return atermpp::down_cast<process::action_list>((*
this)[0]);
47 return atermpp::down_cast<data::data_expression>((*
this)[1]);
102template <
class... ARGUMENTS>
124std::string
pp(
const multi_action& x);
159template <
typename Iter,
typename Function>
160void forall_permutations(Iter first, Iter last, Function f)
169 forall_permutations(next, last, f);
170 while (std::next_permutation(first->first, first->second))
172 forall_permutations(next, last, f);
181inline bool equal_action_signatures(
const std::vector<process::action>& a,
const std::vector<process::action>& b)
183 if (a.size() != b.size())
187 std::vector<process::action>::const_iterator i, j;
188 for (i = a.begin(), j = b.begin(); i != a.end(); ++i, ++j)
190 if (i->label() != j->label())
199struct compare_action_labels
205 bool operator()(
const process::action& a,
const process::action& b)
const
207 return a.label() < b.label();
212struct compare_action_label_arguments
218 bool operator()(
const process::action& a,
const process::action& b)
const
220 if (a.label() != b.label())
222 return a.label() < b.label();
229struct equal_data_parameters_builder
231 const std::vector<process::action>& a;
232 const std::vector<process::action>& b;
233 std::set<data::data_expression>& result;
235 equal_data_parameters_builder(
const std::vector<process::action>& a_,
236 const std::vector<process::action>& b_,
237 std::set<data::data_expression>& result_
247 std::vector<data::data_expression> v;
248 std::vector<process::action>::const_iterator i, j;
249 for (i = a.begin(), j = b.begin(); i != a.end(); ++i, ++j)
251 data::data_expression_list d1 = i->arguments();
252 data::data_expression_list d2 = j->arguments();
253 assert(d1.size() == d2.size());
254 data::data_expression_list::iterator i1 = d1.begin(), i2 = d2.begin();
255 for ( ; i1 != d1.end(); ++i1, ++i2)
257 v.push_back(data::lazy::equal_to(*i1, *i2));
260 data::data_expression expr = data::lazy::join_and(v.begin(), v.end());
266struct not_equal_multi_actions_builder
268 const std::vector<process::action>& a;
269 const std::vector<process::action>& b;
270 std::vector<data::data_expression>& result;
272 not_equal_multi_actions_builder(
const std::vector<process::action>& a_,
273 const std::vector<process::action>& b_,
274 std::vector<data::data_expression>& result_
284 using namespace data::lazy;
286 std::vector<data::data_expression> v;
287 std::vector<process::action>::const_iterator i, j;
288 for (i = a.begin(), j = b.begin(); i != a.end(); ++i, ++j)
290 data::data_expression_list d1 = i->arguments();
291 data::data_expression_list d2 = j->arguments();
292 assert(d1.size() == d2.size());
293 data::data_expression_list::iterator i1=d1.begin(), i2=d2.begin();
294 for ( ; i1 != d1.end(); ++i1, ++i2)
296 v.push_back(data::not_equal_to(*i1, *i2));
299 result.push_back(data::lazy::join_or(v.begin(), v.end()));
313#ifdef MCRL2_EQUAL_MULTI_ACTIONS_DEBUG
314 mCRL2log(debug) <<
"\n<equal multi actions>" << std::endl;
318 using namespace data::lazy;
323 std::sort(va.begin(), va.end(), detail::compare_action_label_arguments());
324 std::sort(vb.begin(), vb.end(), detail::compare_action_label_arguments());
326 if (!detail::equal_action_signatures(va, vb))
328#ifdef MCRL2_EQUAL_MULTI_ACTIONS_DEBUG
329 mCRL2log(debug) <<
"different action signatures detected!" << std::endl;
337 typedef std::vector<process::action>::iterator action_iterator;
338 std::vector<std::pair<action_iterator, action_iterator> > intervals;
339 action_iterator first = va.
begin();
340 while (first != va.
end())
342 action_iterator next = std::upper_bound(first, va.
end(), *first, detail::compare_action_labels());
343 intervals.push_back(std::make_pair(first, next));
347 std::set<data::data_expression> z;
348 detail::equal_data_parameters_builder f(va, vb, z);
349 detail::forall_permutations(intervals.begin(), intervals.end(), f);
361 using namespace data::lazy;
366 std::sort(va.begin(), va.end(), detail::compare_action_label_arguments());
367 std::sort(vb.begin(), vb.end(), detail::compare_action_label_arguments());
369 if (!detail::equal_action_signatures(va, vb))
375 typedef std::vector<process::action>::iterator action_iterator;
376 std::vector<std::pair<action_iterator, action_iterator> > intervals;
377 action_iterator first = va.
begin();
378 while (first != va.
end())
380 action_iterator next = std::upper_bound(first, va.
end(), *first, detail::compare_action_labels());
381 intervals.push_back(std::make_pair(first, next));
384 std::vector<data::data_expression> z;
385 detail::not_equal_multi_actions_builder f(va, vb, z);
386 detail::forall_permutations(intervals.begin(), intervals.end(), f);
403 std::hash<atermpp::aterm> hasher;
404 return hasher(ma.
actions()) ^ (hasher(ma.
time())<<1);
aterm()
Default constructor.
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
size_type size() const
Returns the number of arguments of this term.
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.
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
sort_expression sort() const
Returns the sort of the data expression.
const_iterator end() const
const_iterator begin() const
\brief A timed multi-action
multi_action(const multi_action &) noexcept=default
Move semantics.
multi_action(const atermpp::aterm &term)
Constructor.
bool has_time() const
Returns true if time is available.
const process::action_list & actions() const
multi_action(const process::action &l)
Constructor.
multi_action operator+(const multi_action &other) const
Joins the actions of both multi actions.
multi_action sort_actions() const
Returns the multiaction in which the list of actions is sorted.
const data::data_expression & time() const
multi_action(multi_action &&) noexcept=default
multi_action(const process::action_list &actions=process::action_list(), data::data_expression time=data::undefined_real())
Constructor.
Functions for pretty printing ATerms.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
The main namespace for the aterm++ library.
term_list< Term > sort_list(const term_list< Term > &l, const std::function< bool(const Term &, const Term &)> &ordering=[](const Term &t1, const Term &t2){ return t1< t2;})
Returns the list with the elements sorted according to the <-operator on the addresses of terms.
void make_term_appl(Term &target, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Constructor an aterm in a variable based on a function symbol and an forward iterator providing the a...
const atermpp::function_symbol & function_symbol_TimedMultAct()
bool check_term_TimedMultAct(const Term &t)
data_expression join_and(ForwardTraversalIterator first, ForwardTraversalIterator last)
Returns and applied to the sequence of data expressions [first, last)
data_expression join_or(ForwardTraversalIterator first, ForwardTraversalIterator last)
Returns or applied to the sequence of data expressions [first, last)
const function_symbol & false_()
Constructor for function symbol false.
const function_symbol & true_()
Constructor for function symbol true.
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
const data::data_expression & undefined_real()
Returns a data expression of type Real that corresponds to 'undefined'.
std::vector< multi_action > multi_action_vector
\brief vector of multi_actions
std::string pp(const action_summand &x)
std::ostream & operator<<(std::ostream &out, const action_summand &x)
atermpp::term_list< multi_action > multi_action_list
\brief list of multi_actions
lps::multi_action normalize_sorts(const multi_action &x, const data::sort_specification &sortspec)
std::set< data::variable > find_free_variables(const lps::deadlock &x)
void swap(action_summand &t1, action_summand &t2)
\brief swap overload
data::data_expression equal_multi_actions(const multi_action &a, const multi_action &b)
Returns a data expression that expresses under which conditions the multi actions a and b are equal....
void make_multi_action(atermpp::aterm &t, const ARGUMENTS &... args)
data::data_expression not_equal_multi_actions(const multi_action &a, const multi_action &b)
Returns a pbes expression that expresses under which conditions the multi actions a and b are not equ...
std::set< data::variable > find_all_variables(const lps::deadlock &x)
lps::multi_action translate_user_notation(const lps::multi_action &x)
bool is_multi_action(const atermpp::aterm &x)
std::string pp(const action_label &x)
atermpp::term_list< action > action_list
\brief list of actions
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
add your file description here.
static const atermpp::function_symbol TimedMultAct
std::size_t operator()(const mcrl2::lps::multi_action &ma) const