mCRL2
Loading...
Searching...
No Matches
pfnf_traverser.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/detail/pfnf_traverser.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_DETAIL_PFNF_TRAVERSER_H
13#define MCRL2_PBES_DETAIL_PFNF_TRAVERSER_H
14
15#include "mcrl2/data/rewriter.h"
16#include "mcrl2/pbes/replace.h"
17#include <numeric>
18
19#ifdef MCRL2_PFNF_VISITOR_DEBUG
20#include "mcrl2/data/print.h"
21#endif
22
23namespace mcrl2
24{
25
26namespace pbes_system
27{
28
29namespace detail
30{
31
32/// \brief Represents a quantifier Qv:V. If the bool is true it is a forall, otherwise an exists.
34
36{
38
39 data::variable operator()(const data::variable& v) const
40 {
41 std::map<data::variable, data::variable>::const_iterator i = sigma.find(v);
42 if (i == sigma.end())
43 {
44 return v;
45 }
46 return i->second;
47 }
48
49 data::variable_list operator()(const data::variable_list& variables) const
50 {
51 std::vector<data::variable> result;
52 for (const data::variable& v: variables)
53 {
54 result.push_back((*this)(v));
55 }
56 return data::variable_list(result.begin(),result.end());
57 }
58
59 std::string to_string() const
60 {
61 std::ostringstream out;
62 out << "[";
63 for (std::map<data::variable, data::variable>::const_iterator i = sigma.begin(); i != sigma.end(); ++i)
64 {
65 if (i != sigma.begin())
66 {
67 out << ", ";
68 }
69 out << data::pp(i->first) << " := " << data::pp(i->second);
70 }
71 out << "]";
72 return out.str();
73 }
74};
75
77{
80
82
84 : sigma(sigma_)
85 {}
86
88 {
89 return sigma(v);
90 }
91};
92
93/// \brief Represents the implication g => ( X0(e0) \/ ... \/ Xk(ek) )
95{
98
99 pfnf_traverser_implication(const atermpp::aterm& g_, const std::vector<propositional_variable_instantiation>& rhs_)
100 : g(g_),
101 rhs(rhs_)
102 {}
103
105 : g(x)
106 {}
107
108 // applies a substitution to variables
110 {
111 for (propositional_variable_instantiation& v: rhs)
112 {
113 v = pbes_system::replace_free_variables(v, variable_data_expression_substitution(sigma));
114 }
115 g = pbes_system::replace_free_variables(g, variable_data_expression_substitution(sigma));
116 }
117
118};
119
121{
125
126 pfnf_traverser_expression(const atermpp::aterm& x, const std::vector<pfnf_traverser_quantifier>& quantifiers_, const std::vector<pfnf_traverser_implication>& implications_)
127 : expr(x),
130 {}
131
133 : expr(x)
134 {}
135
136 // applies a substitution to variables
138 {
139 for (pfnf_traverser_quantifier& quantifier: quantifiers)
140 {
141 quantifier.second = sigma(quantifier.second);
142 }
143 for (pfnf_traverser_implication& implication: implications)
144 {
145 implication.substitute(sigma);
146 }
147 expr = pbes_system::replace_free_variables(expr, variable_data_expression_substitution(sigma));
148 }
149};
150
151} // namespace detail
152
153} // namespace pbes_system
154
155} // namespace mcrl2
156
157namespace mcrl2
158{
159
160namespace pbes_system
161{
162
163namespace detail
164{
165
166/// \brief Concatenates two containers
167/// \param x A container
168/// \param y A container
169/// \return The concatenation of x and y
170template <typename Container>
171Container concat(const Container& x, const Container& y)
172{
173 Container result = x;
174 result.insert(result.end(), y.begin(), y.end());
175 return result;
176}
177
178/// \brief Applies the PFNF rewriter to a PBES expression.
180{
182 using super::enter;
183 using super::leave;
184 using super::apply;
185
186 // makes sure there are no name clashes between quantifier variables in left and right
187 // TODO: the efficiency can be increased by maintaining some additional data structures
189 {
190 std::set<data::variable> left_variables;
191 std::set<data::variable> right_variables;
192 std::set<data::variable> name_clashes;
193 for (std::vector<pfnf_traverser_quantifier>::const_iterator i = left.quantifiers.begin(); i != left.quantifiers.end(); ++i)
194 {
195 left_variables.insert(i->second.begin(), i->second.end());
196 }
197 for (std::vector<pfnf_traverser_quantifier>::const_iterator j = right.quantifiers.begin(); j != right.quantifiers.end(); ++j)
198 {
199 for (const data::variable& v: j->second)
200 {
201 right_variables.insert(v);
202 if (left_variables.find(v) != left_variables.end())
203 {
204 name_clashes.insert(v);
205 }
206 }
207 }
208
209#ifdef MCRL2_PFNF_VISITOR_DEBUG
210std::cout << "NAME CLASHES: " << core::detail::print_set(name_clashes) << std::endl;
211#endif
212
213 if (!name_clashes.empty())
214 {
216 for (const data::variable& v: left_variables)
217 {
218 generator.add_identifier(v.name());
219 }
220 for (const data::variable& v: right_variables)
221 {
222 generator.add_identifier(v.name());
223 }
225 for (const data::variable& v: name_clashes)
226 {
227 sigma.sigma[v] = data::variable(generator(std::string(v.name())), v.sort());
228 }
229#ifdef MCRL2_PFNF_VISITOR_DEBUG
230std::cout << "LEFT\n"; print_expression(left);
231std::cout << "RIGHT BEFORE\n"; print_expression(right);
232std::cout << "SIGMA = " << sigma.to_string() << std::endl;
233#endif
234 right.substitute(sigma);
235#ifdef MCRL2_PFNF_VISITOR_DEBUG
236std::cout << "RIGHT AFTER\n"; print_expression(right);
237#endif
238 }
239 }
240
242 {
243 pbes_expression result;
244 data::optimized_and(result, left.expr, right.expr);
245 return result;
246 }
247
249 {
250 pbes_expression result;
251 data::optimized_or(result, left.expr, right.expr);
252 return result;
253 }
254
256 {
257 pbes_expression result;
258 data::optimized_not(result, x.expr);
259 return result;
260 }
261
262 /// \brief A stack containing expressions in PFNF format.
264
265 /// \brief A stack containing quantifier variables.
267
268 /// \brief Returns the top element of the expression stack converted to a pbes expression.
269 /// \return The top element of the expression stack converted to a pbes expression.
271 {
272 assert(!expression_stack.empty());
273 const pfnf_traverser_expression& expr = expression_stack.back();
274 pbes_expression h = expr.expr;
275 pbes_expression result = h;
276 const pbes_expression F = false_();
277 for (const pfnf_traverser_implication& impl: expr.implications)
278 {
279 pbes_expression p;
280 pbes_expression x = std::accumulate(impl.rhs.begin(), impl.rhs.end(), F,
281 [&p](const pbes_expression& arg1, const pbes_expression& arg2) -> const pbes_expression
282 {
283 data::optimized_or(p, arg1, arg2);
284 return p;
285 });
286 data::optimized_imp(p, impl.g, x);
287 data::optimized_and(result, result, p);
288 }
289 for (const pfnf_traverser_quantifier& q: expr.quantifiers)
290 {
291 if (q.first)
292 {
293 result = forall(q.second, result);
294 }
295 else
296 {
297 result = exists(q.second, result);
298 }
299 }
300 return result;
301 }
302
303 /// \brief Prints an expression
304 /// \param expr An expression
306 {
307 const std::vector<pfnf_traverser_quantifier>& q = expr.quantifiers;
308 pbes_expression h = expr.expr;
309 const std::vector<pfnf_traverser_implication>& g = expr.implications;
310 for (const pfnf_traverser_quantifier& i: expr.quantifiers)
311 {
312 std::cout << (i.first ? "forall " : "exists ") << data::pp(i.second) << " ";
313 }
314 std::cout << (q.empty() ? "" : " . ") << pbes_system::pp(h) << "\n";
315 for (const pfnf_traverser_implication& i: g)
316 {
317 std::cout << " /\\ " << pbes_system::pp(i.g) << " => ";
318 if (i.rhs.empty())
319 {
320 std::cout << "true";
321 }
322 else
323 {
324 std::cout << "( ";
325 for (std::vector<propositional_variable_instantiation>::const_iterator j = i.rhs.begin(); j != i.rhs.end(); ++j)
326 {
327 if (j != i.rhs.begin())
328 {
329 std::cout << " \\/ ";
330 }
331 std::cout << pbes_system::pp(*j);
332 }
333 std::cout << " )";
334 std::cout << std::endl;
335 }
336 }
337 std::cout << std::endl;
338 }
339
340 /// \brief Prints the expression stack
341 /// \param msg A string
342 void print(const std::string& msg = "") const
343 {
344 std::cout << "--- " << msg << std::endl;
345 for (const pfnf_traverser_expression& expr: expression_stack)
346 {
347 print_expression(expr);
348 }
349 std::cout << "value = " << pbes_system::pp(evaluate()) << std::endl;
350 }
351
352 void enter(const data::data_expression& x)
353 {
354 expression_stack.push_back(pfnf_traverser_expression(x));
355 }
356
357 void enter(const not_&)
358 {
359 throw std::runtime_error("operation not should not occur");
360 }
361
362 void leave(const and_&)
363 {
364 // join the two expressions on top of the stack
365 pfnf_traverser_expression right = expression_stack.back();
366 expression_stack.pop_back();
367 pfnf_traverser_expression left = expression_stack.back();
368 expression_stack.pop_back();
369 resolve_name_clashes(left, right);
370 std::vector<pfnf_traverser_quantifier> q = concat(left.quantifiers, right.quantifiers);
371 pbes_expression h = make_and(left, right);
372 std::vector<pfnf_traverser_implication> g = concat(left.implications, right.implications);
373//std::cout << "AND RESULT\n"; print_expression(pfnf_traverser_expression(h, q, g));
374 expression_stack.push_back(pfnf_traverser_expression(h, q, g));
375 }
376
377 void leave(const or_&)
378 {
379 // join the two expressions on top of the stack
380 pfnf_traverser_expression right = expression_stack.back();
381 expression_stack.pop_back();
382 pfnf_traverser_expression left = expression_stack.back();
383 expression_stack.pop_back();
384 resolve_name_clashes(left, right);
385
386 std::vector<pfnf_traverser_quantifier> q = concat(left.quantifiers, right.quantifiers);
387
388 pbes_expression h_phi = left.expr;
389 pbes_expression h_psi = right.expr;
390 pbes_expression h = make_or(h_phi, h_psi);
391
392 pbes_expression not_h_phi = make_not(left.expr);
393 pbes_expression not_h_psi = make_not(right.expr);
394
395 const std::vector<pfnf_traverser_implication>& q_phi = left.implications;
396 const std::vector<pfnf_traverser_implication>& q_psi = right.implications;
397
398 std::vector<pfnf_traverser_implication> g;
399
400 // first conjunction
401 for (const pfnf_traverser_implication& i: q_phi)
402 {
403 g.push_back(pfnf_traverser_implication(make_and(not_h_psi, i.g), i.rhs));
404 }
405
406 // second conjunction
407 for (const pfnf_traverser_implication& i: q_psi)
408 {
409 g.push_back(pfnf_traverser_implication(make_and(not_h_phi, i.g), i.rhs));
410 }
411
412 // third conjunction
413 for (const pfnf_traverser_implication& i: q_phi)
414 {
415 for (const pfnf_traverser_implication& k: q_psi)
416 {
417 g.push_back(pfnf_traverser_implication(make_and(i.g, k.g), concat(i.rhs, k.rhs)));
418 }
419 }
420//std::cout << "OR RESULT\n"; print_expression(pfnf_traverser_expression(h, q, g));
421 expression_stack.push_back(pfnf_traverser_expression(h, q, g));
422 }
423
424 void enter(const imp& /*x*/)
425 {
426 throw std::runtime_error("operation imp should not occur");
427 }
428
429 void enter(const forall& x)
430 {
431 quantifier_stack.push_back(x.variables());
432 }
433
434 void leave(const forall&)
435 {
436 // push the quantifier on the expression stack
437 expression_stack.back().quantifiers.push_back(std::make_pair(true, quantifier_stack.back()));
438 quantifier_stack.pop_back();
439 }
440
441 void enter(const exists& x)
442 {
443 quantifier_stack.push_back(x.variables());
444 }
445
446 void leave(const exists&)
447 {
448 // push the quantifier on the expression stack
449 expression_stack.back().quantifiers.push_back(std::make_pair(false, quantifier_stack.back()));
450 quantifier_stack.pop_back();
451 }
452
454 {
455 // push the propositional variable on the expression stack
456 std::vector<pfnf_traverser_quantifier> q;
458 std::vector<pfnf_traverser_implication> g(1, pfnf_traverser_implication(true_(), std::vector<propositional_variable_instantiation>(1, x)));
459 expression_stack.push_back(pfnf_traverser_expression(h, q, g));
460 }
461};
462
463} // namespace detail
464
465} // namespace pbes_system
466
467} // namespace mcrl2
468
469#endif // MCRL2_PBES_DETAIL_PFNF_TRAVERSER_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
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...
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.
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
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
\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.
A rewriter that applies one point rule quantifier elimination to a PBES.
\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.
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
Namespace for system defined sort bool_.
Definition bool.h:32
bool is_or_application(const atermpp::aterm &e)
Recogniser for application of ||.
Definition bool.h:345
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
Namespace for all data library functionality.
Definition data.cpp:22
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
rewrite_strategy
The strategy of the rewriter.
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
atermpp::term_list< variable > variable_list
\brief list of variables
@ 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
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
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
bool is_pfnf_imp(const pbes_expression &x)
Definition is_pfnf.h:86
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_()
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
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
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
data::data_expression operator()(const data::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
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)
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
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.
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const