12#ifndef MCRL2_MODAL_FORMULA_PREPROCESS_STATE_FORMULA_H
13#define MCRL2_MODAL_FORMULA_PREPROCESS_STATE_FORMULA_H
15#include "mcrl2/data/detail/find.h"
16#include "mcrl2/data/xyz_identifier_generator.h"
17#include "mcrl2/modal_formula/has_name_clashes.h"
18#include "mcrl2/modal_formula/is_monotonous.h"
19#include "mcrl2/modal_formula/normalize.h"
20#include "mcrl2/modal_formula/resolve_name_clashes.h"
21#include "mcrl2/modal_formula/state_formula_rename.h"
46 nesting_depth.push_back(0);
51 nesting_depth.pop_back();
56 nesting_depth.back()++;
57 if (nesting_depth.back() > result)
59 result = nesting_depth.back();
65 nesting_depth.back()--;
153 fixpoints.push_back(x);
158 fixpoints.pop_back();
163 if (fixpoints.empty())
171 if (fixpoints.empty())
213template <
typename IdentifierGenerator>
235 fixpoints.push_back(x);
240 fixpoints.pop_back();
245 if (fixpoints.empty())
249 return state_formulas::is_mu(fixpoints.back());
285 make_must(result, x
.formula(), mu(X, {}, operand));
290 make_must(result, x
.formula(), nu(X, {}, operand));
308 make_may(result, x
.formula(), mu(X, {}, operand));
313 make_may(result, x
.formula(), nu(X, {}, operand));
322template <
typename IdentifierGenerator>
336 std::set<core::identifier_string> ids = state_formulas::find_identifiers(x);
337 generator.add_identifiers(ids);
339 detail::make_state_formula_preprocess_nested_modal_operators_builder(generator).apply(result, x);
354 const std::set<core::identifier_string>& context_ids,
355 bool preprocess_modal_operators,
356 bool quantitative =
false,
357 bool warn_for_modal_operator_nesting =
true
364 throw mcrl2::runtime_error(
"The formula " + state_formulas::pp(f) +
" is not monotonous!");
367 if (!preprocess_modal_operators && warn_for_modal_operator_nesting && state_formulas::detail::count_modal_operator_nesting(formula) >= 3)
370 "Warning: detected nested modal operators. This may result in a long execution time.\n"
371 "Use the option -m (for lps2pbes/lps2pres), -p (for lts2pbes/lts2pres) or insert dummy fix \n"
372 "point operators in between manually to speed up the transformation." << std::endl;
375 mCRL2log(log::debug) <<
"Formula before preprocessing: " << f <<
".\n";
378 std::set<core::identifier_string> ids = state_formulas::find_identifiers(f);
379 ids.insert(context_ids.begin(), context_ids.end());
380 f = state_formulas::rename_variables(f, ids);
384 xyz_generator.add_identifiers(
state_formulas::find_identifiers(f));
385 f
= rename_predicate_variables(f, xyz_generator);
387 mCRL2log(log::debug) <<
"Formula after renaming variables: " << f <<
".\n";
390 if (preprocess_modal_operators)
396 mCRL2log(log::debug) <<
"Formula after inserting dummy fix points between modal operators: " << f <<
".\n";
403 f = state_formulas::normalize(f, quantitative);
404 mCRL2log(log::debug) <<
"Formula after normalization: " << f <<
".\n";
413 core::identifier_string X = generator(
"X");
415 mCRL2log(log::debug) <<
"Formula after wrapping the formula inside a 'nu': " << f <<
".\n";
421 f = resolve_state_formula_data_variable_name_clashes(f, context_ids);
422 mCRL2log(log::debug) <<
"formula after removing data variable name clashes: " << f << std::endl;
425 mCRL2log(log::debug) <<
"formula after preprocessing: " << f << std::endl;
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
Identifier generator that generates names from the range X, Y, Z, X0, Y0, Z0, X1, ....
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.