mCRL2
Loading...
Searching...
No Matches
pbes.cpp
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//
11
16#include "mcrl2/pbes/is_bes.h"
18#include "mcrl2/pbes/print.h"
20
21namespace mcrl2
22{
23
24namespace pbes_system
25{
26
27//--- start generated pbes_system overloads ---//
28std::string pp(const pbes_system::pbes_equation_vector& x) { return pbes_system::pp< pbes_system::pbes_equation_vector >(x); }
29std::string pp(const pbes_system::pbes_expression_list& x) { return pbes_system::pp< pbes_system::pbes_expression_list >(x); }
30std::string pp(const pbes_system::pbes_expression_vector& x) { return pbes_system::pp< pbes_system::pbes_expression_vector >(x); }
31std::string pp(const pbes_system::propositional_variable_list& x) { return pbes_system::pp< pbes_system::propositional_variable_list >(x); }
32std::string pp(const pbes_system::propositional_variable_vector& x) { return pbes_system::pp< pbes_system::propositional_variable_vector >(x); }
33std::string pp(const pbes_system::propositional_variable_instantiation_list& x) { return pbes_system::pp< pbes_system::propositional_variable_instantiation_list >(x); }
34std::string pp(const pbes_system::propositional_variable_instantiation_vector& x) { return pbes_system::pp< pbes_system::propositional_variable_instantiation_vector >(x); }
35std::string pp(const pbes_system::and_& x) { return pbes_system::pp< pbes_system::and_ >(x); }
36std::string pp(const pbes_system::exists& x) { return pbes_system::pp< pbes_system::exists >(x); }
37std::string pp(const pbes_system::fixpoint_symbol& x) { return pbes_system::pp< pbes_system::fixpoint_symbol >(x); }
38std::string pp(const pbes_system::forall& x) { return pbes_system::pp< pbes_system::forall >(x); }
39std::string pp(const pbes_system::imp& x) { return pbes_system::pp< pbes_system::imp >(x); }
40std::string pp(const pbes_system::not_& x) { return pbes_system::pp< pbes_system::not_ >(x); }
41std::string pp(const pbes_system::or_& x) { return pbes_system::pp< pbes_system::or_ >(x); }
42std::string pp(const pbes_system::pbes& x) { return pbes_system::pp< pbes_system::pbes >(x); }
43std::string pp(const pbes_system::pbes_equation& x) { return pbes_system::pp< pbes_system::pbes_equation >(x); }
44std::string pp(const pbes_system::pbes_expression& x) { return pbes_system::pp< pbes_system::pbes_expression >(x); }
45std::string pp(const pbes_system::propositional_variable& x) { return pbes_system::pp< pbes_system::propositional_variable >(x); }
46std::string pp(const pbes_system::propositional_variable_instantiation& x) { return pbes_system::pp< pbes_system::propositional_variable_instantiation >(x); }
47void normalize_sorts(pbes_system::pbes_equation_vector& x, const data::sort_specification& sortspec) { pbes_system::normalize_sorts< pbes_system::pbes_equation_vector >(x, sortspec); }
48void normalize_sorts(pbes_system::pbes& x, const data::sort_specification& /* sortspec */) { pbes_system::normalize_sorts< pbes_system::pbes >(x, x.data()); }
49pbes_system::pbes_expression normalize_sorts(const pbes_system::pbes_expression& x, const data::sort_specification& sortspec) { return pbes_system::normalize_sorts< pbes_system::pbes_expression >(x, sortspec); }
50void translate_user_notation(pbes_system::pbes& x) { pbes_system::translate_user_notation< pbes_system::pbes >(x); }
51pbes_system::pbes_expression translate_user_notation(const pbes_system::pbes_expression& x) { return pbes_system::translate_user_notation< pbes_system::pbes_expression >(x); }
52std::set<data::sort_expression> find_sort_expressions(const pbes_system::pbes& x) { return pbes_system::find_sort_expressions< pbes_system::pbes >(x); }
53std::set<data::variable> find_all_variables(const pbes_system::pbes& x) { return pbes_system::find_all_variables< pbes_system::pbes >(x); }
54std::set<data::variable> find_free_variables(const pbes_system::pbes& x) { return pbes_system::find_free_variables< pbes_system::pbes >(x); }
55std::set<data::variable> find_free_variables(const pbes_system::pbes_expression& x) { return pbes_system::find_free_variables< pbes_system::pbes_expression >(x); }
56std::set<data::variable> find_free_variables(const pbes_system::pbes_equation& x) { return pbes_system::find_free_variables< pbes_system::pbes_equation >(x); }
57std::set<data::function_symbol> find_function_symbols(const pbes_system::pbes& x) { return pbes_system::find_function_symbols< pbes_system::pbes >(x); }
58std::set<pbes_system::propositional_variable_instantiation> find_propositional_variable_instantiations(const pbes_system::pbes_expression& x) { return pbes_system::find_propositional_variable_instantiations< pbes_system::pbes_expression >(x); }
59std::set<core::identifier_string> find_identifiers(const pbes_system::pbes_expression& x) { return pbes_system::find_identifiers< pbes_system::pbes_expression >(x); }
60bool search_variable(const pbes_system::pbes_expression& x, const data::variable& v) { return pbes_system::search_variable< pbes_system::pbes_expression >(x, v); }
61//--- end generated pbes_system overloads ---//
62
63namespace algorithms {
64
66{
68}
69
70bool is_bes(const pbes& x)
71{
72 return pbes_system::is_bes(x);
73}
74
75} // namespace algorithms
76
78{
80}
81
83 const std::set<data::sort_expression>& declared_sorts,
84 const std::set<data::variable>& declared_global_variables,
85 const data::data_specification& data_spec
86 )
87{
88 return pbes_system::detail::is_well_typed_equation(eqn, declared_sorts, declared_global_variables, data_spec);
89}
90
91bool is_well_typed_pbes(const std::set<data::sort_expression>& declared_sorts,
92 const std::set<data::variable>& declared_global_variables,
93 const std::set<data::variable>& occurring_global_variables,
94 const std::set<propositional_variable>& declared_variables,
95 const std::set<propositional_variable_instantiation>& occ,
97 const data::data_specification& data_spec
98 )
99{
100 return pbes_system::detail::is_well_typed_pbes(declared_sorts, declared_global_variables, occurring_global_variables, declared_variables, occ, init, data_spec);
101}
102
104{
106}
107
108std::set<propositional_variable_instantiation> pbes::occurring_variable_instantiations() const
109{
110 std::set<propositional_variable_instantiation> result;
111 for (const pbes_equation& eqn: equations())
112 {
114 f.apply(eqn.formula());
115 result.insert(f.variables.begin(), f.variables.end());
116 }
117 return result;
118}
119
120namespace detail {
121
123{
125 unsigned int start_symbol_index = p.start_symbol_index("PbesExpr");
126 bool partial_parses = false;
127 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
128 core::warn_and_or(node);
130 return result;
131}
132
133untyped_pbes parse_pbes_new(const std::string& text)
134{
136 unsigned int start_symbol_index = p.start_symbol_index("PbesSpec");
137 bool partial_parses = false;
138 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
139 core::warn_and_or(node);
140 untyped_pbes result = pbes_actions(p).parse_PbesSpec(node);
141 return result;
142}
143
145{
149}
150
152{
154 unsigned int start_symbol_index = p.start_symbol_index("PropVarDecl");
155 bool partial_parses = false;
156 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
158}
159
161{
163 unsigned int start_symbol_index = p.start_symbol_index("PbesExpr");
164 bool partial_parses = false;
165 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
166 core::warn_and_or(node);
167 return detail::pbes_actions(p).parse_PbesExpr(node);
168}
169
170} // namespace detail
171
172} // namespace pbes_system
173
174} // namespace mcrl2
175
A list of aterm objects.
Definition aterm_list.h:24
\brief A data variable
Definition variable.h:28
\brief The and operator for pbes expressions
\brief The existential quantification operator for pbes expressions
\brief The universal quantification operator for pbes expressions
\brief The implication operator for pbes expressions
\brief The not operator for pbes expressions
\brief The or operator for pbes expressions
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.
Definition pbes.cpp:103
parameterized boolean equation system
Definition pbes.h:58
const data::data_specification & data() const
Returns the data specification.
Definition pbes.h:150
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...
Definition pbes.cpp:108
const std::vector< pbes_equation > & equations() const
Returns the equations.
Definition pbes.h:164
\brief A propositional variable instantiation
\brief A propositional variable declaration
D_ParserTables parser_tables_mcrl2
add your file description here.
MCRL2_EXPORT bool init(rewriter_interface *i, RewriterCompilingJitty *this_rewriter)
void syntax_error_fn(struct D_Parser *ap)
Custom syntax error function that prints both the line number and the column.
Definition dparser.cpp:463
struct D_ParseNode * ambiguity_fn(struct D_Parser *, int, struct D_ParseNode **)
Function for resolving ambiguities in the '_ -> _ <> _' operator for process expressions.
Definition dparser.cpp:332
void warn_and_or(const parse_node &)
Prints a warning for each occurrence of 'x && y || z' in the parse tree.
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:65
bool is_bes(const pbes &x)
Returns true if a PBES is in BES form.
Definition pbes.cpp:70
untyped_pbes parse_pbes_new(const std::string &text)
Definition pbes.cpp:133
void complete_pbes(pbes &x)
Definition pbes.cpp:144
data::mutable_map_substitution instantiate_global_variables(pbes &p)
Eliminates the global variables of a PBES, by substituting a constant value for them....
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)
bool has_propositional_variables(const pbes_expression &x)
propositional_variable parse_propositional_variable(const std::string &text)
Definition pbes.cpp:151
pbes_expression parse_pbes_expression(const std::string &text)
Definition pbes.cpp:160
bool is_well_typed(const pbes_equation &eqn)
Checks if the equation is well typed.
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)
pbes_expression parse_pbes_expression_new(const std::string &text)
Definition pbes.cpp:122
bool is_bes(const T &x)
Returns true if a PBES object is in BES form.
Definition is_bes.h:76
void normalize_sorts(T &x, const data::sort_specification &sortspec, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
std::vector< propositional_variable_instantiation > propositional_variable_instantiation_vector
\brief vector of propositional_variable_instantiations
void find_identifiers(const T &x, OutputIterator o)
Definition find.h:131
std::vector< propositional_variable > propositional_variable_vector
\brief vector of propositional_variables
void find_free_variables(const T &x, OutputIterator o)
Definition find.h:87
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)
Definition pbes.cpp:91
std::vector< pbes_equation > pbes_equation_vector
\brief vector of pbes_equations
void typecheck_pbes(pbes &pbesspec)
Type check a parsed mCRL2 pbes specification. Throws an exception if something went wrong.
Definition typecheck.h:275
bool is_well_typed(const pbes_equation &eqn)
Definition pbes.cpp:77
void find_function_symbols(const T &x, OutputIterator o)
Definition find.h:173
void find_sort_expressions(const T &x, OutputIterator o)
Definition find.h:152
bool search_variable(const T &x, const data::variable &v)
Returns true if the term has a given variable as subterm.
Definition find.h:217
std::vector< pbes_expression > pbes_expression_vector
\brief vector of pbes_expressions
void find_all_variables(const T &x, OutputIterator o)
Definition find.h:66
void complete_data_specification(pbes &)
Adds all sorts that appear in the PBES p to the data specification of p.
Definition pbes.h:314
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)
Definition pbes.cpp:82
std::string pp(const fixpoint_symbol &x)
Definition pbes.cpp:37
void translate_user_notation(pbes_system::pbes &x)
Definition pbes.cpp:50
void find_propositional_variable_instantiations(Container const &container, OutputIterator o)
Returns all data variables that occur in a range of expressions.
Definition find.h:196
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
add your file description here.
add your file description here.
add your file description here.
Add your file description here.
add your file description here.
add your file description here.
add your file description here.
Wrapper for D_ParseNode.
Definition dparser.h:86
Wrapper for D_Parser and its corresponding D_ParserTables.
Definition dparser.h:148
parse_node parse(const std::string &text, unsigned int start_symbol_index=0, bool partial_parses=false)
Parses a string. N.B. The user is responsible for destruction of the returned value by calling destro...
Definition dparser.cpp:209
unsigned int start_symbol_index(const std::string &name) const
Definition dparser.cpp:204
std::set< propositional_variable_instantiation > variables
void apply(const propositional_variable_instantiation &x)
pbes_system::propositional_variable parse_PropVarDecl(const core::parse_node &node) const
Definition parse_impl.h:51
untyped_pbes parse_PbesSpec(const core::parse_node &node) const
Definition parse_impl.h:88
pbes_system::pbes_expression parse_PbesExpr(const core::parse_node &node) const
Definition parse_impl.h:33