mCRL2
Loading...
Searching...
No Matches
action_rename.h
Go to the documentation of this file.
1// Author(s): Jan Friso Groote, 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//
9/// \file mcrl2/lps/action_rename.h
10/// \brief Action rename specifications.
11
12#ifndef MCRL2_LPS_ACTION_RENAME_H
13#define MCRL2_LPS_ACTION_RENAME_H
14
15#include <regex>
16
17#include "mcrl2/core/parse.h"
18
19#include "mcrl2/data/rewriter.h"
20#include "mcrl2/data/substitutions/mutable_map_substitution.h"
21
22#include "mcrl2/lps/stochastic_specification.h"
23#include "mcrl2/process/normalize_sorts.h"
24#include "mcrl2/process/replace.h"
25#include "mcrl2/process/translate_user_notation.h"
26
27// //Action rename rules
28// <ActionRenameRules>
29// ::= ActionRenameRules(<ActionRenameRule>*)
30//
31// //Action rename rule
32// <ActionRenameRule>
33// ::= ActionRenameRule(<DataVarId>*, <DataExprOrNil>,
34// <ParamIdOrAction>, <ActionRenameRuleRHS>)
35//
36// //Right-hand side of an action rename rule
37// <ActionRenameRuleRHS>
38// ::= <ParamId> [- tc]
39// | <Action> [+ tc]
40// | Delta
41// | Tau
42//
43// //Action rename action_rename_specification
44// <ActionRenameSpec>
45// ::= ActionRenameSpec(<DataSpec>, <ActSpec>, <ActionRenameRules>)
46
47namespace mcrl2::lps
48{
49
50// ::= ActionRenameRule(<DataVarId>*, <DataExprOrNil>,
51// <ParamIdOrAction>, <ActionRenameRuleRHS>)
52
53/// \brief Action rename rule
55{
56 protected:
57 /// \brief The data variables of the rule
58 data::variable_list m_variables;
59
60 /// \brief The condition of the rule
62
63 /// \brief The left hand side of the rule
65
66 /// \brief right hand side of the rule. Can only be an action, tau or delta.
68
70 {
72 }
73
74 public:
75 /// \brief Constructor.
76 action_rename_rule() = default;
77
78 /// \brief Constructor.
79 /// \param t A term
81 {
82 assert(core::detail::check_rule_ActionRenameRule(t));
83 atermpp::aterm::iterator i = t.begin();
84 m_variables = atermpp::down_cast<data::variable_list>(*i++);
85 m_condition = data::data_expression(*i++);
86 m_lhs = process::action(*i++);
87 m_rhs = process::process_expression(*i);
89 }
90
91 /// \brief Constructor.
92 action_rename_rule(const data::variable_list& variables,
93 const data::data_expression& condition,
94 const process::action& lhs,
95 const process::process_expression& rhs)
97 {
99 }
100
101 /// \brief Returns the variables of the rule.
102 /// \return The variables of the rule.
103 const data::variable_list& variables() const
104 {
105 return m_variables;
106 }
107
108 /// \brief Returns the variables of the rule.
109 /// \return The variables of the rule.
110 data::variable_list& variables()
111 {
112 return m_variables;
113 }
114
115 /// \brief Returns the condition of the rule.
116 /// \return The condition of the rule.
118 {
119 return m_condition;
120 }
121
122 /// \brief Returns the condition of the rule.
123 /// \return The condition of the rule.
125 {
126 return m_condition;
127 }
128
129 /// \brief Returns the left hand side of the rule.
130 /// \return The left hand side of the rule.
131 const process::action& lhs() const // Type should be action, but as it can be a ParamId(identifier_string,data_expression_list),
132 // which is not accepted by the typechecker, this is a temporary fix, until this option
133 // is added to an action.
134 {
135 return m_lhs;
136 }
137
138 /// \brief Returns the right hand side of the rule.
139 /// \return The right hand side of the rule.
141 {
143 return m_rhs;
144 }
145};
146
147/// \brief Action rename specification
149{
150 protected:
151
152 /// \brief The data specification of the action rename specification
154
155 /// \brief The action labels of the action rename specification
156 process::action_label_list m_action_labels;
157
158 /// \brief The action rename rules of the action rename specification
160
161 public:
162 /// \brief Constructor.
164
165 /// \brief Constructor.
166 /// \param t A term
168 {
169 assert(core::detail::check_rule_ActionRenameSpec(t));
170 atermpp::aterm::iterator i = t.begin();
171 m_data = static_cast<data::data_specification>(*i++);
172 m_action_labels = atermpp::down_cast<process::action_label_list>((*i++)[0]);
173
174 atermpp::aterm_list rules_list = atermpp::down_cast<atermpp::aterm_list>((*i)[0]);
175 for (const atermpp::aterm& r: rules_list)
176 {
177 m_rules.emplace_back(r);
178 }
179 }
180
181 /// \brief Constructor.
182 /// \param data A data specification
183 /// \param action_labels A sequence of action labels
184 /// \param rules A sequence of action rename rules
186 const data::data_specification& data,
187 const process::action_label_list& action_labels,
188 const std::vector <action_rename_rule>& rules)
189 :
190 m_data(data),
193 { }
194
195 /// \brief Returns the data action_rename_specification.
196 /// \return The data action_rename_specification.
197 const data::data_specification& data() const
198 {
199 return m_data;
200 }
201
202 /// \brief Returns the data specification.
204 {
205 return m_data;
206 }
207
208 /// \brief Returns the sequence of action labels
209 /// \return A sequence of action labels containing all action
210 /// labels occurring in the action_rename_specification (but it can have more).
211 const process::action_label_list& action_labels() const
212 {
213 return m_action_labels;
214 }
215
216 /// \brief Returns the sequence of action labels
217 process::action_label_list& action_labels()
218 {
219 return m_action_labels;
220 }
221
222 /// \brief Returns the action rename rules.
223 /// \return The action rename rules.
225 {
226 return m_rules;
227 }
228
229 /// \brief Returns the action rename rules.
231 {
232 return m_rules;
233 }
234
235 /// \brief Indicates whether the action_rename_specification is well typed.
236 /// \return Always returns true.
237 bool is_well_typed() const
238 {
239 return true;
240 }
241};
242
243inline
245{
246 return atermpp::aterm(core::detail::function_symbol_ActionRenameRule(), rule.variables(), rule.condition(), rule.lhs(), rule.rhs());
247}
248
249inline
251{
252 std::vector<atermpp::aterm> rules;
253 for (const action_rename_rule& r: spec.rules())
254 {
255 rules.push_back(action_rename_rule_to_aterm(r));
256 }
257 return atermpp::aterm(core::detail::function_symbol_ActionRenameSpec(),
258 data::detail::data_specification_to_aterm(spec.data()),
259 atermpp::aterm(core::detail::function_symbol_ActSpec(), spec.action_labels()),
260 atermpp::aterm(core::detail::function_symbol_ActionRenameRules(), atermpp::aterm_list(rules.begin(), rules.end()))
261 );
262}
263
264}
265
266namespace mcrl2::lps
267{
268
269/// \cond INTERNAL_DOCS
270namespace detail
271{
272// Put the equalities t==u in the replacement map as u:=t.
273inline void fill_replacement_map(const data::data_expression& equalities_in_conjunction,
274 std::map<data::data_expression, data::data_expression>& replacement_map)
275{
276 if (equalities_in_conjunction==data::sort_bool::true_())
277 {
278 return;
279 }
280 if (data::sort_bool::is_and_application(equalities_in_conjunction))
281 {
282 fill_replacement_map(data::sort_bool::left(equalities_in_conjunction),replacement_map);
283 fill_replacement_map(data::sort_bool::right(equalities_in_conjunction),replacement_map);
284 return;
285 }
286 if(is_equal_to_application(equalities_in_conjunction))
287 {
288 const data::application a=atermpp::down_cast<data::application>(equalities_in_conjunction);
289 if (a[1]!=a[0])
290 {
291 replacement_map[a[1]]=a[0];
292 }
293 }
294}
295
296// Replace expressions in e according to the replacement map.
297// Assume that e only consists of and, not and equality applied to terms.
298inline data::data_expression replace_expressions(const data::data_expression& e,
299 const std::map<data::data_expression, data::data_expression>& replacement_map)
300{
302 {
303 return data::sort_bool::and_(replace_expressions(data::sort_bool::left(e),replacement_map),
304 replace_expressions(data::sort_bool::right(e),replacement_map));
305 }
307 {
308 return data::sort_bool::not_(replace_expressions(data::sort_bool::arg(e),replacement_map));
309 }
310 if (is_equal_to_application(e))
311 {
312 const data::application a=atermpp::down_cast<data::application>(e);
313 return data::application(a.head(),
314 replace_expressions(a[0],replacement_map),
315 replace_expressions(a[1],replacement_map));
316 }
317 const std::map<data::data_expression, data::data_expression>::const_iterator i=replacement_map.find(e);
318 if (i!=replacement_map.end()) // found;
319 {
320 return i->second;
321 }
322 return e;
323}
324
325// Substitute the equalities in equalities_in_conjunction from right to left in e.
326inline data::data_expression substitute_equalities(const data::data_expression& e, const data::data_expression& equalities_in_conjunction)
327{
328 std::map<data::data_expression, data::data_expression> replacement_map;
329 fill_replacement_map(equalities_in_conjunction, replacement_map);
330 return replace_expressions(e,replacement_map);
331}
332
333/// \brief Renames variables
334/// \param rcond A data expression
335/// \param rleft An action
336/// \param rright An action
337/// \param generator A generator for fresh identifiers
338template <typename IdentifierGenerator>
339void rename_renamerule_variables(data::data_expression& rcond, process::action& rleft, process::action& rright, IdentifierGenerator& generator)
340{
341 data::mutable_map_substitution<> renamings;
342
343 std::set< data::variable > new_vars = data::find_all_variables(rleft.arguments());
344
345 for (const data::variable& v: new_vars)
346 {
347 mcrl2::core::identifier_string new_name = generator(std::string(v.name()));
348
349 if (new_name != v.name())
350 {
351 renamings[v] = data::variable(new_name, v.sort());
352 }
353 }
354
355 data::set_identifier_generator id_generator;
356 for (const data::variable& v: data::substitution_variables(renamings))
357 {
358 id_generator.add_identifier(v.name());
359 }
360 rcond = data::replace_variables_capture_avoiding(rcond, renamings, id_generator);
361 rleft = process::replace_variables_capture_avoiding(rleft, renamings, id_generator);
362 rright = process::replace_variables_capture_avoiding(rright, renamings, id_generator);
363}
364
365/* ------------------------------------------ Normalise sorts ------------------------------------------ */
366
367inline
368void normalize_sorts(action_rename_specification& arspec)
369{
370 arspec.action_labels()=process::normalize_sorts(arspec.action_labels(), arspec.data());
371
372 for (action_rename_rule& rule: arspec.rules())
373 {
374 rule = action_rename_rule(data::normalize_sorts(rule.variables(), arspec.data()),
375 data::normalize_sorts(rule.condition(), arspec.data()),
376 process::normalize_sorts(rule.lhs(), arspec.data()),
377 process::normalize_sorts(rule.rhs(), arspec.data()));
378 }
379}
380
381
382/* ------------------------------------------ Translate user notation ------------------------------------------ */
383
384inline
385void translate_user_notation(action_rename_specification& arspec)
386{
387 for (action_rename_rule& rule: arspec.rules())
388 {
389 rule = action_rename_rule(rule.variables(),
390 data::translate_user_notation(rule.condition()),
391 process::translate_user_notation(rule.lhs()),
392 process::translate_user_notation(rule.rhs()));
393 }
394}
395
396} // namespace detail
397/// \endcond
398
399/// \brief Rename the actions in a linear specification using a given action_rename_spec
400/// \details The actions in a linear specification are renamed according to a given
401/// action rename specification.
402/// Note that the rules are applied in the order they appear in the specification.
403/// This yield quite elaborate conditions in the resulting lps, as a latter rule
404/// can only be applied if an earlier rule is not applicable. Note also that
405/// there is always a default summand, where the action is not renamed. Using
406/// sum elimination and rewriting a substantial reduction of the conditions that
407/// are generated can be obtained, often allowing many summands to be removed.
408/// \param action_rename_spec The action_rename_specification to be used.
409/// \param lps_old_spec The input linear specification.
410/// \param rewr A data rewriter.
411/// \return The lps_old_spec where all actions have been renamed according
412/// to action_rename_spec.
413inline
415 const action_rename_specification& action_rename_spec,
416 const lps::stochastic_specification& lps_old_spec,
417 const data::rewriter& rewr,
418 const bool enable_rewriting)
419{
420 using namespace mcrl2::core;
421 using namespace mcrl2::data;
422 using namespace mcrl2::lps;
423
424 const std::vector <action_rename_rule>& rename_rules = action_rename_spec.rules();
425 stochastic_action_summand_vector lps_old_action_summands = lps_old_spec.process().action_summands();
426 deadlock_summand_vector lps_deadlock_summands = lps_old_spec.process().deadlock_summands();
427 process::action_list lps_new_actions;
428
430 generator.add_identifiers(lps::find_identifiers(lps_old_spec));
431 generator.add_identifiers(data::function_and_mapping_identifiers(lps_old_spec.data()));
432
433 //go through the rename rules of the rename file
434 mCRL2log(log::debug) << "Rename rules found: " << rename_rules.size() << "\n";
435 for (const action_rename_rule& r: rename_rules)
436 {
437 stochastic_action_summand_vector lps_new_action_summands;
438
439 data_expression rule_condition = r.condition();
440 process::action rule_old_action = r.lhs();
441 process::action rule_new_action;
442 process::process_expression new_element = r.rhs();
443 if (!is_tau(new_element) && !is_delta(new_element))
444 {
445 rule_new_action = atermpp::down_cast<process::action>(new_element);
446 }
447
448 const bool to_tau = is_tau(new_element);
449 const bool to_delta = is_delta(new_element);
450
451 // Check here that the arguments of the rule_old_action only consist
452 // of uniquely occurring variables or closed terms. Furthermore, check that the variables
453 // in rule_new_action and in rule_condition are a subset of those in
454 // rule_old_action. This check ought to be done in the static checking
455 // part of the renaming rules, but as yet it has nog been done. Ultimately
456 // this check should be moved there.
457
458 // first check that the arguments of rule_old_action are variables or closed
459 // terms.
460
461 for (const data_expression& rule_old_argument_i: rule_old_action.arguments())
462 {
463 if (!is_variable(rule_old_argument_i) &&
464 (!(data::find_all_variables(rule_old_argument_i).empty())))
465 {
466 throw mcrl2::runtime_error("The arguments of the lhs " + process::pp(rule_old_action) +
467 " are not variables or closed expressions");
468 }
469 }
470
471 // Check whether the variables in rhs are included in the lefthandside.
472 std::set < variable > variables_in_old_rule = process::find_free_variables(rule_old_action);
473 std::set < variable > variables_in_new_rule = process::find_free_variables(rule_new_action);
474
475 if (!includes(variables_in_old_rule.begin(),variables_in_old_rule.end(),
476 variables_in_new_rule.begin(),variables_in_new_rule.end()))
477 {
478 throw mcrl2::runtime_error("There are variables occurring in rhs " + process::pp(rule_new_action) +
479 " of a rename rule not occurring in lhs " + process::pp(rule_old_action));
480 }
481
482 // Check whether the variables in condition are included in the lefthandside.
483 std::set < variable > variables_in_condition = data::find_free_variables(rule_condition);
484 if (!includes(variables_in_old_rule.begin(),variables_in_old_rule.end(),
485 variables_in_condition.begin(),variables_in_condition.end()))
486 {
487 throw mcrl2::runtime_error("There are variables occurring in the condition " + data::pp(rule_condition) +
488 " of a rename rule not occurring in lhs " + process::pp(rule_old_action));
489 }
490
491 // check for double occurrences of variables in the lhs. Note that variables_in_old_rule
492 // is empty at the end.
493 for (const data_expression& d: rule_old_action.arguments())
494 {
495 if (is_variable(d))
496 {
497 const variable& v = atermpp::down_cast<variable>(d);
498 if (variables_in_old_rule.find(v)==variables_in_old_rule.end())
499 {
500 throw mcrl2::runtime_error("Variable " + data::pp(v) + " occurs more than once in lhs " +
501 process::pp(rule_old_action) + " of an action rename rule");
502 }
503 else
504 {
505 variables_in_old_rule.erase(v);
506 }
507 }
508 }
509 assert(variables_in_old_rule.empty());
510
511
512 //go through the summands of the old lps
513 mCRL2log(log::debug) << "Action summands found: " << lps_old_action_summands.size() << "\n";
514 for (const stochastic_action_summand& lps_old_action_summand: lps_old_action_summands)
515 {
516 process::action_list lps_old_actions = lps_old_action_summand.multi_action().actions();
517
518 /* For each individual action in the multi-action, for which the
519 rename rule applies, two new summands must be made, namely one
520 where the rule does not match with the parameters of the action,
521 and one where it actually does. This means that for a multiaction
522 with k summands 2^k new summands can result. */
523
524 std::vector < variable_list >
525 lps_new_sum_vars(1,lps_old_action_summand.summation_variables());
526 std::vector < data_expression > lps_new_condition(1,lps_old_action_summand.condition());
527 std::vector < process::action_list >
528 lps_new_actions(1,process::action_list());
529 std::vector < bool > lps_new_actions_is_delta(1,false);
530
531 mCRL2log(log::debug) << "Actions in summand found: " << lps_old_actions.size() << "\n";
532 for (const process::action& lps_old_action: lps_old_actions)
533 {
534 if (equal_signatures(lps_old_action, rule_old_action))
535 {
536 mCRL2log(log::debug) << "Renaming action " << rule_old_action << "\n";
537
538 //rename all previously used variables.
539 data_expression renamed_rule_condition=rule_condition;
540 process::action renamed_rule_old_action=rule_old_action;
541 process::action renamed_rule_new_action=rule_new_action;
542 detail::rename_renamerule_variables(renamed_rule_condition, renamed_rule_old_action, renamed_rule_new_action, generator);
543
544 //go through the arguments of the action.
545 data_expression_list::iterator lps_old_argument_i = lps_old_action.arguments().begin();
546 data_expression new_equalities_condition=sort_bool::true_();
547 for (const data_expression& rule_old_argument_i: renamed_rule_old_action.arguments())
548 {
549 if (is_variable(rule_old_argument_i))
550 {
551 new_equalities_condition=lazy::and_(new_equalities_condition,
552 data::equal_to(rule_old_argument_i, *lps_old_argument_i));
553 }
554 else
555 {
556 assert((data::find_all_variables(rule_old_argument_i).empty())); // the argument must be closed, which is checked above.
557 renamed_rule_condition=
558 lazy::and_(renamed_rule_condition,
559 data::equal_to(rule_old_argument_i, *lps_old_argument_i));
560 if (enable_rewriting)
561 {
562 renamed_rule_condition
563 = rewr(renamed_rule_condition); // Make sure that renamed_rule_condition is as simple as possible.
564 }
565 }
566 lps_old_argument_i++;
567 }
568
569 /* insert the new equality condition in all the newly generated summands */
570 for (data_expression& d: lps_new_condition)
571 {
572 d=lazy::and_(d,new_equalities_condition);
573 }
574
575 /* insert the new sum variables in all the newly generated summands */
576 std::set<variable> new_vars = find_all_variables(renamed_rule_old_action);
577 for (const variable& sdvi: new_vars)
578 {
579 for (variable_list& l: lps_new_sum_vars)
580 {
581 l.push_front(sdvi);
582 }
583 }
584
585 if (enable_rewriting)
586 {
587 renamed_rule_condition
588 = rewr(renamed_rule_condition); // Make sure that renamed_rule_condition is as simple as possible.
589 }
590 if (renamed_rule_condition==sort_bool::true_())
591 {
592 if (to_delta)
593 {
594 std::vector < bool >::iterator i_is_delta=lps_new_actions_is_delta.begin();
595 for (process::action_list& l: lps_new_actions)
596 {
597 l=process::action_list(); // the action becomes delta
598 *i_is_delta=true;
599 ++i_is_delta;
600 }
601 }
602 else if (!to_tau)
603 {
604 std::vector < bool >::iterator i_is_delta=lps_new_actions_is_delta.begin();
605 for (process::action_list& l: lps_new_actions)
606 {
607 if (!*i_is_delta) // the action is not delta
608 {
609 l.push_front(renamed_rule_new_action);
610 }
611 ++i_is_delta;
612 }
613 }
614 }
615 else if (renamed_rule_condition==sort_bool::false_())
616 {
617 std::vector < bool >::iterator i_is_delta=lps_new_actions_is_delta.begin();
618 for (process::action_list& l: lps_new_actions)
619 {
620 if (!*i_is_delta) // The action does not equal delta.
621 {
622 l.push_front(lps_old_action);
623 }
624 ++i_is_delta;
625 }
626
627 }
628 else
629 {
630 /* Duplicate summands, one where the renaming is applied, and one where it is not
631 applied. */
632
633 std::vector < process::action_list > lps_new_actions_temp(lps_new_actions);
634
635 if (!to_tau) // if the new element is tau, we do not insert it in the multi-action.
636 {
637 std::vector < bool >::iterator i_is_delta=lps_new_actions_is_delta.begin();
638 for (process::action_list& l: lps_new_actions)
639 {
640 if (to_delta)
641 {
642 l=process::action_list();
643 *i_is_delta=true;
644 }
645 else
646 {
647 l.push_front(renamed_rule_new_action);
648 *i_is_delta=false;
649 }
650 ++i_is_delta;
651 }
652 }
653
654 for (process::action_list& l: lps_new_actions_temp)
655 {
656 lps_new_actions_is_delta.push_back(false); // A non renamed action is not delta;
657 l.push_front(lps_old_action);
658 }
659
660 lps_new_actions.insert(lps_new_actions.end(),
661 lps_new_actions_temp.begin(),
662 lps_new_actions_temp.end());
663 assert(lps_new_actions_is_delta.size()==lps_new_actions.size());
664
665 /* lps_new_condition_temp will contain the conditions in conjunction with
666 the negated new_condition. It will be concatenated to lps_new_condition,
667 in which the terms will be conjoined with the non-negated new_condition */
668
669 std::vector < data_expression > lps_new_condition_temp(lps_new_condition);
670
671 for (data_expression& d: lps_new_condition)
672 {
673 // substitute the equalities in d in renamed_rule_condition.
674 d=lazy::and_(renamed_rule_condition,detail::substitute_equalities(d,renamed_rule_condition));
675 }
676
677 for (const data_expression& d: lps_new_condition_temp)
678 {
679
680 lps_new_condition.push_back(lazy::and_(d,sort_bool::not_(renamed_rule_condition)));
681 }
682
683 // Replace lps_new_sum_vars with two consecutive copies of itself.
684 // The clumsily looking method below is required, to avoid problems with vector reallocation.
685 std::size_t size=lps_new_sum_vars.size();
686 lps_new_sum_vars.reserve(2*size);
687 for(std::size_t i=0; i<size; ++i)
688 {
689 lps_new_sum_vars.push_back(lps_new_sum_vars[i]);
690 }
691 }
692 }//end if(equal_signatures(...))
693 else
694 {
695 for (process::action_list& l: lps_new_actions)
696 {
697 l.push_front(lps_old_action);
698 }
699 }
700 mCRL2log(log::debug) << "Action done\n";
701
702 } //end of action list iterator
703
704 /* Add the summands to lps_new_action_summands or to the deadlock summands*/
705
706 std::vector < process::action_list > :: iterator i_act=lps_new_actions.begin();
707 std::vector < bool > :: iterator i_act_is_delta=lps_new_actions_is_delta.begin();
708 std::vector < variable_list > :: iterator i_sumvars=lps_new_sum_vars.begin();
709 for (const data_expression& cond: lps_new_condition)
710 {
711 //create a summand for the new lps
712 if (*i_act_is_delta)
713 {
714 // Create a deadlock summand.
715 const deadlock_summand d(*i_sumvars,
716 cond,
717 deadlock(lps_old_action_summand.multi_action().time()));
718 lps_deadlock_summands.push_back(d);
719 }
720 else
721 {
722 // create an action summand.
723 stochastic_action_summand lps_new_summand(*i_sumvars,
724 cond,
725 multi_action(reverse(*i_act), lps_old_action_summand.multi_action().time()),
726 lps_old_action_summand.assignments(),
727 lps_old_action_summand.distribution());
728 lps_new_action_summands.push_back(lps_new_summand);
729 }
730 i_act++;
731 i_sumvars++;
732 ++i_act_is_delta;
733 }
734 } // end of summand list iterator
735 lps_old_action_summands = lps_new_action_summands;
736 } //end of rename rule iterator
737
738 mCRL2log(log::debug) << "Simplifying the result...\n";
739
740 stochastic_linear_process new_process(lps_old_spec.process().process_parameters(),
741 lps_deadlock_summands,
742 lps_old_action_summands);
743
744 // add action_rename_spec.action_labels to action_rename_spec.action_labels without adding duplicates.
745 process::action_label_list all=action_rename_spec.action_labels();
746 for (const process::action_label& a: lps_old_spec.action_labels())
747 {
748 if (std::find(action_rename_spec.action_labels().begin(),
749 action_rename_spec.action_labels().end(),a)==action_rename_spec.action_labels().end())
750 {
751 // Not found;
752 all.push_front(a);
753 }
754 }
755 stochastic_specification lps_new_spec(action_rename_spec.data(), // This contains the data of the lps and the rename file.
756 all,
757 lps_old_spec.global_variables(),
758 new_process,
759 lps_old_spec.initial_process());
760
761 mCRL2log(log::debug) << "New lps complete\n";
762 return lps_new_spec;
763} //end of rename(...)
764
765namespace detail
766{
767
768inline
769process::action_label rename_action_label(const process::action_label& act, const std::regex& matching_regex, const std::string& replacing_fmt)
770{
771 return process::action_label(std::regex_replace(std::string(act.name()), matching_regex, replacing_fmt), act.sorts());
772}
773
774} // namespace detail
775
776/**
777 * \brief Rename actions in given specification based on a regular expression and
778 * a string that specifies how the replacement should be formatted.
779 */
780inline
782 const std::regex& matching_regex,
783 const std::string& replacing_fmt,
784 const stochastic_specification& lps_old_spec)
785{
786 // Use a set to store the new action labels to avoid duplicates
787 std::set<process::action_label> new_actions_set;
788 process::action_label_list new_actions;
789 for(const process::action_label& act: lps_old_spec.action_labels())
790 {
791 process::action_label new_action_label(detail::rename_action_label(act, matching_regex, replacing_fmt));
792 if (std::string(new_action_label.name()).empty())
793 {
794 throw mcrl2::runtime_error("After renaming the action " + std::string(act.name()) + " becomes empty, which is not allowed.");
795 }
796 if(std::string(new_action_label.name()) != "delta" && std::string(new_action_label.name()) != "tau" &&
797 new_actions_set.find(new_action_label) == new_actions_set.end())
798 {
799 // The list of actions should not contain delta and tau actions and also no duplicates.
800 new_actions_set.insert(new_action_label);
801 new_actions.push_front(new_action_label);
802 }
803 }
804 new_actions = reverse(new_actions);
805
806 // The list of new actions summands is initially empty
807 std::vector<stochastic_action_summand> new_action_summands;
808 // The list of new deadlock summands is initialised to the existing list, we will only add new deadlock summands
809 std::vector<deadlock_summand> new_deadlock_summands(lps_old_spec.process().deadlock_summands());
810 for(const stochastic_action_summand& as: lps_old_spec.process().action_summands())
811 {
812 process::action_list new_action_list;
813 bool becomes_deadlock_summand = false;
814 for(const process::action& act: as.multi_action().actions())
815 {
816 process::action_label new_action_label(detail::rename_action_label(act.label(), matching_regex, replacing_fmt));
817 if(std::string(new_action_label.name()) == "delta")
818 {
819 // delta is the absorbing element for multi action concatenation
820 // Therefore, this summand now becomes a deadlock summand
821 becomes_deadlock_summand = true;
822 break;
823 }
824 // tau is the identity for multi action concatenation
825 // therefore, we should not add it to a multi action
826 if(std::string(new_action_label.name()) != "tau")
827 {
828 new_action_list.push_front(process::action(new_action_label, act.arguments()));
829 }
830 }
831
832 if(!becomes_deadlock_summand)
833 {
834 new_action_list = reverse(new_action_list);
835 multi_action new_multi_action(new_action_list, as.multi_action().time());
836
837 // Copy most of the old information, only the multi action has changed
838 stochastic_action_summand new_summand(as.summation_variables(), as.condition(), new_multi_action, as.assignments(), as.distribution());
839 new_action_summands.push_back(new_summand);
840 }
841 else
842 {
843 // Add a new deadlock summand, copying most of the information for the old action summand
844 new_deadlock_summands.emplace_back(as.summation_variables(), as.condition(), deadlock(as.multi_action().time()));
845 }
846 }
847
848 stochastic_linear_process new_process(lps_old_spec.process().process_parameters(),
849 new_deadlock_summands,
850 new_action_summands);
851 stochastic_specification lps_new_spec(lps_old_spec.data(),
852 new_actions,
853 lps_old_spec.global_variables(),
854 new_process,
855 lps_old_spec.initial_process());
856 return lps_new_spec;
857}
858
859} // namespace mcrl2::lps
860
861namespace std
862{
863/// \brief Output an action_rename_rule to ostream.
864/// \param out An output stream
865/// \return The output stream
866// Currently, the variables are not printed. The shape is also not parseable. This may be mended.
867inline
869{
870 return out << "(" << r.condition() << ") -> " << r.lhs() << " => " << r.rhs();
871}
872
873/// \brief Output a action_rename_rule to ostream.
874/// \param out An output stream
875/// \return The output stream
876// Currently, the data declaration and the action declaration are not printed.
877inline
879{
880 for(const mcrl2::lps::action_rename_rule& r: s.rules())
881 {
882 out << r << "\n";
883 }
884 return out;
885}
886
887
888} // end namespace std
889
890
891#endif // MCRL2_LPS_ACTION_RENAME_H
A unordered_map class in which aterms can be stored.
parse_node_unexpected_exception(const parser &p, const parse_node &node)
Definition parse.h:76
\brief Assignment of a data expression to a variable
Definition assignment.h:88
const data_expression & rhs() const
Definition assignment.h:119
const variable & lhs() const
Definition assignment.h:114
data_expression & operator=(const data_expression &) noexcept=default
data_expression & operator=(data_expression &&) noexcept=default
sort_expression sort() const
Returns the sort of the data expression.
Definition data.cpp:107
data_expression(const data_expression &) noexcept=default
Move semantics.
void translate_user_notation()
Translate user notation within the equations of the data specification.
data_specification()=default
Default constructor. Generate a data specification that contains only booleans and positive numbers.
Rewriter that operates on data expressions.
Definition rewriter.h:84
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
\brief A sort expression
\brief A data variable
Definition variable.h:25
const sort_expression & sort() const
Definition variable.h:40
const data::data_expression & condition() const
Returns the condition of the rule.
const process::process_expression & rhs() const
Returns the right hand side of the rule.
data::data_expression & condition()
Returns the condition of the rule.
action_rename_rule()=default
Constructor.
action_rename_rule(const data::variable_list &variables, const data::data_expression &condition, const process::action &lhs, const process::process_expression &rhs)
Constructor.
process::process_expression m_rhs
right hand side of the rule. Can only be an action, tau or delta.
data::variable_list m_variables
The data variables of the rule.
bool check_that_rhs_is_tau_delta_or_an_action() const
data::variable_list & variables()
Returns the variables of the rule.
process::action m_lhs
The left hand side of the rule.
action_rename_rule(const atermpp::aterm &t)
Constructor.
data::data_expression m_condition
The condition of the rule.
const data::variable_list & variables() const
Returns the variables of the rule.
const process::action & lhs() const
Returns the left hand side of the rule.
Action rename specification.
const std::vector< action_rename_rule > & rules() const
Returns the action rename rules.
data::data_specification m_data
The data specification of the action rename specification.
process::action_label_list & action_labels()
Returns the sequence of action labels.
std::vector< action_rename_rule > m_rules
The action rename rules of the action rename specification.
action_rename_specification(const data::data_specification &data, const process::action_label_list &action_labels, const std::vector< action_rename_rule > &rules)
Constructor.
std::vector< action_rename_rule > & rules()
Returns the action rename rules.
action_rename_specification()=default
Constructor.
process::action_label_list m_action_labels
The action labels of the action rename specification.
const process::action_label_list & action_labels() const
Returns the sequence of action labels.
action_rename_specification(atermpp::aterm t)
Constructor.
bool is_well_typed() const
Indicates whether the action_rename_specification is well typed.
action_rename_specification operator()(const action_rename_specification &arspec, const stochastic_specification &lpsspec)
Type check an action_rename_specification.
Definition typecheck.h:97
process::detail::action_context m_action_context
Definition typecheck.h:72
action_rename_rule typecheck_action_rename_rule(const action_rename_rule &x, const process::action_label_list &action_labels)
Definition typecheck.h:74
data::data_type_checker m_data_type_checker
Definition typecheck.h:71
action_rename_type_checker()
Default constructor for an action rename type checker.
Definition typecheck.h:88
LPS summand containing a multi-action.
data::data_expression_list next_state(const data::variable_list &process_parameters) const
Returns the next state corresponding to this summand.
Definition lps.cpp:71
LPS summand containing a deadlock.
Represents a deadlock.
Definition deadlock.h:23
deadlock(data::data_expression time=data::undefined_real())
Constructor.
Definition deadlock.h:33
bool has_time() const
Returns true if time is available.
Definition deadlock.h:39
data::data_expression & time()
Returns the time.
Definition deadlock.h:53
multi_action_type_checker(const data::data_specification &dataspec=data::data_specification())
Default constructor.
Definition typecheck.h:41
multi_action operator()(const process::untyped_multi_action &x)
Type check a multi action. Throws a mcrl2::runtime_error exception if the expression is not well type...
Definition typecheck.h:50
data::detail::variable_context m_variable_context
Definition typecheck.h:26
process::detail::action_context m_action_context
Definition typecheck.h:25
data::data_type_checker m_data_type_checker
Definition typecheck.h:24
multi_action_type_checker(const data::data_specification &dataspec, const VariableContainer &variables, const ActionLabelContainer &action_labels)
Definition typecheck.h:30
\brief A timed multi-action
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 & operator=(multi_action &&) noexcept=default
multi_action(const process::action_list &actions=process::action_list(), data::data_expression time=data::undefined_real())
Constructor. Actions are sorted to establish the sorted-storage invariant.
process_initializer & operator=(process_initializer &&) noexcept=default
process_initializer(const data::data_expression_list &expressions)
Constructor.
Linear process specification.
\brief A stochastic distribution
stochastic_distribution & operator=(stochastic_distribution &&) noexcept=default
stochastic_distribution()
\brief Default constructor X3.
stochastic_distribution(const data::variable_list &variables, const data::data_expression &distribution)
\brief Constructor Z12.
stochastic_process_initializer(const data::data_expression_list &expressions, const stochastic_distribution &distribution)
Constructor.
\brief An action label
action(const action_label &label, const data::data_expression_list &arguments)
\brief Constructor Z14.
const data::data_expression_list & arguments() const
action(const action &) noexcept=default
Move semantics.
const action_label & label() const
\brief The allow operator
\brief The at operator
const data::data_expression & time_stamp() const
const process_expression & operand() const
\brief The block operator
\brief The bounded initialization
\brief The choice operator
const process_expression & left() const
const process_expression & right() const
\brief The communication operator
\brief The value delta
delta()
\brief Default constructor X3.
\brief The hide operator
\brief The if-then-else operator
\brief The if-then operator
const process_expression & then_case() const
const data::data_expression & condition() const
\brief The left merge operator
\brief The merge operator
\brief A process equation
process_equation()
\brief Default constructor X3.
process_equation(const process_equation &) noexcept=default
Move semantics.
const data::variable_list & formal_parameters() const
const process_identifier & identifier() const
const process_expression & expression() const
\brief A process expression
process_expression(const process_expression &) noexcept=default
Move semantics.
const process_identifier & identifier() const
const data::data_expression_list & actual_parameters() const
const process_identifier & identifier() const
Process specification consisting of a data specification, action labels, a sequence of process equati...
const process_expression & init() const
Returns the initialization of the process specification.
const process::action_label_list & action_labels() const
Returns the action label specification.
\brief The rename operator
\brief The sequential composition
const process_expression & right() const
const process_expression & left() const
\brief The distribution operator
const data::variable_list & variables() const
const data::data_expression & distribution() const
\brief The sum operator
const process_expression & operand() const
\brief The synchronization operator
const process_expression & left() const
const process_expression & right() const
\brief The value tau
tau()
\brief Default constructor X3.
\brief An untyped multi action or data application
untyped_multi_action()
\brief Default constructor X3.
D_ParserTables parser_tables_mcrl2
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:393
static data_specification const & default_specification()
Definition parse.h:28
bool check_assignment_variables(assignment_list const &assignments, variable_list const &variables)
Returns true if the left hand sides of assignments are contained in variables.
Namespace for system defined sort bool_.
Definition bool.h:29
bool is_bool(const sort_expression &e)
Recogniser for sort expression Bool.
Definition bool.h:51
bool is_and_application(const atermpp::aterm &e)
Recogniser for application of &&.
Definition bool.h:278
bool is_not_application(const atermpp::aterm &e)
Recogniser for application of !.
Definition bool.h:214
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:74
Namespace for system defined sort real_.
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
Definition real1.h:55
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
bool is_well_typed(const T &x)
Checks well typedness of an LPS object.
bool check_action_labels(const process::action_list &actions, const std::set< process::action_label > &labels)
Returns true if the labels of the given actions are contained in labels.
multi_action complete_multi_action(process::untyped_multi_action &x, const process::action_label_list &action_decls, const data::data_specification &data_spec=data::detail::default_specification())
Definition lps.cpp:148
process::action_label rename_action_label(const process::action_label &act, const std::regex &matching_regex, const std::string &replacing_fmt)
bool check_action_label_sorts(const process::action_label_list &action_labels, const std::set< data::sort_expression > &sorts)
Returns true if the sorts of the given action labels are contained in sorts.
bool check_well_typedness(const T &x)
Checks well typedness of an LPS object, and will print error messages to stderr.
bool check_action_sorts(const process::action_list &actions, const std::set< data::sort_expression > &sorts)
Returns true if the sorts of the given actions are contained in sorts.
void complete_action_rename_specification(action_rename_specification &x, const lps::stochastic_specification &spec)
Definition lps.cpp:166
process::untyped_multi_action parse_multi_action_new(const std::string &text)
Definition lps.cpp:130
multi_action complete_multi_action(process::untyped_multi_action &x, multi_action_type_checker &typechecker, const data::data_specification &data_spec=data::detail::default_specification())
Definition lps.cpp:140
action_rename_specification parse_action_rename_specification_new(const std::string &text)
Definition lps.cpp:156
The main namespace for the LPS library.
Definition constelm.h:18
std::string pp(const lps::stochastic_specification &x, bool arg0)
Definition lps.cpp:40
std::set< data::variable > find_all_variables(const lps::linear_process &x)
Definition lps.cpp:47
std::string pp(const lps::specification &x, bool arg0)
Definition lps.cpp:35
std::set< data::sort_expression > find_sort_expressions(const lps::stochastic_specification &x)
Definition lps.cpp:46
std::string pp_extended(const lps::stochastic_specification &x, const std::string &process_name, bool precedence_aware=true)
Definition lps.cpp:79
std::set< process::action_label > find_action_labels(const lps::stochastic_specification &x)
Definition lps.cpp:68
std::set< data::variable > find_free_variables(const lps::stochastic_specification &x)
Definition lps.cpp:56
std::string pp(const lps::stochastic_distribution &x, bool arg0)
Definition lps.cpp:37
std::string pp_extended(const stochastic_specification &x, const std::string &process_name, bool precedence_aware, bool summand_numbers)
Definition lps.cpp:98
std::set< data::variable > find_all_variables(const lps::multi_action &x)
Returns all variables inside a multi-action.
Definition lps.cpp:52
std::set< data::variable > find_all_variables(const lps::stochastic_specification &x)
Definition lps.cpp:50
bool check_well_typedness(const specification &x)
Definition lps.cpp:118
std::set< data::variable > find_free_variables(const lps::linear_process &x)
Definition lps.cpp:53
bool check_well_typedness(const linear_process &x)
Definition lps.cpp:108
std::set< data::function_symbol > find_function_symbols(const lps::stochastic_specification &x)
Definition lps.cpp:62
std::string pp_extended(const specification &x, const std::string &process_name, bool precedence_aware, bool summand_numbers)
Definition lps.cpp:88
lps::stochastic_specification action_rename(const action_rename_specification &action_rename_spec, const lps::stochastic_specification &lps_old_spec, const data::rewriter &rewr, const bool enable_rewriting)
Rename the actions in a linear specification using a given action_rename_spec.
std::set< process::action_label > find_action_labels(const lps::process_initializer &x)
Definition lps.cpp:66
std::set< data::variable > find_free_variables(const lps::specification &x)
Definition lps.cpp:55
multi_action typecheck_multi_action(process::untyped_multi_action &mult_act, const data::data_specification &data_spec, const process::action_label_list &action_decls)
Type check a multi action Throws an exception if something went wrong.
Definition typecheck.h:125
void normalize_sorts(lps::specification &x, const data::sort_specification &)
Definition lps.cpp:42
std::set< data::variable > find_free_variables(const lps::deadlock &x)
Definition lps.cpp:57
std::string pp(const lps::deadlock_summand &x, bool arg0)
Definition lps.cpp:31
std::set< process::action_label > find_action_labels(const lps::linear_process &x)
Definition lps.cpp:65
lps::multi_action normalize_sorts(const lps::multi_action &x, const data::sort_specification &sortspec)
Definition lps.cpp:41
std::set< data::variable > find_free_variables(const lps::stochastic_linear_process &x)
Definition lps.cpp:54
multi_action typecheck_multi_action(process::untyped_multi_action &mult_act, multi_action_type_checker &typechecker)
Type check a multi action Throws an exception if something went wrong.
Definition typecheck.h:141
std::set< data::function_symbol > find_function_symbols(const lps::specification &x)
Definition lps.cpp:61
std::string pp(const lps::stochastic_linear_process &x, bool arg0)
Definition lps.cpp:38
std::set< data::variable > find_free_variables(const lps::stochastic_process_initializer &x)
Definition lps.cpp:60
std::set< data::variable > find_free_variables(const lps::multi_action &x)
Definition lps.cpp:58
std::string pp(const lps::deadlock &x, bool arg0)
Definition lps.cpp:30
void normalize_sorts(lps::stochastic_specification &x, const data::sort_specification &)
Definition lps.cpp:43
std::set< data::variable > find_free_variables(const lps::process_initializer &x)
Definition lps.cpp:59
std::string pp(const lps::stochastic_action_summand &x, bool arg0)
Definition lps.cpp:36
std::string pp(const lps::stochastic_process_initializer &x, bool arg0)
Definition lps.cpp:39
std::string pp(const lps::linear_process &x, bool arg0)
Definition lps.cpp:32
std::string pp(const lps::multi_action &x, bool arg0)
Definition lps.cpp:33
atermpp::aterm action_rename_specification_to_aterm(const action_rename_specification &spec)
atermpp::aterm action_rename_rule_to_aterm(const action_rename_rule &rule)
std::set< data::sort_expression > find_sort_expressions(const lps::specification &x)
Definition lps.cpp:45
std::string pp(const lps::action_summand &x, bool arg0)
Definition lps.cpp:29
std::set< data::variable > find_all_variables(const lps::specification &x)
Definition lps.cpp:49
stochastic_specification action_rename(const std::regex &matching_regex, const std::string &replacing_fmt, const stochastic_specification &lps_old_spec)
Rename actions in given specification based on a regular expression and a string that specifies how t...
bool check_well_typedness(const stochastic_specification &x)
Definition lps.cpp:123
std::set< data::variable > find_all_variables(const lps::deadlock &x)
Definition lps.cpp:51
action_rename_specification typecheck_action_rename_specification(const action_rename_specification &arspec, const lps::stochastic_specification &lpsspec)
Type checks an action rename specification.
Definition typecheck.h:154
std::set< data::variable > find_all_variables(const lps::stochastic_linear_process &x)
Definition lps.cpp:48
bool check_well_typedness(const stochastic_linear_process &x)
Definition lps.cpp:113
lps::multi_action translate_user_notation(const lps::multi_action &x)
Definition lps.cpp:44
std::set< core::identifier_string > find_identifiers(const lps::stochastic_specification &x)
Definition lps.cpp:64
std::set< core::identifier_string > find_identifiers(const lps::specification &x)
Definition lps.cpp:63
std::set< process::action_label > find_action_labels(const lps::specification &x)
Definition lps.cpp:67
std::string pp(const lps::process_initializer &x, bool arg0)
Definition lps.cpp:34
bool check_process_instance_assignment(const process_equation &eq, const process_instance_assignment &inst)
Returns true if the process instance assignment a matches with the process equation eq.
Definition is_linear.h:25
bool is_process(const process_expression &x)
Returns true if the argument is a process instance.
Definition is_linear.h:68
bool is_conditional_deadlock(const process_expression &x)
Returns true if the argument is a conditional deadlock.
Definition is_linear.h:128
bool is_linear_process_term(const process_expression &x)
Returns true if the argument is a linear process.
Definition is_linear.h:154
bool check_process_instance(const process_equation &eq, const process_instance &init)
Returns true if the process instance a matches with the process equation eq.
Definition is_linear.h:46
bool is_alternative(const process_expression &x)
Returns true if the argument is an alternative composition.
Definition is_linear.h:144
bool is_timed_deadlock(const process_expression &x)
Returns true if the argument is a deadlock.
Definition is_linear.h:93
bool is_action_prefix(const process_expression &x)
Returns true if the argument is an action prefix.
Definition is_linear.h:120
bool is_stochastic_process(const process_expression &x)
Returns true if the argument is a process instance, optionally wrapped in a stochastic distribution.
Definition is_linear.h:78
bool is_multiaction(const process_expression &x)
Returns true if the argument is a multi-action.
Definition is_linear.h:102
bool is_conditional_action_prefix(const process_expression &x)
Returns true if the argument is a conditional action prefix.
Definition is_linear.h:136
bool is_timed_multiaction(const process_expression &x)
Returns true if the argument is a multi-action.
Definition is_linear.h:112
The main namespace for the Process library.
bool is_at(const atermpp::aterm &x)
bool is_linear(const process_specification &p, bool verbose=false)
Returns true if the process specification is linear.
Definition is_linear.h:344
bool is_linear(const process_expression &x, const process_equation &eqn)
Returns true if the process expression is linear.
Definition is_linear.h:389
bool is_process_instance(const atermpp::aterm &x)
bool is_process_instance_assignment(const atermpp::aterm &x)
bool is_tau(const atermpp::aterm &x)
bool is_seq(const atermpp::aterm &x)
bool is_delta(const atermpp::aterm &x)
bool is_linear(const process_equation &eqn)
Returns true if the process equation is linear.
Definition is_linear.h:379
bool is_sum(const atermpp::aterm &x)
bool is_action(const atermpp::aterm &x)
bool is_if_then(const atermpp::aterm &x)
bool is_choice(const atermpp::aterm &x)
bool is_stochastic_operator(const atermpp::aterm &x)
bool is_sync(const atermpp::aterm &x)
std::ostream & operator<<(std::ostream &out, const mcrl2::lps::action_rename_specification &s)
Output a action_rename_rule to ostream.
std::ostream & operator<<(std::ostream &out, const mcrl2::lps::action_rename_rule &r)
Output an action_rename_rule to ostream.
core::identifier_string parse_Id(const parse_node &node) const
Definition parse.h:231
const parser & m_parser
Definition parse.h:83
data::data_expression parse_DataExpr(const core::parse_node &node) const
Definition parse_impl.h:208
bool callback_DataSpecElement(const core::parse_node &node, untyped_data_specification &result) const
Definition parse_impl.h:410
std::vector< lps::action_rename_rule > parse_ActionRenameRuleList(const core::parse_node &node) const
Definition parse_impl.h:71
process::action parse_Action_as_action(const core::parse_node &node) const
Definition parse_impl.h:47
bool callback_ActionRenameSpec(const core::parse_node &node, data::untyped_data_specification &dataspec_result, lps::action_rename_specification &result) const
Definition parse_impl.h:87
std::vector< lps::action_rename_rule > parse_ActionRenameRuleSpec(const core::parse_node &node) const
Definition parse_impl.h:76
lps::action_rename_specification parse_ActionRenameSpec(const core::parse_node &node) const
Definition parse_impl.h:119
process::process_expression parse_ActionRenameRuleRHS(const core::parse_node &node) const
Definition parse_impl.h:53
action_rename_actions(const core::parser &parser_)
Definition parse_impl.h:42
lps::action_rename_rule parse_ActionRenameRule(const core::parse_node &node) const
Definition parse_impl.h:61
Function object for applying a substitution to LPS data types.
bool is_well_typed(const linear_process_base< ActionSummand > &p) const
Checks well typedness of a linear process.
bool is_well_typed(const process::action &a) const
Traverses an action.
bool is_well_typed(const action_summand &s) const
Checks well typedness of a summand.
bool check_time(const data::data_expression &t, const std::string &type) const
Checks if the sort of t has type real.
bool is_well_typed(const data::assignment &a) const
Traverses an assignment.
bool check_condition(const data::data_expression &t, const std::string &type) const
Checks if the sort of t has type bool.
bool is_well_typed(const stochastic_specification &spec) const
bool is_well_typed(const data::variable &d) const
Checks well typedness of a variable.
bool check_assignments(const data::assignment_list &l, const std::string &type) const
Checks if the assignments are well typed and have unique left hand sides.
bool is_well_typed(const specification &spec) const
bool is_well_typed(const data::sort_expression &d) const
Checks well typedness of a sort expression.
bool is_well_typed_container(const Container &c) const
Checks well typedness of the elements of a container.
bool is_well_typed(const process::action_label &d) const
Traverses an action label.
bool is_well_typed(const specification_base< LinearProcess, InitialProcessExpression > &spec, const std::set< data::variable > &free_variables) const
Checks well typedness of a linear process specification.
bool is_well_typed(const deadlock &d) const
Checks well typedness of a deadlock.
bool is_well_typed(const data::data_expression &d) const
Checks well typedness of a data expression.
bool is_well_typed(const deadlock_summand &s) const
Checks well typedness of a summand.
bool is_well_typed(const multi_action &a) const
Checks well typedness of a multi-action.
process::untyped_multi_action parse_MultAct(const core::parse_node &node) const
Definition parse_impl.h:29
multi_action_actions(const core::parser &parser_)
Definition parse_impl.h:25
action_actions(const core::parser &parser_)
Definition parse_impl.h:46
Converts a process expression into linear process format. Use the convert member functions for this.
lps::deadlock_summand_vector m_deadlock_summands
The result of the conversion.
process_equation m_equation
The process equation that is checked.
lps::specification convert(const process_specification &p)
Converts a process_specification into a specification. Throws non_linear_process if a non-linear sub-...
void leave(const process::left_merge &x)
Visit left_merge node.
lps::action_summand_vector m_action_summands
The result of the conversion.
void leave(const process::bounded_init &x)
Visit bounded_init node.
void convert(const process_equation &)
Returns true if the process equation e is linear.
void leave(const process::if_then_else &x)
Visit if_then_else node.
Exception that is thrown by linear_process_expression_traverser.
Definition is_linear.h:175
Checks if a process equation is linear. Use the is_linear() member function for this.
Definition is_linear.h:164
linear_process_expression_traverser(const process_equation &eqn_=process_equation())
Definition is_linear.h:181
void enter(const process::process_instance &x)
Definition is_linear.h:186
process_equation eqn
The process equation that is checked.
Definition is_linear.h:171
bool is_linear(const process_expression &x, bool verbose=false)
Returns true if the process equation e is linear.
Definition is_linear.h:322
void enter(const process::process_instance_assignment &x)
Definition is_linear.h:194
Converts a process expression into linear process format. Use the convert member functions for this.
void leave(const process::stochastic_operator &x)
Visit stochastic operator node.
void convert(const process_equation &)
Returns true if the process equation e is linear.
lps::stochastic_action_summand_vector m_action_summands
The result of the conversion.
lps::deadlock_summand_vector m_deadlock_summands
The result of the conversion.
lps::stochastic_specification convert(const process_specification &p)
Converts a process_specification into a stochastic_specification. Throws non_linear_process if a non-...