mirror of
https://github.com/Z3Prover/z3
synced 2025-08-05 10:50:24 +00:00
optimizations to bv-solver and euf-egraph (#4698)
* additional bit-vector propagators Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * rename restrict (not a keyword, but well) #4694, tune euf Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * merge Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add pb rewriting to pb2bv #4697 Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ed44a44579
commit
6f63f8761c
24 changed files with 206 additions and 116 deletions
|
@ -16,19 +16,22 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/rewriter/bool_rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
|
||||
#include "util/ref_util.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "util/trace.h"
|
||||
#include "util/statistics.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/rewriter/bool_rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/rewriter/pb2bv_rewriter.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "tactic/generic_model_converter.h"
|
||||
#include "tactic/arith/pb2bv_model_converter.h"
|
||||
#include "tactic/arith/pb2bv_tactic.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
class pb2bv_tactic : public tactic {
|
||||
public:
|
||||
|
@ -38,11 +41,13 @@ public:
|
|||
typedef rational numeral;
|
||||
ast_manager & m;
|
||||
arith_util & m_util;
|
||||
bound_manager & m_bm;
|
||||
pb_util & m_pb;
|
||||
bound_manager & m_bm;
|
||||
|
||||
only_01_visitor(arith_util & u, bound_manager & bm):
|
||||
only_01_visitor(arith_util & u, pb_util& pb, bound_manager & bm):
|
||||
m(u.get_manager()),
|
||||
m_util(u),
|
||||
m_pb(pb),
|
||||
m_bm(bm) {
|
||||
}
|
||||
|
||||
|
@ -80,7 +85,10 @@ public:
|
|||
throw_non_pb(n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fid == m_pb.get_family_id())
|
||||
return;
|
||||
|
||||
if (is_uninterp_const(n)) {
|
||||
if (m.is_bool(n))
|
||||
return; // boolean variables are ok
|
||||
|
@ -109,8 +117,10 @@ private:
|
|||
ast_manager & m;
|
||||
bound_manager m_bm;
|
||||
bool_rewriter m_b_rw;
|
||||
pb2bv_rewriter m_pb_rw;
|
||||
arith_util m_arith_util;
|
||||
bv_util m_bv_util;
|
||||
pb_util m_pb;
|
||||
expr_dependency_ref_vector m_new_deps;
|
||||
|
||||
bool m_produce_models;
|
||||
|
@ -187,7 +197,7 @@ private:
|
|||
|
||||
void quick_pb_check(goal_ref const & g) {
|
||||
expr_fast_mark1 visited;
|
||||
only_01_visitor proc(m_arith_util, m_bm);
|
||||
only_01_visitor proc(m_arith_util, m_pb, m_bm);
|
||||
unsigned sz = g->size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
expr * f = g->form(i);
|
||||
|
@ -846,8 +856,10 @@ private:
|
|||
m(_m),
|
||||
m_bm(m),
|
||||
m_b_rw(m, p),
|
||||
m_pb_rw(m, p),
|
||||
m_arith_util(m),
|
||||
m_bv_util(m),
|
||||
m_pb(m),
|
||||
m_new_deps(m),
|
||||
m_temporary_ints(m),
|
||||
m_used_dependencies(m),
|
||||
|
@ -870,6 +882,7 @@ private:
|
|||
m_all_clauses_limit = p.get_uint("pb2bv_all_clauses_limit", 8);
|
||||
m_cardinality_limit = p.get_uint("pb2bv_cardinality_limit", UINT_MAX);
|
||||
m_b_rw.updt_params(p);
|
||||
m_pb_rw.updt_params(p);
|
||||
}
|
||||
|
||||
void collect_param_descrs(param_descrs & r) {
|
||||
|
@ -878,6 +891,7 @@ private:
|
|||
r.insert("pb2bv_cardinality_limit", CPK_UINT, "(default: inf) limit for using arc-consistent cardinality constraint encoding.");
|
||||
|
||||
m_b_rw.get_param_descrs(r);
|
||||
m_pb_rw.collect_param_descrs(r);
|
||||
r.erase("flat");
|
||||
r.erase("elim_and");
|
||||
}
|
||||
|
@ -925,7 +939,9 @@ private:
|
|||
TRACE("pb2bv_convert", tout << "pos: " << pos << "\n" << mk_ismt2_pp(atom, m) << "\n--->\n" << mk_ismt2_pp(new_f, m) << "\n";);
|
||||
}
|
||||
else {
|
||||
proof_ref pr(m);
|
||||
m_rw(curr, new_f);
|
||||
m_pb_rw(true, new_f, new_f, pr);
|
||||
}
|
||||
if (m_produce_unsat_cores) {
|
||||
new_deps.push_back(m.mk_join(m_used_dependencies, g->dep(idx)));
|
||||
|
@ -1017,8 +1033,9 @@ struct is_pb_probe : public probe {
|
|||
bound_manager bm(m);
|
||||
bm(g);
|
||||
arith_util a_util(m);
|
||||
pb_util pb(m);
|
||||
expr_fast_mark1 visited;
|
||||
pb2bv_tactic::only_01_visitor proc(a_util, bm);
|
||||
pb2bv_tactic::only_01_visitor proc(a_util, pb, bm);
|
||||
|
||||
unsigned sz = g.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
|
|
|
@ -27,6 +27,7 @@ Notes:
|
|||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/rewriter/bv_rewriter.h"
|
||||
|
||||
class bv1_blaster_tactic : public tactic {
|
||||
|
@ -141,7 +142,7 @@ class bv1_blaster_tactic : public tactic {
|
|||
--i;
|
||||
new_eqs.push_back(m().mk_eq(bits1[i], bits2[i]));
|
||||
}
|
||||
result = m().mk_and(new_eqs.size(), new_eqs.c_ptr());
|
||||
result = mk_and(m(), new_eqs.size(), new_eqs.c_ptr());
|
||||
}
|
||||
|
||||
void reduce_ite(expr * c, expr * t, expr * e, expr_ref & result) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue