mCRL2
Loading...
Searching...
No Matches
make_timed_lps.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/lps/detail/make_timed_lps.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_LPS_DETAIL_MAKE_TIMED_LPS_H
13#define MCRL2_LPS_DETAIL_MAKE_TIMED_LPS_H
14
15#include "mcrl2/lps/linear_process.h"
16
17namespace mcrl2 {
18
19namespace lps {
20
21namespace detail {
22
23/// \brief Adds a time parameter t to s if needed and returns the result. The time t
24/// is chosen such that it doesn't appear in context.
25template <typename IdentifierGenerator>
27{
28 IdentifierGenerator& m_generator;
29
30 make_timed_lps_summand(IdentifierGenerator& generator)
31 : m_generator(generator)
32 {}
33
34 /// \brief Adds time to the summand s (either an action or a deadlock summand)
35 /// \param s An action summand
36 void operator()(deadlock_summand& s) const
37 {
38 if (!s.deadlock().has_time())
39 {
41 s.deadlock().time() = t;
42 s.summation_variables() = push_back(s.summation_variables(), t);
43 /* data::variable_vector v = data::variable_vector(s.summation_variables().begin(),s.summation_variables().end());
44 v.push_back(t);
45 s.summation_variables() = data::variable_list(v.begin(),v.end()); */
46 }
47 }
48
49 /// \brief Adds time to the summand s (either an action or a deadlock summand)
50 /// \param s An action summand
51 void operator()(action_summand& s) const
52 {
53 if (!s.multi_action().has_time())
54 {
56 s.multi_action() = multi_action(s.multi_action().actions(), t);
57 s.summation_variables()=push_back(s.summation_variables(), t);
58 /* data::variable_vector v = data::variable_vector(s.summation_variables().begin(),s.summation_variables().end());
59 v.push_back(t);
60 s.summation_variables() = data::variable_list(v.begin(),v.end());
61 */
62 }
63 }
64};
65
66/// \brief Adds time parameters to the lps if needed and returns the result.
67/// The times are chosen such that they don't appear in context.
68/// \param lps A linear process
69/// \param context A term
70/// \return A timed linear process
71template <class LINEAR_PROCESS>
72void make_timed_lps(LINEAR_PROCESS& lps,
73 const std::set<core::identifier_string>& context,
74 typename std::enable_if<std::is_same<LINEAR_PROCESS, linear_process>::value ||
75 std::is_same<LINEAR_PROCESS, stochastic_linear_process>::value>::type* = nullptr)
76{
78 generator.add_identifiers(context);
80 for (action_summand& s: lps.action_summands())
81 {
82 f(s);
83 }
84 for (deadlock_summand& s: lps.deadlock_summands())
85 {
86 f(s);
87 }
88}
89
90} // namespace detail
91
92} // namespace lps
93
94} // namespace mcrl2
95
96#endif // MCRL2_LPS_DETAIL_MAKE_TIMED_LPS_H
aterm_string(const aterm_string &t) noexcept=default
bool operator!=(const unprotected_aterm_core &t) const
Inequality operator on two unprotected aterms.
Definition aterm_core.h:92
data_expression & operator=(const data_expression &) noexcept=default
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
\brief A data variable
Definition variable.h:28
logger(const log_level_t l)
Default constructor.
Definition logger.h:164
LPS summand containing a multi-action.
LPS summand containing a deadlock.
bool has_time() const
Returns true if time is available.
Definition deadlock.h:42
data::data_expression & time()
Returns the time.
Definition deadlock.h:56
\brief A timed multi-action
bool has_time() const
Returns true if time is available.
const process::action_list & actions() const
multi_action & operator=(multi_action &&) noexcept=default
multi_action(const process::action_list &actions=process::action_list(), data::data_expression time=data::undefined_real())
Constructor.
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.
Definition lps2pbes.h:34
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.
Definition lps2pbes.h:81
data::set_identifier_generator m_generator
Definition lps2pbes.h:36
lps2pbes_algorithm(bool check_only=false)
Constructor.
Definition lps2pbes.h:68
void run(const state_formulas::state_formula &f, bool structured, bool unoptimized, std::vector< pbes_equation > &equations, Parameters &parameters)
Definition lps2pbes.h:40
propositional_variable & variable()
Returns the pbes variable of the equation.
parameterized boolean equation system
Definition pbes.h:58
bool is_closed() const
True if the pbes is closed.
Definition pbes.h:245
pbes()=default
Constructor.
\brief A propositional variable instantiation
const core::identifier_string & name() const
Standard exception class for reporting runtime errors.
Definition exception.h:27
const state_formula & formula() const
Returns the formula of the state formula specification.
state_formula & formula()
Returns the formula of the state formula specification.
bool has_time() const
Returns true if the formula is timed.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
atermpp::aterm_string identifier_string
String type of the LPS library. Identifier strings are represented internally as ATerms.
Namespace for system defined sort real_.
const basic_sort & real_()
Constructor for sort expression Real.
Definition real1.h:48
Namespace for all data library functionality.
Definition data.cpp:22
data_specification merge_data_specifications(const data_specification &dataspec1, const data_specification &dataspec2)
Merges two data specifications. Throws an exception if conflicts are detected.
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
const data::variable & undefined_real_variable()
Returns a data variable that corresponds to 'undefined'.
Definition undefined.h:42
@ warning
Definition logger.h:34
@ verbose
Definition logger.h:37
void make_timed_lps(LINEAR_PROCESS &lps, const std::set< core::identifier_string > &context, typename std::enable_if< std::is_same< LINEAR_PROCESS, linear_process >::value||std::is_same< LINEAR_PROCESS, stochastic_linear_process >::value >::type *=nullptr)
Adds time parameters to the lps if needed and returns the result. The times are chosen such that they...
The main namespace for the LPS library.
Definition constelm.h:21
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)
void check_lps2pbes_actions(const state_formulas::state_formula &formula, const lps::stochastic_specification &lpsspec)
Prints a warning if formula contains an action that is not used in lpsspec.
Definition lps2pbes.h:27
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 ...
Definition lps2pbes.h:241
void lps2pbes(const std::string &input_filename, const std::string &output_filename, const utilities::file_format &output_format, const std::string &formula_filename, bool timed, bool structured, bool unoptimized, bool preprocess_modal_operators, bool generate_counter_example, bool check_only)
Definition lps2pbes.h:42
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 ...
Definition lps2pbes.h:206
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 ...
Definition lps2pbes.h:158
void complete_data_specification(pbes &)
Adds all sorts that appear in the PBES p to the data specification of p.
Definition pbes.h:314
bool is_monotonous(const pbes &p)
Returns true if the pbes is monotonous.
bool is_nu(const atermpp::aterm &x)
bool is_mu(const atermpp::aterm &x)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Adds a time parameter t to s if needed and returns the result. The time t is chosen such that it does...
void operator()(action_summand &s) const
Adds time to the summand s (either an action or a deadlock summand)
void operator()(deadlock_summand &s) const
Adds time to the summand s (either an action or a deadlock summand)
make_timed_lps_summand(IdentifierGenerator &generator)
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const