mCRL2
Loading...
Searching...
No Matches
ltsmin.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9/// \file mcrl2/lps/ltsmin.h
10/// \brief PINS interface for exploring an LPS from the LTSmin toolset.
11
12#ifndef MCRL2_LPS_LTSMIN_H
13#define MCRL2_LPS_LTSMIN_H
14
15constexpr int MCRL2_GUARDS = 1;
16
17#include <memory>
18
19#include "mcrl2/data/join.h"
20#include "mcrl2/lps/find.h"
21#include "mcrl2/lps/io.h"
22#include "mcrl2/lps/explorer.h"
23#include "mcrl2/lps/parse.h"
24
25// For backwards compatibility
26using mcrl2_log_level_t = mcrl2::log::log_level_t;
27using mcrl2::log::logger;
28
29namespace mcrl2::log {
30 using mcrl2_logger = mcrl2::log::logger;
31}
32
33#ifdef MCRL2_ENABLE_JITTYC
34#define MCRL2_JITTYC_AVAILABLE
35#endif
36
37namespace mcrl2::lps
38{
39
40/// \brief Generates possible values of the data type (at most max_size).
41inline
43{
44 using enumerator_element = data::enumerator_list_element_with_substitution<>;
45
46 std::vector<std::string> result;
47 std::size_t max_iterations = 10000;
48 data::rewriter rewr(dataspec);
50 bool accept_solutions_with_variables = false;
51 data::enumerator_algorithm<data::rewriter, data::rewriter> E(rewr, dataspec, rewr, id_generator, accept_solutions_with_variables, max_iterations);
52 data::mutable_indexed_substitution<> sigma;
53 data::variable x("x", s);
54 data::variable_list v_list{x};
55
56 E.enumerate(enumerator_element(v_list, data::sort_bool::true_()),
57 sigma,
58 [&](const enumerator_element& p)
59 {
60 p.add_assignments(v_list, sigma, rewr);
61 result.push_back(data::pp(sigma(x)));
62 return result.size() >= max_size;
63 }
64 );
65 return result;
66}
67
68/// \brief Models a pins data type. A pins data type maintains a mapping between known values
69/// of a data type and integers.
71{
72 protected:
75 const process::action_label_list& m_action_labels;
77
78 public:
79
80 /// \brief Forward iterator used for iterating over indices.
82 {
83 public:
84 explicit index_iterator(std::size_t index = 0)
85 : m_index(index)
86 {}
87
88 private:
89 friend class boost::iterator_core_access;
90
91 void increment()
92 {
93 m_index++;
94 }
95
96 bool equal(const index_iterator& other) const
97 {
98 return this->m_index == other.m_index;
99 }
100
101 const std::size_t& dereference() const
102 {
103 return m_index;
104 }
105
107 {
108 return static_cast<std::ptrdiff_t>(other.m_index) - static_cast<std::ptrdiff_t>(this->m_index);
109 }
110
112 };
113
114 /// \brief Constructor
116 const process::action_label_list& action_labels,
117 bool is_bounded = false)
118 : // m_generator(generator),
119 m_data(data),
120 m_action_labels(action_labels),
121 m_is_bounded(is_bounded)
122 {}
123
124 /// \brief Destructor.
125 virtual ~pins_data_type() = default;
126
127 /// \brief Serializes the i-th value of the data type to a binary string.
128 /// It is guaranteed that serialize(deserialize(i)) == i.
129 /// \pre i is a valid index
130 virtual std::string serialize(int i) const = 0;
131
132 /// \brief Deserializes a string to a data value, and returns the corresponding index.
133 /// If the value is not in the mapping, it will be added.
134 /// \return The index of the data value.
135 /// \throw <std::runtime_error> { if deserialization failed }
136 virtual std::size_t deserialize(const std::string& s) = 0;
137
138 /// \brief Returns a human readable representation of the value with index i.
139 /// N.B. It is not guaranteed that parse(print(i)) == i.
140 /// \pre i is a valid index
141 virtual std::string print(int i) const = 0;
142
143 /// \brief Parses a string to a data value, and returns the corresponding index.
144 /// If the value is not in the mapping, it will be added.
145 /// \return The index of the data value.
146 /// \throw <std::runtime_error> { if parsing failed }
147 virtual std::size_t parse(const std::string& s) = 0;
148
149 /// \brief Returns the name of the data type.
150 virtual const std::string& name() const = 0;
151
152 /// \brief Generates possible values of the data type (at most max_size).
154
155 /// \brief Returns true if the number of elements is bounded. If this property can
156 /// not be computed for a data type, false is returned.
157 bool is_bounded() const
158 {
159 return m_is_bounded;
160 }
161
162 /// \brief Returns the number of values that are stored in the map.
163 std::size_t size() const
164 {
165 return m_indexed_set.size();
166 }
167
168 /// \brief Returns an iterator to the beginning of the indices
170 {
171 return index_iterator(0);
172 }
173
174 /// \brief Returns an iterator to the end of the indices
176 {
177 return index_iterator(size());
178 }
179
180 /// \brief Returns the index of the value x
182 {
183 return m_indexed_set.insert(x).first;
184 }
185
186 /// \brief Returns the value at index i
187 atermpp::aterm get(std::size_t i)
188 {
189 return m_indexed_set.at(i);
190 }
191
192 /// \brief Returns the indexed_set holding the values
194 {
195 return m_indexed_set;
196 }
197
198 /// \brief Returns the indexed_set holding the values
200 {
201 return m_indexed_set;
202 }
203};
204
205/// \brief Models the mapping of mCRL2 state values to integers.
207{
208 protected:
211
213 {
214 return m_indexed_set.insert(x).first;
215 }
216
218 {
219 return static_cast<data::data_expression>(m_indexed_set.at(i));
220 }
221
222 public:
224 const process::action_label_list& action_labels,
225 const data::sort_expression& sort,
226 bool sort_is_finite
227 )
228 : pins_data_type(data, action_labels, sort_is_finite),
229 m_sort(sort)
230 {
231 m_name = data::pp(m_sort);
232 }
233
234 // prints the expression as an ATerm string
235 std::string serialize(int i) const override
236 {
237 data::data_expression e = index2expression(i);
239 return pp(t);
240 }
241
242 std::size_t deserialize(const std::string& s) override
243 {
244 atermpp::aterm t = data::detail::add_index(atermpp::read_term_from_string(s));
245 return expression2index(atermpp::down_cast<data::data_expression>(t));
246 }
247
248 std::string print(int i) const override
249 {
250 return data::pp(index2expression(i));
251 }
252
253 std::size_t parse(const std::string& s) override
254 {
255 return expression2index(data::parse_data_expression(s, m_data));
256 }
257
258 const std::string& name() const override
259 {
260 return m_name;
261 }
262
264 {
265 return lps::generate_values(m_data, m_sort, max_size);
266 }
267};
268
269/// \brief Models the mapping of mCRL2 action labels to integers.
271{
272 protected:
274
275 public:
276 action_label_data_type(const data::data_specification& data, const process::action_label_list& action_labels)
277 : pins_data_type(data, action_labels, false)
278 {
279 m_name = "action_labels";
280 }
281
282 std::string serialize(int i) const override
283 {
284 return pp(m_indexed_set.at(i));
285 }
286
287 std::size_t deserialize(const std::string& s) override
288 {
289 return m_indexed_set.insert(atermpp::read_term_from_string(s)).first;
290 }
291
292 std::string print(int i) const override
293 {
294 return lps::pp(lps::multi_action(m_indexed_set.at(i)));
295 }
296
297 std::size_t parse(const std::string& s) override
298 {
299 lps::multi_action m = lps::parse_multi_action(s, m_action_labels, m_data);
300 return m_indexed_set.insert(m).first;
301 }
302
303 const std::string& name() const override
304 {
305 return m_name;
306 }
307
308 // TODO: get rid of this useless function
310 {
311 return std::vector<std::string>();
312 }
313};
314
315class pins
316{
317 public:
318 using ltsmin_state_type = int*; /**< the state type used by LTSMin */
319
320 /// \brief guard evaluations have ternary logic. A guard may not always rewrite
321 /// to true or false
323
325
326 protected:
328 std::size_t m_state_length = 0UL; /**< the number of process parameters */
333 using generator_type = lps::explorer<false, false, lps::specification>;
335 generator_type m_generator;
336
339
344
345 // For guard-splitting we use a different generator with a different spec.
346 // This second spec has guards removed from the conditions.
349 generator_type m_generator_reduced;
350
351 // The type mappings
352 // m_data_types[0] ... m_data_types[N-1] contain the state parameter mappings
353 // m_data_types[N] contains the action label values
354 // where N is the number of process parameters
356
357 /// The unique type mappings; owns the data types that m_data_types refers to.
359
360 // maps process parameter index to the corresponding index in m_unique_data_types
362
363 /// \brief Returns the action data type
365 {
366 return *m_data_types.back();
367 }
368
369 /// \brief Returns the action data type
371 {
372 return *m_data_types.back();
373 }
374
375 /// \brief Returns the data type of the i-th state parameter
377 {
378 return *m_data_types[i];
379 }
380
381 /// \brief Returns the data type of the i-th state parameter
382 const pins_data_type& state_type_map(std::size_t i) const
383 {
384 return *m_data_types[i];
385 }
386
387 /// \brief Returns the process of the LPS specification
388 const linear_process& process() const
389 {
390 return m_specification.process();
391 }
392
393 /// \brief Returns the reduced process of the LPS specification,
394 /// i.e. with conditions with guards removed.
396 {
397 return m_specification_reduced.process();
398 }
399
400 /// \brief Returns the data specification of the LPS specification
401 const data::data_specification& data() const
402 {
403 return m_specification.data();
404 }
405
406 template <typename Iter>
408 {
409 std::ostringstream out;
410 out << "[";
411 for (Iter i = first; i != last; ++i)
412 {
413 if (i != first)
414 {
415 out << ", ";
416 }
417 out << *i;
418 }
419 out << "]";
420 return out.str();
421 }
422
423 template <typename Container>
425 {
426 return print_vector(c.begin(), c.end());
427 }
428
430 {
431 std::set<data::variable> parameters(process().process_parameters().begin(), process().process_parameters().end());
432
433 const lps::linear_process& proc = process();
434
435 m_group_count = proc.action_summands().size();
436 m_state_length = proc.process_parameters().size();
437
438 m_read_group.resize(m_group_count);
439 m_write_group.resize(m_group_count);
440
441 // iterate over the list of summands
442 {
443 std::size_t i = 0;
444 for (const auto & summand : proc.action_summands())
445 {
446 std::set<data::variable> used_read_variables;
447 std::set<data::variable> used_write_variables;
448
449 data::find_free_variables(summand.condition(), std::inserter(used_read_variables, used_read_variables.end()));
450 lps::find_free_variables(summand.multi_action(), std::inserter(used_read_variables, used_read_variables.end()));
451
452 for (const auto & assignment : summand.assignments())
453 {
454 if (assignment.lhs() != assignment.rhs())
455 {
456 data::find_all_variables(assignment.lhs(), std::inserter(used_write_variables, used_write_variables.end()));
457 data::find_all_variables(assignment.rhs(), std::inserter(used_read_variables, used_read_variables.end()));
458 }
459 }
460
461 // process parameters used in condition, action or assignment of summand
462 std::set<data::variable> used_read_parameters;
463 std::set<data::variable> used_write_parameters;
464
465 std::set_intersection(used_read_variables.begin(),
466 used_read_variables.end(),
467 parameters.begin(),
468 parameters.end(),
469 std::inserter(used_read_parameters,
470 used_read_parameters.begin()));
471 std::set_intersection(used_write_variables.begin(),
472 used_write_variables.end(),
473 parameters.begin(),
474 parameters.end(),
475 std::inserter(used_write_parameters,
476 used_write_parameters.begin()));
477
478 std::size_t j = 0;
479 for (auto & param : m_parameters_list)
480 {
481 if (used_read_parameters.find(param) != used_read_parameters.end())
482 {
483 m_read_group[i].push_back(j);
484 }
485 if (used_write_parameters.find(param) != used_write_parameters.end())
486 {
487 m_write_group[i].push_back(j);
488 }
489 j++;
490 }
491 i++;
492 }
493 }
494
495 m_update_group.resize(m_group_count);
496
497 // iterate over the list of reduced summands
498 {
499 std::size_t i = 0;
500 for (const auto & reduced_summand : process_reduced().action_summands())
501 {
502 std::set<data::variable> used_update_variables;
503
504 data::find_free_variables(reduced_summand.condition(), std::inserter(used_update_variables, used_update_variables.end()));
505 lps::find_free_variables(reduced_summand.multi_action(), std::inserter(used_update_variables, used_update_variables.end()));
506
507 for (const auto & assignment : reduced_summand.assignments())
508 {
509 if (assignment.lhs() != assignment.rhs())
510 {
511 data::find_all_variables(assignment.rhs(), std::inserter(used_update_variables, used_update_variables.end()));
512 }
513 }
514
515 // process parameters used in the action and assignment of summand
516 std::set<data::variable> used_update_parameters;
517
518 std::set_intersection(used_update_variables.begin(),
519 used_update_variables.end(),
520 parameters.begin(),
521 parameters.end(),
522 std::inserter(used_update_parameters,
523 used_update_parameters.begin()));
524
525 std::size_t j = 0;
526 for (auto & param : m_parameters_list)
527 {
528 if (used_update_parameters.find(param) != used_update_parameters.end())
529 {
530 m_update_group[i].push_back(j);
531 }
532 j++;
533 }
534 i++;
535 }
536 }
537 }
538
539 public:
540 using datatype_index = std::size_t; /**< the index type for datatype maps */
541
542 /// \brief Returns the number of process parameters of the LPS
544 {
545 return m_specification.process().process_parameters().size();
546 }
547
548 /// \brief Returns the number of available groups. This equals the number of action summands of the LPS.
550 {
551 return m_specification.process().action_summands().size();
552 }
553
554 static lps::specification load_specification(const std::string& filename)
555 {
556 lps::specification specification;
557 load_lps(specification, filename);
558 return specification;
559 }
560
561 /// \brief extracts all guards from the original specification and
562 /// returns a new one with the guards removed.
564 // the list of summands
565 std::vector<lps::action_summand> reduced_summands;
566 for (const auto & summand : spec.process().action_summands())
567 {
568 // contains info about which guards this transition group has.
569 std::vector<std::size_t> guard_info;
570
571 // the initial new condition of a summand is always true.
572 // this maybe joined with conjuncts which have local variables.
573 data::data_expression reduced_condition = data::sort_bool::true_();
574
575 // process variables and guards in condition
576 std::set<data::data_expression> conjuncts = data::split_and(summand.condition());
577 std::set<data::variable> summation_variables(summand.summation_variables().begin(), summand.summation_variables().end());
578
579 for (const auto & conjunct : conjuncts)
580 {
581 // check if the conjunct is new
582 std::size_t at = m_guards.index(conjunct);
583 bool is_new = (at == utilities::indexed_set<atermpp::aterm>::npos);
584 bool use_conjunct_as_guard = true;
585
586 if (is_new) { // we have not encountered the guard yet
587 std::set<data::variable> conjunct_variables;
588 data::find_free_variables(conjunct, std::inserter(conjunct_variables, conjunct_variables.end()));
589
590 if (!summand.summation_variables().empty())
591 {
592 // the conjunct may contain summation variables, in which case it can not be
593 // used as guard.
594 std::set<data::variable> summation_variables_in_conjunct;
595 std::set_intersection(conjunct_variables.begin(),
596 conjunct_variables.end(),
597 summation_variables.begin(),
598 summation_variables.end(),
599 std::inserter(summation_variables_in_conjunct, summation_variables_in_conjunct.begin()));
600
601 if (!summation_variables_in_conjunct.empty()) {
602 // this conjunct contains summation variables and will not be used as guard.
603 use_conjunct_as_guard = false;
604
605 std::string printed_guard(data::pp(conjunct).substr(0, 80));
606 mCRL2log(log::log_level_t::verbose)
607 << "Guard '" << printed_guard + (printed_guard.size() > 80?"...":"") << "' in summand "
608 << reduced_summands.size()
609 << " introduces local variables. To remove the guard from the condition, try instantiating the summand with 'lpssuminst'."
610 << std::endl;
611
612 // add conjunct to new summand condition
613 if (reduced_condition == data::sort_bool::true_()) {
614 reduced_condition = conjunct;
615 } else {
616 reduced_condition = data::sort_bool::and_(reduced_condition, conjunct);
617 }
618 }
619 }
620 if (use_conjunct_as_guard) {
621 // add conjunct to guards
622 std::vector<std::size_t> guard_parameters;
623 if (!conjunct_variables.empty())
624 {
625 // compute indexes of parameters used by the guard
626 std::size_t p = 0;
627 for (auto & param : m_parameters_list)
628 {
629 if (conjunct_variables.find(param) != conjunct_variables.end())
630 {
631 guard_parameters.push_back(p);
632 }
633 p++;
634 }
635 }
636 // add conjunct to the set of guards
637 at = m_guards.insert(conjunct).first;
638 m_guard_names.push_back(data::pp(conjunct));
639 guard_parameters_list.push_back(guard_parameters);
640 }
641 }
642 if (use_conjunct_as_guard) {
643 // add the guard index to the list of guards of this summand.
644 guard_info.push_back(at);
645 }
646 }
647
648 // set which guards belong to which transition group
649 m_guard_info.push_back(guard_info);
650
651 // add the new summand to the list of summands.
652 reduced_summands.emplace_back(summand.summation_variables(),
653 reduced_condition,
654 summand.multi_action(),
655 summand.assignments());
656 }
657
658 // create a new LPS
659 lps::linear_process lps_reduced(process().process_parameters(), process().deadlock_summands(), reduced_summands);
660
661 // create a new spec
662 lps::specification specification_reduced(m_specification.data(), m_specification.action_labels(), m_specification.global_variables(), lps_reduced, m_specification.initial_process());
663 return specification_reduced;
664 }
665
666 /// \brief Constructor
667 /// \param filename The name of a file containing an mCRL2 specification
668 /// \param rewriter_strategy The rewriter strategy used for generating next states
669 pins(const std::string& filename, const std::string& rewriter_strategy)
677 {
679
680 // store the process parameter names in a vector, to have random access to them
681 data::variable_list params = m_specification.process().process_parameters();
682 for (const auto & param : params)
683 {
684 m_process_parameter_names.push_back(param.name());
685 }
686
687 // Each state parameter type gets it's own pins_data_type. State parameters of the same
688 // type share the pins_data_type.
689 std::map<data::sort_expression, pins_data_type*> existing_type_maps;
690 std::vector<data::variable> parameters(process().process_parameters().begin(),process().process_parameters().end());
691 for (std::size_t i = 0; i < params.size(); i++)
692 {
693 data::sort_expression s = parameters[i].sort();
694 std::map<data::sort_expression, pins_data_type*>::const_iterator j = existing_type_maps.find(s);
695 if (j == existing_type_maps.end())
696 {
697 m_unique_data_types.push_back(std::make_unique<state_data_type>(m_specification.data(), m_specification.action_labels(), s, m_specification.data().is_certainly_finite(s)));
698 pins_data_type* dt = m_unique_data_types.back().get();
699 m_data_types.push_back(dt);
700 existing_type_maps[s] = dt;
701 }
702 else
703 {
704 m_data_types.push_back(j->second);
705 }
706 }
707 m_unique_data_types.push_back(std::make_unique<action_label_data_type>(m_specification.data(), m_specification.action_labels()));
708 m_data_types.push_back(m_unique_data_types.back().get());
709
710 for (pins_data_type* data_type : m_data_types)
711 {
712 auto j = std::find_if(m_unique_data_types.begin(), m_unique_data_types.end(),
713 [&](const std::unique_ptr<pins_data_type>& unique_data_type) { return unique_data_type.get() == data_type; });
714 assert(j != m_unique_data_types.end());
715 m_unique_data_type_index.push_back(j - m_unique_data_types.begin());
716 }
717 }
718
719 /// \brief Returns the number of unique datatype maps. Note that the datatype map for action labels is included,
720 /// so this number equals the number of different process parameter types + 1.
722 {
723 return m_unique_data_types.size();
724 }
725
726 /// \brief Returns a reference to the datatype map with index i.
727 /// \pre 0 <= i < datatype_count()
728 pins_data_type& data_type(std::size_t i)
729 {
730 assert (i < m_data_types.size());
731 return *m_unique_data_types[i];
732 }
733
734 /// \brief Indices of process parameters that influence event or next state of a summand by being read
735 /// \param[in] index the selected summand
736 /// \returns reference to a vector of indices of parameters
737 /// \pre 0 <= i < group_count()
739 {
740 return m_read_group[index];
741 }
742
743 /// \brief Indices of process parameters that influence event or next state of a summand by being written
744 /// \param[in] index the selected summand
745 /// \returns reference to a vector of indices of parameters
746 /// \pre 0 <= i < group_count()
748 {
749 return m_write_group[index];
750 }
751
752 /// \brief Indices of process parameters that influence event or next state of a summand by being read except from the guards.
753 /// \param[in] index the selected summand
754 /// \returns reference to a vector of indices of parameters
755 /// \pre 0 <= i < group_count()
757 {
758 return m_update_group[index];
759 }
760
762 {
763 return guard_parameters_list[index];
764 }
765
767 {
768 return m_guard_info[index];
769 }
770
772 {
773 return m_guards.size();
774 }
775
777 return m_guard_names[index];
778 }
779
780 /// \brief Returns a human-readable, unique name for process parameter i
782 {
783 return m_process_parameter_names[i];
784 }
785
786 /// \brief Returns the datatype map index corresponding to process parameter i
787 /// \pre 0 <= i < process_parameter_count()
789 {
790 return m_unique_data_type_index[i];
791 }
792
793 /// \brief Returns the number of labels per edge.
795 {
796 return 1;
797 }
798
799 /// \brief Returns the datatype map index corresponding to edge label i
800 /// \pre 0 <= i < edge_label_count()
802 {
803 return m_unique_data_types.size() - 1;
804 }
805
806 /// \brief Returns the name of the i-th action label (always "action").
807 /// \pre 0 <= i < edge_label_count()
809 {
810 return action_label_type_map().name();
811 }
812
813 /// \brief Assigns the initial state to s.
814 void get_initial_state(ltsmin_state_type& s)
815 {
816 state initial_state(m_generator.initial_state().begin(), static_cast<int>(m_generator.initial_state().size()));
817 for (std::size_t i = 0; i < m_state_length; i++)
818 {
819 s[i] = static_cast<int>(state_type_map(i)[initial_state[i]]);
820 }
821 }
822
823 /// \brief Returns the names of the actions that appear in the summand with index i,
824 /// with 0 <= i < group_count().
826 {
827 std::set<std::string> result;
828 auto const l = process().action_summands()[i].multi_action().actions(); // Using a reference in whatever this type
829 // is, leads to a failing lps_ltsmin_test.
830 for (const auto & i : l)
831 {
832 result.insert(std::string(i.label().name()));
833 }
834 return result;
835 }
836
837 /// \brief Iterates over the 'next states' of state src, and invokes a callback function for each discovered state.
838 ///
839 /// StateFunction is a callback function that must provide the function operator() with the following interface:
840 /// <code>void operator()(ltsmin_state_type const& next_state, int* const& edge_labels, int group=-1);</code>
841 /// where
842 /// - \a next_state is the target state of the transition
843 /// - \a edge_labels is an array of edge labels
844 /// - \a group is the number of the summand from which the next state was generated, or -1 if it is unknown which summand
845 ///
846 /// \param src An LTSMin state
847 /// \param f A 'callback' function object
848 /// \param dest A destination state, which is modified and passed to the callback. Must provide space for at least process_parameter_count() items.
849 /// \param labels An array of labels, which is modified and passed to the callback. Must provide space for at least edge_label_count() items.
850 template <typename StateFunction>
851 void next_state_all(ltsmin_state_type const& src, StateFunction& f, ltsmin_state_type const& dest, int* const& labels)
852 {
853 std::size_t nparams = process_parameter_count();
854 data::data_expression_vector state_arguments(nparams);
855 for (std::size_t i = 0; i < nparams; i++)
856 {
857 state_arguments[i] = static_cast<data::data_expression>(state_type_map(i).get(src[i]));
858 }
859 state source(state_arguments.begin(), static_cast<int>(nparams));
860
861 std::list<generator_type::transition> transitions = m_generator.out_edges(source);
862 for (const generator_type::transition& t: transitions)
863 {
864 state destination = t.state;
865 for (std::size_t j = 0; j < nparams; j++)
866 {
867 dest[j] = static_cast<int>(state_type_map(j)[destination[j]]);
868 }
869 labels[0] = static_cast<int>(action_label_type_map()[t.action]);
870 f(dest, labels);
871 }
872 }
873
874 template <typename StateFunction>
875 void next_state_long(ltsmin_state_type const& src, std::size_t group, StateFunction& f, ltsmin_state_type const& dest, int* const& labels)
876 {
877 _long(src, group, f, dest, labels, &m_generator);
878 }
879
880 template <typename StateFunction>
881 void update_long(ltsmin_state_type const& src, std::size_t group, StateFunction& f, ltsmin_state_type const& dest, int* const& labels)
882 {
883 _long(src, group, f, dest, labels, &m_generator_reduced);
884 }
885
886 /// \brief Iterates over the 'next states' of a particular summand
887 /// of state src that are generated by a group of summands, and
888 /// invokes a callback function for each discovered state.
889 ///
890 /// StateFunction is a callback function that must provide the function operator() with the following interface:
891 /// <code>void operator()(ltsmin_state_type const& next_state, int* const& edge_labels, int group);</code>
892 /// where
893 /// - next_state is the target state of the transition
894 /// - edge_labels is an array of edge labels
895 /// - group is the number of the summand from which the next state was generated, or -1 if it is unknown which summand
896 ///
897 /// \param src An LTSMin state.
898 /// \param group the number of the summand.
899 /// \param f A state function.
900 /// \param dest A destination state, which is modified and passed to the callback.
901 /// Must provide space for at least process_parameter_count() items.
902 /// \param labels An array of labels, which is modified and passed to the callback.
903 /// Must provide space for at least edge_label_count() items.
904 /// \param generator The next state generator to use.
905 template <typename StateFunction>
906 void _long(ltsmin_state_type const& src,
907 std::size_t group,
908 StateFunction& f,
909 const ltsmin_state_type& dest,
910 int* const& labels,
911 generator_type* generator)
912 {
913 std::size_t nparams = process_parameter_count();
914 data::data_expression_vector state_arguments(nparams);
915 for (std::size_t i = 0; i < nparams; i++)
916 {
917 state_arguments[i] = static_cast<data::data_expression>(state_type_map(i).get(src[i]));
918 }
919 state source(state_arguments.begin(), static_cast<int>(nparams));
920
921 std::list<generator_type::transition> transitions = generator->out_edges(source, group);
922
923 for (const generator_type::transition& t: transitions)
924 {
925 state destination = t.state;
926 for (std::size_t j = 0; j < nparams; j++)
927 {
928 dest[j] = static_cast<int>(state_type_map(j)[destination[j]]);
929 }
930 labels[0] = static_cast<int>(action_label_type_map()[t.action]);
931 f(dest, labels);
932 }
933 }
934
935 guard_evaluation_t eval_guard_long(ltsmin_state_type const& src, std::size_t guard) {
936 std::size_t nparams = process_parameter_count();
937 substitution_t substitution;
938 for (std::size_t i = 0; i < nparams; i++)
939 {
940 data::data_expression value(static_cast<data::data_expression>(state_type_map(i).get(src[i])));
941 substitution[m_parameters_list[i]] = value;
942 }
943
944 // get the result by rewriting the guard with the substitution.
945 data::data_expression result = m_generator_reduced.get_rewriter()(
946 static_cast<data::data_expression>(m_guards.at(guard)),
947 substitution);
948
949 if(result == data::sort_bool::false_()) { // the guard rewrites to false.
951 } else if(result == data::sort_bool::true_()) { // the guard rewrites to true.
953 } else { // the guard does not rewrite to true or false, so maybe...
955 }
956 }
957
958 /// \brief Prints an overview of several relevant attributes.
960 {
961 std::ostringstream out;
962
963 out << "\n--- EDGE LABELS ---\n";
964 out << "edge_label_count() = " << edge_label_count() << std::endl;
965 for (std::size_t i = 0; i < edge_label_count(); i++)
966 {
967 out << "\n";
968 out << "edge_label_name(" << i << ") = " << edge_label_name(i) << std::endl;
969 out << "edge_label_type(" << i << ") = " << edge_label_type(i) << std::endl;
970 }
971
972 out << "\n--- PROCESS PARAMETERS ---\n";
973 out << "process_parameter_count() = " << process_parameter_count() << std::endl;
974 for (std::size_t i = 0; i < process_parameter_count(); i++)
975 {
976 out << "\n";
977 out << "process_parameter_name(" << i << ") = " << process_parameter_name(i) << std::endl;
978 out << "process_parameter_type(" << i << ") = " << process_parameter_type(i) << std::endl;
979 }
980
981 out << "\n--- SUMMANDS ---\n";
982 out << "group_count() = " << group_count() << std::endl;
983 for (std::size_t i = 0; i < group_count(); i++)
984 {
985 out << std::endl;
986 out << " read_group(" << i << ") = " << print_vector(read_group(i)) << std::endl;
987 out << " write_group(" << i << ") = " << print_vector(write_group(i)) << std::endl;
988 out << "update_group(" << i << ") = " << print_vector(update_group(i)) << std::endl;
989 }
990
991 out << "\n--- GUARDS ---\n";
992 out << "guard_count() = " << guard_count() << std::endl;
993 for (std::size_t i = 0; i < guard_count(); i++)
994 {
995 out << "guard(" << i << ") = " << print_vector(guard_parameters(i)) << std::endl;
996 }
997
998 out << "\n--- INITIAL STATE ---\n";
999 std::vector<int> init(process_parameter_count());
1000 ltsmin_state_type init_state = init.data();
1001 get_initial_state(init_state);
1002 out << "initial state = " << print_vector(init.data(), init.data() + process_parameter_count()) << std::endl;
1003
1004 out << "\n--- DATA TYPE MAPS ---\n";
1005 out << "datatype_count() = " << datatype_count() << std::endl;
1006 for (std::size_t i = 0; i < datatype_count(); i++)
1007 {
1008 const pins_data_type& type = data_type(i);
1009 out << "\n";
1010 out << "datatype " << i << "\n"
1011 << " name = " << type.name() << "\n"
1012 << " size = " << type.size() << "\n"
1013 << " bounded = " << std::boolalpha << type.is_bounded() << "\n";
1014 if (type.is_bounded())
1015 {
1016 out << " possible values: " << core::detail::print_set(type.generate_values(10)) << std::endl;
1017 }
1018 out << std::endl;
1019 }
1020
1021 return out.str();
1022 }
1023};
1024
1025} // namespace mcrl2::lps
1026
1027#endif // MCRL2_LPS_LTSMIN_H
A unordered_map class in which aterms can be stored.
const data_expression & body() const
Definition abstraction.h:65
data_expression & operator=(const data_expression &) noexcept=default
An enumerator algorithm that generates solutions of a condition.
Definition enumerator.h:599
The default element for the todo list of the enumerator.
Definition enumerator.h:229
existential quantification.
Definition exists.h:23
universal quantification.
Definition forall.h:25
function symbol.
Definition lambda.h:24
Components for generating an arbitrary element of a sort.
representative_generator(const data_specification &specification)
Constructor with data specification as context.
Rewriter that operates on data expressions.
Definition rewriter.h:84
\brief A sort expression
sort_expression(const sort_expression &) noexcept=default
Move semantics.
\brief A data variable
Definition variable.h:25
Models the mapping of mCRL2 action labels to integers.
Definition ltsmin.h:271
const std::string & name() const override
Returns the name of the data type.
Definition ltsmin.h:303
std::size_t parse(const std::string &s) override
Parses a string to a data value, and returns the corresponding index. If the value is not in the mapp...
Definition ltsmin.h:297
std::string print(int i) const override
Returns a human readable representation of the value with index i. N.B. It is not guaranteed that par...
Definition ltsmin.h:292
action_label_data_type(const data::data_specification &data, const process::action_label_list &action_labels)
Definition ltsmin.h:276
std::string serialize(int i) const override
Serializes the i-th value of the data type to a binary string. It is guaranteed that serialize(deseri...
Definition ltsmin.h:282
std::vector< std::string > generate_values(std::size_t) const override
Generates possible values of the data type (at most max_size).
Definition ltsmin.h:309
std::size_t deserialize(const std::string &s) override
Deserializes a string to a data value, and returns the corresponding index. If the value is not in th...
Definition ltsmin.h:287
\brief A timed multi-action
Forward iterator used for iterating over indices.
Definition ltsmin.h:82
std::ptrdiff_t distance_to(const index_iterator &other) const
Definition ltsmin.h:106
const std::size_t & dereference() const
Definition ltsmin.h:101
bool equal(const index_iterator &other) const
Definition ltsmin.h:96
index_iterator(std::size_t index=0)
Definition ltsmin.h:84
Models a pins data type. A pins data type maintains a mapping between known values of a data type and...
Definition ltsmin.h:71
utilities::indexed_set< atermpp::aterm > & indexed_set()
Returns the indexed_set holding the values.
Definition ltsmin.h:193
utilities::indexed_set< atermpp::aterm > m_indexed_set
Definition ltsmin.h:73
const utilities::indexed_set< atermpp::aterm > & indexed_set() const
Returns the indexed_set holding the values.
Definition ltsmin.h:199
virtual std::vector< std::string > generate_values(std::size_t max_size) const =0
Generates possible values of the data type (at most max_size).
bool is_bounded() const
Returns true if the number of elements is bounded. If this property can not be computed for a data ty...
Definition ltsmin.h:157
virtual const std::string & name() const =0
Returns the name of the data type.
const data::data_specification & m_data
Definition ltsmin.h:74
virtual std::size_t parse(const std::string &s)=0
Parses a string to a data value, and returns the corresponding index. If the value is not in the mapp...
virtual std::string serialize(int i) const =0
Serializes the i-th value of the data type to a binary string. It is guaranteed that serialize(deseri...
std::size_t size() const
Returns the number of values that are stored in the map.
Definition ltsmin.h:163
virtual std::size_t deserialize(const std::string &s)=0
Deserializes a string to a data value, and returns the corresponding index. If the value is not in th...
pins_data_type(const data::data_specification &data, const process::action_label_list &action_labels, bool is_bounded=false)
Constructor.
Definition ltsmin.h:115
virtual std::string print(int i) const =0
Returns a human readable representation of the value with index i. N.B. It is not guaranteed that par...
index_iterator index_begin() const
Returns an iterator to the beginning of the indices.
Definition ltsmin.h:169
virtual ~pins_data_type()=default
Destructor.
index_iterator index_end() const
Returns an iterator to the end of the indices.
Definition ltsmin.h:175
atermpp::aterm get(std::size_t i)
Returns the value at index i.
Definition ltsmin.h:187
std::size_t operator[](const atermpp::aterm &x)
Returns the index of the value x.
Definition ltsmin.h:181
const process::action_label_list & m_action_labels
Definition ltsmin.h:75
generator_type m_generator
Definition ltsmin.h:335
const std::vector< std::size_t > & guard_parameters(std::size_t index) const
Definition ltsmin.h:761
guard_evaluation_t
guard evaluations have ternary logic. A guard may not always rewrite to true or false
Definition ltsmin.h:322
const linear_process & process() const
Returns the process of the LPS specification.
Definition ltsmin.h:388
const std::vector< std::size_t > & write_group(std::size_t index) const
Indices of process parameters that influence event or next state of a summand by being written.
Definition ltsmin.h:747
void get_initial_state(ltsmin_state_type &s)
Assigns the initial state to s.
Definition ltsmin.h:814
datatype_index edge_label_type(std::size_t) const
Returns the datatype map index corresponding to edge label i.
Definition ltsmin.h:801
std::string process_parameter_name(std::size_t i) const
Returns a human-readable, unique name for process parameter i.
Definition ltsmin.h:781
std::size_t m_group_count
Definition ltsmin.h:327
std::size_t process_parameter_count() const
Returns the number of process parameters of the LPS.
Definition ltsmin.h:543
pins(const std::string &filename, const std::string &rewriter_strategy)
Constructor.
Definition ltsmin.h:669
void next_state_long(ltsmin_state_type const &src, std::size_t group, StateFunction &f, ltsmin_state_type const &dest, int *const &labels)
Definition ltsmin.h:875
lps::specification m_specification_reduced
Definition ltsmin.h:347
generator_type m_generator_reduced
Definition ltsmin.h:349
std::size_t edge_label_count() const
Returns the number of labels per edge.
Definition ltsmin.h:794
std::size_t m_state_length
Definition ltsmin.h:328
std::string print_vector(Iter first, Iter last) const
Definition ltsmin.h:407
std::string print_vector(const Container &c) const
Definition ltsmin.h:424
std::size_t datatype_count() const
Returns the number of unique datatype maps. Note that the datatype map for action labels is included,...
Definition ltsmin.h:721
utilities::indexed_set< atermpp::aterm > m_guards
Definition ltsmin.h:340
void update_long(ltsmin_state_type const &src, std::size_t group, StateFunction &f, ltsmin_state_type const &dest, int *const &labels)
Definition ltsmin.h:881
std::set< std::string > summand_action_names(std::size_t i) const
Returns the names of the actions that appear in the summand with index i, with 0 <= i < group_count()...
Definition ltsmin.h:825
lps::specification reduce_specification(const lps::specification &spec)
extracts all guards from the original specification and returns a new one with the guards removed.
Definition ltsmin.h:563
std::size_t guard_count() const
Definition ltsmin.h:771
void next_state_all(ltsmin_state_type const &src, StateFunction &f, ltsmin_state_type const &dest, int *const &labels)
Iterates over the 'next states' of state src, and invokes a callback function for each discovered sta...
Definition ltsmin.h:851
std::string info()
Prints an overview of several relevant attributes.
Definition ltsmin.h:959
static lps::specification load_specification(const std::string &filename)
Definition ltsmin.h:554
guard_evaluation_t eval_guard_long(ltsmin_state_type const &src, std::size_t guard)
Definition ltsmin.h:935
pins_data_type & action_label_type_map()
Returns the action data type.
Definition ltsmin.h:364
const linear_process & process_reduced() const
Returns the reduced process of the LPS specification, i.e. with conditions with guards removed.
Definition ltsmin.h:395
std::vector< std::size_t > m_unique_data_type_index
Definition ltsmin.h:361
pins_data_type & data_type(std::size_t i)
Returns a reference to the datatype map with index i.
Definition ltsmin.h:728
std::vector< std::string > m_guard_names
Definition ltsmin.h:343
const std::vector< std::size_t > & guard_info(std::size_t index) const
Definition ltsmin.h:766
data::rewriter m_rewriter_reduced
Definition ltsmin.h:348
const pins_data_type & action_label_type_map() const
Returns the action data type.
Definition ltsmin.h:370
std::vector< pins_data_type * > m_data_types
Definition ltsmin.h:355
data::rewriter m_rewriter
Definition ltsmin.h:334
std::vector< data::variable > m_parameters_list
Definition ltsmin.h:337
const pins_data_type & state_type_map(std::size_t i) const
Returns the data type of the i-th state parameter.
Definition ltsmin.h:382
pins_data_type & state_type_map(std::size_t i)
Returns the data type of the i-th state parameter.
Definition ltsmin.h:376
datatype_index process_parameter_type(std::size_t i) const
Returns the datatype map index corresponding to process parameter i.
Definition ltsmin.h:788
const std::vector< std::size_t > & read_group(std::size_t index) const
Indices of process parameters that influence event or next state of a summand by being read.
Definition ltsmin.h:738
std::string edge_label_name(std::size_t) const
Returns the name of the i-th action label (always "action").
Definition ltsmin.h:808
void initialize_read_write_groups()
Definition ltsmin.h:429
const std::string & guard_name(std::size_t index)
Definition ltsmin.h:776
const std::vector< std::size_t > & update_group(std::size_t index) const
Indices of process parameters that influence event or next state of a summand by being read except fr...
Definition ltsmin.h:756
void _long(ltsmin_state_type const &src, std::size_t group, StateFunction &f, const ltsmin_state_type &dest, int *const &labels, generator_type *generator)
Iterates over the 'next states' of a particular summand of state src that are generated by a group of...
Definition ltsmin.h:906
std::vector< std::string > m_process_parameter_names
Definition ltsmin.h:338
std::size_t group_count() const
Returns the number of available groups. This equals the number of action summands of the LPS.
Definition ltsmin.h:549
lps::specification m_specification
Definition ltsmin.h:332
Linear process specification.
Models the mapping of mCRL2 state values to integers.
Definition ltsmin.h:207
std::size_t expression2index(const data::data_expression &x)
Definition ltsmin.h:212
data::data_expression index2expression(std::size_t i) const
Definition ltsmin.h:217
std::size_t parse(const std::string &s) override
Parses a string to a data value, and returns the corresponding index. If the value is not in the mapp...
Definition ltsmin.h:253
std::string print(int i) const override
Returns a human readable representation of the value with index i. N.B. It is not guaranteed that par...
Definition ltsmin.h:248
data::sort_expression m_sort
Definition ltsmin.h:210
std::size_t deserialize(const std::string &s) override
Deserializes a string to a data value, and returns the corresponding index. If the value is not in th...
Definition ltsmin.h:242
std::string serialize(int i) const override
Serializes the i-th value of the data type to a binary string. It is guaranteed that serialize(deseri...
Definition ltsmin.h:235
std::vector< std::string > generate_values(std::size_t max_size) const override
Generates possible values of the data type (at most max_size).
Definition ltsmin.h:263
const std::string & name() const override
Returns the name of the data type.
Definition ltsmin.h:258
state_data_type(const data::data_specification &data, const process::action_label_list &action_labels, const data::sort_expression &sort, bool sort_is_finite)
Definition ltsmin.h:223
\brief The and operator for pbes expressions
and_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & left() const
const pbes_expression & right() const
std::set< pbes_expression > get_successors(const pbes_expression &phi)
Returns the successors of a state, which is a instantiated propositional variable....
pbes_greybox_interface(pbes &p, bool true_false_dependencies=false, bool is_min_parity=true, data::rewriter::strategy rewrite_strategy=data::rewrite_strategy::jitty)
Constructor.
propositional_variable_instantiation get_initial_state() override
Returns the initial state, rewritten and simplified.
virtual std::string print_successors(const std::set< pbes_expression > &successors)
Prints the set of successors states.
pbes_system::enumerate_quantifiers_rewriter pbes_rewriter
pbes_equation get_pbes_equation(const core::identifier_string &s)
Returns the equation for variable s.
pbes_expression rewrite_and_simplify_expression(const pbes_expression &e, const bool=true)
Rewrites and simplifies an expression.
std::set< pbes_expression > get_successors(const pbes_expression &phi, const std::string &var, const pbes_expression &expr)
Returns the successors of a state, which is a instantiated propositional variable,...
virtual pbes_expression expand_group(const pbes_expression &psi, const pbes_expression &expr)
Expands a formula expr for a instantiated state variable psi, which means substituting the variables ...
virtual bool visit_inner_bounded_exists(const pbes_expression &e)
Visits a bounded existential quantifier expression within a disjunctive expression.
Definition ppg_visitor.h:88
virtual ~ppg_visitor()=default
Destructor.
virtual bool visit_inner_implies(const pbes_expression &e)
Visits a disjunctive expression within an inner universal quantifier expression.
virtual bool visit_or(const pbes_expression &e)
Visits a disjunctive expression.
static std::string print_brief(const pbes_expression &e)
Returns a string representation of the type of the root node of the expression.
Definition ppg_visitor.h:38
virtual bool visit_and(const pbes_expression &e)
Visits a conjunctive expression.
virtual bool visit_propositional_variable(const pbes_expression &e)
Visits a propositional variable expression.
Definition ppg_visitor.h:56
virtual bool visit_inner_and(const pbes_expression &e)
Visits a conjunctive expression within an inner existential quantifier expression.
Definition ppg_visitor.h:68
virtual bool visit_ppg_expression(const pbes_expression &e)
Visits a PPG expression.
virtual bool visit_inner_bounded_forall(const pbes_expression &e)
Visits a bounded universal quantifier expression within a conjunctive expression.
virtual bool visit_simple_expression(const pbes_expression &e)
Visits a simple expression. An expression is simple if it does not contain propositional variables.
Definition ppg_visitor.h:47
\brief The existential quantification operator for pbes expressions
const data::variable_list & variables() const
const pbes_expression & body() const
static ltsmin_state false_state()
Returns the state representing false.
ltsmin_state get_state(const propositional_variable_instantiation &expr) const
Returns a PBES_State object for expr.
std::vector< ltsmin_state > get_successors(const ltsmin_state &state, int group)
Computes successor states for a state as defined in transition group group. Serves as a wrapper aroun...
std::string data_to_string(const data::data_expression &e)
Returns a string representation for the data expression e.
int get_index(int type_no, const std::string &s)
Returns the index of value in the local store for the data type with number type_no....
std::vector< std::string > localmap_int2string
ltsmin_state get_initial_state() const
Returns the initial state.
static ltsmin_state true_state()
Returns the state representing true.
void to_state_vector(const ltsmin_state &dst_state, int *dst, const ltsmin_state &src_state, int *const &src)
Transforms a PBES state to a state vector, represented by an array of integers.
std::string get_value(int type_no, int index)
Returns the value at position index in the local store for the data type with number type_no....
int get_value_index(int type_no, const data_expression &value)
Returns the index of value in the local store for the data type with number type_no....
explorer(const std::string &filename, const std::string &rewrite_strategy, bool reset_flag, bool always_split_flag)
Constructor.
std::map< std::string, int > localmap_string2int
void next_state_long(int *const &src, int group, callback &cb)
Iterates over the successors of a state for a certain transition group and invokes a callback functio...
explorer(const pbes &p_, const std::string &rewrite_strategy, bool reset_flag, bool always_split_flag)
Constructor.
ltsmin_state from_state_vector(int *const &src)
Transforms a state vector src into a PBES_State object object containing the variable and parameter v...
int get_string_index(const std::string &s)
Returns the index of s in the local store for string values. This store is reserved for the string re...
const std::string & get_string_value(int index)
Returns the string at position index in the local store for string values. An exception is thrown if ...
std::vector< ltsmin_state > get_successors(const ltsmin_state &state)
Computes successor states for a state. Serves as a wrapper around the get_successors function of the ...
data::data_expression string_to_data(const std::string &s)
Returns a data expression for the string representation s.
lts_info * get_info() const
Returns the PBES_Info object.
const data_expression & get_data_value(int type_no, int index)
Returns the value at position index in the local store for the data type with number type_no....
void next_state_all(int *const &src, callback &cb)
Iterates over the successors of a state and invokes a callback function for each successor state.
detail::pbes_greybox_interface * pgg
the PBES greybox interface
static fixpoint_symbol nu()
Returns the nu symbol.
fixpoint_symbol & operator=(fixpoint_symbol &&) noexcept=default
static fixpoint_symbol mu()
Returns the mu symbol.
\brief The universal quantification operator for pbes expressions
const pbes_expression & body() const
const data::variable_list & variables() const
\brief The implication operator for pbes expressions
const pbes_expression & left() const
const pbes_expression & right() const
bool is_write_dependent_propvar(int group)
Determines if group is write dependent on the propositional variable. Returns true if propositional v...
std::map< std::string, int > variable_priority
static std::vector< std::string > get_param_sequence(const data::variable_list &params)
Converts a variable_sequence_type into a sequence of parameter signatures.
bool is_read_dependent_parameter(int group, int part)
Determines if group is read dependent on part part of the state vector. Returns true if the parameter...
std::vector< int > get_param_indices(const data::variable_list &params)
Converts a variable_sequence_type into a sequence of indices of parameter signatures in the list of p...
std::vector< std::string > transition_variable_name
bool is_pass_through_state(const propositional_variable_instantiation &propvar)
Determines if the propositional variable instantiation is one that only copies parameters from the cu...
const std::map< std::string, fixpoint_symbol > & get_variable_symbols() const
Returns the map from variable names to the fixpoint operator of the equation for the variable.
static std::map< variable, std::string > variable_signatures
std::map< std::string, fixpoint_symbol > variable_symbol
const std::map< std::string, data::variable_list > & get_variable_parameters() const
Returns the map from variable names to the sequence of parameters for the variable.
const std::map< std::string, propositional_variable > & get_variables() const
Returns the map from variable names to the variable object for the variable.
int get_index(const std::string &signature)
Returns the index for a parameter signature in the list of parameter signatures for the system.
const lts_type & get_lts_type() const
Returns the LTS Type.
std::map< std::string, int > param_index
bool get_reset_option() const
Returns if the reset option is set.
std::set< std::string > copied(const pbes_expression &expr, const std::set< std::string > &L)
Computes the free variables which are copied/passed through (to a recursive variable) in an expressio...
const std::vector< pbes_expression > & get_transition_expressions() const
Returns the map from transition group number to the expression of the transition group.
std::set< std::string > copied(const pbes_expression &expr)
Computes the free variables which are copied/passed through (to a recursive variable) in an expressio...
std::vector< data_expression > param_default_values
detail::pbes_greybox_interface * pgg
bool is_read_dependent_propvar(int group)
Determines if group is read dependent on the propositional variable. Returns true,...
std::vector< pbes_expression > transition_expression
const std::vector< operation_type > & get_transition_types() const
Returns the map from transition group number to the type of the right hand side of the equation to wh...
std::set< std::string > used(const pbes_expression &expr, const std::set< std::string > &L)
Computes the free variables actually used, not only passed through, in an expression.
std::set< std::string > used(const pbes_expression &expr)
Computes the free variables actually used, not only passed through, in an expression.
static std::string get_param_signature(const variable &param)
Returns a signature for parameter param.
const std::map< std::string, operation_type > & get_variable_types() const
Returns the map from variable names to the type of the right hand side of the equation for the variab...
void compute_dependency_matrix()
Computes dependency matrix from PBES.
lts_info(pbes &p, detail::pbes_greybox_interface *pgg, bool reset, bool always_split)
Constructor.
static bool tf(const pbes_expression &phi)
Determines if the term phi contains a branch that directly results in true or false (not a variable).
std::vector< pbes_expression > split_expression_and_substitute_variables(const pbes_expression &e, int current_priority, operation_type current_type, std::set< std::string > vars_stack)
Splits the expression into parts (disjuncts or conjuncts) and recursively tries to substitute the pro...
std::map< std::string, propositional_variable > variables
int get_number_of_groups() const
Returns the number of transition groups.
static std::set< std::string > get_param_set(const data::variable_list &params)
Converts a variable_sequence_type into a set of parameter signatures.
std::map< int, int > get_param_index_positions(const data::variable_list &params)
Converts a variable_sequence_type into a map from indices of parameter signatures (in the list of par...
static std::set< std::string > occ(const pbes_expression &expr)
Computes the propositional variables used in an expression.
std::map< std::string, operation_type > variable_type
int count_variables(const pbes_expression &e)
Counts the number of propositional variables in an expression.
void compute_lts_type()
Computes LTS Type from PBES.
std::vector< operation_type > transition_type
std::set< std::string > changed(const pbes_expression &phi, const std::set< std::string > &L)
Computes the set of parameters changed in the expression.
std::string state_to_string(const ltsmin_state &state)
Returns a string representation for state state.
const std::map< std::string, int > & get_variable_priorities() const
Returns the map from variable names to the priority of the equation for the variable.
std::map< std::string, data::variable_list > variable_parameters
const data_expression & get_default_value(int index)
Returns a default value for the sort of a parameter signature.
const std::vector< std::string > & get_transition_variable_names() const
Returns the map from transition group number to the variable name of the equation to which the transi...
std::set< std::string > reset(const pbes_expression &phi, const std::set< std::string > &d)
Computes the set of parameters reset in the expression.
static std::string get_param_signature(const std::string &paramname, const std::string &paramtype)
Returns a signature using name and type of a parameter.
static std::set< std::string > free(const pbes_expression &expr)
Computes the free variables read in an expression.
std::vector< pbes_expression > transition_expression_plain
bool is_write_dependent_parameter(int group, int part)
Determines if group is read dependent on part part of the state vector. Returns true if the parameter...
std::map< std::string, pbes_expression > variable_expression
std::set< std::string > changed(const pbes_expression &phi)
Computes the set of parameters changed in the expression.
void compute_transition_groups()
Computes transition groups from PBES.
const std::vector< std::string > & get_edge_label_types() const
Returns the sequence of edge label types.
std::size_t get_number_of_state_types() const
Returns the number of state types.
const std::vector< std::string > & get_edge_labels() const
Returns the sequence of edge labels.
int get_state_type_no(int part) const
Returns the state type index for the state part part.
std::vector< std::string > state_type_list
std::vector< std::string > state_label_types
std::vector< std::string > state_names
std::vector< int > state_type_no
void add_state(const std::string &name, const std::string &type)
Adds a state part of type type with name name.
void add_state_label(const std::string &name, const std::string &type)
Adds a state label of type type with name name.
lts_type(int state_length)
Contructor.
std::string get_state_type_name(int type_no) const
Returns the name of the state type with number type_no.
int get_state_length() const
Returns the state length.
std::map< std::string, int > state_type_index
std::vector< std::string > edge_label_names
const std::vector< std::string > & get_state_label_types() const
Returns the sequence of state label types.
std::vector< std::string > edge_label_types
std::vector< std::string > state_types
std::size_t get_number_of_edge_labels() const
Returns the number of edge labels.
std::vector< std::string > state_label_names
const std::vector< std::string > & get_state_types() const
Returns the sequence of state part types.
void add_edge_label(const std::string &name, const std::string &type)
Adds an edge label of type type with name name.
const std::vector< std::string > & get_state_labels() const
Returns the sequence of state labels.
const std::vector< std::string > & get_state_names() const
Returns the sequence of state part names.
std::size_t get_number_of_state_labels() const
Returns the number of state labels.
void add_parameter_value(const data_expression &)
Adds a parameter value to the list of parameter values.
pbes_expression to_pbes_expression() const
Returns a PBES expression representing the state.
std::vector< data_expression > param_values
std::string state_to_string() const
Returns a string representation of the state.
bool operator<(const ltsmin_state &other) const
Compares two PBES_State objects. Uses lexicographical ordering on priority, type, variable and parame...
ltsmin_state(const std::string &varname)
Constructor.
bool operator==(const ltsmin_state &other) const
Checks if two PBES_State objects are equal.
ltsmin_state(const std::string &varname, const pbes_expression &e)
Constructor.
std::string get_variable() const
Returns a string representation of the propositional variable of the state.
const std::vector< data_expression > & get_parameter_values() const
Returns the list of parameter values.
\brief The not operator for pbes expressions
const pbes_expression & operand() const
\brief The or operator for pbes expressions
const pbes_expression & left() const
or_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & right() const
Class for generating a BES from a PBES. This BES can be interpreted as a graph corresponding to a par...
void compute_priorities(const std::vector< pbes_equation > &equations)
Compute priorities of PBES propositional variables.
virtual operation_type get_expression_operation(const pbes_expression &phi)
Returns the vertex type.
virtual void print_variable_mapping()
Prints the mapping from BES variables to the corresponding PBES expressions.
std::map< core::identifier_string, std::size_t > m_priorities
Maps propositional variables to corresponding priorities.
void compute_equation_index_map()
Compute equation index map.
pbes_expression expand_rhs(const pbes_expression &psi)
parity_game_generator(pbes &p, bool true_false_dependencies=false, bool is_min_parity=true, data::rewriter::strategy rewrite_strategy=data::rewrite_strategy::jitty)
Constructor.
virtual operation_type get_operation(std::size_t index)
Returns the vertex type.
bool m_true_false_dependencies
Determines what kind of BES equations are generated for true and false.
virtual propositional_variable_instantiation get_initial_state()
Returns the (rewritten) initial state.
std::string print_equation_count(std::size_t size, std::size_t step=1000) const
Prints a log message for every step-th equation.
std::map< pbes_expression, std::size_t > m_pbes_expression_index
Maps PBES closed expressions to corresponding BES variables.
std::size_t m_max_priority
The maximum priority value of the game.
pbes_system::enumerate_quantifiers_rewriter R
PBES rewriter.
void make_substitution(const data::variable_list &v, const data::data_expression_list &e, substitution_function &sigma) const
Generates a substitution function for the pbesinst rewriter.
pbes & m_pbes
The PBES that is being solved.
virtual std::size_t get_priority(std::size_t index)
Returns the priority of a vertex. The priority of the first equation is 0 if it is a maximal fixpoint...
virtual std::set< std::size_t > get_initial_values()
Returns the vertices for which a solution is requested. By default a set containing the values 0,...
virtual std::string print_bes_equation(std::size_t index, const std::set< std::size_t > &rhs)
operation_type
The operation type of the vertices.
bool m_is_min_parity_game
True if it is a min-parity game.
std::size_t add_bes_equation(pbes_expression t, std::size_t priority)
Adds a BES equation for a given PBES expression, if it not already exists.
bool m_initialized
Mark whether initialization has been initialized. Needed to properly cope with virtual inheritance!
virtual std::set< std::size_t > get_dependencies(std::size_t index)
Returns the successors of a vertex in the graph.
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
const fixpoint_symbol & symbol() const
Returns the fixpoint symbol 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
parameterized boolean equation system
Definition pbes.h:54
propositional_variable_instantiation & initial_state()
Returns the initial state.
Definition pbes.h:194
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
\brief A propositional variable declaration
const core::identifier_string & name() const
propositional_variable(const core::identifier_string &name, const data::variable_list &parameters)
\brief Constructor Z12.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:435
atermpp::aterm remove_index(const atermpp::aterm &x)
Definition io.h:50
void split_finite_variables(data::variable_list variables, const data::data_specification &data, data::variable_list &finite_variables, data::variable_list &infinite_variables, data::variable_list &unused, const FILTER filter)
Splits the variables in a subset with finite sort, with infinite sort and those that are not used acc...
void split_enumerable_variables(data::variable_list variables, const data::data_specification &data, const Rewriter &rewr, data::variable_list &enumerable_variables, data::variable_list &non_enumerable_variables, data::variable_list &unused, const FILTER filter)
Splits a list of variables in those that are enumerable, non enumerable and not used,...
Namespace for system defined sort bool_.
Definition bool.h:29
const function_symbol & false_()
Constructor for function symbol false.
Definition bool.h:106
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.
std::ostream & operator<<(std::ostream &out, const no_substitution &)
The main namespace for the LPS library.
Definition constelm.h:18
std::vector< std::string > generate_values(const data::data_specification &dataspec, const data::sort_expression &s, std::size_t max_size=1000)
Generates possible values of the data type (at most max_size).
Definition ltsmin.h:42
The namespace for accessor functions on pbes expressions.
const pbes_expression & arg(const pbes_expression &t)
Returns the pbes expression argument of expressions of type not, exists and forall.
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.
std::set< data::variable > significant_variables(const pbes_expression &x)
Returns the significant variables of a pbes expression.
void remove_parameters(pbes &x, const std::set< data::variable > &to_be_removed)
Removes parameters from propositional variable instantiations in a pbes expression.
void remove_parameters(pbes &x, const std::map< core::identifier_string, std::vector< std::size_t > > &to_be_removed)
Removes parameters from propositional variable instantiations in a pbes expression.
void pbesinst_finite(pbes &p, data::rewrite_strategy rewrite_strategy, const std::string &finite_parameter_selection)
Apply finite instantiation to the given PBES.
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_normalized(const pbes &x)
Checks if a PBEs is normalized.
std::vector< propositional_variable > remove_unreachable_variables(pbes &p)
Removes equations that are not (syntactically) reachable from the initial state of a PBES.
bool is_bes(const pbes &x)
Returns true if a PBES is in BES form.
Definition pbes.cpp:69
std::string print_removed_equations(const std::vector< propositional_variable > &removed)
Print removed equations.
void normalize(pbes &x)
The function normalize brings (embedded) pbes expressions into positive normal form,...
apply_enumerate_builder< Builder, DataRewriter, MutableSubstitution, no_substitution > make_apply_enumerate_builder(const DataRewriter &R, MutableSubstitution &sigma, const data::data_specification &dataspec, data::enumerator_identifier_generator &id_generator, bool enumerate_infinite_sorts)
static void inc_indent()
Increases the current indent level.
bool is_counter_example_equation(const pbes_equation &equation)
Guesses if the PBES equation is a counter example equation.
bool is_counter_example_positive(const core::identifier_string &name)
Returns true iff the name is Zpos, name must be a counter example name.
apply_data_rewriter_with_pbes_substitution_builder< Builder, DataRewriter, MutableSubstitution, PbesSubstitution > make_apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes)
mcrl2::pbes_system::pbes remove_counterexample_info(const pbes_system::pbes &pbes, bool remove_Lplus=true, bool remove_Lminus=true, bool remove_Lequations=true)
Removes all equations and expressions related to counter examples from the input PBES.
void data_rewrite(data::data_expression &result, const data::data_expression &x, const DataRewriter &R, SubstitutionFunction &sigma)
bool is_counter_example_instantiation(const propositional_variable_instantiation &inst)
Guesses if the PBES variable instantiation is for counter example equation.
void data_rewrite(data::data_expression &result, const data::data_expression &x, const DataRewriter &R, data::no_substitution &)
bool has_counter_example_information(const pbes &pbesspec)
Guesses if a pbes has counter example information.
bool counter_example_index(const core::identifier_string &name, std::size_t &index)
Extracts the index embedded in a Zpos_<index>_.../Zneg_<index>_... counter example name.
static void indent()
Indents according to the current indent level.
static void dec_indent()
Decreases the current indent level.
bool is_counter_example_variable(const propositional_variable &X)
static int indent_count
The current indent level. Used for debug output.
apply_rewriter_builder< Builder, DataRewriter, SubstitutionFunction > make_apply_rewriter_builder(const DataRewriter &datar, SubstitutionFunction &sigma)
bool is_counter_example_name(const core::identifier_string &name)
apply_data_rewriter_with_pbes_substitution_builder< Builder, DataRewriter, MutableSubstitution, no_substitution > make_apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma)
MapContainer::mapped_type map_at(const MapContainer &m, typename MapContainer::key_type key)
apply_enumerate_builder< Builder, DataRewriter, MutableSubstitution, PbesSubstitution > make_apply_enumerate_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes, const data::data_specification &dataspec, data::enumerator_identifier_generator &id_generator, bool enumerate_infinite_sorts)
The main namespace for the PBES library.
bool is_pbes_file_format(const utilities::file_format &format)
Definition io.h:26
pbes_expression join_or(FwdIt first, FwdIt last)
Returns or applied to the sequence of pbes expressions [first, last)
Definition join.h:24
bool is_data(const pbes_expression &t)
Returns true if the term t is a data expression.
pbes_expression optimized_or(const pbes_expression &p, const pbes_expression &q)
Make a disjunction.
void load_pbes(pbes &pbes, std::istream &stream, utilities::file_format format, const std::string &)
Load a PBES from file.
Definition io.cpp:83
std::set< pbes_expression > split_and(const pbes_expression &expr, bool split_data_expressions=false)
Splits a conjunction into a sequence of operands Given a pbes expression of the form p1 && p2 && ....
Definition join.h:74
void save_pbes(const pbes &pbes, const std::string &filename, utilities::file_format format, bool welltypedness_check)
save_pbes Saves a PBES to a file.
Definition io.cpp:114
const pbes_expression & true_()
bool is_not(const atermpp::aterm &x)
const utilities::file_format & pbes_format_internal_bes()
Definition io.h:43
pbes_expression optimized_join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of pbes expressions [first, last)
Definition join.h:112
pbes_expression optimized_join_or(FwdIt first, FwdIt last)
Returns or applied to the sequence of pbes expressions [first, last)
Definition join.h:96
pbes_expression join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of pbes expressions [first, last)
Definition join.h:34
void load_pbes(pbes &pbes, const std::string &filename, utilities::file_format format)
Load pbes from file.
Definition io.cpp:149
const utilities::file_format & pbes_format_pgsolver()
Definition io.h:45
bool is_exists(const atermpp::aterm &x)
utilities::file_format guess_format(const std::string &filename)
Definition io.h:47
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.
bool is_non_simple_conjunct(const pbes_expression &t)
Test for a conjunction.
bool is_simple_expression(const T &x, bool allow_counter_example_propvar)
Determines if an expression is a simple expression. An expression is simple if it is free of proposit...
bool is_forall(const atermpp::aterm &x)
pbes_expression optimized_and(const pbes_expression &p, const pbes_expression &q)
Make a conjunction.
const std::vector< utilities::file_format > & pbes_file_formats()
Definition io.cpp:27
void save_bes_pgsolver(const pbes &bes, std::ostream &stream, bool maxpg)
Definition pgsolver.cpp:141
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.
std::vector< pbes_expression > split_disjuncts(const pbes_expression &expr, bool split_simple_expr=false)
Splits a disjunction into a sequence of operands. Given a pbes expression of the form p1 || p2 || ....
bool is_pbes_and(const pbes_expression &t)
Returns true if the term t is an and expression.
void save_pbes(const pbes &pbes, std::ostream &stream, utilities::file_format format)
Save a PBES in the format specified.
Definition io.cpp:50
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.
bool is_simple_expression_with_cache(const T &x, bool allow_counter_example_propvar, std::map< pbes_expression, bool > &cache_true, std::map< pbes_expression, bool > &cache_false)
Determines if an expression is a simple expression using a cache. An expression is simple if it is fr...
std::vector< pbes_expression > split_conjuncts(const pbes_expression &expr, bool split_simple_expr=false)
Splits a conjunction into a sequence of operands Given a pbes expression of the form p1 && p2 && ....
const utilities::file_format & pbes_format_internal()
Definition io.h:39
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
const utilities::file_format & pbes_format_text()
Definition io.h:41
bool is_and(const atermpp::aterm &x)
std::string print_brief(const T &x)
Returns a string representation of the root node of a PBES.
std::set< pbes_expression > split_or(const pbes_expression &expr, bool split_data_expressions=false)
Splits a disjunction into a sequence of operands Given a pbes expression of the form p1 || p2 || ....
Definition join.h:48
bool is_non_simple_disjunct(const pbes_expression &t)
Test for a disjunction.
bool is_imp(const atermpp::aterm &x)
bool is_true(const pbes_expression &t)
Test for the value true.
const pbes_expression & false_()
The main namespace for the Process library.
void enumerate_exists(data_expression &result, const data::variable_list &v, const data_expression &phi)
void operator()(data_expression &result, const data_expression &x, MutableSubstitution &sigma)
data::enumerator_algorithm< self > E
The enumerator.
atermpp::vector< data::data_expression > undo_substitution(const data::variable_list &variables)
enumerate_quantifiers_builder(const DataRewriter &R, MutableSubstitution &sigma, const data::data_specification &dataspec, data::enumerator_identifier_generator &id_generator, bool enumerate_infinite_sorts=true)
Constructor.
void enumerate_forall(data_expression &result, const data::variable_list &v, const data_expression &phi)
bool m_enumerate_infinite_sorts
If false, only quantifier variables over finite sort are enumerated.
void redo_substitution(const data::variable_list &v, const atermpp::vector< data::data_expression > &undo)
data_expression operator()(const data_expression &x, Substitution &sigma) const
data::enumerator_identifier_generator & m_id_generator
bool m_enumerate_infinite_sorts
If true, quantifier variables of infinite sort are enumerated.
enumerate_quantifiers_rewriter(const data::rewriter &R, const data::data_specification &dataspec, data::enumerator_identifier_generator &id_generator, bool enumerate_infinite_sorts=true)
const data::data_specification & m_dataspec
A data specification.
void operator()(data_expression &result, const data_expression &x, Substitution &sigma) const
An empty struct that is used to denote the absence of a substitution. Used for rewriters.
const variable & operator()(const variable &v) const
static constexpr bool is_identity_substitution
A rewriter that applies a data rewriter to data expressions in a term.
pbes_expression operator()(const pbes_expression &x, SubstitutionFunction &sigma) const
pbes_expression operator()(const pbes_expression &x) const
data_rewriter(const DataRewriter &R_)
void apply(T &result, const data::data_expression &x)
add_data_rewriter(const DataRewriter &R_, SubstitutionFunction &sigma_)
void apply(T &result, const propositional_variable_instantiation &x)
void apply(T &result, const forall &x)
void apply(T &result, const exists &x)
void apply(T &result, const or_ &x)
void apply(T &result, const not_ &x)
void apply(T &result, const and_ &x)
apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma)
apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes)
apply_enumerate_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes, const data::data_specification &dataspec, data::enumerator_identifier_generator &id_generator, const enumerate_quantifiers_mode enum_mode)
apply_rewriter_builder(const DataRewriter &datar, SubstitutionFunction &sigma)
A visitor class for PBES equations in BQNF. There is a visit_<node> function for each type of node....
bool debug
flag that indicates if debug output should be printed.
virtual bool visit_bqnf_equation(const pbes_equation &eqn)
Visits a BQNF equation.
virtual bool visit_inner_bounded_exists(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded existential quantifier expression within a disjunctive expression.
static std::string print_brief(const pbes_expression &e)
Returns a string representation of the type of the root node of the expression.
virtual bool visit_bounded_forall(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded universal quantifier expression.
virtual bool visit_bounded_quantifier(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded quantifier expression.
virtual bool visit_inner_and(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a conjunctive expression within an inner existential quantifier expression.
virtual bool visit_propositional_variable(const fixpoint_symbol &, const propositional_variable &, const pbes_expression &e)
Visits a propositional variable expression.
static bool is_inner_implies(const pbes_expression &e)
Determines if an expression if of the form phi => psi or of the form phi \/ psi where phi is a simple...
virtual bool visit_simple_expression(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a simple expression. An expression is simple if it does not contain propositional variables.
virtual bool visit_bqnf_expression(const pbes_expression &e)
Visits a BQNF expression. In the current BQNF visitor sigma and var parameters are added for use in b...
virtual bool visit_and(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a conjunctive expression.
virtual bool visit_bqnf_expression(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a BQNF expression.
static bool is_inner_and(const pbes_expression &e)
Determines if an expression if of the form phi /\ psi where phi is a simple expression and psi is an ...
virtual ~bqnf_visitor()=default
Destructor.
virtual bool visit_or(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a disjunctive expression.
virtual bool visit_bqnf_equation_debug(const pbes_equation &eqn)
Visits a BQNF equation in debug mode.
virtual bool visit_bounded_exists(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded existential quantifier expression.
virtual bool visit_inner_bounded_forall(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded universal quantifier expression within a conjunctive expression.
data_rewriter_builder(const DataRewriter &R, SubstitutionFunction &sigma)
enumerate_quantifiers_mode m_enum_mode
If false, only quantifier variables over finite sorts are enumerated.
void operator()(pbes_expression &result, const pbes_expression &x, MutableSubstitution &)
void enumerate_exists(pbes_expression &result, const data::variable_list &v, const pbes_expression &phi)
data::enumerator_identifier_generator & m_id_generator
identifier generator
void redo_substitution(const data::variable_list &v, const atermpp::vector< data::data_expression > &undo)
pbes_expression operator()(const pbes_expression &x, MutableSubstitution &)
void enumerate_forall(pbes_expression &result, const data::variable_list &v, const pbes_expression &phi)
atermpp::vector< data::data_expression > undo_substitution(const data::variable_list &variables)
enumerate_quantifiers_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes, const data::data_specification &dataspec, data::enumerator_identifier_generator &id_generator, enumerate_quantifiers_mode enum_mode=enumerate_quantifiers_mode::expand_infinite_sorts_and_use_data_rewriter)
Constructor.
void apply_substitution(T &result, const propositional_variable_instantiation &x, const SubstitutionType &sigma)
simplify_data_rewriter_builder(const DataRewriter &R, MutableSubstitution &sigma)
void apply_substitution(T &, const propositional_variable_instantiation &, const no_substitution &)
Overload to have a trivial function in case the substitution is no_substitution.
simplify_data_rewriter_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes)
void apply(T &result, const propositional_variable_instantiation &x)
void apply(T &result, const propositional_variable_instantiation &x)
void operator()(pbes_expression &result, const pbes_expression &x, MutableSubstitution &sigma) const
void thread_initialise()
Initialises this rewriter with thread dependent information.
pbes_expression operator()(const pbes_expression &x, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes) const
enumerate_quantifiers_mode m_enum_mode
If true, quantifier variables of infinite sort are enumerated.
enumerate_quantifiers_rewriter clone()
Create a clone of the rewriter in which the underlying rewriter is copied, and not passed as a shared...
data::data_specification m_dataspec
A data specification.
void operator()(pbes_expression &result, const pbes_expression &x, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes) const
pbes_expression operator()(const pbes_expression &x) const
enumerate_quantifiers_rewriter(const data::rewriter &R, const data::data_specification &dataspec, const enumerate_quantifiers_mode enum_mode=enumerate_quantifiers_mode::expand_infinite_sorts_and_use_data_rewriter)
pbes_expression operator()(const pbes_expression &x, MutableSubstitution &sigma) const
bool operator()(const pbes_expression &x) const
Definition enumerator.h:22
bool operator()(const pbes_expression &x) const
Definition enumerator.h:30
An empty struct that can be used to indicate that there is no substitution that should be applied to ...
Visitor for printing the root node of a PBES.
void apply(const pbes_equation &x)
void apply(const propositional_variable_instantiation &x)
A rewriter that simplifies boolean expressions in a term, and rewrites data expressions using DataRew...
pbes_expression operator()(const pbes_expression &x) const
pbes_expression operator()(const pbes_expression &x, Substitution &sigma, const PbesSubstitution &sigma_pbes) const
void operator()(pbes_expression &result, const pbes_expression &x, Substitution &sigma, const PbesSubstitution &sigma_pbes) const
void operator()(pbes_expression &result, const pbes_expression &x, Substitution &sigma) const
pbes_expression operator()(const pbes_expression &x, Substitution &sigma) const
A rewriter that simplifies boolean expressions in a term.
void operator()(pbes_expression &result, const pbes_expression &x) const
pbes_expression operator()(const pbes_expression &x, const PbesSubstitution &sigma) const
pbes_expression operator()(const pbes_expression &x) const
void operator()(pbes_expression &result, const pbes_expression &x, const PbesSubstitution &sigma) const