mCRL2
Loading...
Searching...
No Matches
typecheck.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//
11
12#ifndef MCRL2_MODAL_FORMULA_TYPECHECK_H
13#define MCRL2_MODAL_FORMULA_TYPECHECK_H
14
15#include "mcrl2/lps/typecheck.h"
19
20namespace mcrl2
21{
22
23namespace action_formulas
24{
25
26namespace detail
27{
28
29struct typecheck_builder: public action_formula_builder<typecheck_builder>
30{
32 using super::apply;
33
37
39 const data::detail::variable_context& variable_context,
40 const process::detail::action_context& action_context
41 )
42 : m_data_type_checker(data_typechecker),
43 m_variable_context(variable_context),
44 m_action_context(action_context)
45 {}
46
48 {
50 }
51
52 template <class T>
53 void apply(T& result, const data::data_expression& x)
54 {
56 }
57
58 template <class T>
59 void apply(T& result, const action_formulas::at& x)
60 {
62 make_at(result, [&](action_formula& r){ (*this).apply(r, x.operand()); }, new_time);
63 }
64
65 template <class T>
66 void apply(T& result, const process::untyped_multi_action& x)
67 {
68 // If x has size 1, first try to type check it as a data expression.
69 if (x.actions().size() == 1)
70 {
72 try
73 {
75 return;
76 }
77 catch (mcrl2::runtime_error& )
78 {
79 // skip
80 }
81 }
82 // Type check it as a multi action
83 process::action_list new_arguments;
84 for (const data::untyped_data_parameter& a: x.actions())
85 {
86 new_arguments.push_front(typecheck_action(a.name(), a.arguments()));
87 }
88 new_arguments = atermpp::reverse(new_arguments);
89 result = action_formulas::multi_action(new_arguments);
90 }
91
92 template <class T>
93 void apply(T& result, const action_formulas::forall& x)
94 {
95 try
96 {
97 auto m_variable_context_copy = m_variable_context;
99 action_formula body;
100 (*this).apply(body, x.body());
101 m_variable_context = m_variable_context_copy;
102 result = forall(x.variables(), body);
103 }
104 catch (mcrl2::runtime_error& e)
105 {
106 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + action_formulas::pp(x));
107 }
108 }
109
110 template <class T>
111 void apply(T& result, const action_formulas::exists& x)
112 {
113 try
114 {
115 auto m_variable_context_copy = m_variable_context;
117 action_formula body;
118 (*this).apply(body, x.body());
119 m_variable_context = m_variable_context_copy;
120 result = exists(x.variables(), body);
121 }
122 catch (mcrl2::runtime_error& e)
123 {
124 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + action_formulas::pp(x));
125 }
126 }
127};
128
129inline
131 data::data_type_checker& data_typechecker,
132 const data::detail::variable_context& variables,
134 )
135{
136 return typecheck_builder(data_typechecker, variables, actions);
137}
138
139} // namespace detail
140
141template <typename ActionLabelContainer = std::vector<state_formulas::variable>, typename VariableContainer = std::vector<data::variable> >
143 const data::data_specification& dataspec,
144 const VariableContainer& variables,
145 const ActionLabelContainer& actions
146 )
147{
148 data::data_type_checker data_typechecker(dataspec);
149 data::detail::variable_context variable_context;
150 variable_context.add_context_variables(variables, data_typechecker);
151 process::detail::action_context action_context;
152 action_context.add_context_action_labels(actions, data_typechecker);
153 action_formula result;
154 detail::make_typecheck_builder(data_typechecker, variable_context, action_context).
155 apply(result, action_formulas::normalize_sorts(x, data_typechecker.typechecked_data_specification()));
156 return result;
157}
158
159inline
161{
162 return typecheck_action_formula(x, lpsspec.data(), lpsspec.global_variables(), lpsspec.action_labels());
163}
164
165} // namespace action_formulas
166
167namespace regular_formulas
168{
169
170namespace detail
171{
172
173struct typecheck_builder: public regular_formula_builder<typecheck_builder>
174{
176 using super::apply;
177
181
183 const data::detail::variable_context& variables,
185 )
186 : m_data_type_checker(data_typechecker),
187 m_variable_context(variables),
188 m_action_context(actions)
189 {}
190
192 {
193 const data::sort_expression& s = atermpp::down_cast<data::application>(left).head().sort();
194 const data::container_sort& cs = atermpp::down_cast<data::container_sort>(s);
195 return data::sort_fbag::union_(cs.element_sort(), left, right);
196 }
197
199 {
200 const data::sort_expression& s = atermpp::down_cast<data::application>(left).head().sort();
201 const data::container_sort& cs = atermpp::down_cast<data::container_sort>(s);
202 return data::sort_bag::union_(cs.element_sort(), left, right);
203 }
204
206 {
207 const data::sort_expression& s = atermpp::down_cast<data::application>(left).head().sort();
208 const data::container_sort& cs = atermpp::down_cast<data::container_sort>(s);
209 return data::sort_fset::union_(cs.element_sort(), left, right);
210 }
211
213 {
214 const data::sort_expression& s = atermpp::down_cast<data::application>(left).head().sort();
215 const data::container_sort& cs = atermpp::down_cast<data::container_sort>(s);
216 return data::sort_set::union_(cs.element_sort(), left, right);
217 }
218
220 {
222 {
223 return data::sort_real::plus(left, right);
224 }
225 else if (data::sort_int::is_int(left.sort()) || data::sort_int::is_int(right.sort()))
226 {
227 return data::sort_int::plus(left, right);
228 }
229 else if (data::sort_nat::is_nat(left.sort()) || data::sort_nat::is_nat(right.sort()))
230 {
231 return data::sort_nat::plus(left, right);
232 }
233 else if (data::sort_pos::is_pos(left.sort()) || data::sort_pos::is_pos(right.sort()))
234 {
235 return data::sort_pos::plus(left, right);
236 }
238 {
239 return make_bag_union(left, right);
240 }
242 {
243 return make_fbag_union(left, right);
244 }
246 {
247 return make_set_union(left, right);
248 }
250 {
251 return make_fset_union(left, right);
252 }
253 throw mcrl2::runtime_error("could not typecheck " + data::pp(left) + " + " + data::pp(right));
254 }
255
257 {
258 const data::sort_expression& s = atermpp::down_cast<data::application>(left).head().sort();
259 const data::container_sort& cs = atermpp::down_cast<data::container_sort>(s);
260 return data::sort_list::element_at(cs.element_sort(), left, right);
261 }
262
263 template <class T>
265 {
266 regular_formula left;
267 (*this).apply(left, x.left());
268 regular_formula right;
269 (*this).apply(right, x.right());
271 {
272 if (x.name() == core::identifier_string("."))
273 {
274 result = make_element_at(atermpp::down_cast<data::data_expression>(left), atermpp::down_cast<data::data_expression>(right));
275 }
276 else
277 {
278 result = make_plus(atermpp::down_cast<data::data_expression>(left), atermpp::down_cast<data::data_expression>(right));
279 }
280 }
281 else
282 {
283 if (x.name() == core::identifier_string("."))
284 {
285 result = seq(left, right);
286 }
287 else
288 {
289 result = alt(left, right);
290 }
291 }
292 }
293
294 /* Has to be a regular formula as result.... */
295 // template <class T>A
297 {
299 }
300};
301
302inline
304 data::data_type_checker& data_typechecker,
305 const data::detail::variable_context& variables,
307 )
308{
309 return typecheck_builder(data_typechecker, variables, actions);
310}
311
312} // namespace detail
313
314template <typename ActionLabelContainer = std::vector<state_formulas::variable>, typename VariableContainer = std::vector<data::variable> >
316 const data::data_specification& dataspec,
317 const VariableContainer& variables,
318 const ActionLabelContainer& actions
319 )
320{
321 data::data_type_checker data_typechecker(dataspec);
322 data::detail::variable_context variable_context;
323 variable_context.add_context_variables(variables, data_typechecker);
324 process::detail::action_context action_context;
325 action_context.add_context_action_labels(actions, data_typechecker);
326 regular_formula result;
327 detail::make_typecheck_builder(data_typechecker, variable_context, action_context).
328 apply(result, regular_formulas::normalize_sorts(x, data_typechecker.typechecked_data_specification()));
329 return result;
330}
331
332inline
334{
335 return typecheck_regular_formula(x, lpsspec.data(), lpsspec.global_variables(), lpsspec.action_labels());
336}
337
338} // namespace regular_formulas
339
340namespace state_formulas
341{
342
343namespace detail
344{
345
346struct typecheck_builder: public state_formula_builder<typecheck_builder>
347{
349 using super::apply;
350
355 const bool m_formula_is_quantitative; // If true, allow real values, otherwise restrict to a boolean formula.
356
358 const data::detail::variable_context& variable_context,
359 const process::detail::action_context& action_context,
361 const bool formula_is_quantitative
362 )
363 : m_data_type_checker(data_typechecker),
364 m_variable_context(variable_context),
365 m_action_context(action_context),
367 m_formula_is_quantitative(formula_is_quantitative)
368 {}
369
370 template <class T>
371 void apply(T& result, const data::data_expression& x)
372 {
374 {
375 try
376 {
378 }
379 catch (mcrl2::runtime_error& e1)
380 {
381 try
382 {
384 }
385 catch (mcrl2::runtime_error& e2)
386 {
387 throw mcrl2::runtime_error("Fail to type data expression as bool or real: " + pp(x) + ".\n" +
388 e1.what() + "\n" +
389 e2.what());
390 }
391 }
392 }
393 else
394 {
396 }
397 }
398
399 template <class T>
400 void apply(T& result, const state_formulas::forall& x)
401 {
403 {
404 throw mcrl2::runtime_error("Forall is not allowed to capture values in a quantitative modal formula " + state_formulas::pp(x) + ". Use inf for infimum instead. ");
405 }
406 else
407 {
408 try
409 {
410 auto m_variable_context_copy = m_variable_context;
412 state_formula body;
413 (*this).apply(body, x.body());
414 m_variable_context = m_variable_context_copy;
415 result = forall(x.variables(), body);
416 }
417 catch (mcrl2::runtime_error& e)
418 {
419 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + state_formulas::pp(x));
420 }
421 }
422 }
423
424 template <class T>
425 void apply(T& result, const state_formulas::exists& x)
426 {
428 {
429 throw mcrl2::runtime_error("Exists is not allowed to capture values in a quantitative modal formula " + state_formulas::pp(x) + ". Use sup for supremum instead. ");
430 }
431 else
432 {
433 try
434 {
435 auto m_variable_context_copy = m_variable_context;
437 state_formula body;
438 (*this).apply(body, x.body());
439 m_variable_context = m_variable_context_copy;
440 result = exists(x.variables(), body);
441 }
442 catch (mcrl2::runtime_error& e)
443 {
444 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + state_formulas::pp(x));
445 }
446 }
447 }
448
449 template <class T>
450 void apply(T& result, const state_formulas::infimum& x)
451 {
453 {
454 throw mcrl2::runtime_error("Infimum is not allowed in an ordinary, non quantitative modal formula " + state_formulas::pp(x) + ". Use forall instead. ");
455 }
456 else
457 {
458 try
459 {
460 auto m_variable_context_copy = m_variable_context;
462 state_formula body;
463 (*this).apply(body, x.body());
464 m_variable_context = m_variable_context_copy;
465 result = infimum(x.variables(), body);
466 }
467 catch (mcrl2::runtime_error& e)
468 {
469 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + state_formulas::pp(x));
470 }
471 }
472 }
473
474 template <class T>
475 void apply(T& result, const state_formulas::supremum& x)
476 {
478 {
479 throw mcrl2::runtime_error("Supremum is not allowed in an ordinary, non quantitative modal formula " + state_formulas::pp(x) + ". Use exists instead. ");
480 }
481 else
482 {
483 try
484 {
485 auto m_variable_context_copy = m_variable_context;
487 state_formula body;
488 (*this).apply(body, x.body());
489 m_variable_context = m_variable_context_copy;
490 result = supremum(x.variables(), body);
491 }
492 catch (mcrl2::runtime_error& e)
493 {
494 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + state_formulas::pp(x));
495 }
496 }
497 }
498
499 template <class T>
500 void apply(T& result, const state_formulas::sum& x)
501 {
503 {
504 throw mcrl2::runtime_error("Sum is not allowed in an ordinary, non quantitative modal formula " + state_formulas::pp(x) + ". ");
505 }
506 else
507 {
508 try
509 {
510 auto m_variable_context_copy = m_variable_context;
512 state_formula body;
513 (*this).apply(body, x.body());
514 m_variable_context = m_variable_context_copy;
515 result = sum(x.variables(), body);
516 }
517 catch (mcrl2::runtime_error& e)
518 {
519 throw mcrl2::runtime_error(std::string(e.what()) + "\nwhile typechecking " + state_formulas::pp(x));
520 }
521 }
522 }
523
524 template <class T>
525 void apply(T& result, const state_formulas::may& x)
526 {
529 state_formula operand;
530 (*this).apply(operand, x.operand());
531 make_may(result, formula, operand);
532 }
533
534 template <class T>
535 void apply(T& result, const state_formulas::must& x)
536 {
539 state_formula operand;
540 (*this).apply(operand, x.operand());
541 make_must(result, formula, operand);
542 }
543
544 template <class T>
545 void apply(T& result, const state_formulas::delay_timed& x)
546 {
548 make_delay_timed(result, new_time);
549 }
550
551 template <class T>
552 void apply(T& result, const state_formulas::yaled_timed& x)
553 {
555 make_yaled_timed(result, new_time);
556 }
557
559 {
561 data::data_expression_list new_arguments;
562 auto q1 = expected_sorts.begin();
563 auto q2 = arguments.begin();
564 for (; q1 != expected_sorts.end(); ++q1, ++q2)
565 {
567 }
568 new_arguments = atermpp::reverse(new_arguments);
569 return state_formulas::variable(name, new_arguments);
570 }
571
572 template <class T>
573 void apply(T& result, const state_formulas::variable& x)
574 {
575 result = apply_untyped_parameter(x.name(), x.arguments());
576 }
577
578 template <class T>
579 void apply(T& result, const data::untyped_data_parameter& x)
580 {
581 result = apply_untyped_parameter(x.name(), x.arguments());
582 }
583
585 {
586 std::vector<data::variable> result;
587 for (const data::assignment& a: x)
588 {
589 result.push_back(a.lhs());
590 }
591 return data::variable_list(result.begin(), result.end());
592 }
593
594 template <typename MuNuFormula>
595 state_formula apply_mu_nu(const MuNuFormula& x, bool is_mu)
596 {
598
599 // add the assignment variables to the context
600 auto m_variable_context_copy = m_variable_context;
601 data::variable_list x_variables = assignment_variables(x.assignments());
603
604 // add x to the state variable context
605 auto m_state_variable_context_copy = m_state_variable_context;
607
608 // typecheck the operand
609 state_formula new_operand;
610 (*this).apply(new_operand, x.operand());
611
612 // restore the context
613 m_variable_context = m_variable_context_copy;
614 m_state_variable_context = m_state_variable_context_copy;
615
616 if (is_mu)
617 {
618 return mu(x.name(), new_assignments, new_operand);
619 }
620 else
621 {
622 return nu(x.name(), new_assignments, new_operand);
623 }
624 }
625
626 template <class T>
627 void apply(T& result, const state_formulas::nu& x)
628 {
629 result = apply_mu_nu(x, false);
630 }
631
632 template <class T>
633 void apply(T& result, const state_formulas::mu& x)
634 {
635 result = apply_mu_nu(x, true);
636 }
637
638 template <class T>
639 void apply(T& result, const state_formulas::not_& x)
640 {
642 {
643 throw mcrl2::runtime_error("No ! allowed in a quantitative modal formula " + state_formulas::pp(x) + ".");
644 }
645 else
646 {
647 apply(result, static_cast<not_>(x).operand());
648 make_not_(result, result);
649 }
650 }
651
652 template <class T>
653 void apply(T& result, const state_formulas::minus& x)
654 {
656 {
657 throw mcrl2::runtime_error("No unary minus (-) allowed in a boolean modal formula " + state_formulas::pp(x) + ".");
658 }
659 else
660 {
661 apply(result, static_cast<minus>(x).operand());
662 make_minus(result, result);
663 }
664 }
665
666 template <class T>
667 void apply(T& result, const state_formulas::plus& x)
668 {
670 {
671 throw mcrl2::runtime_error("No addition (+) allowed in a boolean modal formula " + state_formulas::pp(x) + ".");
672 }
673 else
674 {
675 apply(result, static_cast<plus>(x).left());
676 state_formula rhs;
677 apply(rhs, static_cast<plus>(x).right());
678 make_plus(result, result, rhs);
679 }
680 }
681
682 template <class T>
683 void apply(T& result, const state_formulas::const_multiply& x)
684 {
686 {
687 throw mcrl2::runtime_error("No multiplication with a constant allowed in a boolean modal formula " + state_formulas::pp(x) + ".");
688 }
689 else
690 {
692 state_formula rhs;
693 apply(rhs, static_cast<const_multiply>(x).right());
694 make_const_multiply(result, constant, rhs);
695 }
696 }
697
698 template <class T>
700 {
702 {
703 throw mcrl2::runtime_error("No multiplication with a constant allowed in a boolean modal formula " + state_formulas::pp(x) + ".");
704 }
705 else
706 {
707 state_formula lhs;
708 apply(lhs, static_cast<const_multiply_alt>(x).left());
710 make_const_multiply_alt(result, lhs, constant);
711 }
712 }
713};
714
715inline
717 data::data_type_checker& data_typechecker,
718 const data::detail::variable_context& variable_context,
719 const process::detail::action_context& action_context,
721 const bool formula_is_quantitative
722 )
723{
724 return typecheck_builder(data_typechecker, variable_context, action_context, state_variable_context, formula_is_quantitative);
725}
726
727} // namespace detail
728
730{
731 protected:
737
738 public:
744 template <typename ActionLabelContainer = std::vector<state_formulas::variable>, typename VariableContainer = std::vector<data::variable> >
746 const bool formula_is_quantitative,
747 const ActionLabelContainer& action_labels = ActionLabelContainer(),
748 const VariableContainer& variables = VariableContainer()
749 )
750 : m_data_type_checker(dataspec),
751 m_formula_is_quantitative(formula_is_quantitative)
752 {
755 }
756
757 //check correctness of the state formula as follows:
758 //1) determine the types of actions according to the definitions
759 // in spec
760 //2) determine the types of data expressions according to the
761 // definitions in spec
762 //3) check for name conflicts of data variable declarations in
763 // forall, exists, mu and nu quantifiers
764 //4) check for monotonicity of fixpoint variables
766 {
767 mCRL2log(log::verbose) << "type checking state formula..." << std::endl;
768 state_formula result;
771 return result;
772 }
773};
774
783template <typename VariableContainer, typename ActionLabelContainer>
785 const bool formula_is_quantitative,
787 const ActionLabelContainer& action_labels = ActionLabelContainer(),
788 const VariableContainer& variables = VariableContainer()
789 )
790{
791 try
792 {
793 state_formula_type_checker type_checker(dataspec, formula_is_quantitative, action_labels, variables);
794 return type_checker.typecheck_state_formula(x);
795 }
796 catch (mcrl2::runtime_error& e)
797 {
798 throw mcrl2::runtime_error(std::string(e.what()) + "\ncould not type check modal formula " + state_formulas::pp(x));
799 }
800}
801
809inline
811 const lps::stochastic_specification& lpsspec,
812 const bool formula_is_quantitative
813 )
814{
815 return typecheck_state_formula(x, formula_is_quantitative, lpsspec.data(), lpsspec.action_labels(), lpsspec.global_variables());
816}
817
820inline
821void typecheck_state_formula_specification(state_formula_specification& formspec, const bool formula_is_quantitative)
822{
823 try
824 {
825 data::data_type_checker checker(formspec.data());
827 state_formulas::normalize_sorts(formspec, dataspec);
828 state_formula_type_checker type_checker(dataspec, formula_is_quantitative, formspec.action_labels(), std::vector<data::variable>());
829 formspec.formula() = type_checker.typecheck_state_formula(formspec.formula());
830 formspec.data() = checker.typechecked_data_specification();
831 formspec.data().translate_user_notation();
832 }
833 catch (mcrl2::runtime_error& e)
834 {
835 throw mcrl2::runtime_error(std::string(e.what()) + "\ncould not type check modal formula specification " + state_formulas::pp(formspec));
836 }
837}
838
841inline
842void typecheck_state_formula_specification(state_formula_specification& formspec, const lps::stochastic_specification& lpsspec, const bool formula_is_quantitative)
843{
844 try
845 {
846 data::data_type_checker checker(formspec.data());
848 state_formulas::normalize_sorts(formspec, dataspec);
849 state_formula_type_checker type_checker(dataspec, formula_is_quantitative, lpsspec.action_labels() + formspec.action_labels(), lpsspec.global_variables());
850 formspec.formula() = type_checker.typecheck_state_formula(formspec.formula());
851 formspec.data() = checker.typechecked_data_specification();
852 formspec.data().translate_user_notation();
853 }
854 catch (mcrl2::runtime_error& e)
855 {
856 throw mcrl2::runtime_error(std::string(e.what()) + "\ncould not type check modal formula specification " + state_formulas::pp(formspec));
857 }
858}
859
860} // namespace state_formulas
861
862} // namespace mcrl2
863
864#endif // MCRL2_MODAL_FORMULA_TYPECHECK_H
Term containing a string.
size_type size() const
Returns the size of the term_list.
Definition aterm_list.h:256
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
Definition aterm_list.h:282
const Term & front() const
Returns the first element of the list.
Definition aterm_list.h:239
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
Definition aterm_list.h:275
void push_front(const Term &el)
Inserts a new element at the beginning of the current list.
\brief The at operator for action formulas
const data::data_expression & time_stamp() const
const action_formula & operand() const
\brief The existential quantification operator for action formulas
const data::variable_list & variables() const
const action_formula & body() const
\brief The universal quantification operator for action formulas
const action_formula & body() const
const data::variable_list & variables() const
\brief The multi action for action formulas
\brief Assignment of a data expression to a variable
Definition assignment.h:91
\brief A container sort
const sort_expression & element_sort() const
sort_expression sort() const
Returns the sort of the data expression.
Definition data.cpp:108
void translate_user_notation()
Translate user notation within the equations of the data specification.
assignment_list typecheck_assignment_list(const assignment_list &assignments, const detail::variable_context &variable_context)
Definition typecheck.h:97
data_expression typecheck_data_expression(const data_expression &x, const sort_expression &expected_sort, const detail::variable_context &variable_context)
Definition typecheck.h:75
const data_specification & typechecked_data_specification() const
Definition typecheck.h:120
void add_context_variables(const VariableContainer &variables)
\brief A sort expression
const core::identifier_string & name() const
const data_expression_list & arguments() const
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the LPS.
const process::action_label_list & action_labels() const
Returns a sequence of action labels. This sequence contains all action labels occurring in the specif...
const data::data_specification & data() const
Returns the data specification.
void add_context_action_labels(const ActionLabelContainer &actions, const data::sort_type_checker &sort_typechecker)
\brief An untyped multi action or data application
const data::untyped_data_parameter_list & actions() const
\brief The alt operator for regular formulas
\brief The seq operator for regular formulas
\brief An untyped regular formula or action formula
const core::identifier_string & name() const
Standard exception class for reporting runtime errors.
Definition exception.h:27
\brief The multiply operator for state formulas with values
\brief The multiply operator for state formulas with values
\brief The timed delay operator for state formulas
const data::data_expression & time_stamp() const
data::sort_expression_list matching_state_variable_sorts(const core::identifier_string &name, const data::data_expression_list &arguments) const
void add_state_variable(const core::identifier_string &name, const data::variable_list &parameters, const data::sort_type_checker &sort_typechecker)
\brief The existential quantification operator for state formulas
const state_formula & body() const
const data::variable_list & variables() const
\brief The universal quantification operator for state formulas
const state_formula & body() const
const data::variable_list & variables() const
\brief The infimum over a data type for state formulas
const data::variable_list & variables() const
const state_formula & body() const
\brief The may operator for state formulas
const state_formula & operand() const
const regular_formulas::regular_formula & formula() const
\brief The minus operator for state formulas
\brief The mu operator for state formulas
\brief The must operator for state formulas
const regular_formulas::regular_formula & formula() const
const state_formula & operand() const
\brief The not operator for state formulas
\brief The nu operator for state formulas
\brief The plus operator for state formulas with values
const state_formula & formula() const
Returns the formula of the state formula specification.
const data::data_specification & data() const
Returns the data specification.
const process::action_label_list & action_labels() const
Returns the action label specification.
detail::state_variable_context m_state_variable_context
Definition typecheck.h:735
data::detail::variable_context m_variable_context
Definition typecheck.h:733
process::detail::action_context m_action_context
Definition typecheck.h:734
state_formula_type_checker(const data::data_specification &dataspec, const bool formula_is_quantitative, const ActionLabelContainer &action_labels=ActionLabelContainer(), const VariableContainer &variables=VariableContainer())
Constructor for a state_formula type checker.
Definition typecheck.h:745
state_formula typecheck_state_formula(const state_formula &x)
Definition typecheck.h:765
\brief The sum over a data type for state formulas
const data::variable_list & variables() const
const state_formula & body() const
\brief The supremum over a data type for state formulas
const state_formula & body() const
const data::variable_list & variables() const
\brief The state formula variable
const core::identifier_string & name() const
const data::data_expression_list & arguments() const
\brief The timed yaled operator for state formulas
const data::data_expression & time_stamp() const
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
add your file description here.
add your file description here.
add your file description here.
term_list< Term > reverse(const term_list< Term > &l)
Returns the list with the elements in reversed order.
typecheck_builder make_typecheck_builder(data::data_type_checker &data_typechecker, const data::detail::variable_context &variables, const process::detail::action_context &actions)
Definition typecheck.h:130
void normalize_sorts(T &x, const data::sort_specification &sortspec, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
action_formula typecheck_action_formula(const action_formula &x, const data::data_specification &dataspec, const VariableContainer &variables, const ActionLabelContainer &actions)
Definition typecheck.h:142
std::string pp(const action_formula &x)
void make_at(atermpp::aterm &t, const ARGUMENTS &... args)
bool is_union_application(const atermpp::aterm &e)
Recogniser for application of +.
Definition bag1.h:495
function_symbol union_(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
Definition bag1.h:426
const basic_sort & bool_()
Constructor for sort expression Bool.
Definition bool.h:44
bool is_union_application(const atermpp::aterm &e)
Recogniser for application of +.
Definition fbag1.h:579
function_symbol union_(const sort_expression &s)
Constructor for function symbol +.
Definition fbag1.h:533
function_symbol union_(const sort_expression &s)
Constructor for function symbol +.
Definition fset1.h:465
bool is_union_application(const atermpp::aterm &e)
Recogniser for application of +.
Definition fset1.h:511
bool is_int(const sort_expression &e)
Recogniser for sort expression Int.
Definition int1.h:57
function_symbol plus(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:950
function_symbol element_at(const sort_expression &s)
Constructor for function symbol ..
Definition list1.h:462
bool is_nat(const sort_expression &e)
Recogniser for sort expression Nat.
Definition nat1.h:56
function_symbol plus(const sort_expression &s0, const sort_expression &s1)
Definition nat1.h:834
bool is_pos(const sort_expression &e)
Recogniser for sort expression Pos.
Definition pos1.h:55
const function_symbol & plus()
Constructor for function symbol +.
Definition pos1.h:458
function_symbol plus(const sort_expression &s0, const sort_expression &s1)
Definition real1.h:1059
const basic_sort & real_()
Constructor for sort expression Real.
Definition real1.h:48
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
Definition real1.h:58
bool is_union_application(const atermpp::aterm &e)
Recogniser for application of +.
Definition set1.h:483
function_symbol union_(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
Definition set1.h:422
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
std::string pp(const abstraction &x)
Definition data.cpp:39
data_expression typecheck_untyped_data_parameter(data_type_checker &typechecker, const core::identifier_string &name, const data_expression_list &parameters, const data::sort_expression &expected_sort, const detail::variable_context &variable_context)
Definition typecheck.h:352
atermpp::term_list< variable > variable_list
\brief list of variables
@ verbose
Definition logger.h:37
action typecheck_action(const core::identifier_string &name, const data::data_expression_list &parameters, data::data_type_checker &typechecker, const data::detail::variable_context &variable_context, const detail::action_context &action_context)
Definition typecheck.h:28
typecheck_builder make_typecheck_builder(data::data_type_checker &data_typechecker, const data::detail::variable_context &variables, const process::detail::action_context &actions)
Definition typecheck.h:303
void normalize_sorts(T &x, const data::sort_specification &sortspec, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
regular_formula typecheck_regular_formula(const regular_formula &x, const data::data_specification &dataspec, const VariableContainer &variables, const ActionLabelContainer &actions)
Definition typecheck.h:315
typecheck_builder make_typecheck_builder(data::data_type_checker &data_typechecker, const data::detail::variable_context &variable_context, const process::detail::action_context &action_context, const detail::state_variable_context &state_variable_context, const bool formula_is_quantitative)
Definition typecheck.h:716
void normalize_sorts(T &x, const data::sort_specification &sortspec, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
void make_const_multiply(atermpp::aterm &t, const ARGUMENTS &... args)
void make_plus(atermpp::aterm &t, const ARGUMENTS &... args)
void make_not_(atermpp::aterm &t, const ARGUMENTS &... args)
void make_delay_timed(atermpp::aterm &t, const ARGUMENTS &... args)
void make_const_multiply_alt(atermpp::aterm &t, const ARGUMENTS &... args)
void pp(const T &t, std::ostream &out)
Prints the object t to a stream.
Definition print.h:668
void make_may(atermpp::aterm &t, const ARGUMENTS &... args)
void make_must(atermpp::aterm &t, const ARGUMENTS &... args)
void typecheck_state_formula_specification(state_formula_specification &formspec, const bool formula_is_quantitative)
Typecheck the state formula specification formspec. It is assumed that the formula is self contained,...
Definition typecheck.h:821
state_formula typecheck_state_formula(const state_formula &x, const bool formula_is_quantitative, const data::data_specification &dataspec=data::data_specification(), const ActionLabelContainer &action_labels=ActionLabelContainer(), const VariableContainer &variables=VariableContainer())
Type check a state formula. Throws an exception if something went wrong.
Definition typecheck.h:784
bool is_mu(const atermpp::aterm &x)
void make_minus(atermpp::aterm &t, const ARGUMENTS &... args)
void make_yaled_timed(atermpp::aterm &t, const ARGUMENTS &... args)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
add your file description here.
void apply(T &result, const action_formulas::true_ &x)
Definition builder.h:571
void apply(T &result, const process::untyped_multi_action &x)
Definition typecheck.h:66
typecheck_builder(data::data_type_checker &data_typechecker, const data::detail::variable_context &variable_context, const process::detail::action_context &action_context)
Definition typecheck.h:38
process::action typecheck_action(const core::identifier_string &name, const data::data_expression_list &parameters)
Definition typecheck.h:47
data::data_type_checker & m_data_type_checker
Definition typecheck.h:34
data::detail::variable_context m_variable_context
Definition typecheck.h:35
void apply(T &result, const action_formulas::exists &x)
Definition typecheck.h:111
const process::detail::action_context & m_action_context
Definition typecheck.h:36
action_formula_builder< typecheck_builder > super
Definition typecheck.h:31
void apply(T &result, const action_formulas::at &x)
Definition typecheck.h:59
void apply(T &result, const data::data_expression &x)
Definition typecheck.h:53
void apply(T &result, const action_formulas::forall &x)
Definition typecheck.h:93
void apply(T &result, const regular_formulas::seq &x)
Definition builder.h:1079
const data::detail::variable_context & m_variable_context
Definition typecheck.h:179
data::data_expression make_element_at(const data::data_expression &left, const data::data_expression &right) const
Definition typecheck.h:256
void apply(regular_formula &result, const action_formulas::action_formula &x)
Definition typecheck.h:296
data::data_expression make_plus(const data::data_expression &left, const data::data_expression &right)
Definition typecheck.h:219
void apply(T &result, const regular_formulas::untyped_regular_formula &x)
Definition typecheck.h:264
regular_formula_builder< typecheck_builder > super
Definition typecheck.h:175
typecheck_builder(data::data_type_checker &data_typechecker, const data::detail::variable_context &variables, const process::detail::action_context &actions)
Definition typecheck.h:182
data::data_expression make_fset_union(const data::data_expression &left, const data::data_expression &right)
Definition typecheck.h:205
data::data_expression make_set_union(const data::data_expression &left, const data::data_expression &right)
Definition typecheck.h:212
data::data_expression make_fbag_union(const data::data_expression &left, const data::data_expression &right)
Definition typecheck.h:191
data::data_expression make_bag_union(const data::data_expression &left, const data::data_expression &right)
Definition typecheck.h:198
const process::detail::action_context & m_action_context
Definition typecheck.h:180
void apply(T &result, const state_formulas::true_ &x)
Definition builder.h:2297
state_formula apply_untyped_parameter(const core::identifier_string &name, const data::data_expression_list &arguments)
Definition typecheck.h:558
void apply(T &result, const state_formulas::mu &x)
Definition typecheck.h:633
void apply(T &result, const state_formulas::exists &x)
Definition typecheck.h:425
void apply(T &result, const state_formulas::const_multiply_alt &x)
Definition typecheck.h:699
state_formula apply_mu_nu(const MuNuFormula &x, bool is_mu)
Definition typecheck.h:595
void apply(T &result, const state_formulas::must &x)
Definition typecheck.h:535
void apply(T &result, const state_formulas::delay_timed &x)
Definition typecheck.h:545
void apply(T &result, const state_formulas::not_ &x)
Definition typecheck.h:639
void apply(T &result, const state_formulas::infimum &x)
Definition typecheck.h:450
const process::detail::action_context & m_action_context
Definition typecheck.h:353
void apply(T &result, const state_formulas::forall &x)
Definition typecheck.h:400
void apply(T &result, const state_formulas::supremum &x)
Definition typecheck.h:475
void apply(T &result, const data::untyped_data_parameter &x)
Definition typecheck.h:579
state_formula_builder< typecheck_builder > super
Definition typecheck.h:348
typecheck_builder(data::data_type_checker &data_typechecker, const data::detail::variable_context &variable_context, const process::detail::action_context &action_context, const detail::state_variable_context &state_variable_context, const bool formula_is_quantitative)
Definition typecheck.h:357
void apply(T &result, const state_formulas::may &x)
Definition typecheck.h:525
data::detail::variable_context m_variable_context
Definition typecheck.h:352
void apply(T &result, const state_formulas::const_multiply &x)
Definition typecheck.h:683
void apply(T &result, const state_formulas::plus &x)
Definition typecheck.h:667
void apply(T &result, const state_formulas::sum &x)
Definition typecheck.h:500
void apply(T &result, const state_formulas::nu &x)
Definition typecheck.h:627
void apply(T &result, const state_formulas::variable &x)
Definition typecheck.h:573
void apply(T &result, const state_formulas::yaled_timed &x)
Definition typecheck.h:552
data::data_type_checker & m_data_type_checker
Definition typecheck.h:351
void apply(T &result, const state_formulas::minus &x)
Definition typecheck.h:653
void apply(T &result, const data::data_expression &x)
Definition typecheck.h:371
detail::state_variable_context m_state_variable_context
Definition typecheck.h:354
data::variable_list assignment_variables(const data::assignment_list &x) const
Definition typecheck.h:584