Example #1
0
 inc_sat_solver(ast_manager& m, params_ref const& p):
     m(m), m_solver(p, m.limit(), 0),
     m_params(p), m_optimize_model(false),
     m_fmls(m),
     m_asmsf(m),
     m_fmls_head(0),
     m_core(m),
     m_map(m),
     m_bb_rewriter(m, p),
     m_num_scopes(0),
     m_dep_core(m),
     m_unknown("no reason given") {
     m_params.set_bool("elim_vars", false);
     m_solver.updt_params(m_params);
     params_ref simp2_p = p;
     simp2_p.set_bool("som", true);
     simp2_p.set_bool("pull_cheap_ite", true);
     simp2_p.set_bool("push_ite_bv", false);
     simp2_p.set_bool("local_ctx", true);
     simp2_p.set_uint("local_ctx_limit", 10000000);
     simp2_p.set_bool("flat", true); // required by som
     simp2_p.set_bool("hoist_mul", false); // required by som
     simp2_p.set_bool("elim_and", true);
     m_preprocess =
         and_then(mk_card2bv_tactic(m, m_params),
                  using_params(mk_simplify_tactic(m), simp2_p),
                  mk_max_bv_sharing_tactic(m),
                  mk_bit_blaster_tactic(m, &m_bb_rewriter),
                  //mk_aig_tactic(),
                  using_params(mk_simplify_tactic(m), simp2_p));
 }
Example #2
0
tactic * mk_qfufbv_tactic(ast_manager & m, params_ref const & p) {
    params_ref main_p;
    main_p.set_bool(":elim-and", true);
    main_p.set_bool(":blast-distinct", true);

    tactic * preamble_st = and_then(mk_simplify_tactic(m),
                                    mk_propagate_values_tactic(m),
                                    mk_solve_eqs_tactic(m),
                                    mk_elim_uncnstr_tactic(m),
                                    if_no_proofs(if_no_unsat_cores(mk_reduce_args_tactic(m))),
                                    if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
                                    mk_max_bv_sharing_tactic(m)
                                    );

    tactic * st = using_params(and_then(preamble_st,
                                        mk_smt_tactic()),
                               main_p);

    //cond(is_qfbv(), 
    // and_then(mk_bit_blaster(m),
    //          mk_sat_solver(m)),
    //  mk_smt_solver())
    st->updt_params(p);
    return st;
}
Example #3
0
static tactic * mk_bv2sat_tactic(ast_manager & m) {
    params_ref solver_p;
    // The cardinality constraint encoding generates a lot of shared if-then-else's that can be flattened.
    // Several of them are simplified to and/or. If we flat them, we increase a lot the memory consumption.
    solver_p.set_bool("flat", false); 
    solver_p.set_bool("som", false); 
    // dynamic psm seems to work well.
    solver_p.set_sym("gc", symbol("dyn_psm"));
    
    return using_params(and_then(mk_simplify_tactic(m),
                                 mk_propagate_values_tactic(m),
                                 mk_solve_eqs_tactic(m),
                                 mk_max_bv_sharing_tactic(m),
                                 mk_bit_blaster_tactic(m),
                                 mk_aig_tactic(),
                                 mk_sat_tactic(m)),
                        solver_p);
}
Example #4
0
static tactic * mk_qfaufbv_preamble(ast_manager & m, params_ref const & p) {

    params_ref simp2_p = p;
    simp2_p.set_bool("som", true);
    simp2_p.set_bool("pull_cheap_ite", true);
    simp2_p.set_bool("push_ite_bv", false);
    simp2_p.set_bool("local_ctx", true);
    simp2_p.set_uint("local_ctx_limit", 10000000);


    return and_then(mk_simplify_tactic(m),
                    mk_propagate_values_tactic(m),
                    mk_solve_eqs_tactic(m),
                    mk_elim_uncnstr_tactic(m),
                    // sound to use? if_no_proofs(if_no_unsat_cores(mk_reduce_args_tactic(m))),
                    if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
                    using_params(mk_simplify_tactic(m), simp2_p),
                    mk_max_bv_sharing_tactic(m),
                    if_no_proofs(if_no_unsat_cores(mk_ackermannize_bv_tactic(m, p)))
                    );
}
Example #5
0
static tactic * mk_qfnia_bv_solver(ast_manager & m, params_ref const & p_ref) {
    params_ref p = p_ref;
    p.set_bool("flat", false);
    p.set_bool("hi_div0", true); 
    p.set_bool("elim_and", true);
    p.set_bool("blast_distinct", true);
    
    params_ref simp2_p = p;
    simp2_p.set_bool("local_ctx", true);
    simp2_p.set_uint("local_ctx_limit", 10000000);

    
    tactic * r = using_params(and_then(mk_simplify_tactic(m),
                                       mk_propagate_values_tactic(m),
                                       using_params(mk_simplify_tactic(m), simp2_p),
                                       mk_max_bv_sharing_tactic(m),
                                       mk_bit_blaster_tactic(m),
                                       mk_sat_tactic(m)),
                              p);
    return r;
}
Example #6
0
static tactic * mk_qfbv_preamble(ast_manager& m, params_ref const& p) {

    params_ref solve_eq_p;
    // conservative guassian elimination.
    solve_eq_p.set_uint("solve_eqs_max_occs", 2);

    params_ref simp2_p = p;
    simp2_p.set_bool("som", true);
    simp2_p.set_bool("pull_cheap_ite", true);
    simp2_p.set_bool("push_ite_bv", false);
    simp2_p.set_bool("local_ctx", true);
    simp2_p.set_uint("local_ctx_limit", 10000000);
    simp2_p.set_bool("flat", true); // required by som
    simp2_p.set_bool("hoist_mul", false); // required by som

    params_ref hoist_p;
    hoist_p.set_bool("hoist_mul", true);
    hoist_p.set_bool("som", false);

    return
        and_then(
            mk_simplify_tactic(m),
            mk_propagate_values_tactic(m),
            using_params(mk_solve_eqs_tactic(m), solve_eq_p),
            mk_elim_uncnstr_tactic(m),
            if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
            using_params(mk_simplify_tactic(m), simp2_p),
            //
            // Z3 can solve a couple of extra benchmarks by using hoist_mul
            // but the timeout in SMT-COMP is too small.
            // Moreover, it impacted negatively some easy benchmarks.
            // We should decide later, if we keep it or not.
            //
            using_params(mk_simplify_tactic(m), hoist_p),
            mk_max_bv_sharing_tactic(m),
            if_no_proofs(if_no_unsat_cores(mk_ackermannize_bv_tactic(m,p)))
            );
}
Example #7
0
 inc_sat_solver(ast_manager& m, params_ref const& p):
     m(m), m_solver(p,0), m_params(p),
     m_fmls(m), m_map(m) {
     m_params.set_bool("elim_vars", false);
     m_solver.updt_params(m_params);
     params_ref simp2_p = p;
     simp2_p.set_bool("som", true);
     simp2_p.set_bool("pull_cheap_ite", true);
     simp2_p.set_bool("push_ite_bv", false);
     simp2_p.set_bool("local_ctx", true);
     simp2_p.set_uint("local_ctx_limit", 10000000);
     simp2_p.set_bool("flat", true); // required by som
     simp2_p.set_bool("hoist_mul", false); // required by som
     m_preprocess = 
         and_then(mk_card2bv_tactic(m, m_params),
                  mk_simplify_tactic(m),
                  mk_propagate_values_tactic(m),
                  using_params(mk_simplify_tactic(m), simp2_p),
                  mk_max_bv_sharing_tactic(m),
                  mk_bit_blaster_tactic(m), 
                  mk_aig_tactic());
     
     
 }
Example #8
0
tactic * mk_qfidl_tactic(ast_manager & m, params_ref const & p) {
    params_ref main_p;
    main_p.set_bool("elim_and", true);
    main_p.set_bool("blast_distinct", true);
    main_p.set_bool("som", true);

    params_ref lhs_p;
    lhs_p.set_bool("arith_lhs", true);

    params_ref lia2pb_p;
    lia2pb_p.set_uint("lia2pb_max_bits", 4);

    params_ref pb2bv_p;
    pb2bv_p.set_uint("pb2bv_all_clauses_limit", 8);

    params_ref pull_ite_p;
    pull_ite_p.set_bool("pull_cheap_ite", true);
    pull_ite_p.set_bool("local_ctx", true);
    pull_ite_p.set_uint("local_ctx_limit", 10000000);

    tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
                                             mk_fix_dl_var_tactic(m),
                                             mk_propagate_values_tactic(m),
                                             mk_elim_uncnstr_tactic(m)
                                             ),
                                    and_then(mk_solve_eqs_tactic(m),
                                             using_params(mk_simplify_tactic(m), lhs_p),
                                             mk_propagate_values_tactic(m),
                                             mk_normalize_bounds_tactic(m),
                                             mk_solve_eqs_tactic(m)));

    
    
    params_ref bv_solver_p;
    // The cardinality constraint encoding generates a lot of shared if-then-else's that can be flattened.
    // Several of them are simplified to and/or. If we flat them, we increase a lot the memory consumption.
    bv_solver_p.set_bool("flat", false); 
    bv_solver_p.set_bool("som", false); 
    // dynamic psm seems to work well.
    bv_solver_p.set_sym("gc", symbol("dyn_psm"));

    tactic * bv_solver = using_params(and_then(mk_simplify_tactic(m),
                                               mk_propagate_values_tactic(m),
                                               mk_solve_eqs_tactic(m),
                                               mk_max_bv_sharing_tactic(m),
                                               mk_bit_blaster_tactic(m),
                                               mk_aig_tactic(),
                                               mk_sat_tactic(m)),
                                      bv_solver_p);

    tactic * try2bv = 
        and_then(using_params(mk_lia2pb_tactic(m), lia2pb_p),
                 mk_propagate_ineqs_tactic(m),
                 using_params(mk_pb2bv_tactic(m), pb2bv_p),
                 fail_if(mk_not(mk_is_qfbv_probe())),
                 bv_solver);
    
    params_ref diff_neq_p;
    diff_neq_p.set_uint("diff_neq_max_k", 25);

    tactic * st = cond(mk_and(mk_lt(mk_num_consts_probe(), mk_const_probe(static_cast<double>(BIG_PROBLEM))),
                              mk_and(mk_not(mk_produce_proofs_probe()),
                                     mk_not(mk_produce_unsat_cores_probe()))),
                       using_params(and_then(preamble_st,
                                             or_else(using_params(mk_diff_neq_tactic(m), diff_neq_p),
                                                     try2bv,
                                                     mk_smt_tactic())),
                                    main_p),
                       mk_smt_tactic());
    
    st->updt_params(p);

    return st;
}
Example #9
0
tactic * mk_qfbv_tactic(ast_manager & m, params_ref const & p) {
    params_ref main_p;
    main_p.set_bool("elim_and", true);
    main_p.set_bool("push_ite_bv", true);
    main_p.set_bool("blast_distinct", true);

    params_ref simp2_p = p;
    simp2_p.set_bool("som", true);
    simp2_p.set_bool("pull_cheap_ite", true);
    simp2_p.set_bool("push_ite_bv", false);
    simp2_p.set_bool("local_ctx", true);
    simp2_p.set_uint("local_ctx_limit", 10000000);
    simp2_p.set_bool("flat", true); // required by som
    simp2_p.set_bool("hoist_mul", false); // required by som

    params_ref local_ctx_p = p;
    local_ctx_p.set_bool("local_ctx", true);

    params_ref solver_p;
    solver_p.set_bool("preprocess", false); // preprocessor of smt::context is not needed.
    
    params_ref no_flat_p;
    no_flat_p.set_bool("flat", false);

    params_ref ctx_simp_p;
    ctx_simp_p.set_uint("max_depth", 32);
    ctx_simp_p.set_uint("max_steps", 50000000);

    params_ref hoist_p;
    hoist_p.set_bool("hoist_mul", true);
    hoist_p.set_bool("som", false);

    params_ref solve_eq_p;
    // conservative guassian elimination. 
    solve_eq_p.set_uint("solve_eqs_max_occs", 2); 

    params_ref big_aig_p;
    big_aig_p.set_bool("aig_per_assertion", false);

    tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
                                             mk_propagate_values_tactic(m),
                                             using_params(mk_solve_eqs_tactic(m), solve_eq_p),
                                             mk_elim_uncnstr_tactic(m),
                                             if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
                                             using_params(mk_simplify_tactic(m), simp2_p)),
                                    // Z3 can solve a couple of extra benchmarks by using hoist_mul
                                    // but the timeout in SMT-COMP is too small. 
                                    // Moreover, it impacted negatively some easy benchmarks.
                                    // We should decide later, if we keep it or not.
                                    using_params(mk_simplify_tactic(m), hoist_p),
                                    mk_max_bv_sharing_tactic(m));
    
#ifdef USE_OLD_SAT_SOLVER
    tactic * new_sat = and_then(mk_simplify_tactic(m),
                                mk_smt_tactic());
#else
    tactic * new_sat = cond(mk_or(mk_produce_proofs_probe(), mk_produce_unsat_cores_probe()),
                            and_then(mk_simplify_tactic(m),
                                     mk_smt_tactic()),
                            mk_sat_tactic(m));
#endif    
    
    tactic * st = using_params(and_then(preamble_st,
                                        // If the user sets HI_DIV0=false, then the formula may contain uninterpreted function
                                        // symbols. In this case, we should not use 
                                        cond(mk_is_qfbv_probe(),
                                             cond(mk_is_qfbv_eq_probe(),
                                                  and_then(mk_bv1_blaster_tactic(m),
                                                           using_params(mk_smt_tactic(), solver_p)),
                                                  and_then(mk_bit_blaster_tactic(m),
                                                           when(mk_lt(mk_memory_probe(), mk_const_probe(MEMLIMIT)),
                                                                and_then(using_params(and_then(mk_simplify_tactic(m),
                                                                                               mk_solve_eqs_tactic(m)),
                                                                                      local_ctx_p),
                                                                         if_no_proofs(cond(mk_produce_unsat_cores_probe(),
                                                                                           mk_aig_tactic(),
                                                                                           using_params(mk_aig_tactic(),
                                                                                                        big_aig_p))))),
                                                           new_sat)),
                                             mk_smt_tactic())),
                               main_p);

    st->updt_params(p);
    return st;
}