mirror of
https://github.com/Z3Prover/z3
synced 2025-07-20 03:12:03 +00:00
create helper functions
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
be0129407c
commit
9db5b3d658
1 changed files with 20 additions and 17 deletions
|
@ -369,6 +369,10 @@ struct solver::imp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ineq_j_is_equal_to_zero_add_to_lemma(lpvar j) {
|
||||||
|
m_lemma->push_back(ineq_j_is_equal_to_zero(j));
|
||||||
|
}
|
||||||
|
|
||||||
ineq ineq_j_is_equal_to_zero(lpvar j) const {
|
ineq ineq_j_is_equal_to_zero(lpvar j) const {
|
||||||
lp::lar_term t;
|
lp::lar_term t;
|
||||||
t.add_coeff_var(rational(1), j);
|
t.add_coeff_var(rational(1), j);
|
||||||
|
@ -376,6 +380,17 @@ struct solver::imp {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ineq_j_is_nequal_to_zero_add_to_lemma(lpvar j) {
|
||||||
|
m_lemma->push_back(ineq_j_is_nequal_to_zero(j));
|
||||||
|
}
|
||||||
|
|
||||||
|
ineq ineq_j_is_nequal_to_zero(lpvar j) const {
|
||||||
|
lp::lar_term t;
|
||||||
|
t.add_coeff_var(rational(1), j);
|
||||||
|
ineq i(lp::lconstraint_kind::NE, t, rational::zero());
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
bool var_is_fixed_to_zero(lpvar j) const {
|
bool var_is_fixed_to_zero(lpvar j) const {
|
||||||
return
|
return
|
||||||
m_lar_solver.column_has_upper_bound(j) &&
|
m_lar_solver.column_has_upper_bound(j) &&
|
||||||
|
@ -953,18 +968,11 @@ struct solver::imp {
|
||||||
lpvar mon_var = m_monomials[i_mon].var();
|
lpvar mon_var = m_monomials[i_mon].var();
|
||||||
if (!vvr(mon_var).is_zero() )
|
if (!vvr(mon_var).is_zero() )
|
||||||
return false;
|
return false;
|
||||||
for (lpvar j : f) {
|
|
||||||
if (vvr(j).is_zero())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
lp::lar_term t;
|
|
||||||
t.add_coeff_var(mon_var);
|
|
||||||
SASSERT(m_lemma->empty());
|
SASSERT(m_lemma->empty());
|
||||||
m_lemma->push_back(ineq(lp::lconstraint_kind::NE, t, rational::zero()));
|
ineq_j_is_nequal_to_zero_add_to_lemma(mon_var);
|
||||||
for (lpvar j : f) {
|
for (lpvar j : f) {
|
||||||
t.clear();
|
m_lemma->push_back(ineq_j_is_equal_to_zero(j));
|
||||||
t.add_coeff_var(rational::one(), j);
|
|
||||||
m_lemma->push_back(ineq(lp::lconstraint_kind::EQ, t, rational::zero()));
|
|
||||||
}
|
}
|
||||||
expl_set e;
|
expl_set e;
|
||||||
add_explanation_of_factorization(i_mon, f, e);
|
add_explanation_of_factorization(i_mon, f, e);
|
||||||
|
@ -1000,13 +1008,8 @@ struct solver::imp {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lp::lar_term t;
|
ineq_j_is_nequal_to_zero_add_to_lemma(zero_j);
|
||||||
t.add_coeff_var(zero_j);
|
ineq_j_is_equal_to_zero_add_to_lemma(m_monomials[i_mon].var());
|
||||||
SASSERT(m_lemma->empty());
|
|
||||||
m_lemma->push_back(ineq(lp::lconstraint_kind::NE, t, rational::zero()));
|
|
||||||
t.clear();
|
|
||||||
t.add_coeff_var(m_monomials[i_mon].var());
|
|
||||||
m_lemma->push_back(ineq(lp::lconstraint_kind::EQ, t, rational::zero()));
|
|
||||||
|
|
||||||
expl_set e;
|
expl_set e;
|
||||||
add_explanation_of_factorization(i_mon, f, e);
|
add_explanation_of_factorization(i_mon, f, e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue