mCRL2
Loading...
Searching...
No Matches
simplify_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/simplify_rewriter.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_REWRITERS_SIMPLIFY_REWRITER_H
13#define MCRL2_PBES_REWRITERS_SIMPLIFY_REWRITER_H
14
15#include "mcrl2/data/detail/enumerator_identifier_generator.h"
16#include "mcrl2/data/replace_capture_avoiding_with_an_identifier_generator.h"
17#include "mcrl2/data/optimized_boolean_operators.h"
18#include "mcrl2/pbes/pbes_expression.h"
19#include "mcrl2/pbes/replace.h"
20#include "mcrl2/pbes/rewriters/data_rewriter.h"
21#include "mcrl2/pbes/substitutions.h"
22
23namespace mcrl2::pbes_system {
24
25namespace detail {
26
27template <template <class> class Builder, class Derived>
28struct add_simplify: public Builder<Derived>
29{
30 using super = Builder<Derived>;
31 using super::apply;
32
33 template <class T>
34 void apply(T& result, const not_& x)
35 {
36 assert(&result!=&x); // Result is used as temporary store and cannot match x.
37 apply(result, x.operand());
38 if (is_false(result))
39 {
40 result = true_();
41 return;
42 }
43 if (is_true(result))
44 {
45 result = false_();
46 return;
47 }
48 if (is_not(result))
49 {
50 result = atermpp::down_cast<not_>(result).operand();
51 return;
52 }
53 make_not(result, result);
54 }
55
56 template <class T>
57 void apply(T& result, const and_& x)
58 {
59 assert(&result!=&x); // Result is used as temporary store and cannot match x.
60 apply(result, x.left());
61 if (is_false(result))
62 {
63 result = false_();
64 return;
65 }
66 if (is_true(result))
67 {
68 apply(result, x.right());
69 return;
70 }
71 pbes_expression right;
72 apply(right, x.right());
73 if (is_false(right))
74 {
75 result = false_();
76 return;
77 }
78 if (is_true(right) || result==right)
79 {
80 return;
81 }
83 {
84 data::sort_bool::make_and(atermpp::assign_cast<data::data_expression>(result),
85 atermpp::down_cast<data::data_expression>(result),
86 atermpp::down_cast<data::data_expression>(right));
87 return;
88 }
89 make_and(result, result, right);
90 }
91
92 template <class T>
93 void apply(T& result, const or_& x)
94 {
95 assert(&result!=&x); // Result is used as temporary store and cannot match x.
96 apply(result, x.left());
97 if (is_true(result))
98 {
99 result = true_();
100 return;
101 }
102 if (is_false(result))
103 {
104 apply(result, x.right());
105 return;
106 }
107 pbes_expression right;
108 apply(right, x.right());
109 if (is_true(right))
110 {
111 result = true_();
112 return;
113 }
114 if (is_false(right) || result==right)
115 {
116 return;
117 }
119 {
120 data::sort_bool::make_or(atermpp::assign_cast<data::data_expression>(result),
121 atermpp::down_cast<data::data_expression>(result),
122 atermpp::down_cast<data::data_expression>(right));
123 return;
124 }
125 make_or(result, result, right);
126 }
127
128 template <class T>
129 void apply(T& result, const imp& x)
130 {
131 assert(&result!=&x); // Result is used as temporary store and cannot match x.
132 if (is_false(x.left())) // This test is cheap.
133 {
134 result = true_();
135 return;
136 }
137 apply(result, x.right());
138 if (is_true(result))
139 {
140 result = true_();
141 return;
142 }
143 if (is_false(result))
144 {
145 apply(result, x.left());
146 if (is_not(result))
147 {
148 result = atermpp::down_cast<not_>(result).operand();
149 return;
150 }
151 if (is_true(result))
152 {
153 result = false_();
154 return;
155 }
156 if (is_false(result))
157 {
158 result = true_();
159 return;
160 }
161 make_not(result, result);
162 return;
163 }
164 pbes_expression left;
165 apply(left, x.left());
166 if (is_true(left))
167 {
168 return;
169 }
170 if (is_false(left) || result==left)
171 {
172 result = true_();
173 return;
174 }
175 make_imp(result, left, result);
176 }
177
178 template <class T>
179 void apply(T& result, const forall& x)
180 {
181 apply(result, x.body());
183 }
184
185 template <class T>
186 void apply(T& result, const exists& x)
187 {
188 apply(result, x.body());
190 }
191};
192
193template <typename Derived>
195{ };
196
197template <typename Derived, typename DataRewriter, typename MutableSubstitution, typename PbesSubstitution>
199{
201 using super::enter;
202 using super::leave;
203 using super::apply;
204
205 using substitution_administration_type = data::detail::substitution_updater_with_an_identifier_generator<MutableSubstitution,
207 substitution_administration_type substitution_administration;
208 const PbesSubstitution& m_sigma_pbes;
209
210 simplify_data_rewriter_builder(const DataRewriter& R, MutableSubstitution& sigma)
211 : super(R, sigma),
212 substitution_administration(sigma, const_cast<data::enumerator_identifier_generator&>(R.identifier_generator()))
213 {}
214
215 simplify_data_rewriter_builder(const DataRewriter& R, MutableSubstitution& sigma, const PbesSubstitution& sigma_pbes)
216 : super(R, sigma),
217 substitution_administration(sigma, const_cast<data::enumerator_identifier_generator&>(R.identifier_generator())),
218 m_sigma_pbes(sigma_pbes)
219 {}
220
221 MutableSubstitution& substitution()
222 {
223 return substitution_administration.substitution();
224 }
225
226
227 template<class T, typename SubstitutionType>
228 void apply_substitution(T& result, const propositional_variable_instantiation& x, const SubstitutionType& sigma)
229 {
230 result = sigma(x);
231 }
232
233 /// Overload to have a trivial function in case the substitution is no_substitution.
234 template<class T>
236 {
237 return;
238 }
239
240 template<class T>
242 {
243 super::apply(result, x);
244 apply_substitution(result, atermpp::down_cast<propositional_variable_instantiation>(result), m_sigma_pbes);
245 }
246
247 template <class T>
248 void apply(T& result, const forall& x)
249 {
250 const data::variable_list vl = substitution_administration.push(x.variables());
251 super::apply(result, x.body());
252 pbes_system::make_optimized_forall(result, vl, result, true);
253 substitution_administration.pop(vl);
254 }
255
256 template <class T>
257 void apply(T& result, const exists& x)
258 {
259 const data::variable_list vl = substitution_administration.push(x.variables());
260 super::apply(result, x.body());
261 pbes_system::make_optimized_exists(result, vl, result, true);
262 substitution_administration.pop(vl);
263 }
264
265};
266
267template<template<class, class, class, class> class Builder,
268 class DataRewriter,
269 class MutableSubstitution,
270 class PbesSubstitution = no_substitution>
272 : public Builder<
277{
278 using super = Builder<
283 using super::enter;
284 using super::leave;
285
286 apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter& R, MutableSubstitution& sigma, const PbesSubstitution& sigma_pbes)
288 {}
289
291 MutableSubstitution& sigma)
293 {}
294};
295
296template<template<class, class, class, class> class Builder,
297 class DataRewriter,
298 class MutableSubstitution,
299 class PbesSubstitution>
304{
305 return apply_data_rewriter_with_pbes_substitution_builder<Builder, DataRewriter, MutableSubstitution, PbesSubstitution>(R,
306 sigma,
307 sigma_pbes);
308}
309
310template<template<class, class, class, class> class Builder,
311 class DataRewriter,
312 class MutableSubstitution>
316{
317 return apply_data_rewriter_with_pbes_substitution_builder<Builder,
318 DataRewriter,
319 MutableSubstitution,
320 no_substitution>(R, sigma);
321}
322
323} // namespace detail
324
325/// \brief A rewriter that simplifies boolean expressions in a term.
327{
328 using term_type = pbes_expression;
329 using variable_type = data::variable;
330
332 {
333 pbes_expression result;
334 core::make_apply_builder<detail::simplify_builder>().apply(result, x);
335 return result;
336 }
337
338 void operator()(pbes_expression& result, const pbes_expression& x) const
339 {
340 core::make_apply_builder<detail::simplify_builder>().apply(result, x);
341 }
342
343 // sigma maps propositional variable instantiations to PBES expression.
344 template<class PbesSubstitution>
345 pbes_expression operator()(const pbes_expression& x, const PbesSubstitution& sigma) const
346 {
347 pbes_expression result;
348 pbes_system::detail::make_replace_propositional_variables_builder<detail::simplify_builder>(sigma).apply(result, x);
349 return result;
350 }
351
352 // sigma maps propositional variable instantiations to PBES expression.
353 template <class PbesSubstitution>
354 void operator()(pbes_expression& result, const pbes_expression& x, const PbesSubstitution& sigma) const
355 {
356 assert(&result != &x); // precondition for simplify_builder.apply
357 pbes_system::detail::make_replace_propositional_variables_builder<detail::simplify_builder>(sigma)
358 .apply(result, x);
359 }
360};
361
362/// \brief A rewriter that simplifies boolean expressions in a term, and rewrites data expressions using DataRewriter.
363template <typename DataRewriter>
365{
366 using term_type = pbes_expression;
367 using variable_type = data::variable;
368
369 const DataRewriter& R;
370
371 explicit simplify_data_rewriter(const DataRewriter& R_)
372 : R(R_)
373 {}
374
376 {
377 data::no_substitution sigma;
378 pbes_expression result;
379 detail::make_apply_data_rewriter_with_pbes_substitution_builder<
381 .apply(result, x);
382 return result;
383 }
384
385 template <typename Substitution>
386 pbes_expression operator()(const pbes_expression& x, Substitution& sigma) const
387 {
388 pbes_expression result;
389 detail::make_apply_data_rewriter_with_pbes_substitution_builder<
391 .apply(result, x);
392 return result;
393 }
394
395 template <typename Substitution>
396 void operator()(pbes_expression& result, const pbes_expression& x, Substitution& sigma) const
397 {
398 detail::make_apply_data_rewriter_with_pbes_substitution_builder<
400 .apply(result, x);
401 }
402
403 template<typename Substitution, typename PbesSubstitution>
405 Substitution& sigma,
406 const PbesSubstitution& sigma_pbes) const
407 {
408 pbes_expression result;
409 detail::make_apply_data_rewriter_with_pbes_substitution_builder<
411 .apply(result, x);
412 return result;
413 }
414
415 template<typename Substitution, typename PbesSubstitution>
416 void operator()(pbes_expression& result, const pbes_expression& x, Substitution& sigma, const PbesSubstitution& sigma_pbes) const
417 {
418 detail::make_apply_data_rewriter_with_pbes_substitution_builder<pbes_system::detail::simplify_data_rewriter_builder>(R, sigma, sigma_pbes)
419 .apply(result, x);
420 }
421};
422
423} // namespace mcrl2::pbes_system
424
425
426
427#endif // MCRL2_PBES_REWRITERS_SIMPLIFY_REWRITER_H
A unordered_map class in which aterms can be stored.
Components for generating an arbitrary element of a sort.
representative_generator(const data_specification &specification)
Constructor with data specification as context.
\brief A data variable
Definition variable.h:25
\brief The and operator for pbes expressions
const pbes_expression & left() const
const pbes_expression & right() const
propositional_variable_instantiation get_initial_state() override
Returns the initial state, rewritten and simplified.
pbes_expression rewrite_and_simplify_expression(const pbes_expression &e, const bool=true)
Rewrites and simplifies an expression.
virtual bool visit_inner_bounded_exists(const pbes_expression &e)
Visits a bounded existential quantifier expression within a disjunctive expression.
Definition ppg_visitor.h:88
virtual ~ppg_visitor()=default
Destructor.
virtual bool visit_inner_implies(const pbes_expression &e)
Visits a disjunctive expression within an inner universal quantifier expression.
virtual bool visit_or(const pbes_expression &e)
Visits a disjunctive expression.
static std::string print_brief(const pbes_expression &e)
Returns a string representation of the type of the root node of the expression.
Definition ppg_visitor.h:38
virtual bool visit_and(const pbes_expression &e)
Visits a conjunctive expression.
virtual bool visit_propositional_variable(const pbes_expression &e)
Visits a propositional variable expression.
Definition ppg_visitor.h:56
virtual bool visit_inner_and(const pbes_expression &e)
Visits a conjunctive expression within an inner existential quantifier expression.
Definition ppg_visitor.h:68
virtual bool visit_ppg_expression(const pbes_expression &e)
Visits a PPG expression.
virtual bool visit_inner_bounded_forall(const pbes_expression &e)
Visits a bounded universal quantifier expression within a conjunctive expression.
virtual bool visit_simple_expression(const pbes_expression &e)
Visits a simple expression. An expression is simple if it does not contain propositional variables.
Definition ppg_visitor.h:47
\brief The existential quantification operator for pbes expressions
const data::variable_list & variables() const
const pbes_expression & body() const
static ltsmin_state false_state()
Returns the state representing false.
ltsmin_state get_state(const propositional_variable_instantiation &expr) const
Returns a PBES_State object for expr.
std::vector< ltsmin_state > get_successors(const ltsmin_state &state, int group)
Computes successor states for a state as defined in transition group group. Serves as a wrapper aroun...
int get_index(int type_no, const std::string &s)
Returns the index of value in the local store for the data type with number type_no....
ltsmin_state get_initial_state() const
Returns the initial state.
static ltsmin_state true_state()
Returns the state representing true.
void to_state_vector(const ltsmin_state &dst_state, int *dst, const ltsmin_state &src_state, int *const &src)
Transforms a PBES state to a state vector, represented by an array of integers.
std::string get_value(int type_no, int index)
Returns the value at position index in the local store for the data type with number type_no....
int get_value_index(int type_no, const data_expression &value)
Returns the index of value in the local store for the data type with number type_no....
explorer(const std::string &filename, const std::string &rewrite_strategy, bool reset_flag, bool always_split_flag)
Constructor.
explorer(const pbes &p_, const std::string &rewrite_strategy, bool reset_flag, bool always_split_flag)
Constructor.
ltsmin_state from_state_vector(int *const &src)
Transforms a state vector src into a PBES_State object object containing the variable and parameter v...
int get_string_index(const std::string &s)
Returns the index of s in the local store for string values. This store is reserved for the string re...
const std::string & get_string_value(int index)
Returns the string at position index in the local store for string values. An exception is thrown if ...
std::vector< ltsmin_state > get_successors(const ltsmin_state &state)
Computes successor states for a state. Serves as a wrapper around the get_successors function of the ...
data::data_expression string_to_data(const std::string &s)
Returns a data expression for the string representation s.
lts_info * get_info() const
Returns the PBES_Info object.
const data_expression & get_data_value(int type_no, int index)
Returns the value at position index in the local store for the data type with number type_no....
detail::pbes_greybox_interface * pgg
the PBES greybox interface
static fixpoint_symbol nu()
Returns the nu symbol.
fixpoint_symbol & operator=(fixpoint_symbol &&) noexcept=default
static fixpoint_symbol mu()
Returns the mu symbol.
\brief The universal quantification operator for pbes expressions
const pbes_expression & body() const
const data::variable_list & variables() const
\brief The implication operator for pbes expressions
const pbes_expression & left() const
const pbes_expression & right() const
bool is_write_dependent_propvar(int group)
Determines if group is write dependent on the propositional variable. Returns true if propositional v...
bool is_read_dependent_parameter(int group, int part)
Determines if group is read dependent on part part of the state vector. Returns true if the parameter...
std::vector< int > get_param_indices(const data::variable_list &params)
Converts a variable_sequence_type into a sequence of indices of parameter signatures in the list of p...
bool is_pass_through_state(const propositional_variable_instantiation &propvar)
Determines if the propositional variable instantiation is one that only copies parameters from the cu...
const std::map< std::string, fixpoint_symbol > & get_variable_symbols() const
Returns the map from variable names to the fixpoint operator of the equation for the variable.
static std::map< variable, std::string > variable_signatures
const std::map< std::string, data::variable_list > & get_variable_parameters() const
Returns the map from variable names to the sequence of parameters for the variable.
const std::map< std::string, propositional_variable > & get_variables() const
Returns the map from variable names to the variable object for the variable.
int get_index(const std::string &signature)
Returns the index for a parameter signature in the list of parameter signatures for the system.
const lts_type & get_lts_type() const
Returns the LTS Type.
bool get_reset_option() const
Returns if the reset option is set.
std::set< std::string > copied(const pbes_expression &expr, const std::set< std::string > &L)
Computes the free variables which are copied/passed through (to a recursive variable) in an expressio...
const std::vector< pbes_expression > & get_transition_expressions() const
Returns the map from transition group number to the expression of the transition group.
std::set< std::string > copied(const pbes_expression &expr)
Computes the free variables which are copied/passed through (to a recursive variable) in an expressio...
detail::pbes_greybox_interface * pgg
bool is_read_dependent_propvar(int group)
Determines if group is read dependent on the propositional variable. Returns true,...
const std::vector< operation_type > & get_transition_types() const
Returns the map from transition group number to the type of the right hand side of the equation to wh...
std::set< std::string > used(const pbes_expression &expr, const std::set< std::string > &L)
Computes the free variables actually used, not only passed through, in an expression.
std::set< std::string > used(const pbes_expression &expr)
Computes the free variables actually used, not only passed through, in an expression.
const std::map< std::string, operation_type > & get_variable_types() const
Returns the map from variable names to the type of the right hand side of the equation for the variab...
void compute_dependency_matrix()
Computes dependency matrix from PBES.
lts_info(pbes &p, detail::pbes_greybox_interface *pgg, bool reset, bool always_split)
Constructor.
static bool tf(const pbes_expression &phi)
Determines if the term phi contains a branch that directly results in true or false (not a variable).
std::vector< pbes_expression > split_expression_and_substitute_variables(const pbes_expression &e, int current_priority, operation_type current_type, std::set< std::string > vars_stack)
Splits the expression into parts (disjuncts or conjuncts) and recursively tries to substitute the pro...
int get_number_of_groups() const
Returns the number of transition groups.
std::map< int, int > get_param_index_positions(const data::variable_list &params)
Converts a variable_sequence_type into a map from indices of parameter signatures (in the list of par...
int count_variables(const pbes_expression &e)
Counts the number of propositional variables in an expression.
void compute_lts_type()
Computes LTS Type from PBES.
std::set< std::string > changed(const pbes_expression &phi, const std::set< std::string > &L)
Computes the set of parameters changed in the expression.
std::string state_to_string(const ltsmin_state &state)
Returns a string representation for state state.
const std::map< std::string, int > & get_variable_priorities() const
Returns the map from variable names to the priority of the equation for the variable.
const data_expression & get_default_value(int index)
Returns a default value for the sort of a parameter signature.
const std::vector< std::string > & get_transition_variable_names() const
Returns the map from transition group number to the variable name of the equation to which the transi...
std::set< std::string > reset(const pbes_expression &phi, const std::set< std::string > &d)
Computes the set of parameters reset in the expression.
bool is_write_dependent_parameter(int group, int part)
Determines if group is read dependent on part part of the state vector. Returns true if the parameter...
std::set< std::string > changed(const pbes_expression &phi)
Computes the set of parameters changed in the expression.
void compute_transition_groups()
Computes transition groups from PBES.
const std::vector< std::string > & get_edge_label_types() const
Returns the sequence of edge label types.
std::size_t get_number_of_state_types() const
Returns the number of state types.
const std::vector< std::string > & get_edge_labels() const
Returns the sequence of edge labels.
int get_state_type_no(int part) const
Returns the state type index for the state part part.
void add_state(const std::string &name, const std::string &type)
Adds a state part of type type with name name.
void add_state_label(const std::string &name, const std::string &type)
Adds a state label of type type with name name.
lts_type(int state_length)
Contructor.
std::string get_state_type_name(int type_no) const
Returns the name of the state type with number type_no.
int get_state_length() const
Returns the state length.
const std::vector< std::string > & get_state_label_types() const
Returns the sequence of state label types.
std::size_t get_number_of_edge_labels() const
Returns the number of edge labels.
const std::vector< std::string > & get_state_types() const
Returns the sequence of state part types.
void add_edge_label(const std::string &name, const std::string &type)
Adds an edge label of type type with name name.
const std::vector< std::string > & get_state_labels() const
Returns the sequence of state labels.
const std::vector< std::string > & get_state_names() const
Returns the sequence of state part names.
std::size_t get_number_of_state_labels() const
Returns the number of state labels.
void add_parameter_value(const data_expression &)
Adds a parameter value to the list of parameter values.
pbes_expression to_pbes_expression() const
Returns a PBES expression representing the state.
std::string state_to_string() const
Returns a string representation of the state.
bool operator<(const ltsmin_state &other) const
Compares two PBES_State objects. Uses lexicographical ordering on priority, type, variable and parame...
ltsmin_state(const std::string &varname)
Constructor.
bool operator==(const ltsmin_state &other) const
Checks if two PBES_State objects are equal.
ltsmin_state(const std::string &varname, const pbes_expression &e)
Constructor.
std::string get_variable() const
Returns a string representation of the propositional variable of the state.
const std::vector< data_expression > & get_parameter_values() const
Returns the list of parameter values.
\brief The not operator for pbes expressions
const pbes_expression & operand() const
\brief The or operator for pbes expressions
const pbes_expression & left() const
const pbes_expression & right() const
Class for generating a BES from a PBES. This BES can be interpreted as a graph corresponding to a par...
operation_type
The operation type of the vertices.
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
const fixpoint_symbol & symbol() const
Returns the fixpoint symbol of the equation.
const propositional_variable & variable() const
Returns the pbes variable of the equation.
pbes_expression & operator=(const pbes_expression &) noexcept=default
parameterized boolean equation system
Definition pbes.h:54
propositional_variable_instantiation & initial_state()
Returns the initial state.
Definition pbes.h:194
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
\brief A propositional variable declaration
const core::identifier_string & name() const
propositional_variable(const core::identifier_string &name, const data::variable_list &parameters)
\brief Constructor Z12.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:435
atermpp::aterm remove_index(const atermpp::aterm &x)
Definition io.h:50
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
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.
static void inc_indent()
Increases the current indent level.
bool is_counter_example_equation(const pbes_equation &equation)
Guesses if the PBES equation is a counter example equation.
bool is_counter_example_positive(const core::identifier_string &name)
Returns true iff the name is Zpos, name must be a counter example name.
apply_data_rewriter_with_pbes_substitution_builder< Builder, DataRewriter, MutableSubstitution, PbesSubstitution > make_apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes)
mcrl2::pbes_system::pbes remove_counterexample_info(const pbes_system::pbes &pbes, bool remove_Lplus=true, bool remove_Lminus=true, bool remove_Lequations=true)
Removes all equations and expressions related to counter examples from the input PBES.
bool is_counter_example_instantiation(const propositional_variable_instantiation &inst)
Guesses if the PBES variable instantiation is for counter example equation.
bool has_counter_example_information(const pbes &pbesspec)
Guesses if a pbes has counter example information.
bool counter_example_index(const core::identifier_string &name, std::size_t &index)
Extracts the index embedded in a Zpos_<index>_.../Zneg_<index>_... counter example name.
static void indent()
Indents according to the current indent level.
static void dec_indent()
Decreases the current indent level.
bool is_counter_example_variable(const propositional_variable &X)
static int indent_count
The current indent level. Used for debug output.
bool is_counter_example_name(const core::identifier_string &name)
apply_data_rewriter_with_pbes_substitution_builder< Builder, DataRewriter, MutableSubstitution, no_substitution > make_apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma)
MapContainer::mapped_type map_at(const MapContainer &m, typename MapContainer::key_type key)
bool is_data(const pbes_expression &t)
Returns true if the term t is a data expression.
const pbes_expression & true_()
bool is_not(const atermpp::aterm &x)
bool is_exists(const atermpp::aterm &x)
bool is_or(const atermpp::aterm &x)
void make_optimized_forall(pbes_expression &result, const data::variable_list &l, const pbes_expression &p, bool remove_variables=false)
Make a universal quantification If l is empty, p is returned.
bool is_non_simple_conjunct(const pbes_expression &t)
Test for a conjunction.
bool is_simple_expression(const T &x, bool allow_counter_example_propvar)
Determines if an expression is a simple expression. An expression is simple if it is free of proposit...
bool is_forall(const atermpp::aterm &x)
bool is_pbes_or(const pbes_expression &t)
Returns true if the term t is an or expression.
bool is_false(const pbes_expression &t)
Test for the value false.
std::vector< pbes_expression > split_disjuncts(const pbes_expression &expr, bool split_simple_expr=false)
Splits a disjunction into a sequence of operands. Given a pbes expression of the form p1 || p2 || ....
bool is_pbes_and(const pbes_expression &t)
Returns true if the term t is an and expression.
void make_optimized_exists(pbes_expression &result, const data::variable_list &l, const pbes_expression &p, bool remove_variables=false)
Make an optimized existential quantification. If l is empty, p is returned.
bool is_simple_expression_with_cache(const T &x, bool allow_counter_example_propvar, std::map< pbes_expression, bool > &cache_true, std::map< pbes_expression, bool > &cache_false)
Determines if an expression is a simple expression using a cache. An expression is simple if it is fr...
std::vector< pbes_expression > split_conjuncts(const pbes_expression &expr, bool split_simple_expr=false)
Splits a conjunction into a sequence of operands Given a pbes expression of the form p1 && p2 && ....
bool is_propositional_variable_instantiation(const atermpp::aterm &x)
bool is_and(const atermpp::aterm &x)
std::string print_brief(const T &x)
Returns a string representation of the root node of a PBES.
bool is_non_simple_disjunct(const pbes_expression &t)
Test for a disjunction.
bool is_imp(const atermpp::aterm &x)
bool is_true(const pbes_expression &t)
Test for the value true.
const pbes_expression & false_()
An empty struct that is used to denote the absence of a substitution. Used for rewriters.
void apply(T &result, const forall &x)
void apply(T &result, const exists &x)
void apply(T &result, const or_ &x)
void apply(T &result, const not_ &x)
void apply(T &result, const and_ &x)
apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma)
apply_data_rewriter_with_pbes_substitution_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes)
A visitor class for PBES equations in BQNF. There is a visit_<node> function for each type of node....
bool debug
flag that indicates if debug output should be printed.
virtual bool visit_bqnf_equation(const pbes_equation &eqn)
Visits a BQNF equation.
virtual bool visit_inner_bounded_exists(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded existential quantifier expression within a disjunctive expression.
static std::string print_brief(const pbes_expression &e)
Returns a string representation of the type of the root node of the expression.
virtual bool visit_bounded_forall(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded universal quantifier expression.
virtual bool visit_bounded_quantifier(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded quantifier expression.
virtual bool visit_inner_and(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a conjunctive expression within an inner existential quantifier expression.
virtual bool visit_propositional_variable(const fixpoint_symbol &, const propositional_variable &, const pbes_expression &e)
Visits a propositional variable expression.
static bool is_inner_implies(const pbes_expression &e)
Determines if an expression if of the form phi => psi or of the form phi \/ psi where phi is a simple...
virtual bool visit_simple_expression(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a simple expression. An expression is simple if it does not contain propositional variables.
virtual bool visit_bqnf_expression(const pbes_expression &e)
Visits a BQNF expression. In the current BQNF visitor sigma and var parameters are added for use in b...
virtual bool visit_and(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a conjunctive expression.
virtual bool visit_bqnf_expression(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a BQNF expression.
static bool is_inner_and(const pbes_expression &e)
Determines if an expression if of the form phi /\ psi where phi is a simple expression and psi is an ...
virtual ~bqnf_visitor()=default
Destructor.
virtual bool visit_or(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a disjunctive expression.
virtual bool visit_bqnf_equation_debug(const pbes_equation &eqn)
Visits a BQNF equation in debug mode.
virtual bool visit_bounded_exists(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded existential quantifier expression.
virtual bool visit_inner_bounded_forall(const fixpoint_symbol &sigma, const propositional_variable &var, const pbes_expression &e)
Visits a bounded universal quantifier expression within a conjunctive expression.
void apply_substitution(T &result, const propositional_variable_instantiation &x, const SubstitutionType &sigma)
simplify_data_rewriter_builder(const DataRewriter &R, MutableSubstitution &sigma)
void apply_substitution(T &, const propositional_variable_instantiation &, const no_substitution &)
Overload to have a trivial function in case the substitution is no_substitution.
simplify_data_rewriter_builder(const DataRewriter &R, MutableSubstitution &sigma, const PbesSubstitution &sigma_pbes)
void apply(T &result, const propositional_variable_instantiation &x)
void apply(T &result, const propositional_variable_instantiation &x)
An empty struct that can be used to indicate that there is no substitution that should be applied to ...
Visitor for printing the root node of a PBES.
void apply(const pbes_equation &x)
void apply(const propositional_variable_instantiation &x)
A rewriter that simplifies boolean expressions in a term, and rewrites data expressions using DataRew...
pbes_expression operator()(const pbes_expression &x) const
pbes_expression operator()(const pbes_expression &x, Substitution &sigma, const PbesSubstitution &sigma_pbes) const
void operator()(pbes_expression &result, const pbes_expression &x, Substitution &sigma, const PbesSubstitution &sigma_pbes) const
void operator()(pbes_expression &result, const pbes_expression &x, Substitution &sigma) const
pbes_expression operator()(const pbes_expression &x, Substitution &sigma) const
A rewriter that simplifies boolean expressions in a term.
void operator()(pbes_expression &result, const pbes_expression &x) const
pbes_expression operator()(const pbes_expression &x, const PbesSubstitution &sigma) const
pbes_expression operator()(const pbes_expression &x) const
void operator()(pbes_expression &result, const pbes_expression &x, const PbesSubstitution &sigma) const