16#ifndef MCRL2_DATA_LINEAR_INEQUALITY_H
17#define MCRL2_DATA_LINEAR_INEQUALITY_H
32data_expression
min(
const data_expression& e1,
const data_expression& e2,
const rewriter&);
33data_expression
max(
const data_expression& e1,
const data_expression& e2,
const rewriter&);
35bool is_negative(
const data_expression& e,
const rewriter& r);
36bool is_positive(
const data_expression& e,
const rewriter& r);
37bool is_zero(
const data_expression& e);
90class linear_inequality;
96inline std::string
pp(
const linear_inequality& l);
98inline std::string
pp_vector(
const TYPE& inequalities);
148 return atermpp::down_cast<variable>((*
this)[0]);
155 return atermpp::down_cast<data_expression>((*
this)[1]);
188 template <
class ITERATOR>
194 template <
class ITERATOR,
class TRANSFORMER>
202 return std::find_if(
begin(),
211 std::vector <variable_with_a_rational_factor> result;
214 if (p.variable_name()!=v)
219 return lhs_t(result.begin(),result.end());
245 template <
typename SubstitutionFunction>
249 bool result_defined=
false;
279 result=p.transform_to_data_expression();
283 result=
real_plus(result,p.transform_to_data_expression());
295 detail::map_based_lhs_t::iterator i=new_lhs.find(x);
296 if (i!=new_lhs.end())
311 std::vector<variable_with_a_rational_factor> result;
314 if (!inserted && x<=p.variable_name())
316 result.emplace_back(x,e);
318 if (x!=p.variable_name())
320 result.emplace_back(p.variable_name(),p.factor());
323 else result.emplace_back(p.variable_name(),p.factor());
327 result.emplace_back(x,e);
330 return lhs_t(result.begin(),result.end());
336 for(map_based_lhs_t::const_reverse_iterator i=lhs.rbegin(); i!=lhs.rend(); ++i)
347 for(map_based_lhs_t::const_reverse_iterator i=lhs.rbegin(); i!=lhs.rend(); ++i)
371 if (p.variable_name()<=last_variable_seen)
375 last_variable_seen=p.variable_name();
383 std::vector <variable_with_a_rational_factor> result;
386 if (p.variable_name()!=v)
391 return lhs_t(result.begin(),result.end());
403 template < application Operation(const data_expression&, const data_expression&) >
406 std::vector<detail::variable_with_a_rational_factor> result;
407 result.reserve(argument.
size());
412 return lhs_t(result.begin(),result.end());
417 template <
class OPERATION>
419 const lhs_t& argument2,
423 std::vector<detail::variable_with_a_rational_factor> result;
424 result.reserve(argument1.
size()+argument2.
size());
429 while (i1!=argument1.
end() && i2!=argument2.
end())
431 if (i1->variable_name()<i2->variable_name())
436 else if (i1->variable_name()>i2->variable_name())
443 assert(i1->variable_name()==i2->variable_name());
450 if (i1==argument1.
end())
452 while (i2!=argument2.
end())
460 while (i1!=argument1.
end())
466 return lhs_t(result.begin(),result.end());
471 return meta_operation_constant<real_plus>(argument,v,r);
476 return meta_operation_constant<real_minus>(argument, v, r);
481 return meta_operation_constant<real_times>(argument, v, r);
486 return meta_operation_constant<real_divides>(argument, v, r);
516 s=s + (i==lhs.
begin()?
"":
" + ") ;
520 s=s +
pp(i->variable_name());
524 s=s +
"-" +
pp(i->variable_name());
572 const bool negate =
false,
608 const variable& v = atermpp::down_cast<variable>(e);
611 throw mcrl2::runtime_error(
"Encountered a variable in a real expression which is not of sort real: " +
pp(e) +
"\n");
613 const detail::map_based_lhs_t::const_iterator var_factor = new_lhs.find(v);
616 const data_expression new_factor(var_factor == new_lhs.end() ? neg_factor :
real_plus(var_factor->second, neg_factor));
646 detail::linear_inequality_less():
647 (t==detail::less_eq?detail::linear_inequality_less_equal():detail::linear_inequality_equal())),
679 const bool negate=
false)
774 return atermpp::down_cast<detail::lhs_t>((*
this)[0]);
779 return atermpp::down_cast<data_expression>((*
this)[1]);
842 rhs_expression=
rhs();
860 lhs_expression=
real_plus(lhs_expression,e);
904 variable_set.insert(i->variable_name());
926 { return real_minus(d1,real_times(f,d2)); },r),
1026template <
class TYPE>
1033 s=s+ (first?
"":
", ") +
pp(l);
1041 const std::vector < linear_inequality >& inequalities_in,
1043 const bool use_cache=
true);
1049 const std::vector < linear_inequality >& inequalities,
1050 std::map < variable, std::size_t>& nr_positive_occurrences,
1051 std::map < variable, std::size_t>& nr_negative_occurrences,
1054 for (std::vector < linear_inequality >::const_iterator i=inequalities.begin();
1055 i!=inequalities.end(); ++i)
1061 nr_positive_occurrences[j->variable_name()]=nr_positive_occurrences[j->variable_name()]+1;
1065 nr_negative_occurrences[j->variable_name()]=nr_negative_occurrences[j->variable_name()]+1;
1071template <
class Variable_iterator >
1073 const std::vector < linear_inequality >& inequalities,
1074 std::vector < linear_inequality >& resulting_equalities,
1075 std::vector < linear_inequality >& resulting_inequalities,
1076 Variable_iterator variables_begin,
1077 Variable_iterator variables_end,
1093 const std::vector < linear_inequality >& inequalities,
1094 const std::vector < linear_inequality > :: iterator i,
1100 for (std::vector < linear_inequality >:: const_iterator j=inequalities.begin() ;
1101 j!=inequalities.end() ; ++j)
1161 const std::vector < linear_inequality >& inequalities,
1162 std::vector < linear_inequality >& resulting_inequalities,
1165 assert(resulting_inequalities.empty());
1166 if (inequalities.empty())
1178 resulting_inequalities=inequalities;
1179 for (std::size_t i=0; i<resulting_inequalities.size();)
1191 resulting_inequalities.begin()+i,
1201 resulting_inequalities.erase(resulting_inequalities.begin()+i);
1218 std::map < variable,data_expression >& beta,
1219 std::map < variable,data_expression >& beta_delta_correction,
1220 std::set < variable >& basic_variables,
1221 std::map < variable, detail::lhs_t >& working_equalities,
1229 beta_delta_correction[xi]=v_delta_correction;
1234 for (std::set < variable >::const_iterator k=basic_variables.begin();
1235 k!=basic_variables.end(); ++k)
1237 mCRL2log(
log::trace) <<
"Working equalities " << *k <<
": " <<
pp(working_equalities[*k]) <<
"\n";
1238 if ((*k!=xi) && (working_equalities[*k].count(xj)>0))
1247 basic_variables.erase(xi);
1248 basic_variables.insert(xj);
1251 expression_for_xj=expression_for_xj.
erase(xj);
1252 expression_for_xj=set_factor_for_a_variable(expression_for_xj,xi,
real_minus_one());
1256 working_equalities.erase(xi);
1258 for (std::map < variable, detail::lhs_t >::iterator j=working_equalities.begin();
1259 j!=working_equalities.end(); ++j)
1261 if (j->second.count(xj)>0)
1265 j->second=j->second.erase(xj);
1269 j->second=add(j->second,multiply(expression_for_xj,factor,r),r);
1273 working_equalities[xj]=expression_for_xj;
1277 for (std::map < variable, detail::lhs_t >::const_iterator i=working_equalities.begin();
1278 i!=working_equalities.end() ; ++i)
1287 for (std::map < variable,data_expression >::const_iterator i=beta.begin();
1290 mCRL2log(
log::trace) <<
"(1) beta[" <<
pp(i->first) <<
"]= " <<
pp(beta[i->first]) <<
"+ delta* " <<
pp(beta_delta_correction[i->first]) <<
"\n";
1292 for (std::map < variable, detail::lhs_t >::const_iterator i=working_equalities.begin();
1293 i!=working_equalities.end() ; ++i)
1304 class inequality_inconsistency_cache;
1305 class inequality_consistency_cache;
1375 std::set < linear_inequality > inequalities_in(inequalities_in_.begin(),inequalities_in_.end());
1403 std::set < linear_inequality > inequalities_in(inequalities_in_.begin(),inequalities_in_.end());
1409 while ((*current_root)->m_node==
intermediate_node && l>(*current_root)->m_inequality)
1411 current_root=&((*current_root)->m_non_present_branch);
1415 if (l==(*current_root)->m_inequality)
1417 current_root=&((*current_root)->m_present_branch);
1418 assert((*current_root)->m_node!=
intermediate_node || l<(*current_root)->m_inequality);
1425 *current_root=new_node;
1443 *current_root=new_node;
1452 assert(*current_root!=
nullptr);
1453 delete *current_root;
1483 bool is_consistent(
const std::vector < linear_inequality >& inequalities_in_)
const
1485 std::set < linear_inequality > inequalities_in(inequalities_in_.begin(),inequalities_in_.end());
1487 for(std::set < linear_inequality >::const_iterator i=inequalities_in.begin(); i!=inequalities_in.end(); ++i)
1515 std::set < linear_inequality > inequalities_in(inequalities_in_.begin(),inequalities_in_.end());
1521 while ((*current_root)->m_node==
intermediate_node && l>(*current_root)->m_inequality)
1523 current_root=&((*current_root)->m_non_present_branch);
1527 if (l==(*current_root)->m_inequality)
1529 current_root=&((*current_root)->m_present_branch);
1530 assert((*current_root)->m_node!=
intermediate_node || l<(*current_root)->m_inequality);
1537 *current_root=new_node;
1546 *current_root=new_node;
1571 const std::vector < linear_inequality >& inequalities_in,
1573 const bool use_cache)
1588 if (use_cache && consistency_cache.
is_consistent(inequalities_in))
1593 if (use_cache && inconsistency_cache.
is_inconsistent(inequalities_in))
1599 std::map < variable,data_expression > lowerbounds;
1600 std::map < variable,data_expression > upperbounds;
1601 std::map < variable,data_expression > beta;
1602 std::map < variable,data_expression > lowerbounds_delta_correction;
1603 std::map < variable,data_expression > upperbounds_delta_correction;
1604 std::map < variable,data_expression > beta_delta_correction;
1605 std::set < variable > non_basic_variables;
1606 std::set < variable > basic_variables;
1607 std::map < variable, detail::lhs_t > working_equalities;
1611 for (std::vector < linear_inequality >::const_iterator i=inequalities_in.begin();
1612 i!=inequalities_in.end(); ++i)
1616 mCRL2log(
log::trace) <<
"Inconsistent, because linear inequalities contains an inconsistent inequality\n";
1624 i->add_variables(non_basic_variables);
1626 j!=i->lhs_end(); ++j)
1632 std::vector < linear_inequality > inequalities;
1633 std::vector < linear_inequality > equalities;
1634 non_basic_variables=
1638 non_basic_variables.begin(),
1639 non_basic_variables.end(),
1642 assert(equalities.size()==0);
1643 non_basic_variables.clear();
1654 for (std::vector < linear_inequality >::iterator i=inequalities.begin();
1655 i!=inequalities.end(); ++i)
1660 mCRL2log(
log::trace) <<
"Inconsistent, because linear inequalities contains an inconsistent inequality after Gauss elimination\n";
1671 assert(i->lhs().size()>0);
1672 i->add_variables(non_basic_variables);
1674 if (i->lhs().size()==1)
1676 variable v=i->lhs_begin()->variable_name();
1683 if ((upperbounds.count(v)==0) ||
1686 upperbounds[v]=bound;
1687 upperbounds_delta_correction[v]=
1693 if (bound==upperbounds[v])
1695 upperbounds_delta_correction[v]=
1696 min(upperbounds_delta_correction[v],
1704 if ((lowerbounds.count(v)==0) ||
1707 lowerbounds[v]=bound;
1708 lowerbounds_delta_correction[v]=
1713 if (bound==lowerbounds[v])
1715 lowerbounds_delta_correction[v]=
1716 max(lowerbounds_delta_correction[v],
1727 basic_variables.insert(new_basic_variable);
1728 upperbounds[new_basic_variable]=i->rhs();
1729 upperbounds_delta_correction[new_basic_variable]=
1731 working_equalities[new_basic_variable]=i->lhs();
1732 mCRL2log(
log::trace) <<
"New slack variable: " <<
pp(new_basic_variable) <<
":=" <<
pp(*i) <<
" " <<
pp(i->lhs()) <<
"\n";
1739 for (std::set < variable >::const_iterator i=non_basic_variables.begin();
1740 i!=non_basic_variables.end(); ++i)
1742 if (lowerbounds.count(*i)>0)
1744 if ((upperbounds.count(*i)>0) &&
1746 ((upperbounds[*i]==lowerbounds[*i]) &&
1757 beta[*i]=lowerbounds[*i];
1758 beta_delta_correction[*i]=lowerbounds_delta_correction[*i];
1760 else if (upperbounds.count(*i)>0)
1762 beta[*i]=upperbounds[*i];
1763 beta_delta_correction[*i]=upperbounds_delta_correction[*i];
1770 mCRL2log(
log::trace) <<
"(2) beta[" <<
pp(*i) <<
"]=" <<
pp(beta[*i])<<
"+delta*" <<
pp(beta_delta_correction[*i]) <<
"\n";
1774 for (std::set < variable >::const_iterator i=basic_variables.begin();
1775 i!=basic_variables.end(); ++i)
1778 beta_delta_correction[*i]=working_equalities[*i].
1780 mCRL2log(
log::trace) <<
"(3) beta[" <<
pp(*i) <<
"]=" <<
pp(beta[*i])<<
"+delta*" <<
pp(beta_delta_correction[*i]) <<
"\n";
1792 bool lowerbound_violation =
false;
1794 for (std::set < variable > :: const_iterator i=basic_variables.begin() ;
1795 i!=basic_variables.end() ; ++i)
1802 if ((upperbounds.count(*i)>0) &&
1804 ((upperbounds[*i]==value) &&
1812 lowerbound_violation=
false;
1815 else if ((lowerbounds.count(*i)>0) &&
1817 ((lowerbounds[*i]==value) &&
1825 lowerbound_violation=
true;
1841 mCRL2log(
log::trace) <<
"The smallest basic variable that does not satisfy the bounds is " <<
pp(xi) <<
"\n";
1842 if (lowerbound_violation)
1850 const variable xj=xj_it->variable_name();
1853 ((upperbounds.count(xj)==0) ||
1857 ((lowerbounds.count(xj)==0) ||
1863 beta, beta_delta_correction,
1864 basic_variables,working_equalities,r);
1887 xj_it!=working_equalities[xi].end(); ++xj_it)
1889 const variable xj=xj_it->variable_name();
1892 ((upperbounds.count(xj)==0) ||
1896 ((lowerbounds.count(xj)==0) ||
1902 beta,beta_delta_correction,
1903 basic_variables,working_equalities,r);
1943template <
class Variable_iterator >
1945 const std::vector < linear_inequality >& inequalities,
1946 std::vector < linear_inequality >& resulting_equalities,
1947 std::vector < linear_inequality >& resulting_inequalities,
1948 Variable_iterator variables_begin,
1949 Variable_iterator variables_end,
1952 std::set < variable > remaining_variables;
1955 for (std::vector < linear_inequality > ::const_iterator j = inequalities.begin(); j != inequalities.end(); ++j)
1960 resulting_equalities.clear();
1961 resulting_inequalities.clear();
1963 return remaining_variables;
1965 else if (!j->is_true(r))
1969 resulting_equalities.push_back(*j);
1973 resulting_inequalities.push_back(*j);
1980 for (Variable_iterator i = variables_begin; i != variables_end; ++i)
1983 for (j=0; j<resulting_equalities.size(); ++j)
1985 bool check_equalities_for_redundant_inequalities(
false);
1986 std::set < variable > vars;
1987 resulting_equalities[j].add_variables(vars);
1988 if (vars.count(*i)>0)
1993 for (std::size_t k = 0; k < resulting_inequalities.size();)
1995 resulting_inequalities[k]=
subtract(resulting_inequalities[k],
1996 resulting_equalities[j],
1997 resulting_inequalities[k].get_factor_for_a_variable(*i),
1998 resulting_equalities[j].get_factor_for_a_variable(*i),
2000 if (resulting_inequalities[k].
is_false(r))
2003 resulting_equalities.clear();
2004 resulting_inequalities.clear();
2006 remaining_variables.clear();
2007 return remaining_variables;
2009 else if (resulting_inequalities[k].
is_true(r))
2012 if ((k+1)<resulting_inequalities.size())
2014 resulting_inequalities[k].swap(resulting_inequalities.back());
2016 resulting_inequalities.pop_back();
2024 for (std::size_t k = 0; k<resulting_equalities.size();)
2033 resulting_equalities[k],
2034 resulting_equalities[j],
2035 resulting_equalities[k].get_factor_for_a_variable(*i),
2036 resulting_equalities[j].get_factor_for_a_variable(*i),
2038 if (resulting_equalities[k].
is_false(r))
2041 resulting_equalities.clear();
2042 resulting_inequalities.clear();
2044 remaining_variables.clear();
2045 return remaining_variables;
2047 else if (resulting_equalities[k].
is_true(r))
2050 if (j+1==resulting_equalities.size())
2056 check_equalities_for_redundant_inequalities=
true;
2060 if ((k+1)<resulting_equalities.size())
2062 resulting_equalities[k].swap(resulting_equalities.back());
2064 resulting_equalities.pop_back();
2076 if (j+1<resulting_equalities.size())
2078 resulting_equalities[j].swap(resulting_equalities.back());
2080 resulting_equalities.pop_back();
2083 if (check_equalities_for_redundant_inequalities)
2085 for (std::size_t k = 0; k<resulting_equalities.size();)
2087 if (resulting_equalities[k].
is_true(r))
2090 if ((k+1)<resulting_equalities.size())
2092 resulting_equalities[k].swap(resulting_equalities.back());
2094 resulting_equalities.pop_back();
2104 remaining_variables.insert(*i);
2107 return remaining_variables;
2118 static std::map < data_expression, data_expression > rewrite_hash_table;
2119 std::map < data_expression, data_expression > :: iterator i=rewrite_hash_table.find(t);
2120 if (i==rewrite_hash_table.end())
2123 rewrite_hash_table.insert(std::make_pair(t, t1));
const_iterator end() const
Returns a const_iterator pointing past the last argument.
aterm()
Default constructor.
const_iterator begin() const
Returns an iterator pointing to the first argument.
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
size_type size() const
Returns the size of the term_list.
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const Term & front() const
Returns the first element of the list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
bool empty() const
Returns true if the list's size is 0.
void push_front(const Term &el)
Inserts a new element at the beginning of the current list.
term_list() noexcept
Default constructor. Creates an empty list.
An application of a data expression to a number of arguments.
sort_expression sort() const
Returns the sort of the data expression.
const_iterator begin() const
~inequality_consistency_cache()
inequality_consistency_cache()
void add_consistent_inequality_set(const std::vector< linear_inequality > &inequalities_in_)
inequality_consistency_cache & operator=(const inequality_consistency_cache &)=delete
inequality_consistency_cache(const inequality_consistency_cache &)=delete
inequality_inconsistency_cache_base * m_cache
bool is_consistent(const std::vector< linear_inequality > &inequalities_in_) const
inequality_inconsistency_cache_base & operator=(const inequality_inconsistency_cache_base &)=delete
inequality_inconsistency_cache_base * m_present_branch
linear_inequality m_inequality
inequality_inconsistency_cache_base * m_non_present_branch
inequality_inconsistency_cache_base(const node_type node, const linear_inequality &inequality, inequality_inconsistency_cache_base *present_branch, inequality_inconsistency_cache_base *non_present_branch)
~inequality_inconsistency_cache_base()
inequality_inconsistency_cache_base(const inequality_inconsistency_cache_base &)=delete
friend inequality_consistency_cache
inequality_inconsistency_cache_base(const node_type node)
friend inequality_inconsistency_cache
~inequality_inconsistency_cache()
bool is_inconsistent(const std::vector< linear_inequality > &inequalities_in_) const
inequality_inconsistency_cache()
inequality_inconsistency_cache & operator=(const inequality_consistency_cache &)=delete
inequality_inconsistency_cache_base * m_cache
inequality_inconsistency_cache(const inequality_inconsistency_cache &)=delete
void add_inconsistent_inequality_set(const std::vector< linear_inequality > &inequalities_in_)
lhs_t(const aterm &t)
Constructor from an aterm.
const data_expression & operator[](const variable &v) const
Give the factor of variable v.
data_expression transform_to_data_expression() const
lhs_t erase(const variable &v) const
Erase a variable and its factor.
std::size_t count(const variable &v) const
Give the factor of variable v.
lhs_t(const ITERATOR begin, const ITERATOR end, TRANSFORMER f)
Constructor.
data_expression evaluate(const SubstitutionFunction &beta, const rewriter &r) const
Evaluate the variables in this lhs_t according to the subsitution function.
lhs_t::const_iterator find(const variable &v) const
Give an iterator of the factor/variable pair for v, or end() if v does not occur.
lhs_t(const ITERATOR begin, const ITERATOR end)
Constructor.
variable_with_a_rational_factor(const variable &v, const data_expression &f)
const variable & variable_name() const
data_expression transform_to_data_expression() const
bool is_variable_with_a_rational_factor() const
const data_expression & factor() const
const detail::lhs_t & lhs() const
linear_inequality invert(const rewriter &r)
bool typical_pair(data_expression &lhs_expression, data_expression &rhs_expression, detail::comparison_t &comparison_operator, const rewriter &r) const
Return this inequality as a typical pair of terms of the form <x1+c2 x2+...+cn xn,...
linear_inequality()
Constructor yielding an inconsistent inequality.
bool is_true(const rewriter &r) const
void add_variables(std::set< variable > &variable_set) const
bool is_false(const rewriter &r) const
linear_inequality(const data_expression &e, const rewriter &r)
Constructor that constructs a linear inequality out of a data expression.
linear_inequality(const data_expression &lhs, const data_expression &rhs, const detail::comparison_t comparison, const rewriter &r, const bool negate=false)
constructor.
data_expression transform_to_data_expression() const
static void parse_and_store_expression(const data_expression &e, detail::map_based_lhs_t &new_lhs, data_expression &new_rhs, const rewriter &r, const bool negate=false, const data_expression &factor=real_one())
linear_inequality(const detail::lhs_t &lhs, const data_expression &r, detail::comparison_t t)
Basic constructor.
detail::lhs_t::const_iterator lhs_begin() const
detail::lhs_t::const_iterator lhs_end() const
linear_inequality(const detail::lhs_t &lhs, const data_expression &rhs, detail::comparison_t comparison, const rewriter &r)
constructor.
const data_expression & rhs() const
data_expression get_factor_for_a_variable(const variable &x)
detail::comparison_t comparison() const
Rewriter that operates on data expressions.
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
void add_identifier(const core::identifier_string &s) override
Adds the identifier s to the context.
const sort_expression & sort() const
Standard exception class for reporting runtime errors.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
add your file description here.
The main namespace for the aterm++ library.
atermpp::function_symbol linear_inequality_equal()
const lhs_t map_to_lhs_type(const map_based_lhs_t &lhs)
const lhs_t remove_variable_and_divide(const lhs_t &lhs, const variable &v, const data_expression &f, const rewriter &r)
atermpp::function_symbol linear_inequality_less()
void emplace_back_if_not_zero(std::vector< detail::variable_with_a_rational_factor > &r, const variable &v, const data_expression &f)
const lhs_t add(const data_expression &v, const lhs_t &argument, const rewriter &r)
bool is_well_formed(const lhs_t &lhs)
detail::comparison_t negate(const detail::comparison_t t)
std::map< variable, data_expression > map_based_lhs_t
atermpp::function_symbol linear_inequality_less_equal()
lhs_t meta_operation_lhs(const lhs_t &argument1, const lhs_t &argument2, OPERATION operation, const rewriter &r)
const lhs_t subtract(const lhs_t &argument, const data_expression &v, const rewriter &r)
std::string pp(const detail::lhs_t &lhs)
const lhs_t meta_operation_constant(const lhs_t &argument, const data_expression &v, const rewriter &r)
void set_factor_for_a_variable(detail::map_based_lhs_t &new_lhs, const variable &x, const data_expression &e)
const lhs_t multiply(const lhs_t &argument, const data_expression &v, const rewriter &r)
atermpp::function_symbol f_variable_with_a_rational_factor()
const lhs_t divide(const lhs_t &argument, const data_expression &v, const rewriter &r)
const function_symbol & false_()
Constructor for function symbol false.
const function_symbol & true_()
Constructor for function symbol true.
function_symbol plus(const sort_expression &s0, const sort_expression &s1)
function_symbol times(const sort_expression &s0, const sort_expression &s1)
function_symbol divides(const sort_expression &s0, const sort_expression &s1)
bool is_plus_application(const atermpp::aterm &e)
Recogniser for application of +.
function_symbol minus(const sort_expression &s0, const sort_expression &s1)
const basic_sort & real_()
Constructor for sort expression Real.
function_symbol abs(const sort_expression &s0)
bool is_times_application(const atermpp::aterm &e)
Recogniser for application of *.
function_symbol negate(const sort_expression &s0)
bool is_negate_application(const atermpp::aterm &e)
Recogniser for application of -.
bool is_minus_application(const atermpp::aterm &e)
Recogniser for application of -.
linear_inequality subtract(const linear_inequality &e1, const linear_inequality &e2, const data_expression &f1, const data_expression &f2, const rewriter &r)
Subtract the given equality, multiplied by f1/f2. The result is e1-(f1/f2)e2,.
bool is_greater_application(const DataExpression &e)
Recogniser for application of >
application real_times(const data_expression &arg0, const data_expression &arg1)
data_expression & real_one()
function_symbol less_equal(const sort_expression &s)
Constructor for function symbol <=.
const data_expression & binary_right(const application &x)
const data_expression & arg1(const data_expression &e)
Function for projecting out argument. arg1 from an application.
bool is_closed_real_number(const data_expression &e)
application real_plus(const data_expression &arg0, const data_expression &arg1)
data_expression & real_minus_one()
std::set< data::variable > find_all_variables(const data::data_expression &x)
function_symbol less(const sort_expression &s)
Constructor for function symbol <.
bool is_positive(const data_expression &e, const rewriter &r)
bool is_false(const data_expression &x)
Test if x is false.
application real_abs(const data_expression &arg)
void count_occurrences(const std::vector< linear_inequality > &inequalities, std::map< variable, std::size_t > &nr_positive_occurrences, std::map< variable, std::size_t > &nr_negative_occurrences, const rewriter &r)
bool is_greater_equal_application(const DataExpression &e)
Recogniser for application of >=.
std::string pp_vector(const TYPE &inequalities)
Print the vector of inequalities to stderr in readable form.
const data_expression & binary_left(const application &x)
void remove_redundant_inequalities(const std::vector< linear_inequality > &inequalities, std::vector< linear_inequality > &resulting_inequalities, const rewriter &r)
Remove every redundant inequality from a vector of inequalities.
application real_minus(const data_expression &arg0, const data_expression &arg1)
bool is_true(const data_expression &x)
Test if x is true.
std::string pp(const abstraction &x)
static void pivot_and_update(const variable &xi, const variable &xj, const data_expression &v, const data_expression &v_delta_correction, std::map< variable, data_expression > &beta, std::map< variable, data_expression > &beta_delta_correction, std::set< variable > &basic_variables, std::map< variable, detail::lhs_t > &working_equalities, const rewriter &r)
map_substitution< AssociativeContainer > make_map_substitution(const AssociativeContainer &m)
Utility function for creating a map_substitution.
application real_divides(const data_expression &arg0, const data_expression &arg1)
std::set< variable > gauss_elimination(const std::vector< linear_inequality > &inequalities, std::vector< linear_inequality > &resulting_equalities, std::vector< linear_inequality > &resulting_inequalities, Variable_iterator variables_begin, Variable_iterator variables_end, const rewriter &r)
Try to eliminate variables from a system of inequalities using Gauss elimination.
const data_expression & unary_operand1(const data_expression &x)
bool is_zero(const data_expression &e)
data_expression rewrite_with_memory(const data_expression &t, const rewriter &r)
data_expression & real_zero()
const data_expression & binary_right1(const data_expression &x)
bool is_a_redundant_inequality(const std::vector< linear_inequality > &inequalities, const std::vector< linear_inequality > ::iterator i, const rewriter &r)
Indicate whether an inequality from a set of inequalities is redundant.
application real_negate(const data_expression &arg)
bool is_inconsistent(const std::vector< linear_inequality > &inequalities_in, const rewriter &r, const bool use_cache=true)
Determine whether a list of data expressions is inconsistent.
const data_expression & binary_left1(const data_expression &x)
data_expression max(const data_expression &e1, const data_expression &e2, const rewriter &)
function_symbol equal_to(const sort_expression &s)
Constructor for function symbol ==.
bool is_negative(const data_expression &e, const rewriter &r)
bool is_less_application(const DataExpression &e)
Recogniser for application of <.
data_expression min(const data_expression &e1, const data_expression &e2, const rewriter &)
bool is_less_equal_application(const DataExpression &e)
Recogniser for application of <=.
bool is_equal_to_application(const DataExpression &e)
Recogniser for application of ==.
bool is_variable(const atermpp::aterm &x)
Returns true if the term t is a variable.
function_symbol greater(const sort_expression &s)
Constructor for function symbol >
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...