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//
9/// \file modal_formula.cpp
10/// \brief
11
12#include "mcrl2/modal_formula/algorithms.h"
13#include "mcrl2/modal_formula/is_timed.h"
14#include "mcrl2/modal_formula/normalize.h"
15#include "mcrl2/modal_formula/parse.h"
16#include "mcrl2/modal_formula/parse_impl.h"
17#include "mcrl2/modal_formula/print.h"
18#include "mcrl2/modal_formula/replace.h"
19
20namespace mcrl2
21{
22
24{
25
26//--- start generated action_formulas overloads ---//
27std::string pp(const action_formulas::action_formula& x, bool arg0) { return action_formulas::pp< action_formulas::action_formula >(x, arg0); }
28std::string pp(const action_formulas::and_& x, bool arg0) { return action_formulas::pp< action_formulas::and_ >(x, arg0); }
29std::string pp(const action_formulas::at& x, bool arg0) { return action_formulas::pp< action_formulas::at >(x, arg0); }
30std::string pp(const action_formulas::exists& x, bool arg0) { return action_formulas::pp< action_formulas::exists >(x, arg0); }
31std::string pp(const action_formulas::false_& x, bool arg0) { return action_formulas::pp< action_formulas::false_ >(x, arg0); }
32std::string pp(const action_formulas::forall& x, bool arg0) { return action_formulas::pp< action_formulas::forall >(x, arg0); }
33std::string pp(const action_formulas::imp& x, bool arg0) { return action_formulas::pp< action_formulas::imp >(x, arg0); }
34std::string pp(const action_formulas::multi_action& x, bool arg0) { return action_formulas::pp< action_formulas::multi_action >(x, arg0); }
35std::string pp(const action_formulas::not_& x, bool arg0) { return action_formulas::pp< action_formulas::not_ >(x, arg0); }
36std::string pp(const action_formulas::or_& x, bool arg0) { return action_formulas::pp< action_formulas::or_ >(x, arg0); }
37std::string pp(const action_formulas::true_& x, bool arg0) { return action_formulas::pp< action_formulas::true_ >(x, arg0); }
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{
45 core::parser p(parser_tables_mcrl2, core::detail::ambiguity_fn, core::detail::syntax_error_fn);
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
59{
60
61//--- start generated regular_formulas overloads ---//
62std::string pp(const regular_formulas::alt& x, bool arg0) { return regular_formulas::pp< regular_formulas::alt >(x, arg0); }
63std::string pp(const regular_formulas::regular_formula& x, bool arg0) { return regular_formulas::pp< regular_formulas::regular_formula >(x, arg0); }
64std::string pp(const regular_formulas::seq& x, bool arg0) { return regular_formulas::pp< regular_formulas::seq >(x, arg0); }
65std::string pp(const regular_formulas::trans& x, bool arg0) { return regular_formulas::pp< regular_formulas::trans >(x, arg0); }
66std::string pp(const regular_formulas::trans_or_nil& x, bool arg0) { return regular_formulas::pp< regular_formulas::trans_or_nil >(x, arg0); }
67std::string pp(const regular_formulas::untyped_regular_formula& x, bool arg0) { return regular_formulas::pp< regular_formulas::untyped_regular_formula >(x, arg0); }
68//--- end generated regular_formulas overloads ---//
69
70namespace detail
71{
72
73regular_formula parse_regular_formula(const std::string& text)
74{
75 core::parser p(parser_tables_mcrl2, core::detail::ambiguity_fn, core::detail::syntax_error_fn);
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
88{
89
90//--- start generated state_formulas overloads ---//
91std::string pp(const state_formulas::and_& x, bool arg0) { return state_formulas::pp< state_formulas::and_ >(x, arg0); }
92std::string pp(const state_formulas::const_multiply& x, bool arg0) { return state_formulas::pp< state_formulas::const_multiply >(x, arg0); }
93std::string pp(const state_formulas::const_multiply_alt& x, bool arg0) { return state_formulas::pp< state_formulas::const_multiply_alt >(x, arg0); }
94std::string pp(const state_formulas::delay& x, bool arg0) { return state_formulas::pp< state_formulas::delay >(x, arg0); }
95std::string pp(const state_formulas::delay_timed& x, bool arg0) { return state_formulas::pp< state_formulas::delay_timed >(x, arg0); }
96std::string pp(const state_formulas::exists& x, bool arg0) { return state_formulas::pp< state_formulas::exists >(x, arg0); }
97std::string pp(const state_formulas::false_& x, bool arg0) { return state_formulas::pp< state_formulas::false_ >(x, arg0); }
98std::string pp(const state_formulas::forall& x, bool arg0) { return state_formulas::pp< state_formulas::forall >(x, arg0); }
99std::string pp(const state_formulas::imp& x, bool arg0) { return state_formulas::pp< state_formulas::imp >(x, arg0); }
100std::string pp(const state_formulas::infimum& x, bool arg0) { return state_formulas::pp< state_formulas::infimum >(x, arg0); }
101std::string pp(const state_formulas::may& x, bool arg0) { return state_formulas::pp< state_formulas::may >(x, arg0); }
102std::string pp(const state_formulas::minus& x, bool arg0) { return state_formulas::pp< state_formulas::minus >(x, arg0); }
103std::string pp(const state_formulas::mu& x, bool arg0) { return state_formulas::pp< state_formulas::mu >(x, arg0); }
104std::string pp(const state_formulas::must& x, bool arg0) { return state_formulas::pp< state_formulas::must >(x, arg0); }
105std::string pp(const state_formulas::not_& x, bool arg0) { return state_formulas::pp< state_formulas::not_ >(x, arg0); }
106std::string pp(const state_formulas::nu& x, bool arg0) { return state_formulas::pp< state_formulas::nu >(x, arg0); }
107std::string pp(const state_formulas::or_& x, bool arg0) { return state_formulas::pp< state_formulas::or_ >(x, arg0); }
108std::string pp(const state_formulas::plus& x, bool arg0) { return state_formulas::pp< state_formulas::plus >(x, arg0); }
109std::string pp(const state_formulas::state_formula& x, bool arg0) { return state_formulas::pp< state_formulas::state_formula >(x, arg0); }
110std::string pp(const state_formulas::state_formula_specification& x, bool arg0) { return state_formulas::pp< state_formulas::state_formula_specification >(x, arg0); }
111std::string pp(const state_formulas::sum& x, bool arg0) { return state_formulas::pp< state_formulas::sum >(x, arg0); }
112std::string pp(const state_formulas::supremum& x, bool arg0) { return state_formulas::pp< state_formulas::supremum >(x, arg0); }
113std::string pp(const state_formulas::true_& x, bool arg0) { return state_formulas::pp< state_formulas::true_ >(x, arg0); }
114std::string pp(const state_formulas::variable& x, bool arg0) { return state_formulas::pp< state_formulas::variable >(x, arg0); }
115std::string pp(const state_formulas::yaled& x, bool arg0) { return state_formulas::pp< state_formulas::yaled >(x, arg0); }
116std::string pp(const state_formulas::yaled_timed& x, bool arg0) { return state_formulas::pp< state_formulas::yaled_timed >(x, arg0); }
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{
130 core::parser p(parser_tables_mcrl2, core::detail::ambiguity_fn, core::detail::syntax_error_fn);
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);
136 return result;
137}
138
140{
141 core::parser p(parser_tables_mcrl2, core::detail::ambiguity_fn, core::detail::syntax_error_fn);
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);
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{
199 return state_formulas::is_normalized(x);
200}
201
203{
205}
206
208{
209 return state_formulas::find_state_variable_names(x);
210}
211
212} // namespace algorithms
213
214} // namespace state_formulas
215
216} // namespace mcrl2
D_ParserTables parser_tables_mcrl2
action_formula parse_action_formula(const std::string &text)
std::string pp(const action_formulas::exists &x, bool arg0)
std::string pp(const action_formulas::imp &x, bool arg0)
std::string pp(const action_formulas::at &x, bool arg0)
std::string pp(const action_formulas::forall &x, bool arg0)
std::string pp(const action_formulas::or_ &x, bool arg0)
std::string pp(const action_formulas::action_formula &x, bool arg0)
std::string pp(const action_formulas::true_ &x, bool arg0)
std::set< data::variable > find_all_variables(const action_formulas::action_formula &x)
std::string pp(const action_formulas::not_ &x, bool arg0)
std::string pp(const action_formulas::multi_action &x, bool arg0)
std::string pp(const action_formulas::false_ &x, bool arg0)
std::string pp(const action_formulas::and_ &x, bool arg0)
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.
The main namespace for the LPS library.
Definition constelm.h:18
regular_formula parse_regular_formula(const std::string &text)
std::string pp(const regular_formulas::trans &x, bool arg0)
std::string pp(const regular_formulas::alt &x, bool arg0)
std::string pp(const regular_formulas::untyped_regular_formula &x, bool arg0)
std::string pp(const regular_formulas::seq &x, bool arg0)
std::string pp(const regular_formulas::trans_or_nil &x, bool arg0)
std::string pp(const regular_formulas::regular_formula &x, bool arg0)
state_formula_specification parse_state_formula_specification(const std::string &text, const bool formula_is_quantitative)
Parses a state formula specification from text.
bool is_normalized(const state_formula &x)
Checks if a state formula is normalized.
state_formula parse_state_formula(std::istream &in, lps::stochastic_specification &lpsspec, const bool formula_is_quantitative)
Parses a state formula from an input stream.
state_formula normalize(const state_formula &x, bool quantitative=false, bool negated=false)
bool is_monotonous(const state_formula &f)
Returns true if the state formula is monotonous.
state_formula parse_state_formula(const std::string &text, lps::stochastic_specification &lpsspec, const bool formula_is_quantitative)
Parses a state formula from text.
state_formula_specification parse_state_formula_specification(std::istream &in, const bool formula_is_quantitative)
Parses a state formula specification from an input stream.
state_formula_specification parse_state_formula_specification(const std::string &text, lps::stochastic_specification &lpsspec, const bool formula_is_quantitative)
Parses a state formula specification from text.
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(std::istream &in, lps::stochastic_specification &lpsspec, const bool formula_is_quantitative)
Parses a state formula specification from an input stream.
state_formula_specification parse_state_formula_specification(const std::string &text)
state_formula parse_state_formula(const std::string &text)
std::string pp(const state_formulas::nu &x, bool arg0)
std::string pp(const state_formulas::exists &x, bool arg0)
std::string pp(const state_formulas::not_ &x, bool arg0)
std::string pp(const state_formulas::supremum &x, bool arg0)
std::string pp(const state_formulas::must &x, bool arg0)
std::string pp(const state_formulas::minus &x, bool arg0)
std::set< data::variable > find_all_variables(const state_formulas::state_formula &x)
std::set< data::variable > find_free_variables(const state_formulas::state_formula &x)
std::string pp(const state_formulas::true_ &x, bool arg0)
std::string pp(const state_formulas::state_formula &x, bool arg0)
std::string pp(const state_formulas::const_multiply &x, bool arg0)
std::string pp(const state_formulas::delay_timed &x, bool arg0)
bool is_timed(const state_formula &x)
Checks if a state formula is timed.
Definition is_timed.h:71
std::string pp(const state_formulas::imp &x, bool arg0)
std::string pp(const state_formulas::mu &x, bool arg0)
bool is_monotonous(const state_formula &f)
Returns true if the state formula is monotonous.
state_formulas::state_formula translate_user_notation(const state_formulas::state_formula &x)
state_formulas::state_formula normalize_sorts(const state_formulas::state_formula &x, const data::sort_specification &sortspec)
std::string pp(const state_formulas::delay &x, bool arg0)
std::string pp(const state_formulas::forall &x, bool arg0)
std::string pp(const state_formulas::sum &x, bool arg0)
std::string pp(const state_formulas::yaled &x, bool arg0)
std::string pp(const state_formulas::infimum &x, bool arg0)
std::string pp(const state_formulas::or_ &x, bool arg0)
std::string pp(const state_formulas::may &x, bool arg0)
std::string pp(const state_formulas::and_ &x, bool arg0)
std::string pp(const state_formulas::false_ &x, bool arg0)
std::string pp(const state_formulas::const_multiply_alt &x, bool arg0)
std::string pp(const state_formulas::state_formula_specification &x, bool arg0)
std::string pp(const state_formulas::yaled_timed &x, bool arg0)
std::string pp(const state_formulas::plus &x, bool arg0)
std::string pp(const state_formulas::variable &x, bool arg0)
std::set< data::sort_expression > find_sort_expressions(const state_formulas::state_formula &x)
std::set< process::action_label > find_action_labels(const state_formulas::state_formula &x)
std::set< core::identifier_string > find_identifiers(const state_formulas::state_formula &x)
action_formula_actions(const core::parser &parser_)
Definition parse_impl.h:27
action_formulas::action_formula parse_ActFrm(const core::parse_node &node) const
Definition parse_impl.h:31
regular_formulas::regular_formula parse_RegFrm(const core::parse_node &node) const
Definition parse_impl.h:61
untyped_state_formula_specification parse_StateFrmSpec(const core::parse_node &node) const
Definition parse_impl.h:204
state_formula_actions(const core::parser &parser_)
Definition parse_impl.h:95
state_formulas::state_formula parse_StateFrm(const core::parse_node &node) const
Definition parse_impl.h:133