12#ifndef MCRL2_PBES_REMOVE_EQUATIONS_H
13#define MCRL2_PBES_REMOVE_EQUATIONS_H
15#include "mcrl2/pbes/pbes.h"
25 std::ostringstream out;
26 out <<
"\nremoved the following equations:" << std::endl;
27 for (
const propositional_variable& v: removed)
29 out <<
" " << pbes_system::pp(v) << std::endl;
39 using iterator = std::vector<pbes_equation>::const_iterator;
42 std::map<core::identifier_string, iterator> index;
43 for (
auto i = p.equations().begin(); i != p.equations().end(); ++i)
48 index.insert(std::pair<core::identifier_string, iterator>(i->variable().name(),i));
51 std::set<core::identifier_string> visited;
52 std::set<core::identifier_string> explored;
53 visited.insert(p.initial_state().name());
54 while (!visited.empty())
56 core::identifier_string X = *visited.begin();
57 visited.erase(visited.begin());
59 pbes_expression phi = index[X]->formula();
60 std::set<propositional_variable_instantiation> iocc = pbes_system::find_propositional_variable_instantiations(phi);
61 for (
const propositional_variable_instantiation& i: iocc)
63 if (explored.find(i.name()) == explored.end())
65 visited.insert(i.name());
70 std::set<propositional_variable> result;
71 for (
const core::identifier_string& i: explored)
73 result.insert(index[i]->variable());
83 std::vector<propositional_variable> result;
85 std::set<propositional_variable> V = reachable_variables(p);
86 std::vector<pbes_equation> equations;
87 for (pbes_equation& eqn: p.equations())
89 if (V.find(eqn.variable()) != V.end())
91 equations.push_back(eqn);
95 result.push_back(eqn.variable());
98 p.equations() = equations;
Rewriter that operates on data expressions.
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
\brief The and operator for pbes expressions
\brief The existential quantification operator for pbes expressions
const data::variable_list & variables() const
\brief The universal quantification operator for pbes expressions
const data::variable_list & variables() const
\brief The implication operator for pbes expressions
\brief The not operator for pbes expressions
\brief The or operator for pbes expressions
parameterized boolean equation system
propositional_variable_instantiation & initial_state()
Returns the initial state.
Algorithm class for the finite pbesinst algorithm.
data::enumerator_identifier_generator m_id_generator
Identifier generator for the enumerator.
std::size_t m_equation_count
The number of generated equations.
void run(pbes &p)
Runs the algorithm.
void run(pbes &pbesspec, const pbesinst_variable_map &variable_map)
Runs the algorithm.
std::string print_equation_count(std::size_t size) const
Prints a message for every 1000-th equation.
data::rewriter::strategy m_rewriter_strategy
The strategy of the data rewriter.
void compute_index_map(const std::vector< pbes_equation > &equations, const pbesinst_variable_map &variable_map, pbesinst_index_map &index_map)
Returns true if the container contains the given element.
pbesinst_finite_algorithm(data::rewriter::strategy rewriter_strategy=data::jitty)
Constructor.
\brief A propositional variable instantiation
propositional_variable_instantiation(const core::identifier_string &name, const data::data_expression_list ¶meters)
Constructor.
const core::identifier_string & name() const
propositional_variable_instantiation & operator=(const propositional_variable_instantiation &) noexcept=default
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
data_expression and_(const data_expression &x, const data_expression &y)
const data_expression & true_()
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....
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.
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,...
std::ostream & print_pbes_parameter_map(std::ostream &out, const pbes_parameter_map &m)
Print a parameter map.
bool match_declaration(const std::string &text, const data::variable &d, const data::data_specification &data_spec)
Returns true if the declaration text matches with the variable d.
std::string print_removed_equations(const std::vector< propositional_variable > &removed)
void split_parameters(const PropositionalVariable &X, const pbesinst_index_map &index_map, std::vector< Parameter > &finite, std::vector< Parameter > &infinite)
Computes the subset with variables of finite sort and infinite.
pbes_parameter_map parse_pbes_parameter_map(const pbes &p, const std::string &text)
Parses parameter selection for finite pbesinst algorithm.
std::vector< data::variable > find_matching_parameters(const pbes &p, const std::string &name, const std::set< std::string > &declarations)
Find parameter declarations that match a given string.
The main namespace for the PBES library.
std::set< propositional_variable > reachable_variables(const pbes &p)
pbes_expression make_exists_(const data::variable_list &l, const pbes_expression &p)
Make an existential quantification. It checks for an empty variable list, which is not allowed.
void pbesinst_finite(pbes &p, data::rewrite_strategy rewrite_strategy, const std::string &finite_parameter_selection)
pbes_expression make_forall_(const data::variable_list &l, const pbes_expression &p)
Make a universal quantification. It checks for an empty variable list, which is not allowed.
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_normalized(const T &x)
Checks if a pbes expression is normalized.
An empty struct that is used to denote the absence of a substitution. Used for rewriters.
Visitor that applies a propositional variable substitution to a pbes expression.
const pbesinst_finite_rename & m_rename
data::data_expression make_condition(const VariableContainer &variables, const ExpressionContainer &expressions) const
Computes the condition 'for all i: variables[i] == expressions[i]'.
void apply(T &result, const propositional_variable_instantiation &x)
const pbesinst_index_map & m_index_map
data::data_expression_list rewrite_container(const DataExpressionContainer &v, const data::rewriter &rewr, const data::mutable_indexed_substitution<> &sigma)
const pbesinst_variable_map & m_variable_map
std::string print_parameters(const std::vector< data::data_expression > &finite_parameters, const std::vector< data::data_expression > &infinite_parameters) const
propositional_variable_instantiation visit_initial_state(const propositional_variable_instantiation &init)
const data::data_specification & m_data_spec
data::data_expression_list rewrite_container(const DataExpressionContainer &v, const data::rewriter &rewr)
pbesinst_finite_builder(const DataRewriter &R, SubstitutionFunction &sigma, const pbesinst_finite_rename &rho, const data::data_specification &data_spec, const pbesinst_index_map &index_map, const pbesinst_variable_map &variable_map)
Exception that is used to signal an empty parameter selection.
empty_parameter_selection(const std::string &msg)
Function object for renaming a propositional variable instantiation.
core::identifier_string operator()(const core::identifier_string &name, const data::data_expression_list ¶meters) const
Renames the propositional variable x.
std::unordered_map< propositional_variable_instantiation, core::identifier_string > m
data::set_identifier_generator id_generator
core::identifier_string rename(const core::identifier_string &name, const data::data_expression_list ¶meters) const