3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

add bounded-int and pb2bv solvers to fd_solver, use sorting networks for pb2bv rewriter when applicable, hoist to pb2bv_rewriter module and remove it from the pb2bv_tactic

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-10-23 20:31:59 -07:00
parent 6d3430c689
commit 3778048eb4
26 changed files with 1424 additions and 700 deletions

View file

@ -222,6 +222,12 @@ namespace smt {
m_imp->assert_expr(e);
}
void kernel::assert_expr(expr_ref_vector const& es) {
for (unsigned i = 0; i < es.size(); ++i) {
m_imp->assert_expr(es[i]);
}
}
void kernel::assert_expr(expr * e, proof * pr) {
m_imp->assert_expr(e, pr);
}

View file

@ -70,7 +70,8 @@ namespace smt {
This method uses the "asserted" proof as a justification for e.
*/
void assert_expr(expr * e);
void assert_expr(expr_ref_vector const& es);
/**
\brief Assert the given assertion with the given proof as a justification.
*/

View file

@ -1270,28 +1270,25 @@ namespace smt {
TRACE("pb", tout << in << " >= " << k << "\n";);
psort_expr ps(ctx, *this);
psort_nw<psort_expr> sortnw(ps);
sortnw.m_stats.reset();
if (ctx.get_assignment(thl) == l_true &&
ctx.get_assign_level(thl) == ctx.get_base_level()) {
psort_expr ps(ctx, *this);
psort_nw<psort_expr> sortnw(ps);
sortnw.m_stats.reset();
at_least_k = sortnw.ge(false, k, in.size(), in.c_ptr());
TRACE("pb", tout << ~thl << " " << at_least_k << "\n";);
ctx.mk_clause(~thl, at_least_k, justify(~thl, at_least_k));
m_stats.m_num_compiled_vars += sortnw.m_stats.m_num_compiled_vars;
m_stats.m_num_compiled_clauses += sortnw.m_stats.m_num_compiled_clauses;
}
else {
psort_expr ps(ctx, *this);
psort_nw<psort_expr> sortnw(ps);
sortnw.m_stats.reset();
literal at_least_k = sortnw.ge(true, k, in.size(), in.c_ptr());
TRACE("pb", tout << ~thl << " " << at_least_k << "\n";);
ctx.mk_clause(~thl, at_least_k, justify(~thl, at_least_k));
ctx.mk_clause(~at_least_k, thl, justify(thl, ~at_least_k));
m_stats.m_num_compiled_vars += sortnw.m_stats.m_num_compiled_vars;
m_stats.m_num_compiled_clauses += sortnw.m_stats.m_num_compiled_clauses;
}
m_stats.m_num_compiled_vars += sortnw.m_stats.m_num_compiled_vars;
m_stats.m_num_compiled_clauses += sortnw.m_stats.m_num_compiled_clauses;
IF_VERBOSE(1, verbose_stream()
<< "(smt.pb compile sorting network bound: "
<< k << " literals: " << in.size() << ")\n";);