3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 09:34:08 +00:00
This commit is contained in:
Nikolaj Bjorner 2020-05-06 12:56:46 -07:00
parent 603b5552fa
commit 691759c9e2
3 changed files with 13 additions and 4 deletions

View file

@ -473,6 +473,14 @@ interval & interval::operator*=(interval const & other) {
return *this;
}
bool interval::empty() const {
if (m_lower.is_infinite() || m_upper.is_infinite())
return false;
if (m_lower < m_upper)
return false;
return m_lower > m_upper || m_lower_open || m_upper_open;
}
bool interval::contains_zero() const {
TRACE("interval_zero_bug", tout << "contains_zero info: " << *this << "\n";
tout << "m_lower.is_neg(): " << m_lower.is_neg() << "\n";

View file

@ -102,6 +102,7 @@ public:
bool operator==(old_interval const & other) const { return m_lower == other.m_lower && m_upper == other.m_upper && m_lower_open == other.m_lower_open && m_upper_open == other.m_upper_open; }
bool contains_zero() const;
bool contains(rational const& v) const;
bool empty() const;
old_interval & inv();
void expt(unsigned n);
void neg();

View file

@ -226,23 +226,23 @@ interval theory_arith<Ext>::mk_interval_for(theory_var v) {
}
return interval(m_dep_manager,
l->get_value().get_rational().to_rational(),
!l->get_value().get_infinitesimal().to_rational().is_zero(),
l->get_value().get_infinitesimal().to_rational().is_pos(),
m_dep_manager.mk_leaf(l),
u->get_value().get_rational().to_rational(),
!u->get_value().get_infinitesimal().to_rational().is_zero(),
u->get_value().get_infinitesimal().to_rational().is_neg(),
m_dep_manager.mk_leaf(u));
}
else if (l) {
return interval(m_dep_manager,
l->get_value().get_rational().to_rational(),
!l->get_value().get_infinitesimal().to_rational().is_zero(),
l->get_value().get_infinitesimal().to_rational().is_pos(),
true,
m_dep_manager.mk_leaf(l));
}
else if (u) {
return interval(m_dep_manager,
u->get_value().get_rational().to_rational(),
!u->get_value().get_infinitesimal().to_rational().is_zero(),
u->get_value().get_infinitesimal().to_rational().is_neg(),
false,
m_dep_manager.mk_leaf(u));
}