mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
na (#4254)
* remove level of indirection for context and ast_manager in smt_theory Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add request by #4252 Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * move to def Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * int Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fix #4251 Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fix #4255 * fix #4257 * add code to debug #4246 * restore new solver as default * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fix #4246 Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
becf423c77
commit
fdc87f286f
18 changed files with 269 additions and 231 deletions
|
@ -41,7 +41,7 @@ def_module_params(module_name='smt',
|
|||
('bv.reflect', BOOL, True, 'create enode for every bit-vector term'),
|
||||
('bv.enable_int2bv', BOOL, True, 'enable support for int2bv and bv2int operators'),
|
||||
('arith.random_initial_value', BOOL, False, 'use random initial values in the simplex-based procedure for linear arithmetic'),
|
||||
('arith.solver', UINT, 2, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'),
|
||||
('arith.solver', UINT, 6, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'),
|
||||
('arith.nl', BOOL, True, '(incomplete) nonlinear arithmetic support based on Groebner basis and interval propagation, relevant only if smt.arith.solver=2'),
|
||||
('arith.nl.gb', BOOL, True, 'groebner Basis computation, this option is ignored when arith.nl=false, relevant only if smt.arith.solver=2'),
|
||||
('arith.nl.branching', BOOL, True, 'branching on integer variables in non linear clusters, relevant only if smt.arith.solver=2'),
|
||||
|
|
|
@ -29,9 +29,10 @@ namespace smt {
|
|||
expr_ref context::antecedent2fml(index_set const& vars) {
|
||||
expr_ref_vector premises(m);
|
||||
for (unsigned v : vars) {
|
||||
expr* e = bool_var2expr(v);
|
||||
e = m_assumption2orig.find(e);
|
||||
premises.push_back(get_assignment(v) != l_false ? e : m.mk_not(e));
|
||||
expr* e;
|
||||
if (m_assumption2orig.find(v, e)) {
|
||||
premises.push_back(get_assignment(v) != l_false ? e : m.mk_not(e));
|
||||
}
|
||||
}
|
||||
return mk_and(premises);
|
||||
}
|
||||
|
@ -277,6 +278,7 @@ namespace smt {
|
|||
m_antecedents.insert(true_literal.var(), index_set());
|
||||
pop_to_base_lvl();
|
||||
expr_ref_vector vars(m), assumptions(m);
|
||||
index_set _assumptions;
|
||||
m_var2val.reset();
|
||||
m_var2orig.reset();
|
||||
m_assumption2orig.reset();
|
||||
|
@ -310,17 +312,21 @@ namespace smt {
|
|||
for (expr* a : assumptions0) {
|
||||
if (is_uninterp_const(a)) {
|
||||
assumptions.push_back(a);
|
||||
m_assumption2orig.insert(a, a);
|
||||
}
|
||||
else {
|
||||
if (!pushed) pushed = true, push();
|
||||
expr_ref c(m.mk_fresh_const("a", m.get_sort(a)), m);
|
||||
expr_ref eq(m.mk_eq(c, a), m);
|
||||
assert_expr(eq);
|
||||
assumptions.push_back(c);
|
||||
m_assumption2orig.insert(c, a);
|
||||
assumptions.push_back(c);
|
||||
}
|
||||
expr* e = assumptions.back();
|
||||
if (!e_internalized(e)) internalize(e, false);
|
||||
literal lit = get_literal(e);
|
||||
_assumptions.insert(lit.var());
|
||||
m_assumption2orig.insert(lit.var(), a);
|
||||
}
|
||||
|
||||
lbool is_sat = check(assumptions.size(), assumptions.c_ptr());
|
||||
if (is_sat != l_true) {
|
||||
TRACE("context", tout << is_sat << "\n";);
|
||||
|
@ -333,11 +339,6 @@ namespace smt {
|
|||
|
||||
TRACE("context", display(tout););
|
||||
|
||||
index_set _assumptions;
|
||||
for (expr* e : assumptions) {
|
||||
if (!e_internalized(e)) internalize(e, false);
|
||||
_assumptions.insert(get_literal(e).var());
|
||||
}
|
||||
model_ref mdl;
|
||||
get_model(mdl);
|
||||
expr_ref_vector trail(m);
|
||||
|
@ -459,9 +460,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
m_antecedents.reset();
|
||||
literal_vector const& lits = assigned_literals();
|
||||
for (unsigned i = 0; i < lits.size(); ++i) {
|
||||
literal lit = lits[i];
|
||||
for (literal lit : assigned_literals()) {
|
||||
index_set s;
|
||||
if (_asms.contains(lit.index())) {
|
||||
s.insert(lit.var());
|
||||
|
@ -472,10 +471,8 @@ namespace smt {
|
|||
m_antecedents.insert(lit.var(), s);
|
||||
if (_nasms.contains(lit.index())) {
|
||||
expr_ref_vector core(m);
|
||||
index_set::iterator it = s.begin(), end = s.end();
|
||||
for (; it != end; ++it) {
|
||||
core.push_back(var2expr[*it]);
|
||||
}
|
||||
for (auto v : s)
|
||||
core.push_back(var2expr[v]);
|
||||
core.push_back(var2expr[lit.var()]);
|
||||
cores.push_back(core);
|
||||
min_core_size = std::min(min_core_size, core.size());
|
||||
|
|
|
@ -1498,7 +1498,7 @@ namespace smt {
|
|||
//typedef uint_set index_set;
|
||||
u_map<index_set> m_antecedents;
|
||||
obj_map<expr, expr*> m_var2orig;
|
||||
obj_map<expr, expr*> m_assumption2orig;
|
||||
u_map<expr*> m_assumption2orig;
|
||||
obj_map<expr, expr*> m_var2val;
|
||||
void extract_fixed_consequences(literal lit, index_set const& assumptions, expr_ref_vector& conseq);
|
||||
void extract_fixed_consequences(unsigned& idx, index_set const& assumptions, expr_ref_vector& conseq);
|
||||
|
|
|
@ -2162,7 +2162,10 @@ public:
|
|||
|
||||
nla::lemma m_lemma;
|
||||
|
||||
void false_case_of_check_nla() {
|
||||
void false_case_of_check_nla(const nla::lemma & l) {
|
||||
m_lemma = l; //todo avoid the copy
|
||||
m_explanation = l.expl();
|
||||
m_stats.m_nla_explanations += static_cast<unsigned>(l.expl().size());
|
||||
literal_vector core;
|
||||
for (auto const& ineq : m_lemma.ineqs()) {
|
||||
bool is_lower = true, pos = true, is_eq = false;
|
||||
|
@ -2197,10 +2200,7 @@ public:
|
|||
case l_false: {
|
||||
m_stats.m_nla_lemmas += lv.size();
|
||||
for(const nla::lemma & l : lv) {
|
||||
m_lemma = l; //todo avoid the copy
|
||||
m_explanation = l.expl();
|
||||
m_stats.m_nla_explanations += static_cast<unsigned>(l.expl().size());
|
||||
false_case_of_check_nla();
|
||||
false_case_of_check_nla(l);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3257,7 +3257,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
lp::explanation m_explanation;
|
||||
lp::explanation m_explanation;
|
||||
|
||||
literal_vector m_core;
|
||||
svector<enode_pair> m_eqs;
|
||||
|
@ -3324,7 +3324,7 @@ public:
|
|||
set_evidence(ev.second, m_core, m_eqs);
|
||||
}
|
||||
}
|
||||
// SASSERT(validate_conflict());
|
||||
// SASSERT(validate_conflict(m_core, m_eqs));
|
||||
dump_conflict(m_core, m_eqs);
|
||||
if (is_conflict) {
|
||||
ctx().set_conflict(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue