mCRL2
Loading...
Searching...
No Matches
linear_process_conversion_traverser.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//
9/// \file mcrl2/lps/detail/linear_process_conversion_traverser.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_LPS_DETAIL_LINEAR_PROCESS_CONVERSION_TRAVERSER_H
13#define MCRL2_LPS_DETAIL_LINEAR_PROCESS_CONVERSION_TRAVERSER_H
14
15#include "mcrl2/lps/stochastic_specification.h"
16#include "mcrl2/process/is_linear.h"
17
18namespace mcrl2
19{
20
21namespace process
22{
23
24namespace detail
25{
26
27// TODO: join the stochastic and non-stochastic versions of the traversers
28
29/// \brief Converts a process expression into linear process format.
30/// Use the \p convert member functions for this.
32{
34 using super::enter;
35 using super::leave;
36 using super::apply;
37
38 /// \brief The result of the conversion.
40
41 /// \brief The result of the conversion.
43
44 /// \brief The process equation that is checked.
46
47 /// \brief Contains intermediary results.
49
50 /// \brief Contains intermediary results.
52
53 /// \brief Contains intermediary results.
55
56 /// \brief Contains intermediary results.
58
59 /// \brief True if m_deadlock was changed.
61
62 /// \brief True if m_multi_action was changed.
64
65 /// \brief True if m_next_state was changed.
67
68 /// \brief Contains intermediary results.
70
71 /// \brief Exception that is thrown to denote that the process is not linear.
73 {
75
77 : expr(p)
78 {}
79 };
80
81 /// \brief Clears the current summand
83 {
84 m_sum_variables = data::variable_list();
86 m_deadlock_changed = false;
90 m_next_state = data::assignment_list();
92 }
93
94 /// \brief Adds a summand to the result
96 {
98 {
100 {
101 m_action_summands.push_back(lps::action_summand(m_sum_variables, m_condition, m_multi_action, m_next_state));
102 mCRL2log(log::debug) << "adding action summand\n" << m_action_summands.back() << std::endl;
104 }
105 else
106 {
107 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: encountered a multi action without process reference");
108 }
109 }
110 else if (m_deadlock_changed)
111 {
112 m_deadlock_summands.push_back(lps::deadlock_summand(m_sum_variables, m_condition, m_deadlock));
113 mCRL2log(log::debug) << "adding deadlock summand\n" << m_deadlock_summands.back() << std::endl;
115 }
116 }
117
118 /// \brief Visit delta node
119 /// \return The result of visiting the node
120 /// \param x A process expression
121 void leave(const delta& /* x */)
122 {
124 m_deadlock_changed = true;
125 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
126 }
127
128 /// \brief Visit tau node
129 /// \return The result of visiting the node
130 /// \param x A process expression
131 void leave(const process::tau& /* x */)
132 {
135 mCRL2log(log::debug) << "adding multi action tau\n" << m_multi_action << std::endl;
136 }
137
138 /// \brief Visit action node
139 /// \return The result of visiting the node
140 /// \param x A process expression
141 /// \param l An action label
142 /// \param v A sequence of data expressions
143 void leave(const process::action& x)
144 {
148 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
149 }
150
151 /// \brief Visit sum node
152 /// \return The result of visiting the node
153 /// \param x A process expression
154 /// \param v A sequence of data variables
155 /// \param right A process expression
156 void leave(const process::sum& x)
157 {
158 m_sum_variables = m_sum_variables + x.variables();
159 mCRL2log(log::debug) << "adding sum variables\n" << data::pp(x.variables()) << std::endl;
160 }
161
162 /// \brief Visit block node
163 /// \return The result of visiting the node
164 /// \param x A process expression
165 /// \param s A sequence of identifiers
166 /// \param right A process expression
167 void leave(const process::block& x)
168 {
170 }
171
172 /// \brief Visit hide node
173 /// \return The result of visiting the node
174 /// \param x A process expression
175 /// \param s A sequence of identifiers
176 /// \param right A process expression
177 void leave(const process::hide& x)
178 {
180 }
181
182 /// \brief Visit rename node
183 /// \return The result of visiting the node
184 /// \param x A process expression
185 /// \param r A sequence of rename expressions
186 /// \param right A process expression
187 void leave(const process::rename& x)
188 {
190 }
191
192 /// \brief Visit comm node
193 /// \return The result of visiting the node
194 /// \param x A process expression
195 /// \param c A sequence of communication expressions
196 /// \param right A process expression
197 void leave(const process::comm& x)
198 {
200 }
201
202 /// \brief Visit allow node
203 /// \return The result of visiting the node
204 /// \param x A process expression
205 /// \param s A sequence of multi-action names
206 /// \param right A process expression
207 void leave(const process::allow& x)
208 {
210 }
211
212 /// \brief Visit sync node
213 /// \return The result of visiting the node
214 /// \param x A process expression
215 /// \param left A process expression
216 /// \param right A process expression
217 void apply(const process::sync& x)
218 {
219 apply(x.left());
221 apply(x.right());
223 m_multi_action = l + r;
225 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
226 }
227
228 /// \brief Visit at node
229 /// \return The result of visiting the node
230 /// \param x A process expression
231 /// \param left A process expression
232 /// \param d A data expression
233 void leave(const process::at& x)
234 {
235 if (is_delta(x))
236 {
238 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
239 }
240 else
241 {
243 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
244 }
245 }
246
247 /// \brief Visit seq node
248 /// \return The result of visiting the node
249 /// \param x A process expression
250 /// \param left A process expression
251 /// \param right A process expression
252 void apply(const process::seq& x)
253 {
254 apply(x.left());
255
256 // Check 1) The expression right must be a process instance or a process assignment
258 {
259 const process_instance& p = atermpp::down_cast<process_instance>(x.right());
260 // Check 2) The process equation and and the process instance must match
262 {
263 std::clog << "seq right hand side: " << process::pp(x.right()) << std::endl;
264 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
265 }
266 m_next_state = data::make_assignment_list(m_equation.formal_parameters(), p.actual_parameters());
268 }
270 {
272 // Check 2) The process equation and and the process instance assignment must match
274 {
275 std::clog << "seq right hand side: " << process::pp(x.right()) << std::endl;
276 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
277 }
278 m_next_state = p.assignments(); // TODO: check if this is correct
280 }
281 else
282 {
283 std::clog << "seq right hand side: " << process::pp(x.right()) << std::endl;
284 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered with an unexpected right hand side");
285 }
286
287 mCRL2log(log::debug) << "adding next state\n" << data::pp(m_next_state) << std::endl;
288 }
289
290 /// \brief Visit if_then node
291 /// \return The result of visiting the node
292 /// \param x A process expression
293 /// \param d A data expression
294 /// \param right A process expression
295 void leave(const process::if_then& x)
296 {
298 mCRL2log(log::debug) << "adding condition\n" << data::pp(m_condition) << std::endl;
299 }
300
301 /// \brief Visit if_then_else node
302 /// \return The result of visiting the node
303 /// \param x A process expression
304 /// \param d A data expression
305 /// \param left A process expression
306 /// \param right A process expression
307 void leave(const process::if_then_else& x)
308 {
310 }
311
312 /// \brief Visit bounded_init node
313 /// \return The result of visiting the node
314 /// \param x A process expression
315 /// \param left A process expression
316 /// \param right A process expression
317 void leave(const process::bounded_init& x)
318 {
320 }
321
322 /// \brief Visit merge node
323 /// \return The result of visiting the node
324 /// \param x A process expression
325 /// \param left A process expression
326 /// \param right A process expression
327 void leave(const process::merge& x)
328 {
330 }
331
332 /// \brief Visit left_merge node
333 /// \return The result of visiting the node
334 /// \param x A process expression
335 /// \param left A process expression
336 /// \param right A process expression
337 void leave(const process::left_merge& x)
338 {
340 }
341
342 /// \brief Visit choice node
343 /// \return The result of visiting the node
344 /// \param x A process expression
345 /// \param left A process expression
346 /// \param right A process expression
347 void apply(const process::choice& x)
348 {
349 apply(x.left());
350 if (!is_choice(x.left()))
351 {
353 }
354 apply(x.right());
356 {
358 }
359 }
360
361 /// \brief Returns true if the process equation e is linear.
362 /// \param e A process equation
363 void convert(const process_equation& /* e */)
364 {
367 add_summand(); // needed if it is not a choice
368 }
369
370 /// \brief Converts a process_specification into a specification.
371 /// Throws \p non_linear_process if a non-linear sub-expression is encountered.
372 /// Throws \p mcrl2::runtime_error in the following cases:
373 /// \li The number of equations is not equal to one
374 /// \li The initial process is not a process instance, or it does not match with the equation
375 /// \li A sequential process is found with a right hand side that is not a process instance,
376 /// or it doesn't match the equation
377 /// \param p A process specification
378 /// \return The converted specification
380 {
381 m_action_summands.clear();
382 m_deadlock_summands.clear();
383
384 // Check 1) The number of equations must be one
385 if (p.equations().size() != 1)
386 {
387 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the number of process equations is not equal to 1!");
388 }
389 m_equation = p.equations().front();
390
391 lps::process_initializer proc_init;
392
394 {
395 const process_instance& init = atermpp::down_cast<process_instance>(p.init());
397 {
398 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the initial process does not match the process equation");
399 }
401 }
403 {
406 {
407 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the initial process does not match the process equation");
408 }
409 proc_init = lps::process_initializer(data::right_hand_sides(init.assignments()));
410 }
411 else
412 {
413 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the initial process has an unexpected value");
414 }
415
416 // Do the conversion
418
420 return lps::specification(p.data(), p.action_labels(), p.global_variables(), proc, proc_init);
421 }
422};
423
424/// \brief Converts a process expression into linear process format.
425/// Use the \p convert member functions for this.
427{
429 using super::enter;
430 using super::leave;
431 using super::apply;
432
433 /// \brief The result of the conversion.
435
436 /// \brief The result of the conversion.
438
439 /// \brief The process equation that is checked.
441
442 /// \brief Contains intermediary results.
444
445 /// \brief Contains intermediary results.
447
448 /// \brief Contains intermediary results.
450
451 /// \brief Contains intermediary results.
453
454 /// \brief Contains intermediary results.
456
457 /// \brief True if m_deadlock was changed.
459
460 /// \brief True if m_multi_action was changed.
462
463 /// \brief True if m_next_state was changed.
465
466 /// \brief Contains intermediary results.
468
469 /// \brief Exception that is thrown to denote that the process is not linear.
471 {
473
475 : expr(p)
476 {}
477 };
478
479 /// \brief Clears the current summand
481 {
482 m_sum_variables = data::variable_list();
484 m_deadlock_changed = false;
489 m_next_state = data::assignment_list();
490 m_next_state_changed = false;
491 }
492
493 /// \brief Adds a summand to the result
495 {
497 {
499 {
500 m_action_summands.push_back(lps::stochastic_action_summand(m_sum_variables, m_condition, m_multi_action, m_next_state, m_distribution));
501 mCRL2log(log::debug) << "adding action summand\n" << m_action_summands.back() << std::endl;
503 }
504 else
505 {
506 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: encountered a multi action without process reference");
507 }
508 }
509 else if (m_deadlock_changed)
510 {
511 m_deadlock_summands.push_back(lps::deadlock_summand(m_sum_variables, m_condition, m_deadlock));
512 mCRL2log(log::debug) << "adding deadlock summand\n" << m_deadlock_summands.back() << std::endl;
514 }
515 }
516
517 /// \brief Visit delta node
518 /// \return The result of visiting the node
519 /// \param x A process expression
520 void leave(const delta& /* x */)
521 {
523 m_deadlock_changed = true;
524 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
525 }
526
527 /// \brief Visit tau node
528 /// \return The result of visiting the node
529 /// \param x A process expression
530 void leave(const process::tau& /* x */)
531 {
534 mCRL2log(log::debug) << "adding multi action tau\n" << m_multi_action << std::endl;
535 }
536
537 /// \brief Visit action node
538 /// \return The result of visiting the node
539 /// \param x A process expression
540 /// \param l An action label
541 /// \param v A sequence of data expressions
542 void leave(const process::action& x)
543 {
547 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
548 }
549
550 /// \brief Visit sum node
551 /// \return The result of visiting the node
552 /// \param x A process expression
553 /// \param v A sequence of data variables
554 /// \param right A process expression
555 void leave(const process::sum& x)
556 {
557 m_sum_variables = m_sum_variables + x.variables();
558 mCRL2log(log::debug) << "adding sum variables\n" << data::pp(x.variables()) << std::endl;
559 }
560
561 /// \brief Visit block node
562 /// \return The result of visiting the node
563 /// \param x A process expression
564 /// \param s A sequence of identifiers
565 /// \param right A process expression
566 void leave(const process::block& x)
567 {
569 }
570
571 /// \brief Visit hide node
572 /// \return The result of visiting the node
573 /// \param x A process expression
574 /// \param s A sequence of identifiers
575 /// \param right A process expression
576 void leave(const process::hide& x)
577 {
579 }
580
581 /// \brief Visit rename node
582 /// \return The result of visiting the node
583 /// \param x A process expression
584 /// \param r A sequence of rename expressions
585 /// \param right A process expression
586 void leave(const process::rename& x)
587 {
589 }
590
591 /// \brief Visit comm node
592 /// \return The result of visiting the node
593 /// \param x A process expression
594 /// \param c A sequence of communication expressions
595 /// \param right A process expression
596 void leave(const process::comm& x)
597 {
599 }
600
601 /// \brief Visit allow node
602 /// \return The result of visiting the node
603 /// \param x A process expression
604 /// \param s A sequence of multi-action names
605 /// \param right A process expression
606 void leave(const process::allow& x)
607 {
609 }
610
611 /// \brief Visit sync node
612 /// \return The result of visiting the node
613 /// \param x A process expression
614 /// \param left A process expression
615 /// \param right A process expression
616 void apply(const process::sync& x)
617 {
618 apply(x.left());
620 apply(x.right());
622 m_multi_action = l + r;
624 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
625 }
626
627 /// \brief Visit at node
628 /// \return The result of visiting the node
629 /// \param x A process expression
630 /// \param left A process expression
631 /// \param d A data expression
632 void leave(const process::at& x)
633 {
634 if (is_delta(x))
635 {
637 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
638 }
639 else
640 {
642 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
643 }
644 }
645
646 /// \brief Visit seq node
647 /// \return The result of visiting the node
648 /// \param x A process expression
649 /// \param left A process expression
650 /// \param right A process expression
651 void apply(const process::seq& x)
652 {
653 apply(x.left());
654
657 {
658 auto const& op = atermpp::down_cast<stochastic_operator>(right);
659 m_distribution = lps::stochastic_distribution(op.variables(), op.distribution());
660 right = op.operand();
661 }
662
663 // Check 1) The expression right must be a process instance or a process assignment
664 if (is_process_instance(right))
665 {
666 const process_instance& p = atermpp::down_cast<process_instance>(right);
667 // Check 2) The process equation and and the process instance must match
669 {
670 std::clog << "seq right hand side: " << process::pp(right) << std::endl;
671 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
672 }
673 m_next_state = data::make_assignment_list(m_equation.formal_parameters(), p.actual_parameters());
675 }
677 {
679 // Check 2) The process equation and and the process instance assignment must match
681 {
682 std::clog << "seq right hand side: " << process::pp(right) << std::endl;
683 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
684 }
685 m_next_state = p.assignments(); // TODO: check if this is correct
687 }
688 else
689 {
690 std::clog << "seq right hand side: " << process::pp(right) << std::endl;
691 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered with an unexpected right hand side");
692 }
693
694 mCRL2log(log::debug) << "adding next state\n" << data::pp(m_next_state) << std::endl;
695 }
696
697 /// \brief Visit if_then node
698 /// \return The result of visiting the node
699 /// \param x A process expression
700 /// \param d A data expression
701 /// \param right A process expression
702 void leave(const process::if_then& x)
703 {
705 mCRL2log(log::debug) << "adding condition\n" << data::pp(m_condition) << std::endl;
706 }
707
708 /// \brief Visit if_then_else node
709 /// \return The result of visiting the node
710 /// \param x A process expression
711 /// \param d A data expression
712 /// \param left A process expression
713 /// \param right A process expression
714 void leave(const process::if_then_else& x)
715 {
717 }
718
719 /// \brief Visit bounded_init node
720 /// \return The result of visiting the node
721 /// \param x A process expression
722 /// \param left A process expression
723 /// \param right A process expression
724 void leave(const process::bounded_init& x)
725 {
727 }
728
729 /// \brief Visit merge node
730 /// \return The result of visiting the node
731 /// \param x A process expression
732 void leave(const process::merge& x)
733 {
735 }
736
737 /// \brief Visit left_merge node
738 /// \return The result of visiting the node
739 /// \param x A process expression
740 void leave(const process::left_merge& x)
741 {
743 }
744
745 /// \brief Visit stochastic operator node
746 /// \param x A process expression
748 {
750 }
751
752 /// \brief Visit choice node
753 /// \return The result of visiting the node
754 /// \param x A process expression
755 void apply(const process::choice& x)
756 {
757 apply(x.left());
758 if (!is_choice(x.left()))
759 {
761 }
762 apply(x.right());
764 {
766 }
767 }
768
769 /// \brief Returns true if the process equation e is linear.
770 /// \param e A process equation
771 void convert(const process_equation& /* e */)
772 {
775 add_summand(); // needed if it is not a choice
776 }
777
778 /// \brief Converts a process_specification into a stochastic_specification.
779 /// Throws \p non_linear_process if a non-linear sub-expression is encountered.
780 /// Throws \p mcrl2::runtime_error in the following cases:
781 /// \li The number of equations is not equal to one
782 /// \li The initial process is not a process instance, or it does not match with the equation
783 /// \li A sequential process is found with a right hand side that is not a process instance,
784 /// or it doesn't match the equation
785 /// \param p A process specification
786 /// \return The converted specification
788 {
789 m_action_summands.clear();
790 m_deadlock_summands.clear();
791
792 // Check 1) The number of equations must be one
793 if (p.equations().size() != 1)
794 {
795 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the number of process equations is not equal to 1!");
796 }
797
798 m_equation = p.equations().front();
799
800 // convert the initial state
802 process_expression p_init = p.init();
805 {
806 auto const& s = atermpp::down_cast<stochastic_operator>(p.init());
807 dist = lps::stochastic_distribution(s.variables(), s.distribution());
808 p_init = s.operand();
809 }
810 if (is_process_instance(p_init))
811 {
812 const process_instance& init = atermpp::down_cast<process_instance>(p_init);
814 {
815 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the initial process does not match the process equation");
816 }
818 }
820 {
821 const process_instance_assignment& init = atermpp::down_cast<process_instance_assignment>(p_init);
823 {
824 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the initial process does not match the process equation");
825 }
826 proc_init = lps::stochastic_process_initializer(data::right_hand_sides(init.assignments()), dist);
827 }
828 else
829 {
830 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the initial process has an unexpected value");
831 }
832
834
836
837 return lps::stochastic_specification(p.data(), p.action_labels(), p.global_variables(), proc, proc_init);
838 }
839};
840
841} // namespace detail
842
843} // namespace process
844
845} // namespace mcrl2
846
847#endif // MCRL2_LPS_DETAIL_LINEAR_PROCESS_CONVERSION_TRAVERSER_H
bool operator!=(const unprotected_aterm_core &t) const
Inequality operator on two unprotected aterms.
Definition aterm_core.h:92
parse_node_unexpected_exception(const parser &p, const parse_node &node)
Definition parse.h:78
\brief Assignment of a data expression to a variable
Definition assignment.h:91
const data_expression & rhs() const
Definition assignment.h:122
const variable & lhs() const
Definition assignment.h:117
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:108
\brief A sort expression
\brief A data variable
Definition variable.h:28
const sort_expression & sort() const
Definition variable.h:43
logger(const log_level_t l)
Default constructor.
Definition logger.h:164
action_rename_rule(const data::variable_list &variables, const data::data_expression &condition, const process::action &lhs, const process::process_expression &rhs)
Constructor.
Read-only singly linked list of action rename rules.
process::action_label_list & action_labels()
Returns the sequence of action labels.
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:68
const data::assignment_list & assignments() const
Returns the sequence of assignments.
LPS summand containing a deadlock.
Represents a deadlock.
Definition deadlock.h:26
deadlock(data::data_expression time=data::undefined_real())
Constructor.
Definition deadlock.h:36
bool has_time() const
Returns true if time is available.
Definition deadlock.h:42
const data::data_expression & time() const
Returns the time.
Definition deadlock.h:49
data::data_expression & time()
Returns the time.
Definition deadlock.h:56
linear_process(const data::variable_list &process_parameters, const deadlock_summand_vector &deadlock_summands, const action_summand_vector &action_summands)
Constructor.
\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
const data::data_expression & time() const
multi_action(const process::action_list &actions=process::action_list(), data::data_expression time=data::undefined_real())
Constructor.
process_initializer & operator=(process_initializer &&) noexcept=default
Linear process specification.
LPS summand containing a multi-action.
\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_linear_process(const data::variable_list &process_parameters, const deadlock_summand_vector &deadlock_summands, const stochastic_action_summand_vector &action_summands)
Constructor.
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
const action_label & label() const
\brief The allow operator
\brief The at operator
const data::data_expression & time_stamp() 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 data::data_expression & condition() const
\brief The left merge operator
\brief The merge operator
\brief A process equation
const data::variable_list & formal_parameters() const
const process_expression & expression() const
\brief A process expression
process_expression(const process_expression &) noexcept=default
Move semantics.
const data::data_expression_list & actual_parameters() 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 data::variable_list & variables() 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
Definition dparser.cpp:20
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
The main namespace for the aterm++ library.
Definition algorithm.h:21
void syntax_error_fn(struct D_Parser *ap)
Custom syntax error function that prints both the line number and the column.
Definition dparser.cpp:463
D_ParseNode * ambiguity_fn(struct D_Parser *, int n, struct D_ParseNode **v)
Function for resolving parser ambiguities.
Definition dparser.cpp:332
bool sequence_empty_intersection(Sequence s1, Sequence s2)
Determines if the unordered sequences s1 and s2 have an empty intersection.
bool sequence_contains_duplicates(Iterator first, Iterator last)
Returns true if the sequence [first, last) contains duplicates.
static data_specification const & default_specification()
Definition parse.h:31
bool sequence_is_subset_of_set(Iterator first, Iterator last, const std::set< T > &s)
Returns true if all elements of the range [first, last) are element of the set s.
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.
bool sequences_do_overlap(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
Returns true if the two sequences [first1, last1) and [first2, last2) have a non empty intersection.
std::set< typename Container::value_type > make_set(const Container &c)
Makes a set of the given container.
Namespace for system defined sort bool_.
Definition bool.h:32
bool is_bool(const sort_expression &e)
Recogniser for sort expression Bool.
Definition bool.h:54
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:77
Namespace for system defined sort real_.
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
Definition real1.h:58
Namespace for all data library functionality.
Definition data.cpp:22
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
atermpp::term_list< variable > variable_list
\brief list of variables
atermpp::term_list< assignment > assignment_list
\brief list of assignments
Definition assignment.h:146
std::string pp(const data::variable_list &x)
Definition data.cpp:31
std::string pp(const data::data_expression &x)
Definition data.cpp:52
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:132
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:150
process::untyped_multi_action parse_multi_action_new(const std::string &text)
Definition lps.cpp:114
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:124
action_rename_specification parse_action_rename_specification_new(const std::string &text)
Definition lps.cpp:140
The main namespace for the LPS library.
Definition constelm.h:21
std::string pp(const lps::stochastic_process_initializer &x)
Definition lps.cpp:36
std::string pp(const lps::stochastic_distribution &x)
Definition lps.cpp:34
std::set< data::variable > find_all_variables(const lps::linear_process &x)
Definition lps.cpp:44
std::set< data::sort_expression > find_sort_expressions(const lps::stochastic_specification &x)
Definition lps.cpp:43
std::set< process::action_label > find_action_labels(const lps::stochastic_specification &x)
Definition lps.cpp:65
std::set< data::variable > find_free_variables(const lps::stochastic_specification &x)
Definition lps.cpp:53
std::vector< stochastic_action_summand > stochastic_action_summand_vector
\brief vector of stochastic_action_summands
std::string pp_with_summand_numbers(const specification &x)
Definition lps.cpp:74
std::string pp(const lps::process_initializer &x)
Definition lps.cpp:31
std::set< data::variable > find_all_variables(const lps::stochastic_specification &x)
Definition lps.cpp:47
bool check_well_typedness(const specification &x)
Definition lps.cpp:102
std::set< data::variable > find_free_variables(const lps::linear_process &x)
Definition lps.cpp:50
std::string pp(const lps::stochastic_specification &x)
Definition lps.cpp:37
bool check_well_typedness(const linear_process &x)
Definition lps.cpp:92
std::set< data::function_symbol > find_function_symbols(const lps::stochastic_specification &x)
Definition lps.cpp:59
std::string pp(const lps::linear_process &x)
Definition lps.cpp:29
std::vector< deadlock_summand > deadlock_summand_vector
\brief vector of deadlock_summands
std::string pp(const lps::deadlock &x)
Definition lps.cpp:27
std::set< process::action_label > find_action_labels(const lps::process_initializer &x)
Definition lps.cpp:63
std::string pp(const lps::multi_action &x)
Definition lps.cpp:30
std::set< data::variable > find_free_variables(const lps::specification &x)
Definition lps.cpp:52
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:128
std::string pp(const lps::specification &x)
Definition lps.cpp:32
void normalize_sorts(lps::specification &x, const data::sort_specification &)
Definition lps.cpp:39
std::set< data::variable > find_free_variables(const lps::deadlock &x)
Definition lps.cpp:54
std::set< process::action_label > find_action_labels(const lps::linear_process &x)
Definition lps.cpp:62
lps::multi_action normalize_sorts(const lps::multi_action &x, const data::sort_specification &sortspec)
Definition lps.cpp:38
std::set< data::variable > find_free_variables(const lps::stochastic_linear_process &x)
Definition lps.cpp:51
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:144
std::set< data::function_symbol > find_function_symbols(const lps::specification &x)
Definition lps.cpp:58
std::set< data::variable > find_free_variables(const lps::stochastic_process_initializer &x)
Definition lps.cpp:57
void normalize_sorts(T &x, const data::sort_specification &sortspec, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
std::set< data::variable > find_free_variables(const lps::multi_action &x)
Definition lps.cpp:55
std::string pp(const lps::deadlock_summand &x)
Definition lps.cpp:28
void normalize_sorts(lps::stochastic_specification &x, const data::sort_specification &)
Definition lps.cpp:40
std::set< data::variable > find_free_variables(const lps::process_initializer &x)
Definition lps.cpp:56
std::string pp(const lps::stochastic_linear_process &x)
Definition lps.cpp:35
std::set< data::variable > find_all_variables(const lps::multi_action &x)
Definition lps.cpp:49
T normalize_sorts(const T &x, const data::sort_specification &sortspec, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value >::type *=0)
std::set< data::sort_expression > find_sort_expressions(const lps::specification &x)
Definition lps.cpp:42
std::vector< action_summand > action_summand_vector
\brief vector of action_summands
std::string pp(const lps::stochastic_action_summand &x)
Definition lps.cpp:33
std::set< data::variable > find_all_variables(const lps::specification &x)
Definition lps.cpp:46
bool check_well_typedness(const stochastic_specification &x)
Definition lps.cpp:107
std::set< data::variable > find_all_variables(const lps::deadlock &x)
Definition lps.cpp:48
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:157
std::set< data::variable > find_all_variables(const lps::stochastic_linear_process &x)
Definition lps.cpp:45
bool check_well_typedness(const stochastic_linear_process &x)
Definition lps.cpp:97
lps::multi_action translate_user_notation(const lps::multi_action &x)
Definition lps.cpp:41
std::set< core::identifier_string > find_identifiers(const lps::stochastic_specification &x)
Definition lps.cpp:61
std::string pp(const lps::action_summand &x)
Definition lps.cpp:26
std::set< core::identifier_string > find_identifiers(const lps::specification &x)
Definition lps.cpp:60
std::string pp_with_summand_numbers(const stochastic_specification &x)
Definition lps.cpp:83
std::set< process::action_label > find_action_labels(const lps::specification &x)
Definition lps.cpp:64
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:28
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:49
The main namespace for the Process library.
bool is_process_instance(const atermpp::aterm &x)
bool is_process_instance_assignment(const atermpp::aterm &x)
bool is_delta(const atermpp::aterm &x)
atermpp::term_list< action_label > action_label_list
\brief list of action_labels
atermpp::term_list< action > action_list
\brief list of actions
std::string pp(const process::process_expression &x)
Definition process.cpp:52
bool is_choice(const atermpp::aterm &x)
bool is_stochastic_operator(const atermpp::aterm &x)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
core::identifier_string parse_Id(const parse_node &node) const
Definition parse.h:233
Wrapper for D_ParseNode.
Definition dparser.h:86
parse_node child(int i) const
Definition dparser.cpp:43
int child_count() const
Definition dparser.cpp:37
std::string symbol_name(const parse_node &node) const
Definition parse.h:205
const parser & m_parser
Definition parse.h:85
Wrapper for D_Parser and its corresponding D_ParserTables.
Definition dparser.h:148
parse_node parse(const std::string &text, unsigned int start_symbol_index=0, bool partial_parses=false)
Parses a string. N.B. The user is responsible for destruction of the returned value by calling destro...
Definition dparser.cpp:209
parser(D_ParserTables &tables, D_AmbiguityFn ambiguity_fn=nullptr, D_SyntaxErrorFn syntax_error_fn=nullptr, std::size_t max_error_message_count=1)
Definition dparser.cpp:174
unsigned int start_symbol_index(const std::string &name) const
Definition dparser.cpp:204
Substitution that maps data variables to data expressions. The substitution is stored as an assignmen...
assignment_sequence_substitution(const assignment_list &assignments_)
data::data_expression parse_DataExpr(const core::parse_node &node) const
Definition parse_impl.h:211
bool callback_DataSpecElement(const core::parse_node &node, untyped_data_specification &result) const
Definition parse_impl.h:413
normalize_sorts_function(const sort_specification &sort_spec)
std::vector< lps::action_rename_rule > parse_ActionRenameRuleList(const core::parse_node &node) const
Definition parse_impl.h:75
process::action parse_Action_as_action(const core::parse_node &node) const
Definition parse_impl.h:51
bool callback_ActionRenameSpec(const core::parse_node &node, data::untyped_data_specification &dataspec_result, lps::action_rename_specification &result) const
Definition parse_impl.h:91
std::vector< lps::action_rename_rule > parse_ActionRenameRuleSpec(const core::parse_node &node) const
Definition parse_impl.h:80
lps::action_rename_specification parse_ActionRenameSpec(const core::parse_node &node) const
Definition parse_impl.h:123
process::process_expression parse_ActionRenameRuleRHS(const core::parse_node &node) const
Definition parse_impl.h:57
action_rename_actions(const core::parser &parser_)
Definition parse_impl.h:46
lps::action_rename_rule parse_ActionRenameRule(const core::parse_node &node) const
Definition parse_impl.h:65
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:33
multi_action_actions(const core::parser &parser_)
Definition parse_impl.h:29
action_actions(const core::parser &parser_)
Definition parse_impl.h:47
Converts a process expression into linear process format. Use the convert member functions for this.
process_expression_traverser< linear_process_conversion_traverser > super
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.
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.
process_expression_traverser< stochastic_linear_process_conversion_traverser > super
lps::stochastic_specification convert(const process_specification &p)
Converts a process_specification into a stochastic_specification. Throws non_linear_process if a non-...
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const