3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

pass sign into literal definition for pbge

This commit is contained in:
Nikolaj Bjorner 2023-01-04 16:55:44 -08:00
parent 81ce57b5a8
commit 0d8a472aac
4 changed files with 12 additions and 12 deletions

View file

@ -113,13 +113,13 @@ namespace pb {
k1 += wl.first;
}
}
add_pb_ge(sat::null_bool_var, wlits, k1);
add_pb_ge(sat::null_bool_var, sign, wlits, k1);
return sat::null_literal;
}
else {
bool_var v = s().add_var(true);
literal lit(v, sign);
add_pb_ge(v, wlits, k.get_unsigned());
add_pb_ge(v, sign, wlits, k.get_unsigned());
TRACE("ba", tout << "root: " << root << " lit: " << lit << "\n";);
return lit;
}
@ -140,13 +140,13 @@ namespace pb {
k1 += wl.first;
}
}
add_pb_ge(sat::null_bool_var, wlits, k1);
add_pb_ge(sat::null_bool_var, sign, wlits, k1);
return sat::null_literal;
}
else {
sat::bool_var v = s().add_var(true);
sat::literal lit(v, sign);
add_pb_ge(v, wlits, k.get_unsigned());
add_pb_ge(v, sign, wlits, k.get_unsigned());
TRACE("goal2sat", tout << "root: " << root << " lit: " << lit << "\n";);
return lit;
}
@ -160,14 +160,14 @@ namespace pb {
bool base_assert = (root && !sign && s().num_user_scopes() == 0);
bool_var v1 = base_assert ? sat::null_bool_var : s().add_var(true);
bool_var v2 = base_assert ? sat::null_bool_var : s().add_var(true);
add_pb_ge(v1, wlits, k.get_unsigned());
add_pb_ge(v1, false, wlits, k.get_unsigned());
k.neg();
for (wliteral& wl : wlits) {
wl.second.neg();
k += rational(wl.first);
}
check_unsigned(k);
add_pb_ge(v2, wlits, k.get_unsigned());
add_pb_ge(v2, false, wlits, k.get_unsigned());
if (base_assert) {
return sat::null_literal;
}

View file

@ -1472,8 +1472,8 @@ namespace pb {
return p;
}
void solver::add_pb_ge(bool_var v, svector<wliteral> const& wlits, unsigned k) {
literal lit = v == sat::null_bool_var ? sat::null_literal : literal(v, false);
void solver::add_pb_ge(bool_var v, bool sign, svector<wliteral> const& wlits, unsigned k) {
literal lit = v == sat::null_bool_var ? sat::null_literal : literal(v, sign);
add_pb_ge(lit, wlits, k, m_is_redundant);
}

View file

@ -371,7 +371,7 @@ namespace pb {
~solver() override;
void set_lookahead(sat::lookahead* l) override { m_lookahead = l; }
void add_at_least(bool_var v, literal_vector const& lits, unsigned k);
void add_pb_ge(bool_var v, svector<wliteral> const& wlits, unsigned k);
void add_pb_ge(bool_var v, bool sign, svector<wliteral> const& wlits, unsigned k);
bool is_external(bool_var v) override;
bool propagated(literal l, sat::ext_constraint_idx idx) override;

View file

@ -51,7 +51,7 @@ struct tactic_report::imp {
<< " :time " << std::fixed << std::setprecision(2) << m_watch.get_seconds()
<< " :before-memory " << std::fixed << std::setprecision(2) << m_start_memory
<< " :after-memory " << std::fixed << std::setprecision(2) << end_memory
<< ")" << std::endl);
<< ")\n");
IF_VERBOSE(20, m_goal.display(verbose_stream() << m_id << "\n"));
SASSERT(m_goal.is_well_formed());
}
@ -71,7 +71,7 @@ tactic_report::~tactic_report() {
void report_tactic_progress(char const * id, unsigned val) {
if (val > 0) {
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(" << id << " " << val << ")" << std::endl;);
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(" << id << " " << val << ")\n");
}
}
@ -166,7 +166,7 @@ void exec(tactic & t, goal_ref const & in, goal_ref_buffer & result) {
t.cleanup();
}
catch (tactic_exception & ex) {
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(tactic-exception \"" << escaped(ex.msg()) << "\")" << std::endl;);
IF_VERBOSE(TACTIC_VERBOSITY_LVL, verbose_stream() << "(tactic-exception \"" << escaped(ex.msg()) << "\")\n");
t.cleanup();
throw ex;
}