3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

add a unit test for monics, plus some cosmetic changes

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2020-03-12 18:22:53 -07:00
parent 0207878f5f
commit 26631ce38d
5 changed files with 103 additions and 6 deletions

View file

@ -1705,7 +1705,7 @@ bool lar_solver::all_vars_are_registered(const vector<std::pair<mpq, var_index>>
return true;
}
// do not register this term if ext_i == -1
// do not register this term if ext_i == UINT_MAX
var_index lar_solver::add_term(const vector<std::pair<mpq, var_index>> & coeffs, unsigned ext_i) {
TRACE("lar_solver_terms", print_linear_combination_of_column_indices_only(coeffs, tout) << ", ext_i =" << ext_i << "\n";);
m_term_register.add_var(ext_i, term_is_int(coeffs));
@ -2370,7 +2370,7 @@ std::pair<constraint_index, constraint_index> lar_solver::add_equality(lpvar j,
vector<std::pair<mpq, var_index>> coeffs;
coeffs.push_back(std::make_pair(mpq(1),j));
coeffs.push_back(std::make_pair(mpq(-1),k));
unsigned term_index = add_term(coeffs, -1); // -1 is the external null var
unsigned term_index = add_term(coeffs, UINT_MAX); // UINT_MAX is the external null var
return std::pair<constraint_index, constraint_index>(
add_var_bound(term_index, lconstraint_kind::LE, mpq(0)),
add_var_bound(term_index, lconstraint_kind::GE, mpq(0)));

View file

@ -586,10 +586,14 @@ public:
std::ostream& print_column_info(unsigned j, std::ostream& out) const {
m_mpq_lar_core_solver.m_r_solver.print_column_info(j, out);
if( !column_corresponds_to_term(j))
return out;
const lar_term& t = * m_terms[m_var_register.local_to_external(j) - m_terms_start_index];
print_term_as_indices(t, out) << "\n";
if (is_term(j)) {
const lar_term& t = * m_terms[j - m_terms_start_index];
print_term_as_indices(t, out) << "\n";
} else if(column_corresponds_to_term(j)) {
const lar_term& t = * m_terms[m_var_register.local_to_external(j) - m_terms_start_index];
print_term_as_indices(t, out) << "\n";
}
return out;
}

View file

@ -108,6 +108,8 @@ public:
\brief merge equivalence classes for v1, v2 with justification j
*/
void merge(signed_var v1, signed_var v2, eq_justification const& j) {
if (v1 == v2)
return;
unsigned max_i = std::max(v1.index(), v2.index()) + 2;
m_eqs.reserve(max_i);
while (m_uf.get_num_vars() <= max_i) m_uf.mk_var();