12#ifndef MCRL2_DATA_OPTIMIZED_BOOLEAN_OPERATORS_H
13#define MCRL2_DATA_OPTIMIZED_BOOLEAN_OPERATORS_H
27template <
typename TermTraits>
30 const typename TermTraits::term_type& arg,
33 typedef TermTraits tr;
39 else if (tr::is_false(arg))
43 else if (tr::is_not(arg))
45 result=tr::not_arg(arg);
49 tr::make_not_(result, arg);
57template <
typename TermTraits>
60 const typename TermTraits::term_type& left,
61 const typename TermTraits::term_type& right,
64 typedef TermTraits tr;
66 if (tr::is_true(left))
70 else if (tr::is_false(left))
74 else if (tr::is_true(right))
78 else if (tr::is_false(right))
82 else if (left == right)
88 tr::make_and_(result, left, right);
130template <
typename TermTraits>
133 const typename TermTraits::term_type& left,
134 const typename TermTraits::term_type& right, TermTraits)
136 typedef TermTraits tr;
138 if (tr::is_true(left))
142 else if (tr::is_false(left))
146 else if (tr::is_true(right))
150 else if (tr::is_false(right))
154 else if (left == right)
160 tr::make_or_(result, left, right);
168template <
typename TermTraits>
171 const typename TermTraits::term_type& left,
172 const typename TermTraits::term_type& right, TermTraits t)
174 typedef TermTraits tr;
176 if (tr::is_true(left))
180 else if (tr::is_false(left))
184 else if (tr::is_true(right))
188 else if (tr::is_false(right))
192 else if (left == right)
198 tr::make_imp(result, left, right);
210template <
typename TermTraits>
213 const typename TermTraits::variable_sequence_type& v,
214 const typename TermTraits::term_type& arg,
215 bool remove_variables,
216 bool empty_domain_allowed, TermTraits)
218 typedef TermTraits tr;
222 if (empty_domain_allowed)
224 result = tr::true_();
231 else if (tr::is_true(arg))
233 result = tr::true_();
235 else if (tr::is_false(arg))
237 result = tr::false_();
241 if (remove_variables)
244 if (variables.
empty())
250 tr::make_forall(result, variables, arg);
255 tr::make_forall(result, v, arg);
268template <
typename TermTraits>
271 const typename TermTraits::variable_sequence_type& v,
272 const typename TermTraits::term_type& arg,
273 bool remove_variables,
274 bool empty_domain_allowed,
277 typedef TermTraits tr;
281 if (empty_domain_allowed)
283 result = tr::false_();
290 else if (tr::is_true(arg))
292 result = tr::true_();
294 else if (tr::is_false(arg))
296 result = tr::false_();
300 if (remove_variables)
303 if (variables.
empty())
309 result = tr::exists(variables, arg);
314 result = tr::exists(v, arg);
525template <
typename Term>
536template <
typename Term>
558template <
typename Term>
569template <
typename Term>
581template <
typename Term,
typename VariableSequence>
583void optimized_forall(Term& result,
const VariableSequence& l,
const Term& p,
bool remove_variables =
false)
585 bool empty_domain_allowed =
true;
595template <
typename Term,
typename VariableSequence>
599 bool empty_domain_allowed =
false;
608template <
typename Term,
typename VariableSequence>
610void optimized_exists(Term& result,
const VariableSequence& l,
const Term& p,
bool remove_variables =
false)
612 bool empty_domain_allowed =
true;
622template <
typename Term,
typename VariableSequence>
626 bool empty_domain_allowed =
false;
bool empty() const
Returns true if the list's size is 0.
add your file description here.
void optimized_forall(typename TermTraits::term_type &result, const typename TermTraits::variable_sequence_type &v, const typename TermTraits::term_type &arg, bool remove_variables, bool empty_domain_allowed, TermTraits)
Make a universal quantification.
void optimized_exists(typename TermTraits::term_type &result, const typename TermTraits::variable_sequence_type &v, const typename TermTraits::term_type &arg, bool remove_variables, bool empty_domain_allowed, TermTraits)
Make an existential quantification.
void optimized_or(typename TermTraits::term_type &result, const typename TermTraits::term_type &left, const typename TermTraits::term_type &right, TermTraits)
Make a disjunction.
variable_list set_intersection(const variable_list &x, const variable_list &y)
Returns the intersection of two unordered sets, that are stored in ATerm lists.
void optimized_imp(typename TermTraits::term_type &result, const typename TermTraits::term_type &left, const typename TermTraits::term_type &right, TermTraits t)
Make an implication.
void optimized_not(typename TermTraits::term_type &result, const typename TermTraits::term_type &arg, TermTraits)
void optimized_and(typename TermTraits::term_type &result, const typename TermTraits::term_type &left, const typename TermTraits::term_type &right, TermTraits)
Make a conjunction and optimize it if possible.
variable_list free_variables(const data_expression &x)
void optimized_exists_no_empty_domain(Term &result, const VariableSequence &l, const Term &p, bool remove_variables=false)
Make an existential quantification.
void optimized_exists(Term &result, const VariableSequence &l, const Term &p, bool remove_variables=false)
Make an existential quantification.
void optimized_or(Term &result, const Term &p, const Term &q)
Make a conjunction, and optimize if possible.
void optimized_imp(Term &result, const Term &p, const Term &q)
Make an implication.
void optimized_forall_no_empty_domain(Term &result, const VariableSequence &l, const Term &p, bool remove_variables=false)
Make a universal quantification.
void optimized_not(Term &result, const Term &arg)
Make a negation.
void optimized_and(Term &result, const Term &p, const Term &q)
Make a conjunction, and optimize if possible.
void optimized_forall(Term &result, const VariableSequence &l, const Term &p, bool remove_variables=false)
Make a universal quantification.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Contains type information for terms.
Traits class for (boolean) terms.