mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
pull unstable
Signed-off-by: Nikolaj Bjorner <nbjorner@hotmail.com>
This commit is contained in:
commit
52619b9dbb
337 changed files with 24943 additions and 30606 deletions
|
@ -27,7 +27,7 @@ Notes:
|
|||
struct aig;
|
||||
|
||||
class aig_lit {
|
||||
friend class aig_ref;
|
||||
friend class aig_ref;
|
||||
aig * m_ref;
|
||||
public:
|
||||
aig_lit(aig * n = 0):m_ref(n) {}
|
||||
|
@ -1508,10 +1508,10 @@ public:
|
|||
template<typename S>
|
||||
aig_lit mk_aig(S const & s) {
|
||||
aig_lit r;
|
||||
r = m_true;
|
||||
inc_ref(r);
|
||||
r = m_true;
|
||||
inc_ref(r);
|
||||
try {
|
||||
expr2aig proc(*this);
|
||||
expr2aig proc(*this);
|
||||
unsigned sz = s.size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
SASSERT(ref_count(r) >= 1);
|
||||
|
@ -1528,10 +1528,10 @@ public:
|
|||
}
|
||||
SASSERT(ref_count(r) >= 1);
|
||||
}
|
||||
catch (aig_exception ex) {
|
||||
dec_ref(r);
|
||||
throw ex;
|
||||
}
|
||||
catch (aig_exception ex) {
|
||||
dec_ref(r);
|
||||
throw ex;
|
||||
}
|
||||
dec_ref_result(r);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -198,11 +198,75 @@ struct is_non_qflira_functor {
|
|||
}
|
||||
};
|
||||
|
||||
struct is_non_qfauflira_functor {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
arith_util m_arith_util;
|
||||
array_util m_array_util;
|
||||
bool m_int;
|
||||
bool m_real;
|
||||
|
||||
is_non_qfauflira_functor(ast_manager & _m, bool _int, bool _real) :
|
||||
m(_m), m_arith_util(_m), m_array_util(_m), m_int(_int), m_real(_real) {}
|
||||
|
||||
void operator()(var *) { throw found(); }
|
||||
|
||||
void operator()(quantifier *) { throw found(); }
|
||||
|
||||
bool compatible_sort(app * n) const {
|
||||
if (m.is_bool(n))
|
||||
return true;
|
||||
if (m_int && m_arith_util.is_int(n))
|
||||
return true;
|
||||
if (m_real && m_arith_util.is_real(n))
|
||||
return true;
|
||||
if (m_array_util.is_array(n))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void operator()(app * n) {
|
||||
if (!compatible_sort(n))
|
||||
throw found();
|
||||
family_id fid = n->get_family_id();
|
||||
if (fid == m.get_basic_family_id())
|
||||
return;
|
||||
if (fid == m_arith_util.get_family_id()) {
|
||||
switch (n->get_decl_kind()) {
|
||||
case OP_LE: case OP_GE: case OP_LT: case OP_GT:
|
||||
case OP_ADD: case OP_NUM:
|
||||
return;
|
||||
case OP_MUL:
|
||||
if (n->get_num_args() != 2)
|
||||
throw found();
|
||||
if (!m_arith_util.is_numeral(n->get_arg(0)))
|
||||
throw found();
|
||||
return;
|
||||
case OP_TO_REAL:
|
||||
if (!m_real)
|
||||
throw found();
|
||||
break;
|
||||
default:
|
||||
throw found();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (is_uninterp(n))
|
||||
return;
|
||||
throw found();
|
||||
}
|
||||
};
|
||||
|
||||
static bool is_qflia(goal const & g) {
|
||||
is_non_qflira_functor p(g.m(), true, false);
|
||||
return !test(g, p);
|
||||
}
|
||||
|
||||
static bool is_qfauflia(goal const & g) {
|
||||
is_non_qfauflira_functor p(g.m(), true, false);
|
||||
return !test(g, p);
|
||||
}
|
||||
|
||||
class is_qflia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
|
@ -210,6 +274,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class is_qfauflia_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
return is_qfauflia(g);
|
||||
}
|
||||
};
|
||||
|
||||
static bool is_qflra(goal const & g) {
|
||||
is_non_qflira_functor p(g.m(), false, true);
|
||||
return !test(g, p);
|
||||
|
@ -289,6 +360,10 @@ probe * mk_is_qflia_probe() {
|
|||
return alloc(is_qflia_probe);
|
||||
}
|
||||
|
||||
probe * mk_is_qfauflia_probe() {
|
||||
return alloc(is_qfauflia_probe);
|
||||
}
|
||||
|
||||
probe * mk_is_qflra_probe() {
|
||||
return alloc(is_qflra_probe);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ probe * mk_arith_max_degree_probe();
|
|||
*/
|
||||
|
||||
probe * mk_is_qflia_probe();
|
||||
probe * mk_is_qfauflia_probe();
|
||||
probe * mk_is_qflra_probe();
|
||||
probe * mk_is_qflira_probe();
|
||||
probe * mk_is_ilp_probe();
|
||||
|
@ -40,6 +41,7 @@ probe * mk_is_mip_probe();
|
|||
|
||||
/*
|
||||
ADD_PROBE("is-qflia", "true if the goal is in QF_LIA.", "mk_is_qflia_probe()")
|
||||
ADD_PROBE("is-qfauflia", "true if the goal is in QF_AUFLIA.", "mk_is_qfauflia_probe()")
|
||||
ADD_PROBE("is-qflra", "true if the goal is in QF_LRA.", "mk_is_qflra_probe()")
|
||||
ADD_PROBE("is-qflira", "true if the goal is in QF_LIRA.", "mk_is_qflira_probe()")
|
||||
ADD_PROBE("is-ilp", "true if the goal is ILP.", "mk_is_ilp_probe()")
|
||||
|
|
|
@ -115,6 +115,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
out << "< oo";
|
||||
out << "\n";
|
||||
}
|
||||
nm.del(k);
|
||||
}
|
||||
|
||||
a_var mk_var(expr * t) {
|
||||
|
@ -234,6 +235,7 @@ struct propagate_ineqs_tactic::imp {
|
|||
SASSERT(k == GE);
|
||||
bp.assert_lower(x, c_prime, strict);
|
||||
}
|
||||
nm.del(c_prime);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -309,6 +311,8 @@ struct propagate_ineqs_tactic::imp {
|
|||
m_new_goal->assert_expr(m_util.mk_le(p, m_util.mk_numeral(rational(u), m_util.is_int(p))));
|
||||
}
|
||||
}
|
||||
nm.del(l);
|
||||
nm.del(u);
|
||||
}
|
||||
|
||||
bool is_x_minus_y_eq_0(expr * t, expr * & x, expr * & y) {
|
||||
|
|
|
@ -85,7 +85,7 @@ model_converter * fpa2bv_model_converter::translate(ast_translation & translator
|
|||
}
|
||||
|
||||
void fpa2bv_model_converter::convert(model * bv_mdl, model * float_mdl) {
|
||||
float_util fu(m);
|
||||
fpa_util fu(m);
|
||||
bv_util bu(m);
|
||||
mpf fp_val;
|
||||
unsynch_mpz_manager & mpzm = fu.fm().mpz_manager();
|
||||
|
@ -112,16 +112,16 @@ void fpa2bv_model_converter::convert(model * bv_mdl, model * float_mdl) {
|
|||
unsigned sbits = fu.get_sbits(var->get_range());
|
||||
|
||||
expr_ref sgn(m), sig(m), exp(m);
|
||||
bv_mdl->eval(a->get_arg(0), sgn, true);
|
||||
bv_mdl->eval(a->get_arg(1), sig, true);
|
||||
bv_mdl->eval(a->get_arg(2), exp, true);
|
||||
bv_mdl->eval(a->get_arg(0), sgn, true);
|
||||
bv_mdl->eval(a->get_arg(1), exp, true);
|
||||
bv_mdl->eval(a->get_arg(2), sig, true);
|
||||
|
||||
SASSERT(a->is_app_of(fu.get_family_id(), OP_TO_FLOAT));
|
||||
SASSERT(a->is_app_of(fu.get_family_id(), OP_FPA_FP));
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
SASSERT(to_app(a->get_arg(0))->get_decl()->get_arity() == 0);
|
||||
SASSERT(to_app(a->get_arg(1))->get_decl()->get_arity() == 0);
|
||||
SASSERT(to_app(a->get_arg(1))->get_decl()->get_arity() == 0);
|
||||
SASSERT(to_app(a->get_arg(2))->get_decl()->get_arity() == 0);
|
||||
seen.insert(to_app(a->get_arg(0))->get_decl());
|
||||
seen.insert(to_app(a->get_arg(1))->get_decl());
|
||||
seen.insert(to_app(a->get_arg(2))->get_decl());
|
||||
|
@ -134,9 +134,9 @@ void fpa2bv_model_converter::convert(model * bv_mdl, model * float_mdl) {
|
|||
if (!sgn && !sig && !exp)
|
||||
continue;
|
||||
|
||||
unsigned sgn_sz = bu.get_bv_size(m.get_sort(a->get_arg(0)));
|
||||
unsigned sig_sz = bu.get_bv_size(m.get_sort(a->get_arg(1))) - 1;
|
||||
unsigned exp_sz = bu.get_bv_size(m.get_sort(a->get_arg(2)));
|
||||
unsigned sgn_sz = bu.get_bv_size(m.get_sort(a->get_arg(0)));
|
||||
unsigned exp_sz = bu.get_bv_size(m.get_sort(a->get_arg(1)));
|
||||
unsigned sig_sz = bu.get_bv_size(m.get_sort(a->get_arg(2))) - 1;
|
||||
|
||||
rational sgn_q(0), sig_q(0), exp_q(0);
|
||||
|
||||
|
@ -167,14 +167,15 @@ void fpa2bv_model_converter::convert(model * bv_mdl, model * float_mdl) {
|
|||
it++)
|
||||
{
|
||||
func_decl * var = it->m_key;
|
||||
app * a = to_app(it->m_value);
|
||||
expr * v = it->m_value;
|
||||
expr_ref eval_v(m);
|
||||
SASSERT(fu.is_rm(var->get_range()));
|
||||
rational val(0);
|
||||
rational bv_val(0);
|
||||
unsigned sz = 0;
|
||||
if (a && bu.is_numeral(a, val, sz)) {
|
||||
TRACE("fpa2bv_mc", tout << var->get_name() << " == " << val.to_string() << std::endl;);
|
||||
SASSERT(val.is_uint64());
|
||||
switch (val.get_uint64())
|
||||
if (v && bv_mdl->eval(v, eval_v, true) && bu.is_numeral(eval_v, bv_val, sz)) {
|
||||
TRACE("fpa2bv_mc", tout << var->get_name() << " == " << bv_val.to_string() << std::endl;);
|
||||
SASSERT(bv_val.is_uint64());
|
||||
switch (bv_val.get_uint64())
|
||||
{
|
||||
case BV_RM_TIES_TO_AWAY: float_mdl->register_decl(var, fu.mk_round_nearest_ties_to_away()); break;
|
||||
case BV_RM_TIES_TO_EVEN: float_mdl->register_decl(var, fu.mk_round_nearest_ties_to_even()); break;
|
||||
|
@ -183,7 +184,8 @@ void fpa2bv_model_converter::convert(model * bv_mdl, model * float_mdl) {
|
|||
case BV_RM_TO_ZERO:
|
||||
default: float_mdl->register_decl(var, fu.mk_round_toward_zero());
|
||||
}
|
||||
seen.insert(var);
|
||||
SASSERT(v->get_kind() == AST_APP);
|
||||
seen.insert(to_app(v)->get_decl());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,8 +96,8 @@ class fpa2bv_tactic : public tactic {
|
|||
g->inc_depth();
|
||||
result.push_back(g.get());
|
||||
|
||||
for (unsigned i = 0; i < m_conv.extra_assertions.size(); i++)
|
||||
result.back()->assert_expr(m_conv.extra_assertions[i].get());
|
||||
for (unsigned i = 0; i < m_conv.m_extra_assertions.size(); i++)
|
||||
result.back()->assert_expr(m_conv.m_extra_assertions[i].get());
|
||||
|
||||
SASSERT(g->is_well_sorted());
|
||||
TRACE("fpa2bv", tout << "AFTER: " << std::endl; g->display(tout);
|
||||
|
|
102
src/tactic/fpa/qffp_tactic.cpp
Normal file
102
src/tactic/fpa/qffp_tactic.cpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
qffpa_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Tactic for QF_FP benchmarks.
|
||||
|
||||
Author:
|
||||
|
||||
Christoph (cwinter) 2012-01-16
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"simplify_tactic.h"
|
||||
#include"bit_blaster_tactic.h"
|
||||
#include"sat_tactic.h"
|
||||
#include"fpa2bv_tactic.h"
|
||||
#include"smt_tactic.h"
|
||||
#include"propagate_values_tactic.h"
|
||||
|
||||
#include"qffp_tactic.h"
|
||||
|
||||
tactic * mk_qffp_tactic(ast_manager & m, params_ref const & p) {
|
||||
params_ref simp_p = p;
|
||||
simp_p.set_bool("arith_lhs", true);
|
||||
simp_p.set_bool("elim_and", true);
|
||||
|
||||
tactic * st = and_then(mk_simplify_tactic(m, simp_p),
|
||||
mk_propagate_values_tactic(m, p),
|
||||
cond(mk_or(mk_produce_proofs_probe(), mk_produce_unsat_cores_probe()),
|
||||
mk_smt_tactic(),
|
||||
and_then(
|
||||
mk_fpa2bv_tactic(m, p),
|
||||
using_params(mk_simplify_tactic(m, p), simp_p),
|
||||
mk_bit_blaster_tactic(m, p),
|
||||
using_params(mk_simplify_tactic(m, p), simp_p),
|
||||
cond(mk_is_propositional_probe(),
|
||||
mk_sat_tactic(m, p),
|
||||
mk_smt_tactic(p)),
|
||||
mk_fail_if_undecided_tactic())));
|
||||
|
||||
st->updt_params(p);
|
||||
return st;
|
||||
}
|
||||
|
||||
tactic * mk_qffpbv_tactic(ast_manager & m, params_ref const & p) {
|
||||
return mk_qffp_tactic(m, p);
|
||||
}
|
||||
|
||||
struct is_non_qffp_predicate {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
bv_util bu;
|
||||
fpa_util fu;
|
||||
arith_util au;
|
||||
|
||||
is_non_qffp_predicate(ast_manager & _m) : m(_m), bu(m), fu(m), au(m) {}
|
||||
|
||||
void operator()(var *) { throw found(); }
|
||||
|
||||
void operator()(quantifier *) { throw found(); }
|
||||
|
||||
void operator()(app * n) {
|
||||
sort * s = get_sort(n);
|
||||
if (!m.is_bool(s) && !fu.is_float(s) && !fu.is_rm(s) && !bu.is_bv_sort(s) && !au.is_real(s))
|
||||
throw found();
|
||||
family_id fid = n->get_family_id();
|
||||
if (fid == m.get_basic_family_id())
|
||||
return;
|
||||
if (fid == fu.get_family_id() || fid == bu.get_family_id())
|
||||
return;
|
||||
if (is_uninterp_const(n))
|
||||
return;
|
||||
if (au.is_real(s) && au.is_numeral(n))
|
||||
return;
|
||||
|
||||
throw found();
|
||||
}
|
||||
};
|
||||
|
||||
class is_qffp_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
return !test<is_non_qffp_predicate>(g);
|
||||
}
|
||||
|
||||
virtual ~is_qffp_probe() {}
|
||||
};
|
||||
|
||||
probe * mk_is_qffp_probe() {
|
||||
return alloc(is_qffp_probe);
|
||||
}
|
||||
|
||||
probe * mk_is_qffpbv_probe() {
|
||||
return alloc(is_qffp_probe);
|
||||
}
|
41
src/tactic/fpa/qffp_tactic.h
Normal file
41
src/tactic/fpa/qffp_tactic.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
qffp_tactic.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Tactic for QF_FP benchmarks.
|
||||
|
||||
Author:
|
||||
|
||||
Christoph (cwinter) 2012-01-16
|
||||
|
||||
Notes:
|
||||
|
||||
|
||||
--*/
|
||||
#ifndef _QFFP_TACTIC_H_
|
||||
#define _QFFP_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
tactic * mk_qffp_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
tactic * mk_qffpbv_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
/*
|
||||
ADD_TACTIC("qffp", "(try to) solve goal using the tactic for QF_FP.", "mk_qffp_tactic(m, p)")
|
||||
ADD_TACTIC("qffpbv", "(try to) solve goal using the tactic for QF_FPBV (floats+bit-vectors).", "mk_qffpbv_tactic(m, p)")
|
||||
*/
|
||||
|
||||
probe * mk_is_qffp_probe();
|
||||
probe * mk_is_qffpbv_probe();
|
||||
/*
|
||||
ADD_PROBE("is-qffp", "true if the goal is in QF_FP (floats).", "mk_is_qffp_probe()")
|
||||
ADD_PROBE("is-qffpbv", "true if the goal is in QF_FPBV (floats+bit-vectors).", "mk_is_qffpbv_probe()")
|
||||
*/
|
||||
|
||||
#endif
|
|
@ -1,116 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
qffpa_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Tactic for QF_FPA benchmarks.
|
||||
|
||||
Author:
|
||||
|
||||
Christoph (cwinter) 2012-01-16
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"simplify_tactic.h"
|
||||
#include"bit_blaster_tactic.h"
|
||||
#include"sat_tactic.h"
|
||||
#include"fpa2bv_tactic.h"
|
||||
|
||||
#include"qffpa_tactic.h"
|
||||
|
||||
tactic * mk_qffpa_tactic(ast_manager & m, params_ref const & p) {
|
||||
params_ref sat_simp_p = p;
|
||||
sat_simp_p .set_bool("elim_and", true);
|
||||
|
||||
return and_then(mk_simplify_tactic(m, p),
|
||||
mk_fpa2bv_tactic(m, p),
|
||||
using_params(mk_simplify_tactic(m, p), sat_simp_p),
|
||||
mk_bit_blaster_tactic(m, p),
|
||||
using_params(mk_simplify_tactic(m, p), sat_simp_p),
|
||||
mk_sat_tactic(m, p),
|
||||
mk_fail_if_undecided_tactic());
|
||||
}
|
||||
|
||||
struct is_non_qffpa_predicate {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
float_util u;
|
||||
|
||||
is_non_qffpa_predicate(ast_manager & _m) : m(_m), u(m) {}
|
||||
|
||||
void operator()(var *) { throw found(); }
|
||||
|
||||
void operator()(quantifier *) { throw found(); }
|
||||
|
||||
void operator()(app * n) {
|
||||
sort * s = get_sort(n);
|
||||
if (!m.is_bool(s) && !u.is_float(s) && !u.is_rm(s))
|
||||
throw found();
|
||||
family_id fid = n->get_family_id();
|
||||
if (fid == m.get_basic_family_id())
|
||||
return;
|
||||
if (fid == u.get_family_id())
|
||||
return;
|
||||
if (is_uninterp_const(n))
|
||||
return;
|
||||
|
||||
throw found();
|
||||
}
|
||||
};
|
||||
|
||||
struct is_non_qffpabv_predicate {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
bv_util bu;
|
||||
float_util fu;
|
||||
|
||||
is_non_qffpabv_predicate(ast_manager & _m) : m(_m), bu(m), fu(m) {}
|
||||
|
||||
void operator()(var *) { throw found(); }
|
||||
|
||||
void operator()(quantifier *) { throw found(); }
|
||||
|
||||
void operator()(app * n) {
|
||||
sort * s = get_sort(n);
|
||||
if (!(m.is_bool(s) || fu.is_float(s) || fu.is_rm(s) || bu.is_bv_sort(s)))
|
||||
throw found();
|
||||
family_id fid = n->get_family_id();
|
||||
if (fid == m.get_basic_family_id())
|
||||
return;
|
||||
if (fid == fu.get_family_id() || fid == bu.get_family_id())
|
||||
return;
|
||||
if (is_uninterp_const(n))
|
||||
return;
|
||||
|
||||
throw found();
|
||||
}
|
||||
};
|
||||
|
||||
class is_qffpa_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
return !test<is_non_qffpa_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
||||
class is_qffpabv_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
return !test<is_non_qffpabv_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
||||
probe * mk_is_qffpa_probe() {
|
||||
return alloc(is_qffpa_probe);
|
||||
}
|
||||
|
||||
probe * mk_is_qffpabv_probe() {
|
||||
return alloc(is_qffpabv_probe);
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
qffpa_tactic.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Tactic QF_FPA benchmarks.
|
||||
|
||||
Author:
|
||||
|
||||
Christoph (cwinter) 2012-01-16
|
||||
|
||||
Notes:
|
||||
|
||||
|
||||
--*/
|
||||
#ifndef _QFFPA_TACTIC_H_
|
||||
#define _QFFPA_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
tactic * mk_qffpa_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
/*
|
||||
ADD_TACTIC("qffpa", "(try to) solve goal using the tactic for QF_FPA.", "mk_qffpa_tactic(m, p)")
|
||||
ADD_TACTIC("qffpabv", "(try to) solve goal using the tactic for QF_FPABV (floats+bit-vectors).", "mk_qffpa_tactic(m, p)")
|
||||
*/
|
||||
|
||||
probe * mk_is_qffpa_probe();
|
||||
probe * mk_is_qffpabv_probe();
|
||||
/*
|
||||
ADD_PROBE("is-qffpa", "true if the goal is in QF_FPA (FloatingPoints).", "mk_is_qffpa_probe()")
|
||||
ADD_PROBE("is-qffpabv", "true if the goal is in QF_FPABV (FloatingPoints+Bitvectors).", "mk_is_qffpabv_probe()")
|
||||
*/
|
||||
|
||||
#endif
|
|
@ -27,19 +27,23 @@ Notes:
|
|||
#include"nra_tactic.h"
|
||||
#include"probe_arith.h"
|
||||
#include"quant_tactics.h"
|
||||
#include"qffpa_tactic.h"
|
||||
#include"qffp_tactic.h"
|
||||
#include"qfaufbv_tactic.h"
|
||||
#include"qfauflia_tactic.h"
|
||||
|
||||
tactic * mk_default_tactic(ast_manager & m, params_ref const & p) {
|
||||
tactic * st = using_params(and_then(mk_simplify_tactic(m),
|
||||
tactic * st = using_params(and_then(mk_simplify_tactic(m),
|
||||
cond(mk_is_qfbv_probe(), mk_qfbv_tactic(m),
|
||||
cond(mk_is_qfaufbv_probe(), mk_qfaufbv_tactic(m),
|
||||
cond(mk_is_qfauflia_probe(), mk_qfauflia_tactic(m),
|
||||
cond(mk_is_qflia_probe(), mk_qflia_tactic(m),
|
||||
cond(mk_is_qflra_probe(), mk_qflra_tactic(m),
|
||||
cond(mk_is_qfnra_probe(), mk_qfnra_tactic(m),
|
||||
cond(mk_is_qfnia_probe(), mk_qfnia_tactic(m),
|
||||
cond(mk_is_nra_probe(), mk_nra_tactic(m),
|
||||
cond(mk_is_lira_probe(), mk_lira_tactic(m, p),
|
||||
cond(mk_is_qffpabv_probe(), mk_qffpa_tactic(m, p),
|
||||
mk_smt_tactic()))))))))),
|
||||
cond(mk_is_qffp_probe(), mk_qffp_tactic(m, p),
|
||||
mk_smt_tactic()))))))))))),
|
||||
p);
|
||||
return st;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ Notes:
|
|||
#include"qfidl_tactic.h"
|
||||
#include"default_tactic.h"
|
||||
#include"ufbv_tactic.h"
|
||||
#include"qffpa_tactic.h"
|
||||
#include"qffp_tactic.h"
|
||||
#include"horn_tactic.h"
|
||||
#include"smt_solver.h"
|
||||
|
||||
|
@ -78,10 +78,10 @@ tactic * mk_tactic_for_logic(ast_manager & m, params_ref const & p, symbol const
|
|||
return mk_ufbv_tactic(m, p);
|
||||
else if (logic=="BV")
|
||||
return mk_ufbv_tactic(m, p);
|
||||
else if (logic=="QF_FPA")
|
||||
return mk_qffpa_tactic(m, p);
|
||||
else if (logic=="QF_FPABV")
|
||||
return mk_qffpa_tactic(m, p);
|
||||
else if (logic=="QF_FP")
|
||||
return mk_qffp_tactic(m, p);
|
||||
else if (logic == "QF_FPBV")
|
||||
return mk_qffpbv_tactic(m, p);
|
||||
else if (logic=="HORN")
|
||||
return mk_horn_tactic(m, p);
|
||||
else
|
||||
|
|
|
@ -315,6 +315,44 @@ probe * mk_is_qfbv_probe() {
|
|||
return alloc(is_qfbv_probe);
|
||||
}
|
||||
|
||||
struct is_non_qfaufbv_predicate {
|
||||
struct found {};
|
||||
ast_manager & m;
|
||||
bv_util m_bv_util;
|
||||
array_util m_array_util;
|
||||
|
||||
is_non_qfaufbv_predicate(ast_manager & _m) : m(_m), m_bv_util(_m), m_array_util(_m) {}
|
||||
|
||||
void operator()(var *) { throw found(); }
|
||||
|
||||
void operator()(quantifier *) { throw found(); }
|
||||
|
||||
void operator()(app * n) {
|
||||
if (!m.is_bool(n) && !m_bv_util.is_bv(n) && !m_array_util.is_array(n))
|
||||
throw found();
|
||||
family_id fid = n->get_family_id();
|
||||
if (fid == m.get_basic_family_id())
|
||||
return;
|
||||
if (fid == m_bv_util.get_family_id() || fid == m_array_util.get_family_id())
|
||||
return;
|
||||
if (is_uninterp(n))
|
||||
return;
|
||||
|
||||
throw found();
|
||||
}
|
||||
};
|
||||
|
||||
class is_qfaufbv_probe : public probe {
|
||||
public:
|
||||
virtual result operator()(goal const & g) {
|
||||
return !test<is_non_qfaufbv_predicate>(g);
|
||||
}
|
||||
};
|
||||
|
||||
probe * mk_is_qfaufbv_probe() {
|
||||
return alloc(is_qfaufbv_probe);
|
||||
}
|
||||
|
||||
class num_consts_probe : public probe {
|
||||
bool m_bool; // If true, track only boolean constants. Otherwise, track only non boolean constants.
|
||||
char const * m_family; // (Ignored if m_bool == true), if != 0 and m_bool == true, then track only constants of the given family.
|
||||
|
|
|
@ -111,10 +111,12 @@ probe * mk_div(probe * p1, probe * p2);
|
|||
|
||||
probe * mk_is_propositional_probe();
|
||||
probe * mk_is_qfbv_probe();
|
||||
probe * mk_is_qfaufbv_probe();
|
||||
|
||||
/*
|
||||
ADD_PROBE("is-propositional", "true if the goal is in propositional logic.", "mk_is_propositional_probe()")
|
||||
ADD_PROBE("is-qfbv", "true if the goal is in QF_BV.", "mk_is_qfbv_probe()")
|
||||
ADD_PROBE("is-qfaufbv", "true if the goal is in QF_AUFBV.", "mk_is_qfaufbv_probe()")
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,8 +16,7 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include<float.h>
|
||||
#include<iomanip>
|
||||
#include<float.h> // Need DBL_MAX
|
||||
|
||||
#include"map.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
|
@ -570,8 +569,12 @@ void sls_engine::operator()(goal_ref const & g, model_converter_ref & mc) {
|
|||
mc = 0;
|
||||
}
|
||||
|
||||
lbool sls_engine::operator()() {
|
||||
lbool sls_engine::operator()() {
|
||||
m_tracker.initialize(m_assertions);
|
||||
m_tracker.reset(m_assertions);
|
||||
if (m_restart_init)
|
||||
m_tracker.randomize(m_assertions);
|
||||
|
||||
lbool res = l_undef;
|
||||
|
||||
do {
|
||||
|
@ -589,7 +592,7 @@ lbool sls_engine::operator()() {
|
|||
}
|
||||
} while (res != l_true && m_stats.m_restarts++ < m_max_restarts);
|
||||
|
||||
verbose_stream() << "(restarts: " << m_stats.m_restarts << " flips: " << m_stats.m_moves << " time: " << std::fixed << std::setprecision(2) << m_stats.m_stopwatch.get_current_seconds() << " fps: " << (m_stats.m_moves / m_stats.m_stopwatch.get_current_seconds()) << ")" << std::endl;
|
||||
verbose_stream() << "(restarts: " << m_stats.m_restarts << " flips: " << m_stats.m_moves << " fps: " << (m_stats.m_moves / m_stats.m_stopwatch.get_current_seconds()) << ")" << std::endl;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -147,8 +147,7 @@ tactic * mk_preamble(ast_manager & m, params_ref const & p) {
|
|||
}
|
||||
|
||||
tactic * mk_qfbv_sls_tactic(ast_manager & m, params_ref const & p) {
|
||||
tactic * t = and_then(mk_preamble(m, p), mk_sls_tactic(m));
|
||||
//tactic * t = and_then(mk_simplify_tactic(m), mk_nnf_tactic(m, p), mk_sls_tactic(m));
|
||||
tactic * t = and_then(mk_preamble(m, p), mk_sls_tactic(m, p));
|
||||
t->updt_params(p);
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ Notes:
|
|||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
tactic * mk_sls_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
tactic * mk_qfbv_sls_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
||||
/*
|
||||
ADD_TACTIC("qfbv-sls", "(try to) solve using stochastic local search for QF_BV.", "mk_qfbv_sls_tactic(m, p)")
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,7 @@ class sls_tracker {
|
|||
mpz m_zero, m_one, m_two;
|
||||
|
||||
struct value_score {
|
||||
value_score() : m(0), value(unsynch_mpz_manager::mk_z(0)), score(0.0), distance(0), touched(1), score_prune(0.0), has_pos_occ(0), has_neg_occ(0) { };
|
||||
value_score() : m(0), value(unsynch_mpz_manager::mk_z(0)), score(0.0), score_prune(0.0), has_pos_occ(0), has_neg_occ(0), distance(0), touched(1) {};
|
||||
~value_score() { if (m) m->del(value); }
|
||||
unsynch_mpz_manager * m;
|
||||
mpz value;
|
||||
|
@ -90,6 +90,7 @@ private:
|
|||
unsigned m_track_unsat;
|
||||
obj_map<expr, unsigned> m_weights;
|
||||
double m_top_sum;
|
||||
obj_hashtable<expr> m_temp_seen;
|
||||
|
||||
public:
|
||||
sls_tracker(ast_manager & m, bv_util & bvu, unsynch_mpz_manager & mm, powers & p) :
|
||||
|
@ -454,6 +455,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
m_temp_seen.reset();
|
||||
for (unsigned i = 0; i < sz; i++)
|
||||
{
|
||||
expr * e = as[i];
|
||||
|
@ -666,7 +668,14 @@ public:
|
|||
app * a = to_app(n);
|
||||
expr * const * args = a->get_args();
|
||||
for (unsigned i = 0; i < a->get_num_args(); i++)
|
||||
setup_occs(args[i]);
|
||||
{
|
||||
expr * child = args[i];
|
||||
if (!m_temp_seen.contains(child))
|
||||
{
|
||||
setup_occs(child, false);
|
||||
m_temp_seen.insert(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_manager.is_not(n))
|
||||
{
|
||||
|
@ -674,8 +683,7 @@ public:
|
|||
app * a = to_app(n);
|
||||
SASSERT(a->get_num_args() == 1);
|
||||
expr * child = a->get_arg(0);
|
||||
if (m_manager.is_and(child) || m_manager.is_or(child))
|
||||
NOT_IMPLEMENTED_YET();
|
||||
SASSERT(!m_manager.is_and(child) && !m_manager.is_or(child));
|
||||
setup_occs(child, true);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -134,14 +134,4 @@ tactic * mk_qfbv_tactic(ast_manager & m, params_ref const & p) {
|
|||
|
||||
}
|
||||
|
||||
/* use full sls
|
||||
tactic * st = main_p(and_then(preamble_st,
|
||||
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_nnf_tactic(m, p), mk_sls_tactic(m))),
|
||||
mk_smt_tactic())));
|
||||
*/
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue