mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 11:42:28 +00:00 
			
		
		
		
	Merge branch 'master' into polysat
This commit is contained in:
		
						commit
						e168d8a2eb
					
				
					 109 changed files with 4372 additions and 2743 deletions
				
			
		|  | @ -69,23 +69,23 @@ namespace arith { | |||
|                 m_nla->push(); | ||||
|             } | ||||
|             smt_params_helper prms(s().params()); | ||||
|             m_nla->settings().run_order() = prms.arith_nl_order(); | ||||
|             m_nla->settings().run_tangents() = prms.arith_nl_tangents(); | ||||
|             m_nla->settings().run_horner() = prms.arith_nl_horner(); | ||||
|             m_nla->settings().horner_subs_fixed() = prms.arith_nl_horner_subs_fixed(); | ||||
|             m_nla->settings().horner_frequency() = prms.arith_nl_horner_frequency(); | ||||
|             m_nla->settings().horner_row_length_limit() = prms.arith_nl_horner_row_length_limit(); | ||||
|             m_nla->settings().run_grobner() = prms.arith_nl_grobner(); | ||||
|             m_nla->settings().run_nra() = prms.arith_nl_nra(); | ||||
|             m_nla->settings().grobner_subs_fixed() = prms.arith_nl_grobner_subs_fixed(); | ||||
|             m_nla->settings().grobner_eqs_growth() = prms.arith_nl_grobner_eqs_growth(); | ||||
|             m_nla->settings().grobner_expr_size_growth() = prms.arith_nl_grobner_expr_size_growth(); | ||||
|             m_nla->settings().grobner_expr_degree_growth() = prms.arith_nl_grobner_expr_degree_growth(); | ||||
|             m_nla->settings().grobner_max_simplified() = prms.arith_nl_grobner_max_simplified(); | ||||
|             m_nla->settings().grobner_number_of_conflicts_to_report() = prms.arith_nl_grobner_cnfl_to_report(); | ||||
|             m_nla->settings().grobner_quota() = prms.arith_nl_gr_q(); | ||||
|             m_nla->settings().grobner_frequency() = prms.arith_nl_grobner_frequency(); | ||||
|             m_nla->settings().expensive_patching() = false; | ||||
|             m_nla->settings().run_order = prms.arith_nl_order(); | ||||
|             m_nla->settings().run_tangents = prms.arith_nl_tangents(); | ||||
|             m_nla->settings().run_horner = prms.arith_nl_horner(); | ||||
|             m_nla->settings().horner_subs_fixed = prms.arith_nl_horner_subs_fixed(); | ||||
|             m_nla->settings().horner_frequency = prms.arith_nl_horner_frequency(); | ||||
|             m_nla->settings().horner_row_length_limit = prms.arith_nl_horner_row_length_limit(); | ||||
|             m_nla->settings().run_grobner = prms.arith_nl_grobner(); | ||||
|             m_nla->settings().run_nra = prms.arith_nl_nra(); | ||||
|             m_nla->settings().grobner_subs_fixed = prms.arith_nl_grobner_subs_fixed(); | ||||
|             m_nla->settings().grobner_eqs_growth = prms.arith_nl_grobner_eqs_growth(); | ||||
|             m_nla->settings().grobner_expr_size_growth = prms.arith_nl_grobner_expr_size_growth(); | ||||
|             m_nla->settings().grobner_expr_degree_growth = prms.arith_nl_grobner_expr_degree_growth(); | ||||
|             m_nla->settings().grobner_max_simplified = prms.arith_nl_grobner_max_simplified(); | ||||
|             m_nla->settings().grobner_number_of_conflicts_to_report = prms.arith_nl_grobner_cnfl_to_report(); | ||||
|             m_nla->settings().grobner_quota = prms.arith_nl_gr_q(); | ||||
|             m_nla->settings().grobner_frequency = prms.arith_nl_grobner_frequency(); | ||||
|             m_nla->settings().expensive_patching = false; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -442,6 +442,7 @@ namespace bv { | |||
|         SASSERT(bv.is_int2bv(n)); | ||||
|         euf::enode* e = expr2enode(n); | ||||
|         mk_bits(e->get_th_var(get_id())); | ||||
|         get_var(e->get_arg(0)); | ||||
|         assert_int2bv_axiom(n); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -209,6 +209,22 @@ namespace bv { | |||
|         if (is_bv(eq.v1())) { | ||||
|             m_find.merge(eq.v1(), eq.v2()); | ||||
|             VERIFY(eq.is_eq()); | ||||
|             return; | ||||
|         } | ||||
|         euf::enode* n1 = var2enode(eq.v1()); | ||||
|         for (euf::enode* bv2int : euf::enode_class(n1)) { | ||||
|             if (!bv.is_bv2int(bv2int->get_expr())) | ||||
|                 continue; | ||||
|             euf::enode* bv2int_arg = bv2int->get_arg(0); | ||||
|             for (euf::enode* p : euf::enode_parents(n1->get_root())) { | ||||
|                 if (bv.is_int2bv(p->get_expr()) && p->get_sort() == bv2int_arg->get_sort() && p->get_root() != bv2int_arg->get_root()) { | ||||
|                     euf::enode_pair_vector eqs; | ||||
|                     eqs.push_back({ n1, p->get_arg(0) }); | ||||
|                     eqs.push_back({ n1, bv2int }); | ||||
|                     ctx.propagate(p, bv2int_arg, euf::th_explain::propagate(*this, eqs, p, bv2int_arg)); | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -506,7 +506,7 @@ namespace dt { | |||
|         return m_nodes; | ||||
|     } | ||||
| 
 | ||||
|     ptr_vector<euf::enode> const& solver::get_seq_args(enode* n) { | ||||
|     ptr_vector<euf::enode> const& solver::get_seq_args(enode* n, enode*& sibling) { | ||||
|         m_nodes.reset(); | ||||
|         m_todo.reset(); | ||||
|         auto add_todo = [&](enode* n) { | ||||
|  | @ -515,9 +515,15 @@ namespace dt { | |||
|                 m_todo.push_back(n); | ||||
|             } | ||||
|         }; | ||||
|              | ||||
|         for (enode* sib : euf::enode_class(n)) | ||||
|             add_todo(sib); | ||||
| 
 | ||||
|         for (enode* sib : euf::enode_class(n)) { | ||||
|             if (m_sutil.str.is_concat_of_units(sib->get_expr())) { | ||||
|                 add_todo(sib); | ||||
|                 sibling = sib; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|              | ||||
|         for (unsigned i = 0; i < m_todo.size(); ++i) { | ||||
|             enode* n = m_todo[i]; | ||||
|  | @ -551,10 +557,10 @@ namespace dt { | |||
| 
 | ||||
|         // collect equalities on all children that may have been used.
 | ||||
|         bool found = false; | ||||
|         auto add = [&](enode* arg) { | ||||
|             if (arg->get_root() == child->get_root()) { | ||||
|                 if (arg != child) | ||||
|                     m_used_eqs.push_back(enode_pair(arg, child)); | ||||
|         auto add = [&](enode* seq_arg) { | ||||
|             if (seq_arg->get_root() == child->get_root()) { | ||||
|                 if (seq_arg != child) | ||||
|                     m_used_eqs.push_back(enode_pair(seq_arg, child)); | ||||
|                 found = true; | ||||
|             } | ||||
|         }; | ||||
|  | @ -564,11 +570,14 @@ namespace dt { | |||
|             if (m_autil.is_array(s) && dt.is_datatype(get_array_range(s))) | ||||
|                 for (enode* aarg : get_array_args(arg)) | ||||
|                     add(aarg); | ||||
|         } | ||||
|         sort* se; | ||||
|         if (m_sutil.is_seq(child->get_sort(), se) && dt.is_datatype(se)) { | ||||
|             for (enode* aarg : get_seq_args(child)) | ||||
|                 add(aarg); | ||||
|             sort* se; | ||||
|             if (m_sutil.is_seq(arg->get_sort(), se) && dt.is_datatype(se)) { | ||||
|                 enode* sibling = nullptr; | ||||
|                 for (enode* seq_arg : get_seq_args(arg, sibling)) | ||||
|                     add(seq_arg); | ||||
|                 if (sibling && sibling != arg) | ||||
|                     m_used_eqs.push_back(enode_pair(arg, sibling));                 | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         VERIFY(found); | ||||
|  | @ -636,12 +645,13 @@ namespace dt { | |||
|             // explore `arg` (with parent)
 | ||||
|             expr* earg = arg->get_expr(); | ||||
|             sort* s = earg->get_sort(), *se; | ||||
|             enode* sibling; | ||||
|             if (dt.is_datatype(s)) { | ||||
|                 m_parent.insert(arg->get_root(), parent); | ||||
|                 oc_push_stack(arg); | ||||
|             } | ||||
|             else if (m_sutil.is_seq(s, se) && dt.is_datatype(se)) { | ||||
|                 for (enode* sarg : get_seq_args(arg)) | ||||
|                 for (enode* sarg : get_seq_args(arg, sibling)) | ||||
|                     if (process_arg(sarg)) | ||||
|                         return true; | ||||
|             } | ||||
|  |  | |||
|  | @ -112,7 +112,7 @@ namespace dt { | |||
|         void oc_push_stack(enode * n); | ||||
|         ptr_vector<enode> m_nodes, m_todo; | ||||
|         ptr_vector<enode> const& get_array_args(enode* n); | ||||
|         ptr_vector<enode> const& get_seq_args(enode* n); | ||||
|         ptr_vector<enode> const& get_seq_args(enode* n, enode*& sibling); | ||||
| 
 | ||||
|         void pop_core(unsigned n) override; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1795,9 +1795,9 @@ namespace pb { | |||
|         } | ||||
|         if (c.lit() != sat::null_literal && value(c.lit()) != l_true) return true; | ||||
|         SASSERT(c.lit() == sat::null_literal || lvl(c.lit()) == 0 || (c.is_watched(*this, c.lit()) && c.is_watched(*this, ~c.lit()))); | ||||
|         if (eval(c) == l_true) { | ||||
|         if (eval(c) == l_true)  | ||||
|             return true; | ||||
|         } | ||||
|          | ||||
|         literal_vector lits(c.literals()); | ||||
|         for (literal l : lits) { | ||||
|             if (lvl(l) == 0) continue; | ||||
|  | @ -1823,6 +1823,8 @@ namespace pb { | |||
|     } | ||||
| 
 | ||||
|     bool solver::validate_watch(pbc const& p, literal alit) const { | ||||
|         if (value(p.lit()) != l_true) | ||||
|             return true; | ||||
|         for (unsigned i = 0; i < p.size(); ++i) { | ||||
|             literal l = p[i].second; | ||||
|             if (l != alit && lvl(l) != 0 && p.is_watched(*this, l) != (i < p.num_watch())) { | ||||
|  | @ -1833,9 +1835,8 @@ namespace pb { | |||
|             } | ||||
|         } | ||||
|         unsigned slack = 0; | ||||
|         for (unsigned i = 0; i < p.num_watch(); ++i) { | ||||
|             slack += p[i].first; | ||||
|         } | ||||
|         for (unsigned i = 0; i < p.num_watch(); ++i)  | ||||
|             slack += p[i].first;         | ||||
|         if (slack != p.slack()) { | ||||
|             IF_VERBOSE(0, display(verbose_stream(), p, true);); | ||||
|             UNREACHABLE(); | ||||
|  |  | |||
|  | @ -270,6 +270,10 @@ namespace euf { | |||
|         return mk(th, lits.size(), lits.data(), eqs.size(), eqs.data(), sat::null_literal, x, y, pma); | ||||
|     } | ||||
| 
 | ||||
|     th_explain* th_explain::propagate(th_euf_solver& th, enode_pair_vector const& eqs, euf::enode* x, euf::enode* y, sat::proof_hint const* pma) { | ||||
|         return mk(th, 0, nullptr, eqs.size(), eqs.data(), sat::null_literal, x, y, pma); | ||||
|     } | ||||
| 
 | ||||
|     th_explain* th_explain::propagate(th_euf_solver& th, sat::literal lit, euf::enode* x, euf::enode* y) { | ||||
|         return mk(th, 1, &lit, 0, nullptr, sat::null_literal, x, y); | ||||
|     } | ||||
|  |  | |||
|  | @ -241,6 +241,7 @@ namespace euf { | |||
|         static th_explain* conflict(th_euf_solver& th, sat::literal lit, euf::enode* x, euf::enode* y); | ||||
|         static th_explain* conflict(th_euf_solver& th, euf::enode* x, euf::enode* y); | ||||
|         static th_explain* propagate(th_euf_solver& th, sat::literal lit, euf::enode* x, euf::enode* y); | ||||
|         static th_explain* propagate(th_euf_solver& th, enode_pair_vector const& eqs, euf::enode* x, euf::enode* y, sat::proof_hint const* pma = nullptr); | ||||
|         static th_explain* propagate(th_euf_solver& th, sat::literal_vector const& lits, enode_pair_vector const& eqs, sat::literal consequent, sat::proof_hint const* pma = nullptr); | ||||
|         static th_explain* propagate(th_euf_solver& th, sat::literal_vector const& lits, enode_pair_vector const& eqs, euf::enode* x, euf::enode* y, sat::proof_hint const* pma = nullptr); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue