mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 08:35:31 +00:00
if you are really reading this commit message, you must be a programmer who has no life.
This commit is contained in:
parent
a5fdf6ba8a
commit
de424713e4
6 changed files with 33 additions and 16 deletions
|
@ -81,7 +81,7 @@ namespace polysat {
|
|||
}
|
||||
else {
|
||||
SASSERT(c.is_currently_false(s));
|
||||
SASSERT(c.bvalue(s) == l_true);
|
||||
// TBD: fails with test_subst SASSERT(c.bvalue(s) == l_true);
|
||||
c->set_var_dependent();
|
||||
insert(c);
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ namespace polysat {
|
|||
* The clause is conflicting in the current search state.
|
||||
*/
|
||||
void conflict::set(clause const& cl) {
|
||||
if (!empty())
|
||||
return;
|
||||
LOG("Conflict: " << cl);
|
||||
SASSERT(empty());
|
||||
for (auto lit : cl)
|
||||
|
|
|
@ -369,7 +369,7 @@ namespace polysat {
|
|||
rational const& a2, pdd const& b2, pdd const& e2,
|
||||
eval_interval& interval, vector<signed_constraint>& side_cond) {
|
||||
if (a1.is_odd() && a2.is_zero() && b2.val().is_zero()) {
|
||||
push_eq(false, e2, side_cond);
|
||||
push_eq(true, e2, side_cond);
|
||||
rational a_inv, pow2 = e1.manager().max_value() + 1;
|
||||
VERIFY(a1.mult_inverse(e1.manager().power_of_2(), a_inv));
|
||||
auto lo = -e1 * a_inv;
|
||||
|
|
|
@ -77,6 +77,9 @@ namespace polysat {
|
|||
if (!c.is_currently_false(s) && c.bvalue(s) != l_false)
|
||||
return false;
|
||||
|
||||
if (c.bvalue(s) == l_true)
|
||||
return false;
|
||||
|
||||
// avoid loops
|
||||
if (core.contains(~c))
|
||||
return false;
|
||||
|
|
|
@ -125,13 +125,15 @@ namespace polysat {
|
|||
m_constraints.ensure_bvar(c.get());
|
||||
sat::literal lit = c.blit();
|
||||
LOG("New constraint: " << c);
|
||||
if (m_bvars.is_false(lit) || c.is_currently_false(*this)) {
|
||||
set_conflict(c /*, dep */);
|
||||
return;
|
||||
if (m_bvars.is_false(lit))
|
||||
set_conflict(c);
|
||||
else {
|
||||
m_bvars.asserted(lit, m_level, dep);
|
||||
m_trail.push_back(trail_instr_t::assign_bool_i);
|
||||
m_search.push_boolean(lit);
|
||||
if (c.is_currently_false(*this))
|
||||
set_conflict(c);
|
||||
}
|
||||
m_bvars.asserted(lit, m_level, dep);
|
||||
m_trail.push_back(trail_instr_t::assign_bool_i);
|
||||
m_search.push_boolean(lit);
|
||||
|
||||
#if ENABLE_LINEAR_SOLVER
|
||||
m_linear_solver.new_constraint(*c.get());
|
||||
|
@ -577,6 +579,13 @@ namespace polysat {
|
|||
/**
|
||||
* Revert a decision that caused a conflict.
|
||||
* Variable v was assigned by a decision at position i in the search stack.
|
||||
*
|
||||
* C & v = val is conflict.
|
||||
*
|
||||
* C => v != val
|
||||
*
|
||||
* l1 \/ l2 \/ ... \/ lk \/ v != val
|
||||
*
|
||||
*/
|
||||
void solver::revert_decision(pvar v) {
|
||||
rational val = m_value[v];
|
||||
|
@ -594,7 +603,11 @@ namespace polysat {
|
|||
|
||||
// The justification for this restriction is the guessed constraint from the lemma.
|
||||
// cjust[v] will be updated accordingly by decide_bool.
|
||||
m_viable.add_non_viable(v, val);
|
||||
// m_viable.add_non_viable(v, val);
|
||||
// TBD: review with Jakob: add_non_viable seems redundant. The lemma contains the disjunction that v != val
|
||||
// other literals in the lemma could be chosen, but they prune decisions further down.
|
||||
// when the v != val literal is selected the viability constraint gets asserted.
|
||||
|
||||
learn_lemma(v, *lemma);
|
||||
|
||||
if (!is_conflict())
|
||||
|
|
|
@ -10,7 +10,6 @@ Author:
|
|||
Nikolaj Bjorner (nbjorner) 2021-03-19
|
||||
Jakob Rath 2021-04-6
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
|
@ -46,13 +45,12 @@ namespace polysat {
|
|||
|
||||
void viable2::push_viable() {
|
||||
auto& [v, e] = m_trail.back();
|
||||
SASSERT(e->prev() != e || !m_viable[v]);
|
||||
SASSERT(e->prev() != e || e->next() == e);
|
||||
if (e->prev() != e)
|
||||
e->prev()->insert_after(e);
|
||||
else {
|
||||
SASSERT(!m_viable[v]);
|
||||
SASSERT(e->next() == e);
|
||||
m_viable[v] = e;
|
||||
}
|
||||
else
|
||||
m_viable[v] = e;
|
||||
m_trail.pop_back();
|
||||
}
|
||||
|
||||
|
|
|
@ -1071,11 +1071,12 @@ void tst_polysat() {
|
|||
// polysat::test_ineq_axiom2();
|
||||
// polysat::test_ineq_axiom3();
|
||||
// polysat::test_ineq_non_axiom1();
|
||||
#if 0
|
||||
polysat::test_ineq_non_axiom4(32, 5);
|
||||
polysat::test_ineq_axiom4();
|
||||
polysat::test_ineq_axiom5();
|
||||
polysat::test_ineq_axiom6();
|
||||
|
||||
#endif
|
||||
|
||||
// working
|
||||
// NOT: polysat::test_fixed_point_arith_mul_div_inverse();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue