3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 19:35:50 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-05-10 20:28:35 -07:00
parent 179c9c2da2
commit 99043399ce
3 changed files with 69 additions and 80 deletions

View file

@ -625,24 +625,6 @@ bool core::is_canonical_monic(lpvar j) const {
}
void core::explain_existing_lower_bound(new_lemma& lemma, lpvar j) {
SASSERT(has_lower_bound(j));
lemma &= m_lar_solver.get_column_lower_bound_witness(j);
}
void core::explain_existing_upper_bound(new_lemma& lemma, lpvar j) {
SASSERT(has_upper_bound(j));
lemma &= m_lar_solver.get_column_upper_bound_witness(j);
}
void core::explain_separation_from_zero(new_lemma& lemma, lpvar j) {
SASSERT(!val(j).is_zero());
if (val(j).is_pos())
explain_existing_lower_bound(lemma, j);
else
explain_existing_upper_bound(lemma, j);
}
void core::trace_print_monic_and_factorization(const monic& rm, const factorization& f, std::ostream& out) const {
out << "rooted vars: ";
print_product(rm.rvars(), out) << "\n";
@ -651,14 +633,6 @@ void core::trace_print_monic_and_factorization(const monic& rm, const factorizat
print_factorization(f, out << "fact: ") << "\n";
}
void core::explain_var_separated_from_zero(new_lemma& lemma, lpvar j) {
SASSERT(var_is_separated_from_zero(j));
if (m_lar_solver.column_has_upper_bound(j) && (m_lar_solver.get_upper_bound(j)< lp::zero_of_type<lp::impq>()))
lemma &= m_lar_solver.get_column_upper_bound_witness(j);
else
lemma &= m_lar_solver.get_column_lower_bound_witness(j);
}
bool core::var_has_positive_lower_bound(lpvar j) const {
return m_lar_solver.column_has_lower_bound(j) && m_lar_solver.get_lower_bound(j) > lp::zero_of_type<lp::impq>();
@ -1187,6 +1161,38 @@ new_lemma& new_lemma::explain_equiv(lpvar a, lpvar b) {
return *this;
}
new_lemma& new_lemma::explain_var_separated_from_zero(lpvar j) {
SASSERT(c.var_is_separated_from_zero(j));
if (c.m_lar_solver.column_has_upper_bound(j) &&
(c.m_lar_solver.get_upper_bound(j)< lp::zero_of_type<lp::impq>()))
*this &= c.m_lar_solver.get_column_upper_bound_witness(j);
else
*this &= c.m_lar_solver.get_column_lower_bound_witness(j);
return *this;
}
new_lemma& new_lemma::explain_existing_lower_bound(lpvar j) {
SASSERT(c.has_lower_bound(j));
*this &= c.m_lar_solver.get_column_lower_bound_witness(j);
return *this;
}
new_lemma& new_lemma::explain_existing_upper_bound(lpvar j) {
SASSERT(c.has_upper_bound(j));
*this &= c.m_lar_solver.get_column_upper_bound_witness(j);
return *this;
}
new_lemma& new_lemma::explain_separation_from_zero(lpvar j) {
SASSERT(!c.val(j).is_zero());
if (c.val(j).is_pos())
explain_existing_lower_bound(j);
else
explain_existing_upper_bound(j);
return *this;
}
std::ostream& new_lemma::display(std::ostream & out) const {
auto const& lemma = current();