12#ifndef MCRL2_PBES_LPS2PBES_H
13#define MCRL2_PBES_LPS2PBES_H
15#include "mcrl2/data/merge_data_specifications.h"
16#include "mcrl2/lps/detail/make_timed_lps.h"
17#include "mcrl2/lps/linearise.h"
18#include "mcrl2/modal_formula/algorithms.h"
19#include "mcrl2/modal_formula/preprocess_state_formula.h"
20#include "mcrl2/pbes/algorithms.h"
21#include "mcrl2/pbes/detail/lps2pbes_e.h"
22#include "mcrl2/pbes/detail/term_traits_optimized.h"
23#include "mcrl2/pbes/is_monotonous.h"
24#include "mcrl2/process/merge_action_specifications.h"
38 template <
typename Parameters>
45 detail::E_structured(f, parameters, equations, core::term_traits<pbes_expression>());
49 detail::E_structured(f, parameters, equations, core::term_traits_optimized<pbes_expression>());
56 detail::E(f, parameters, equations, core::term_traits<pbes_expression>());
60 detail::E(f, parameters, equations, core::term_traits_optimized<pbes_expression>());
82 bool structured =
false,
83 bool unoptimized =
false,
84 bool preprocess_modal_operators =
false,
85 bool generate_counter_example =
false,
91 std::set<core::identifier_string> lps_ids = lps::find_identifiers(lpsspec);
92 std::set<core::identifier_string> dataspec_ids = data::function_and_mapping_identifiers(lpsspec.data());
93 lps_ids.insert(dataspec_ids.begin(), dataspec_ids.end());
94 f = state_formulas::preprocess_state_formula(f, lps_ids, preprocess_modal_operators);
101 m_generator.clear_context();
102 m_generator.add_identifiers(lps::find_identifiers(lpsspec));
103 m_generator.add_identifiers(data::function_and_mapping_identifiers(lpsspec.data()));
104 m_generator.add_identifiers(state_formulas::find_identifiers(f));
106 std::vector<pbes_equation> equations;
107 if (generate_counter_example)
110 run(f, structured, unoptimized, equations, parameters);
111 equations = equations + parameters.equations();
116 run(f, structured, unoptimized, equations, parameters);
120 assert(!equations.empty());
125 data::data_expression_list fi = detail::mu_expressions(f);
126 data::data_expression_list pi = lpsspec.initial_process().expressions();
127 data::data_expression_list e = fi + pi + detail::Par(Xf, data::variable_list(), f);
130 e.push_front(data::sort_real::real_(0));
134 pbes result(lpsspec.data(), lpsspec.global_variables(), equations, init);
160 bool structured =
false,
161 bool unoptimized =
false,
162 bool preprocess_modal_operators =
false,
163 bool generate_counter_example =
false,
164 bool check_only =
false
167 if ((formula
.has_time() || lpsspec.process().has_time()) && !timed)
169 mCRL2log(log::warning) <<
"Switch to timed translation because formula has "
170 << (formula.has_time()?
"":
"no ") <<
"time, and process has "
171 << (lpsspec.process().has_time()?
"":
"no ") <<
"time" << std::endl;
179 generator.add_identifiers(
lps::find_identifiers(lpsspec));
180 generator.add_identifiers(
state_formulas::find_identifiers(formula));
181 generator.add_identifiers(data::function_and_mapping_identifiers(lpsspec.data()));
183 lps::detail::make_timed_lps(lpsspec_timed.process(), generator.context());
208 bool structured =
false,
209 bool unoptimized =
false,
210 bool preprocess_modal_operators =
false,
211 bool generate_counter_example =
false,
212 bool check_only =
false
220 preprocess_modal_operators
,
221 generate_counter_example
,
243 bool structured =
false,
244 bool unoptimized =
false,
245 bool preprocess_modal_operators =
false,
246 bool generate_counter_example =
false,
247 bool check_only =
false
252 lps::normalize_sorts(lpsspec1, lpsspec1.data());
253 lpsspec1.action_labels() = process::merge_action_specifications(lpsspec1.action_labels(), formspec.action_labels());
254 return lps2pbes(lpsspec1
, formspec
.formula(), timed
, structured
, unoptimized
, preprocess_modal_operators
, generate_counter_example
, check_only
);
271 const std::string& formula_text,
273 bool structured =
false,
274 bool unoptimized =
false,
275 bool preprocess_modal_operators =
false,
276 bool generate_counter_example =
false,
277 bool check_only =
false
284 const bool formula_is_quantitative =
false;
286 return lps2pbes(lpsspec
, f
, timed
, structured
, unoptimized
, preprocess_modal_operators
, generate_counter_example
, check_only
);
aterm_string(const aterm_string &t) noexcept=default
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
Linear process specification.
Linear process specification.
stochastic_specification(const specification &other)
Constructor. This constructor is explicit as implicit conversions of this kind is a source of bugs.
Algorithm for translating a state formula and a timed specification to a pbes.
pbes run(const state_formulas::state_formula &formula, const lps::stochastic_specification &lpsspec, bool structured=false, bool unoptimized=false, bool preprocess_modal_operators=false, bool generate_counter_example=false, const data::variable &T=data::undefined_real_variable())
Runs the translation algorithm.
data::set_identifier_generator m_generator
lps2pbes_algorithm(bool check_only=false)
Constructor.
void run(const state_formulas::state_formula &f, bool structured, bool unoptimized, std::vector< pbes_equation > &equations, Parameters ¶meters)
propositional_variable & variable()
Returns the pbes variable of the equation.
parameterized boolean equation system
bool is_closed() const
True if the pbes is closed.
pbes()=default
Constructor.
\brief A propositional variable instantiation
const core::identifier_string & name() const
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Namespace for system defined sort real_.
const basic_sort & real_()
Constructor for sort expression Real.
data_specification merge_data_specifications(const data_specification &dataspec1, const data_specification &dataspec2)
Merges two data specifications. Throws an exception if conflicts are detected.
const data::variable & undefined_real_variable()
Returns a data variable that corresponds to 'undefined'.
The main namespace for the LPS library.
specification remove_stochastic_operators(const stochastic_specification &spec)
Converts a stochastic specification to a specification. Throws an exception if non-empty distribution...
bool is_normalized(const pbes &x)
Checks if a PBEs is normalized.
void normalize(pbes &x)
The function normalize brings (embedded) pbes expressions into positive normal form,...
const core::identifier_string & mu_name(const state_formulas::state_formula &f)
The main namespace for the PBES library.
pbes lps2pbes(const lps::stochastic_specification &lpsspec, const state_formulas::state_formula_specification &formspec, bool timed=false, bool structured=false, bool unoptimized=false, bool preprocess_modal_operators=false, bool generate_counter_example=false, bool check_only=false)
Translates a linear process specification and a state formula to a PBES. If the solution of the PBES ...
pbes lps2pbes(const lps::specification &lpsspec, const state_formulas::state_formula &formula, bool timed=false, bool structured=false, bool unoptimized=false, bool preprocess_modal_operators=false, bool generate_counter_example=false, bool check_only=false)
Translates a linear process specification and a state formula to a PBES. If the solution of the PBES ...
pbes lps2pbes(const std::string &spec_text, const std::string &formula_text, bool timed=false, bool structured=false, bool unoptimized=false, bool preprocess_modal_operators=false, bool generate_counter_example=false, bool check_only=false)
Applies the lps2pbes algorithm.
pbes lps2pbes(const lps::stochastic_specification &lpsspec, const state_formulas::state_formula &formula, bool timed=false, bool structured=false, bool unoptimized=false, bool preprocess_modal_operators=false, bool generate_counter_example=false, bool check_only=false)
Translates a linear process specification and a state formula to a PBES. If the solution of the PBES ...
void complete_data_specification(pbes &)
Adds all sorts that appear in the PBES p to the data specification of p.
bool is_monotonous(const pbes &p)
Returns true if the pbes is monotonous.