mCRL2
Loading...
Searching...
No Matches
lts2lps.h
Go to the documentation of this file.
1// Author(s): Frank Stappers, Jan Friso Groote
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 lts2lps.h
10/// \brief This file contains functions to translate lts's into`
11/// LPS format.
12
13
14#ifndef MCRL2_LTS_LTS2LPS_H
15#define MCRL2_LTS_LTS2LPS_H
16
17#include "mcrl2/lps/io.h"
18#include "mcrl2/lts/detail/lts_convert.h"
19
20
21namespace mcrl2
22{
23namespace lts
24{
25
26using namespace mcrl2::lps;
27using namespace mcrl2::data;
28
29/// \brief transform an lts in lts format into a linear process.
30/// \param l A labelled transition system in lts format.
31/// \return The function returns a linear process with the same behaviour as the lts.
33{
34 action_summand_vector action_summands;
35 const variable process_parameter("x",mcrl2::data::sort_pos::pos());
36 const variable_list process_parameters = { process_parameter };
37 const std::set< data::variable> global_variables;
38 // Add a single delta.
39 const deadlock_summand_vector deadlock_summands(1,deadlock_summand(variable_list(), sort_bool::true_(), deadlock()));
40 const process_initializer initial_process(data::data_expression_list{sort_pos::pos(l.initial_state()+1)}
41 );
42
43 const std::vector<transition>& trans=l.get_transitions();
44 for (std::vector<transition>::const_iterator r=trans.begin(); r!=trans.end(); ++r)
45 {
46 const lps::multi_action actions=l.action_label(r->label());
47
48 assignment_list assignments;
49 if (r->from()!=r->to())
50 {
51 assignments=push_back(assignments,assignment(process_parameter,sort_pos::pos(r->to()+1)));
52 }
53
54 const action_summand summand(variable_list(),
55 equal_to(process_parameter,sort_pos::pos(r->from()+1)),
56 actions,
57 assignments);
58 action_summands.push_back(summand);
59 }
60
61 const linear_process lps1(process_parameters,deadlock_summands,action_summands);
62 const specification spec(l.data(),l.action_label_declarations(),global_variables,lps1,initial_process);
63
64 return spec;
65}
66
67/// \brief transform an lts in aut format into a linear process.
68/// \param l1 A labelled transition system in aut format.
69/// \param data A separate data specification.
70/// \param action_labels A list containing the action labels used in the lts.
71/// \param process_parameters The process parameters of the current process.
72/// \return The function returns a linear process with the same behaviour as the lts.
74 const data_specification& data,
75 const process::action_label_list& action_labels,
76 const variable_list& process_parameters)
77{
78 lts_lts_t l2;
79 mcrl2::lts::detail::lts_convert(l1,l2,data,action_labels,process_parameters);
80 return transform_lts2lps(l2);
81}
82
83/// \brief transform an lts in fsm format into a linear process.
84/// \param l1 A labelled transition system in fsm format.
85/// \param data A separate data specification.
86/// \param action_labels A list containing the action labels used in the lts.
87/// \param process_parameters The process parameters of the current process. XXXXX Is this needed????
88/// \return The function returns a linear process with the same behaviour as the lts.
89
91 const data_specification& data,
92 const process::action_label_list& action_labels,
93 const variable_list& process_parameters)
94{
95 lts_lts_t l2;
96 mcrl2::lts::detail::lts_convert(l1,l2,data,action_labels,process_parameters);
97 return transform_lts2lps(l2);
98}
99
100} // namespace lts
101} // namespace mcrl2
102
103#endif // MCRL2_LTS_LTS2LPS_H
\brief A data variable
Definition variable.h:28
LPS summand containing a deadlock.
deadlock_summand(const data::variable_list &summation_variables, const data::data_expression &condition, const lps::deadlock &delta)
Constructor.
Represents a deadlock.
Definition deadlock.h:26
deadlock(data::data_expression time=data::undefined_real())
Constructor.
Definition deadlock.h:36
process_initializer(const data::data_expression_list &expressions)
Constructor.
Linear process specification.
A simple labelled transition format with only strings as action labels.
Definition lts_aut.h:70
The class lts_fsm_t contains labelled transition systems in .fsm format.
Definition lts_fsm.h:255
This class contains labelled transition systems in .lts format.
Definition lts_lts.h:385
Namespace for system defined sort bool_.
Definition bool.h:32
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:77
Namespace for system defined sort pos.
const basic_sort & pos()
Constructor for sort expression Pos.
Definition pos1.h:45
Namespace for all data library functionality.
Definition data.cpp:22
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
atermpp::term_list< variable > variable_list
\brief list of variables
The main namespace for the LPS library.
Definition constelm.h:21
std::vector< deadlock_summand > deadlock_summand_vector
\brief vector of deadlock_summands
std::vector< action_summand > action_summand_vector
\brief vector of action_summands
A base class for the lts_dot labelled transition system.
The main LTS namespace.
lps::specification transform_lts2lps(const lts_aut_t &l1, const data_specification &data, const process::action_label_list &action_labels, const variable_list &process_parameters)
transform an lts in aut format into a linear process.
Definition lts2lps.h:73
lps::specification transform_lts2lps(const lts_lts_t &l)
transform an lts in lts format into a linear process.
Definition lts2lps.h:32
lps::specification transform_lts2lps(const lts_fsm_t &l1, const data_specification &data, const process::action_label_list &action_labels, const variable_list &process_parameters)
transform an lts in fsm format into a linear process.
Definition lts2lps.h:90
The main namespace for the Process library.
atermpp::term_list< action_label > action_label_list
\brief list of action_labels