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 Converts a process expression into a linear process.
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::process::detail
19{
20
21// TODO: join the stochastic and non-stochastic versions of the traversers
22
23/// \brief Converts a process expression into linear process format.
24/// Use the \p convert member functions for this.
26{
28 using super::enter;
29 using super::leave;
30 using super::apply;
31
32 /// \brief The result of the conversion.
34
35 /// \brief The result of the conversion.
37
38 /// \brief The process equation that is checked.
40
41 /// \brief Contains intermediary results.
42 data::variable_list m_sum_variables;
43
44 /// \brief Contains intermediary results.
45 data::assignment_list m_next_state;
46
47 /// \brief Contains intermediary results.
49
50 /// \brief Contains intermediary results.
52
53 /// \brief True if m_deadlock was changed.
54 bool m_deadlock_changed = false;
55
56 /// \brief True if m_multi_action was changed.
58
59 /// \brief True if m_next_state was changed.
61
62 /// \brief Contains intermediary results.
64
65 /// \brief Exception that is thrown to denote that the process is not linear.
67 {
69
71 : expr(p)
72 {}
73 };
74
75 /// \brief Clears the current summand
77 {
78 m_sum_variables = data::variable_list();
80 m_deadlock_changed = false;
84 m_next_state = data::assignment_list();
86 }
87
88 /// \brief Adds a summand to the result
90 {
92 {
94 {
95 m_action_summands.emplace_back(m_sum_variables, m_condition, m_multi_action, m_next_state);
96 mCRL2log(log::debug) << "adding action summand\n" << m_action_summands.back() << std::endl;
98 }
99 else
100 {
101 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: encountered a multi action without process reference");
102 }
103 }
104 else if (m_deadlock_changed)
105 {
106 m_deadlock_summands.emplace_back(m_sum_variables, m_condition, m_deadlock);
107 mCRL2log(log::debug) << "adding deadlock summand\n" << m_deadlock_summands.back() << std::endl;
109 }
110 }
111
112 /// \brief Visit delta node
113 /// \return The result of visiting the node
114 /// \param x A process expression
115 void leave(const delta& /* x */)
116 {
118 m_deadlock_changed = true;
119 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
120 }
121
122 /// \brief Visit tau node
123 /// \return The result of visiting the node
124 /// \param x A process expression
125 void leave(const process::tau& /* x */)
126 {
129 mCRL2log(log::debug) << "adding multi action tau\n" << m_multi_action << std::endl;
130 }
131
132 /// \brief Visit action node
133 /// \return The result of visiting the node
134 /// \param x A process expression
135 /// \param l An action label
136 /// \param v A sequence of data expressions
137 void leave(const process::action& x)
138 {
142 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
143 }
144
145 /// \brief Visit sum node
146 /// \return The result of visiting the node
147 /// \param x A process expression
148 /// \param v A sequence of data variables
149 /// \param right A process expression
150 void leave(const process::sum& x)
151 {
152 m_sum_variables = m_sum_variables + x.variables();
153 mCRL2log(log::debug) << "adding sum variables\n" << data::pp(x.variables()) << std::endl;
154 }
155
156 /// \brief Visit block node
157 /// \return The result of visiting the node
158 /// \param x A process expression
159 /// \param s A sequence of identifiers
160 /// \param right A process expression
161 void leave(const process::block& x)
162 {
164 }
165
166 /// \brief Visit hide node
167 /// \return The result of visiting the node
168 /// \param x A process expression
169 /// \param s A sequence of identifiers
170 /// \param right A process expression
171 void leave(const process::hide& x)
172 {
174 }
175
176 /// \brief Visit rename node
177 /// \return The result of visiting the node
178 /// \param x A process expression
179 /// \param r A sequence of rename expressions
180 /// \param right A process expression
181 void leave(const process::rename& x)
182 {
184 }
185
186 /// \brief Visit comm node
187 /// \return The result of visiting the node
188 /// \param x A process expression
189 /// \param c A sequence of communication expressions
190 /// \param right A process expression
191 void leave(const process::comm& x)
192 {
194 }
195
196 /// \brief Visit allow node
197 /// \return The result of visiting the node
198 /// \param x A process expression
199 /// \param s A sequence of multi-action names
200 /// \param right A process expression
201 void leave(const process::allow& x)
202 {
204 }
205
206 /// \brief Visit sync node
207 /// \return The result of visiting the node
208 /// \param x A process expression
209 /// \param left A process expression
210 /// \param right A process expression
211 void apply(const process::sync& x)
212 {
213 apply(x.left());
215 apply(x.right());
217 m_multi_action = l + r;
219 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
220 }
221
222 /// \brief Visit at node
223 /// \return The result of visiting the node
224 /// \param x A process expression
225 /// \param left A process expression
226 /// \param d A data expression
227 void leave(const process::at& x)
228 {
229 if (is_delta(x))
230 {
232 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
233 }
234 else
235 {
237 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
238 }
239 }
240
241 /// \brief Visit seq node
242 /// \return The result of visiting the node
243 /// \param x A process expression
244 /// \param left A process expression
245 /// \param right A process expression
246 void apply(const process::seq& x)
247 {
248 apply(x.left());
249
250 // Check 1) The expression right must be a process instance or a process assignment
252 {
253 const process_instance& p = atermpp::down_cast<process_instance>(x.right());
254 // Check 2) The process equation and and the process instance must match
256 {
257 std::clog << "seq right hand side: " << process::pp(x.right()) << std::endl;
258 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
259 }
260 m_next_state = data::make_assignment_list(m_equation.formal_parameters(), p.actual_parameters());
262 }
264 {
265 const process_instance_assignment& p = atermpp::down_cast<process_instance_assignment>(x.right());
266 // Check 2) The process equation and and the process instance assignment must match
268 {
269 std::clog << "seq right hand side: " << process::pp(x.right()) << std::endl;
270 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
271 }
272 m_next_state = p.assignments(); // TODO: check if this is correct
274 }
275 else
276 {
277 std::clog << "seq right hand side: " << process::pp(x.right()) << std::endl;
278 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered with an unexpected right hand side");
279 }
280
281 mCRL2log(log::debug) << "adding next state\n" << data::pp(m_next_state) << std::endl;
282 }
283
284 /// \brief Visit if_then node
285 /// \return The result of visiting the node
286 /// \param x A process expression
287 /// \param d A data expression
288 /// \param right A process expression
289 void leave(const process::if_then& x)
290 {
292 mCRL2log(log::debug) << "adding condition\n" << data::pp(m_condition) << std::endl;
293 }
294
295 /// \brief Visit if_then_else node
296 /// \return The result of visiting the node
297 /// \param x A process expression
298 /// \param d A data expression
299 /// \param left A process expression
300 /// \param right A process expression
301 void leave(const process::if_then_else& x)
302 {
304 }
305
306 /// \brief Visit bounded_init node
307 /// \return The result of visiting the node
308 /// \param x A process expression
309 /// \param left A process expression
310 /// \param right A process expression
311 void leave(const process::bounded_init& x)
312 {
314 }
315
316 /// \brief Visit merge node
317 /// \return The result of visiting the node
318 /// \param x A process expression
319 /// \param left A process expression
320 /// \param right A process expression
321 void leave(const process::merge& x)
322 {
324 }
325
326 /// \brief Visit left_merge node
327 /// \return The result of visiting the node
328 /// \param x A process expression
329 /// \param left A process expression
330 /// \param right A process expression
331 void leave(const process::left_merge& x)
332 {
334 }
335
336 /// \brief Visit choice node
337 /// \return The result of visiting the node
338 /// \param x A process expression
339 /// \param left A process expression
340 /// \param right A process expression
341 void apply(const process::choice& x)
342 {
343 apply(x.left());
344 if (!is_choice(x.left()))
345 {
347 }
348 apply(x.right());
350 {
352 }
353 }
354
355 /// \brief Returns true if the process equation e is linear.
356 /// \param e A process equation
357 void convert(const process_equation& /* e */)
358 {
361 add_summand(); // needed if it is not a choice
362 }
363
364 /// \brief Converts a process_specification into a specification.
365 /// Throws \p non_linear_process if a non-linear sub-expression is encountered.
366 /// Throws \p mcrl2::runtime_error in the following cases:
367 /// \li The number of equations is not equal to one
368 /// \li The initial process is not a process instance, or it does not match with the equation
369 /// \li A sequential process is found with a right hand side that is not a process instance,
370 /// or it doesn't match the equation
371 /// \param p A process specification
372 /// \return The converted specification
374 {
375 m_action_summands.clear();
376 m_deadlock_summands.clear();
377
378 // Check 1) The number of equations must be one
379 if (p.equations().size() != 1)
380 {
381 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the number of process equations is not equal to 1!");
382 }
383 m_equation = p.equations().front();
384
385 lps::process_initializer proc_init;
386
388 {
389 const process_instance& init = atermpp::down_cast<process_instance>(p.init());
391 {
392 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the initial process does not match the process equation");
393 }
395 }
397 {
398 const process_instance_assignment& init = atermpp::down_cast<process_instance_assignment>(p.init());
400 {
401 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the initial process does not match the process equation");
402 }
403 proc_init = lps::process_initializer(data::right_hand_sides(init.assignments()));
404 }
405 else
406 {
407 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: the initial process has an unexpected value");
408 }
409
410 // Do the conversion
412
413 lps::linear_process proc(m_equation.formal_parameters(), m_deadlock_summands, m_action_summands);
414 return lps::specification(p.data(), p.action_labels(), p.global_variables(), proc, proc_init);
415 }
416};
417
418/// \brief Converts a process expression into linear process format.
419/// Use the \p convert member functions for this.
421{
423 using super::enter;
424 using super::leave;
425 using super::apply;
426
427 /// \brief The result of the conversion.
429
430 /// \brief The result of the conversion.
432
433 /// \brief The process equation that is checked.
435
436 /// \brief Contains intermediary results.
437 data::variable_list m_sum_variables;
438
439 /// \brief Contains intermediary results.
440 data::assignment_list m_next_state;
441
442 /// \brief Contains intermediary results.
444
445 /// \brief Contains intermediary results.
447
448 /// \brief Contains intermediary results.
450
451 /// \brief True if m_deadlock was changed.
452 bool m_deadlock_changed = false;
453
454 /// \brief True if m_multi_action was changed.
456
457 /// \brief True if m_next_state was changed.
459
460 /// \brief Contains intermediary results.
462
463 /// \brief Exception that is thrown to denote that the process is not linear.
465 {
467
469 : expr(p)
470 {}
471 };
472
473 /// \brief Clears the current summand
475 {
476 m_sum_variables = data::variable_list();
478 m_deadlock_changed = false;
483 m_next_state = data::assignment_list();
484 m_next_state_changed = false;
485 }
486
487 /// \brief Adds a summand to the result
489 {
491 {
493 {
494 m_action_summands.emplace_back(m_sum_variables, m_condition, m_multi_action, m_next_state, m_distribution);
495 mCRL2log(log::debug) << "adding action summand\n" << m_action_summands.back() << std::endl;
497 }
498 else
499 {
500 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: encountered a multi action without process reference");
501 }
502 }
503 else if (m_deadlock_changed)
504 {
505 m_deadlock_summands.emplace_back(m_sum_variables, m_condition, m_deadlock);
506 mCRL2log(log::debug) << "adding deadlock summand\n" << m_deadlock_summands.back() << std::endl;
508 }
509 }
510
511 /// \brief Visit delta node
512 /// \return The result of visiting the node
513 /// \param x A process expression
514 void leave(const delta& /* x */)
515 {
517 m_deadlock_changed = true;
518 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
519 }
520
521 /// \brief Visit tau node
522 /// \return The result of visiting the node
523 /// \param x A process expression
524 void leave(const process::tau& /* x */)
525 {
528 mCRL2log(log::debug) << "adding multi action tau\n" << m_multi_action << std::endl;
529 }
530
531 /// \brief Visit action node
532 /// \return The result of visiting the node
533 /// \param x A process expression
534 /// \param l An action label
535 /// \param v A sequence of data expressions
536 void leave(const process::action& x)
537 {
541 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
542 }
543
544 /// \brief Visit sum node
545 /// \return The result of visiting the node
546 /// \param x A process expression
547 /// \param v A sequence of data variables
548 /// \param right A process expression
549 void leave(const process::sum& x)
550 {
551 m_sum_variables = m_sum_variables + x.variables();
552 mCRL2log(log::debug) << "adding sum variables\n" << data::pp(x.variables()) << std::endl;
553 }
554
555 /// \brief Visit block node
556 /// \return The result of visiting the node
557 /// \param x A process expression
558 /// \param s A sequence of identifiers
559 /// \param right A process expression
560 void leave(const process::block& x)
561 {
563 }
564
565 /// \brief Visit hide node
566 /// \return The result of visiting the node
567 /// \param x A process expression
568 /// \param s A sequence of identifiers
569 /// \param right A process expression
570 void leave(const process::hide& x)
571 {
573 }
574
575 /// \brief Visit rename node
576 /// \return The result of visiting the node
577 /// \param x A process expression
578 /// \param r A sequence of rename expressions
579 /// \param right A process expression
580 void leave(const process::rename& x)
581 {
583 }
584
585 /// \brief Visit comm node
586 /// \return The result of visiting the node
587 /// \param x A process expression
588 /// \param c A sequence of communication expressions
589 /// \param right A process expression
590 void leave(const process::comm& x)
591 {
593 }
594
595 /// \brief Visit allow node
596 /// \return The result of visiting the node
597 /// \param x A process expression
598 /// \param s A sequence of multi-action names
599 /// \param right A process expression
600 void leave(const process::allow& x)
601 {
603 }
604
605 /// \brief Visit sync node
606 /// \return The result of visiting the node
607 /// \param x A process expression
608 /// \param left A process expression
609 /// \param right A process expression
610 void apply(const process::sync& x)
611 {
612 apply(x.left());
614 apply(x.right());
616 m_multi_action = l + r;
618 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
619 }
620
621 /// \brief Visit at node
622 /// \return The result of visiting the node
623 /// \param x A process expression
624 /// \param left A process expression
625 /// \param d A data expression
626 void leave(const process::at& x)
627 {
628 if (is_delta(x))
629 {
631 mCRL2log(log::debug) << "adding deadlock\n" << m_deadlock << std::endl;
632 }
633 else
634 {
636 mCRL2log(log::debug) << "adding multi action\n" << m_multi_action << std::endl;
637 }
638 }
639
640 /// \brief Visit seq node
641 /// \return The result of visiting the node
642 /// \param x A process expression
643 /// \param left A process expression
644 /// \param right A process expression
645 void apply(const process::seq& x)
646 {
647 apply(x.left());
648
651 {
652 auto const& op = atermpp::down_cast<stochastic_operator>(right);
653 m_distribution = lps::stochastic_distribution(op.variables(), op.distribution());
654 right = op.operand();
655 }
656
657 // Check 1) The expression right must be a process instance or a process assignment
658 if (is_process_instance(right))
659 {
660 const process_instance& p = atermpp::down_cast<process_instance>(right);
661 // Check 2) The process equation and and the process instance must match
663 {
664 std::clog << "seq right hand side: " << process::pp(right) << std::endl;
665 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
666 }
667 m_next_state = data::make_assignment_list(m_equation.formal_parameters(), p.actual_parameters());
669 }
671 {
672 const process_instance_assignment& p = atermpp::down_cast<process_instance_assignment>(right);
673 // Check 2) The process equation and and the process instance assignment must match
675 {
676 std::clog << "seq right hand side: " << process::pp(right) << std::endl;
677 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered that does not match the process equation");
678 }
679 m_next_state = p.assignments(); // TODO: check if this is correct
681 }
682 else
683 {
684 std::clog << "seq right hand side: " << process::pp(right) << std::endl;
685 throw mcrl2::runtime_error("Error in linear_process_conversion_traverser::convert: seq expression encountered with an unexpected right hand side");
686 }
687
688 mCRL2log(log::debug) << "adding next state\n" << data::pp(m_next_state) << std::endl;
689 }
690
691 /// \brief Visit if_then node
692 /// \return The result of visiting the node
693 /// \param x A process expression
694 /// \param d A data expression
695 /// \param right A process expression
696 void leave(const process::if_then& x)
697 {
699 mCRL2log(log::debug) << "adding condition\n" << data::pp(m_condition) << std::endl;
700 }
701
702 /// \brief Visit if_then_else node
703 /// \return The result of visiting the node
704 /// \param x A process expression
705 /// \param d A data expression
706 /// \param left A process expression
707 /// \param right A process expression
708 void leave(const process::if_then_else& x)
709 {
711 }
712
713 /// \brief Visit bounded_init node
714 /// \return The result of visiting the node
715 /// \param x A process expression
716 /// \param left A process expression
717 /// \param right A process expression
718 void leave(const process::bounded_init& x)
719 {
721 }
722
723 /// \brief Visit merge node
724 /// \return The result of visiting the node
725 /// \param x A process expression
726 void leave(const process::merge& x)
727 {
729 }
730
731 /// \brief Visit left_merge node
732 /// \return The result of visiting the node
733 /// \param x A process expression
734 void leave(const process::left_merge& x)
735 {
737 }
738
739 /// \brief Visit stochastic operator node
740 /// \param x A process expression
742 {
744 }
745
746 /// \brief Visit choice node
747 /// \return The result of visiting the node
748 /// \param x A process expression
749 void apply(const process::choice& x)
750 {
751 apply(x.left());
752 if (!is_choice(x.left()))
753 {
755 }
756 apply(x.right());
758 {
760 }
761 }
762
763 /// \brief Returns true if the process equation e is linear.
764 /// \param e A process equation
765 void convert(const process_equation& /* e */)
766 {
769 add_summand(); // needed if it is not a choice
770 }
771
772 /// \brief Converts a process_specification into a stochastic_specification.
773 /// Throws \p non_linear_process if a non-linear sub-expression is encountered.
774 /// Throws \p mcrl2::runtime_error in the following cases:
775 /// \li The number of equations is not equal to one
776 /// \li The initial process is not a process instance, or it does not match with the equation
777 /// \li A sequential process is found with a right hand side that is not a process instance,
778 /// or it doesn't match the equation
779 /// \param p A process specification
780 /// \return The converted specification
782 {
783 m_action_summands.clear();
784 m_deadlock_summands.clear();
785
786 // Check 1) The number of equations must be one
787 if (p.equations().size() != 1)
788 {
789 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the number of process equations is not equal to 1!");
790 }
791
792 m_equation = p.equations().front();
793
794 // convert the initial state
796 process_expression p_init = p.init();
799 {
800 auto const& s = atermpp::down_cast<stochastic_operator>(p.init());
801 dist = lps::stochastic_distribution(s.variables(), s.distribution());
802 p_init = s.operand();
803 }
804 if (is_process_instance(p_init))
805 {
806 const process_instance& init = atermpp::down_cast<process_instance>(p_init);
808 {
809 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the initial process does not match the process equation");
810 }
812 }
814 {
815 const process_instance_assignment& init = atermpp::down_cast<process_instance_assignment>(p_init);
817 {
818 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the initial process does not match the process equation");
819 }
820 proc_init = lps::stochastic_process_initializer(data::right_hand_sides(init.assignments()), dist);
821 }
822 else
823 {
824 throw mcrl2::runtime_error("Error in stochastic_linear_process_conversion_traverser::convert: the initial process has an unexpected value");
825 }
826
828
829 lps::stochastic_linear_process proc(m_equation.formal_parameters(), m_deadlock_summands, m_action_summands);
830
831 return lps::stochastic_specification(p.data(), p.action_labels(), p.global_variables(), proc, proc_init);
832 }
833};
834
835} // namespace mcrl2::process::detail
836
837#endif // MCRL2_LPS_DETAIL_LINEAR_PROCESS_CONVERSION_TRAVERSER_H
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
\brief A sort expression
\brief A data variable
Definition variable.h:25
const sort_expression & sort() const
Definition variable.h:40
action_rename_rule(const data::variable_list &variables, const data::data_expression &condition, const process::action &lhs, const process::process_expression &rhs)
Constructor.
Action rename specification.
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: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
\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
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 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
\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
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
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
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
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
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 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
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)
bool is_choice(const atermpp::aterm &x)
bool is_stochastic_operator(const atermpp::aterm &x)
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.
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-...