12#ifndef MCRL2_PBES_PBES_H
13#define MCRL2_PBES_PBES_H
15#include "mcrl2/data/detail/equal_sorts.h"
16#include "mcrl2/pbes/pbes_equation.h"
34 const std::set<data::sort_expression>& declared_sorts,
35 const std::set<data::variable>& declared_global_variables,
40 const std::set<data::variable>& declared_global_variables,
41 const std::set<data::variable>& occurring_global_variables,
42 const std::set<propositional_variable>& declared_variables,
43 const std::set<propositional_variable_instantiation>& occ,
75 std::set<propositional_variable> result;
76 for (
const pbes_equation& eqn: equations())
78 result.insert(eqn.variable());
91 template <
typename Iter>
94 for (Iter i = first; i != last; ++i)
113 const std::vector<pbes_equation>& equations,
120 m_global_variables = pbes_system::find_free_variables(*
this);
131 const std::set<data::variable>& global_variables,
132 const std::vector<pbes_equation>& equations,
176 return m_global_variables;
183 return m_global_variables;
205 std::set<propositional_variable> result;
206 for (
const pbes_equation& eqn: equations())
208 result.insert(eqn.variable());
223 std::set<propositional_variable> result;
224 std::set<propositional_variable_instantiation> occ = occurring_variable_instantiations();
225 std::map<core::identifier_string, propositional_variable> declared_variables;
226 for (
const pbes_equation& eqn: equations())
228 declared_variables[eqn.variable().name()] = eqn.variable();
230 for (
const propositional_variable_instantiation& v: occ)
232 result.insert(declared_variables[v.name()]);
241 std::set<propositional_variable> bnd = binding_variables();
242 std::set<propositional_variable> occ = occurring_variables();
243 return std::includes(bnd.begin(), bnd.end(), occ.begin(), occ.end()) && is_declared_in(bnd.begin(), bnd.end(), initial_state(), data());
263 std::set<data::sort_expression> declared_sorts = data::detail::make_set(data().sorts());
264 const std::set<data::variable>& declared_global_variables = global_variables();
265 std::set<data::variable> occurring_global_variables = pbes_system::find_free_variables(*
this);
266 std::set<propositional_variable> declared_variables = compute_declared_variables();
267 std::set<propositional_variable_instantiation> occ = occurring_variable_instantiations();
270 if (!is_well_typed_pbes(declared_sorts, declared_global_variables, occurring_global_variables, declared_variables, occ, initial_state(), data()))
276 for (
const pbes_equation& eqn: equations())
278 if (!is_well_typed_equation(eqn, declared_sorts, declared_global_variables, data()))
300 return out << pbes_system::pp(x);
310 std::set<data::sort_expression> s = pbes_system::find_sort_expressions(p);
311 p.data().add_context_sorts(s);
A unordered_map class in which aterms can be stored.
bool is_well_typed() const
Returns true if.
\brief An untyped parameter
\brief The and operator for pbes expressions
const pbes_expression & left() const
const pbes_expression & right() const
\brief The existential quantification operator for pbes expressions
const data::variable_list & variables() const
const pbes_expression & body() const
\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
\brief The not operator for pbes expressions
const pbes_expression & operand() const
\brief The or operator for pbes expressions
const pbes_expression & left() const
const pbes_expression & right() const
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
bool is_solved() const
Returns true if the predicate formula on the right hand side contains no predicate variables.
const propositional_variable & variable() const
Returns the pbes variable of the equation.
parameterized boolean equation system
std::set< data::variable > & global_variables()
Returns the declared free variables of the pbes.
bool is_closed() const
True if the pbes is closed.
data::data_specification m_data
The data specification.
pbes(const data::data_specification &data, const std::vector< pbes_equation > &equations, propositional_variable_instantiation initial_state)
Constructor.
std::set< data::variable > m_global_variables
The set of global variables.
std::set< propositional_variable > compute_declared_variables() const
Returns the predicate variables appearing in the left hand side of an equation.
pbes(const data::data_specification &data, const std::set< data::variable > &global_variables, const std::vector< pbes_equation > &equations, propositional_variable_instantiation initial_state)
Constructor.
const propositional_variable_instantiation & initial_state() const
Returns the initial state.
std::set< propositional_variable > binding_variables() const
Returns the set of binding variables of the pbes. This is the set variables that occur on the left ha...
std::set< propositional_variable > occurring_variables() const
Returns the set of occurring propositional variable declarations of the pbes, i.e....
std::set< propositional_variable_instantiation > occurring_variable_instantiations() const
Returns the set of occurring propositional variable instantiations of the pbes. This is the set of va...
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the pbes.
std::vector< pbes_equation > & equations()
Returns the equations.
propositional_variable_instantiation & initial_state()
Returns the initial state.
propositional_variable_instantiation m_initial_state
The initial state.
pbes()=default
Constructor.
std::vector< pbes_equation > m_equations
The sequence of pbes equations.
bool is_declared_in(Iter first, Iter last, const propositional_variable_instantiation &v, const data::data_specification &data_spec) const
Checks if the propositional variable instantiation v appears with the right type in the sequence of p...
const std::vector< pbes_equation > & equations() const
Returns the equations.
bool is_well_typed() const
Checks if the PBES is well typed.
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
propositional_variable_instantiation(const propositional_variable_instantiation &) noexcept=default
Move semantics.
const core::identifier_string & name() const
\brief A propositional variable declaration
const data::variable_list & parameters() const
const core::identifier_string & name() const
D_ParserTables parser_tables_mcrl2
void warn_and_or(const parse_node &)
Prints a warning for each occurrence of 'x && y || z' in the parse tree.
bool equal_sorts(const data::variable_list &v, const data::data_expression_list &w, const data::data_specification &data_spec)
Checks if the sorts of the variables/expressions in both lists are equal.
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
bool is_untyped_data_parameter(const atermpp::aterm &x)
void instantiate_global_variables(pbes &p)
Attempts to eliminate the free variables of a PBES, by substituting a constant value for them....
bool is_bes(const pbes &x)
Returns true if a PBES is in BES form.
untyped_pbes parse_pbes_new(const std::string &text)
void complete_pbes(pbes &x)
bool has_propositional_variables(const pbes_expression &x)
propositional_variable parse_propositional_variable(const std::string &text)
pbes_expression parse_pbes_expression(const std::string &text)
bool is_well_typed(const pbes_equation &eqn)
Checks if the equation is well typed.
pbes_expression parse_pbes_expression_new(const std::string &text)
The main namespace for the PBES library.
std::set< data::variable > find_free_variables(const pbes_system::pbes_equation &x)
std::string pp(const pbes_system::propositional_variable_list &x, bool arg0)
std::string pp(const pbes_system::or_ &x, bool arg0)
std::set< data::variable > find_free_variables(const pbes_system::pbes &x)
void normalize_sorts(pbes_system::pbes_equation_vector &x, const data::sort_specification &sortspec)
std::string pp(const pbes_system::imp &x, bool arg0)
std::string pp(const pbes_system::propositional_variable_instantiation_list &x, bool arg0)
pbes_system::pbes_expression normalize_sorts(const pbes_system::pbes_expression &x, const data::sort_specification &sortspec)
std::set< data::sort_expression > find_sort_expressions(const pbes_system::pbes &x)
std::string pp(const pbes_system::pbes_equation_vector &x, bool arg0)
std::string pp(const pbes_system::pbes_expression_list &x, bool arg0)
bool is_not(const atermpp::aterm &x)
std::set< pbes_system::propositional_variable_instantiation > find_propositional_variable_instantiations(const pbes_system::pbes_expression &x)
bool is_exists(const atermpp::aterm &x)
void normalize_sorts(pbes_system::pbes &x, const data::sort_specification &)
std::ostream & operator<<(std::ostream &out, const pbes &x)
bool is_or(const atermpp::aterm &x)
bool is_well_typed_pbes(const std::set< data::sort_expression > &declared_sorts, const std::set< data::variable > &declared_global_variables, const std::set< data::variable > &occurring_global_variables, const std::set< propositional_variable > &declared_variables, const std::set< propositional_variable_instantiation > &occ, const propositional_variable_instantiation &init, const data::data_specification &data_spec)
std::set< data::function_symbol > find_function_symbols(const pbes_system::pbes &x)
bool is_forall(const atermpp::aterm &x)
void typecheck_pbes(pbes &pbesspec)
Type check a parsed mCRL2 pbes specification. Throws an exception if something went wrong.
std::string pp(const pbes_system::propositional_variable &x, bool arg0)
std::string pp(const pbes_system::exists &x, bool arg0)
std::string pp(const pbes_system::pbes_expression &x, bool arg0)
atermpp::aterm pbes_to_aterm(const pbes &p)
Conversion to atermappl.
bool operator==(const pbes &p1, const pbes &p2)
Equality operator on PBESs.
bool is_well_typed(const pbes_equation &eqn)
std::set< data::variable > find_free_variables(const pbes_system::pbes_expression &x)
pbes_system::pbes_expression translate_user_notation(const pbes_system::pbes_expression &x)
bool search_variable(const pbes_system::pbes_expression &x, const data::variable &v)
std::set< data::variable > find_all_variables(const pbes_system::pbes &x)
std::string pp(const pbes_system::not_ &x, bool arg0)
void complete_data_specification(pbes &)
Adds all sorts that appear in the PBES p to the data specification of p.
std::string pp(const pbes_system::pbes_equation &x, bool arg0)
std::set< core::identifier_string > find_identifiers(const pbes_system::pbes_expression &x)
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
bool is_well_typed_equation(const pbes_equation &eqn, const std::set< data::sort_expression > &declared_sorts, const std::set< data::variable > &declared_global_variables, const data::data_specification &data_spec)
std::string pp(const pbes_system::propositional_variable_instantiation &x, bool arg0)
bool is_and(const atermpp::aterm &x)
void translate_user_notation(pbes_system::pbes &x)
std::string pp(const pbes_system::pbes &x, bool arg0)
bool is_imp(const atermpp::aterm &x)
std::string pp(const pbes_system::and_ &x, bool arg0)
std::string pp(const pbes_system::fixpoint_symbol &x, bool arg0)
std::string pp(const pbes_system::forall &x, bool arg0)
expression traverser that visits all sub expressions
void apply(const pbes_system::imp &x)
void apply(const pbes_system::not_ &x)
void apply(const pbes_system::propositional_variable_instantiation &x)
void apply(const pbes_system::exists &x)
void apply(const pbes_system::pbes &x)
void apply(const pbes_system::pbes_equation &x)
void apply(const pbes_system::pbes_expression &x)
void apply(const pbes_system::or_ &x)
void apply(const pbes_system::and_ &x)
void apply(const pbes_system::forall &x)
void apply(const pbes_system::pbes &x)
void apply(const pbes_system::pbes_expression &x)
void apply(const pbes_system::exists &x)
void apply(const pbes_system::and_ &x)
void apply(const pbes_system::not_ &x)
void apply(const pbes_system::propositional_variable &x)
void apply(const pbes_system::imp &x)
void apply(const pbes_system::forall &x)
void apply(const pbes_system::or_ &x)
void apply(const pbes_system::pbes_equation &x)
void apply(const pbes_system::propositional_variable_instantiation &x)
void apply(const pbes_system::propositional_variable_instantiation &x)
void apply(const pbes_system::and_ &x)
void apply(const pbes_system::forall &x)
void apply(const pbes_system::pbes_equation &x)
void apply(const pbes_system::or_ &x)
void apply(const pbes_system::imp &x)
void apply(const pbes_system::pbes_expression &x)
void apply(const pbes_system::exists &x)
void apply(const pbes_system::not_ &x)
void apply(const pbes_system::pbes &x)
void apply(const pbes_system::exists &x)
void apply(const pbes_system::or_ &x)
void apply(const pbes_system::propositional_variable_instantiation &x)
void apply(const pbes_system::propositional_variable &x)
void apply(const pbes_system::imp &x)
void apply(const pbes_system::and_ &x)
void apply(const pbes_system::pbes &x)
void apply(const pbes_system::forall &x)
void apply(const pbes_system::pbes_equation &x)
void apply(const pbes_system::pbes_expression &x)
void apply(const pbes_system::not_ &x)
void apply(const pbes_system::pbes &x)
void apply(const pbes_system::propositional_variable &x)
void apply(const pbes_system::or_ &x)
void apply(const pbes_system::propositional_variable_instantiation &x)
void apply(const pbes_system::not_ &x)
void apply(const pbes_system::exists &x)
void apply(const pbes_system::and_ &x)
void apply(const pbes_system::imp &x)
void apply(const pbes_system::pbes_expression &x)
void apply(const pbes_system::pbes_equation &x)
void apply(const pbes_system::forall &x)
void enter(const propositional_variable_instantiation &)
pbes_system::propositional_variable parse_PropVarDecl(const core::parse_node &node) const
pbes_actions(const core::parser &parser_)
untyped_pbes parse_PbesSpec(const core::parse_node &node) const
pbes_system::pbes_expression parse_PbesExpr(const core::parse_node &node) const
Traversal class for pbes_expressions. Used as a base class for pbes_expression_traverser.
void apply(const data::data_expression &x)
void apply(const data::untyped_data_parameter &x)