mirror of
https://github.com/Z3Prover/z3
synced 2025-08-24 03:57:51 +00:00
fixes, tests
This commit is contained in:
parent
e6c413b249
commit
a574eebd05
9 changed files with 110 additions and 48 deletions
|
@ -14,10 +14,6 @@ Notes:
|
|||
|
||||
TODO: try a final core reduction step or other core minimization
|
||||
|
||||
TODO: If we have e.g. 4x+y=2 and y=0, then we have a conflict no matter the value of x, so we should drop x=? from the core.
|
||||
(works currently if x is unassigned; for other cases we would need extra info from constraint::is_currently_false)
|
||||
note that we may have added too many variables: e.g., y disappears in x*y if x=0
|
||||
|
||||
TODO: revert(pvar v) is too weak.
|
||||
It should apply saturation rules currently only available for propagated values.
|
||||
|
||||
|
@ -134,16 +130,22 @@ namespace polysat {
|
|||
}
|
||||
|
||||
|
||||
// NOTE: maybe we should skip intermediate steps and just collect the leaf premises for c?
|
||||
// Ensure that c is assigned and justified
|
||||
/**
|
||||
* Premises can either be justified by a Clause or by a value assignment.
|
||||
* Premises that are justified by value assignments are not assigned (the bvalue is l_undef)
|
||||
* The justification for those premises are based on the free assigned variables.
|
||||
*
|
||||
* NOTE: maybe we should skip intermediate steps and just collect the leaf premises for c?
|
||||
* Ensure that c is assigned and justified
|
||||
*/
|
||||
void conflict::insert(signed_constraint c, vector<signed_constraint> const& premises) {
|
||||
insert(c);
|
||||
keep(c);
|
||||
clause_builder c_lemma(s);
|
||||
for (auto premise : premises) {
|
||||
LOG_H3("premise: " << premise);
|
||||
keep(premise);
|
||||
SASSERT(premise->has_bvar());
|
||||
SASSERT(premise.bvalue(s) == l_true);
|
||||
SASSERT(premise.bvalue(s) != l_false);
|
||||
c_lemma.push(~premise.blit());
|
||||
}
|
||||
c_lemma.push(c.blit());
|
||||
|
@ -278,15 +280,21 @@ namespace polysat {
|
|||
return true;
|
||||
}
|
||||
|
||||
std::cout << "vars " << m_vars << " contains: " << m_vars.contains(v) << "\n";
|
||||
|
||||
m_vars.remove(v);
|
||||
|
||||
for (auto c : cjust_v)
|
||||
insert(c);
|
||||
|
||||
std::cout << "try explain v" << v << "\n";
|
||||
|
||||
for (auto* engine : ex_engines)
|
||||
if (engine->try_explain(v, *this))
|
||||
return true;
|
||||
|
||||
std::cout << "try elim v" << v << "\n";
|
||||
|
||||
// No value resolution method was successful => fall back to saturation and variable elimination
|
||||
while (s.inc()) {
|
||||
// TODO: as a last resort, substitute v by m_value[v]?
|
||||
|
@ -296,7 +304,9 @@ namespace polysat {
|
|||
break;
|
||||
}
|
||||
set_bailout();
|
||||
m_vars.insert(v);
|
||||
if (s.is_assigned(v))
|
||||
m_vars.insert(v);
|
||||
std::cout << "vars " << m_vars << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue