mCRL2
Loading...
Searching...
No Matches
lts2pbes.h
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 mcrl2/pbes/lts2pbes.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_LTS2PBES_H
13#define MCRL2_PBES_LTS2PBES_H
14
15#include "mcrl2/modal_formula/count_fixpoints.h"
16#include "mcrl2/pbes/lps2pbes.h"
17#include "mcrl2/pbes/detail/lts2pbes_e.h"
18
19namespace mcrl2::pbes_system {
20
21/// \brief Algorithm for translating a state formula and an untimed specification to a pbes.
23{
24 public:
27
28 protected:
31 utilities::progress_meter m_progress_meter;
33
34 template <typename Parameters>
35 void run(const state_formulas::state_formula& f, std::vector<pbes_equation>& equations, Parameters& parameters)
36 {
37 detail::E_lts2pbes(f, parameters, equations, core::term_traits_optimized<pbes_expression>());
38 }
39
40 public:
41 /// \brief Constructor.
42 explicit lts2pbes_algorithm(const lts::lts_lts_t& l)
43 : lts0(l), lts1(l)
44 {}
45
46 /// \brief Runs the translation algorithm
47 /// \param formspec A state formula specification.
48 /// \param preprocess_modal_operators A boolean indicating that the modal operators can be preprocessed
49 // for a more compact translation.
50 /// \param generate_counter_example A boolean indicating whether a counterexample must be generated.
51 /// \return The result of the translation
53 bool preprocess_modal_operators = false,
54 bool generate_counter_example = false
55 )
56 {
57 // TODO: extract identifiers from the LTS(?)
58 std::set<core::identifier_string> lts_ids;
59 state_formulas::state_formula f = state_formulas::preprocess_state_formula(formspec.formula(), lts_ids, preprocess_modal_operators);
60
61 // initialize progress meter
62 std::size_t num_fixpoints = state_formulas::count_fixpoints(f);
63 std::size_t num_steps = num_fixpoints * lts1.state_count();
64 m_progress_meter.set_size(num_steps);
65 mCRL2log(log::verbose) << "Generating " << num_steps << " equations." << std::endl;
66
67 // compute the equations
68 std::vector<pbes_equation> equations;
69 if (generate_counter_example)
70 {
71 detail::lts2pbes_counter_example_parameters parameters(f, lts0, lts1, m_id_generator, m_progress_meter);
72 run(f, equations, parameters);
73 equations = equations + parameters.equations();
74 }
75 else
76 {
77 detail::lts2pbes_parameters parameters(f, lts0, lts1, m_id_generator, m_progress_meter);
78 run(f, equations, parameters);
79 }
80
81 // compute the initial state
82 state_type s0 = lts0.initial_state();
83 core::identifier_string Xs0 = detail::make_identifier(detail::mu_name(f), s0);
84 data::data_expression_list e = detail::mu_expressions(f);
86
87 return pbes(lts0.data(), equations, init);
88 }
89};
90
91/// \brief Translates an LTS and a modal formula into a PBES that represents the corresponding
92/// model checking problem.
93/// \param l A labelled transition system.
94/// \param formspec A modal formula specification.
95/// \param preprocess_modal_operators A boolean indicating that modal operators must be preprocessed.
96/// \param generate_counter_example A boolean indicating that a counter example must be generated.
97inline
98pbes lts2pbes(const lts::lts_lts_t& l, const state_formulas::state_formula_specification& formspec, bool preprocess_modal_operators = false, bool generate_counter_example = false)
99{
100 lts2pbes_algorithm algorithm(l);
101 return algorithm.run(formspec, preprocess_modal_operators, generate_counter_example);
102}
103
104} // namespace mcrl2::pbes_system
105
106
107
108#endif // MCRL2_PBES_LTS2PBES_H
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
This class contains labelled transition systems in .lts format.
Definition lts_lts.h:370
Algorithm for translating a state formula and an untimed specification to a pbes.
Definition lts2pbes.h:23
utilities::progress_meter m_progress_meter
Definition lts2pbes.h:31
data::set_identifier_generator m_id_generator
Definition lts2pbes.h:32
void run(const state_formulas::state_formula &f, std::vector< pbes_equation > &equations, Parameters &parameters)
Definition lts2pbes.h:35
pbes_system::detail::lts2pbes_lts lts1
Definition lts2pbes.h:30
pbes run(const state_formulas::state_formula_specification &formspec, bool preprocess_modal_operators=false, bool generate_counter_example=false)
Runs the translation algorithm.
Definition lts2pbes.h:52
lts2pbes_algorithm(const lts::lts_lts_t &l)
Constructor.
Definition lts2pbes.h:42
const lts::lts_lts_t & lts0
Definition lts2pbes.h:29
parameterized boolean equation system
Definition pbes.h:54
\brief A propositional variable instantiation
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:393
pbes lts2pbes(const lts::lts_lts_t &l, const state_formulas::state_formula_specification &formspec, bool preprocess_modal_operators=false, bool generate_counter_example=false)
Translates an LTS and a modal formula into a PBES that represents the corresponding model checking pr...
Definition lts2pbes.h:98