mCRL2
Loading...
Searching...
No Matches
pbes_expression.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9/// \file mcrl2/pbes/pbes_expression.h
10/// \brief The class pbes_expression.
11
12#ifndef MCRL2_PBES_PBES_EXPRESSION_H
13#define MCRL2_PBES_PBES_EXPRESSION_H
14
15#include "mcrl2/core/optimized_boolean_operators.h"
16#include "mcrl2/data/detail/data_sequence_algorithm.h"
17#include "mcrl2/pbes/propositional_variable.h"
18
19namespace mcrl2::pbes_system
20{
21
22//--- start generated classes ---//
23/// \\brief A pbes expression
25{
26 public:
27 /// \\brief Default constructor X3.
30 {}
31
32 /// \\brief Constructor Z9.
33 /// \\param term A term
34 explicit pbes_expression(const atermpp::aterm& term)
35 : atermpp::aterm(term)
36 {
37 assert(core::detail::check_rule_PBExpr(*this));
38 }
39
40 /// \\brief Constructor Z6.
43 {}
44
45 /// \\brief Constructor Z6.
48 {}
49
50 /// Move semantics
51 pbes_expression(const pbes_expression&) noexcept = default;
52 pbes_expression(pbes_expression&&) noexcept = default;
53 pbes_expression& operator=(const pbes_expression&) noexcept = default;
54 pbes_expression& operator=(pbes_expression&&) noexcept = default;
55};
56
57/// \\brief list of pbes_expressions
58using pbes_expression_list = atermpp::term_list<pbes_expression>;
59
60/// \\brief vector of pbes_expressions
62
63// prototypes
65inline bool is_not(const atermpp::aterm& x);
66inline bool is_and(const atermpp::aterm& x);
67inline bool is_or(const atermpp::aterm& x);
68inline bool is_imp(const atermpp::aterm& x);
69inline bool is_forall(const atermpp::aterm& x);
70inline bool is_exists(const atermpp::aterm& x);
71
72/// \\brief Test for a pbes_expression expression
73/// \\param x A term
74/// \\return True if \\a x is a pbes_expression expression
75inline
77{
87}
88
89// prototype declaration
90std::string pp(const pbes_expression& x, bool precedence_aware = true);
91
92/// \\brief Outputs the object to a stream
93/// \\param out An output stream
94/// \\param x Object x
95/// \\return The output stream
96inline
98{
99 return out << pbes_system::pp(x);
100}
101
102/// \\brief swap overload
103inline void swap(pbes_expression& t1, pbes_expression& t2) noexcept
104{
105 t1.swap(t2);
106}
107
108
109/// \\brief A propositional variable instantiation
111{
112 public:
113
114
115 /// Move semantics
120
121 const core::identifier_string& name() const
122 {
123 return atermpp::down_cast<core::identifier_string>((*this)[0]);
124 }
125
126 const data::data_expression_list& parameters() const
127 {
128 return atermpp::down_cast<data::data_expression_list>((*this)[1]);
129 }
130//--- start user section propositional_variable_instantiation ---//
131 /// \brief Default constructor.
134 {}
135
136 /// \brief Constructor.
137 /// \param term A term
140 {
141 assert(core::detail::check_term_PropVarInst(*this));
142 }
143
144 /// \brief Constructor.
145 explicit propositional_variable_instantiation(const core::identifier_string& name, const data::data_expression_list& parameters)
146 {
147 atermpp::make_term_appl(*this,core::detail::function_symbol_PropVarInst(), name, parameters);
148 }
149
150 /// \brief Constructor.
151 explicit propositional_variable_instantiation(const std::string& name, const data::data_expression_list& parameters)
153 {
154 }
155
156 /// \brief Constructor.
157 explicit propositional_variable_instantiation(const core::identifier_string& name)
158 : propositional_variable_instantiation(name, data::data_expression_list())
159 {
160 }
161
162 /// \brief Constructor.
163 explicit propositional_variable_instantiation(const std::string& name)
165 {
166 }
167
168//--- end user section propositional_variable_instantiation ---//
169};
170
171/// \\brief The function make_propositional_variable_instantiation constructs a new term into a given address.
172/// \\ \param t The reference into which the new propositional_variable_instantiation is constructed.
173template <class... ARGUMENTS>
174inline void make_propositional_variable_instantiation(atermpp::aterm& t, const ARGUMENTS&... args)
175{
176 atermpp::make_term_appl(t, core::detail::function_symbol_PropVarInst(), args...);
177}
178
179/// \\brief list of propositional_variable_instantiations
180using propositional_variable_instantiation_list = atermpp::term_list<propositional_variable_instantiation>;
181
182/// \\brief vector of propositional_variable_instantiations
184
185/// \\brief Test for a propositional_variable_instantiation expression
186/// \\param x A term
187/// \\return True if \\a x is a propositional_variable_instantiation expression
188inline
190{
191 return x.function() == core::detail::function_symbols::PropVarInst;
192}
193
194// prototype declaration
196
197/// \\brief Outputs the object to a stream
198/// \\param out An output stream
199/// \\param x Object x
200/// \\return The output stream
201inline
203{
204 return out << pbes_system::pp(x);
205}
206
207/// \\brief swap overload
209{
210 t1.swap(t2);
211}
212
213
214/// \\brief The not operator for pbes expressions
216{
217 public:
218 /// \\brief Default constructor X3.
221 {}
222
223 /// \\brief Constructor Z9.
224 /// \\param term A term
225 explicit not_(const atermpp::aterm& term)
227 {
228 assert(core::detail::check_term_PBESNot(*this));
229 }
230
231 /// \\brief Constructor Z14.
232 explicit not_(const pbes_expression& operand)
234 {}
235
236 /// Move semantics
237 not_(const not_&) noexcept = default;
238 not_(not_&&) noexcept = default;
239 not_& operator=(const not_&) noexcept = default;
240 not_& operator=(not_&&) noexcept = default;
241
243 {
244 return atermpp::down_cast<pbes_expression>((*this)[0]);
245 }
246};
247
248/// \\brief The function make_not constructs a new term into a given address.
249/// \\ \param t The reference into which the new not is constructed.
250template <class... ARGUMENTS>
251inline void make_not(atermpp::aterm& t, const ARGUMENTS&... args)
252{
253 atermpp::make_term_appl(t, core::detail::function_symbol_PBESNot(), args...);
254}
255
256/// \\brief Test for a not expression
257/// \\param x A term
258/// \\return True if \\a x is a not expression
259inline
260bool is_not(const atermpp::aterm& x)
261{
262 return x.function() == core::detail::function_symbols::PBESNot;
263}
264
265// prototype declaration
266std::string pp(const not_& x, bool precedence_aware = true);
267
268/// \\brief Outputs the object to a stream
269/// \\param out An output stream
270/// \\param x Object x
271/// \\return The output stream
272inline
274{
275 return out << pbes_system::pp(x);
276}
277
278/// \\brief swap overload
279inline void swap(not_& t1, not_& t2) noexcept
280{
281 t1.swap(t2);
282}
283
284
285/// \\brief The and operator for pbes expressions
287{
288 public:
289 /// \\brief Default constructor X3.
292 {}
293
294 /// \\brief Constructor Z9.
295 /// \\param term A term
296 explicit and_(const atermpp::aterm& term)
298 {
299 assert(core::detail::check_term_PBESAnd(*this));
300 }
301
302 /// \\brief Constructor Z14.
303 and_(const pbes_expression& left, const pbes_expression& right)
305 {}
306
307 /// Move semantics
308 and_(const and_&) noexcept = default;
309 and_(and_&&) noexcept = default;
310 and_& operator=(const and_&) noexcept = default;
311 and_& operator=(and_&&) noexcept = default;
312
313 const pbes_expression& left() const
314 {
315 return atermpp::down_cast<pbes_expression>((*this)[0]);
316 }
317
318 const pbes_expression& right() const
319 {
320 return atermpp::down_cast<pbes_expression>((*this)[1]);
321 }
322};
323
324/// \\brief The function make_and constructs a new term into a given address.
325/// \\ \param t The reference into which the new and is constructed.
326template <class... ARGUMENTS>
327inline void make_and(atermpp::aterm& t, const ARGUMENTS&... args)
328{
329 atermpp::make_term_appl(t, core::detail::function_symbol_PBESAnd(), args...);
330}
331
332/// \\brief Test for a and expression
333/// \\param x A term
334/// \\return True if \\a x is a and expression
335inline
336bool is_and(const atermpp::aterm& x)
337{
338 return x.function() == core::detail::function_symbols::PBESAnd;
339}
340
341// prototype declaration
342std::string pp(const and_& x, bool precedence_aware = true);
343
344/// \\brief Outputs the object to a stream
345/// \\param out An output stream
346/// \\param x Object x
347/// \\return The output stream
348inline
350{
351 return out << pbes_system::pp(x);
352}
353
354/// \\brief swap overload
355inline void swap(and_& t1, and_& t2) noexcept
356{
357 t1.swap(t2);
358}
359
360
361/// \\brief The or operator for pbes expressions
362class or_: public pbes_expression
363{
364 public:
365 /// \\brief Default constructor X3.
368 {}
369
370 /// \\brief Constructor Z9.
371 /// \\param term A term
372 explicit or_(const atermpp::aterm& term)
374 {
375 assert(core::detail::check_term_PBESOr(*this));
376 }
377
378 /// \\brief Constructor Z14.
379 or_(const pbes_expression& left, const pbes_expression& right)
381 {}
382
383 /// Move semantics
384 or_(const or_&) noexcept = default;
385 or_(or_&&) noexcept = default;
386 or_& operator=(const or_&) noexcept = default;
387 or_& operator=(or_&&) noexcept = default;
388
389 const pbes_expression& left() const
390 {
391 return atermpp::down_cast<pbes_expression>((*this)[0]);
392 }
393
394 const pbes_expression& right() const
395 {
396 return atermpp::down_cast<pbes_expression>((*this)[1]);
397 }
398};
399
400/// \\brief The function make_or constructs a new term into a given address.
401/// \\ \param t The reference into which the new or is constructed.
402template <class... ARGUMENTS>
403inline void make_or(atermpp::aterm& t, const ARGUMENTS&... args)
404{
405 atermpp::make_term_appl(t, core::detail::function_symbol_PBESOr(), args...);
406}
407
408/// \\brief Test for a or expression
409/// \\param x A term
410/// \\return True if \\a x is a or expression
411inline
412bool is_or(const atermpp::aterm& x)
413{
414 return x.function() == core::detail::function_symbols::PBESOr;
415}
416
417// prototype declaration
418std::string pp(const or_& x, bool precedence_aware = true);
419
420/// \\brief Outputs the object to a stream
421/// \\param out An output stream
422/// \\param x Object x
423/// \\return The output stream
424inline
426{
427 return out << pbes_system::pp(x);
428}
429
430/// \\brief swap overload
431inline void swap(or_& t1, or_& t2) noexcept
432{
433 t1.swap(t2);
434}
435
436
437/// \\brief The implication operator for pbes expressions
438class imp: public pbes_expression
439{
440 public:
441 /// \\brief Default constructor X3.
444 {}
445
446 /// \\brief Constructor Z9.
447 /// \\param term A term
448 explicit imp(const atermpp::aterm& term)
450 {
451 assert(core::detail::check_term_PBESImp(*this));
452 }
453
454 /// \\brief Constructor Z14.
455 imp(const pbes_expression& left, const pbes_expression& right)
457 {}
458
459 /// Move semantics
460 imp(const imp&) noexcept = default;
461 imp(imp&&) noexcept = default;
462 imp& operator=(const imp&) noexcept = default;
463 imp& operator=(imp&&) noexcept = default;
464
465 const pbes_expression& left() const
466 {
467 return atermpp::down_cast<pbes_expression>((*this)[0]);
468 }
469
470 const pbes_expression& right() const
471 {
472 return atermpp::down_cast<pbes_expression>((*this)[1]);
473 }
474};
475
476/// \\brief The function make_imp constructs a new term into a given address.
477/// \\ \param t The reference into which the new imp is constructed.
478template <class... ARGUMENTS>
479inline void make_imp(atermpp::aterm& t, const ARGUMENTS&... args)
480{
481 atermpp::make_term_appl(t, core::detail::function_symbol_PBESImp(), args...);
482}
483
484/// \\brief Test for a imp expression
485/// \\param x A term
486/// \\return True if \\a x is a imp expression
487inline
488bool is_imp(const atermpp::aterm& x)
489{
490 return x.function() == core::detail::function_symbols::PBESImp;
491}
492
493// prototype declaration
494std::string pp(const imp& x, bool precedence_aware = true);
495
496/// \\brief Outputs the object to a stream
497/// \\param out An output stream
498/// \\param x Object x
499/// \\return The output stream
500inline
502{
503 return out << pbes_system::pp(x);
504}
505
506/// \\brief swap overload
507inline void swap(imp& t1, imp& t2) noexcept
508{
509 t1.swap(t2);
510}
511
512
513/// \\brief The universal quantification operator for pbes expressions
515{
516 public:
517 /// \\brief Default constructor X3.
520 {}
521
522 /// \\brief Constructor Z9.
523 /// \\param term A term
524 explicit forall(const atermpp::aterm& term)
526 {
527 assert(core::detail::check_term_PBESForall(*this));
528 }
529
530 /// \\brief Constructor Z14.
531 forall(const data::variable_list& variables, const pbes_expression& body)
533 {}
534
535 /// Move semantics
536 forall(const forall&) noexcept = default;
537 forall(forall&&) noexcept = default;
538 forall& operator=(const forall&) noexcept = default;
539 forall& operator=(forall&&) noexcept = default;
540
541 const data::variable_list& variables() const
542 {
543 return atermpp::down_cast<data::variable_list>((*this)[0]);
544 }
545
546 const pbes_expression& body() const
547 {
548 return atermpp::down_cast<pbes_expression>((*this)[1]);
549 }
550};
551
552/// \\brief The function make_forall constructs a new term into a given address.
553/// \\ \param t The reference into which the new forall is constructed.
554template <class... ARGUMENTS>
555inline void make_forall(atermpp::aterm& t, const ARGUMENTS&... args)
556{
557 atermpp::make_term_appl(t, core::detail::function_symbol_PBESForall(), args...);
558}
559
560/// \\brief Test for a forall expression
561/// \\param x A term
562/// \\return True if \\a x is a forall expression
563inline
564bool is_forall(const atermpp::aterm& x)
565{
566 return x.function() == core::detail::function_symbols::PBESForall;
567}
568
569// prototype declaration
570std::string pp(const forall& x, bool precedence_aware = true);
571
572/// \\brief Outputs the object to a stream
573/// \\param out An output stream
574/// \\param x Object x
575/// \\return The output stream
576inline
578{
579 return out << pbes_system::pp(x);
580}
581
582/// \\brief swap overload
583inline void swap(forall& t1, forall& t2) noexcept
584{
585 t1.swap(t2);
586}
587
588
589/// \\brief The existential quantification operator for pbes expressions
591{
592 public:
593 /// \\brief Default constructor X3.
596 {}
597
598 /// \\brief Constructor Z9.
599 /// \\param term A term
600 explicit exists(const atermpp::aterm& term)
602 {
603 assert(core::detail::check_term_PBESExists(*this));
604 }
605
606 /// \\brief Constructor Z14.
607 exists(const data::variable_list& variables, const pbes_expression& body)
609 {}
610
611 /// Move semantics
612 exists(const exists&) noexcept = default;
613 exists(exists&&) noexcept = default;
614 exists& operator=(const exists&) noexcept = default;
615 exists& operator=(exists&&) noexcept = default;
616
617 const data::variable_list& variables() const
618 {
619 return atermpp::down_cast<data::variable_list>((*this)[0]);
620 }
621
622 const pbes_expression& body() const
623 {
624 return atermpp::down_cast<pbes_expression>((*this)[1]);
625 }
626};
627
628/// \\brief The function make_exists constructs a new term into a given address.
629/// \\ \param t The reference into which the new exists is constructed.
630template <class... ARGUMENTS>
631inline void make_exists(atermpp::aterm& t, const ARGUMENTS&... args)
632{
633 atermpp::make_term_appl(t, core::detail::function_symbol_PBESExists(), args...);
634}
635
636/// \\brief Test for a exists expression
637/// \\param x A term
638/// \\return True if \\a x is a exists expression
639inline
640bool is_exists(const atermpp::aterm& x)
641{
642 return x.function() == core::detail::function_symbols::PBESExists;
643}
644
645// prototype declaration
646std::string pp(const exists& x, bool precedence_aware = true);
647
648/// \\brief Outputs the object to a stream
649/// \\param out An output stream
650/// \\param x Object x
651/// \\return The output stream
652inline
654{
655 return out << pbes_system::pp(x);
656}
657
658/// \\brief swap overload
659inline void swap(exists& t1, exists& t2) noexcept
660{
661 t1.swap(t2);
662}
663//--- end generated classes ---//
664
665// template function overloads
666std::string pp(const pbes_expression_list& x, bool precedence_aware = true);
673bool search_variable(const pbes_system::pbes_expression& x, const data::variable& v);
676
677/// \return Returns the value true
678inline
680{
681 /* The dynamic cast is required, to prevent copying the data term true to
682 a local term on the stack. */
683 return reinterpret_cast<const pbes_expression&>(data::sort_bool::true_());
684}
685
686/// \return Returns the value false
687inline
689{
690 /* The dynamic cast is required, to prevent copying the data term false to
691 a local term on the stack. */
692 return reinterpret_cast<const pbes_expression&>(data::sort_bool::false_());
693}
694
695/// \brief Test for the value true
696/// \param t A PBES expression
697/// \return True if it is the value \p true
698inline bool is_true(const pbes_expression& t)
699{
701}
702
703/// \brief Test for the value false
704/// \param t A PBES expression
705/// \return True if it is the value \p false
706inline bool is_false(const pbes_expression& t)
707{
709}
710
711/// \brief Returns true if the term t is a not expression
712/// \param t A PBES expression
713/// \return True if the term t is a not expression
714inline bool is_pbes_not(const pbes_expression& t)
715{
716 return pbes_system::is_not(t);
717}
718
719/// \brief Returns true if the term t is an and expression
720/// \param t A PBES expression
721/// \return True if the term t is an and expression
722inline bool is_pbes_and(const pbes_expression& t)
723{
724 return pbes_system::is_and(t);
725}
726
727/// \brief Returns true if the term t is an or expression
728/// \param t A PBES expression
729/// \return True if the term t is an or expression
730inline bool is_pbes_or(const pbes_expression& t)
731{
732 return pbes_system::is_or(t);
733}
734
735/// \brief Returns true if the term t is an imp expression
736/// \param t A PBES expression
737/// \return True if the term t is an imp expression
738inline bool is_pbes_imp(const pbes_expression& t)
739{
740 return pbes_system::is_imp(t);
741}
742
743/// \brief Returns true if the term t is a universal quantification
744/// \param t A PBES expression
745/// \return True if the term t is a universal quantification
746inline bool is_pbes_forall(const pbes_expression& t)
747{
749}
750
751/// \brief Returns true if the term t is an existential quantification
752/// \param t A PBES expression
753/// \return True if the term t is an existential quantification
754inline bool is_pbes_exists(const pbes_expression& t)
755{
757}
758
759/// \brief Test for a conjunction
760/// \param t A PBES expression or a data expression
761/// \return True if it is a conjunction
763{
765}
766
767/// \brief Test for a conjunction
768/// \param t A PBES expression or a data expression
769/// \return True if it is a conjunction
771{
773}
774
775/// \brief Test for a disjunction
776/// \param t A PBES expression or a data expression
777/// \return True if it is a disjunction
778inline bool is_universal_or(const pbes_expression& t)
779{
781}
782
783/// \brief Returns true if the term t is a data expression
784/// \param t A PBES expression
785/// \return True if the term t is a data expression
786inline bool is_data(const pbes_expression& t)
787{
789}
790
791/// \brief The namespace for accessor functions on pbes expressions.
792namespace accessors
793{
794
795/// \brief Returns the pbes expression argument of expressions of type not, exists and forall.
796/// \param t A PBES expression
797/// \return The pbes expression argument of expressions of type not, exists and forall.
798inline
800{
801 if (is_pbes_not(t))
802 {
803 return atermpp::down_cast<const pbes_expression>(t[0]);
804 }
805 else
806 {
807 assert(is_forall(t) || is_exists(t));
808 return atermpp::down_cast<const pbes_expression>(t[1]);
809 }
810}
811
812/// \brief Returns the pbes expression argument of expressions of type not, exists and forall.
813/// \param t A PBES expression or a data expression
814/// \return The pbes expression argument of expressions of type not, exists and forall.
815inline
817{
819 {
820 assert(data::is_application(t));
821 const data::application& a = atermpp::down_cast<const data::application>(t);
822 return atermpp::down_cast<pbes_expression>(*(a.begin()));
823 }
824 else
825 {
826 return arg(t);
827 }
828}
829
830/// \brief Returns the left hand side of an expression of type and, or or imp.
831/// \param t A PBES expression
832/// \return The left hand side of an expression of type and, or or imp.
833inline
835{
836 assert(is_and(t) || is_or(t) || is_imp(t));
837 return atermpp::down_cast<pbes_expression>(t[0]);
838}
839
840/// \brief Returns the left hand side of an expression of type and, or or imp.
841/// \param x A PBES expression or a data expression
842/// \return The left hand side of an expression of type and, or or imp.
843inline
845{
847 {
848 return atermpp::down_cast<pbes_expression>(data::binary_left(atermpp::down_cast<data::application>(x)));
849 }
850 else
851 {
852 return left(x);
853 }
854}
855
856/// \brief Returns the right hand side of an expression of type and, or or imp.
857/// \param t A PBES expression
858/// \return The right hand side of an expression of type and, or or imp.
859inline
861{
862 return atermpp::down_cast<pbes_expression>(t[1]);
863}
864
865/// \brief Returns the left hand side of an expression of type and, or or imp.
866/// \param x A PBES expression or a data expression
867/// \return The left hand side of an expression of type and, or or imp.
868inline
870{
872 {
873 return atermpp::down_cast<pbes_expression>(data::binary_right(atermpp::down_cast<data::application>(x)));
874 }
875 else
876 {
877 return right(x);
878 }
879}
880
881/// \brief Returns the variables of a quantification expression
882/// \param t A PBES expression
883/// \return The variables of a quantification expression
884inline
885const data::variable_list& var(const pbes_expression& t)
886{
887 assert(is_forall(t) || is_exists(t));
888 return atermpp::down_cast<data::variable_list>(t[0]);
889}
890
891/// \brief Returns the name of a propositional variable expression
892/// \param t A PBES expression
893/// \return The name of a propositional variable expression
894inline
895const core::identifier_string& name(const pbes_expression& t)
896{
898 return atermpp::down_cast<core::identifier_string>(t[0]);
899}
900
901/// \brief Returns the parameters of a propositional variable instantiation.
902/// \param t A PBES expression
903/// \return The parameters of a propositional variable instantiation.
904inline
905const data::data_expression_list& param(const pbes_expression& t)
906{
908 return atermpp::down_cast<data::data_expression_list>(t[1]);
909}
910} // namespace accessors
911
912///
913/// \brief Make a negation
914/// \param result Placeholder for the resulting PBES expression <tt>!p</tt>. This is more efficient than delivering it as the result of a function.
915/// \param p A PBES expression
916inline
918{
919 core::make_optimized_not(result, p);
920}
921
922/// \brief Make a negation
923/// \param p A PBES expression
924/// \return The value <tt>!p</tt>
925inline
927{
928 return core::optimized_not(p);
929}
930
931/// \brief Make a conjunction
932/// \param result Placeholder for the resulting PBES expression <tt>p && q</tt>. This is more efficient than delivering it as the result of a function.
933/// \param p A PBES expression
934/// \param q A PBES expression
935/// \post result is the optimized negation of <tt>!p</tt>
936inline
938{
939 core::make_optimized_and(result, p, q);
940}
941
942/// \brief Make a conjunction
943/// \param p A PBES expression
944/// \param q A PBES expression
945/// \post result is the optimized conjunction of <tt>p && q</tt>
946inline
948{
949 return core::optimized_and(p, q);
950}
951
952/// \brief Make a disjunction
953/// \param result Placeholder for the resulting PBES expression <tt>p || q</tt>. This is more efficient than delivering it as the result of a function.
954/// \param p A PBES expression
955/// \param q A PBES expression
956inline
958{
959 core::make_optimized_or(result, p, q);
960}
961
962/// \brief Make a disjunction
963/// \param result Placeholder for the resulting PBES expression <tt>p || q</tt>. This is more efficient than delivering it as the result of a function.
964/// \param p A PBES expression
965/// \param q A PBES expression
966/// \return The value <tt>p || q</tt>
967inline
969{
970 return core::optimized_or(p, q);
971}
972
973/// \brief Make an implication
974/// \param result Placeholder for the resulting PBES expression <tt>p => q</tt>. This is more efficient than delivering it as the result of a function.
975/// \param p A PBES expression
976/// \param q A PBES expression
977inline
979{
980 core::make_optimized_imp(result, p, q);
981}
982
983/// \brief Make a disjunction
984/// \param p A PBES expression
985/// \param q A PBES expression
986/// \return The value <tt>p => q</tt>
987inline
989{
990 return core::optimized_imp(p, q);
991}
992
993/// \brief Make a universal quantification
994/// If l is empty, p is returned.
995/// \param result The placeholder to which the optimised existential quantification is assigned.
996/// \param l A sequence of data variables
997/// \param p A PBES expression
998/// \param remove_variables If true variables not occurring in p will be removed. This requires complexity in the size of p.
999/// \post result is the optimized universal quantification <tt>forall l.p</tt>
1000inline
1001void make_optimized_forall(pbes_expression& result, const data::variable_list& l, const pbes_expression& p, bool remove_variables = false)
1002{
1003 core::make_optimized_forall(result, l, p, remove_variables);
1004}
1005
1006/// \brief Make a universal quantification
1007/// If l is empty, p is returned.
1008/// \param l A sequence of data variables
1009/// \param p A PBES expression
1010/// \param remove_variables If true variables not occurring in p will be removed. This requires complexity in the size of p.
1011/// \return The value <tt>forall l.p</tt>
1012inline
1013pbes_expression optimized_forall(const data::variable_list& l, const pbes_expression& p, bool remove_variables = false)
1014{
1015 return core::optimized_forall(l, p, remove_variables);
1016}
1017
1018/// \brief Make an optimized existential quantification. If l is empty, p is returned.
1019/// \param result The placeholder to which the optimised existential quantification is assigned.
1020/// \param l A sequence of data variables
1021/// \param p A PBES expression
1022/// \param remove_variables If true variables not occurring in p will be removed. This requires complexity in the size of p.
1023inline
1024void make_optimized_exists(pbes_expression& result, const data::variable_list& l, const pbes_expression& p, bool remove_variables = false)
1025{
1026 core::make_optimized_exists(result, l, p, remove_variables);
1027}
1028
1029/// \brief Make an existential quantification
1030/// If l is empty, p is returned.
1031/// \param l A sequence of data variables
1032/// \param p A PBES expression
1033/// \param remove_variables If true variables not occurring in p will be removed. This requires complexity in the size of p.
1034/// \post result is the optimized existential quantification <tt>exists l.p</tt>
1035inline
1036pbes_expression optimized_exists(const data::variable_list& l, const pbes_expression& p, bool remove_variables = false)
1037{
1038 return core::optimized_exists(l, p, remove_variables);
1039}
1040
1041inline
1043{
1044 return find_free_variables(x).empty();
1045}
1046
1047inline
1048const data::variable_list& quantifier_variables(const pbes_expression& x)
1049{
1050 assert(is_exists(x) || is_forall(x));
1051 if (is_exists(x))
1052 {
1053 return atermpp::down_cast<exists>(x).variables();
1054 }
1055 else
1056 {
1057 return atermpp::down_cast<forall>(x).variables();
1058 }
1059}
1060
1061inline
1062data::variable_list free_variables(const pbes_expression& x)
1063{
1064 std::set<data::variable> v = find_free_variables(x);
1065 return data::variable_list(v.begin(), v.end());
1066}
1067
1068} // namespace mcrl2::pbes_system
1069
1070namespace mcrl2::core
1071{
1072
1073/// \brief Contains type information for pbes expressions.
1074template <>
1075struct term_traits<pbes_system::pbes_expression>
1076{
1077 /// \brief The term type
1078 using term_type = pbes_system::pbes_expression;
1079
1080 /// \brief The data term type
1081 using data_term_type = data::data_expression;
1082
1083 /// \brief The data term sequence type
1084 using data_term_sequence_type = data::data_expression_list;
1085
1086 /// \brief The variable type
1087 using variable_type = data::variable;
1088
1089 /// \brief The variable sequence type
1090 using variable_sequence_type = data::variable_list;
1091
1092 /// \brief The propositional variable declaration type
1093 using propositional_variable_decl_type = pbes_system::propositional_variable;
1094
1095 /// \brief The propositional variable instantiation type
1096 using propositional_variable_type = pbes_system::propositional_variable_instantiation;
1097
1098 /// \brief The string type
1099 using string_type = core::identifier_string;
1100
1101 /// \brief Make the value true
1102 /// \return The value \p true
1103 static inline
1104 term_type true_()
1105 {
1106 return pbes_system::true_();
1107 }
1108
1109 /// \brief Make the value false
1110 /// \return The value \p false
1111 static inline
1112 term_type false_()
1113 {
1114 return pbes_system::false_();
1115 }
1116
1117 /// \brief Make a negation
1118 /// \param p A term
1119 /// \return The value <tt>!p</tt>
1120 static inline
1121 term_type not_(const term_type& p)
1122 {
1123 return pbes_system::not_(p);
1124 }
1125
1126 /// \brief Make a negation
1127 /// \param result The value <tt>!p</tt>
1128 /// \param p A term
1129 static inline
1130 void make_not(term_type& result, const term_type& p)
1131 {
1132 pbes_system::make_not(result, p);
1133 }
1134
1135 /// \brief Make a conjunction
1136 /// \param p A term
1137 /// \param q A term
1138 /// \return The value <tt>p && q</tt>
1139 static inline
1140 term_type and_(const term_type& p, const term_type& q)
1141 {
1142 return pbes_system::and_(p, q);
1143 }
1144
1145 /// \brief Make a conjunction
1146 /// \param result The value <tt>p && q</tt>
1147 /// \param p A term
1148 /// \param q A term
1149 static inline
1150 void make_and(term_type& result, const term_type& p, const term_type& q)
1151 {
1152 pbes_system::make_and(result, p, q);
1153 }
1154
1155 /// \brief Make a disjunction
1156 /// \param p A term
1157 /// \param q A term
1158 /// \return The value <tt>p || q</tt>
1159 static inline
1160 term_type or_(const term_type& p, const term_type& q)
1161 {
1162 return pbes_system::or_(p, q);
1163 }
1164
1165 /// \brief Make a disjunction
1166 /// \param result The value <tt>p || q</tt>
1167 /// \param p A term
1168 /// \param q A term
1169 static inline
1170 void make_or(term_type& result, const term_type& p, const term_type& q)
1171 {
1172 pbes_system::make_or(result, p,q);
1173 }
1174
1175 template <typename FwdIt>
1176 static inline
1177 term_type join_or(FwdIt first, FwdIt last)
1178 {
1179 return utilities::detail::join(first, last, or_, false_());
1180 }
1181
1182 template <typename FwdIt>
1183 static inline
1184 term_type join_and(FwdIt first, FwdIt last)
1185 {
1186 return utilities::detail::join(first, last, and_, true_());
1187 }
1188
1189 /// \brief Make an implication
1190 /// \param p A term
1191 /// \param q A term
1192 /// \return The value <tt>p => q</tt>
1193 static inline
1194 term_type imp(const term_type& p, const term_type& q)
1195 {
1196 return pbes_system::imp(p, q);
1197 }
1198
1199 /// \brief Make an implication
1200 /// \param result The value <tt>p => q</tt>
1201 /// \param p A term
1202 /// \param q A term
1203 static inline
1204 void make_imp(term_type& result, const term_type& p, const term_type& q)
1205 {
1206 pbes_system::make_imp(result, p, q);
1207 }
1208
1209 /// \brief Make a universal quantification
1210 /// \param l A sequence of variables
1211 /// \param p A term
1212 /// \return The value <tt>forall l.p</tt>
1213 static inline
1214 term_type forall(const variable_sequence_type& l, const term_type& p)
1215 {
1216 if (l.empty())
1217 {
1218 return p;
1219 }
1220 return pbes_system::forall(l, p);
1221 }
1222
1223 /// \brief Make a universal quantification
1224 /// \param result The value <tt>forall l.p</tt>
1225 /// \param l A sequence of variables
1226 /// \param p A term
1227 static inline
1228 void make_forall(term_type& result, const variable_sequence_type& l, const term_type& p)
1229 {
1230 if (l.empty())
1231 {
1232 result = p;
1233 return;
1234 }
1235 pbes_system::make_forall(result, l, p);
1236 }
1237
1238 /// \brief Make an existential quantification
1239 /// \param l A sequence of variables
1240 /// \param p A term
1241 /// \return The value <tt>exists l.p</tt>
1242 static inline
1243 term_type exists(const variable_sequence_type& l, const term_type& p)
1244 {
1245 if (l.empty())
1246 {
1247 return p;
1248 }
1249 return pbes_system::exists(l, p);
1250 }
1251
1252 /// \brief Make an existential quantification
1253 /// \param result The value <tt>exists l.p</tt>
1254 /// \param l A sequence of variables
1255 /// \param p A term
1256 static inline
1257 void make_exists(term_type& result, const variable_sequence_type& l, const term_type& p)
1258 {
1259 if (l.empty())
1260 {
1261 result = p;
1262 return;
1263 }
1264 pbes_system::make_exists(result, l, p);
1265 }
1266
1267 /// \brief Test for the value true
1268 /// \param t A term
1269 /// \return True if it is the value \p true
1270 static inline
1271 bool is_true(const term_type& t)
1272 {
1274 }
1275
1276 /// \brief Test for the value false
1277 /// \param t A term
1278 /// \return True if it is the value \p false
1279 static inline
1280 bool is_false(const term_type& t)
1281 {
1283 }
1284
1285 /// \brief Test for a negation
1286 /// \param t A term
1287 /// \return True if it is a negation
1288 static inline
1289 bool is_not(const term_type& t)
1290 {
1291 return pbes_system::is_not(t);
1292 }
1293
1294 /// \brief Test for a conjunction
1295 /// \param t A term
1296 /// \return True if it is a conjunction
1297 static inline
1298 bool is_and(const term_type& t)
1299 {
1300 return pbes_system::is_and(t);
1301 }
1302
1303 /// \brief Test for a disjunction
1304 /// \param t A term
1305 /// \return True if it is a disjunction
1306 static inline
1307 bool is_or(const term_type& t)
1308 {
1309 return pbes_system::is_or(t);
1310 }
1311
1312 /// \brief Test for an implication
1313 /// \param t A term
1314 /// \return True if it is an implication
1315 static inline
1316 bool is_imp(const term_type& t)
1317 {
1318 return pbes_system::is_imp(t);
1319 }
1320
1321 /// \brief Test for an universal quantification
1322 /// \param t A term
1323 /// \return True if it is a universal quantification
1324 static inline
1325 bool is_forall(const term_type& t)
1326 {
1328 }
1329
1330 /// \brief Test for an existential quantification
1331 /// \param t A term
1332 /// \return True if it is an existential quantification
1333 static inline
1334 bool is_exists(const term_type& t)
1335 {
1337 }
1338
1339 /// \brief Test for data term
1340 /// \param t A term
1341 /// \return True if the term is a data term
1342 static inline
1343 bool is_data(const term_type& t)
1344 {
1346 }
1347
1348 /// \brief Test for propositional variable instantiation
1349 /// \param t A term
1350 /// \return True if the term is a propositional variable instantiation
1351 static inline
1352 bool is_prop_var(const term_type& t)
1353 {
1355 }
1356
1357 /// \brief Returns the left argument of a term of type and, or or imp
1358 /// \param t A term
1359 /// \return The left argument of the term. Also works for data terms
1360 static inline
1361 term_type left(const term_type& t)
1362 {
1364 }
1365
1366 /// \brief Returns the right argument of a term of type and, or or imp
1367 /// \param t A term
1368 /// \return The right argument of the term. Also works for data terms
1369 static inline
1370 term_type right(const term_type& t)
1371 {
1373 }
1374
1375 /// \brief Returns the argument of a term of type not
1376 /// \param t A term
1377 static inline
1378 const term_type& not_arg(const term_type& t)
1379 {
1380 assert(is_pbes_not(t));
1381 return atermpp::down_cast<term_type>(t[0]);
1382 }
1383
1384 /// \brief Returns the quantifier variables of a quantifier expression
1385 /// \param t A term
1386 /// \return The requested argument. Doesn't work for data terms
1387 static inline
1388 const variable_sequence_type& var(const term_type& t)
1389 {
1390 // Forall and exists are not fully supported by the data library
1393 assert(is_exists(t) || is_forall(t));
1394
1395 return atermpp::down_cast<variable_sequence_type>(t[0]);
1396 }
1397
1398 /// \brief Returns the name of a propositional variable instantiation
1399 /// \param t A term
1400 /// \return The name of the propositional variable instantiation
1401 static inline
1402 const string_type &name(const term_type& t)
1403 {
1404 assert(is_prop_var(t));
1405 return atermpp::down_cast<string_type>(t[0]);
1406 }
1407
1408 /// \brief Returns the parameter list of a propositional variable instantiation
1409 /// \param t A term
1410 /// \return The parameter list of the propositional variable instantiation
1411 static inline
1412 const data_term_sequence_type &param(const term_type& t)
1413 {
1414 assert(is_prop_var(t));
1415 return atermpp::down_cast<data_term_sequence_type>(t[1]);
1416 }
1417
1418 /// \brief Conversion from variable to term
1419 /// \param v A variable
1420 /// \return The converted variable
1421 static inline
1422 const term_type& variable2term(const variable_type& v)
1423 {
1424 return atermpp::down_cast<term_type>(v);
1425 }
1426
1427 /// \brief Test if a term is a variable
1428 /// \param t A term
1429 /// \return True if the term is a variable
1430 static inline
1431 bool is_variable(const term_type& t)
1432 {
1433 return data::is_variable(t);
1434 }
1435
1436 /// \brief Pretty print function
1437 /// \param t A term
1438 /// \return Returns a pretty print representation of the term
1439 static inline
1440 std::string pp(const term_type& t)
1441 {
1442 return pbes_system::pp(t);
1443 }
1444
1445 // \brief A function that calculates the intersection of two variable lists.
1446 // \param x A list.
1447 // \param y Another list.
1448 // \return The intersection of the two lists.
1449 static inline
1450 data::variable_list set_intersection(const data::variable_list& x, const std::set<data::variable>& y)
1451 {
1452 return data::detail::set_intersection(x, y);
1453 }
1454
1455 // \brief Find the free variables in a term.
1456 // \param x The input term.
1457 // \return The set of free variables in a term.
1458 static inline
1459 std::set<data::variable> find_free_variables(const term_type& x)
1460 {
1461 return pbes_system::find_free_variables(x);
1462 }
1463
1464};
1465
1466} // namespace mcrl2::core
1467
1468namespace std
1469{
1470
1471 template <>
1472 struct hash<mcrl2::pbes_system::pbes_expression>
1473 {
1475 {
1476 return hash<atermpp::aterm>()(x);
1477 }
1478 };
1479
1480 template <>
1482 {
1484 {
1485 return hash<atermpp::aterm>()(x);
1486 }
1487 };
1488
1489} // namespace std
1490
1491#endif // MCRL2_PBES_PBES_EXPRESSION_H
aterm(const aterm &other) noexcept=default
This class has user-declared copy constructor so declare default copy and move operators.
A list of aterm objects.
Definition aterm_list.h:26
A unordered_map class in which aterms can be stored.
An abstraction expression.
Definition abstraction.h:23
abstraction(const atermpp::aterm &term)
Constructor.
Definition abstraction.h:32
bool is_well_typed() const
Returns true if.
\brief A data variable
Definition variable.h:25
\brief The and operator for pbes expressions
and_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
and_(const and_ &) noexcept=default
Move semantics.
and_(and_ &&) noexcept=default
and_ & operator=(and_ &&) noexcept=default
and_(const atermpp::aterm &term)
and_ & operator=(const and_ &) noexcept=default
const pbes_expression & left() const
const pbes_expression & right() const
and_()
\brief Default constructor X3.
\brief The existential quantification operator for pbes expressions
exists(const atermpp::aterm &term)
exists & operator=(exists &&) noexcept=default
exists(exists &&) noexcept=default
exists(const data::variable_list &variables, const pbes_expression &body)
\brief Constructor Z14.
const data::variable_list & variables() const
exists()
\brief Default constructor X3.
exists(const exists &) noexcept=default
Move semantics.
const pbes_expression & body() const
exists & operator=(const exists &) noexcept=default
static fixpoint_symbol nu()
Returns the nu symbol.
fixpoint_symbol()
\brief Default constructor X3.
fixpoint_symbol & operator=(fixpoint_symbol &&) noexcept=default
fixpoint_symbol(const fixpoint_symbol &) noexcept=default
Move semantics.
bool is_nu() const
Returns true if the symbol is nu.
bool is_mu() const
Returns true if the symbol is mu.
fixpoint_symbol(fixpoint_symbol &&) noexcept=default
static fixpoint_symbol mu()
Returns the mu symbol.
fixpoint_symbol & operator=(const fixpoint_symbol &) noexcept=default
fixpoint_symbol(const atermpp::aterm &term)
\brief The universal quantification operator for pbes expressions
forall()
\brief Default constructor X3.
const pbes_expression & body() const
forall(const data::variable_list &variables, const pbes_expression &body)
\brief Constructor Z14.
forall(const atermpp::aterm &term)
const data::variable_list & variables() const
forall & operator=(const forall &) noexcept=default
forall & operator=(forall &&) noexcept=default
forall(const forall &) noexcept=default
Move semantics.
forall(forall &&) noexcept=default
\brief The implication operator for pbes expressions
imp & operator=(imp &&) noexcept=default
imp(const imp &) noexcept=default
Move semantics.
const pbes_expression & left() const
imp(imp &&) noexcept=default
imp(const atermpp::aterm &term)
imp()
\brief Default constructor X3.
imp(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & right() const
imp & operator=(const imp &) noexcept=default
\brief The not operator for pbes expressions
not_()
\brief Default constructor X3.
not_(const pbes_expression &operand)
\brief Constructor Z14.
not_(const not_ &) noexcept=default
Move semantics.
const pbes_expression & operand() const
not_ & operator=(const not_ &) noexcept=default
not_(not_ &&) noexcept=default
not_(const atermpp::aterm &term)
not_ & operator=(not_ &&) noexcept=default
\brief The or operator for pbes expressions
const pbes_expression & left() const
or_(const or_ &) noexcept=default
Move semantics.
or_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & right() const
or_(or_ &&) noexcept=default
or_ & operator=(or_ &&) noexcept=default
or_ & operator=(const or_ &) noexcept=default
or_(const atermpp::aterm &term)
or_()
\brief Default constructor X3.
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
fixpoint_symbol & symbol()
Returns the fixpoint symbol of the equation.
pbes_equation(const fixpoint_symbol &symbol, const propositional_variable &variable, const pbes_expression &expr)
Constructor.
bool is_solved() const
Returns true if the predicate formula on the right hand side contains no predicate variables.
Definition pbes.cpp:102
fixpoint_symbol m_symbol
The fixpoint symbol of the equation.
propositional_variable m_variable
The variable on the left hand side of the equation.
const fixpoint_symbol & symbol() const
Returns the fixpoint symbol of the equation.
bool operator<(const pbes_equation &other) const
A comparison operator on pbes equations.
propositional_variable & variable()
Returns the pbes variable of the equation.
pbes_expression m_formula
The expression on the right hand side of the equation.
void swap(pbes_equation &other) noexcept
Swaps the contents.
pbes_equation()=default
Constructor.
pbes_expression & formula()
Returns the predicate formula on the right hand side of the equation.
const propositional_variable & variable() const
Returns the pbes variable of the equation.
pbes_expression & operator=(pbes_expression &&) noexcept=default
pbes_expression & operator=(const pbes_expression &) noexcept=default
pbes_expression(const atermpp::aterm &term)
pbes_expression(const pbes_expression &) noexcept=default
Move semantics.
pbes_expression(const data::data_expression &x)
\brief Constructor Z6.
pbes_expression(const data::untyped_data_parameter &x)
\brief Constructor Z6.
pbes_expression()
\brief Default constructor X3.
pbes_expression(pbes_expression &&) noexcept=default
parameterized boolean equation system
Definition pbes.h:54
std::set< data::variable > & global_variables()
Returns the declared free variables of the pbes.
Definition pbes.h:180
bool is_closed() const
True if the pbes is closed.
Definition pbes.h:238
data::data_specification m_data
The data specification.
Definition pbes.h:60
pbes(const data::data_specification &data, const std::vector< pbes_equation > &equations, propositional_variable_instantiation initial_state)
Constructor.
Definition pbes.h:111
std::set< data::variable > m_global_variables
The set of global variables.
Definition pbes.h:66
std::set< propositional_variable > compute_declared_variables() const
Returns the predicate variables appearing in the left hand side of an equation.
Definition pbes.h:73
pbes(const data::data_specification &data, const std::set< data::variable > &global_variables, const std::vector< pbes_equation > &equations, propositional_variable_instantiation initial_state)
Constructor.
Definition pbes.h:129
const propositional_variable_instantiation & initial_state() const
Returns the initial state.
Definition pbes.h:187
std::set< propositional_variable > binding_variables() const
Returns the set of binding variables of the pbes. This is the set variables that occur on the left ha...
Definition pbes.h:202
std::set< propositional_variable > occurring_variables() const
Returns the set of occurring propositional variable declarations of the pbes, i.e....
Definition pbes.h:220
std::set< propositional_variable_instantiation > occurring_variable_instantiations() const
Returns the set of occurring propositional variable instantiations of the pbes. This is the set of va...
Definition pbes.cpp:107
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the pbes.
Definition pbes.h:173
std::vector< pbes_equation > & equations()
Returns the equations.
Definition pbes.h:166
propositional_variable_instantiation & initial_state()
Returns the initial state.
Definition pbes.h:194
propositional_variable_instantiation m_initial_state
The initial state.
Definition pbes.h:69
pbes()=default
Constructor.
std::vector< pbes_equation > m_equations
The sequence of pbes equations.
Definition pbes.h:63
bool is_declared_in(Iter first, Iter last, const propositional_variable_instantiation &v, const data::data_specification &data_spec) const
Checks if the propositional variable instantiation v appears with the right type in the sequence of p...
Definition pbes.h:91
const std::vector< pbes_equation > & equations() const
Returns the equations.
Definition pbes.h:159
bool is_well_typed() const
Checks if the PBES is well typed.
Definition pbes.h:260
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
propositional_variable_instantiation(const propositional_variable_instantiation &) noexcept=default
Move semantics.
propositional_variable_instantiation(const std::string &name)
Constructor.
propositional_variable_instantiation(propositional_variable_instantiation &&) noexcept=default
propositional_variable_instantiation(const core::identifier_string &name, const data::data_expression_list &parameters)
Constructor.
propositional_variable_instantiation & operator=(propositional_variable_instantiation &&) noexcept=default
propositional_variable_instantiation(const core::identifier_string &name)
Constructor.
propositional_variable_instantiation & operator=(const propositional_variable_instantiation &) noexcept=default
propositional_variable_instantiation(const std::string &name, const data::data_expression_list &parameters)
Constructor.
propositional_variable_instantiation(const atermpp::aterm &term)
Constructor.
\brief A propositional variable declaration
const data::variable_list & parameters() const
propositional_variable(const propositional_variable &) noexcept=default
Move semantics.
const core::identifier_string & name() const
D_ParserTables parser_tables_mcrl2
void warn_and_or(const parse_node &)
Prints a warning for each occurrence of 'x && y || z' in the parse tree.
bool equal_sorts(const data::variable_list &v, const data::data_expression_list &w, const data::data_specification &data_spec)
Checks if the sorts of the variables/expressions in both lists are equal.
Definition equal_sorts.h:25
Namespace for system defined sort bool_.
Definition bool.h:29
bool is_false_function_symbol(const atermpp::aterm &e)
Recogniser for function false.
Definition bool.h:116
bool is_or_application(const atermpp::aterm &e)
Recogniser for application of ||.
Definition bool.h:342
const function_symbol & false_()
Constructor for function symbol false.
Definition bool.h:106
bool is_and_application(const atermpp::aterm &e)
Recogniser for application of &&.
Definition bool.h:278
bool is_true_function_symbol(const atermpp::aterm &e)
Recogniser for function true.
Definition bool.h:84
bool is_not_application(const atermpp::aterm &e)
Recogniser for application of !.
Definition bool.h:214
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:74
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
bool is_abstraction(const atermpp::aterm &x)
Returns true if the term t is an abstraction.
bool is_forall(const atermpp::aterm &x)
Returns true if the term t is a universal quantification.
bool is_untyped_data_parameter(const atermpp::aterm &x)
bool is_exists(const atermpp::aterm &x)
Returns true if the term t is an existential quantification.
bool is_application(const atermpp::aterm &x)
Returns true if the term t is an application.
bool is_variable(const atermpp::aterm &x)
Returns true if the term t is a variable.
The namespace for accessor functions on pbes expressions.
const pbes_expression & data_arg(const pbes_expression &t)
Returns the pbes expression argument of expressions of type not, exists and forall.
const pbes_expression & arg(const pbes_expression &t)
Returns the pbes expression argument of expressions of type not, exists and forall.
const pbes_expression & data_right(const pbes_expression &x)
Returns the left hand side of an expression of type and, or or imp.
const pbes_expression & data_left(const pbes_expression &x)
Returns the left hand side of an expression of type and, or or imp.
const pbes_expression & left(const pbes_expression &t)
Returns the left hand side of an expression of type and, or or imp.
const pbes_expression & right(const pbes_expression &t)
Returns the right hand side of an expression of type and, or or imp.
const data::data_expression_list & param(const pbes_expression &t)
Returns the parameters of a propositional variable instantiation.
const core::identifier_string & name(const pbes_expression &t)
Returns the name of a propositional variable expression.
const data::variable_list & var(const pbes_expression &t)
Returns the variables of a quantification expression.
void instantiate_global_variables(pbes &p)
Attempts to eliminate the free variables of a PBES, by substituting a constant value for them....
Definition pbes.cpp:64
bool is_bes(const pbes &x)
Returns true if a PBES is in BES form.
Definition pbes.cpp:69
untyped_pbes parse_pbes_new(const std::string &text)
Definition pbes.cpp:132
void complete_pbes(pbes &x)
Definition pbes.cpp:143
bool has_propositional_variables(const pbes_expression &x)
propositional_variable parse_propositional_variable(const std::string &text)
Definition pbes.cpp:150
pbes_expression parse_pbes_expression(const std::string &text)
Definition pbes.cpp:159
bool is_well_typed(const pbes_equation &eqn)
Checks if the equation is well typed.
pbes_expression parse_pbes_expression_new(const std::string &text)
Definition pbes.cpp:121
The main namespace for the PBES library.
bool is_pbes_exists(const pbes_expression &t)
Returns true if the term t is an existential quantification.
std::ostream & operator<<(std::ostream &out, const exists &x)
std::ostream & operator<<(std::ostream &out, const pbes_equation &x)
bool is_universal_or(const pbes_expression &t)
Test for a disjunction.
std::set< data::variable > find_free_variables(const pbes_system::pbes_equation &x)
Definition pbes.cpp:55
std::string pp(const pbes_system::propositional_variable_list &x, bool arg0)
Definition pbes.cpp:30
std::string pp(const pbes_system::or_ &x, bool arg0)
Definition pbes.cpp:40
void make_and(atermpp::aterm &t, const ARGUMENTS &... args)
bool is_data(const pbes_expression &t)
Returns true if the term t is a data expression.
bool operator!=(const pbes_equation &x, const pbes_equation &y)
void swap(propositional_variable_instantiation &t1, propositional_variable_instantiation &t2) noexcept
\brief swap overload
std::set< data::variable > find_free_variables(const pbes_system::pbes &x)
Definition pbes.cpp:53
void make_optimized_and(pbes_expression &result, const pbes_expression &p, const pbes_expression &q)
Make a conjunction.
void normalize_sorts(pbes_system::pbes_equation_vector &x, const data::sort_specification &sortspec)
Definition pbes.cpp:46
std::string pp(const pbes_system::imp &x, bool arg0)
Definition pbes.cpp:38
std::string pp(const pbes_system::propositional_variable_instantiation_list &x, bool arg0)
Definition pbes.cpp:32
pbes_expression optimized_or(const pbes_expression &p, const pbes_expression &q)
Make a disjunction.
pbes_system::pbes_expression normalize_sorts(const pbes_system::pbes_expression &x, const data::sort_specification &sortspec)
Definition pbes.cpp:48
std::set< data::sort_expression > find_sort_expressions(const pbes_system::pbes &x)
Definition pbes.cpp:51
bool is_universal_and(const pbes_expression &t)
Test for a conjunction.
bool is_pbes_expression(const atermpp::aterm &x)
bool is_pbes_not(const pbes_expression &t)
Returns true if the term t is a not expression.
std::string pp(const pbes_system::pbes_equation_vector &x, bool arg0)
Definition pbes.cpp:27
const pbes_expression & true_()
bool is_pbes_forall(const pbes_expression &t)
Returns true if the term t is a universal quantification.
std::string pp(const pbes_system::pbes_expression_list &x, bool arg0)
Definition pbes.cpp:28
std::ostream & operator<<(std::ostream &out, const not_ &x)
bool is_not(const atermpp::aterm &x)
std::set< pbes_system::propositional_variable_instantiation > find_propositional_variable_instantiations(const pbes_system::pbes_expression &x)
Definition pbes.cpp:57
void make_or(atermpp::aterm &t, const ARGUMENTS &... args)
bool is_exists(const atermpp::aterm &x)
data::variable_list free_variables(const pbes_expression &x)
std::ostream & operator<<(std::ostream &out, const forall &x)
std::ostream & operator<<(std::ostream &out, const fixpoint_symbol &x)
bool operator==(const pbes_equation &x, const pbes_equation &y)
bool is_constant(const pbes_expression &x)
void normalize_sorts(pbes_system::pbes &x, const data::sort_specification &)
Definition pbes.cpp:47
std::ostream & operator<<(std::ostream &out, const pbes &x)
Definition pbes.h:297
bool is_or(const atermpp::aterm &x)
void make_optimized_forall(pbes_expression &result, const data::variable_list &l, const pbes_expression &p, bool remove_variables=false)
Make a universal quantification If l is empty, p is returned.
const data::variable_list & quantifier_variables(const pbes_expression &x)
std::ostream & operator<<(std::ostream &out, const and_ &x)
pbes_expression optimized_imp(const pbes_expression &p, const pbes_expression &q)
Make a disjunction.
void make_optimized_not(pbes_expression &result, const pbes_expression &p)
Make a negation.
bool is_well_typed_pbes(const std::set< data::sort_expression > &declared_sorts, const std::set< data::variable > &declared_global_variables, const std::set< data::variable > &occurring_global_variables, const std::set< propositional_variable > &declared_variables, const std::set< propositional_variable_instantiation > &occ, const propositional_variable_instantiation &init, const data::data_specification &data_spec)
Definition pbes.cpp:90
std::set< data::function_symbol > find_function_symbols(const pbes_system::pbes &x)
Definition pbes.cpp:56
bool has_propositional_variables(const pbes_expression &x)
void make_optimized_or(pbes_expression &result, const pbes_expression &p, const pbes_expression &q)
Make a disjunction.
bool is_forall(const atermpp::aterm &x)
void typecheck_pbes(pbes &pbesspec)
Type check a parsed mCRL2 pbes specification. Throws an exception if something went wrong.
Definition typecheck.h:272
std::ostream & operator<<(std::ostream &out, const or_ &x)
void swap(not_ &t1, not_ &t2) noexcept
\brief swap overload
void make_propositional_variable_instantiation(atermpp::aterm &t, const ARGUMENTS &... args)
std::string pp(const pbes_system::propositional_variable &x, bool arg0)
Definition pbes.cpp:44
std::string pp(const pbes_system::exists &x, bool arg0)
Definition pbes.cpp:35
pbes_expression optimized_and(const pbes_expression &p, const pbes_expression &q)
Make a conjunction.
std::string pp(const pbes_system::pbes_expression &x, bool arg0)
Definition pbes.cpp:43
atermpp::aterm pbes_to_aterm(const pbes &p)
Conversion to atermappl.
Definition io.cpp:315
bool is_universal_not(const pbes_expression &t)
Test for a conjunction.
bool operator==(const pbes &p1, const pbes &p2)
Equality operator on PBESs.
Definition pbes.h:318
void swap(pbes_equation &t1, pbes_equation &t2) noexcept
\brief swap overload
bool is_well_typed(const pbes_equation &eqn)
Definition pbes.cpp:76
std::ostream & operator<<(std::ostream &out, const propositional_variable_instantiation &x)
void swap(exists &t1, exists &t2) noexcept
\brief swap overload
std::set< data::variable > find_free_variables(const pbes_system::pbes_expression &x)
Definition pbes.cpp:54
void swap(or_ &t1, or_ &t2) noexcept
\brief swap overload
pbes_system::pbes_expression translate_user_notation(const pbes_system::pbes_expression &x)
Definition pbes.cpp:50
bool is_pbes_or(const pbes_expression &t)
Returns true if the term t is an or expression.
bool is_false(const pbes_expression &t)
Test for the value false.
bool is_pbes_imp(const pbes_expression &t)
Returns true if the term t is an imp expression.
void swap(forall &t1, forall &t2) noexcept
\brief swap overload
bool is_pbes_and(const pbes_expression &t)
Returns true if the term t is an and expression.
void swap(propositional_variable &t1, propositional_variable &t2) noexcept
\brief swap overload
atermpp::aterm pbes_equation_to_aterm(const pbes_equation &eqn)
Conversion to atermaPpl.
bool search_variable(const pbes_system::pbes_expression &x, const data::variable &v)
Definition pbes.cpp:59
void make_optimized_exists(pbes_expression &result, const data::variable_list &l, const pbes_expression &p, bool remove_variables=false)
Make an optimized existential quantification. If l is empty, p is returned.
std::set< data::variable > find_all_variables(const pbes_system::pbes &x)
Definition pbes.cpp:52
std::string pp(const pbes_system::not_ &x, bool arg0)
Definition pbes.cpp:39
void complete_data_specification(pbes &)
Adds all sorts that appear in the PBES p to the data specification of p.
Definition pbes.h:307
pbes_expression optimized_exists(const data::variable_list &l, const pbes_expression &p, bool remove_variables=false)
Make an existential quantification If l is empty, p is returned.
void swap(pbes_expression &t1, pbes_expression &t2) noexcept
\brief swap overload
pbes_expression optimized_not(const pbes_expression &p)
Make a negation.
void make_not(atermpp::aterm &t, const ARGUMENTS &... args)
std::string pp(const pbes_system::pbes_equation &x, bool arg0)
Definition pbes.cpp:42
void swap(imp &t1, imp &t2) noexcept
\brief swap overload
std::ostream & operator<<(std::ostream &out, const pbes_expression &x)
void make_exists(atermpp::aterm &t, const ARGUMENTS &... args)
std::set< core::identifier_string > find_identifiers(const pbes_system::pbes_expression &x)
Definition pbes.cpp:58
std::ostream & operator<<(std::ostream &out, const imp &x)
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
bool is_well_typed_equation(const pbes_equation &eqn, const std::set< data::sort_expression > &declared_sorts, const std::set< data::variable > &declared_global_variables, const data::data_specification &data_spec)
Definition pbes.cpp:81
std::string pp(const pbes_system::propositional_variable_instantiation &x, bool arg0)
Definition pbes.cpp:45
bool is_and(const atermpp::aterm &x)
std::string pp(const pbes_equation_vector &x)
void make_optimized_imp(pbes_expression &result, const pbes_expression &p, const pbes_expression &q)
Make an implication.
void swap(and_ &t1, and_ &t2) noexcept
\brief swap overload
void translate_user_notation(pbes_system::pbes &x)
Definition pbes.cpp:49
void swap(fixpoint_symbol &t1, fixpoint_symbol &t2) noexcept
\brief swap overload
std::string pp(const pbes_system::pbes &x, bool arg0)
Definition pbes.cpp:41
bool is_imp(const atermpp::aterm &x)
void make_imp(atermpp::aterm &t, const ARGUMENTS &... args)
pbes_expression optimized_forall(const data::variable_list &l, const pbes_expression &p, bool remove_variables=false)
Make a universal quantification If l is empty, p is returned.
bool is_true(const pbes_expression &t)
Test for the value true.
const pbes_expression & false_()
std::string pp(const pbes_system::and_ &x, bool arg0)
Definition pbes.cpp:34
std::string pp(const pbes_system::fixpoint_symbol &x, bool arg0)
Definition pbes.cpp:36
void make_forall(atermpp::aterm &t, const ARGUMENTS &... args)
std::string pp(const pbes_system::forall &x, bool arg0)
Definition pbes.cpp:37
static const atermpp::aterm PBESForall
static const atermpp::aterm PBExpr
static const atermpp::aterm PBESOr
static const atermpp::aterm PBESExists
static const atermpp::aterm PBESImp
static const atermpp::aterm PBESNot
static const atermpp::aterm FixPoint
static const atermpp::aterm PropVarInst
static const atermpp::aterm PBESAnd
expression traverser that visits all sub expressions
Definition traverser.h:29
void apply(const pbes_system::imp &x)
Definition traverser.h:236
void apply(const pbes_system::not_ &x)
Definition traverser.h:213
void apply(const pbes_system::propositional_variable_instantiation &x)
Definition traverser.h:206
void apply(const pbes_system::exists &x)
Definition traverser.h:251
void apply(const pbes_system::pbes &x)
Definition traverser.h:198
void apply(const pbes_system::pbes_equation &x)
Definition traverser.h:191
void apply(const pbes_system::pbes_expression &x)
Definition traverser.h:258
void apply(const pbes_system::or_ &x)
Definition traverser.h:228
void apply(const pbes_system::and_ &x)
Definition traverser.h:220
void apply(const pbes_system::forall &x)
Definition traverser.h:244
void apply(const pbes_system::pbes_expression &x)
Definition traverser.h:662
void apply(const pbes_system::exists &x)
Definition traverser.h:654
void apply(const pbes_system::propositional_variable &x)
Definition traverser.h:582
void apply(const pbes_system::forall &x)
Definition traverser.h:646
void apply(const pbes_system::pbes_equation &x)
Definition traverser.h:590
void apply(const pbes_system::propositional_variable_instantiation &x)
Definition traverser.h:607
void apply(const pbes_system::propositional_variable_instantiation &x)
Definition traverser.h:332
void apply(const pbes_system::and_ &x)
Definition traverser.h:346
void apply(const pbes_system::forall &x)
Definition traverser.h:370
void apply(const pbes_system::pbes_equation &x)
Definition traverser.h:318
void apply(const pbes_system::or_ &x)
Definition traverser.h:354
void apply(const pbes_system::imp &x)
Definition traverser.h:362
void apply(const pbes_system::pbes_expression &x)
Definition traverser.h:384
void apply(const pbes_system::exists &x)
Definition traverser.h:377
void apply(const pbes_system::not_ &x)
Definition traverser.h:339
void apply(const pbes_system::pbes &x)
Definition traverser.h:325
void apply(const pbes_system::exists &x)
Definition traverser.h:123
void apply(const pbes_system::or_ &x)
Definition traverser.h:99
void apply(const pbes_system::propositional_variable_instantiation &x)
Definition traverser.h:77
void apply(const pbes_system::propositional_variable &x)
Definition traverser.h:53
void apply(const pbes_system::imp &x)
Definition traverser.h:107
void apply(const pbes_system::and_ &x)
Definition traverser.h:91
void apply(const pbes_system::pbes &x)
Definition traverser.h:68
void apply(const pbes_system::forall &x)
Definition traverser.h:115
void apply(const pbes_system::pbes_equation &x)
Definition traverser.h:60
void apply(const pbes_system::pbes_expression &x)
Definition traverser.h:131
void apply(const pbes_system::not_ &x)
Definition traverser.h:84
void apply(const pbes_system::pbes &x)
Definition traverser.h:459
void apply(const pbes_system::propositional_variable &x)
Definition traverser.h:444
void apply(const pbes_system::or_ &x)
Definition traverser.h:490
void apply(const pbes_system::propositional_variable_instantiation &x)
Definition traverser.h:468
void apply(const pbes_system::not_ &x)
Definition traverser.h:475
void apply(const pbes_system::exists &x)
Definition traverser.h:514
void apply(const pbes_system::and_ &x)
Definition traverser.h:482
void apply(const pbes_system::imp &x)
Definition traverser.h:498
void apply(const pbes_system::pbes_expression &x)
Definition traverser.h:522
void apply(const pbes_system::pbes_equation &x)
Definition traverser.h:451
void apply(const pbes_system::forall &x)
Definition traverser.h:506
pbes_system::propositional_variable parse_PropVarDecl(const core::parse_node &node) const
Definition parse_impl.h:47
pbes_actions(const core::parser &parser_)
Definition parse_impl.h:25
untyped_pbes parse_PbesSpec(const core::parse_node &node) const
Definition parse_impl.h:84
pbes_system::pbes_expression parse_PbesExpr(const core::parse_node &node) const
Definition parse_impl.h:29
Traversal class for pbes_expressions. Used as a base class for pbes_expression_traverser.
Definition traverser.h:23
void apply(const data::data_expression &x)
Definition traverser.h:29
void apply(const data::untyped_data_parameter &x)
Definition traverser.h:36
std::size_t operator()(const mcrl2::pbes_system::pbes_expression &x) const
std::size_t operator()(const mcrl2::pbes_system::propositional_variable_instantiation &x) const