mCRL2
Loading...
Searching...
No Matches
int64.h
Go to the documentation of this file.
1// Author(s): Jeroen Keiren
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/data/int.h
10/// \brief The standard sort int_.
11///
12/// This file was generated from the data sort specification
13/// mcrl2/data/build/int.spec.
14
15#ifndef MCRL2_DATA_INT64_H
16#define MCRL2_DATA_INT64_H
17
18#include "functional" // std::function
19#include "mcrl2/utilities/exception.h"
20#include "mcrl2/data/basic_sort.h"
21#include "mcrl2/data/function_sort.h"
22#include "mcrl2/data/function_symbol.h"
23#include "mcrl2/data/application.h"
24#include "mcrl2/data/data_equation.h"
25#include "mcrl2/data/standard.h"
26#include "mcrl2/data/bool.h"
27#include "mcrl2/data/pos64.h"
28#include "mcrl2/data/nat64.h"
29
30/// \brief Namespace for system defined sort int_.
31namespace mcrl2::data::sort_int
32{
33
34 inline
35 const core::identifier_string& int_name()
36 {
37 static core::identifier_string int_name = core::identifier_string("Int");
38 return int_name;
39 }
40
41 /// \brief Constructor for sort expression Int.
42 /// \return Sort expression Int.
43 inline
44 const basic_sort& int_()
45 {
47 return int_;
48 }
49
50 /// \brief Recogniser for sort expression Int
51 /// \param e A sort expression
52 /// \return true iff e == int_()
53 inline
54 bool is_int(const sort_expression& e)
55 {
56 if (is_basic_sort(e))
57 {
58 return basic_sort(e) == int_();
59 }
60 return false;
61 }
62
63
64 /// \brief Generate identifier \@cInt.
65 /// \return Identifier \@cInt.
66 inline
67 const core::identifier_string& cint_name()
68 {
69 static core::identifier_string cint_name = core::identifier_string("@cInt");
70 return cint_name;
71 }
72
73 /// \brief Constructor for function symbol \@cInt.
74
75 /// \return Function symbol cint.
76 inline
77 const function_symbol& cint()
78 {
80 return cint;
81 }
82
83 /// \brief Recogniser for function \@cInt.
84 /// \param e A data expression.
85 /// \return true iff e is the function symbol matching \@cInt.
86 inline
88 {
90 {
91 return atermpp::down_cast<function_symbol>(e) == cint();
92 }
93 return false;
94 }
95
96 /// \brief Application of function symbol \@cInt.
97
98 /// \param[in] arg0 A data expression.
99 /// \return Application of \@cInt to a number of arguments.
100 inline
101 application cint(const data_expression& arg0)
102 {
103 return sort_int::cint()(arg0);
104 }
105
106 /// \brief Make an application of function symbol \@cInt.
107 /// \param[out] result The data expression where the \@cInt expression is put.
108
109 /// \param[in] arg0 A data expression.
110 inline
111 void make_cint(data_expression& result, const data_expression& arg0)
112 {
113 make_application(result, sort_int::cint(),arg0);
114 }
115
116 /// \brief Recogniser for application of \@cInt.
117 /// \param e A data expression.
118 /// \return true iff e is an application of function symbol cint to a
119 /// number of arguments.
120 inline
121 bool is_cint_application(const atermpp::aterm& e)
122 {
123 return is_application(e) && is_cint_function_symbol(atermpp::down_cast<application>(e).head());
124 }
125
126 /// \brief Generate identifier \@cNeg.
127 /// \return Identifier \@cNeg.
128 inline
129 const core::identifier_string& cneg_name()
130 {
131 static core::identifier_string cneg_name = core::identifier_string("@cNeg");
132 return cneg_name;
133 }
134
135 /// \brief Constructor for function symbol \@cNeg.
136
137 /// \return Function symbol cneg.
138 inline
139 const function_symbol& cneg()
140 {
142 return cneg;
143 }
144
145 /// \brief Recogniser for function \@cNeg.
146 /// \param e A data expression.
147 /// \return true iff e is the function symbol matching \@cNeg.
148 inline
150 {
152 {
153 return atermpp::down_cast<function_symbol>(e) == cneg();
154 }
155 return false;
156 }
157
158 /// \brief Application of function symbol \@cNeg.
159
160 /// \param[in] arg0 A data expression.
161 /// \return Application of \@cNeg to a number of arguments.
162 inline
163 application cneg(const data_expression& arg0)
164 {
165 return sort_int::cneg()(arg0);
166 }
167
168 /// \brief Make an application of function symbol \@cNeg.
169 /// \param[out] result The data expression where the \@cNeg expression is put.
170
171 /// \param[in] arg0 A data expression.
172 inline
173 void make_cneg(data_expression& result, const data_expression& arg0)
174 {
175 make_application(result, sort_int::cneg(),arg0);
176 }
177
178 /// \brief Recogniser for application of \@cNeg.
179 /// \param e A data expression.
180 /// \return true iff e is an application of function symbol cneg to a
181 /// number of arguments.
182 inline
183 bool is_cneg_application(const atermpp::aterm& e)
184 {
185 return is_application(e) && is_cneg_function_symbol(atermpp::down_cast<application>(e).head());
186 }
187 /// \brief Give all system defined constructors for int_.
188 /// \return All system defined constructors for int_.
189 inline
191 {
192 function_symbol_vector result;
193 result.push_back(sort_int::cint());
194 result.push_back(sort_int::cneg());
195
196 return result;
197 }
198 /// \brief Give all defined constructors which can be used in mCRL2 specs for int_.
199 /// \return All system defined constructors that can be used in an mCRL2 specification for int_.
200 inline
202 {
203 function_symbol_vector result;
204 result.push_back(sort_int::cint());
205 result.push_back(sort_int::cneg());
206
207 return result;
208 }
209 // The typedef is the sort that maps a function symbol to an function that rewrites it as well as a string of a function that can be used to implement it
211 /// \brief Give all system defined constructors which have an implementation in C++ and not in rewrite rules for int_.
212 /// \return All system defined constructors that are to be implemented in C++ for int_.
213 inline
215 {
216 implementation_map result;
217 return result;
218 }
219
220 /// \brief Generate identifier Nat2Int.
221 /// \return Identifier Nat2Int.
222 inline
223 const core::identifier_string& nat2int_name()
224 {
225 static core::identifier_string nat2int_name = core::identifier_string("Nat2Int");
226 return nat2int_name;
227 }
228
229 /// \brief Constructor for function symbol Nat2Int.
230
231 /// \return Function symbol nat2int.
232 inline
233 const function_symbol& nat2int()
234 {
236 return nat2int;
237 }
238
239 /// \brief Recogniser for function Nat2Int.
240 /// \param e A data expression.
241 /// \return true iff e is the function symbol matching Nat2Int.
242 inline
244 {
246 {
247 return atermpp::down_cast<function_symbol>(e) == nat2int();
248 }
249 return false;
250 }
251
252 /// \brief Application of function symbol Nat2Int.
253
254 /// \param[in] arg0 A data expression.
255 /// \return Application of Nat2Int to a number of arguments.
256 inline
257 application nat2int(const data_expression& arg0)
258 {
259 return sort_int::nat2int()(arg0);
260 }
261
262 /// \brief Make an application of function symbol Nat2Int.
263 /// \param[out] result The data expression where the Nat2Int expression is put.
264
265 /// \param[in] arg0 A data expression.
266 inline
267 void make_nat2int(data_expression& result, const data_expression& arg0)
268 {
269 make_application(result, sort_int::nat2int(),arg0);
270 }
271
272 /// \brief Recogniser for application of Nat2Int.
273 /// \param e A data expression.
274 /// \return true iff e is an application of function symbol nat2int to a
275 /// number of arguments.
276 inline
277 bool is_nat2int_application(const atermpp::aterm& e)
278 {
279 return is_application(e) && is_nat2int_function_symbol(atermpp::down_cast<application>(e).head());
280 }
281
282 /// \brief Generate identifier Int2Nat.
283 /// \return Identifier Int2Nat.
284 inline
285 const core::identifier_string& int2nat_name()
286 {
287 static core::identifier_string int2nat_name = core::identifier_string("Int2Nat");
288 return int2nat_name;
289 }
290
291 /// \brief Constructor for function symbol Int2Nat.
292
293 /// \return Function symbol int2nat.
294 inline
295 const function_symbol& int2nat()
296 {
298 return int2nat;
299 }
300
301 /// \brief Recogniser for function Int2Nat.
302 /// \param e A data expression.
303 /// \return true iff e is the function symbol matching Int2Nat.
304 inline
306 {
308 {
309 return atermpp::down_cast<function_symbol>(e) == int2nat();
310 }
311 return false;
312 }
313
314 /// \brief Application of function symbol Int2Nat.
315
316 /// \param[in] arg0 A data expression.
317 /// \return Application of Int2Nat to a number of arguments.
318 inline
319 application int2nat(const data_expression& arg0)
320 {
321 return sort_int::int2nat()(arg0);
322 }
323
324 /// \brief Make an application of function symbol Int2Nat.
325 /// \param[out] result The data expression where the Int2Nat expression is put.
326
327 /// \param[in] arg0 A data expression.
328 inline
329 void make_int2nat(data_expression& result, const data_expression& arg0)
330 {
331 make_application(result, sort_int::int2nat(),arg0);
332 }
333
334 /// \brief Recogniser for application of Int2Nat.
335 /// \param e A data expression.
336 /// \return true iff e is an application of function symbol int2nat to a
337 /// number of arguments.
338 inline
339 bool is_int2nat_application(const atermpp::aterm& e)
340 {
341 return is_application(e) && is_int2nat_function_symbol(atermpp::down_cast<application>(e).head());
342 }
343
344 /// \brief Generate identifier Pos2Int.
345 /// \return Identifier Pos2Int.
346 inline
347 const core::identifier_string& pos2int_name()
348 {
349 static core::identifier_string pos2int_name = core::identifier_string("Pos2Int");
350 return pos2int_name;
351 }
352
353 /// \brief Constructor for function symbol Pos2Int.
354
355 /// \return Function symbol pos2int.
356 inline
357 const function_symbol& pos2int()
358 {
360 return pos2int;
361 }
362
363 /// \brief Recogniser for function Pos2Int.
364 /// \param e A data expression.
365 /// \return true iff e is the function symbol matching Pos2Int.
366 inline
368 {
370 {
371 return atermpp::down_cast<function_symbol>(e) == pos2int();
372 }
373 return false;
374 }
375
376 /// \brief Application of function symbol Pos2Int.
377
378 /// \param[in] arg0 A data expression.
379 /// \return Application of Pos2Int to a number of arguments.
380 inline
381 application pos2int(const data_expression& arg0)
382 {
383 return sort_int::pos2int()(arg0);
384 }
385
386 /// \brief Make an application of function symbol Pos2Int.
387 /// \param[out] result The data expression where the Pos2Int expression is put.
388
389 /// \param[in] arg0 A data expression.
390 inline
391 void make_pos2int(data_expression& result, const data_expression& arg0)
392 {
393 make_application(result, sort_int::pos2int(),arg0);
394 }
395
396 /// \brief Recogniser for application of Pos2Int.
397 /// \param e A data expression.
398 /// \return true iff e is an application of function symbol pos2int to a
399 /// number of arguments.
400 inline
401 bool is_pos2int_application(const atermpp::aterm& e)
402 {
403 return is_application(e) && is_pos2int_function_symbol(atermpp::down_cast<application>(e).head());
404 }
405
406 /// \brief Generate identifier Int2Pos.
407 /// \return Identifier Int2Pos.
408 inline
409 const core::identifier_string& int2pos_name()
410 {
411 static core::identifier_string int2pos_name = core::identifier_string("Int2Pos");
412 return int2pos_name;
413 }
414
415 /// \brief Constructor for function symbol Int2Pos.
416
417 /// \return Function symbol int2pos.
418 inline
419 const function_symbol& int2pos()
420 {
422 return int2pos;
423 }
424
425 /// \brief Recogniser for function Int2Pos.
426 /// \param e A data expression.
427 /// \return true iff e is the function symbol matching Int2Pos.
428 inline
430 {
432 {
433 return atermpp::down_cast<function_symbol>(e) == int2pos();
434 }
435 return false;
436 }
437
438 /// \brief Application of function symbol Int2Pos.
439
440 /// \param[in] arg0 A data expression.
441 /// \return Application of Int2Pos to a number of arguments.
442 inline
443 application int2pos(const data_expression& arg0)
444 {
445 return sort_int::int2pos()(arg0);
446 }
447
448 /// \brief Make an application of function symbol Int2Pos.
449 /// \param[out] result The data expression where the Int2Pos expression is put.
450
451 /// \param[in] arg0 A data expression.
452 inline
453 void make_int2pos(data_expression& result, const data_expression& arg0)
454 {
455 make_application(result, sort_int::int2pos(),arg0);
456 }
457
458 /// \brief Recogniser for application of Int2Pos.
459 /// \param e A data expression.
460 /// \return true iff e is an application of function symbol int2pos to a
461 /// number of arguments.
462 inline
463 bool is_int2pos_application(const atermpp::aterm& e)
464 {
465 return is_application(e) && is_int2pos_function_symbol(atermpp::down_cast<application>(e).head());
466 }
467
468 /// \brief Generate identifier max.
469 /// \return Identifier max.
470 inline
471 const core::identifier_string& maximum_name()
472 {
473 static core::identifier_string maximum_name = core::identifier_string("max");
474 return maximum_name;
475 }
476
477 // This function is not intended for public use and therefore not documented in Doxygen.
478 inline
480 {
481 sort_expression target_sort;
482 if (s0 == sort_pos::pos() && s1 == int_())
483 {
484 target_sort = sort_pos::pos();
485 }
486 else if (s0 == int_() && s1 == sort_pos::pos())
487 {
488 target_sort = sort_pos::pos();
489 }
490 else if (s0 == sort_nat::nat() && s1 == int_())
491 {
492 target_sort = sort_nat::nat();
493 }
494 else if (s0 == int_() && s1 == sort_nat::nat())
495 {
496 target_sort = sort_nat::nat();
497 }
498 else if (s0 == int_() && s1 == int_())
499 {
500 target_sort = int_();
501 }
502 else if (s0 == sort_pos::pos() && s1 == sort_nat::nat())
503 {
504 target_sort = sort_pos::pos();
505 }
506 else if (s0 == sort_nat::nat() && s1 == sort_pos::pos())
507 {
508 target_sort = sort_pos::pos();
509 }
510 else if (s0 == sort_nat::nat() && s1 == sort_nat::nat())
511 {
512 target_sort = sort_nat::nat();
513 }
514 else if (s0 == sort_pos::pos() && s1 == sort_pos::pos())
515 {
516 target_sort = sort_pos::pos();
517 }
518 else
519 {
520 throw mcrl2::runtime_error("Cannot compute target sort for maximum with domain sorts " + pp(s0) + ", " + pp(s1) + ". ");
521 }
522
524 return maximum;
525 }
526
527 /// \brief Recogniser for function max.
528 /// \param e A data expression.
529 /// \return true iff e is the function symbol matching max.
530 inline
532 {
534 {
535 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
536 return f.name() == maximum_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == maximum(sort_pos::pos(), int_()) || f == maximum(int_(), sort_pos::pos()) || f == maximum(sort_nat::nat(), int_()) || f == maximum(int_(), sort_nat::nat()) || f == maximum(int_(), int_()) || f == maximum(sort_pos::pos(), sort_nat::nat()) || f == maximum(sort_nat::nat(), sort_pos::pos()) || f == maximum(sort_nat::nat(), sort_nat::nat()) || f == maximum(sort_pos::pos(), sort_pos::pos()));
537 }
538 return false;
539 }
540
541 /// \brief Application of function symbol max.
542
543 /// \param[in] arg0 A data expression.
544 /// \param[in] arg1 A data expression.
545 /// \return Application of max to a number of arguments.
546 inline
547 application maximum(const data_expression& arg0, const data_expression& arg1)
548 {
549 return sort_int::maximum(arg0.sort(), arg1.sort())(arg0, arg1);
550 }
551
552 /// \brief Make an application of function symbol max.
553 /// \param[out] result The data expression where the max expression is put.
554
555 /// \param[in] arg0 A data expression.
556 /// \param[in] arg1 A data expression.
557 inline
558 void make_maximum(data_expression& result, const data_expression& arg0, const data_expression& arg1)
559 {
560 make_application(result, sort_int::maximum(arg0.sort(), arg1.sort()),arg0, arg1);
561 }
562
563 /// \brief Recogniser for application of max.
564 /// \param e A data expression.
565 /// \return true iff e is an application of function symbol maximum to a
566 /// number of arguments.
567 inline
568 bool is_maximum_application(const atermpp::aterm& e)
569 {
570 return is_application(e) && is_maximum_function_symbol(atermpp::down_cast<application>(e).head());
571 }
572
573 /// \brief Generate identifier min.
574 /// \return Identifier min.
575 inline
576 const core::identifier_string& minimum_name()
577 {
578 static core::identifier_string minimum_name = core::identifier_string("min");
579 return minimum_name;
580 }
581
582 // This function is not intended for public use and therefore not documented in Doxygen.
583 inline
585 {
586 sort_expression target_sort;
587 if (s0 == int_() && s1 == int_())
588 {
589 target_sort = int_();
590 }
591 else if (s0 == sort_nat::nat() && s1 == sort_nat::nat())
592 {
593 target_sort = sort_nat::nat();
594 }
595 else if (s0 == sort_pos::pos() && s1 == sort_pos::pos())
596 {
597 target_sort = sort_pos::pos();
598 }
599 else
600 {
601 throw mcrl2::runtime_error("Cannot compute target sort for minimum with domain sorts " + pp(s0) + ", " + pp(s1) + ". ");
602 }
603
605 return minimum;
606 }
607
608 /// \brief Recogniser for function min.
609 /// \param e A data expression.
610 /// \return true iff e is the function symbol matching min.
611 inline
613 {
615 {
616 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
617 return f.name() == minimum_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == minimum(int_(), int_()) || f == minimum(sort_nat::nat(), sort_nat::nat()) || f == minimum(sort_pos::pos(), sort_pos::pos()));
618 }
619 return false;
620 }
621
622 /// \brief Application of function symbol min.
623
624 /// \param[in] arg0 A data expression.
625 /// \param[in] arg1 A data expression.
626 /// \return Application of min to a number of arguments.
627 inline
628 application minimum(const data_expression& arg0, const data_expression& arg1)
629 {
630 return sort_int::minimum(arg0.sort(), arg1.sort())(arg0, arg1);
631 }
632
633 /// \brief Make an application of function symbol min.
634 /// \param[out] result The data expression where the min expression is put.
635
636 /// \param[in] arg0 A data expression.
637 /// \param[in] arg1 A data expression.
638 inline
639 void make_minimum(data_expression& result, const data_expression& arg0, const data_expression& arg1)
640 {
641 make_application(result, sort_int::minimum(arg0.sort(), arg1.sort()),arg0, arg1);
642 }
643
644 /// \brief Recogniser for application of min.
645 /// \param e A data expression.
646 /// \return true iff e is an application of function symbol minimum to a
647 /// number of arguments.
648 inline
649 bool is_minimum_application(const atermpp::aterm& e)
650 {
651 return is_application(e) && is_minimum_function_symbol(atermpp::down_cast<application>(e).head());
652 }
653
654 /// \brief Generate identifier abs.
655 /// \return Identifier abs.
656 inline
657 const core::identifier_string& abs_name()
658 {
659 static core::identifier_string abs_name = core::identifier_string("abs");
660 return abs_name;
661 }
662
663 /// \brief Constructor for function symbol abs.
664
665 /// \return Function symbol abs.
666 inline
667 const function_symbol& abs()
668 {
670 return abs;
671 }
672
673 /// \brief Recogniser for function abs.
674 /// \param e A data expression.
675 /// \return true iff e is the function symbol matching abs.
676 inline
677 bool is_abs_function_symbol(const atermpp::aterm& e)
678 {
680 {
681 return atermpp::down_cast<function_symbol>(e) == abs();
682 }
683 return false;
684 }
685
686 /// \brief Application of function symbol abs.
687
688 /// \param[in] arg0 A data expression.
689 /// \return Application of abs to a number of arguments.
690 inline
691 application abs(const data_expression& arg0)
692 {
693 return sort_int::abs()(arg0);
694 }
695
696 /// \brief Make an application of function symbol abs.
697 /// \param[out] result The data expression where the abs expression is put.
698
699 /// \param[in] arg0 A data expression.
700 inline
701 void make_abs(data_expression& result, const data_expression& arg0)
702 {
703 make_application(result, sort_int::abs(),arg0);
704 }
705
706 /// \brief Recogniser for application of abs.
707 /// \param e A data expression.
708 /// \return true iff e is an application of function symbol abs to a
709 /// number of arguments.
710 inline
711 bool is_abs_application(const atermpp::aterm& e)
712 {
713 return is_application(e) && is_abs_function_symbol(atermpp::down_cast<application>(e).head());
714 }
715
716 /// \brief Generate identifier -.
717 /// \return Identifier -.
718 inline
719 const core::identifier_string& negate_name()
720 {
721 static core::identifier_string negate_name = core::identifier_string("-");
722 return negate_name;
723 }
724
725 // This function is not intended for public use and therefore not documented in Doxygen.
726 inline
728 {
729 sort_expression target_sort(int_());
731 return negate;
732 }
733
734 /// \brief Recogniser for function -.
735 /// \param e A data expression.
736 /// \return true iff e is the function symbol matching -.
737 inline
739 {
741 {
742 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
743 return f.name() == negate_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 1 && (f == negate(sort_pos::pos()) || f == negate(sort_nat::nat()) || f == negate(int_()));
744 }
745 return false;
746 }
747
748 /// \brief Application of function symbol -.
749
750 /// \param[in] arg0 A data expression.
751 /// \return Application of - to a number of arguments.
752 inline
753 application negate(const data_expression& arg0)
754 {
755 return sort_int::negate(arg0.sort())(arg0);
756 }
757
758 /// \brief Make an application of function symbol -.
759 /// \param[out] result The data expression where the - expression is put.
760
761 /// \param[in] arg0 A data expression.
762 inline
763 void make_negate(data_expression& result, const data_expression& arg0)
764 {
765 make_application(result, sort_int::negate(arg0.sort()),arg0);
766 }
767
768 /// \brief Recogniser for application of -.
769 /// \param e A data expression.
770 /// \return true iff e is an application of function symbol negate to a
771 /// number of arguments.
772 inline
773 bool is_negate_application(const atermpp::aterm& e)
774 {
775 return is_application(e) && is_negate_function_symbol(atermpp::down_cast<application>(e).head());
776 }
777
778 /// \brief Generate identifier succ.
779 /// \return Identifier succ.
780 inline
781 const core::identifier_string& succ_name()
782 {
783 static core::identifier_string succ_name = core::identifier_string("succ");
784 return succ_name;
785 }
786
787 // This function is not intended for public use and therefore not documented in Doxygen.
788 inline
790 {
791 sort_expression target_sort;
792 if (s0 == int_())
793 {
794 target_sort = int_();
795 }
796 else if (s0 == sort_nat::nat())
797 {
798 target_sort = sort_pos::pos();
799 }
800 else if (s0 == sort_pos::pos())
801 {
802 target_sort = sort_pos::pos();
803 }
804 else
805 {
806 throw mcrl2::runtime_error("Cannot compute target sort for succ with domain sorts " + pp(s0) + ". ");
807 }
808
810 return succ;
811 }
812
813 /// \brief Recogniser for function succ.
814 /// \param e A data expression.
815 /// \return true iff e is the function symbol matching succ.
816 inline
818 {
820 {
821 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
822 return f.name() == succ_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 1 && (f == succ(int_()) || f == succ(sort_nat::nat()) || f == succ(sort_pos::pos()));
823 }
824 return false;
825 }
826
827 /// \brief Application of function symbol succ.
828
829 /// \param[in] arg0 A data expression.
830 /// \return Application of succ to a number of arguments.
831 inline
832 application succ(const data_expression& arg0)
833 {
834 return sort_int::succ(arg0.sort())(arg0);
835 }
836
837 /// \brief Make an application of function symbol succ.
838 /// \param[out] result The data expression where the succ expression is put.
839
840 /// \param[in] arg0 A data expression.
841 inline
842 void make_succ(data_expression& result, const data_expression& arg0)
843 {
844 make_application(result, sort_int::succ(arg0.sort()),arg0);
845 }
846
847 /// \brief Recogniser for application of succ.
848 /// \param e A data expression.
849 /// \return true iff e is an application of function symbol succ to a
850 /// number of arguments.
851 inline
852 bool is_succ_application(const atermpp::aterm& e)
853 {
854 return is_application(e) && is_succ_function_symbol(atermpp::down_cast<application>(e).head());
855 }
856
857 /// \brief Generate identifier pred.
858 /// \return Identifier pred.
859 inline
860 const core::identifier_string& pred_name()
861 {
862 static core::identifier_string pred_name = core::identifier_string("pred");
863 return pred_name;
864 }
865
866 // This function is not intended for public use and therefore not documented in Doxygen.
867 inline
869 {
870 sort_expression target_sort;
871 if (s0 == sort_nat::nat())
872 {
873 target_sort = int_();
874 }
875 else if (s0 == int_())
876 {
877 target_sort = int_();
878 }
879 else if (s0 == sort_pos::pos())
880 {
881 target_sort = sort_nat::nat();
882 }
883 else
884 {
885 throw mcrl2::runtime_error("Cannot compute target sort for pred with domain sorts " + pp(s0) + ". ");
886 }
887
889 return pred;
890 }
891
892 /// \brief Recogniser for function pred.
893 /// \param e A data expression.
894 /// \return true iff e is the function symbol matching pred.
895 inline
897 {
899 {
900 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
901 return f.name() == pred_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 1 && (f == pred(sort_nat::nat()) || f == pred(int_()) || f == pred(sort_pos::pos()));
902 }
903 return false;
904 }
905
906 /// \brief Application of function symbol pred.
907
908 /// \param[in] arg0 A data expression.
909 /// \return Application of pred to a number of arguments.
910 inline
911 application pred(const data_expression& arg0)
912 {
913 return sort_int::pred(arg0.sort())(arg0);
914 }
915
916 /// \brief Make an application of function symbol pred.
917 /// \param[out] result The data expression where the pred expression is put.
918
919 /// \param[in] arg0 A data expression.
920 inline
921 void make_pred(data_expression& result, const data_expression& arg0)
922 {
923 make_application(result, sort_int::pred(arg0.sort()),arg0);
924 }
925
926 /// \brief Recogniser for application of pred.
927 /// \param e A data expression.
928 /// \return true iff e is an application of function symbol pred to a
929 /// number of arguments.
930 inline
931 bool is_pred_application(const atermpp::aterm& e)
932 {
933 return is_application(e) && is_pred_function_symbol(atermpp::down_cast<application>(e).head());
934 }
935
936 /// \brief Generate identifier +.
937 /// \return Identifier +.
938 inline
939 const core::identifier_string& plus_name()
940 {
941 static core::identifier_string plus_name = core::identifier_string("+");
942 return plus_name;
943 }
944
945 // This function is not intended for public use and therefore not documented in Doxygen.
946 inline
948 {
949 sort_expression target_sort;
950 if (s0 == int_() && s1 == int_())
951 {
952 target_sort = int_();
953 }
954 else if (s0 == sort_pos::pos() && s1 == sort_nat::nat())
955 {
956 target_sort = sort_pos::pos();
957 }
958 else if (s0 == sort_nat::nat() && s1 == sort_pos::pos())
959 {
960 target_sort = sort_pos::pos();
961 }
962 else if (s0 == sort_nat::nat() && s1 == sort_nat::nat())
963 {
964 target_sort = sort_nat::nat();
965 }
966 else if (s0 == sort_pos::pos() && s1 == sort_pos::pos())
967 {
968 target_sort = sort_pos::pos();
969 }
970 else
971 {
972 throw mcrl2::runtime_error("Cannot compute target sort for plus with domain sorts " + pp(s0) + ", " + pp(s1) + ". ");
973 }
974
976 return plus;
977 }
978
979 /// \brief Recogniser for function +.
980 /// \param e A data expression.
981 /// \return true iff e is the function symbol matching +.
982 inline
984 {
986 {
987 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
988 return f.name() == plus_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == plus(int_(), int_()) || f == plus(sort_pos::pos(), sort_nat::nat()) || f == plus(sort_nat::nat(), sort_pos::pos()) || f == plus(sort_nat::nat(), sort_nat::nat()) || f == plus(sort_pos::pos(), sort_pos::pos()));
989 }
990 return false;
991 }
992
993 /// \brief Application of function symbol +.
994
995 /// \param[in] arg0 A data expression.
996 /// \param[in] arg1 A data expression.
997 /// \return Application of + to a number of arguments.
998 inline
999 application plus(const data_expression& arg0, const data_expression& arg1)
1000 {
1001 return sort_int::plus(arg0.sort(), arg1.sort())(arg0, arg1);
1002 }
1003
1004 /// \brief Make an application of function symbol +.
1005 /// \param[out] result The data expression where the + expression is put.
1006
1007 /// \param[in] arg0 A data expression.
1008 /// \param[in] arg1 A data expression.
1009 inline
1010 void make_plus(data_expression& result, const data_expression& arg0, const data_expression& arg1)
1011 {
1012 make_application(result, sort_int::plus(arg0.sort(), arg1.sort()),arg0, arg1);
1013 }
1014
1015 /// \brief Recogniser for application of +.
1016 /// \param e A data expression.
1017 /// \return true iff e is an application of function symbol plus to a
1018 /// number of arguments.
1019 inline
1020 bool is_plus_application(const atermpp::aterm& e)
1021 {
1022 return is_application(e) && is_plus_function_symbol(atermpp::down_cast<application>(e).head());
1023 }
1024
1025 /// \brief Generate identifier -.
1026 /// \return Identifier -.
1027 inline
1028 const core::identifier_string& minus_name()
1029 {
1030 static core::identifier_string minus_name = core::identifier_string("-");
1031 return minus_name;
1032 }
1033
1034 // This function is not intended for public use and therefore not documented in Doxygen.
1035 inline
1037 {
1038 sort_expression target_sort(int_());
1040 return minus;
1041 }
1042
1043 /// \brief Recogniser for function -.
1044 /// \param e A data expression.
1045 /// \return true iff e is the function symbol matching -.
1046 inline
1047 bool is_minus_function_symbol(const atermpp::aterm& e)
1048 {
1050 {
1051 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
1052 return f.name() == minus_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == minus(sort_pos::pos(), sort_pos::pos()) || f == minus(sort_nat::nat(), sort_nat::nat()) || f == minus(int_(), int_()));
1053 }
1054 return false;
1055 }
1056
1057 /// \brief Application of function symbol -.
1058
1059 /// \param[in] arg0 A data expression.
1060 /// \param[in] arg1 A data expression.
1061 /// \return Application of - to a number of arguments.
1062 inline
1063 application minus(const data_expression& arg0, const data_expression& arg1)
1064 {
1065 return sort_int::minus(arg0.sort(), arg1.sort())(arg0, arg1);
1066 }
1067
1068 /// \brief Make an application of function symbol -.
1069 /// \param[out] result The data expression where the - expression is put.
1070
1071 /// \param[in] arg0 A data expression.
1072 /// \param[in] arg1 A data expression.
1073 inline
1074 void make_minus(data_expression& result, const data_expression& arg0, const data_expression& arg1)
1075 {
1076 make_application(result, sort_int::minus(arg0.sort(), arg1.sort()),arg0, arg1);
1077 }
1078
1079 /// \brief Recogniser for application of -.
1080 /// \param e A data expression.
1081 /// \return true iff e is an application of function symbol minus to a
1082 /// number of arguments.
1083 inline
1084 bool is_minus_application(const atermpp::aterm& e)
1085 {
1086 return is_application(e) && is_minus_function_symbol(atermpp::down_cast<application>(e).head());
1087 }
1088
1089 /// \brief Generate identifier *.
1090 /// \return Identifier *.
1091 inline
1092 const core::identifier_string& times_name()
1093 {
1094 static core::identifier_string times_name = core::identifier_string("*");
1095 return times_name;
1096 }
1097
1098 // This function is not intended for public use and therefore not documented in Doxygen.
1099 inline
1101 {
1102 sort_expression target_sort;
1103 if (s0 == int_() && s1 == int_())
1104 {
1105 target_sort = int_();
1106 }
1107 else if (s0 == sort_nat::nat() && s1 == sort_nat::nat())
1108 {
1109 target_sort = sort_nat::nat();
1110 }
1111 else if (s0 == sort_pos::pos() && s1 == sort_pos::pos())
1112 {
1113 target_sort = sort_pos::pos();
1114 }
1115 else
1116 {
1117 throw mcrl2::runtime_error("Cannot compute target sort for times with domain sorts " + pp(s0) + ", " + pp(s1) + ". ");
1118 }
1119
1121 return times;
1122 }
1123
1124 /// \brief Recogniser for function *.
1125 /// \param e A data expression.
1126 /// \return true iff e is the function symbol matching *.
1127 inline
1128 bool is_times_function_symbol(const atermpp::aterm& e)
1129 {
1131 {
1132 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
1133 return f.name() == times_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == times(int_(), int_()) || f == times(sort_nat::nat(), sort_nat::nat()) || f == times(sort_pos::pos(), sort_pos::pos()));
1134 }
1135 return false;
1136 }
1137
1138 /// \brief Application of function symbol *.
1139
1140 /// \param[in] arg0 A data expression.
1141 /// \param[in] arg1 A data expression.
1142 /// \return Application of * to a number of arguments.
1143 inline
1144 application times(const data_expression& arg0, const data_expression& arg1)
1145 {
1146 return sort_int::times(arg0.sort(), arg1.sort())(arg0, arg1);
1147 }
1148
1149 /// \brief Make an application of function symbol *.
1150 /// \param[out] result The data expression where the * expression is put.
1151
1152 /// \param[in] arg0 A data expression.
1153 /// \param[in] arg1 A data expression.
1154 inline
1155 void make_times(data_expression& result, const data_expression& arg0, const data_expression& arg1)
1156 {
1157 make_application(result, sort_int::times(arg0.sort(), arg1.sort()),arg0, arg1);
1158 }
1159
1160 /// \brief Recogniser for application of *.
1161 /// \param e A data expression.
1162 /// \return true iff e is an application of function symbol times to a
1163 /// number of arguments.
1164 inline
1165 bool is_times_application(const atermpp::aterm& e)
1166 {
1167 return is_application(e) && is_times_function_symbol(atermpp::down_cast<application>(e).head());
1168 }
1169
1170 /// \brief Generate identifier div.
1171 /// \return Identifier div.
1172 inline
1173 const core::identifier_string& div_name()
1174 {
1175 static core::identifier_string div_name = core::identifier_string("div");
1176 return div_name;
1177 }
1178
1179 // This function is not intended for public use and therefore not documented in Doxygen.
1180 inline
1182 {
1183 sort_expression target_sort;
1184 if (s0 == int_() && s1 == sort_pos::pos())
1185 {
1186 target_sort = int_();
1187 }
1188 else if (s0 == sort_nat::nat() && s1 == sort_pos::pos())
1189 {
1190 target_sort = sort_nat::nat();
1191 }
1192 else
1193 {
1194 throw mcrl2::runtime_error("Cannot compute target sort for div with domain sorts " + pp(s0) + ", " + pp(s1) + ". ");
1195 }
1196
1198 return div;
1199 }
1200
1201 /// \brief Recogniser for function div.
1202 /// \param e A data expression.
1203 /// \return true iff e is the function symbol matching div.
1204 inline
1205 bool is_div_function_symbol(const atermpp::aterm& e)
1206 {
1208 {
1209 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
1210 return f.name() == div_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == div(int_(), sort_pos::pos()) || f == div(sort_nat::nat(), sort_pos::pos()));
1211 }
1212 return false;
1213 }
1214
1215 /// \brief Application of function symbol div.
1216
1217 /// \param[in] arg0 A data expression.
1218 /// \param[in] arg1 A data expression.
1219 /// \return Application of div to a number of arguments.
1220 inline
1221 application div(const data_expression& arg0, const data_expression& arg1)
1222 {
1223 return sort_int::div(arg0.sort(), arg1.sort())(arg0, arg1);
1224 }
1225
1226 /// \brief Make an application of function symbol div.
1227 /// \param[out] result The data expression where the div expression is put.
1228
1229 /// \param[in] arg0 A data expression.
1230 /// \param[in] arg1 A data expression.
1231 inline
1232 void make_div(data_expression& result, const data_expression& arg0, const data_expression& arg1)
1233 {
1234 make_application(result, sort_int::div(arg0.sort(), arg1.sort()),arg0, arg1);
1235 }
1236
1237 /// \brief Recogniser for application of div.
1238 /// \param e A data expression.
1239 /// \return true iff e is an application of function symbol div to a
1240 /// number of arguments.
1241 inline
1242 bool is_div_application(const atermpp::aterm& e)
1243 {
1244 return is_application(e) && is_div_function_symbol(atermpp::down_cast<application>(e).head());
1245 }
1246
1247 /// \brief Generate identifier mod.
1248 /// \return Identifier mod.
1249 inline
1250 const core::identifier_string& mod_name()
1251 {
1252 static core::identifier_string mod_name = core::identifier_string("mod");
1253 return mod_name;
1254 }
1255
1256 // This function is not intended for public use and therefore not documented in Doxygen.
1257 inline
1259 {
1262 return mod;
1263 }
1264
1265 /// \brief Recogniser for function mod.
1266 /// \param e A data expression.
1267 /// \return true iff e is the function symbol matching mod.
1268 inline
1269 bool is_mod_function_symbol(const atermpp::aterm& e)
1270 {
1272 {
1273 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
1274 return f.name() == mod_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == mod(int_(), sort_pos::pos()) || f == mod(sort_nat::nat(), sort_pos::pos()));
1275 }
1276 return false;
1277 }
1278
1279 /// \brief Application of function symbol mod.
1280
1281 /// \param[in] arg0 A data expression.
1282 /// \param[in] arg1 A data expression.
1283 /// \return Application of mod to a number of arguments.
1284 inline
1285 application mod(const data_expression& arg0, const data_expression& arg1)
1286 {
1287 return sort_int::mod(arg0.sort(), arg1.sort())(arg0, arg1);
1288 }
1289
1290 /// \brief Make an application of function symbol mod.
1291 /// \param[out] result The data expression where the mod expression is put.
1292
1293 /// \param[in] arg0 A data expression.
1294 /// \param[in] arg1 A data expression.
1295 inline
1296 void make_mod(data_expression& result, const data_expression& arg0, const data_expression& arg1)
1297 {
1298 make_application(result, sort_int::mod(arg0.sort(), arg1.sort()),arg0, arg1);
1299 }
1300
1301 /// \brief Recogniser for application of mod.
1302 /// \param e A data expression.
1303 /// \return true iff e is an application of function symbol mod to a
1304 /// number of arguments.
1305 inline
1306 bool is_mod_application(const atermpp::aterm& e)
1307 {
1308 return is_application(e) && is_mod_function_symbol(atermpp::down_cast<application>(e).head());
1309 }
1310
1311 /// \brief Generate identifier exp.
1312 /// \return Identifier exp.
1313 inline
1314 const core::identifier_string& exp_name()
1315 {
1316 static core::identifier_string exp_name = core::identifier_string("exp");
1317 return exp_name;
1318 }
1319
1320 // This function is not intended for public use and therefore not documented in Doxygen.
1321 inline
1323 {
1324 sort_expression target_sort;
1325 if (s0 == int_() && s1 == sort_nat::nat())
1326 {
1327 target_sort = int_();
1328 }
1329 else if (s0 == sort_pos::pos() && s1 == sort_nat::nat())
1330 {
1331 target_sort = sort_pos::pos();
1332 }
1333 else if (s0 == sort_nat::nat() && s1 == sort_nat::nat())
1334 {
1335 target_sort = sort_nat::nat();
1336 }
1337 else
1338 {
1339 throw mcrl2::runtime_error("Cannot compute target sort for exp with domain sorts " + pp(s0) + ", " + pp(s1) + ". ");
1340 }
1341
1343 return exp;
1344 }
1345
1346 /// \brief Recogniser for function exp.
1347 /// \param e A data expression.
1348 /// \return true iff e is the function symbol matching exp.
1349 inline
1350 bool is_exp_function_symbol(const atermpp::aterm& e)
1351 {
1353 {
1354 const function_symbol& f = atermpp::down_cast<function_symbol>(e);
1355 return f.name() == exp_name() && atermpp::down_cast<function_sort>(f.sort()).domain().size() == 2 && (f == exp(int_(), sort_nat::nat()) || f == exp(sort_pos::pos(), sort_nat::nat()) || f == exp(sort_nat::nat(), sort_nat::nat()));
1356 }
1357 return false;
1358 }
1359
1360 /// \brief Application of function symbol exp.
1361
1362 /// \param[in] arg0 A data expression.
1363 /// \param[in] arg1 A data expression.
1364 /// \return Application of exp to a number of arguments.
1365 inline
1366 application exp(const data_expression& arg0, const data_expression& arg1)
1367 {
1368 return sort_int::exp(arg0.sort(), arg1.sort())(arg0, arg1);
1369 }
1370
1371 /// \brief Make an application of function symbol exp.
1372 /// \param[out] result The data expression where the exp expression is put.
1373
1374 /// \param[in] arg0 A data expression.
1375 /// \param[in] arg1 A data expression.
1376 inline
1377 void make_exp(data_expression& result, const data_expression& arg0, const data_expression& arg1)
1378 {
1379 make_application(result, sort_int::exp(arg0.sort(), arg1.sort()),arg0, arg1);
1380 }
1381
1382 /// \brief Recogniser for application of exp.
1383 /// \param e A data expression.
1384 /// \return true iff e is an application of function symbol exp to a
1385 /// number of arguments.
1386 inline
1387 bool is_exp_application(const atermpp::aterm& e)
1388 {
1389 return is_application(e) && is_exp_function_symbol(atermpp::down_cast<application>(e).head());
1390 }
1391 /// \brief Give all system defined mappings for int_
1392 /// \return All system defined mappings for int_
1393 inline
1395 {
1396 function_symbol_vector result;
1397 result.push_back(sort_int::nat2int());
1398 result.push_back(sort_int::int2nat());
1399 result.push_back(sort_int::pos2int());
1400 result.push_back(sort_int::int2pos());
1401 result.push_back(sort_int::maximum(sort_pos::pos(), int_()));
1402 result.push_back(sort_int::maximum(int_(), sort_pos::pos()));
1403 result.push_back(sort_int::maximum(sort_nat::nat(), int_()));
1404 result.push_back(sort_int::maximum(int_(), sort_nat::nat()));
1405 result.push_back(sort_int::maximum(int_(), int_()));
1406 result.push_back(sort_int::minimum(int_(), int_()));
1407 result.push_back(sort_int::abs());
1408 result.push_back(sort_int::negate(sort_pos::pos()));
1409 result.push_back(sort_int::negate(sort_nat::nat()));
1410 result.push_back(sort_int::negate(int_()));
1411 result.push_back(sort_int::succ(int_()));
1412 result.push_back(sort_int::pred(sort_nat::nat()));
1413 result.push_back(sort_int::pred(int_()));
1414 result.push_back(sort_int::plus(int_(), int_()));
1415 result.push_back(sort_int::minus(sort_pos::pos(), sort_pos::pos()));
1416 result.push_back(sort_int::minus(sort_nat::nat(), sort_nat::nat()));
1417 result.push_back(sort_int::minus(int_(), int_()));
1418 result.push_back(sort_int::times(int_(), int_()));
1419 result.push_back(sort_int::div(int_(), sort_pos::pos()));
1420 result.push_back(sort_int::mod(int_(), sort_pos::pos()));
1421 result.push_back(sort_int::exp(int_(), sort_nat::nat()));
1422 return result;
1423 }
1424
1425 /// \brief Give all system defined mappings and constructors for int_
1426 /// \return All system defined mappings for int_
1427 inline
1429 {
1430 function_symbol_vector result=int_generate_functions_code();
1431 for(const function_symbol& f: int_generate_constructors_code())
1432 {
1433 result.push_back(f);
1434 }
1435 return result;
1436 }
1437
1438 /// \brief Give all system defined mappings that can be used in mCRL2 specs for int_
1439 /// \return All system defined mappings for that can be used in mCRL2 specificationis int_
1440 inline
1442 {
1443 function_symbol_vector result;
1444 result.push_back(sort_int::nat2int());
1445 result.push_back(sort_int::int2nat());
1446 result.push_back(sort_int::pos2int());
1447 result.push_back(sort_int::int2pos());
1448 result.push_back(sort_int::maximum(sort_pos::pos(), int_()));
1449 result.push_back(sort_int::maximum(int_(), sort_pos::pos()));
1450 result.push_back(sort_int::maximum(sort_nat::nat(), int_()));
1451 result.push_back(sort_int::maximum(int_(), sort_nat::nat()));
1452 result.push_back(sort_int::maximum(int_(), int_()));
1453 result.push_back(sort_int::minimum(int_(), int_()));
1454 result.push_back(sort_int::abs());
1455 result.push_back(sort_int::negate(sort_pos::pos()));
1456 result.push_back(sort_int::negate(sort_nat::nat()));
1457 result.push_back(sort_int::negate(int_()));
1458 result.push_back(sort_int::succ(int_()));
1459 result.push_back(sort_int::pred(sort_nat::nat()));
1460 result.push_back(sort_int::pred(int_()));
1461 result.push_back(sort_int::plus(int_(), int_()));
1462 result.push_back(sort_int::minus(sort_pos::pos(), sort_pos::pos()));
1463 result.push_back(sort_int::minus(sort_nat::nat(), sort_nat::nat()));
1464 result.push_back(sort_int::minus(int_(), int_()));
1465 result.push_back(sort_int::times(int_(), int_()));
1466 result.push_back(sort_int::div(int_(), sort_pos::pos()));
1467 result.push_back(sort_int::mod(int_(), sort_pos::pos()));
1468 result.push_back(sort_int::exp(int_(), sort_nat::nat()));
1469 return result;
1470 }
1471
1472
1473 // The typedef is the sort that maps a function symbol to an function that rewrites it as well as a string of a function that can be used to implement it
1475 /// \brief Give all system defined mappings that are to be implemented in C++ code for int_
1476 /// \return A mapping from C++ implementable function symbols to system defined mappings implemented in C++ code for int_
1477 inline
1479 {
1480 implementation_map result;
1481 return result;
1482 }
1483 ///\brief Function for projecting out argument.
1484 /// arg from an application.
1485 /// \param e A data expression.
1486 /// \pre arg is defined for e.
1487 /// \return The argument of e that corresponds to arg.
1488 inline
1489 const data_expression& arg(const data_expression& e)
1490 {
1492 return atermpp::down_cast<application>(e)[0];
1493 }
1494
1495 ///\brief Function for projecting out argument.
1496 /// left from an application.
1497 /// \param e A data expression.
1498 /// \pre left is defined for e.
1499 /// \return The argument of e that corresponds to left.
1500 inline
1501 const data_expression& left(const data_expression& e)
1502 {
1504 return atermpp::down_cast<application>(e)[0];
1505 }
1506
1507 ///\brief Function for projecting out argument.
1508 /// right from an application.
1509 /// \param e A data expression.
1510 /// \pre right is defined for e.
1511 /// \return The argument of e that corresponds to right.
1512 inline
1513 const data_expression& right(const data_expression& e)
1514 {
1516 return atermpp::down_cast<application>(e)[1];
1517 }
1518
1519 /// \brief Give all system defined equations for int_
1520 /// \return All system defined equations for sort int_
1521 inline
1523 {
1525 variable vn("n",sort_nat::nat());
1526 variable vm("m",sort_nat::nat());
1527 variable vp("p",sort_pos::pos());
1528 variable vq("q",sort_pos::pos());
1529 variable vx("x",int_());
1530 variable vy("y",int_());
1531
1532 data_equation_vector result;
1533 result.emplace_back(variable_list({vm, vn}), equal_to(cint(vm), cint(vn)), equal_to(vm, vn));
1534 result.emplace_back(variable_list({vn, vp}), equal_to(cint(vn), cneg(vp)), sort_bool::false_());
1535 result.emplace_back(variable_list({vn, vp}), equal_to(cneg(vp), cint(vn)), sort_bool::false_());
1536 result.emplace_back(variable_list({vp, vq}), equal_to(cneg(vp), cneg(vq)), equal_to(vp, vq));
1537 result.emplace_back(variable_list({vm, vn}), less(cint(vm), cint(vn)), less(vm, vn));
1538 result.emplace_back(variable_list({vn, vp}), less(cint(vn), cneg(vp)), sort_bool::false_());
1539 result.emplace_back(variable_list({vn, vp}), less(cneg(vp), cint(vn)), sort_bool::true_());
1540 result.emplace_back(variable_list({vp, vq}), less(cneg(vp), cneg(vq)), less(vq, vp));
1541 result.emplace_back(variable_list({vx, vy}), less_total(vx, vy), less(vx, vy));
1542 result.emplace_back(variable_list({vm, vn}), less_equal(cint(vm), cint(vn)), less_equal(vm, vn));
1543 result.emplace_back(variable_list({vn, vp}), less_equal(cint(vn), cneg(vp)), sort_bool::false_());
1544 result.emplace_back(variable_list({vn, vp}), less_equal(cneg(vp), cint(vn)), sort_bool::true_());
1545 result.emplace_back(variable_list({vp, vq}), less_equal(cneg(vp), cneg(vq)), less_equal(vq, vp));
1546 result.emplace_back(variable_list({vn}), nat2int(vn), cint(vn));
1547 result.emplace_back(variable_list({vn}), int2nat(cint(vn)), vn);
1548 result.emplace_back(variable_list({vp}), pos2int(vp), cint(sort_nat::pos2nat(vp)));
1549 result.emplace_back(variable_list({vn}), int2pos(cint(vn)), sort_nat::nat2pos(vn));
1550 result.emplace_back(variable_list({vn, vp}), maximum(vp, cint(vn)), maximum(vp, vn));
1551 result.emplace_back(variable_list({vp, vq}), maximum(vp, cneg(vq)), vp);
1552 result.emplace_back(variable_list({vn, vp}), maximum(cint(vn), vp), maximum(vn, vp));
1553 result.emplace_back(variable_list({vp, vq}), maximum(cneg(vq), vp), vp);
1554 result.emplace_back(variable_list({vm, vn}), maximum(vm, cint(vn)), if_(less_equal(vm, vn), vn, vm));
1555 result.emplace_back(variable_list({vn, vp}), maximum(vn, cneg(vp)), vn);
1556 result.emplace_back(variable_list({vm, vn}), maximum(cint(vm), vn), if_(less_equal(vm, vn), vn, vm));
1557 result.emplace_back(variable_list({vn, vp}), maximum(cneg(vp), vn), vn);
1558 result.emplace_back(variable_list({vx, vy}), maximum(vx, vy), if_(less_equal(vx, vy), vy, vx));
1559 result.emplace_back(variable_list({vx, vy}), minimum(vx, vy), if_(less_equal(vx, vy), vx, vy));
1560 result.emplace_back(variable_list({vn}), abs(cint(vn)), vn);
1561 result.emplace_back(variable_list({vp}), abs(cneg(vp)), sort_nat::pos2nat(vp));
1562 result.emplace_back(variable_list({vp}), negate(vp), cneg(vp));
1563 result.emplace_back(variable_list(), negate(sort_nat::c0()), cint(sort_nat::c0()));
1564 result.emplace_back(variable_list({vn}), sort_nat::equals_zero(vn), negate(vn), cint(sort_nat::most_significant_digit_nat(sort_machine_word::zero_word())));
1565 result.emplace_back(variable_list({vn}), sort_nat::not_equals_zero(vn), negate(vn), cneg(sort_nat::nat2pos(vn)));
1566 result.emplace_back(variable_list({vn}), negate(cint(vn)), negate(vn));
1567 result.emplace_back(variable_list({vp}), negate(cneg(vp)), cint(sort_nat::pos2nat(vp)));
1568 result.emplace_back(variable_list({vn}), succ(cint(vn)), cint(sort_nat::succ_nat(vn)));
1569 result.emplace_back(variable_list({vp}), succ(cneg(vp)), negate(pred(vp)));
1570 result.emplace_back(variable_list({vn}), pred(vn), if_(sort_nat::equals_zero(vn), cneg(sort_pos::most_significant_digit(sort_machine_word::one_word())), cint(sort_nat::natpred(vn))));
1571 result.emplace_back(variable_list({vn}), pred(cint(vn)), pred(vn));
1572 result.emplace_back(variable_list({vp}), pred(cneg(vp)), cneg(succ(vp)));
1573 result.emplace_back(variable_list({vm, vn}), plus(cint(vm), cint(vn)), cint(plus(vm, vn)));
1574 result.emplace_back(variable_list({vn, vp}), plus(cint(vn), cneg(vp)), minus(vn, sort_nat::pos2nat(vp)));
1575 result.emplace_back(variable_list({vn, vp}), plus(cneg(vp), cint(vn)), minus(vn, sort_nat::pos2nat(vp)));
1576 result.emplace_back(variable_list({vp, vq}), plus(cneg(vp), cneg(vq)), cneg(plus(vp, vq)));
1577 result.emplace_back(variable_list({vp, vq}), less_equal(vq, vp), minus(vp, vq), cint(sort_nat::monus(sort_nat::pos2nat(vp), sort_nat::pos2nat(vq))));
1578 result.emplace_back(variable_list({vp, vq}), less(vp, vq), minus(vp, vq), negate(sort_nat::monus(sort_nat::pos2nat(vq), sort_nat::pos2nat(vp))));
1579 result.emplace_back(variable_list({vm, vn}), less_equal(vn, vm), minus(vm, vn), cint(sort_nat::monus(vm, vn)));
1580 result.emplace_back(variable_list({vm, vn}), less(vm, vn), minus(vm, vn), negate(sort_nat::monus(vn, vm)));
1581 result.emplace_back(variable_list({vx, vy}), minus(vx, vy), plus(vx, negate(vy)));
1582 result.emplace_back(variable_list({vm, vn}), times(cint(vm), cint(vn)), cint(times(vm, vn)));
1583 result.emplace_back(variable_list({vn, vp}), times(cint(vn), cneg(vp)), negate(times(sort_nat::pos2nat(vp), vn)));
1584 result.emplace_back(variable_list({vn, vp}), times(cneg(vp), cint(vn)), negate(times(sort_nat::pos2nat(vp), vn)));
1585 result.emplace_back(variable_list({vp, vq}), times(cneg(vp), cneg(vq)), cint(sort_nat::pos2nat(times(vp, vq))));
1586 result.emplace_back(variable_list({vn, vp}), div(cint(vn), vp), cint(div(vn, vp)));
1587 result.emplace_back(variable_list({vp, vq}), div(cneg(vp), vq), cneg(succ(div(pred(vp), vq))));
1588 result.emplace_back(variable_list({vn, vp}), mod(cint(vn), vp), mod(vn, vp));
1589 result.emplace_back(variable_list({vp, vq}), mod(cneg(vp), vq), int2nat(minus(vq, succ(mod(pred(vp), vq)))));
1590 result.emplace_back(variable_list({vm, vn}), exp(cint(vm), vn), cint(exp(vm, vn)));
1591 result.emplace_back(variable_list({vn, vp}), exp(cneg(vp), vn), if_(sort_nat::is_odd(vn), cneg(exp(vp, vn)), cint(sort_nat::pos2nat(exp(vp, vn)))));
1592 return result;
1593 }
1594
1595} // namespace mcrl2::data::sort_int
1596
1597#endif // MCRL2_DATA_INT64_H
A unordered_map class in which aterms can be stored.
\brief A basic sort
Definition basic_sort.h:25
basic_sort(const core::identifier_string &name)
\brief Constructor Z14.
Definition basic_sort.h:41
basic_sort(const atermpp::aterm &term)
Definition basic_sort.h:34
application operator()(const data_expression &e1, const data_expression &e2) const
Apply a data expression to two data expressions.
sort_expression sort() const
Returns the sort of the data expression.
Definition data.cpp:107
application operator()(const data_expression &e) const
Apply a data expression to a data expression.
\brief A function symbol
function_symbol(const core::identifier_string &name, const sort_expression &sort)
Constructor.
\brief A sort expression
sort_expression & operator=(const sort_expression &) noexcept=default
sort_expression(const sort_expression &) noexcept=default
Move semantics.
\brief A data variable
Definition variable.h:25
Namespace for system defined sort bool_.
Definition bool.h:29
const basic_sort & bool_()
Constructor for sort expression Bool.
Definition bool.h:41
Namespace for system defined sort int_.
bool is_minimum_application(const atermpp::aterm &e)
Recogniser for application of min.
Definition int1.h:649
const data_expression & right(const data_expression &e)
Function for projecting out argument. right from an application.
Definition int1.h:1513
void make_minimum(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol min.
Definition int1.h:639
const core::identifier_string & cint_name()
Generate identifier @cInt.
Definition int1.h:67
application cint(const data_expression &arg0)
Application of function symbol @cInt.
Definition int1.h:101
application abs(const data_expression &arg0)
Application of function symbol abs.
Definition int1.h:691
application nat2int(const data_expression &arg0)
Application of function symbol Nat2Int.
Definition int1.h:257
application succ(const data_expression &arg0)
Application of function symbol succ.
Definition int1.h:832
application cneg(const data_expression &arg0)
Application of function symbol @cNeg.
Definition int1.h:163
bool is_minus_function_symbol(const atermpp::aterm &e)
Recogniser for function -.
Definition int1.h:1047
bool is_maximum_application(const atermpp::aterm &e)
Recogniser for application of max.
Definition int1.h:568
bool is_succ_function_symbol(const atermpp::aterm &e)
Recogniser for function succ.
Definition int1.h:817
const core::identifier_string & abs_name()
Generate identifier abs.
Definition int1.h:657
bool is_minimum_function_symbol(const atermpp::aterm &e)
Recogniser for function min.
Definition int1.h:612
bool is_int2pos_application(const atermpp::aterm &e)
Recogniser for application of Int2Pos.
Definition int1.h:463
const core::identifier_string & pred_name()
Generate identifier pred.
Definition int1.h:860
bool is_exp_function_symbol(const atermpp::aterm &e)
Recogniser for function exp.
Definition int1.h:1350
bool is_int2pos_function_symbol(const atermpp::aterm &e)
Recogniser for function Int2Pos.
Definition int1.h:429
const function_symbol & pos2int()
Constructor for function symbol Pos2Int.
Definition int1.h:357
const core::identifier_string & nat2int_name()
Generate identifier Nat2Int.
Definition int1.h:223
const data_expression & arg(const data_expression &e)
Function for projecting out argument. arg from an application.
Definition int1.h:1489
void make_minus(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol -.
Definition int1.h:1074
application negate(const data_expression &arg0)
Application of function symbol -.
Definition int1.h:753
bool is_cneg_function_symbol(const atermpp::aterm &e)
Recogniser for function @cNeg.
Definition int1.h:149
const core::identifier_string & int2pos_name()
Generate identifier Int2Pos.
Definition int1.h:409
function_symbol maximum(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:479
void make_cneg(data_expression &result, const data_expression &arg0)
Make an application of function symbol @cNeg.
Definition int1.h:173
application int2nat(const data_expression &arg0)
Application of function symbol Int2Nat.
Definition int1.h:319
function_symbol pred(const sort_expression &s0)
Definition int1.h:868
application plus(const data_expression &arg0, const data_expression &arg1)
Application of function symbol +.
Definition int1.h:999
const core::identifier_string & cneg_name()
Generate identifier @cNeg.
Definition int1.h:129
const core::identifier_string & exp_name()
Generate identifier exp.
Definition int1.h:1314
void make_exp(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol exp.
Definition int1.h:1377
const core::identifier_string & minimum_name()
Generate identifier min.
Definition int1.h:576
bool is_mod_application(const atermpp::aterm &e)
Recogniser for application of mod.
Definition int1.h:1306
const core::identifier_string & int_name()
Definition int1.h:35
bool is_mod_function_symbol(const atermpp::aterm &e)
Recogniser for function mod.
Definition int1.h:1269
application maximum(const data_expression &arg0, const data_expression &arg1)
Application of function symbol max.
Definition int1.h:547
application times(const data_expression &arg0, const data_expression &arg1)
Application of function symbol *.
Definition int1.h:1144
function_symbol_vector int_mCRL2_usable_mappings()
Give all system defined mappings that can be used in mCRL2 specs for int_.
Definition int1.h:1441
const core::identifier_string & pos2int_name()
Generate identifier Pos2Int.
Definition int1.h:347
const function_symbol & int2nat()
Constructor for function symbol Int2Nat.
Definition int1.h:295
bool is_int(const sort_expression &e)
Recogniser for sort expression Int.
Definition int1.h:54
function_symbol minus(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:1036
bool is_pred_application(const atermpp::aterm &e)
Recogniser for application of pred.
Definition int1.h:931
const function_symbol & nat2int()
Constructor for function symbol Nat2Int.
Definition int1.h:233
application div(const data_expression &arg0, const data_expression &arg1)
Application of function symbol div.
Definition int1.h:1221
bool is_times_application(const atermpp::aterm &e)
Recogniser for application of *.
Definition int1.h:1165
const core::identifier_string & maximum_name()
Generate identifier max.
Definition int1.h:471
bool is_int2nat_function_symbol(const atermpp::aterm &e)
Recogniser for function Int2Nat.
Definition int1.h:305
bool is_cneg_application(const atermpp::aterm &e)
Recogniser for application of @cNeg.
Definition int1.h:183
const core::identifier_string & succ_name()
Generate identifier succ.
Definition int1.h:781
const function_symbol & cneg()
Constructor for function symbol @cNeg.
Definition int1.h:139
void make_pos2int(data_expression &result, const data_expression &arg0)
Make an application of function symbol Pos2Int.
Definition int1.h:391
const function_symbol & abs()
Constructor for function symbol abs.
Definition int1.h:667
function_symbol exp(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:1322
bool is_cint_application(const atermpp::aterm &e)
Recogniser for application of @cInt.
Definition int1.h:121
bool is_times_function_symbol(const atermpp::aterm &e)
Recogniser for function *.
Definition int1.h:1128
bool is_plus_application(const atermpp::aterm &e)
Recogniser for application of +.
Definition int1.h:1020
const core::identifier_string & mod_name()
Generate identifier mod.
Definition int1.h:1250
void make_plus(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol +.
Definition int1.h:1010
data_equation_vector int_generate_equations_code()
Give all system defined equations for int_.
Definition int1.h:1522
application minus(const data_expression &arg0, const data_expression &arg1)
Application of function symbol -.
Definition int1.h:1063
function_symbol plus(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:947
application minimum(const data_expression &arg0, const data_expression &arg1)
Application of function symbol min.
Definition int1.h:628
const function_symbol & int2pos()
Constructor for function symbol Int2Pos.
Definition int1.h:419
const core::identifier_string & plus_name()
Generate identifier +.
Definition int1.h:939
function_symbol_vector int_generate_constructors_and_functions_code()
Give all system defined mappings and constructors for int_.
Definition int1.h:1428
void make_div(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol div.
Definition int1.h:1232
bool is_negate_application(const atermpp::aterm &e)
Recogniser for application of -.
Definition int1.h:773
function_symbol negate(const sort_expression &s0)
Definition int1.h:727
bool is_div_application(const atermpp::aterm &e)
Recogniser for application of div.
Definition int1.h:1242
void make_mod(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol mod.
Definition int1.h:1296
bool is_pos2int_function_symbol(const atermpp::aterm &e)
Recogniser for function Pos2Int.
Definition int1.h:367
function_symbol_vector int_generate_constructors_code()
Give all system defined constructors for int_.
Definition int1.h:190
bool is_abs_application(const atermpp::aterm &e)
Recogniser for application of abs.
Definition int1.h:711
void make_maximum(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol max.
Definition int1.h:558
function_symbol_vector int_mCRL2_usable_constructors()
Give all defined constructors which can be used in mCRL2 specs for int_.
Definition int1.h:201
application int2pos(const data_expression &arg0)
Application of function symbol Int2Pos.
Definition int1.h:443
function_symbol succ(const sort_expression &s0)
Definition int1.h:789
void make_negate(data_expression &result, const data_expression &arg0)
Make an application of function symbol -.
Definition int1.h:763
const core::identifier_string & negate_name()
Generate identifier -.
Definition int1.h:719
bool is_cint_function_symbol(const atermpp::aterm &e)
Recogniser for function @cInt.
Definition int1.h:87
void make_abs(data_expression &result, const data_expression &arg0)
Make an application of function symbol abs.
Definition int1.h:701
function_symbol_vector int_generate_functions_code()
Give all system defined mappings for int_.
Definition int1.h:1394
implementation_map int_cpp_implementable_constructors()
Give all system defined constructors which have an implementation in C++ and not in rewrite rules for...
Definition int1.h:214
bool is_exp_application(const atermpp::aterm &e)
Recogniser for application of exp.
Definition int1.h:1387
application mod(const data_expression &arg0, const data_expression &arg1)
Application of function symbol mod.
Definition int1.h:1285
void make_nat2int(data_expression &result, const data_expression &arg0)
Make an application of function symbol Nat2Int.
Definition int1.h:267
const function_symbol & cint()
Constructor for function symbol @cInt.
Definition int1.h:77
implementation_map int_cpp_implementable_mappings()
Give all system defined mappings that are to be implemented in C++ code for int_.
Definition int1.h:1478
application pos2int(const data_expression &arg0)
Application of function symbol Pos2Int.
Definition int1.h:381
bool is_nat2int_function_symbol(const atermpp::aterm &e)
Recogniser for function Nat2Int.
Definition int1.h:243
bool is_int2nat_application(const atermpp::aterm &e)
Recogniser for application of Int2Nat.
Definition int1.h:339
const core::identifier_string & minus_name()
Generate identifier -.
Definition int1.h:1028
function_symbol mod(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:1258
const core::identifier_string & int2nat_name()
Generate identifier Int2Nat.
Definition int1.h:285
const core::identifier_string & div_name()
Generate identifier div.
Definition int1.h:1173
bool is_maximum_function_symbol(const atermpp::aterm &e)
Recogniser for function max.
Definition int1.h:531
application exp(const data_expression &arg0, const data_expression &arg1)
Application of function symbol exp.
Definition int1.h:1366
bool is_div_function_symbol(const atermpp::aterm &e)
Recogniser for function div.
Definition int1.h:1205
application pred(const data_expression &arg0)
Application of function symbol pred.
Definition int1.h:911
bool is_negate_function_symbol(const atermpp::aterm &e)
Recogniser for function -.
Definition int1.h:738
void make_int2pos(data_expression &result, const data_expression &arg0)
Make an application of function symbol Int2Pos.
Definition int1.h:453
function_symbol times(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:1100
bool is_plus_function_symbol(const atermpp::aterm &e)
Recogniser for function +.
Definition int1.h:983
bool is_nat2int_application(const atermpp::aterm &e)
Recogniser for application of Nat2Int.
Definition int1.h:277
bool is_minus_application(const atermpp::aterm &e)
Recogniser for application of -.
Definition int1.h:1084
void make_times(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol *.
Definition int1.h:1155
function_symbol minimum(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:584
bool is_pred_function_symbol(const atermpp::aterm &e)
Recogniser for function pred.
Definition int1.h:896
function_symbol div(const sort_expression &s0, const sort_expression &s1)
Definition int1.h:1181
void make_succ(data_expression &result, const data_expression &arg0)
Make an application of function symbol succ.
Definition int1.h:842
bool is_pos2int_application(const atermpp::aterm &e)
Recogniser for application of Pos2Int.
Definition int1.h:401
void make_pred(data_expression &result, const data_expression &arg0)
Make an application of function symbol pred.
Definition int1.h:921
void make_cint(data_expression &result, const data_expression &arg0)
Make an application of function symbol @cInt.
Definition int1.h:111
void make_int2nat(data_expression &result, const data_expression &arg0)
Make an application of function symbol Int2Nat.
Definition int1.h:329
bool is_abs_function_symbol(const atermpp::aterm &e)
Recogniser for function abs.
Definition int1.h:677
const core::identifier_string & times_name()
Generate identifier *.
Definition int1.h:1092
const data_expression & left(const data_expression &e)
Function for projecting out argument. left from an application.
Definition int1.h:1501
bool is_succ_application(const atermpp::aterm &e)
Recogniser for application of succ.
Definition int1.h:852
const basic_sort & int_()
Constructor for sort expression Int.
Definition int1.h:44
Namespace for system defined sort nat.
const basic_sort & nat()
Constructor for sort expression Nat.
Definition nat1.h:43
Namespace for system defined sort pos.
const basic_sort & pos()
Constructor for sort expression Pos.
Definition pos1.h:42
function_sort make_function_sort_(const sort_expression &dom1, const sort_expression &codomain)
Convenience constructor for function sort with domain size 1.
bool is_function_symbol(const atermpp::aterm &x)
Returns true if the term t is a function symbol.
bool is_basic_sort(const atermpp::aterm &x)
Returns true if the term t is a basic sort.
function_sort make_function_sort_(const sort_expression &dom1, const sort_expression &dom2, const sort_expression &codomain)
Convenience constructor for function sort with domain size 2.