mCRL2
Loading...
Searching...
No Matches
modal_formula.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
19
20namespace mcrl2
21{
22
23namespace action_formulas
24{
25
26//--- start generated action_formulas overloads ---//
27std::string pp(const action_formulas::action_formula& x) { return action_formulas::pp< action_formulas::action_formula >(x); }
28std::string pp(const action_formulas::and_& x) { return action_formulas::pp< action_formulas::and_ >(x); }
29std::string pp(const action_formulas::at& x) { return action_formulas::pp< action_formulas::at >(x); }
30std::string pp(const action_formulas::exists& x) { return action_formulas::pp< action_formulas::exists >(x); }
31std::string pp(const action_formulas::false_& x) { return action_formulas::pp< action_formulas::false_ >(x); }
32std::string pp(const action_formulas::forall& x) { return action_formulas::pp< action_formulas::forall >(x); }
33std::string pp(const action_formulas::imp& x) { return action_formulas::pp< action_formulas::imp >(x); }
34std::string pp(const action_formulas::multi_action& x) { return action_formulas::pp< action_formulas::multi_action >(x); }
35std::string pp(const action_formulas::not_& x) { return action_formulas::pp< action_formulas::not_ >(x); }
36std::string pp(const action_formulas::or_& x) { return action_formulas::pp< action_formulas::or_ >(x); }
37std::string pp(const action_formulas::true_& x) { return action_formulas::pp< action_formulas::true_ >(x); }
38std::set<data::variable> find_all_variables(const action_formulas::action_formula& x) { return action_formulas::find_all_variables< action_formulas::action_formula >(x); }
39//--- end generated action_formulas overloads ---//
40
41namespace detail {
42
43action_formula parse_action_formula(const std::string& text)
44{
46 unsigned int start_symbol_index = p.start_symbol_index("ActFrm");
47 bool partial_parses = false;
48 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
51 return result;
52}
53
54} // namespace detail
55
56} // namespace action_formulas
57
58namespace regular_formulas
59{
60
61//--- start generated regular_formulas overloads ---//
62std::string pp(const regular_formulas::alt& x) { return regular_formulas::pp< regular_formulas::alt >(x); }
63std::string pp(const regular_formulas::regular_formula& x) { return regular_formulas::pp< regular_formulas::regular_formula >(x); }
64std::string pp(const regular_formulas::seq& x) { return regular_formulas::pp< regular_formulas::seq >(x); }
65std::string pp(const regular_formulas::trans& x) { return regular_formulas::pp< regular_formulas::trans >(x); }
66std::string pp(const regular_formulas::trans_or_nil& x) { return regular_formulas::pp< regular_formulas::trans_or_nil >(x); }
67std::string pp(const regular_formulas::untyped_regular_formula& x) { return regular_formulas::pp< regular_formulas::untyped_regular_formula >(x); }
68//--- end generated regular_formulas overloads ---//
69
70namespace detail
71{
72
73regular_formula parse_regular_formula(const std::string& text)
74{
76 unsigned int start_symbol_index = p.start_symbol_index("RegFrm");
77 bool partial_parses = false;
78 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
80 return result;
81}
82
83} // namespace detail
84
85} // namespace regular_formulas
86
87namespace state_formulas
88{
89
90//--- start generated state_formulas overloads ---//
91std::string pp(const state_formulas::and_& x) { return state_formulas::pp< state_formulas::and_ >(x); }
92std::string pp(const state_formulas::const_multiply& x) { return state_formulas::pp< state_formulas::const_multiply >(x); }
93std::string pp(const state_formulas::const_multiply_alt& x) { return state_formulas::pp< state_formulas::const_multiply_alt >(x); }
94std::string pp(const state_formulas::delay& x) { return state_formulas::pp< state_formulas::delay >(x); }
95std::string pp(const state_formulas::delay_timed& x) { return state_formulas::pp< state_formulas::delay_timed >(x); }
96std::string pp(const state_formulas::exists& x) { return state_formulas::pp< state_formulas::exists >(x); }
97std::string pp(const state_formulas::false_& x) { return state_formulas::pp< state_formulas::false_ >(x); }
98std::string pp(const state_formulas::forall& x) { return state_formulas::pp< state_formulas::forall >(x); }
99std::string pp(const state_formulas::imp& x) { return state_formulas::pp< state_formulas::imp >(x); }
100std::string pp(const state_formulas::infimum& x) { return state_formulas::pp< state_formulas::infimum >(x); }
101std::string pp(const state_formulas::may& x) { return state_formulas::pp< state_formulas::may >(x); }
102std::string pp(const state_formulas::minus& x) { return state_formulas::pp< state_formulas::minus >(x); }
103std::string pp(const state_formulas::mu& x) { return state_formulas::pp< state_formulas::mu >(x); }
104std::string pp(const state_formulas::must& x) { return state_formulas::pp< state_formulas::must >(x); }
105std::string pp(const state_formulas::not_& x) { return state_formulas::pp< state_formulas::not_ >(x); }
106std::string pp(const state_formulas::nu& x) { return state_formulas::pp< state_formulas::nu >(x); }
107std::string pp(const state_formulas::or_& x) { return state_formulas::pp< state_formulas::or_ >(x); }
108std::string pp(const state_formulas::plus& x) { return state_formulas::pp< state_formulas::plus >(x); }
109std::string pp(const state_formulas::state_formula& x) { return state_formulas::pp< state_formulas::state_formula >(x); }
110std::string pp(const state_formulas::state_formula_specification& x) { return state_formulas::pp< state_formulas::state_formula_specification >(x); }
111std::string pp(const state_formulas::sum& x) { return state_formulas::pp< state_formulas::sum >(x); }
112std::string pp(const state_formulas::supremum& x) { return state_formulas::pp< state_formulas::supremum >(x); }
113std::string pp(const state_formulas::true_& x) { return state_formulas::pp< state_formulas::true_ >(x); }
114std::string pp(const state_formulas::variable& x) { return state_formulas::pp< state_formulas::variable >(x); }
115std::string pp(const state_formulas::yaled& x) { return state_formulas::pp< state_formulas::yaled >(x); }
116std::string pp(const state_formulas::yaled_timed& x) { return state_formulas::pp< state_formulas::yaled_timed >(x); }
117state_formulas::state_formula normalize_sorts(const state_formulas::state_formula& x, const data::sort_specification& sortspec) { return state_formulas::normalize_sorts< state_formulas::state_formula >(x, sortspec); }
118state_formulas::state_formula translate_user_notation(const state_formulas::state_formula& x) { return state_formulas::translate_user_notation< state_formulas::state_formula >(x); }
119std::set<data::sort_expression> find_sort_expressions(const state_formulas::state_formula& x) { return state_formulas::find_sort_expressions< state_formulas::state_formula >(x); }
120std::set<data::variable> find_all_variables(const state_formulas::state_formula& x) { return state_formulas::find_all_variables< state_formulas::state_formula >(x); }
121std::set<data::variable> find_free_variables(const state_formulas::state_formula& x) { return state_formulas::find_free_variables< state_formulas::state_formula >(x); }
122std::set<core::identifier_string> find_identifiers(const state_formulas::state_formula& x) { return state_formulas::find_identifiers< state_formulas::state_formula >(x); }
123std::set<process::action_label> find_action_labels(const state_formulas::state_formula& x) { return state_formulas::find_action_labels< state_formulas::state_formula >(x); }
124//--- end generated state_formulas overloads ---//
125
126namespace detail {
127
128state_formula parse_state_formula(const std::string& text)
129{
131 unsigned int start_symbol_index = p.start_symbol_index("StateFrm");
132 bool partial_parses = false;
133 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
134 core::warn_and_or(node);
136 return result;
137}
138
140{
142 unsigned int start_symbol_index = p.start_symbol_index("StateFrmSpec");
143 bool partial_parses = false;
144 core::parse_node node = p.parse(text, start_symbol_index, partial_parses);
145 core::warn_and_or(node);
147
150 return result;
151}
152
153} // namespace detail
154
155namespace algorithms {
156
157state_formula parse_state_formula(std::istream& in, lps::stochastic_specification& lpsspec, const bool formula_is_quantitative)
158{
159 return state_formulas::parse_state_formula(in, lpsspec, formula_is_quantitative);
160}
161
162state_formula parse_state_formula(const std::string& text, lps::stochastic_specification& lpsspec, const bool formula_is_quantitative)
163{
164 return state_formulas::parse_state_formula(text, lpsspec, formula_is_quantitative);
165}
166
167state_formula_specification parse_state_formula_specification(std::istream& in, const bool formula_is_quantitative)
168{
169 return state_formulas::parse_state_formula_specification(in, formula_is_quantitative);
170}
171
172state_formula_specification parse_state_formula_specification(const std::string& text, const bool formula_is_quantitative)
173{
174 return state_formulas::parse_state_formula_specification(text, formula_is_quantitative);
175}
176
177state_formula_specification parse_state_formula_specification(std::istream& in, lps::stochastic_specification& lpsspec, const bool formula_is_quantitative)
178{
179 return state_formulas::parse_state_formula_specification(in, lpsspec, formula_is_quantitative);
180}
181
182state_formula_specification parse_state_formula_specification(const std::string& text, lps::stochastic_specification& lpsspec, const bool formula_is_quantitative)
183{
184 return state_formulas::parse_state_formula_specification(text, lpsspec, formula_is_quantitative);
185}
186
188{
190}
191
192state_formula normalize(const state_formula& x, bool quantitative=false, bool negated=false)
193{
194 return state_formulas::normalize(x, quantitative, negated);
195}
196
198{
200}
201
203{
204 return state_formulas::is_timed(x);
205}
206
207std::set<core::identifier_string> find_state_variable_names(const state_formula& x)
208{
210}
211
212} // namespace algorithms
213
214} // namespace state_formulas
215
216} // namespace mcrl2
\brief The and operator for action formulas
\brief The at operator for action formulas
\brief The existential quantification operator for action formulas
\brief The value false for action formulas
\brief The universal quantification operator for action formulas
\brief The implication operator for action formulas
\brief The multi action for action formulas
\brief The not operator for action formulas
\brief The or operator for action formulas
\brief The value true for action formulas
\brief The alt operator for regular formulas
\brief The seq operator for regular formulas
\brief The 'trans or nil' operator for regular formulas
\brief The trans operator for regular formulas
\brief An untyped regular formula or action formula
\brief The and operator for state formulas
\brief The multiply operator for state formulas with values
\brief The multiply operator for state formulas with values
\brief The timed delay operator for state formulas
\brief The delay operator for state formulas
\brief The existential quantification operator for state formulas
\brief The value false for state formulas
\brief The universal quantification operator for state formulas
\brief The implication operator for state formulas
\brief The infimum over a data type for state formulas
\brief The may operator for state formulas
\brief The minus operator for state formulas
\brief The mu operator for state formulas
\brief The must operator for state formulas
\brief The not operator for state formulas
\brief The nu operator for state formulas
\brief The or operator for state formulas
\brief The plus operator for state formulas with values
\brief The sum over a data type for state formulas
\brief The supremum over a data type for state formulas
\brief The value true for state formulas
\brief The state formula variable
\brief The timed yaled operator for state formulas
\brief The yaled operator for state formulas
D_ParserTables parser_tables_mcrl2
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.
action_formula parse_action_formula(const std::string &text)
std::set< data::variable > find_all_variables(const action_formulas::action_formula &x)
std::string pp(const action_formula &x)
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_left_merge_merge(const parse_node &)
Prints a warning for each occurrence of 'x ||_ y || z' in the parse tree.
void warn_and_or(const parse_node &)
Prints a warning for each occurrence of 'x && y || z' in the parse tree.
regular_formula parse_regular_formula(const std::string &text)
void pp(const T &t, std::ostream &out)
Prints the object t to a stream.
Definition print.h:279
state_formula normalize(const state_formula &x)
Normalizes a state formula, i.e. removes any occurrences of ! or =>.
bool is_normalized(const state_formula &x)
Checks if a state formula is normalized.
state_formula_specification parse_state_formula_specification(std::istream &in, const bool formula_is_quantitative)
Parses a state formula specification from an input stream.
bool is_monotonous(const state_formula &f)
Returns true if the state formula is monotonous.
state_formula parse_state_formula(std::istream &in, lps::stochastic_specification &spec, const bool formula_is_quantitative)
Parses a state formula from an input stream.
bool is_timed(const state_formula &x)
std::set< core::identifier_string > find_state_variable_names(const state_formula &x)
Returns the names of the state variables that occur in x.
state_formula_specification parse_state_formula_specification(const std::string &text)
state_formula parse_state_formula(const std::string &text)
void normalize_sorts(T &x, const data::sort_specification &sortspec, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
state_formula parse_state_formula(const std::string &text, lps::stochastic_specification &lpsspec, const bool formula_is_quantitative, parse_state_formula_options options=parse_state_formula_options())
Parses a state formula from an input stream.
Definition parse.h:144
bool is_normalized(const T &x)
Checks if a state formula is normalized.
Definition normalize.h:411
void find_identifiers(const T &x, OutputIterator o)
Definition find.h:366
bool is_timed(const state_formula &x)
Checks if a state formula is timed.
Definition is_timed.h:60
void pp(const T &t, std::ostream &out)
Prints the object t to a stream.
Definition print.h:668
void find_sort_expressions(const T &x, OutputIterator o)
Definition find.h:387
state_formulas::state_formula translate_user_notation(const state_formulas::state_formula &x)
void find_action_labels(const T &x, OutputIterator o)
Returns all action labels that occur in an object.
Definition find.h:578
state_formula_specification parse_state_formula_specification(const std::string &text, const bool formula_is_quantitative, parse_state_formula_options options=parse_state_formula_options())
Parses a state formula specification from a string.
Definition parse.h:220
bool is_monotonous(const state_formula &f, const std::set< core::identifier_string > &non_negated_variables, const std::set< core::identifier_string > &negated_variables)
Returns true if the state formula is monotonous.
void find_all_variables(const T &x, OutputIterator o)
Definition find.h:301
std::set< core::identifier_string > find_state_variable_names(const state_formula &x)
Returns the names of the state variables that occur in x.
Definition find.h:524
void normalize(T &x, bool quantitative=false, bool negated=false, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
The function normalize brings (embedded) state formulas into positive normal form,...
Definition normalize.h:424
void find_free_variables(const T &x, OutputIterator o)
Definition find.h:322
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
action_formulas::action_formula parse_ActFrm(const core::parse_node &node) const
Definition parse_impl.h:34
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
regular_formulas::regular_formula parse_RegFrm(const core::parse_node &node) const
Definition parse_impl.h:69
untyped_state_formula_specification parse_StateFrmSpec(const core::parse_node &node) const
Definition parse_impl.h:217
state_formulas::state_formula parse_StateFrm(const core::parse_node &node) const
Definition parse_impl.h:146