12#ifndef MCRL2_PBES_SOLVE_STRUCTURE_GRAPH_H
13#define MCRL2_PBES_SOLVE_STRUCTURE_GRAPH_H
23namespace pbes_system {
28 std::size_t min_rank = (std::numeric_limits<std::size_t>::max)();
29 std::size_t max_rank = 0;
30 std::vector<structure_graph::index_type> M;
33 for (std::size_t vi = 0; vi < N; vi++)
40 if (v.rank <= min_rank)
42 if (v.rank < min_rank)
49 if (v.rank > max_rank)
54 return std::make_tuple(min_rank, max_rank,
vertex_set(N, M.begin(), M.end()));
61 std::regex re(
"Z(neg|pos)_(\\d+)_.*");
65 std::string X = eqn.variable().name();
66 if (std::regex_match(X, match, re))
129 std::size_t N = G.
extent();
137 std::size_t m = std::get<0>(q);
140 std::size_t alpha = m % 2;
146 if (u.decoration == alpha)
149 auto v =
succ(G, ui, U);
183 if (W_1[1 - alpha].size() == B.
size())
191 W[1 - alpha] =
set_union(W[1 - alpha], B);
197 if (W_1[1 - alpha].is_empty())
200 W[1 - alpha].
clear();
206 W[1 - alpha] =
set_union(W[1 - alpha], B);
213 assert(W[0].size() + W[1].size() + G.
exclude().count() == N);
214 return { W[0], W[1] };
221 mCRL2log(
log::debug) <<
"\n --- solve_recursive_extended input ---\n" << G << std::endl;
223 std::size_t N = G.
extent();
228 for (std::size_t vi = 0; vi < N; vi++)
297 v.successors.
clear();
298 v.predecessors.clear();
301 std::set<structure_graph::index_type> todo = {
init };
302 std::set<structure_graph::index_type> done;
304 while (!todo.empty())
307 todo.erase(todo.begin());
325 if (!contains(done, v))
338 bool is_disjunctive1;
341 is_disjunctive1 =
true;
345 is_disjunctive1 =
false;
403 std::regex re(
"Z(neg|pos)_(\\d+)_.*");
413 const auto Z = atermpp::down_cast<propositional_variable_instantiation>(v.formula());
414 std::string Zname = Z.name();
416 if (std::regex_match(Zname, match, re))
418 std::size_t summand_index = std::stoul(match[2]);
421 throw mcrl2::runtime_error(
"Counter-example cannot be reconstructed from this LPS. Did you supply the correct file?");
434 std::size_t m = d.
size() - 2 * n;
436 for (std::size_t i = 0; i < n; i++)
439 next_state_assignments.emplace_back(d1[i], e1[n + m + i]);
443 std::size_t index = 0;
447 actions.push_back(a1);
448 index = index + a.arguments().size();
456 action_summands.push_back(summand);
476 throw mcrl2::runtime_error(
"solve_with_counter_example requires an LPS without global variables.");
480 throw mcrl2::runtime_error(
"solve_with_counter_example requires a PBES without global variables.");
505 std::vector<lts::transition> transitions;
506 for (std::size_t i: transition_indices)
508 if (i >= lts_transitions.size())
510 throw mcrl2::runtime_error(
"Counter-example cannot be reconstructed from this LTS. Did you supply the correct file?");
512 transitions.push_back(lts_transitions[i]);
524 std::regex re(
"Z(neg|pos)_(\\d+)_.*");
526 std::set<std::size_t> transition_indices;
533 std::string Zname = Z.
name();
535 if (std::regex_match(Zname, match, re))
537 std::size_t transition_index = std::stoul(match[2]);
538 transition_indices.insert(transition_index);
570 bool use_toms_optimization = !check_strategy;
572 return algorithm.
solve(G);
size_type size() const
Returns the size of the term_list.
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
LPS summand containing a multi-action.
const lps::multi_action & multi_action() const
Returns the multi-action of this summand.
const data::assignment_list & assignments() const
Returns the sequence of assignments.
const std::vector< ActionSummand > & action_summands() const
Returns the sequence of action summands.
const deadlock_summand_vector & deadlock_summands() const
Returns the sequence of deadlock summands.
const data::variable_list & process_parameters() const
Returns the sequence of process parameters.
\brief A timed multi-action
const process::action_list & actions() const
const data::data_expression & time() const
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the LPS.
const LinearProcess & process() const
Returns the linear process of the specification.
Linear process specification.
const data::data_expression & condition() const
Returns the condition expression.
data::variable_list & summation_variables()
Returns the sequence of summation variables.
This class contains labelled transition systems in .lts format.
const std::vector< transition > & get_transitions() const
Gets a const reference to the vector of transitions of the current lts.
Maps variables to their corresponding equations in a boolean_equation_system or PBES.
std::pair< bool, lps::specification > solve_with_counter_example(structure_graph &G, const lps::specification &lpsspec, const pbes &p, const pbes_equation_index &p_index)
Solve a pbes for some equation, while constructing a counter example or wittness based on the accompa...
lps_solve_structure_graph_algorithm()=default
static lps::specification create_counter_example_lps(structure_graph &G, const std::set< structure_graph::index_type > &V, const lps::specification &lpsspec, const pbes &p, const pbes_equation_index &p_index)
static void filter_transitions(lts::lts_lts_t <sspec, const std::set< std::size_t > &transition_indices)
lts_solve_structure_graph_algorithm()=default
bool solve_with_counter_example(structure_graph &G, lts::lts_lts_t <sspec)
Solve a boolean equation system while generating a counter example.
static void create_counter_example_lts(structure_graph &G, const std::set< structure_graph::index_type > &V, lts::lts_lts_t <sspec)
const propositional_variable & variable() const
Returns the pbes variable of the equation.
parameterized boolean equation system
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the pbes.
const std::vector< pbes_equation > & equations() const
Returns the equations.
\brief A propositional variable instantiation
const core::identifier_string & name() const
const data::variable_list & parameters() const
bool use_toms_optimization
std::pair< vertex_set, vertex_set > solve_recursive(structure_graph &G, const vertex_set &A)
static void insert_edge(structure_graph::vertex_vector &V, structure_graph::index_type ui, structure_graph::index_type vi)
solve_structure_graph_algorithm(bool check_strategy_=false, bool use_toms_optimization_=false)
static structure_graph::index_type succ(const structure_graph &G, structure_graph::index_type u)
void check_solve_recursive_solution(const structure_graph &G, bool is_disjunctive, const vertex_set &Wdisj, const vertex_set &Wconj)
bool solve(structure_graph &G)
std::pair< vertex_set, vertex_set > solve_recursive(structure_graph &G)
static structure_graph::index_type succ(const structure_graph &G, structure_graph::index_type u, const vertex_set &U)
std::pair< vertex_set, vertex_set > solve_recursive_extended(structure_graph &G)
index_type initial_vertex() const
std::size_t extent() const
const boost::dynamic_bitset & exclude() const
const vertex_vector & all_vertices() const
boost::filtered_range< integers_not_contained_in, const std::vector< index_type > > successors(index_type u) const
bool contains(index_type u) const
vertex & find_vertex(index_type u)
index_type strategy(index_type u) const
decoration_type decoration(index_type u) const
Standard exception class for reporting runtime errors.
Join and split functions for data expressions.
MCRL2_EXPORT bool init(rewriter_interface *i, RewriterCompilingJitty *this_rewriter)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Algorithms for LTS, such as equivalence reductions, determinisation, etc.
std::vector< assignment > assignment_vector
\brief vector of assignments
std::vector< variable > variable_vector
\brief vector of variables
std::vector< data_expression > data_expression_vector
\brief vector of data_expressions
atermpp::term_list< variable > variable_list
\brief list of variables
atermpp::term_list< assignment > assignment_list
\brief list of assignments
function_symbol equal_to(const sort_expression &s)
Constructor for function symbol ==.
data_expression join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of data expressions [first, last)
bool reachability_check(lts< SL, AL, BASE > &l, bool remove_unreachable=false)
Checks whether all states in this LTS are reachable from the initial state and remove unreachable sta...
constexpr unsigned int undefined_vertex()
bool solve_structure_graph(structure_graph &G, bool check_strategy=false)
bool has_counter_example_information(const pbes &pbesspec)
Guesses if a pbes has counter example information.
vertex_set attr_default(const StructureGraph &G, vertex_set A, std::size_t alpha)
bool is_disjunctive(const pbes_expression &x)
vertex_set set_union(const vertex_set &V, const vertex_set &W)
std::pair< bool, lps::specification > solve_structure_graph_with_counter_example(structure_graph &G, const lps::specification &lpsspec, const pbes &p, const pbes_equation_index &p_index)
std::tuple< std::size_t, std::size_t, vertex_set > get_minmax_rank(const structure_graph &G)
std::set< structure_graph::index_type > extract_minimal_structure_graph(StructureGraph &G, typename StructureGraph::index_type init, const vertex_set &S0, const vertex_set &S1)
void log_vertex_set(const StructureGraph &G, const vertex_set &V, const std::string &name)
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
std::vector< action > action_vector
\brief vector of actions
bool contains(const atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable > &c, const typename atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable >::key_type &v, const std::size_t thread_index=0)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void swap(atermpp::unprotected_aterm_core &t1, atermpp::unprotected_aterm_core &t2) noexcept
Swaps two aterms.
add your file description here.
add your file description here.
void set_strategy(structure_graph::index_type u, structure_graph::index_type v)
std::size_t index(const core::identifier_string &name) const
Returns the index of the equation of the variable with the given name.
std::vector< index_type > successors
std::vector< index_type > predecessors
void insert(structure_graph::index_type u)
bool contains(structure_graph::index_type u) const
const std::vector< structure_graph::index_type > & vertices() const
const boost::dynamic_bitset & include() const