mCRL2
Loading...
Searching...
No Matches
enumerator_substitution.h
Go to the documentation of this file.
1// Author(s): Muck van Weerdenburg, 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/data/substitutions/enumerator_substitution.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_DATA_SUBSTITUTIONS_ENUMERATOR_SUBSTITUTION_H
13#define MCRL2_DATA_SUBSTITUTIONS_ENUMERATOR_SUBSTITUTION_H
14
15#include "mcrl2/data/builder.h"
16#include "mcrl2/data/is_simple_substitution.h"
17
18namespace mcrl2::data
19{
20
21namespace detail {
22
23// applies the enumerator substitution defined by variables and expressions to x
24template<typename T>
26 variable_list::const_iterator variables_begin,
27 variable_list::const_iterator variables_end,
28 data_expression_list::const_iterator expressions_begin);
29
31{
33 using super::enter;
34 using super::leave;
35 using super::apply;
36 using super::update;
37
41
42 enumerator_replace_builder(const variable_list::const_iterator variables_begin,
43 const variable_list::const_iterator variables_end,
44 const data_expression_list::const_iterator expressions_begin)
48 {}
49
50 template <class T>
51 void apply(T& result, const variable& x)
52 {
53 variable_list::const_iterator i_vars = m_vars_begin;
54 data_expression_list::const_iterator i_exprs = m_expressions_begin;
55 while (i_vars!=m_vars_end && x != *i_vars)
56 {
57 ++i_vars;
58 ++i_exprs;
59 }
60 if (i_vars==m_vars_end)
61 {
62 result = x;
63 return;
64 }
65 else
66 {
67 result = enumerator_replace(*i_exprs, i_vars, m_vars_end, i_exprs);
68 return;
69 }
70 }
71};
72
73template <typename T>
74inline
75data_expression enumerator_replace(const T& x,
76 const variable_list::const_iterator variables_begin,
77 const variable_list::const_iterator variables_end,
78 const data_expression_list::const_iterator expressions_begin)
79{
80 data_expression result;
81 enumerator_replace_builder f(variables_begin, variables_end, expressions_begin);
82 f.apply(result, x);
83 return result;
84}
85
86template <typename T>
87inline
88data_expression enumerator_replace(const T& x, const variable_list& variables, const data_expression_list& expressions)
89{
90 assert(variables.size()==expressions.size());
91 return enumerator_replace(x, variables.begin(), variables.end(), expressions.begin());
92}
93
94} // namespace detail
95
96/// \brief Substitution that stores the assignments as a sequence of variables and a sequence of expressions.
97/// It supports function composition efficiently. This is done by simply concatenating the variables and
98/// expressions of the two substitutions. As a result, evaluating the substitution becomes more expensive.
100{
101 /// \brief type used to represent variables
102 using variable_type = data::variable;
103
104 /// \brief type used to represent expressions
105 using expression_type = data::data_expression;
106
107 data::variable_list variables;
108 data::data_expression_list expressions;
109
111
112 enumerator_substitution(data::variable_list variables_, data::data_expression_list expressions_)
115 {
116 assert(variables.size() == expressions.size());
117 }
118
120 {
121 return detail::enumerator_replace(v, variables, expressions);
122 }
123
124 // Adds the assignment [v := e] to this substitution, by putting it in front of the lists with variables and expressions.
125 // Note that this operation has not the same effect as function composition with [v := e]. Therefore we use a different
126 // syntax than sigma[v] = e.
128 {
129 variables.push_front(v);
130 expressions.push_front(e);
131 }
132
133 // Reverses the order of the assignments in the substitution.
134 void revert()
135 {
136 variables = atermpp::reverse(variables);
137 expressions = atermpp::reverse(expressions);
138 }
139
141 {
142 std::ostringstream out;
143 out << "[";
144 auto i = variables.begin();
145 auto j = expressions.begin();
146 for (; i != variables.end(); ++i, ++j)
147 {
148 out << (i == variables.begin() ? "" : "; ") << *i << " := " << *j;
149 }
150 out << "]";
151 return out.str();
152 }
153};
154
155inline
157{
158 return out << sigma.to_string();
159}
160
161inline
163{
164 auto i = sigma.variables.begin();
165 auto j = sigma.expressions.begin();
166 for (i = sigma.variables.begin(); i != sigma.variables.end(); ++i, ++j)
167 {
168 if (!is_simple_substitution(*i, *j))
169 {
170 return false;
171 }
172 }
173 return true;
174}
175
176} // namespace mcrl2::data
177
178#endif // MCRL2_DATA_SUBSTITUTIONS_ENUMERATOR_SUBSTITUTION_H
aterm()
Default constructor.
Definition aterm.h:51
A unordered_map class in which aterms can be stored.
An abstraction expression.
Definition abstraction.h:23
const variable_list & variables() const
Definition abstraction.h:60
abstraction(const binder_type &binding_operator, const variable_list &variables, const data_expression &body)
Constructor.
Definition abstraction.h:39
const data_expression & body() const
Definition abstraction.h:65
const binder_type & binding_operator() const
Definition abstraction.h:55
Rewriter class for the mCRL2 Library. It only works for terms of type data_expression and data_expres...
Definition rewriter.h:26
basic_rewriter(const data_specification &d, const strategy s=jitty)
Constructor.
Definition rewriter.h:66
const data::enumerator_identifier_generator & identifier_generator() const
Expose the identifier generator present in m_rewriter.
Definition rewriter.h:44
basic_rewriter(const data_specification &d, const used_data_equation_selector &equation_selector, const strategy s=jitty)
Constructor.
Definition rewriter.h:71
basic_rewriter(const std::shared_ptr< detail::Rewriter > &r)
Constructor.
Definition rewriter.h:53
basic_rewriter(const basic_rewriter &other)=default
Copy Constructor.
basic_rewriter & operator=(const basic_rewriter &other)=default
Assignment operator.
std::shared_ptr< detail::Rewriter > m_rewriter
The wrapped Rewriter.
Definition rewriter.h:33
\brief A container sort
const sort_expression & element_sort() const
\brief A data equation
const data_expression & lhs() const
const variable_list & variables() const
data_expression & operator=(const data_expression &) noexcept=default
data_expression & operator=(data_expression &&) noexcept=default
sort_expression sort() const
Returns the sort of the data expression.
Definition data.cpp:107
bool is_certainly_finite(const sort_expression &s) const
Checks whether a sort is certainly finite.
The class BDD_Info provides information about the structure of binary decision diagrams.
Definition bdd_info.h:22
static const mcrl2::data::data_expression & get_true_branch(const mcrl2::data::data_expression &a_bdd)
Method that returns the true-branch of a BDD.
Definition bdd_info.h:43
static bool is_if_then_else(const data_expression &a_bdd)
Method that indicates wether or not the root of a BDD is a guard node.
Definition bdd_info.h:78
static bool is_false(const data_expression &a_bdd)
Method that indicates whether or not a BDD equals false.
Definition bdd_info.h:69
static const mcrl2::data::data_expression & get_guard(const mcrl2::data::data_expression &a_bdd)
Method that returns the guard of a BDD.
Definition bdd_info.h:35
static const mcrl2::data::data_expression & argument(const mcrl2::data::data_expression &x, std::size_t n)
Definition bdd_info.h:24
static const mcrl2::data::data_expression & get_false_branch(const mcrl2::data::data_expression &a_bdd)
Method that returns the false-branch of a BDD.
Definition bdd_info.h:51
static bool is_true(const data_expression &a_bdd)
Method that indicates whether or not a BDD equals true.
Definition bdd_info.h:60
Base class for eliminating inconsistent paths from BDDs.
data_expression simplify(const data_expression &a_bdd) override
Returns a BDD without inconsistent paths, equivalent to a_bdd. precondition: The argument passed as p...
data_expression aux_simplify(const data_expression &a_bdd, const data_expression_list &a_path)
Simplifies the BDD a_bdd using path a_path. Paths whose guards in conjunction with the guards in.
BDD_Info f_bdd_info
Class that provides information about the structure of BDDs.
SMT_Solver * f_smt_solver
Pointer to an SMT solver used to determine whether or not a path is inconsistent.
bool variables_overlap(const data_expression &a_expression_1, const data_expression &a_expression_2)
Returns true if the expression a_expression_1 has variables in common with expression a_expression_2.
BDD_Path_Eliminator(smt_solver_type a_solver_type)
Constructor that initializes the field BDD_Path_Eliminator::f_smt_solver.
data_expression_list create_condition(data_expression_list a_path, const data_expression &a_guard, bool a_minimal)
Returns a list representing the conjunction of all guards in a_path and the guard a_guard.
bool get_branch(const data_expression &a_bdd, const bool a_polarity, data_expression &result)
Returns branch of the BDD a_bdd, depending on the polarity a_polarity.
Definition bdd_prover.h:423
Induction f_induction
Class that creates all statements needed to prove a given property using induction.
Definition bdd_prover.h:144
strategy rewriter_strategy() const
Returns the strategy of the rewriter used inside this proving rewriter.
Definition bdd_prover.h:618
std::vector< variable > f_variables
The variables in the expression in order.
Definition bdd_prover.h:130
std::shared_ptr< BDD_Simplifier > f_bdd_simplifier
Class that simplifies a BDD.
Definition bdd_prover.h:141
static constexpr bool f_reverse
Flag indicating whether or not the result of the comparison between the first two arguments.
Definition bdd_prover.h:94
void set_substitution(substitution_type &sigma)
Set the substitution to be used to construct the BDD.
Definition bdd_prover.h:523
void set_formula(const data_expression &formula)
Sets Prover::f_formula to formula. precondition: the argument passed as parameter formula is an expre...
Definition bdd_prover.h:625
std::string indent(size_t n)
Definition bdd_prover.h:178
bool smallest(const data_expression &formula, data_expression &result)
Returns the smallest guard in the formula formula.
Definition bdd_prover.h:338
data_expression f_bdd
A binary decision diagram in the internal representation of mCRL2.
Definition bdd_prover.h:467
const Info f_info
A class that provides information about expressions.
Definition bdd_prover.h:105
data_expression bdd_down(const data_expression &formula, const size_t a_indent=0)
Creates the EQ-BDD corresponding to the formula formula.
Definition bdd_prover.h:184
static constexpr bool f_full
Flag indicating whether or not the arguments of equality functions are taken into account.
Definition bdd_prover.h:98
void eliminate_paths()
Removes all inconsistent paths from the BDD BDD_Prover::f_bdd.
Definition bdd_prover.h:248
BDD_Prover(const rewriter &r, double time_limit=0, bool apply_induction=false)
Definition bdd_prover.h:513
data_expression get_counter_example()
Returns all the guards on a path in the BDD that leads to a leaf labelled "false",...
Definition bdd_prover.h:584
substitution_type bdd_sigma
A binary decision diagram in the internal representation of the rewriter.
Definition bdd_prover.h:464
Answer f_tautology
A flag that indicates whether or not the formala Prover::f_formula is a tautology.
Definition bdd_prover.h:114
Answer is_contradiction()
Indicates whether or not the formula Prover::f_formula is a contradiction.
Definition bdd_prover.h:542
data_expression f_formula
An expression of sort Bool.
Definition bdd_prover.h:102
std::chrono::milliseconds f_deadline
A timestamp representing the moment when the maximal amount of milliseconds has been spent on process...
Definition bdd_prover.h:123
bool f_processed
A flag that indicates whether or not the formala Prover::f_formula has been processed.
Definition bdd_prover.h:111
void update_answers()
Updates the values of Prover::f_tautology and Prover::f_contradiction.
Definition bdd_prover.h:266
std::shared_ptr< detail::Rewriter > get_rewriter()
Returns the rewriter used by this prover (i.e. it returns Prover::f_rewriter).
Definition bdd_prover.h:612
const double f_time_limit
An integer representing the maximal amount of seconds to be spent on processing a formula.
Definition bdd_prover.h:120
Manipulator f_manipulator
A class that can be used to manipulate expressions.
Definition bdd_prover.h:108
bool f_apply_induction
A flag indicating whether or not induction on lists is applied.
Definition bdd_prover.h:127
void build_bdd()
Constructs the EQ-BDD corresponding to the formula Prover::f_formula.
Definition bdd_prover.h:147
std::unordered_map< data_expression, data_expression > f_smallest
A hashtable that maps formulas to the smallest guard occuring in those formulas.
Definition bdd_prover.h:138
Answer f_contradiction
A flag that indicates whether or not the formala Prover::f_formula is a contradiction.
Definition bdd_prover.h:117
std::unordered_map< data_expression, data_expression > f_formula_to_bdd
A hashtable that maps formulas to BDDs.
Definition bdd_prover.h:134
data_expression get_bdd()
Returns the BDD BDD_Prover::f_bdd.
Definition bdd_prover.h:549
data_expression get_witness()
Returns all the guards on a path in the BDD that leads to a leaf labelled "true", if such a leaf exis...
Definition bdd_prover.h:556
void set_substitution_internal(substitution_type &sigma)
Set the substitution in internal format to be used to construct the BDD.
Definition bdd_prover.h:529
BDD_Prover(const data_specification &data_spec, const used_data_equation_selector &equations_selector, mcrl2::data::rewriter::strategy a_rewrite_strategy=mcrl2::data::jitty, double a_time_limit=0, bool a_path_eliminator=false, smt_solver_type a_solver_type=solver_type_cvc, bool a_apply_induction=false)
Definition bdd_prover.h:470
Answer is_tautology()
Indicates whether or not the formula Prover::f_formula is a tautology.
Definition bdd_prover.h:535
A base class for simplifying binary decision diagrams.
void set_time_limit(time_t a_time_limit)
Sets the attribute BDD_Simplifier::f_deadline.
virtual data_expression simplify(const data_expression &a_bdd)
Returns a simplified BDD, equivalent to the bdd a_bdd. precondition: The argument passed as parameter...
virtual ~BDD_Simplifier()=default
Destructor without any additional functionality.
time_t f_deadline
An integer representing the moment in time when the maximal amount of seconds has been spent on simpl...
The class Induction generates statements corresponding to.
Definition induction.h:25
sort_expression get_sort_of_list_elements(const variable &a_list_variable) const
Definition induction.h:53
data_expression create_hypotheses(const data_expression &a_hypothesis, variable_list a_list_of_variables, variable_list a_list_of_dummies) const
Definition induction.h:87
std::size_t f_count
The number of variables used during the last application of induction.
Definition induction.h:30
variable_vector f_list_variables
Definition induction.h:36
data_expression f_formula
An expression of sort Bool in mCRL2 format.
Definition induction.h:33
set_identifier_generator fresh_identifier_generator
Definition induction.h:27
variable_vector recurse_expression_for_lists(const data_expression &a_expression) const
Definition induction.h:39
variable get_fresh_dummy(const sort_expression &a_sort)
Definition induction.h:60
data_expression_list create_clauses(const data_expression &a_formula, const data_expression &a_hypothesis, const std::size_t a_variable_number, const std::size_t a_number_of_variables, const variable_list &a_list_of_variables, const variable_list &a_list_of_dummies)
Definition induction.h:117
void initialize(const data_expression &a_formula)
Definition induction.h:160
data_expression apply_induction()
\requires can_apply_induction()
Definition induction.h:173
data_expression apply_induction_one(const core::identifier_string &fresh_name) const
Definition induction.h:67
Base class for classes that provide information about the structure of.
Definition info.h:32
data_expression get_operator(const data_expression &term) const
Returns the main operator of the term term;.
Definition info.h:236
constexpr Info(bool a_full, bool a_reverse)
Constructor that initializes the rewriter.
Definition info.h:181
Compare_Result compare_term_free_variables(const data_expression &term1, const data_expression &term2) const
Definition info.h:136
Compare_Result compare_guard_equality(const data_expression &guard1, const data_expression &guard2) const
Compares two guards by their arguments.
Definition info.h:114
Compare_Result compare_address(const atermpp::aterm &term1, const atermpp::aterm &term2) const
Definition info.h:51
static bool occurs(const data_expression &t1, const data_expression &t2)
Definition info.h:187
Compare_Result lexico(const Compare_Result &a_result1, const Compare_Result &a_result2) const
Definition info.h:44
Compare_Result compare_term_type(const data_expression &term1, const data_expression &term2) const
Compares terms by their type.
Definition info.h:152
std::size_t get_number_of_arguments(const data_expression &a_term) const
Returns the number of arguments of the main operator of a term.
Definition info.h:223
double get_guard_structure(const data_expression &guard, const std::vector< variable > &f_variables) const
Returns an integer corresponding to the structure of the guard passed as argument guard.
Definition info.h:68
Compare_Result compare_term_occurs(const data_expression &term1, const data_expression &term2) const
Compares terms by checking whether one is a part of the other.
Definition info.h:166
const bool f_full
Flag indicating whether or not the arguments of equality functions are taken into account.
Definition info.h:37
Compare_Result compare_guard_structure(const data_expression &guard1, const data_expression &guard2, const std::vector< variable > &f_variables) const
Compares the structure of two guards.
Definition info.h:100
Compare_Result compare_term(const data_expression &term1, const data_expression &term2) const
Compares two terms.
Definition info.h:205
Compare_Result compare_guard(const data_expression &guard1, const data_expression &guard2, const std::vector< variable > &f_variables) const
Compares two guards.
Definition info.h:193
const bool f_reverse
Flag indicating whether or not the result of the comparison between the first two arguments.
Definition info.h:42
Base class for classes that provide functionality to modify or create terms.
Definition manipulator.h:23
data_expression orient(const data_expression &a_term)
Orients the term a_term such that all equations of the form t1 == t2 are.
Manipulator(const Info &a_info)
Constructor initializing the rewriter and the field f_info.
data_expression set_true(const data_expression &a_formula, const data_expression &a_guard) const
Initializes the table Manipulator::f_set_true and calls.
std::unordered_map< data_expression, data_expression > f_orient
A table used by the method Manipulator::orient. The method Manipulator::orient stores resulting terms...
Definition manipulator.h:33
data_expression set_false(const data_expression &a_formula, const data_expression &a_guard) const
Initializes the table Manipulator::f_set_false and calls the method.
const Info & f_info
A class that provides information on the structure of expressions in one of the.
Definition manipulator.h:27
static data_expression make_reduced_if_then_else(const data_expression &a_expr, const data_expression &a_high, const data_expression &a_low)
Returns an expression in the internal format of the rewriter with the jitty strategy.
data_expression set_false_auxiliary(const data_expression &a_formula, const data_expression &a_guard, std::unordered_map< data_expression, data_expression > &f_set_false) const
Replaces all occurences of a_guard in a_formula by false.
Definition manipulator.h:98
data_expression set_true_auxiliary(const data_expression &a_formula, const data_expression &a_guard, std::unordered_map< data_expression, data_expression > &f_set_true) const
Replaces all occurences of a_guard in a_formula by true. Additionally, if the variable.
Definition manipulator.h:38
RewriterProver(const data_specification &data_spec, mcrl2::data::rewriter::strategy strat, const used_data_equation_selector &equations_selector)
Definition with_prover.h:28
RewriterProver(const RewriterProver &other)=delete
data_expression rewrite(const data_expression &t, substitution_type &sigma) override
Rewrite an mCRL2 data term.
Definition with_prover.h:68
rewrite_strategy getStrategy() override
Get rewriter strategy that is used.
Definition with_prover.h:38
void rewrite(data_expression &result, const data_expression &t, substitution_type &sigma) override
Rewrite an mCRL2 data term.
Definition with_prover.h:53
RewriterProver(const RewriterProver &rewr, BDD_Prover prover_obj_)
Definition with_prover.h:88
std::shared_ptr< Rewriter > clone() override
Clone a rewriter.
Definition with_prover.h:96
Rewriter interface class.
Definition rewrite.h:39
void rewrite_where(data_expression &result, const where_clause &term, substitution_type &sigma)
Definition rewrite.cpp:61
virtual void thread_initialise()
Definition rewrite.h:163
Rewriter(const data_specification &data_spec, const used_data_equation_selector &eq_selector)
Constructor. Do not use directly; use createRewriter() function instead.
Definition rewrite.h:60
A strategy is a list of rules and the number of variables that occur in it.
An enumerator algorithm that generates solutions of a condition.
Definition enumerator.h:599
void rewrite(Expression &result, const Expression &phi, MutableSubstitution &sigma) const
Definition enumerator.h:642
enumerator_identifier_generator & id_generator
Definition enumerator.h:611
std::size_t m_max_count
max_count The enumeration is aborted after max_count iterations
Definition enumerator.h:614
std::size_t enumerate(const EnumeratorListElement &p, MutableSubstitution &sigma, ReportSolution report_solution, Reject reject=Reject(), Accept accept=Accept()) const
Enumerates the element p. Solutions are reported using the callback function report_solution....
Definition enumerator.h:972
enumerator_algorithm(const enumerator_algorithm< Rewriter, DataRewriter > &)=delete
std::size_t enumerate(const variable_list &vars, const typename EnumeratorListElement::expression_type &cond, MutableSubstitution &sigma, ReportSolution report_solution, Reject reject=Reject(), Accept accept=Accept()) const
Enumerates the variables v for condition c. Solutions are reported using the callback function report...
bool enumerate_front(enumerator_queue< EnumeratorListElement > &P, MutableSubstitution &sigma, ReportSolution report_solution, Reject reject=Reject(), Accept accept=Accept()) const
Enumerates the front element of the todo list P. The enumeration is interrupted when report_solution ...
Definition enumerator.h:705
std::string print(const data::variable &x) const
Definition enumerator.h:623
bool m_accept_solutions_with_variables
If true, solutions with a non-empty list of variables may be reported.
Definition enumerator.h:617
const data::data_specification & dataspec
A data specification.
Definition enumerator.h:605
std::size_t enumerate_all(enumerator_queue< EnumeratorListElement > &P, MutableSubstitution &sigma, ReportSolution report_solution, Reject reject=Reject(), Accept accept=Accept()) const
Enumerates until P is empty. Solutions are reported using the callback function report_solution....
Definition enumerator.h:932
enumerator_algorithm(const Rewriter &R_, const data::data_specification &dataspec_, const DataRewriter &datar_, enumerator_identifier_generator &id_generator_, bool accept_solutions_with_variables, std::size_t max_count=(std::numeric_limits< std::size_t >::max)())
Definition enumerator.h:651
Expression rewrite(const Expression &phi, MutableSubstitution &sigma) const
Definition enumerator.h:632
core::identifier_string operator()()
Generates a unique function symbol with the given prefix followed by a number.
An element for the todo list of the enumerator that collects the substitution corresponding to the ex...
Definition enumerator.h:346
enumerator_list_element_with_substitution(const data::variable_list &v, const Expression &phi, const enumerator_list_element_with_substitution< Expression > &elem, const data::variable &d, const data::data_expression &e)
Constructs the element (v, phi, e.sigma[v := x])
Definition enumerator.h:374
data::data_expression_list assign_expressions(const VariableList &v, const Rewriter &rewriter) const
Returns the right hand sides corresponding to the variables v.
Definition enumerator.h:414
enumerator_list_element_with_substitution(const data::variable_list &v, const Expression &phi)
Constructs the element (v, phi, [])
Definition enumerator.h:358
void remove_assignments(const VariableList &v, MutableSubstitution &result) const
Removes the assignments corresponding with this element from the substitution result.
Definition enumerator.h:403
void set(const data::variable_list &v, const Expression &phi, const enumerator_list_element_with_substitution< Expression > &elem, const data::variable &d, const data::data_expression &e)
Set the variable ands and the expression explicitly as the element (v, phi, e.sigma[v := x]).
Definition enumerator.h:439
void add_assignments(const VariableList &v, MutableSubstitution &result, const Rewriter &rewriter) const
Adds the assignments that correspond with this element to the substitution result.
Definition enumerator.h:391
void set(const data::variable_list &v, const Expression &phi, const enumerator_list_element_with_substitution< Expression > &elem)
Set the variable ands and the expression explicitly as the element (v, phi, e.sigma[v := x]).
Definition enumerator.h:454
void mark(std::stack< std::reference_wrapper< atermpp::detail::_aterm > > &todo) const
The following function is needed to mark the aterms in this class, when elements of this class are us...
Definition enumerator.h:430
data::enumerator_substitution sigma() const
Definition enumerator.h:421
enumerator_list_element_with_substitution(const data::variable_list &v, const Expression &phi, const enumerator_list_element_with_substitution< Expression > &elem)
Constructs the element (v, phi, e.sigma[v := x])
Definition enumerator.h:363
enumerator_list_element_with_substitution()=default
Default constructor.
The default element for the todo list of the enumerator.
Definition enumerator.h:229
enumerator_list_element(data::variable_list v_, const Expression &phi_, const enumerator_list_element &, const data::variable &, const data::data_expression &)
Constructs the element (v, phi)
Definition enumerator.h:254
void set(const data::variable_list &v_, const Expression &phi_)
Set the variables and the condition explicitly.
Definition enumerator.h:309
enumerator_list_element(data::variable_list v_, const Expression &phi_)
Constructs the element (v, phi)
Definition enumerator.h:241
enumerator_list_element(data::variable_list v_, const Expression &phi_, const enumerator_list_element &)
Constructs the element (v, phi)
Definition enumerator.h:246
bool is_valid() const
Returns true if the element is valid. If it becomes false, this is used to signal that the enumeratio...
Definition enumerator.h:291
void set(const data::variable_list &v_, const Expression &phi_, const enumerator_list_element &, const data::variable &, const data::data_expression &)
Set the variable ands and the expression explicitly as the element (v, phi, e.sigma[v := x]).
Definition enumerator.h:330
enumerator_list_element()=default
Default constructor.
void mark(atermpp::term_mark_stack &todo) const
The following function is needed to mark the aterms in this class, when elements of this class are us...
Definition enumerator.h:300
void set(const data::variable_list &v_, const Expression &phi_, const enumerator_list_element &)
Set the variables and the condition explicitly.
Definition enumerator.h:319
void invalidate()
Invalidates the element, by giving phi an undefined value.
Definition enumerator.h:284
const data::variable_list & variables() const
Definition enumerator.h:263
const Expression & expression() const
Definition enumerator.h:268
Contains the enumerator queue.
Definition enumerator.h:499
atermpp::deque< EnumeratorListElement > P
Definition enumerator.h:501
atermpp::deque< EnumeratorListElement >::size_type size() const
Definition enumerator.h:553
enumerator_queue()=default
Default constructor.
const EnumeratorListElement & enumerator_element_cache(const Args &... args)
Definition enumerator.h:589
EnumeratorListElement::expression_type scratch_expression
Definition enumerator.h:511
variable_list scratch_variable_list
Definition enumerator.h:513
const EnumeratorListElement & back() const
Definition enumerator.h:568
void push_back(const EnumeratorListElement &x)
Definition enumerator.h:526
void emplace_back(Args &&... args)
Definition enumerator.h:535
EnumeratorListElement m_enumerator_element_cache
Definition enumerator.h:502
EnumeratorListElement & back()
Definition enumerator.h:573
EnumeratorListElement & front()
Definition enumerator.h:563
enumerator_queue(const EnumeratorListElement &value)
Initializes the enumerator queue with the given value.
Definition enumerator.h:522
data_expression scratch_data_expression
Definition enumerator.h:512
const EnumeratorListElement & front() const
Definition enumerator.h:558
\brief A function sort
const sort_expression & codomain() const
\brief A function symbol
const sort_expression & sort() const
Components for generating an arbitrary element of a sort.
bool find_representative(const function_symbol &symbol, std::set< sort_expression > &visited_sorts, data_expression &result)
Finds a representative of the form f(t1,...,tn) where f is the function symbol.
std::map< sort_expression, data_expression > m_representatives_cache
Serves as a cache for later find operations.
const data_specification & m_specification
Data specification context.
bool search_for_lexicographically_minimal_symbol(function_symbol &f_result, const sort_expression &sort, const std::vector< function_symbol > &function_symbols)
bool find_representative(const sort_expression &sort, std::set< sort_expression > &visited_sorts, data_expression &result)
Finds a representative element for an arbitrary sort expression.
data_expression operator()(const sort_expression &sort)
Returns a representative of a sort.
representative_generator(const data_specification &specification)
Constructor with data specification as context.
void set_representative(const sort_expression &sort, const data_expression &representative)
Sets a data expression as representative of the sort.
Rewriter that operates on data expressions.
Definition rewriter.h:84
void operator()(data_expression &result, const data_expression &d) const
Rewrites a data expression.
Definition rewriter.h:169
rewriter(const std::shared_ptr< detail::Rewriter > &r)
Constructor for internal use.
Definition rewriter.h:108
static const data_specification & default_specification()
Default specification used if no specification is specified at construction.
Definition rewriter.h:100
void operator()(data_expression &result, const data_expression &d, substitution_type &sigma) const
Rewrites the data expression d, and on the fly applies a substitution function to data variables.
Definition rewriter.h:225
void thread_initialise()
Initialises this rewriter with thread dependent information.
Definition rewriter.h:153
data_expression operator()(const data_expression &d, substitution_type &sigma) const
Rewrites the data expression d, and on the fly applies a substitution function to data variables.
Definition rewriter.h:211
rewriter(const data_specification &d, const EquationSelector &selector, const strategy s=jitty)
Constructor.
Definition rewriter.h:135
static substitution_type & empty_substitution()
Definition rewriter.h:87
rewriter clone()
Create a clone of the rewriter in which the underlying rewriter is copied, and not passed as a shared...
Definition rewriter.h:143
rewriter(const rewriter &r)=default
Constructor.
rewriter(const data_specification &d=rewriter::default_specification(), const strategy s=jitty)
Constructor.
Definition rewriter.h:126
void operator()(data_expression &result, const data_expression &d, const SubstitutionFunction &sigma) const
Rewrites the data expression d, and on the fly applies a substitution function. to data variables.
Definition rewriter.h:193
data_expression operator()(const data_expression &d, const SubstitutionFunction &sigma) const
Rewrites the data expression d, and on the fly applies a substitution function. to data variables.
Definition rewriter.h:180
data_expression operator()(const data_expression &d) const
Rewrites a data expression.
Definition rewriter.h:161
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
\brief A sort expression
Component for selecting a subset of equations that are actually used in an encompassing specification...
Definition selection.h:36
\brief A data variable
Definition variable.h:25
variable(const variable &) noexcept=default
Move semantics.
const sort_expression & sort() const
Definition variable.h:40
variable(const core::identifier_string &name, const sort_expression &sort)
Constructor.
Definition variable.h:59
\brief A where expression
const assignment_list & assignments() const
const data_expression & body() const
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:393
void CheckRewriteRule(const data_equation &data_eqn)
Check that an mCRL2 data equation is a valid rewrite rule. If not, an runtime_error is thrown indicat...
Definition rewrite.cpp:582
static void checkPattern(const data_expression &p)
Definition rewrite.cpp:567
static void check_vars(application::const_iterator begin, const application::const_iterator &end, const std::set< variable > &vars, std::set< variable > &used_vars)
Definition rewrite.cpp:524
void set_enumerator_iteration_limit(std::size_t size)
bool isValidRewriteRule(const data_equation &data_eqn)
Check whether or not an mCRL2 data equation is a valid rewrite rule.
Definition rewrite.cpp:640
static bool occur_check(const variable &v, const atermpp::aterm &e)
Definition rewrite.cpp:44
data_expression make_if_expression_(std::size_t &function_index, const std::size_t argument_index, const std::vector< data_expression_vector > &data_domain_expressions, const data_expression_vector &codomain_expressions, const variable_vector &parameters)
Definition enumerator.h:45
bool is_enumerable(const data_specification &dataspec, const Rewriter &rewr, const sort_expression &sort, std::list< sort_expression > &parents)
Definition enumerator.h:157
static void checkPattern(application::const_iterator begin, const application::const_iterator &end)
Definition rewrite.cpp:558
Answer
A prover that uses EQ-BDDs.
Definition bdd_prover.h:77
@ compare_result_bigger
Definition info.h:26
@ compare_result_smaller
Definition info.h:24
static void check_vars(const data_expression &expr, const std::set< variable > &vars, std::set< variable > &used_vars)
Definition rewrite.cpp:535
data_expression enumerator_replace(const T &x, const variable_list &variables, const data_expression_list &expressions)
data_expression make_set_(std::size_t function_index, const sort_expression &element_sort, const data_expression_vector &set_elements)
Definition enumerator.h:30
bool compute_finite_function_sorts(const function_sort &sort, enumerator_identifier_generator &id_generator, const data::data_specification &dataspec, Rewriter datar, data_expression_vector &result, variable_list &function_parameter_list)
Computes the elements of a finite function sort, and puts them in result. If there are too many eleme...
Definition enumerator.h:107
bool compute_finite_set_elements(const container_sort &sort, const data_specification &dataspec, Rewriter datar, MutableSubstitution &sigma, data_expression_vector &result, enumerator_identifier_generator &id_generator)
Computes the elements of a finite set sort, and puts them in result. If there are too many elements,...
Definition enumerator.h:80
data_expression enumerator_replace(const T &x, variable_list::const_iterator variables_begin, variable_list::const_iterator variables_end, data_expression_list::const_iterator expressions_begin)
A collection of utilities for lazy expression construction.
data_expression and_(data_expression const &p, data_expression const &q)
Returns an expression equivalent to p or q.
Namespace for system defined sort bag.
Definition bag1.h:35
bool is_bag(const sort_expression &e)
Recogniser for sort expression Bag(s)
Definition bag1.h:52
Namespace for system defined sort bool_.
Definition bool.h:29
bool is_false_function_symbol(const atermpp::aterm &e)
Recogniser for function false.
Definition bool.h:116
bool is_or_application(const atermpp::aterm &e)
Recogniser for application of ||.
Definition bool.h:342
const basic_sort & bool_()
Constructor for sort expression Bool.
Definition bool.h:41
bool is_implies_application(const atermpp::aterm &e)
Recogniser for application of =>.
Definition bool.h:406
application not_(const data_expression &arg0)
Application of function symbol !.
Definition bool.h:194
application and_(const data_expression &arg0, const data_expression &arg1)
Application of function symbol &&.
Definition bool.h:257
application implies(const data_expression &arg0, const data_expression &arg1)
Application of function symbol =>.
Definition bool.h:385
application or_(const data_expression &arg0, const data_expression &arg1)
Application of function symbol ||.
Definition bool.h:321
const function_symbol & false_()
Constructor for function symbol false.
Definition bool.h:106
bool is_and_application(const atermpp::aterm &e)
Recogniser for application of &&.
Definition bool.h:278
bool is_true_function_symbol(const atermpp::aterm &e)
Recogniser for function true.
Definition bool.h:84
bool is_not_application(const atermpp::aterm &e)
Recogniser for application of !.
Definition bool.h:214
void make_not_(data_expression &result, const data_expression &arg0)
Make an application of function symbol !.
Definition bool.h:204
void make_and_(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol &&.
Definition bool.h:268
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:74
void make_or_(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol ||.
Definition bool.h:332
void make_implies(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol =>.
Definition bool.h:396
Namespace for system defined sort fbag.
Definition fbag1.h:34
bool is_fbag(const sort_expression &e)
Recogniser for sort expression FBag(s)
Definition fbag1.h:51
Namespace for system defined sort fset.
Definition fset1.h:32
bool is_fset(const sort_expression &e)
Recogniser for sort expression FSet(s)
Definition fset1.h:49
function_symbol empty(const sort_expression &s)
Constructor for function symbol {}.
Definition fset1.h:72
container_sort fset(const sort_expression &s)
Constructor for sort expression FSet(S)
Definition fset1.h:38
Namespace for system defined sort list.
Definition list1.h:33
bool is_list(const sort_expression &e)
Recogniser for sort expression List(s)
Definition list1.h:50
Namespace for system defined sort set_.
Definition set1.h:33
bool is_set(const sort_expression &e)
Recogniser for sort expression Set(s)
Definition set1.h:50
function_symbol false_function(const sort_expression &s)
Constructor for function symbol @false_.
Definition set1.h:663
application constructor(const sort_expression &s, const data_expression &arg0, const data_expression &arg1)
Application of function symbol @set.
Definition set1.h:98
bool is_application(const data_expression &t)
Returns true if the term t is an application.
bool is_where_clause(const atermpp::aterm &x)
Returns true if the term t is a where clause.
bool is_abstraction(const atermpp::aterm &x)
Returns true if the term t is an abstraction.
application if_(const data_expression &arg0, const data_expression &arg1, const data_expression &arg2)
Application of function symbol if.
Definition standard.h:215
data_expression_vector enumerate_expressions(const sort_expression &s, const data_specification &dataspec, const Rewriter &rewr, enumerator_identifier_generator &id_generator)
Returns a vector with all expressions of sort s.
std::ostream & operator<<(std::ostream &out, const enumerator_list_element_with_substitution< Expression > &p)
Definition enumerator.h:481
bool is_simple_substitution(const enumerator_substitution &sigma)
bool is_forall(const atermpp::aterm &x)
Returns true if the term t is a universal quantification.
bool is_function_symbol(const atermpp::aterm &x)
Returns true if the term t is a function symbol.
std::set< data::variable > find_free_variables(const data::data_expression &x)
Definition data.cpp:98
bool is_exists(const atermpp::aterm &x)
Returns true if the term t is an existential quantification.
static bool is_enumerable(const data_specification &dataspec, const Rewriter &rewr, const sort_expression &sort)
Definition enumerator.h:220
bool is_function_sort(const atermpp::aterm &x)
Returns true if the term t is a function sort.
bool is_machine_number(const atermpp::aterm &x)
Returns true if the term t is a machine_number.
std::ostream & operator<<(std::ostream &out, const enumerator_list_element< Expression > &p)
Definition enumerator.h:465
bool is_lambda(const atermpp::aterm &x)
Returns true if the term t is a lambda abstraction.
data_expression_vector enumerate_expressions(const sort_expression &s, const data_specification &dataspec, const Rewriter &rewr)
Returns a vector with all expressions of sort s.
const data::data_expression & undefined_data_expression()
Returns a data expression that corresponds to 'undefined'.
Definition undefined.h:58
std::ostream & operator<<(std::ostream &out, const enumerator_substitution &sigma)
bool is_variable(const atermpp::aterm &x)
Returns true if the term t is a variable.
enumerator_replace_builder(const variable_list::const_iterator variables_begin, const variable_list::const_iterator variables_end, const data_expression_list::const_iterator expressions_begin)
const data_expression_list::const_iterator m_expressions_begin
bool operator()(const atermpp::aterm &t) const
Definition rewrite.cpp:37
void operator()(data_expression &result, const data_expression &t, Rewriter::substitution_type &sigma) const
data_expression operator()(const data_expression &t, Rewriter::substitution_type &sigma) const
void operator()(data_expression &result, const data_expression &t) const
data_expression operator()(const data_expression &t) const
Enumerator exception.
Definition enumerator.h:214
enumerator_error(const std::string &message)
Definition enumerator.h:215
Substitution that stores the assignments as a sequence of variables and a sequence of expressions....
enumerator_substitution(data::variable_list variables_, data::data_expression_list expressions_)
data::data_expression operator()(const data::variable &v) const
void add_assignment(const data::variable &v, const data::data_expression &e)
expression traits (currently nothing more than core::term_traits)
static const data_expression & false_()
static bool is_false(const data_expression &e)
static data_expression and_(const data_expression &e1, const data_expression &e2)
static const variable_list & variables(const data_expression &a)
static const data_expression & head(const data_expression &e)
static const data_expression & true_()
static data_expression replace_body(const data_expression &variable_binder, const data_expression &new_body)
static data_expression or_(const data_expression &e1, const data_expression &e2)
static bool is_application(const data_expression &e)
static const data_expression & body(const data_expression &a)
static bool is_true(const data_expression &e)
static bool is_abstraction(const data_expression &e)