3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 19:35:50 +00:00

generate lemmas from nla_intervals

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-06-14 17:32:07 -07:00
parent c121c5d2d8
commit 3f6ecfb3b6
13 changed files with 292 additions and 408 deletions

View file

@ -30,7 +30,7 @@ namespace lp {
template <typename C> // C plays a role of a container
class bound_analyzer_on_row {
const C& m_row;
lp_bound_propagator & m_bp;
lp_bound_propagator & m_bp;
unsigned m_row_or_term_index;
int m_column_of_u; // index of an unlimited from above monoid
// -1 means that such a value is not found, -2 means that at least two of such monoids were found
@ -55,8 +55,9 @@ public :
m_rs(rs)
{}
unsigned j;
void analyze() {
TRACE("lp_bound_prop", print_linear_combination_of_column_indices_only(m_row, tout); tout << " = " << m_rs << "\n";);
for (const auto & c : m_row) {
if ((m_column_of_l == -2) && (m_column_of_u == -2))
break;
@ -79,53 +80,86 @@ public :
}
bool upper_bound_is_available(unsigned j) const {
return m_bp.upper_bound_is_available(j);
switch (m_bp.get_column_type(j))
{
case column_type::fixed:
case column_type::boxed:
case column_type::upper_bound:
return true;
default:
return false;
}
}
bool lower_bound_is_available(unsigned j) const {
return m_bp.lower_bound_is_available(j);
switch (m_bp.get_column_type(j))
{
case column_type::fixed:
case column_type::boxed:
case column_type::lower_bound:
return true;
default:
return false;
}
}
impq ub(unsigned j) const {
const impq & ub(unsigned j) const {
lp_assert(upper_bound_is_available(j));
return m_bp.get_upper_bound(j);
}
impq lb(unsigned j) const {
const impq & lb(unsigned j) const {
lp_assert(lower_bound_is_available(j));
return m_bp.get_lower_bound(j);
}
mpq u_strict(unsigned j, bool & strict) const {
const impq u = ub(j);
strict = !is_zero(u.y);
return u.x;
}
mpq l_strict(unsigned j, bool & strict) const {
const impq l = lb(j);
strict = !is_zero(l.y);
return l.x;
}
mpq monoid_max_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
return a_is_pos? u_strict(j, strict) : l_strict(j, strict);
const mpq & monoid_max_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
if (a_is_pos) {
strict = !is_zero(ub(j).y);
return ub(j).x;
}
strict = !is_zero(lb(j).y);
return lb(j).x;
}
mpq monoid_max(const mpq & a, unsigned j) const {
return a * (is_pos(a) ? ub(j).x : lb(j).x);
if (is_pos(a)) {
return a * ub(j).x;
}
return a * lb(j).x;
}
mpq monoid_max(const mpq & a, unsigned j, bool & strict) const {
return a * (is_pos(a)? u_strict(j, strict) : l_strict(j, strict));
if (is_pos(a)) {
strict = !is_zero(ub(j).y);
return a * ub(j).x;
}
strict = !is_zero(lb(j).y);
return a * lb(j).x;
}
mpq monoid_min_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
return a_is_pos? l_strict(j, strict) : u_strict(j, strict);
const mpq & monoid_min_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
if (!a_is_pos) {
strict = !is_zero(ub(j).y);
return ub(j).x;
}
strict = !is_zero(lb(j).y);
return lb(j).x;
}
mpq monoid_min(const mpq & a, unsigned j, bool& strict) const {
return a * (is_neg(a)? u_strict(j, strict) : l_strict(j, strict));
if (is_neg(a)) {
strict = !is_zero(ub(j).y);
return a * ub(j).x;
}
strict = !is_zero(lb(j).y);
return a * lb(j).x;
}
mpq monoid_min(const mpq & a, unsigned j) const {
return a * (is_neg(a)? ub(j).x : lb(j).x );
if (is_neg(a)) {
return a * ub(j).x;
}
return a * lb(j).x;
}