mCRL2
Loading...
Searching...
No Matches
pbesrewr.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_PBESREWR_H
13#define MCRL2_PBES_TOOLS_PBESREWR_H
14
19#include "mcrl2/pbes/io.h"
22#include "mcrl2/pbes/rewrite.h"
23#include "mcrl2/pbes/rewriter.h"
26
27namespace mcrl2 {
28
29namespace pbes_system {
30
31void pbesrewr(const std::string& input_filename,
32 const std::string& output_filename,
33 const utilities::file_format& input_format,
34 const utilities::file_format& output_format,
35 const data::rewrite_strategy rewrite_strategy,
36 pbes_rewriter_type rewriter_type)
37{
38 // load the pbes
39 pbes p;
40 load_pbes(p, input_filename, input_format);
41
42 // data rewriter
43 data::rewriter datar(p.data(), rewrite_strategy);
44
45 // pbes rewriter
46 switch (rewriter_type)
47 {
48 case simplify:
49 {
51 //simplify_data_rewriter<data::rewriter> pbesr(datar);
52 pbes_rewrite(p, pbesr);
53 break;
54 }
55 case quantifier_all:
56 {
57 bool enumerate_infinite_sorts = true;
58 enumerate_quantifiers_rewriter pbesr(datar, p.data(), enumerate_infinite_sorts);
59 pbes_rewrite(p, pbesr);
60 break;
61 }
63 {
64 bool enumerate_infinite_sorts = false;
65 enumerate_quantifiers_rewriter pbesr(datar, p.data(), enumerate_infinite_sorts);
66 pbes_rewrite(p, pbesr);
67 break;
68 }
70 {
72 pbes_rewrite(p, pbesr);
73 break;
74 }
76 {
77 // apply the one point rule rewriter
79 bool innermost = false;
80 replace_pbes_expressions(p, pbesr, innermost); // use replace, since the one point rule rewriter does the recursion itself
81
82 // post processing: apply the simplifying rewriter
84 pbes_rewrite(p, simp);
85 break;
86 }
87 case pfnf:
88 {
89 pfnf_rewriter pbesr;
91 pbes_rewrite(p, pbesr);
92 break;
93 }
94 case ppg:
95 {
96 //bool bqnf = detail::is_bqnf(p);
97 //std::clog << "bqnf_traverser says: p is " << (bqnf ? "" : "NOT ") << "in BQNF." << std::endl;
98 bool ppg = detail::is_ppg(p);
99 if (ppg)
100 {
101 mCRL2log(log::verbose) << "PBES is already a PPG." << std::endl;
102 }
103 else
104 {
105 mCRL2log(log::verbose) << "Rewriting..." << std::endl;
106 pbes q = detail::to_ppg(p);
107 mCRL2log(log::verbose) << "Rewriting done." << std::endl;
108 ppg = detail::is_ppg(q);
109 if (!ppg)
110 {
111 throw(std::runtime_error("The result PBES if not a PPG!"));
112 }
113 p = q;
114 }
115 break;
116 }
117 case bqnf_quantifier:
118 {
119 bqnf_rewriter pbesr;
120 pbes_rewrite(p, pbesr);
121 break;
122 }
123 case prover:
124 default:
125 {
126 // Just ignore.
127 assert(false); // The PBES rewriter cannot be activated through
128 // the commandline. So, we cannot end up here.
129 break;
130 }
131 }
132 save_pbes(p, output_filename, output_format);
133}
134
135} // namespace pbes_system
136
137} // namespace mcrl2
138
139#endif // MCRL2_PBES_TOOLS_PBESREWR_H
Traverser class for PBESs in Bounded Quantifier Normal Form (BQNF): BQNF :== forall d: D ....
Rewriter that operates on data expressions.
Definition rewriter.h:81
A rewriter that rewrites universal quantifiers over conjuncts in BQNF expressions to conjuncts over u...
A rewriter that applies one point rule quantifier elimination to a PBES.
parameterized boolean equation system
Definition pbes.h:58
const data::data_specification & data() const
Returns the data specification.
Definition pbes.h:150
A rewriter that brings PBES expressions into PFNF normal form.
A rewriter that pushes quantifiers inside in a PBES expression.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
rewrite_strategy
The strategy of the rewriter.
@ verbose
Definition logger.h:37
pbes to_ppg(pbes x)
Rewrites a PBES to a PPG.
bool is_ppg(const T &x)
Determines if an expression is a PPG expression.
pbes_rewriter_type
An enumerated type for the available pbes rewriters.
void load_pbes(pbes &pbes, std::istream &stream, utilities::file_format format, const std::string &source="")
Load a PBES from file.
Definition io.cpp:82
void pbesrewr(const std::string &input_filename, const std::string &output_filename, const utilities::file_format &input_format, const utilities::file_format &output_format, data::rewrite_strategy rewrite_strategy, pbes_rewriter_type rewriter_type)
Definition pbesrewr.h:31
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
void replace_pbes_expressions(T &x, const Substitution &sigma, bool innermost=true, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
Definition replace.h:268
void normalize(T &x, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
The function normalize brings (embedded) pbes expressions into positive normal form,...
Definition normalize.h:177
void pbes_rewrite(T &x, const Rewriter &R, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Rewrites all embedded pbes expressions in an object x.
Definition rewrite.h:156
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
add your file description here.
IO routines for boolean equation systems.
Normalization of pbes expressions.
add your file description here.
Rewriters for pbes expressions.
add your file description here.
add your file description here.
add your file description here.
Traverser class for Parameterised Parity Games (PPG), PBES expressions of the form: PPG :== /_{i: I} ...
A rewriter that simplifies boolean expressions in a term, and rewrites data expressions.
A rewriter that simplifies boolean expressions and quantifiers, and rewrites data expressions.