12#ifndef MCRL2_LPS_LTSMIN_H
13#define MCRL2_LPS_LTSMIN_H
17#include "mcrl2/data/join.h"
18#include "mcrl2/lps/find.h"
19#include "mcrl2/lps/io.h"
20#include "mcrl2/lps/explorer.h"
21#include "mcrl2/lps/parse.h"
25using mcrl2::
log::logger;
31#ifdef MCRL2_ENABLE_JITTYC
32#define MCRL2_JITTYC_AVAILABLE
43 typedef data::enumerator_list_element_with_substitution<> enumerator_element;
45 std::vector<std::string> result;
46 std::size_t max_iterations = 10000;
49 bool accept_solutions_with_variables =
false;
51 data::mutable_indexed_substitution<> sigma;
55 E.enumerate(enumerator_element(v_list, data::sort_bool::true_()),
57 [&](
const enumerator_element& p)
59 p.add_assignments(v_list, sigma, rewr);
60 result.push_back(data::pp(sigma(x)));
61 return result.size() >= max_size;
88 friend class boost::iterator_core_access;
116 bool is_bounded =
false)
135 virtual std::size_t deserialize(
const std::string& s) = 0;
146 virtual std::size_t parse(
const std::string& s) = 0;
164 return m_indexed_set.size();
182 return m_indexed_set.insert(x).first;
188 return m_indexed_set.at(i);
194 return m_indexed_set;
200 return m_indexed_set;
213 return m_indexed_set.insert(x).first;
218 return static_cast<data::data_expression>(m_indexed_set.at(i));
241 std::size_t deserialize(
const std::string& s)
override
252 std::size_t parse(
const std::string& s)
override
264 return lps::generate_values(m_data, m_sort, max_size);
283 return pp(m_indexed_set.at(i));
286 std::size_t deserialize(
const std::string& s)
override
288 return m_indexed_set.insert(atermpp::read_term_from_string(s)).first;
293 return lps::pp(lps::multi_action(m_indexed_set.at(i)));
296 std::size_t parse(
const std::string& s)
override
299 return m_indexed_set.insert(m).first;
310 return std::vector<std::string>();
363 return *m_data_types.back();
369 return *m_data_types.back();
375 return *m_data_types[i];
381 return *m_data_types[i];
387 return m_specification.process();
394 return m_specification_reduced.process();
400 return m_specification.data();
403 template <
typename Iter>
404 std::string print_vector(Iter first, Iter last)
const
406 std::ostringstream out;
408 for (Iter i = first; i != last; ++i)
420 template <
typename Container>
421 std::string print_vector(
const Container& c)
const
423 return print_vector(c.begin(), c.end());
428 std::set<data::variable> parameters(process().process_parameters().begin(), process().process_parameters().end());
435 m_read_group.resize(m_group_count);
436 m_write_group.resize(m_group_count);
441 for (
const auto & summand : proc.action_summands())
443 std::set<data::variable> used_read_variables;
444 std::set<data::variable> used_write_variables;
446 data::find_free_variables(summand.condition(), std::inserter(used_read_variables, used_read_variables.end()));
447 lps::find_free_variables(summand.multi_action(), std::inserter(used_read_variables, used_read_variables.end()));
449 for (
const auto & assignment : summand.assignments())
451 if (assignment.lhs() != assignment.rhs())
453 data::find_all_variables(assignment.lhs(), std::inserter(used_write_variables, used_write_variables.end()));
454 data::find_all_variables(assignment.rhs(), std::inserter(used_read_variables, used_read_variables.end()));
459 std::set<data::variable> used_read_parameters;
460 std::set<data::variable> used_write_parameters;
462 std::set_intersection(used_read_variables.begin(),
463 used_read_variables.end(),
466 std::inserter(used_read_parameters,
467 used_read_parameters.begin()));
468 std::set_intersection(used_write_variables.begin(),
469 used_write_variables.end(),
472 std::inserter(used_write_parameters,
473 used_write_parameters.begin()));
476 for (
auto & param : m_parameters_list)
478 if (used_read_parameters.find(param) != used_read_parameters.end())
480 m_read_group[i].push_back(j);
482 if (used_write_parameters.find(param) != used_write_parameters.end())
484 m_write_group[i].push_back(j);
492 m_update_group.resize(m_group_count);
497 for (
const auto & reduced_summand : process_reduced().action_summands())
499 std::set<data::variable> used_update_variables;
501 data::find_free_variables(reduced_summand.condition(), std::inserter(used_update_variables, used_update_variables.end()));
502 lps::find_free_variables(reduced_summand.multi_action(), std::inserter(used_update_variables, used_update_variables.end()));
504 for (
const auto & assignment : reduced_summand.assignments())
506 if (assignment.lhs() != assignment.rhs())
508 data::find_all_variables(assignment.rhs(), std::inserter(used_update_variables, used_update_variables.end()));
513 std::set<data::variable> used_update_parameters;
515 std::set_intersection(used_update_variables.begin(),
516 used_update_variables.end(),
519 std::inserter(used_update_parameters,
520 used_update_parameters.begin()));
523 for (
auto & param : m_parameters_list)
525 if (used_update_parameters.find(param) != used_update_parameters.end())
527 m_update_group[i].push_back(j);
542 return m_specification.process().process_parameters().size();
548 return m_specification.process().action_summands().size();
554 load_lps(specification, filename);
555 return specification;
562 std::vector<lps::action_summand> reduced_summands;
563 for (
const auto & summand : spec.process().action_summands())
566 std::vector<std::size_t> guard_info;
570 data::data_expression reduced_condition = data::sort_bool::true_();
573 std::set<data::data_expression> conjuncts = data::split_and(summand.condition());
574 std::set<data::variable> summation_variables(summand.summation_variables().begin(), summand.summation_variables().end());
576 for (
const auto & conjunct : conjuncts)
579 std::size_t at = m_guards.index(conjunct);
580 bool is_new = (at == utilities::indexed_set<atermpp::aterm>::npos);
581 bool use_conjunct_as_guard =
true;
584 std::set<data::variable> conjunct_variables;
585 data::find_free_variables(conjunct, std::inserter(conjunct_variables, conjunct_variables.end()));
587 if (!summand.summation_variables().empty())
591 std::set<data::variable> summation_variables_in_conjunct;
592 std::set_intersection(conjunct_variables.begin(),
593 conjunct_variables.end(),
594 summation_variables.begin(),
595 summation_variables.end(),
596 std::inserter(summation_variables_in_conjunct, summation_variables_in_conjunct.begin()));
598 if (!summation_variables_in_conjunct.empty()) {
600 use_conjunct_as_guard =
false;
602 std::string printed_guard(data::pp(conjunct).substr(0, 80));
604 <<
"Guard '" << printed_guard + (printed_guard.size() > 80?
"...":
"") <<
"' in summand "
605 << reduced_summands.size()
606 <<
" introduces local variables. To remove the guard from the condition, try instantiating the summand with 'lpssuminst'."
610 if (reduced_condition == data::sort_bool::true_()) {
611 reduced_condition = conjunct;
613 reduced_condition = data::sort_bool::and_(reduced_condition, conjunct);
617 if (use_conjunct_as_guard) {
619 std::vector<std::size_t> guard_parameters;
620 if (!conjunct_variables.empty())
624 for (
auto & param : m_parameters_list)
626 if (conjunct_variables.find(param) != conjunct_variables.end())
628 guard_parameters.push_back(p);
634 at = m_guards.insert(conjunct).first;
635 m_guard_names.push_back(data::pp(conjunct));
636 guard_parameters_list.push_back(guard_parameters);
639 if (use_conjunct_as_guard) {
641 guard_info.push_back(at);
646 m_guard_info.push_back(guard_info);
649 reduced_summands.push_back(lps::action_summand(summand.summation_variables(), reduced_condition, summand.multi_action(), summand.assignments()));
653 lps::
linear_process lps_reduced(process().process_parameters(), process().deadlock_summands(), reduced_summands);
656 lps::
specification specification_reduced(m_specification.data(), m_specification.action_labels(), m_specification.global_variables(), lps_reduced, m_specification.initial_process());
657 return specification_reduced;
663 pins(
const std::string& filename,
const std::string& rewriter_strategy)
664 : m_specification(load_specification(filename)),
665 m_generator(m_specification, data::parse_rewrite_strategy(rewriter_strategy)),
666 m_parameters_list(process().process_parameters().begin(), process().process_parameters().end()),
667 m_specification_reduced(reduce_specification(m_specification)),
668 m_generator_reduced(m_specification_reduced, data::parse_rewrite_strategy(rewriter_strategy))
674 for (
const auto & param : params)
676 m_process_parameter_names.push_back(param.name());
681 std::map<data::sort_expression, pins_data_type*> existing_type_maps;
682 std::vector<data::variable> parameters(process().process_parameters().begin(),process().process_parameters().end());
683 for (std::size_t i = 0; i < params.size(); i++)
685 data::sort_expression s = parameters[i].sort();
686 std::map<data::sort_expression, pins_data_type*>::const_iterator j = existing_type_maps.find(s);
687 if (j == existing_type_maps.end())
689 pins_data_type* dt =
new state_data_type(m_specification.data(), m_specification.action_labels(), s, m_specification.data().is_certainly_finite(s));
690 m_data_types.push_back(dt);
691 m_unique_data_types.push_back(dt);
692 existing_type_maps[s] = dt;
696 m_data_types.push_back(j->second);
699 pins_data_type* dt =
new action_label_data_type(m_specification.data(), m_specification.action_labels());
700 m_data_types.push_back(dt);
701 m_unique_data_types.push_back(dt);
703 for (
auto m_data_type : m_data_types)
705 std::vector<pins_data_type*>::const_iterator j = std::find(m_unique_data_types.begin(), m_unique_data_types.end(), m_data_type);
706 assert(j != m_unique_data_types.end());
707 m_unique_data_type_index.push_back(j - m_unique_data_types.begin());
714 std::set<pins_data_type*> deleted;
715 for (
auto& data_type_ptr: m_data_types)
717 if (deleted.find(data_type_ptr) == deleted.end())
719 delete data_type_ptr;
720 deleted.insert(data_type_ptr);
729 return m_unique_data_types.size();
736 assert (i < m_data_types.size());
737 return *m_unique_data_types[i];
746 return m_read_group[index];
755 return m_write_group[index];
764 return m_update_group[index];
769 return guard_parameters_list[index];
774 return m_guard_info[index];
779 return m_guards.size();
783 return m_guard_names[index];
789 return m_process_parameter_names[i];
796 return m_unique_data_type_index[i];
809 return m_unique_data_types.size() - 1;
822 state initial_state(m_generator.initial_state().begin(), m_generator.initial_state().size());
825 s[i] = state_type_map(i)[initial_state[i]];
833 std::set<std::string> result;
834 auto const l =
process().action_summands()[i].multi_action().actions();
836 for (
const auto & i : l)
838 result.insert(std::string(i.label().name()));
856 template <
typename StateFunction>
861 for (
std::size_t i = 0; i < nparams; i++)
863 state_arguments[i] =
static_cast<data::data_expression>(state_type_map(i).get(src[i]));
866 state source(state_arguments.begin(),nparams);
868 std::list<generator_type::transition> transitions = m_generator.out_edges(source);
869 for (
const generator_type::transition& t: transitions)
871 state destination = t.state;
872 for (std::size_t j = 0; j < nparams; j++)
874 dest[j] = state_type_map(j)[destination[j]];
876 labels[0] = action_label_type_map()[t.action];
881 template <
typename StateFunction>
884 _long(src, group, f, dest, labels, &m_generator);
887 template <
typename StateFunction>
890 _long(src, group, f, dest, labels, &m_generator_reduced);
912 template <
typename StateFunction>
922 for (
std::size_t i = 0; i < nparams; i++)
924 state_arguments[i] =
static_cast<data::data_expression>(state_type_map(i).get(src[i]));
926 state source(state_arguments.begin(),nparams);
928 std::list<generator_type::transition> transitions = generator->out_edges(source, group);
930 for (
const generator_type::transition& t: transitions)
932 state destination = t.state;
933 for (std::size_t j = 0; j < nparams; j++)
935 dest[j] = state_type_map(j)[destination[j]];
937 labels[0] = action_label_type_map()[t.action];
945 for (
std::size_t i = 0; i < nparams; i++)
948 substitution[m_parameters_list[i]] = value;
953 static_cast<data::data_expression>(m_guards.at(guard)),
968 std::ostringstream out;
970 out <<
"\n--- EDGE LABELS ---\n";
979 out <<
"\n--- PROCESS PARAMETERS ---\n";
988 out <<
"\n--- SUMMANDS ---\n";
993 out <<
" read_group(" << i <<
") = " << print_vector(read_group(i)) << std::endl;
994 out <<
" write_group(" << i <<
") = " << print_vector(write_group(i)) << std::endl;
995 out <<
"update_group(" << i <<
") = " << print_vector(update_group(i)) << std::endl;
998 out <<
"\n--- GUARDS ---\n";
1002 out <<
"guard(" << i <<
") = " << print_vector(guard_parameters(i)) << std::endl;
1005 out <<
"\n--- INITIAL STATE ---\n";
1011 out <<
"\n--- DATA TYPE MAPS ---\n";
1017 out <<
"datatype " << i <<
"\n"
1018 <<
" name = " << type
.name() <<
"\n"
1019 <<
" size = " << type
.size() <<
"\n"
1023 out <<
" possible values: " <<
core::
detail::print_set(type.generate_values(10)) <<
std::endl;
aterm_string(const std::string &s)
Constructor that allows construction from a string.
aterm(const aterm &other) noexcept=default
This class has user-declared copy constructor so declare default copy and move operators.
bool operator==(const unprotected_aterm_core &t) const
Comparison operator.
bool operator!=(const unprotected_aterm_core &t) const
Inequality operator on two unprotected aterms.
data_expression(const atermpp::aterm &term)
An enumerator algorithm that generates solutions of a condition.
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.
basic_rewriter< data_expression >::substitution_type substitution_type
sort_expression(const sort_expression &) noexcept=default
Move semantics.
const core::identifier_string & name() const
const sort_expression & sort() const
Class for logging messages.
logger(const log_level_t l)
Default constructor.
Models the mapping of mCRL2 action labels to integers.
const std::string & name() const override
Returns the name of the data type.
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...
action_label_data_type(const data::data_specification &data, const process::action_label_list &action_labels)
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...
std::vector< std::string > generate_values(std::size_t) const override
Generates possible values of the data type (at most max_size).
\brief A timed multi-action
Forward iterator used for iterating over indices.
std::ptrdiff_t distance_to(const index_iterator &other) const
const std::size_t & dereference() const
bool equal(const index_iterator &other) const
index_iterator(std::size_t index=0)
Models a pins data type. A pins data type maintains a mapping between known values of a data type and...
utilities::indexed_set< atermpp::aterm > & indexed_set()
Returns the indexed_set holding the values.
utilities::indexed_set< atermpp::aterm > m_indexed_set
const utilities::indexed_set< atermpp::aterm > & indexed_set() const
Returns the indexed_set holding the values.
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...
virtual const std::string & name() const =0
Returns the name of the data type.
const data::data_specification & m_data
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.
pins_data_type(const data::data_specification &data, const process::action_label_list &action_labels, bool is_bounded=false)
Constructor.
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.
virtual ~pins_data_type()=default
Destructor.
index_iterator index_end() const
Returns an iterator to the end of the indices.
atermpp::aterm get(std::size_t i)
Returns the value at index i.
std::size_t operator[](const atermpp::aterm &x)
Returns the index of the value x.
const process::action_label_list & m_action_labels
generator_type m_generator
const std::vector< std::size_t > & guard_parameters(std::size_t index) const
guard_evaluation_t
guard evaluations have ternary logic. A guard may not always rewrite to true or false
const linear_process & process() const
Returns the process of the LPS specification.
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.
void get_initial_state(ltsmin_state_type &s)
Assigns the initial state to s.
datatype_index edge_label_type(std::size_t) const
Returns the datatype map index corresponding to edge label i.
std::string process_parameter_name(std::size_t i) const
Returns a human-readable, unique name for process parameter i.
std::vector< std::vector< std::size_t > > m_write_group
std::size_t m_group_count
std::size_t process_parameter_count() const
Returns the number of process parameters of the LPS.
void next_state_long(ltsmin_state_type const &src, std::size_t group, StateFunction &f, ltsmin_state_type const &dest, int *const &labels)
lps::specification m_specification_reduced
generator_type m_generator_reduced
std::vector< pins_data_type * > m_unique_data_types
The unique type mappings (is contained in m_data_types).
data::rewriter::substitution_type substitution_t
std::size_t edge_label_count() const
Returns the number of labels per edge.
std::size_t m_state_length
std::size_t datatype_count() const
Returns the number of unique datatype maps. Note that the datatype map for action labels is included,...
utilities::indexed_set< atermpp::aterm > m_guards
void update_long(ltsmin_state_type const &src, std::size_t group, StateFunction &f, ltsmin_state_type const &dest, int *const &labels)
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()...
lps::specification reduce_specification(const lps::specification &spec)
extracts all guards from the original specification and returns a new one with the guards removed.
std::size_t guard_count() const
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...
std::vector< std::vector< std::size_t > > m_read_group
std::string info()
Prints an overview of several relevant attributes.
guard_evaluation_t eval_guard_long(ltsmin_state_type const &src, std::size_t guard)
pins_data_type & action_label_type_map()
Returns the action data type.
const linear_process & process_reduced() const
Returns the reduced process of the LPS specification, i.e. with conditions with guards removed.
std::vector< std::size_t > m_unique_data_type_index
pins_data_type & data_type(std::size_t i)
Returns a reference to the datatype map with index i.
std::vector< std::string > m_guard_names
const std::vector< std::size_t > & guard_info(std::size_t index) const
const pins_data_type & action_label_type_map() const
Returns the action data type.
std::vector< pins_data_type * > m_data_types
std::vector< data::variable > m_parameters_list
const pins_data_type & state_type_map(std::size_t i) const
Returns the data type of the i-th state parameter.
pins_data_type & state_type_map(std::size_t i)
Returns the data type of the i-th state parameter.
std::vector< std::vector< std::size_t > > m_update_group
datatype_index process_parameter_type(std::size_t i) const
Returns the datatype map index corresponding to process parameter i.
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.
std::string edge_label_name(std::size_t) const
Returns the name of the i-th action label (always "action").
std::size_t datatype_index
std::vector< std::vector< std::size_t > > m_guard_info
void initialize_read_write_groups()
const std::string & guard_name(std::size_t index)
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...
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...
lps::explorer< false, false, lps::specification > generator_type
std::vector< std::string > m_process_parameter_names
std::vector< std::vector< std::size_t > > guard_parameters_list
std::size_t group_count() const
Returns the number of available groups. This equals the number of action summands of the LPS.
lps::specification m_specification
Linear process specification.
Models the mapping of mCRL2 state values to integers.
std::size_t expression2index(const data::data_expression &x)
data::data_expression index2expression(std::size_t i) const
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...
data::sort_expression m_sort
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...
std::vector< std::string > generate_values(std::size_t max_size) const override
Generates possible values of the data type (at most max_size).
const std::string & name() const override
Returns the name of the data type.
state_data_type(const data::data_specification &data, const process::action_label_list &action_labels, const data::sort_expression &sort, bool sort_is_finite)
\brief The and operator for pbes expressions
and_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
std::set< pbes_expression > get_successors(const pbes_expression &phi)
Returns the successors of a state, which is a instantiated propositional variable....
virtual std::string print_successors(const std::set< pbes_expression > &successors)
Prints the set of successors states.
pbes_greybox_interface(pbes &p, bool true_false_dependencies=false, bool is_min_parity=true, data::rewriter::strategy rewrite_strategy=data::jitty)
Constructor.
pbes_system::enumerate_quantifiers_rewriter pbes_rewriter
pbes_equation get_pbes_equation(const core::identifier_string &s)
Returns the equation for variable s.
propositional_variable_instantiation get_initial_state()
Returns the initial state, rewritten and simplified.
pbes_expression rewrite_and_simplify_expression(const pbes_expression &e, const bool=true)
Rewrites and simplifies an expression.
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 ~pbes_greybox_interface()
virtual bool visit_inner_bounded_exists(const pbes_expression &e)
Visits a bounded existential quantifier expression within a disjunctive expression.
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.
virtual ~ppg_visitor()
Destructor.
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_and(const pbes_expression &e)
Visits a conjunctive expression.
virtual bool visit_propositional_variable(const pbes_expression &e)
Visits a propositional variable expression.
bqnf_visitor bqnf
The BQNF visitor type.
virtual bool visit_inner_and(const pbes_expression &e)
Visits a conjunctive expression within an inner existential quantifier expression.
ppg_visitor()
Constructor.
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.
\brief The existential quantification operator for pbes expressions
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< std::vector< data_expression > > localmaps_int2data
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.
std::vector< std::map< data_expression, int > > localmaps_data2int
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
void initial_state(int *state)
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
\brief The implication operator for pbes expressions
bool is_write_dependent_propvar(int group)
Determines if group is write dependent on the propositional variable. Returns true if propositional v...
const std::map< std::string, std::map< int, int > > & get_variable_parameter_index_positions() const
Returns the map from variable names to the map from indices of parameter signatures for the variable ...
std::map< std::string, int > variable_priority
const std::map< int, std::vector< bool > > & get_read_matrix() const
Returns the read dependency matrix.
const std::map< int, std::vector< bool > > & get_write_matrix() const
Returns the write dependency matrix.
static std::vector< std::string > get_param_sequence(const data::variable_list ¶ms)
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 ¶ms)
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, std::vector< std::string > > & get_variable_parameter_signatures() const
Returns the map from variable names to the list of parameters signatures 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...
std::map< std::string, std::vector< std::string > > variable_parameter_signatures
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::map< int, std::vector< bool > > read_matrix
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::map< int, std::vector< bool > > & get_dependency_matrix() const
Returns the dependency matrix.
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.
std::map< std::string, std::map< int, int > > variable_parameter_index_positions
static std::string get_param_signature(const variable ¶m)
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 ¶ms)
Converts a variable_sequence_type into a set of parameter signatures.
std::map< int, int > get_param_index_positions(const data::variable_list ¶ms)
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::map< int, std::vector< bool > > matrix
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 ¶mname, const std::string ¶mtype)
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
std::map< int, std::vector< bool > > write_matrix
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.
std::map< std::string, std::vector< int > > variable_parameter_indices
void compute_transition_groups()
Computes transition groups from PBES.
const std::map< std::string, std::vector< int > > & get_variable_parameter_indices() const
Returns the map from variable names to the list of indices of the parameters signatures for the varia...
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 the player or type of the state (And/Or, Abelard/Eloise, Odd/Even).
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 the priority for the state, which depends on the fixpoint operator of the equation of the pro...
const std::vector< data_expression > & get_parameter_values() const
Returns the list of parameter values.
\brief The not operator for pbes expressions
\brief The or operator for pbes expressions
or_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
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.
std::vector< std::pair< pbes_expression, std::size_t > > m_bes
Contains intermediate results of the BES that is being generated. m_bes[i] represents a BES equation ...
virtual operation_type get_expression_operation(const pbes_expression &phi)
Returns the vertex type.
parity_game_generator(pbes &p, bool true_false_dependencies=false, bool is_min_parity=true, data::rewriter::strategy rewrite_strategy=data::jitty)
Constructor.
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)
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< core::identifier_string, std::vector< pbes_equation >::const_iterator > m_pbes_equation_index
Maps propositional variables to corresponding PBES equations.
std::map< pbes_expression, std::size_t > m_pbes_expression_index
Maps PBES closed expressions to corresponding BES variables.
virtual void initialize_generation()
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 ~parity_game_generator()=default
virtual std::string print_bes_equation(std::size_t index, const std::set< std::size_t > &rhs)
data::rewriter datar
Data rewriter.
operation_type
The operation type of the vertices.
data::rewriter::substitution_type substitution_function
Substitution function type used by the PBES rewriter.
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
propositional_variable_instantiation & initial_state()
Returns the initial state.
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
const core::identifier_string & name() const
\brief A propositional variable declaration
const data::variable_list & parameters() const
const core::identifier_string & name() const
propositional_variable(const core::identifier_string &name, const data::variable_list ¶meters)
\brief Constructor Z12.
Standard exception class for reporting runtime errors.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
mcrl2::log::log_level_t mcrl2_log_level_t
The main namespace for the aterm++ library.
std::string pp(const atermpp::aterm &t)
Transform an aterm to an ascii string.
aterm read_term_from_string(const std::string &s)
Reads an aterm from a string. The string can be in either binary or text format.
atermpp::aterm_string identifier_string
String type of the LPS library. Identifier strings are represented internally as ATerms.
atermpp::aterm add_index(const atermpp::aterm &x)
atermpp::aterm remove_index(const atermpp::aterm &x)
Namespace for system defined sort bool_.
const function_symbol & false_()
Constructor for function symbol false.
const function_symbol & true_()
Constructor for function symbol true.
Namespace for all data library functionality.
std::vector< data_expression > data_expression_vector
\brief vector of data_expressions
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
data_expression parse_data_expression(const std::string &text, const data_specification &data_spec=detail::default_specification(), bool type_check=true, bool translate_user_notation=true, bool normalize_sorts=true)
Parses and type checks a data expression.
atermpp::term_list< variable > variable_list
\brief list of variables
std::string pp(const data::sort_expression &x)
std::string pp(const data::data_expression &x)
log_level_t
Log levels that are supported.
The main namespace for the LPS library.
multi_action parse_multi_action(const std::string &text, const process::action_label_list &action_decls, const data::data_specification &data_spec=data::detail::default_specification())
Parses a multi_action from a string.
atermpp::term_balanced_tree< data::data_expression > state
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).
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.
void instantiate_global_variables(pbes &p)
Attempts to eliminate the free variables of a PBES, by substituting a constant value for them....
void normalize(pbes &x)
The function normalize brings (embedded) pbes expressions into positive normal form,...
static void inc_indent()
Increases the current indent level.
static void indent()
Indents according to the current indent level.
static void dec_indent()
Decreases the current indent level.
void check_bes_equation_limit(std::size_t size)
static int indent_count
The current indent level. Used for debug output.
void set_bes_equation_limit(std::size_t size)
MapContainer::mapped_type map_at(const MapContainer &m, typename MapContainer::key_type key)
The main namespace for the PBES library.
pbes_expression join_or(FwdIt first, FwdIt last)
Returns or applied to the sequence of pbes expressions [first, last)
bool is_data(const pbes_expression &t)
Returns true if the term t is a data expression.
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 && ....
const pbes_expression & true_()
bool is_not(const atermpp::aterm &x)
pbes_expression optimized_join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of pbes expressions [first, last)
pbes_expression optimized_join_or(FwdIt first, FwdIt last)
Returns or applied to the sequence of pbes expressions [first, last)
pbes_expression join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of pbes expressions [first, last)
bool is_exists(const atermpp::aterm &x)
bool is_or(const atermpp::aterm &x)
bool is_non_simple_conjunct(const pbes_expression &t)
Test for a conjunction.
bool is_forall(const atermpp::aterm &x)
std::string pp(const pbes_system::pbes_expression &x)
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.
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 && ....
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
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 || ....
bool is_non_simple_disjunct(const pbes_expression &t)
Test for a disjunction.
bool is_imp(const atermpp::aterm &x)
bool is_simple_expression(const T &x)
Determines if an expression is a simple expression. An expression is simple if it is free of proposit...
bool is_true(const pbes_expression &t)
Test for the value true.
const pbes_expression & false_()
The main namespace for the Process library.
atermpp::term_list< action_label > action_label_list
\brief list of action_labels
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
static std::size_t max_bes_equations
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.
bqnf_visitor()
Constructor.
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 ~bqnf_visitor()
Destructor.
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 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.
An attempt for improving the efficiency.
Visitor for printing the root node of a PBES.
void apply(const pbes_equation &x)
void apply(const propositional_variable_instantiation &x)
void apply(const forall &)
void apply(const exists &)
pbes_expression_traverser< print_brief_traverser > super
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const