mCRL2
Loading...
Searching...
No Matches
quantifiers_inside_rewriter.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/rewriters/quantifiers_inside_rewriter.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_DATA_REWRITERS_QUANTIFIERS_INSIDE_REWRITER_H
13#define MCRL2_DATA_REWRITERS_QUANTIFIERS_INSIDE_REWRITER_H
14
15#include <tuple>
16#include "mcrl2/data/builder.h"
17#include "mcrl2/data/join.h"
18#include "mcrl2/data/optimized_boolean_operators.h"
19
20namespace mcrl2 {
21
22namespace data {
23
24namespace detail {
25
27data_expression quantifiers_inside_forall(const std::set<variable>& variables, const data_expression& x);
28data_expression quantifiers_inside_exists(const std::set<variable>& variables, const data_expression& x);
29
30inline
32{
33 return std::set<variable>(x.begin(), x.end());
34}
35
36inline
37variable_list make_variable_list(const std::set<variable>& x)
38{
39 return variable_list(x.begin(), x.end());
40}
41
42template <typename BinaryOperation>
43std::tuple<data_expression, data_expression> compute_Phi_Psi(const std::vector<data_expression>& X, const std::set<variable>& V, BinaryOperation op, data_expression empty_sequence_result)
44{
45 using utilities::detail::set_difference;
46 using utilities::detail::set_intersection;
47
48 std::vector<std::set<data::variable>> vars; // free variables
49 for (const data_expression& x_j: X)
50 {
51 vars.push_back(set_intersection(find_free_variables(x_j), V));
52 }
53 auto j = std::min_element(vars.begin(), vars.end(),
54 [&](const std::set<data::variable>& x, const std::set<data::variable>& y)
55 {
56 return x.size() < y.size();
57 }
58 );
59 const std::set<data::variable>& Z = *j;
60
61 std::vector<data_expression> phi;
62 std::vector<data_expression> psi;
63 for (std::size_t i = 0; i < X.size(); i++)
64 {
65 if (std::includes(Z.begin(), Z.end(), vars[i].begin(), vars[i].end()))
66 {
67 phi.push_back(X[i]);
68 }
69 else
70 {
71 psi.push_back(X[i]);
72 }
73 }
74 data_expression Phi = utilities::detail::join(phi.begin(), phi.end(), op, empty_sequence_result);
75 data_expression Psi = utilities::detail::join(psi.begin(), psi.end(), op, empty_sequence_result);
76 return { Phi, Psi };
77}
78
80{
82 using super::apply;
83
84 template <class T>
85 void apply(T& result, const forall& x)
86 {
87 const data_expression& phi = x.body();
88 std::set<variable> W = make_variable_set(x.variables());
89 apply(result, phi);
90 result = quantifiers_inside_forall(W, result);
91 }
92
93 template <class T>
94 void apply(T& result, const exists& x)
95 {
96 const data_expression& phi = x.body();
97 std::set<variable> W = make_variable_set(x.variables());
98 apply(result, phi);
99 result = quantifiers_inside_exists(W, result);
100 }
101};
102
104{
106 using super::apply;
107
108 const std::set<variable>& V;
109
110 explicit quantifiers_inside_forall_builder(const std::set<variable>& V_)
111 : V(V_)
112 {}
113
115 {
116 return vars.empty() ? body : forall(vars,body);
117 }
118
119 template <class T>
120 void apply(T& result, const forall& x)
121 {
122 using utilities::detail::set_union;
123 std::set<variable> W = make_variable_set(x.variables());
124 result = quantifiers_inside_forall(set_union(V, W), x.body());
125 }
126
127 // default case
128 template <typename T>
130 {
131 using utilities::detail::set_intersection;
132 std::set<variable> W = set_intersection(V, find_free_variables(x));
133 return make_forall_(variable_list(W.begin(), W.end()), x);
134 }
135
136 template <class T>
137 void apply(T& result, const data_expression& x)
138 {
140 {
141 data_expression const& phi = sort_bool::arg(x);
142 result = sort_bool::not_(quantifiers_inside_exists(V, phi));
143 return;
144 }
146 {
149 result = sort_bool::and_(quantifiers_inside_forall(V, phi), quantifiers_inside_forall(V, psi));
150 return;
151 }
153 {
154 using utilities::detail::set_difference;
155 using utilities::detail::set_intersection;
156 typedef core::term_traits<data::data_expression> tr;
157
158 std::vector<data_expression> X;
159 utilities::detail::split(x, std::back_inserter(X), tr::is_or, tr::left, tr::right);
160 const auto [Phi, Psi] = compute_Phi_Psi(X, V, tr::or_, tr::false_());
161 if (sort_bool::is_false_function_symbol(Psi))
162 {
163 result = make_forall_(make_variable_list(set_intersection(V,find_free_variables(x))), x);
164 return;
165 }
166 std::set<variable> vars_Phi = find_free_variables(Phi);
167 std::set<variable> vars_Psi = find_free_variables(Psi);
168 result = make_forall_(make_variable_list(set_intersection(V, set_intersection(vars_Phi, vars_Psi))),
169 lazy::or_(
170 quantifiers_inside_forall(set_difference(set_intersection(V, vars_Phi), vars_Psi), Phi),
171 quantifiers_inside_forall(set_difference(set_intersection(V, vars_Psi), vars_Phi), Psi)
172 )
173 );
174 return;
175 }
177 {
178 const data_expression& left = sort_bool::left(x);
179 const data_expression& right = sort_bool::right(x);
180 result = quantifiers_inside_forall(V, sort_bool::or_(sort_bool::not_(left), right));
181 return;
182 }
183 else
184 {
185 result = apply_default(x);
186 return;
187 }
188 }
189};
190
192{
194 using super::apply;
195
196 const std::set<variable>& V;
197
198 quantifiers_inside_exists_builder(const std::set<variable>& V_)
199 : V(V_)
200 {}
201
203 {
204 return vars.empty() ? body : exists(vars,body);
205 }
206
207 template <class T>
208 void apply(T& result, const exists& x)
209 {
210 using utilities::detail::set_union;
211 std::set<variable> W = make_variable_set(x.variables());
212 result = quantifiers_inside_exists(set_union(V, W), x.body());
213 }
214
215 // default case
216 template <typename T>
218 {
219 using utilities::detail::set_intersection;
220 std::set<variable> W = set_intersection(V, find_free_variables(x));
221 return make_exists_(variable_list(W.begin(), W.end()), x);
222 }
223
224 template <class T>
225 void apply(T& result, const forall& x)
226 {
227 result = apply_default(x);
228 }
229
230 template <class T>
231 void apply(T& result, const data_expression& x)
232 {
234 {
235 data_expression const& phi = sort_bool::arg(x);
236 result = sort_bool::not_(quantifiers_inside_forall(V, phi));
237 return;
238 }
240 {
241 using utilities::detail::set_difference;
242 using utilities::detail::set_intersection;
243 typedef core::term_traits<data::data_expression> tr;
244
245 std::vector<data_expression> X;
246 utilities::detail::split(x, std::back_inserter(X), tr::is_and, tr::left, tr::right);
247 const auto [Phi, Psi] = compute_Phi_Psi(X, V, tr::and_, tr::true_());
248 if (sort_bool::is_true_function_symbol(Psi))
249 {
250 result = make_exists_(make_variable_list(set_intersection(V, find_free_variables(x))), x);
251 return;
252 }
253 std::set<variable> vars_Phi = find_free_variables(Phi);
254 std::set<variable> vars_Psi = find_free_variables(Psi);
255 result = make_exists_(make_variable_list(set_intersection(V, set_intersection(vars_Phi, vars_Psi))),
256 lazy::and_(
257 quantifiers_inside_exists(set_difference(set_intersection(V, vars_Phi), vars_Psi), Phi),
258 quantifiers_inside_exists(set_difference(set_intersection(V, vars_Psi), vars_Phi), Psi)
259 )
260 );
261 return;
262 }
264 {
267 result = sort_bool::or_(quantifiers_inside_exists(V, phi), quantifiers_inside_exists(V, psi));
268 return;
269 }
271 {
272 const data_expression& left = sort_bool::left(x);
273 const data_expression& right = sort_bool::right(x);
274 result = quantifiers_inside_exists(V, sort_bool::or_(sort_bool::not_(left), right));
275 return;
276 }
277 result = apply_default(x);
278 return;
279 }
280};
281
282inline
284{
286 data_expression result;
287 f.apply(result, x);
288 return result;
289}
290
291inline
292data_expression quantifiers_inside_forall(const std::set<variable>& variables, const data_expression& x)
293{
295 data_expression result;
296 f.apply(result, x);
297 return result;
298}
299
300inline
301data_expression quantifiers_inside_exists(const std::set<variable>& variables, const data_expression& x)
302{
304 data_expression result;
305 f.apply(result, x);
306 return result;
307}
308
309} // namespace detail
310
312{
313 using argument_type = data_expression;
314 using result_type = data_expression;
315
317 {
319 }
320};
321
322template <typename T>
323void quantifiers_inside_rewrite(T& x, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value>::type* = 0)
324{
325 core::make_update_apply_builder<data_expression_builder>(quantifiers_inside_rewriter()).update(x);
326}
327
328template <typename T>
329T quantifiers_inside_rewrite(const T& x, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value>::type* = 0)
330{
331 T result;
332 core::make_update_apply_builder<data_expression_builder>(quantifiers_inside_rewriter()).apply(result, x);
333 return result;
334}
335
336} // namespace data
337
338} // namespace mcrl2
339
340#endif // MCRL2_DATA_REWRITERS_QUANTIFIERS_INSIDE_REWRITER_H
bool operator<(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
Definition aterm_core.h:104
bool operator==(const unprotected_aterm_core &t) const
Comparison operator.
Definition aterm_core.h:83
bool operator!=(const unprotected_aterm_core &t) const
Inequality operator on two unprotected aterms.
Definition aterm_core.h:92
const data_expression & body() const
Definition abstraction.h:68
data_expression(const data_expression &) noexcept=default
Move semantics.
Base class for storing properties of mCRL2 types. Properties are (key, value) pairs stored as strings...
existential quantification.
Definition exists.h:26
universal quantification.
Definition forall.h:26
Rewriter that operates on data expressions.
Definition rewriter.h:81
basic_rewriter< data_expression >::substitution_type substitution_type
Definition rewriter.h:114
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
\brief A data variable
Definition variable.h:28
variable(const variable &) noexcept=default
Move semantics.
const sort_expression & sort() const
Definition variable.h:43
logger(const log_level_t l)
Default constructor.
Definition logger.h:164
\brief The and operator for pbes expressions
and_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & left() const
const pbes_expression & right() const
A rewriter that rewrites universal quantifiers over conjuncts in BQNF expressions to conjuncts over u...
term_type operator()(const term_type &x, SubstitutionFunction sigma) const
Rewrites a pbes expression.
std::unique_ptr< pbes_system::detail::bqnf_quantifier_rewriter > bqnf_quantifier_rewriter
std::unique_ptr< pbes_system::detail::bqnf_visitor > bqnf_checker
pbes_equation equation_type
The equation type.
pbes_expression term_type
The term type.
term_type operator()(const term_type &t) const
Rewrites a PBES expression in BQNF such that universal quantifier over conjuncts are replaced by conj...
Stores the following properties of a linear process specification:
data::detail::data_property_map< pbes_property_map > super
std::string compare(const pbes_property_map &other) const
pbes_property_map(const pbes &p)
Constructor Initializes the pbes_property_map with a linear process specification.
std::string print(const propositional_variable &v) const
std::pair< std::size_t, std::size_t > compute_equation_counts(const pbes &p) const
Computes the number of mu and nu equations and returns them as a pair.
std::size_t compute_block_nesting_depth(const pbes &p) const
pbes_expression make_expr(const pbes_expression &expr) const
Definition constelm.h:74
bool operator<(const quantified_variable &other) const
Definition constelm.h:69
quantified_variable(bool is_forall, const data::variable &var)
Definition constelm.h:44
bool operator==(const quantified_variable &other) const
Definition constelm.h:59
bool operator!=(const quantified_variable &other) const
Definition constelm.h:64
\brief The existential quantification operator for pbes expressions
exists(const atermpp::aterm &term)
exists(const data::variable_list &variables, const pbes_expression &body)
\brief Constructor Z14.
const data::variable_list & variables() const
exists(const exists &) noexcept=default
Move semantics.
const pbes_expression & body() const
\brief The universal quantification operator for pbes expressions
const pbes_expression & body() const
forall(const data::variable_list &variables, const pbes_expression &body)
\brief Constructor Z14.
forall(const atermpp::aterm &term)
const data::variable_list & variables() const
forall(const forall &) noexcept=default
Move semantics.
\brief The implication operator for pbes expressions
const pbes_expression & left() const
imp(const atermpp::aterm &term)
imp(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & right() const
\brief The not operator for pbes expressions
not_(const pbes_expression &operand)
\brief Constructor Z14.
const pbes_expression & operand() const
A rewriter that applies one point rule quantifier elimination to a PBES.
pbes_expression operator()(const pbes_expression &x) const
Rewrites a pbes expression.
\brief The or operator for pbes expressions
const pbes_expression & left() const
or_(const pbes_expression &left, const pbes_expression &right)
\brief Constructor Z14.
const pbes_expression & right() const
or_(const atermpp::aterm &term)
Represents an edge of the dependency graph. The assignments are stored implicitly using the 'right' p...
Definition constelm.h:419
edge(const propositional_variable &src, const qvar_list &qvars, const propositional_variable_instantiation &tgt, const std::set< data::variable > &conj_context, const std::set< data::variable > &disj_context, data::data_expression c=data::sort_bool::true_())
Constructor.
Definition constelm.h:441
const propositional_variable_instantiation & target() const
The propositional variable instantiation that determines the target of the edge.
Definition constelm.h:494
qvar_list quantifier_inside_approximation(const vertex &source, const DataRewriter &rewr) const
Try to guess which quantifiers of Q can end up directly before target, when the quantifier inside rew...
Definition constelm.h:507
const propositional_variable_instantiation m_target
The propositional variable instantiation that determines the target of the edge.
Definition constelm.h:428
const qvar_list & quantified_variables() const
Definition constelm.h:488
const qvar_list m_qvars
The quantifiers in whose direct context the target PVI occurs.
Definition constelm.h:425
const propositional_variable m_source
The propositional variable at the source of the edge.
Definition constelm.h:422
const std::set< data::variable > m_disj_context
Definition constelm.h:431
const data::data_expression & condition() const
The condition of the edge.
Definition constelm.h:500
const std::set< data::variable > m_conj_context
Definition constelm.h:430
const propositional_variable & source() const
The propositional variable at the source of the edge.
Definition constelm.h:483
std::string to_string() const
Returns a string representation of the edge.
Definition constelm.h:459
Represents a vertex of the dependency graph.
Definition constelm.h:552
void fix_constraints(std::vector< data::data_expression > deleted_constraints)
Weaken the constraints so they satisfy.
Definition constelm.h:589
qvar_list m_qvars
The list of quantified variables that occur in the constraints.
Definition constelm.h:558
std::string to_string() const
Returns a string representation of the vertex.
Definition constelm.h:670
bool update(const qvar_list &qvars, const data::data_expression_list &e, const constraint_map &e_constraints, const DataRewriter &datar)
Assign new values to the parameters of this vertex, and update the constraints accordingly....
Definition constelm.h:687
constraint_map m_constraints
Maps data variables to data expressions. If a parameter is not.
Definition constelm.h:562
bool m_visited
Indicates whether this vertex has been visited at least once.
Definition constelm.h:565
const constraint_map & constraints() const
Maps data variables to data expressions. If the right hand side is a data variable,...
Definition constelm.h:646
bool is_constant(const data::variable &v) const
Returns true if the parameter v has been assigned a constant expression.
Definition constelm.h:570
propositional_variable m_variable
The propositional variable that corresponds to the vertex.
Definition constelm.h:555
std::vector< std::size_t > constant_parameter_indices() const
Returns the indices of the constant parameters of this vertex.
Definition constelm.h:653
const propositional_variable & variable() const
The propositional variable that corresponds to the vertex.
Definition constelm.h:634
bool bound_in_quantifiers(const qvar_list &qvars, const data::data_expression &e)
Returns true iff all free variables in e are bound in qvars.
Definition constelm.h:577
vertex(propositional_variable x)
Constructor.
Definition constelm.h:629
Algorithm class for the constelm algorithm.
Definition constelm.h:395
const PbesRewriter & m_pbes_rewriter
Compares data expressions for equality.
Definition constelm.h:405
std::string print_todo_list(const std::deque< propositional_variable > &todo)
Definition constelm.h:796
vertex_map m_vertices
The vertices of the dependency graph. They are stored in a map, to support searching for a vertex.
Definition constelm.h:762
std::string print_edge_update(const edge &e, const vertex &u, const vertex &v)
Definition constelm.h:812
std::map< propositional_variable, std::vector< data::variable > > redundant_parameters() const
Returns the parameters that have been removed by the constelm algorithm.
Definition constelm.h:858
std::string print_edges()
Logs the edges of the dependency graph.
Definition constelm.h:783
pbes_constelm_algorithm(const DataRewriter &datar, const PbesRewriter &pbesr)
Constructor.
Definition constelm.h:852
std::map< core::identifier_string, std::vector< edge > > edge_map
The storage type for edges.
Definition constelm.h:758
std::map< core::identifier_string, std::vector< std::size_t > > m_redundant_parameters
The redundant parameters.
Definition constelm.h:769
std::list< E > concat(const std::list< E > a, const std::list< E > b)
Definition constelm.h:840
std::string print_evaluation_failure(const edge &e, const vertex &u)
Definition constelm.h:830
std::map< core::identifier_string, vertex > vertex_map
The storage type for vertices.
Definition constelm.h:755
std::list< detail::quantified_variable > qvar_list
Definition constelm.h:399
std::map< data::variable, data::data_expression > constraint_map
A map with constraints on the vertices of the graph.
Definition constelm.h:398
const DataRewriter & m_data_rewriter
Compares data expressions for equality.
Definition constelm.h:402
void run(pbes &p, bool compute_conditions=false, bool check_quantifiers=true)
Runs the constelm algorithm.
Definition constelm.h:879
edge_map m_edges
The edges of the dependency graph. They are stored in a map, to easily access all out-edges correspon...
Definition constelm.h:766
std::string print_condition(const edge &e, const vertex &u, const pbes_expression &value)
Definition constelm.h:821
std::string print_vertices() const
Logs the vertices of the dependency graph.
Definition constelm.h:772
pbes_expression & operator=(pbes_expression &&) noexcept=default
pbes_expression & operator=(const pbes_expression &) noexcept=default
pbes_expression(const atermpp::aterm &term)
pbes_expression(const pbes_expression &) noexcept=default
Move semantics.
pbes_expression()
\brief Default constructor X3.
parameterized boolean equation system
Definition pbes.h:58
bool is_closed() const
True if the pbes is closed.
Definition pbes.h:245
propositional_variable_instantiation & initial_state()
Returns the initial state.
Definition pbes.h:199
bool is_well_typed() const
Checks if the PBES is well typed.
Definition pbes.h:267
A rewriter that brings PBES expressions into PFNF normal form.
pbes_expression term_type
The term type.
data::variable variable_type
The variable type.
pbes_expression operator()(const pbes_expression &x, SubstitutionFunction sigma) const
Rewrites a pbes expression.
pbes_expression operator()(const pbes_expression &x) const
Rewrites a pbes expression.
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
propositional_variable_instantiation(const propositional_variable_instantiation &) noexcept=default
Move semantics.
\brief A propositional variable declaration
propositional_variable(const propositional_variable &) noexcept=default
Move semantics.
const core::identifier_string & name() const
A rewriter that pushes quantifiers inside in a PBES expression.
pbes_expression operator()(const pbes_expression &x) const
Rewrites a pbes expression.
Standard exception class for reporting runtime errors.
Definition exception.h:27
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
The main namespace for the aterm++ library.
Definition algorithm.h:21
data_expression quantifiers_inside_forall(const std::set< variable > &variables, const data_expression &x)
data_expression quantifiers_inside_exists(const std::set< variable > &variables, const data_expression &x)
variable_list make_variable_list(const std::set< variable > &x)
std::set< variable > make_variable_set(const variable_list &x)
data_expression quantifiers_inside(const data_expression &x)
std::tuple< data_expression, data_expression > compute_Phi_Psi(const std::vector< data_expression > &X, const std::set< variable > &V, BinaryOperation op, data_expression empty_sequence_result)
Namespace for system defined sort bool_.
Definition bool.h:32
const data_expression & arg(const data_expression &e)
Function for projecting out argument. arg from an application.
Definition bool.h:469
bool is_or_application(const atermpp::aterm &e)
Recogniser for application of ||.
Definition bool.h:345
const data_expression & right(const data_expression &e)
Function for projecting out argument. right from an application.
Definition bool.h:493
bool is_implies_application(const atermpp::aterm &e)
Recogniser for application of =>.
Definition bool.h:409
bool is_and_application(const atermpp::aterm &e)
Recogniser for application of &&.
Definition bool.h:281
bool is_not_application(const atermpp::aterm &e)
Recogniser for application of !.
Definition bool.h:217
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:77
const data_expression & left(const data_expression &e)
Function for projecting out argument. left from an application.
Definition bool.h:481
Namespace for all data library functionality.
Definition data.cpp:22
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
data_expression not_(const data_expression &x)
rewrite_strategy
The strategy of the rewriter.
T quantifiers_inside_rewrite(const T &x, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value >::type *=0)
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
atermpp::term_list< variable > variable_list
\brief list of variables
void quantifiers_inside_rewrite(T &x, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
@ verbose
Definition logger.h:37
bool mCRL2logEnabled(const log_level_t level)
Definition logger.h:383
The namespace for accessor functions on pbes expressions.
const pbes_expression & arg(const pbes_expression &t)
Returns the pbes expression argument of expressions of type not, exists and forall.
const pbes_expression & left(const pbes_expression &t)
Returns the left hand side of an expression of type and, or or imp.
const pbes_expression & right(const pbes_expression &t)
Returns the right hand side of an expression of type and, or or imp.
std::vector< pbes_expression > pfnf_implications(const pbes_expression &x)
Definition is_pfnf.h:218
bool is_pfnf_simple_expression(const pbes_expression &x)
Definition is_pfnf.h:51
void make_constelm_substitution(const std::map< data::variable, data::data_expression > &m, data::rewriter::substitution_type &result)
Definition constelm.h:29
Container concat(const Container &x, const Container &y)
Concatenates two containers.
bool is_pfnf_or_expression(const pbes_expression &x)
Definition is_pfnf.h:63
std::pair< bool, data::variable_list > pfnf_traverser_quantifier
Represents a quantifier Qv:V. If the bool is true it is a forall, otherwise an exists.
void split_and(const pbes_expression &expr, std::vector< pbes_expression > &result)
Splits a conjunction into a sequence of operands Given a pbes expression of the form p1 && p2 && ....
Definition is_pfnf.h:31
pbes to_ppg(pbes x)
Rewrites a PBES to a PPG.
rewrite_pbes_expressions_with_substitution_builder< Builder, Rewriter, Substitution > make_rewrite_pbes_expressions_with_substitution_builder(const Rewriter &R, Substitution &sigma)
Definition rewrite.h:84
bool is_pfnf_or(const pbes_expression &x)
Definition is_pfnf.h:79
bool is_pfnf_inner_and(const pbes_expression &x)
Definition is_pfnf.h:106
bool is_pfnf_data_expression(const pbes_expression &x)
Definition is_pfnf.h:57
pbes_expression quantifiers_inside_forall(const std::set< data::variable > &variables, const pbes_expression &x)
void split_or(const pbes_expression &expr, std::vector< pbes_expression > &result)
Splits a conjunction into a sequence of operands Given a pbes expression of the form p1 || p2 || ....
Definition is_pfnf.h:44
bool is_bqnf(const T &x)
Determines if an expression is a BQNF expression.
void split_pfnf_expression(const pbes_expression &phi, pbes_expression &h, std::vector< pbes_expression > &g)
Definition is_pfnf.h:233
pbes_expression quantifiers_inside_exists(const std::set< data::variable > &variables, const pbes_expression &x)
rewrite_pbes_expressions_builder< Builder, Rewriter > make_rewrite_pbes_expressions_builder(const Rewriter &R)
Definition rewrite.h:56
bool is_pfnf(const T &x)
Definition is_pfnf.h:188
std::tuple< pbes_expression, pbes_expression > compute_Phi_Psi(const std::vector< pbes_expression > &X, const std::set< data::variable > &V, BinaryOperation op, pbes_expression empty_sequence_result)
bool is_pfnf_imp(const pbes_expression &x)
Definition is_pfnf.h:86
pbes_expression quantifiers_inside(const pbes_expression &x)
pbes_expression remove_quantifiers(const pbes_expression &x)
Definition is_pfnf.h:196
bool is_pfnf_outer_and(const pbes_expression &x)
Definition is_pfnf.h:121
bool is_pfnf_expression(const pbes_expression &x)
Definition is_pfnf.h:152
The main namespace for the PBES library.
bool is_data(const pbes_expression &t)
Returns true if the term t is a data expression.
pbes_rewriter_type
An enumerated type for the available pbes rewriters.
const pbes_expression & true_()
bool is_not(const atermpp::aterm &x)
void rewrite(T &x, Rewriter R, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Definition rewrite.h:97
std::string pfnf_pp(const T &x)
Returns a PFNF string representation of the object x.
Definition pfnf_print.h:147
bool is_exists(const atermpp::aterm &x)
bool is_or(const atermpp::aterm &x)
T rewrite(const T &x, Rewriter R, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Definition rewrite.h:110
void pbesinfo(const std::string &input_filename, const std::string &input_file_message, const utilities::file_format &file_format, bool opt_full)
Definition pbesinfo.h:22
std::map< data::variable, std::set< data::data_expression > > find_equalities(const pbes_expression &x)
void pbespp(const std::string &input_filename, const std::string &output_filename, const utilities::file_format &input_format, core::print_format_type format, bool use_pfnf_printer)
Definition pbespp.h:22
bool is_forall(const atermpp::aterm &x)
T pbes_rewrite(const T &x, const Rewriter &R, Substitution sigma, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value >::type *=0)
Rewrites all embedded pbes expressions in an object x, and applies a substitution to variables on the...
Definition rewrite.h:199
void constelm(pbes &p, data::rewrite_strategy rewrite_strategy, pbes_rewriter_type rewriter_type, bool compute_conditions=false, bool remove_redundant_equations=true, bool check_quantifiers=true)
Apply the constelm algorithm.
Definition constelm.h:1029
atermpp::aterm pbes_to_aterm(const pbes &p)
Conversion to atermappl.
Definition io.cpp:328
void rewrite(T &x, Rewriter R, const Substitution &sigma, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Definition rewrite.h:125
bool is_false(const pbes_expression &t)
Test for the value false.
T rewrite(const T &x, Rewriter R, const Substitution &sigma, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
Definition rewrite.h:140
void pbes_rewrite(T &x, const Rewriter &R, Substitution sigma, typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value >::type *=0)
Rewrites all embedded pbes expressions in an object x, and applies a substitution to variables on the...
Definition rewrite.h:184
void pbesconstelm(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, bool compute_conditions, bool remove_redundant_equations, bool check_quantifiers)
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
std::map< data::variable, std::set< data::data_expression > > find_inequalities(const pbes_expression &x)
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
bool is_and(const atermpp::aterm &x)
bool is_imp(const atermpp::aterm &x)
T pbes_rewrite(const T &x, const Rewriter &R, typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value >::type *=0)
Rewrites all embedded pbes expressions in an object x.
Definition rewrite.h:169
bool is_true(const pbes_expression &t)
Test for the value true.
const pbes_expression & false_()
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void swap(atermpp::aterm &t1, atermpp::aterm &t2) noexcept
Swaps two term_applss.
Definition aterm.h:475
Contains type information for terms.
Definition term_traits.h:24
data::data_expression operator()(const data::data_expression &x) const
data_expression_builder< quantifiers_inside_builder > super
data_expression make_exists_(const variable_list &vars, const data_expression &body)
data_expression_builder< quantifiers_inside_exists_builder > super
static data_expression make_forall_(const variable_list &vars, const data_expression &body)
data_expression_builder< quantifiers_inside_forall_builder > super
An empty struct that is used to denote the absence of a substitution. Used for rewriters.
data_expression operator()(const data_expression &x) const
data_expression operator()(const data_expression &x) const
A quantified predicate variable instantiation.
Definition constelm.h:89
std::list< quantified_variable > Q
Definition constelm.h:90
propositional_variable_instantiation X_e
Definition constelm.h:91
bool operator<(const QPVI &other) const
Definition constelm.h:93
virtual pbes_expression filter_guard(const pbes_expression &g, const pbes_expression &phi_i, const data::variable_list &d)
Filters a 'guard' g with respect to a set of variables d and an expression phi_i such that parts of g...
virtual pbes_expression rewrite_bqnf_expression(const pbes_expression &e)
Rewrites a BQNF expression. Replaces universal quantifier over conjuncts with conjuncts over universa...
virtual pbes_expression rewrite_bounded_forall(const pbes_expression &e)
Rewrites a bounded universal quantifier expression. If the subexpression is a conjunction,...
virtual pbes_expression rewrite_and(const pbes_expression &e)
Rewrites a conjunctive expression. rewrite_imp(/_i phi_i) = /_i rewrite_bqnf_expression(phi_i).
virtual pbes_expression rewrite_imp(const pbes_expression &e)
Rewrites an implication: rewrite_imp(phi => psi) = rewrite_bqnf_expression(phi) => rewrite_bqnf_expre...
virtual pbes_expression rewrite_bounded_exists(const pbes_expression &e)
Rewrites a bounded existential quantifier expression. rewrite_bounded_exists(exists v ....
virtual pbes_expression filter(const pbes_expression &e, const std::set< data::variable > &d)
Filters the expression e such that subexpressions that are data expression that do not refer to varia...
virtual pbes_expression rewrite_or(const pbes_expression &e)
Rewrites a disjunctive expression. rewrite_imp(\/_i phi_i) = \/_i rewrite_bqnf_expression(phi_i).
A visitor class for PBES equations in BQNF. There is a visit_<node> function for each type of node....
pbes_expression_traverser< edge_condition_traverser > super
Definition constelm.h:132
void leave(const propositional_variable_instantiation &x)
Definition constelm.h:358
std::list< detail::quantified_variable > qvar_list
Definition constelm.h:139
void merge_conditions(stack_elem &ec1, bool negate1, stack_elem &ec2, bool negate2, stack_elem &ec, bool is_conjunctive)
Definition constelm.h:167
std::list< pbes_expression > quantified_context
Definition constelm.h:142
void leave(const data::data_expression &x)
Definition constelm.h:222
std::set< data::variable > disjunctive_context_FV
The set of free variables that occur on the other side of the conjunctions this PVI occurs in....
Definition constelm.h:111
std::set< data::variable > conjunctive_context_FV
The set of free variables that occur on the other side of the conjunctions this PVI occurs in....
Definition constelm.h:107
std::set< data::data_expression > conditions
Contains expressions that characterise when an edge is enabled. The conjunction of these expressions ...
Definition constelm.h:103
std::multimap< QPVI, edge_details > edge_map
Definition constelm.h:116
edge_traverser_stack_elem(const data::data_expression &cond_pos, const data::data_expression &cond_neg, std::set< data::variable > &&free_vars)
Definition constelm.h:123
pbes_system::detail::find_equalities_traverser< pbes_system::data_expression_traverser, find_equalities_traverser_inst > super
data::detail::find_equalities_traverser< Traverser, Derived > super
void apply(const propositional_variable_instantiation &)
void apply(const pbes_expression &x)
Definition is_pfnf.h:181
pbes_expression_traverser< is_pfnf_traverser > super
Definition is_pfnf.h:170
std::string abstraction_operator(const Abstraction &x) const
Definition pfnf_print.h:43
pbes_expression abstraction_body(const Abstraction &x) const
Definition pfnf_print.h:61
bool is_abstraction(const pbes_system::pbes_expression &x)
Definition pfnf_print.h:37
void print_pbes_abstraction(const Abstraction &x)
Definition pfnf_print.h:97
void apply(const pbes_system::pbes_expression &x)
Definition pfnf_print.h:117
pbes_system::detail::printer< Derived > super
Definition pfnf_print.h:27
data::variable_list abstraction_variables(const Abstraction &x) const
Definition pfnf_print.h:79
std::vector< pfnf_traverser_implication > implications
std::vector< pfnf_traverser_quantifier > quantifiers
void substitute(const variable_variable_substitution &sigma)
pfnf_traverser_expression(const atermpp::aterm &x, const std::vector< pfnf_traverser_quantifier > &quantifiers_, const std::vector< pfnf_traverser_implication > &implications_)
Represents the implication g => ( X0(e0) \/ ... \/ Xk(ek) )
void substitute(const variable_variable_substitution &sigma)
pfnf_traverser_implication(const atermpp::aterm &g_, const std::vector< propositional_variable_instantiation > &rhs_)
std::vector< propositional_variable_instantiation > rhs
Applies the PFNF rewriter to a PBES expression.
void enter(const propositional_variable_instantiation &x)
void enter(const data::data_expression &x)
pbes_expression make_and(const pfnf_traverser_expression &left, const pfnf_traverser_expression &right) const
void print_expression(const pfnf_traverser_expression &expr) const
Prints an expression.
pbes_expression evaluate() const
Returns the top element of the expression stack converted to a pbes expression.
std::vector< data::variable_list > quantifier_stack
A stack containing quantifier variables.
pbes_expression_traverser< pfnf_traverser > super
pbes_expression make_or(const pfnf_traverser_expression &left, const pfnf_traverser_expression &right) const
std::vector< pfnf_traverser_expression > expression_stack
A stack containing expressions in PFNF format.
pbes_expression make_not(const pfnf_traverser_expression &x) const
void resolve_name_clashes(pfnf_traverser_expression &left, pfnf_traverser_expression &right)
pbes_expression_builder< quantifiers_inside_builder > super
static pbes_expression make_exists_(const data::variable_list &vars, const pbes_expression &body)
void apply(T &result, const propositional_variable_instantiation &x)
pbes_expression_builder< quantifiers_inside_exists_builder > super
static pbes_expression make_forall_(const data::variable_list &vars, const pbes_expression &body)
void apply(T &result, const propositional_variable_instantiation &x)
data_expression_builder< quantifiers_inside_forall_builder > super
void apply(T &result, const pbes_expression &x)
Definition rewrite.h:39
Builder< rewrite_pbes_expressions_builder< Builder, Rewriter > > super
Definition rewrite.h:28
Builder< rewrite_pbes_expressions_with_substitution_builder< Builder, Rewriter, Substitution > > super
Definition rewrite.h:64
rewrite_pbes_expressions_with_substitution_builder(const Rewriter &R_, Substitution &sigma_)
Definition rewrite.h:70
simplify_quantifiers_data_rewriter_builder(const DataRewriter &R, SubstitutionFunction &sigma)
add_data_rewriter< pbes_system::detail::simplify_quantifiers_builder, Derived, DataRewriter, SubstitutionFunction > super
data::data_expression operator()(const data::variable &v) const
variable_data_expression_substitution(const variable_variable_substitution &sigma_)
data::variable operator()(const data::variable &v) const
std::map< data::variable, data::variable > sigma
data::variable_list operator()(const data::variable_list &variables) const
enumerate_quantifiers_rewriter(const data::rewriter &R, const data::data_specification &dataspec, bool enumerate_infinite_sorts=true)
Prints the object x to a stream.
Definition pfnf_print.h:136
void operator()(const T &x, std::ostream &out)
Definition pfnf_print.h:138
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.
pbes_expression operator()(const pbes_expression &x, SubstitutionFunction &sigma) const
pbes_expression operator()(const pbes_expression &x) const
A rewriter that simplifies boolean expressions and quantifiers.
pbes_expression operator()(const pbes_expression &x) const
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const