mCRL2
Loading...
Searching...
No Matches
complps2pbes.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//
11
12#ifndef MCRL2_PBES_TOOLS_COMPLPS2PBES_H
13#define MCRL2_PBES_TOOLS_COMPLPS2PBES_H
14
15#include "mcrl2/lps/linearise.h"
18#include "mcrl2/pbes/io.h"
19
20namespace mcrl2 {
21
22namespace pbes_system {
23
24void complps2pbes(const std::string& input_filename,
25 const std::string& output_filename,
26 const utilities::file_format& output_format,
27 const std::string& formula_filename
28 )
29{
30 if (formula_filename.empty())
31 {
32 throw mcrl2::runtime_error("option -f is not specified");
33 }
34
35 // load mCRL2 specification
36 std::string text;
37 if (input_filename.empty())
38 {
39 mCRL2log(log::verbose) << "reading mCRL2 specification from stdin..." << std::endl;
40 text = utilities::read_text(std::cin);
41 }
42 else
43 {
44 mCRL2log(log::verbose) << "reading mCRL2 specification from file '" << input_filename << "'..." << std::endl;
45 std::ifstream from(input_filename.c_str());
46 text = utilities::read_text(from);
47 }
48 // TODO: check if alpha reduction should be applied
51 lps::specification temp_spec = remove_stochastic_operators(lps::linearise(procspec)); // Just to check that there are no stochastic operators.
52
53 // load state formula
54 mCRL2log(log::verbose) << "reading formula from file '" << formula_filename << "'..." << std::endl;
55 std::ifstream instream(formula_filename.c_str(), std::ifstream::in|std::ifstream::binary);
56 if (!instream)
57 {
58 throw mcrl2::runtime_error("cannot open state formula file: " + formula_filename);
59 }
60 const bool formula_is_quantitative = false;
62 instream.close();
63
64 pbes result = complps2pbes(procspec, formula);
65
66 // save the result
67 if (output_filename.empty())
68 {
69 mCRL2log(log::verbose) << "writing PBES to stdout..." << std::endl;
70 }
71 else
72 {
73 mCRL2log(log::verbose) << "writing PBES to file '" << output_filename << "'..." << std::endl;
74 }
75 save_pbes(result, output_filename, output_format);
76}
77
78} // namespace pbes_system
79
80} // namespace mcrl2
81
82#endif // MCRL2_PBES_TOOLS_COMPLPS2PBES_H
Linear process specification.
parameterized boolean equation system
Definition pbes.h:58
Process specification consisting of a data specification, action labels, a sequence of process equati...
Standard exception class for reporting runtime errors.
Definition exception.h:27
add your file description here.
Linearisation of process specifications.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
add your file description here.
@ verbose
Definition logger.h:37
mcrl2::lps::stochastic_specification linearise(const mcrl2::process::process_specification &type_checked_spec, const mcrl2::lps::t_lin_options &lin_options=t_lin_options())
Linearises a process specification.
void save_pbes(const pbes &pbes, std::ostream &stream, utilities::file_format format=utilities::file_format())
Save a PBES in the format specified.
Definition io.cpp:49
pbes_system::pbes complps2pbes(const process::process_specification &procspec, const state_formulas::state_formula &)
pbes_expression formula(std::set< identifier_t > const &v, const owner_t owner, const std::string &prefix="X")
Definition pg_parse.h:54
process_specification parse_process_specification(std::istream &in)
Parses a process specification from an input stream.
Definition parse.h:43
state_formula parse_state_formula(std::istream &in, lps::stochastic_specification &spec, const bool formula_is_quantitative)
Parses a state formula from an input stream.
std::string read_text(const std::string &filename, bool warn=false)
Read text from a file.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
IO routines for boolean equation systems.