mirror of
https://github.com/Z3Prover/z3
synced 2025-08-21 02:30:23 +00:00
merge with Z3Prover/z3/master
This commit is contained in:
commit
f7b50ef796
452 changed files with 29240 additions and 34285 deletions
|
@ -628,10 +628,7 @@ namespace smt {
|
|||
*/
|
||||
void context::remove_parents_from_cg_table(enode * r1) {
|
||||
// Remove parents from the congruence table
|
||||
enode_vector::iterator it = r1->begin_parents();
|
||||
enode_vector::iterator end = r1->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode * parent : r1->get_parents()) {
|
||||
#if 0
|
||||
{
|
||||
static unsigned num_eqs = 0;
|
||||
|
@ -676,10 +673,7 @@ namespace smt {
|
|||
*/
|
||||
void context::reinsert_parents_into_cg_table(enode * r1, enode * r2, enode * n1, enode * n2, eq_justification js) {
|
||||
enode_vector & r2_parents = r2->m_parents;
|
||||
enode_vector::iterator it = r1->begin_parents();
|
||||
enode_vector::iterator end = r1->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode * parent : r1->get_parents()) {
|
||||
if (!parent->is_marked())
|
||||
continue;
|
||||
parent->unset_mark();
|
||||
|
@ -1011,10 +1005,7 @@ namespace smt {
|
|||
r2->m_parents.shrink(r2_num_parents);
|
||||
|
||||
// try to reinsert parents of r1 that are not cgr
|
||||
it = r1->begin_parents();
|
||||
end = r1->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode * parent : r1->get_parents()) {
|
||||
TRACE("add_eq_parents", tout << "visiting: #" << parent->get_owner_id() << "\n";);
|
||||
if (parent->is_cgc_enabled()) {
|
||||
enode * cg = parent->m_cg;
|
||||
|
@ -1210,10 +1201,7 @@ namespace smt {
|
|||
bool context::is_diseq_slow(enode * n1, enode * n2) const {
|
||||
if (n1->get_num_parents() > n2->get_num_parents())
|
||||
std::swap(n1, n2);
|
||||
enode_vector::iterator it = n1->begin_parents();
|
||||
enode_vector::iterator end = n1->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode * parent : n1->get_parents()) {
|
||||
if (parent->is_eq() && is_relevant(parent->get_owner()) && get_assignment(enode2bool_var(parent)) == l_false &&
|
||||
((parent->get_arg(0)->get_root() == n1->get_root() && parent->get_arg(1)->get_root() == n2->get_root()) ||
|
||||
(parent->get_arg(1)->get_root() == n1->get_root() && parent->get_arg(0)->get_root() == n2->get_root()))) {
|
||||
|
@ -1245,10 +1233,7 @@ namespace smt {
|
|||
return false;
|
||||
if (r1->get_num_parents() < SMALL_NUM_PARENTS) {
|
||||
TRACE("is_ext_diseq", tout << mk_bounded_pp(n1->get_owner(), m_manager) << " " << mk_bounded_pp(n2->get_owner(), m_manager) << " " << depth << "\n";);
|
||||
enode_vector::iterator it1 = r1->begin_parents();
|
||||
enode_vector::iterator end1 = r1->end_parents();
|
||||
for (; it1 != end1; ++it1) {
|
||||
enode * p1 = *it1;
|
||||
for (enode* p1 : r1->get_parents()) {
|
||||
if (!is_relevant(p1))
|
||||
continue;
|
||||
if (p1->is_eq())
|
||||
|
@ -1258,10 +1243,7 @@ namespace smt {
|
|||
func_decl * f = p1->get_decl();
|
||||
TRACE("is_ext_diseq", tout << "p1: " << mk_bounded_pp(p1->get_owner(), m_manager) << "\n";);
|
||||
unsigned num_args = p1->get_num_args();
|
||||
enode_vector::iterator it2 = r2->begin_parents();
|
||||
enode_vector::iterator end2 = r2->end_parents();
|
||||
for (; it2 != end2; ++it2) {
|
||||
enode * p2 = *it2;
|
||||
for (enode * p2 : r2->get_parents()) {
|
||||
if (!is_relevant(p2))
|
||||
continue;
|
||||
if (p2->is_eq())
|
||||
|
@ -1299,10 +1281,7 @@ namespace smt {
|
|||
}
|
||||
almost_cg_table & table = *(m_almost_cg_tables[depth]);
|
||||
table.reset(r1, r2);
|
||||
enode_vector::iterator it1 = r1->begin_parents();
|
||||
enode_vector::iterator end1 = r1->end_parents();
|
||||
for (; it1 != end1; ++it1) {
|
||||
enode * p1 = *it1;
|
||||
for (enode* p1 : r1->get_parents()) {
|
||||
if (!is_relevant(p1))
|
||||
continue;
|
||||
if (p1->is_eq())
|
||||
|
@ -1313,10 +1292,7 @@ namespace smt {
|
|||
}
|
||||
if (table.empty())
|
||||
return false;
|
||||
enode_vector::iterator it2 = r2->begin_parents();
|
||||
enode_vector::iterator end2 = r2->end_parents();
|
||||
for (; it2 != end2; ++it2) {
|
||||
enode * p2 = *it2;
|
||||
for (enode * p2 : r2->get_parents()) {
|
||||
if (!is_relevant(p2))
|
||||
continue;
|
||||
if (p2->is_eq())
|
||||
|
@ -1523,10 +1499,7 @@ namespace smt {
|
|||
}
|
||||
TRACE("push_new_th_diseqs", tout << "#" << r->get_owner_id() << " v" << v << "\n";);
|
||||
theory_id th_id = th->get_id();
|
||||
enode_vector::iterator it = r->begin_parents();
|
||||
enode_vector::iterator end = r->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode * parent : r->get_parents()) {
|
||||
CTRACE("parent_bug", parent == 0, tout << "#" << r->get_owner_id() << ", num_parents: " << r->get_num_parents() << "\n"; display(tout););
|
||||
if (parent->is_eq()) {
|
||||
bool_var bv = get_bool_var_of_id(parent->get_owner_id());
|
||||
|
@ -1830,6 +1803,15 @@ namespace smt {
|
|||
m_bvar_inc *= INV_ACTIVITY_LIMIT;
|
||||
}
|
||||
|
||||
expr* context::next_decision() {
|
||||
bool_var var;
|
||||
lbool phase;
|
||||
m_case_split_queue->next_case_split(var, phase);
|
||||
if (var == null_bool_var) return m_manager.mk_true();
|
||||
m_case_split_queue->unassign_var_eh(var);
|
||||
return bool_var2expr(var);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Execute next clase split, return false if there are no
|
||||
more case splits to be performed.
|
||||
|
@ -1990,6 +1972,15 @@ namespace smt {
|
|||
m_watches[(~cls->get_literal(idx)).index()].remove_clause(cls);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Remove boolean variable from watch lists.
|
||||
*/
|
||||
void context::remove_watch(bool_var v) {
|
||||
literal lit(v);
|
||||
m_watches[lit.index()].reset();
|
||||
m_watches[(~lit).index()].reset();
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Update the index used for backward subsumption.
|
||||
*/
|
||||
|
@ -2201,9 +2192,7 @@ namespace smt {
|
|||
TRACE("cached_generation", tout << "caching: #" << n->get_id() << " " << e->get_generation() << "\n";);
|
||||
m_cached_generation.insert(n, e->get_generation());
|
||||
}
|
||||
unsigned num_args = to_app(n)->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
expr * arg = to_app(n)->get_arg(i);
|
||||
for (expr * arg : *to_app(n)) {
|
||||
if (is_app(arg) || is_quantifier(arg))
|
||||
todo.push_back(arg);
|
||||
}
|
||||
|
@ -3407,6 +3396,7 @@ namespace smt {
|
|||
m_num_conflicts = 0;
|
||||
m_num_conflicts_since_restart = 0;
|
||||
m_num_conflicts_since_lemma_gc = 0;
|
||||
m_num_restarts = 0;
|
||||
m_restart_threshold = m_fparams.m_restart_initial;
|
||||
m_restart_outer_threshold = m_fparams.m_restart_initial;
|
||||
m_agility = 0.0;
|
||||
|
@ -3504,6 +3494,7 @@ namespace smt {
|
|||
|
||||
bool context::restart(lbool& status, unsigned curr_lvl) {
|
||||
|
||||
|
||||
if (m_last_search_failure != OK) {
|
||||
if (status != l_false) {
|
||||
// build candidate model before returning
|
||||
|
@ -3537,7 +3528,7 @@ namespace smt {
|
|||
inc_limits();
|
||||
if (status == l_true || !m_fparams.m_restart_adaptive || m_agility < m_fparams.m_restart_agility_threshold) {
|
||||
SASSERT(!inconsistent());
|
||||
IF_VERBOSE(2, verbose_stream() << "(smt.restarting :propagations " << m_stats.m_num_propagations
|
||||
IF_VERBOSE(2, verbose_stream() << "(smt.restarting :propagations " << m_stats.m_num_propagations
|
||||
<< " :decisions " << m_stats.m_num_decisions
|
||||
<< " :conflicts " << m_stats.m_num_conflicts << " :restart " << m_restart_threshold;
|
||||
if (m_fparams.m_restart_strategy == RS_IN_OUT_GEOMETRIC) {
|
||||
|
@ -3546,9 +3537,10 @@ namespace smt {
|
|||
if (m_fparams.m_restart_adaptive) {
|
||||
verbose_stream() << " :agility " << m_agility;
|
||||
}
|
||||
verbose_stream() << ")" << std::endl; verbose_stream().flush(););
|
||||
verbose_stream() << ")\n");
|
||||
// execute the restart
|
||||
m_stats.m_num_restarts++;
|
||||
m_num_restarts++;
|
||||
if (m_scope_lvl > curr_lvl) {
|
||||
pop_scope(m_scope_lvl - curr_lvl);
|
||||
SASSERT(at_search_level());
|
||||
|
@ -3565,6 +3557,11 @@ namespace smt {
|
|||
status = l_false;
|
||||
return false;
|
||||
}
|
||||
if (m_num_restarts >= m_fparams.m_restart_max) {
|
||||
status = l_undef;
|
||||
m_last_search_failure = NUM_CONFLICTS;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (m_fparams.m_simplify_clauses)
|
||||
simplify_clauses();
|
||||
|
@ -3870,6 +3867,9 @@ namespace smt {
|
|||
svector<bool> expr_signs;
|
||||
for (unsigned i = 0; i < num_lits; i++) {
|
||||
literal l = lits[i];
|
||||
if (get_assignment(l) != l_false) {
|
||||
std::cout << l << " " << get_assignment(l) << "\n";
|
||||
}
|
||||
SASSERT(get_assignment(l) == l_false);
|
||||
expr_lits.push_back(bool_var2expr(l.var()));
|
||||
expr_signs.push_back(l.sign());
|
||||
|
@ -4232,10 +4232,7 @@ namespace smt {
|
|||
theory_var_list * l = n->get_th_var_list();
|
||||
theory_id th_id = l->get_th_id();
|
||||
|
||||
enode_vector::const_iterator it = n->begin_parents();
|
||||
enode_vector::const_iterator end = n->end_parents();
|
||||
for (; it != end; ++it) {
|
||||
enode * parent = *it;
|
||||
for (enode* parent : n->get_parents()) {
|
||||
family_id fid = parent->get_owner()->get_family_id();
|
||||
if (fid != th_id && fid != m_manager.get_basic_family_id()) {
|
||||
TRACE("is_shared", tout << mk_pp(n->get_owner(), m_manager) << "\nis shared because of:\n" << mk_pp(parent->get_owner(), m_manager) << "\n";);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue