mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
Reorganizing the code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
2b8fb6c718
commit
492484c5aa
|
@ -7,7 +7,7 @@ Module Name:
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
Add symmetry breaking predicates to assertion sets.
|
Add symmetry breaking predicates to goals.
|
||||||
|
|
||||||
Author:
|
Author:
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ Notes:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
#include"tactical.h"
|
#include"tactical.h"
|
||||||
#include"assertion_set.h"
|
|
||||||
#include"for_each_expr.h"
|
#include"for_each_expr.h"
|
||||||
#include"map.h"
|
#include"map.h"
|
||||||
#include"expr_replacer.h"
|
#include"expr_replacer.h"
|
||||||
|
|
|
@ -33,4 +33,10 @@ add_lib('simplifier', ['util', 'ast', 'rewriter', 'old_params'])
|
||||||
# We must replace all occurrences of simplifier with rewriter.
|
# We must replace all occurrences of simplifier with rewriter.
|
||||||
add_lib('model', ['util', 'ast', 'rewriter', 'simplifier', 'old_params'])
|
add_lib('model', ['util', 'ast', 'rewriter', 'simplifier', 'old_params'])
|
||||||
add_lib('framework', ['util', 'ast', 'model', 'old_params', 'simplifier', 'rewriter'])
|
add_lib('framework', ['util', 'ast', 'model', 'old_params', 'simplifier', 'rewriter'])
|
||||||
|
# Assertion set is the old tactic framework used in Z3 3.x. It will be deleted as soon as we finish the porting old
|
||||||
|
# code to the new tactic framework.
|
||||||
|
add_lib('assertion_set', ['util', 'ast', 'framework', 'model', 'rewriter', 'old_params'])
|
||||||
|
add_lib('normal_forms', ['util', 'ast', 'old_params', 'simplifier', 'rewriter', 'assertion_set', 'framework', 'model'])
|
||||||
|
add_lib('smt', ['util', 'ast', 'assertion_set'])
|
||||||
|
add_lib('pattern', ['util', 'ast'])
|
||||||
|
add_lib('spc', ['util', 'ast', 'simplifier', 'pattern', 'model', 'old_params', 'normal_forms', 'rewriter'])
|
||||||
|
|
1
src/assertion_set/README
Normal file
1
src/assertion_set/README
Normal file
|
@ -0,0 +1 @@
|
||||||
|
This module is obsolete. It is subsumed by the tactic module.
|
|
@ -21,7 +21,6 @@ Notes:
|
||||||
#include"cooperate.h"
|
#include"cooperate.h"
|
||||||
#include"scoped_timer.h"
|
#include"scoped_timer.h"
|
||||||
#include"cancel_eh.h"
|
#include"cancel_eh.h"
|
||||||
#include"smt_solver.h"
|
|
||||||
#include"front_end_params.h"
|
#include"front_end_params.h"
|
||||||
#include"progress_callback.h"
|
#include"progress_callback.h"
|
||||||
#include"params2front_end_params.h"
|
#include"params2front_end_params.h"
|
||||||
|
@ -1201,164 +1200,6 @@ struct check_decided_test : public as_test {
|
||||||
|
|
||||||
as_test * check_decided() { return alloc(check_decided_test); }
|
as_test * check_decided() { return alloc(check_decided_test); }
|
||||||
|
|
||||||
class as_st_solver : public assertion_set_strategy {
|
|
||||||
scoped_ptr<front_end_params> m_params;
|
|
||||||
params_ref m_params_ref;
|
|
||||||
statistics m_stats;
|
|
||||||
std::string m_failure;
|
|
||||||
smt::solver * m_ctx;
|
|
||||||
bool m_candidate_models;
|
|
||||||
symbol m_logic;
|
|
||||||
progress_callback * m_callback;
|
|
||||||
public:
|
|
||||||
as_st_solver(bool candidate_models):m_ctx(0), m_candidate_models(candidate_models), m_callback(0) {}
|
|
||||||
|
|
||||||
front_end_params & fparams() {
|
|
||||||
if (!m_params)
|
|
||||||
m_params = alloc(front_end_params);
|
|
||||||
return *m_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct scoped_init_ctx {
|
|
||||||
as_st_solver & m_owner;
|
|
||||||
|
|
||||||
scoped_init_ctx(as_st_solver & o, ast_manager & m):m_owner(o) {
|
|
||||||
smt::solver * new_ctx = alloc(smt::solver, m, o.fparams());
|
|
||||||
TRACE("as_solver", tout << "logic: " << o.m_logic << "\n";);
|
|
||||||
new_ctx->set_logic(o.m_logic);
|
|
||||||
if (o.m_callback) {
|
|
||||||
new_ctx->set_progress_callback(o.m_callback);
|
|
||||||
}
|
|
||||||
#pragma omp critical (as_st_solver)
|
|
||||||
{
|
|
||||||
o.m_ctx = new_ctx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~scoped_init_ctx() {
|
|
||||||
smt::solver * d = m_owner.m_ctx;
|
|
||||||
#pragma omp critical (as_st_cancel)
|
|
||||||
{
|
|
||||||
m_owner.m_ctx = 0;
|
|
||||||
}
|
|
||||||
if (d)
|
|
||||||
dealloc(d);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~as_st_solver() {
|
|
||||||
SASSERT(m_ctx == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void updt_params(params_ref const & p) {
|
|
||||||
TRACE("as_solver", tout << "updt_params: " << p << "\n";);
|
|
||||||
m_params_ref = p;
|
|
||||||
params2front_end_params(m_params_ref, fparams());
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void collect_param_descrs(param_descrs & r) {
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void set_cancel(bool f) {
|
|
||||||
if (m_ctx)
|
|
||||||
m_ctx->set_cancel(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void operator()(assertion_set & s, model_converter_ref & mc) {
|
|
||||||
SASSERT(is_well_sorted(s));
|
|
||||||
IF_VERBOSE(ST_VERBOSITY_LVL, verbose_stream() << "(smt-solver)" << std::endl;);
|
|
||||||
TRACE("as_solver", tout << "AUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " "
|
|
||||||
<< " PREPROCESS: " << fparams().m_preprocess << ", SOLVER:" << fparams().m_solver << "\n";);
|
|
||||||
TRACE("as_solver_detail", s.display(tout););
|
|
||||||
ast_manager & m = s.m();
|
|
||||||
TRACE("as_solver_memory", tout << "wasted_size: " << m.get_allocator().get_wasted_size() << "\n";);
|
|
||||||
// verbose_stream() << "wasted_size: " << m.get_allocator().get_wasted_size() << ", free_objs: " << m.get_allocator().get_num_free_objs() << "\n";
|
|
||||||
// m.get_allocator().consolidate();
|
|
||||||
scoped_init_ctx init(*this, m);
|
|
||||||
SASSERT(m_ctx != 0);
|
|
||||||
unsigned sz = s.size();
|
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
|
||||||
expr * f = s.form(i);
|
|
||||||
m_ctx->assert_expr(f);
|
|
||||||
}
|
|
||||||
lbool r = m_ctx->setup_and_check();
|
|
||||||
m_ctx->collect_statistics(m_stats);
|
|
||||||
switch (r) {
|
|
||||||
case l_true: {
|
|
||||||
// the empty assertion set is trivially satifiable.
|
|
||||||
s.reset();
|
|
||||||
// store the model in a do nothin model converter.
|
|
||||||
model_ref md;
|
|
||||||
m_ctx->get_model(md);
|
|
||||||
mc = model2model_converter(md.get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case l_false:
|
|
||||||
// formula is unsat, reset the assertion set, and store false there.
|
|
||||||
s.reset();
|
|
||||||
s.assert_expr(m.mk_false(), m_ctx->get_proof());
|
|
||||||
return;
|
|
||||||
case l_undef:
|
|
||||||
if (m_candidate_models) {
|
|
||||||
switch (m_ctx->last_failure()) {
|
|
||||||
case smt::NUM_CONFLICTS:
|
|
||||||
case smt::THEORY:
|
|
||||||
case smt::QUANTIFIERS: {
|
|
||||||
model_ref md;
|
|
||||||
m_ctx->get_model(md);
|
|
||||||
mc = model2model_converter(md.get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_failure = m_ctx->last_failure_as_string();
|
|
||||||
throw strategy_exception(m_failure.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void collect_statistics(statistics & st) const {
|
|
||||||
if (m_ctx)
|
|
||||||
m_ctx->collect_statistics(st); // ctx is still running...
|
|
||||||
else
|
|
||||||
st.copy(m_stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void cleanup() {
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void reset_statistics() {
|
|
||||||
m_stats.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
// for backward compatibility
|
|
||||||
virtual void set_front_end_params(front_end_params & p) {
|
|
||||||
m_params = alloc(front_end_params, p);
|
|
||||||
// must propagate the params_ref to fparams
|
|
||||||
params2front_end_params(m_params_ref, fparams());
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void set_logic(symbol const & l) {
|
|
||||||
m_logic = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void set_progress_callback(progress_callback * callback) {
|
|
||||||
m_callback = callback;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
as_st * mk_smt_solver_core(bool candidate_models) {
|
|
||||||
return alloc(as_st_solver, candidate_models);
|
|
||||||
}
|
|
||||||
|
|
||||||
as_st * mk_smt_solver(bool auto_config, bool candidate_models) {
|
|
||||||
as_st * solver = mk_smt_solver_core(candidate_models);
|
|
||||||
params_ref solver_p;
|
|
||||||
solver_p.set_bool(":auto-config", auto_config);
|
|
||||||
return using_params(solver, solver_p);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Execute strategy st on the given assertion set.
|
\brief Execute strategy st on the given assertion set.
|
||||||
*/
|
*/
|
|
@ -167,9 +167,6 @@ as_test * check_as_size(unsigned l);
|
||||||
as_test * check_decided();
|
as_test * check_decided();
|
||||||
as_st * cond(as_test * c, as_st * t, as_st * e);
|
as_st * cond(as_test * c, as_st * t, as_st * e);
|
||||||
|
|
||||||
as_st * mk_smt_solver_core(bool candidate_models = false);
|
|
||||||
as_st * mk_smt_solver(bool auto_config = true, bool candidate_models = false);
|
|
||||||
|
|
||||||
void exec(as_st * st, assertion_set & s, model_converter_ref & mc);
|
void exec(as_st * st, assertion_set & s, model_converter_ref & mc);
|
||||||
lbool check_sat(as_st * st, assertion_set & s, model_ref & md, proof_ref & pr, std::string & reason_unknown);
|
lbool check_sat(as_st * st, assertion_set & s, model_ref & md, proof_ref & pr, std::string & reason_unknown);
|
||||||
|
|
||||||
|
@ -207,8 +204,6 @@ public:
|
||||||
|
|
||||||
#define MK_SIMPLE_ST_FACTORY(NAME, ST) MK_ST_FACTORY(NAME, return ST;)
|
#define MK_SIMPLE_ST_FACTORY(NAME, ST) MK_ST_FACTORY(NAME, return ST;)
|
||||||
|
|
||||||
MK_SIMPLE_ST_FACTORY(smt_solver_stf, mk_smt_solver());
|
|
||||||
|
|
||||||
struct is_qfbv_test : public as_test {
|
struct is_qfbv_test : public as_test {
|
||||||
virtual bool operator()(assertion_set const & s) const { return is_qfbv(s); }
|
virtual bool operator()(assertion_set const & s) const { return is_qfbv(s); }
|
||||||
};
|
};
|
94
src/assertion_set/der_strategy.cpp
Normal file
94
src/assertion_set/der_strategy.cpp
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
der_strategy.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
DER strategy
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include"der_strategy.h"
|
||||||
|
|
||||||
|
struct der_strategy::imp {
|
||||||
|
ast_manager & m_manager;
|
||||||
|
der_rewriter m_r;
|
||||||
|
|
||||||
|
imp(ast_manager & m):
|
||||||
|
m_manager(m),
|
||||||
|
m_r(m) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ast_manager & m() const { return m_manager; }
|
||||||
|
|
||||||
|
void set_cancel(bool f) {
|
||||||
|
m_r.set_cancel(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
m_r.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(assertion_set & s) {
|
||||||
|
SASSERT(is_well_sorted(s));
|
||||||
|
as_st_report report("der", s);
|
||||||
|
TRACE("before_der", s.display(tout););
|
||||||
|
if (s.inconsistent())
|
||||||
|
return;
|
||||||
|
expr_ref new_curr(m());
|
||||||
|
proof_ref new_pr(m());
|
||||||
|
unsigned size = s.size();
|
||||||
|
for (unsigned idx = 0; idx < size; idx++) {
|
||||||
|
if (s.inconsistent())
|
||||||
|
break;
|
||||||
|
expr * curr = s.form(idx);
|
||||||
|
m_r(curr, new_curr, new_pr);
|
||||||
|
if (m().proofs_enabled()) {
|
||||||
|
proof * pr = s.pr(idx);
|
||||||
|
new_pr = m().mk_modus_ponens(pr, new_pr);
|
||||||
|
}
|
||||||
|
s.update(idx, new_curr, new_pr);
|
||||||
|
}
|
||||||
|
s.elim_redundancies();
|
||||||
|
TRACE("after_der", s.display(tout););
|
||||||
|
SASSERT(is_well_sorted(s));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
der_strategy::der_strategy(ast_manager & m) {
|
||||||
|
m_imp = alloc(imp, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
der_strategy::~der_strategy() {
|
||||||
|
dealloc(m_imp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void der_strategy::operator()(assertion_set & s) {
|
||||||
|
m_imp->operator()(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void der_strategy::set_cancel(bool f) {
|
||||||
|
if (m_imp)
|
||||||
|
m_imp->set_cancel(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void der_strategy::cleanup() {
|
||||||
|
ast_manager & m = m_imp->m();
|
||||||
|
imp * d = m_imp;
|
||||||
|
#pragma omp critical (as_st_cancel)
|
||||||
|
{
|
||||||
|
m_imp = 0;
|
||||||
|
}
|
||||||
|
dealloc(d);
|
||||||
|
d = alloc(imp, m);
|
||||||
|
#pragma omp critical (as_st_cancel)
|
||||||
|
{
|
||||||
|
m_imp = d;
|
||||||
|
}
|
||||||
|
}
|
47
src/assertion_set/der_strategy.h
Normal file
47
src/assertion_set/der_strategy.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
der_strategy.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
DER strategy
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _DER_STRATEGY_H_
|
||||||
|
#define _DER_STRATEGY_H_
|
||||||
|
|
||||||
|
#include"der.h"
|
||||||
|
#include"assertion_set_strategy.h"
|
||||||
|
|
||||||
|
// TODO: delete obsolete class
|
||||||
|
class der_strategy : public assertion_set_strategy {
|
||||||
|
struct imp;
|
||||||
|
imp * m_imp;
|
||||||
|
public:
|
||||||
|
der_strategy(ast_manager & m);
|
||||||
|
virtual ~der_strategy();
|
||||||
|
|
||||||
|
void operator()(assertion_set & s);
|
||||||
|
|
||||||
|
virtual void operator()(assertion_set & s, model_converter_ref & mc) {
|
||||||
|
operator()(s);
|
||||||
|
mc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void cleanup();
|
||||||
|
virtual void set_cancel(bool f);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline as_st * mk_der(ast_manager & m) {
|
||||||
|
return alloc(der_strategy, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
29
src/assertion_set/num_occurs_assertion_set.cpp
Normal file
29
src/assertion_set/num_occurs_assertion_set.cpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
num_occurs_assertion_set.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
TODO: delete
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include"num_occurs_assertion_set.h"
|
||||||
|
#include"assertion_set.h"
|
||||||
|
|
||||||
|
// TODO delete
|
||||||
|
void num_occurs_as::operator()(assertion_set const & s) {
|
||||||
|
expr_fast_mark1 visited;
|
||||||
|
unsigned sz = s.size();
|
||||||
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
|
process(s.form(i), visited);
|
||||||
|
}
|
||||||
|
}
|
38
src/assertion_set/num_occurs_assertion_set.h
Normal file
38
src/assertion_set/num_occurs_assertion_set.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
num_occurs_assertion_set.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
TODO: delete
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _NUM_OCCURS_AS_H_
|
||||||
|
#define _NUM_OCCURS_AS_H_
|
||||||
|
|
||||||
|
#include"num_occurs.h"
|
||||||
|
|
||||||
|
class assertion_set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Functor for computing the number of occurrences of each sub-expression in a expression F.
|
||||||
|
*/
|
||||||
|
class num_occurs_as : public num_occurs {
|
||||||
|
public:
|
||||||
|
num_occurs_as(bool ignore_ref_count1 = false, bool ignore_quantifiers = false):
|
||||||
|
num_occurs(ignore_ref_count1, ignore_quantifiers) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(assertion_set const & s); // TODO delete
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -18,8 +18,6 @@ Revision History:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include"num_occurs.h"
|
#include"num_occurs.h"
|
||||||
#include"assertion_set.h"
|
|
||||||
#include"goal.h"
|
|
||||||
|
|
||||||
void num_occurs::process(expr * t, expr_fast_mark1 & visited) {
|
void num_occurs::process(expr * t, expr_fast_mark1 & visited) {
|
||||||
ptr_buffer<expr, 128> stack;
|
ptr_buffer<expr, 128> stack;
|
||||||
|
@ -74,19 +72,3 @@ void num_occurs::operator()(unsigned num, expr * const * ts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO delete
|
|
||||||
void num_occurs::operator()(assertion_set const & s) {
|
|
||||||
expr_fast_mark1 visited;
|
|
||||||
unsigned sz = s.size();
|
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
|
||||||
process(s.form(i), visited);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void num_occurs::operator()(goal const & g) {
|
|
||||||
expr_fast_mark1 visited;
|
|
||||||
unsigned sz = g.size();
|
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
|
||||||
process(g.form(i), visited);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,13 +22,11 @@ Revision History:
|
||||||
#include"ast.h"
|
#include"ast.h"
|
||||||
#include"obj_hashtable.h"
|
#include"obj_hashtable.h"
|
||||||
|
|
||||||
class assertion_set; // TODO delete
|
|
||||||
class goal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Functor for computing the number of occurrences of each sub-expression in a expression F.
|
\brief Functor for computing the number of occurrences of each sub-expression in a expression F.
|
||||||
*/
|
*/
|
||||||
class num_occurs {
|
class num_occurs {
|
||||||
|
protected:
|
||||||
bool m_ignore_ref_count1;
|
bool m_ignore_ref_count1;
|
||||||
bool m_ignore_quantifiers;
|
bool m_ignore_quantifiers;
|
||||||
obj_map<expr, unsigned> m_num_occurs;
|
obj_map<expr, unsigned> m_num_occurs;
|
||||||
|
@ -44,8 +42,6 @@ public:
|
||||||
|
|
||||||
void operator()(expr * t);
|
void operator()(expr * t);
|
||||||
void operator()(unsigned num, expr * const * ts);
|
void operator()(unsigned num, expr * const * ts);
|
||||||
void operator()(assertion_set const & s); // TODO delete
|
|
||||||
void operator()(goal const & s);
|
|
||||||
|
|
||||||
unsigned get_num_occs(expr * n) const {
|
unsigned get_num_occs(expr * n) const {
|
||||||
unsigned val;
|
unsigned val;
|
114
src/framework/der_tactic.cpp
Normal file
114
src/framework/der_tactic.cpp
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
der_tactic.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
DER tactic
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include"der.h"
|
||||||
|
#include"tactical.h"
|
||||||
|
|
||||||
|
class der_tactic : public tactic {
|
||||||
|
struct imp {
|
||||||
|
ast_manager & m_manager;
|
||||||
|
der_rewriter m_r;
|
||||||
|
|
||||||
|
imp(ast_manager & m):
|
||||||
|
m_manager(m),
|
||||||
|
m_r(m) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ast_manager & m() const { return m_manager; }
|
||||||
|
|
||||||
|
void set_cancel(bool f) {
|
||||||
|
m_r.set_cancel(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
m_r.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(goal & g) {
|
||||||
|
SASSERT(g.is_well_sorted());
|
||||||
|
bool proofs_enabled = g.proofs_enabled();
|
||||||
|
tactic_report report("der", g);
|
||||||
|
TRACE("before_der", g.display(tout););
|
||||||
|
expr_ref new_curr(m());
|
||||||
|
proof_ref new_pr(m());
|
||||||
|
unsigned size = g.size();
|
||||||
|
for (unsigned idx = 0; idx < size; idx++) {
|
||||||
|
if (g.inconsistent())
|
||||||
|
break;
|
||||||
|
expr * curr = g.form(idx);
|
||||||
|
m_r(curr, new_curr, new_pr);
|
||||||
|
if (proofs_enabled) {
|
||||||
|
proof * pr = g.pr(idx);
|
||||||
|
new_pr = m().mk_modus_ponens(pr, new_pr);
|
||||||
|
}
|
||||||
|
g.update(idx, new_curr, new_pr, g.dep(idx));
|
||||||
|
}
|
||||||
|
g.elim_redundancies();
|
||||||
|
TRACE("after_der", g.display(tout););
|
||||||
|
SASSERT(g.is_well_sorted());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
imp * m_imp;
|
||||||
|
|
||||||
|
public:
|
||||||
|
der_tactic(ast_manager & m) {
|
||||||
|
m_imp = alloc(imp, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual tactic * translate(ast_manager & m) {
|
||||||
|
return alloc(der_tactic, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~der_tactic() {
|
||||||
|
dealloc(m_imp);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void operator()(goal_ref const & in,
|
||||||
|
goal_ref_buffer & result,
|
||||||
|
model_converter_ref & mc,
|
||||||
|
proof_converter_ref & pc,
|
||||||
|
expr_dependency_ref & core) {
|
||||||
|
mc = 0; pc = 0; core = 0;
|
||||||
|
(*m_imp)(*(in.get()));
|
||||||
|
in->inc_depth();
|
||||||
|
result.push_back(in.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void cleanup() {
|
||||||
|
ast_manager & m = m_imp->m();
|
||||||
|
imp * d = m_imp;
|
||||||
|
#pragma omp critical (tactic_cancel)
|
||||||
|
{
|
||||||
|
m_imp = 0;
|
||||||
|
}
|
||||||
|
dealloc(d);
|
||||||
|
d = alloc(imp, m);
|
||||||
|
#pragma omp critical (tactic_cancel)
|
||||||
|
{
|
||||||
|
m_imp = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set_cancel(bool f) {
|
||||||
|
if (m_imp)
|
||||||
|
m_imp->set_cancel(f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
tactic * mk_der_tactic(ast_manager & m) {
|
||||||
|
return alloc(der_tactic, m);
|
||||||
|
}
|
25
src/framework/der_tactic.h
Normal file
25
src/framework/der_tactic.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
der_tactic.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
DER tactic
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _DER_TACTIC_H_
|
||||||
|
#define _DER_TACTIC_H_
|
||||||
|
|
||||||
|
class ast_manager;
|
||||||
|
class tactic;
|
||||||
|
|
||||||
|
tactic * mk_der_tactic(ast_manager & m);
|
||||||
|
|
||||||
|
#endif /* _DER_TACTIC_H_ */
|
27
src/framework/num_occurs_goal.cpp
Normal file
27
src/framework/num_occurs_goal.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
num_occurs_goal.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include"num_occurs_goal.h"
|
||||||
|
#include"goal.h"
|
||||||
|
|
||||||
|
void num_occurs_goal::operator()(goal const & g) {
|
||||||
|
expr_fast_mark1 visited;
|
||||||
|
unsigned sz = g.size();
|
||||||
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
|
process(g.form(i), visited);
|
||||||
|
}
|
||||||
|
}
|
35
src/framework/num_occurs_goal.h
Normal file
35
src/framework/num_occurs_goal.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
num_occurs_goal.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2012-10-20.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _NUM_OCCURS_GOAL_H_
|
||||||
|
#define _NUM_OCCURS_GOAL_H_
|
||||||
|
|
||||||
|
#include"num_occurs.h"
|
||||||
|
|
||||||
|
class goal;
|
||||||
|
|
||||||
|
class num_occurs_goal : public num_occurs {
|
||||||
|
public:
|
||||||
|
num_occurs_goal(bool ignore_ref_count1 = false, bool ignore_quantifiers = false):
|
||||||
|
num_occurs(ignore_ref_count1, ignore_quantifiers) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(goal const & s);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -25,7 +25,6 @@ Revision History:
|
||||||
#include"ast_pp.h"
|
#include"ast_pp.h"
|
||||||
#include"ast_ll_pp.h"
|
#include"ast_ll_pp.h"
|
||||||
#include"ast_smt2_pp.h"
|
#include"ast_smt2_pp.h"
|
||||||
#include"tactical.h"
|
|
||||||
|
|
||||||
static bool is_var(expr * e, unsigned num_decls) {
|
static bool is_var(expr * e, unsigned num_decls) {
|
||||||
return is_var(e) && to_var(e)->get_idx() < num_decls;
|
return is_var(e) && to_var(e)->get_idx() < num_decls;
|
||||||
|
@ -465,175 +464,4 @@ void der_rewriter::reset() {
|
||||||
m_imp->reset();
|
m_imp->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct der_strategy::imp {
|
|
||||||
ast_manager & m_manager;
|
|
||||||
der_rewriter m_r;
|
|
||||||
|
|
||||||
imp(ast_manager & m):
|
|
||||||
m_manager(m),
|
|
||||||
m_r(m) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ast_manager & m() const { return m_manager; }
|
|
||||||
|
|
||||||
void set_cancel(bool f) {
|
|
||||||
m_r.set_cancel(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
m_r.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(assertion_set & s) {
|
|
||||||
SASSERT(is_well_sorted(s));
|
|
||||||
as_st_report report("der", s);
|
|
||||||
TRACE("before_der", s.display(tout););
|
|
||||||
if (s.inconsistent())
|
|
||||||
return;
|
|
||||||
expr_ref new_curr(m());
|
|
||||||
proof_ref new_pr(m());
|
|
||||||
unsigned size = s.size();
|
|
||||||
for (unsigned idx = 0; idx < size; idx++) {
|
|
||||||
if (s.inconsistent())
|
|
||||||
break;
|
|
||||||
expr * curr = s.form(idx);
|
|
||||||
m_r(curr, new_curr, new_pr);
|
|
||||||
if (m().proofs_enabled()) {
|
|
||||||
proof * pr = s.pr(idx);
|
|
||||||
new_pr = m().mk_modus_ponens(pr, new_pr);
|
|
||||||
}
|
|
||||||
s.update(idx, new_curr, new_pr);
|
|
||||||
}
|
|
||||||
s.elim_redundancies();
|
|
||||||
TRACE("after_der", s.display(tout););
|
|
||||||
SASSERT(is_well_sorted(s));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
der_strategy::der_strategy(ast_manager & m) {
|
|
||||||
m_imp = alloc(imp, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
der_strategy::~der_strategy() {
|
|
||||||
dealloc(m_imp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void der_strategy::operator()(assertion_set & s) {
|
|
||||||
m_imp->operator()(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void der_strategy::set_cancel(bool f) {
|
|
||||||
if (m_imp)
|
|
||||||
m_imp->set_cancel(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void der_strategy::cleanup() {
|
|
||||||
ast_manager & m = m_imp->m();
|
|
||||||
imp * d = m_imp;
|
|
||||||
#pragma omp critical (as_st_cancel)
|
|
||||||
{
|
|
||||||
m_imp = 0;
|
|
||||||
}
|
|
||||||
dealloc(d);
|
|
||||||
d = alloc(imp, m);
|
|
||||||
#pragma omp critical (as_st_cancel)
|
|
||||||
{
|
|
||||||
m_imp = d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class der_tactic : public tactic {
|
|
||||||
struct imp {
|
|
||||||
ast_manager & m_manager;
|
|
||||||
der_rewriter m_r;
|
|
||||||
|
|
||||||
imp(ast_manager & m):
|
|
||||||
m_manager(m),
|
|
||||||
m_r(m) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ast_manager & m() const { return m_manager; }
|
|
||||||
|
|
||||||
void set_cancel(bool f) {
|
|
||||||
m_r.set_cancel(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
m_r.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(goal & g) {
|
|
||||||
SASSERT(g.is_well_sorted());
|
|
||||||
bool proofs_enabled = g.proofs_enabled();
|
|
||||||
tactic_report report("der", g);
|
|
||||||
TRACE("before_der", g.display(tout););
|
|
||||||
expr_ref new_curr(m());
|
|
||||||
proof_ref new_pr(m());
|
|
||||||
unsigned size = g.size();
|
|
||||||
for (unsigned idx = 0; idx < size; idx++) {
|
|
||||||
if (g.inconsistent())
|
|
||||||
break;
|
|
||||||
expr * curr = g.form(idx);
|
|
||||||
m_r(curr, new_curr, new_pr);
|
|
||||||
if (proofs_enabled) {
|
|
||||||
proof * pr = g.pr(idx);
|
|
||||||
new_pr = m().mk_modus_ponens(pr, new_pr);
|
|
||||||
}
|
|
||||||
g.update(idx, new_curr, new_pr, g.dep(idx));
|
|
||||||
}
|
|
||||||
g.elim_redundancies();
|
|
||||||
TRACE("after_der", g.display(tout););
|
|
||||||
SASSERT(g.is_well_sorted());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
imp * m_imp;
|
|
||||||
|
|
||||||
public:
|
|
||||||
der_tactic(ast_manager & m) {
|
|
||||||
m_imp = alloc(imp, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual tactic * translate(ast_manager & m) {
|
|
||||||
return alloc(der_tactic, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~der_tactic() {
|
|
||||||
dealloc(m_imp);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void operator()(goal_ref const & in,
|
|
||||||
goal_ref_buffer & result,
|
|
||||||
model_converter_ref & mc,
|
|
||||||
proof_converter_ref & pc,
|
|
||||||
expr_dependency_ref & core) {
|
|
||||||
mc = 0; pc = 0; core = 0;
|
|
||||||
(*m_imp)(*(in.get()));
|
|
||||||
in->inc_depth();
|
|
||||||
result.push_back(in.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void cleanup() {
|
|
||||||
ast_manager & m = m_imp->m();
|
|
||||||
imp * d = m_imp;
|
|
||||||
#pragma omp critical (tactic_cancel)
|
|
||||||
{
|
|
||||||
m_imp = 0;
|
|
||||||
}
|
|
||||||
dealloc(d);
|
|
||||||
d = alloc(imp, m);
|
|
||||||
#pragma omp critical (tactic_cancel)
|
|
||||||
{
|
|
||||||
m_imp = d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void set_cancel(bool f) {
|
|
||||||
if (m_imp)
|
|
||||||
m_imp->set_cancel(f);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tactic * mk_der_tactic(ast_manager & m) {
|
|
||||||
return alloc(der_tactic, m);
|
|
||||||
}
|
|
|
@ -23,7 +23,6 @@ Revision History:
|
||||||
|
|
||||||
#include"ast.h"
|
#include"ast.h"
|
||||||
#include"var_subst.h"
|
#include"var_subst.h"
|
||||||
#include"assertion_set_strategy.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
New DER: the class DER (above) eliminates variables one by one.
|
New DER: the class DER (above) eliminates variables one by one.
|
||||||
|
@ -184,32 +183,5 @@ public:
|
||||||
|
|
||||||
typedef der_rewriter der_star;
|
typedef der_rewriter der_star;
|
||||||
|
|
||||||
// TODO: delete obsolete class
|
|
||||||
class der_strategy : public assertion_set_strategy {
|
|
||||||
struct imp;
|
|
||||||
imp * m_imp;
|
|
||||||
public:
|
|
||||||
der_strategy(ast_manager & m);
|
|
||||||
virtual ~der_strategy();
|
|
||||||
|
|
||||||
void operator()(assertion_set & s);
|
|
||||||
|
|
||||||
virtual void operator()(assertion_set & s, model_converter_ref & mc) {
|
|
||||||
operator()(s);
|
|
||||||
mc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void cleanup();
|
|
||||||
virtual void set_cancel(bool f);
|
|
||||||
};
|
|
||||||
|
|
||||||
inline as_st * mk_der(ast_manager & m) {
|
|
||||||
return alloc(der_strategy, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
class tactic;
|
|
||||||
|
|
||||||
tactic * mk_der_tactic(ast_manager & m);
|
|
||||||
|
|
||||||
#endif /* _DER_H_ */
|
#endif /* _DER_H_ */
|
||||||
|
|
180
src/smt/smt_solver_strategy.cpp
Normal file
180
src/smt/smt_solver_strategy.cpp
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
smt_solver_strategy.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Wraps a solver as an assertion_set strategy.
|
||||||
|
**Temporary code**
|
||||||
|
It should be deleted when we finish porting the assertion_set code to the tactic framework.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo (leonardo) 2012-10-20
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include"smt_solver_strategy.h"
|
||||||
|
#include"smt_solver.h"
|
||||||
|
|
||||||
|
class as_st_solver : public assertion_set_strategy {
|
||||||
|
scoped_ptr<front_end_params> m_params;
|
||||||
|
params_ref m_params_ref;
|
||||||
|
statistics m_stats;
|
||||||
|
std::string m_failure;
|
||||||
|
smt::solver * m_ctx;
|
||||||
|
bool m_candidate_models;
|
||||||
|
symbol m_logic;
|
||||||
|
progress_callback * m_callback;
|
||||||
|
public:
|
||||||
|
as_st_solver(bool candidate_models):m_ctx(0), m_candidate_models(candidate_models), m_callback(0) {}
|
||||||
|
|
||||||
|
front_end_params & fparams() {
|
||||||
|
if (!m_params)
|
||||||
|
m_params = alloc(front_end_params);
|
||||||
|
return *m_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct scoped_init_ctx {
|
||||||
|
as_st_solver & m_owner;
|
||||||
|
|
||||||
|
scoped_init_ctx(as_st_solver & o, ast_manager & m):m_owner(o) {
|
||||||
|
smt::solver * new_ctx = alloc(smt::solver, m, o.fparams());
|
||||||
|
TRACE("as_solver", tout << "logic: " << o.m_logic << "\n";);
|
||||||
|
new_ctx->set_logic(o.m_logic);
|
||||||
|
if (o.m_callback) {
|
||||||
|
new_ctx->set_progress_callback(o.m_callback);
|
||||||
|
}
|
||||||
|
#pragma omp critical (as_st_solver)
|
||||||
|
{
|
||||||
|
o.m_ctx = new_ctx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~scoped_init_ctx() {
|
||||||
|
smt::solver * d = m_owner.m_ctx;
|
||||||
|
#pragma omp critical (as_st_cancel)
|
||||||
|
{
|
||||||
|
m_owner.m_ctx = 0;
|
||||||
|
}
|
||||||
|
if (d)
|
||||||
|
dealloc(d);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual ~as_st_solver() {
|
||||||
|
SASSERT(m_ctx == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void updt_params(params_ref const & p) {
|
||||||
|
TRACE("as_solver", tout << "updt_params: " << p << "\n";);
|
||||||
|
m_params_ref = p;
|
||||||
|
params2front_end_params(m_params_ref, fparams());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void collect_param_descrs(param_descrs & r) {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set_cancel(bool f) {
|
||||||
|
if (m_ctx)
|
||||||
|
m_ctx->set_cancel(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void operator()(assertion_set & s, model_converter_ref & mc) {
|
||||||
|
SASSERT(is_well_sorted(s));
|
||||||
|
IF_VERBOSE(ST_VERBOSITY_LVL, verbose_stream() << "(smt-solver)" << std::endl;);
|
||||||
|
TRACE("as_solver", tout << "AUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " "
|
||||||
|
<< " PREPROCESS: " << fparams().m_preprocess << ", SOLVER:" << fparams().m_solver << "\n";);
|
||||||
|
TRACE("as_solver_detail", s.display(tout););
|
||||||
|
ast_manager & m = s.m();
|
||||||
|
TRACE("as_solver_memory", tout << "wasted_size: " << m.get_allocator().get_wasted_size() << "\n";);
|
||||||
|
// verbose_stream() << "wasted_size: " << m.get_allocator().get_wasted_size() << ", free_objs: " << m.get_allocator().get_num_free_objs() << "\n";
|
||||||
|
// m.get_allocator().consolidate();
|
||||||
|
scoped_init_ctx init(*this, m);
|
||||||
|
SASSERT(m_ctx != 0);
|
||||||
|
unsigned sz = s.size();
|
||||||
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
|
expr * f = s.form(i);
|
||||||
|
m_ctx->assert_expr(f);
|
||||||
|
}
|
||||||
|
lbool r = m_ctx->setup_and_check();
|
||||||
|
m_ctx->collect_statistics(m_stats);
|
||||||
|
switch (r) {
|
||||||
|
case l_true: {
|
||||||
|
// the empty assertion set is trivially satifiable.
|
||||||
|
s.reset();
|
||||||
|
// store the model in a do nothin model converter.
|
||||||
|
model_ref md;
|
||||||
|
m_ctx->get_model(md);
|
||||||
|
mc = model2model_converter(md.get());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case l_false:
|
||||||
|
// formula is unsat, reset the assertion set, and store false there.
|
||||||
|
s.reset();
|
||||||
|
s.assert_expr(m.mk_false(), m_ctx->get_proof());
|
||||||
|
return;
|
||||||
|
case l_undef:
|
||||||
|
if (m_candidate_models) {
|
||||||
|
switch (m_ctx->last_failure()) {
|
||||||
|
case smt::NUM_CONFLICTS:
|
||||||
|
case smt::THEORY:
|
||||||
|
case smt::QUANTIFIERS: {
|
||||||
|
model_ref md;
|
||||||
|
m_ctx->get_model(md);
|
||||||
|
mc = model2model_converter(md.get());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_failure = m_ctx->last_failure_as_string();
|
||||||
|
throw strategy_exception(m_failure.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void collect_statistics(statistics & st) const {
|
||||||
|
if (m_ctx)
|
||||||
|
m_ctx->collect_statistics(st); // ctx is still running...
|
||||||
|
else
|
||||||
|
st.copy(m_stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void cleanup() {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void reset_statistics() {
|
||||||
|
m_stats.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// for backward compatibility
|
||||||
|
virtual void set_front_end_params(front_end_params & p) {
|
||||||
|
m_params = alloc(front_end_params, p);
|
||||||
|
// must propagate the params_ref to fparams
|
||||||
|
params2front_end_params(m_params_ref, fparams());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set_logic(symbol const & l) {
|
||||||
|
m_logic = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set_progress_callback(progress_callback * callback) {
|
||||||
|
m_callback = callback;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
as_st * mk_smt_solver_core(bool candidate_models) {
|
||||||
|
return alloc(as_st_solver, candidate_models);
|
||||||
|
}
|
||||||
|
|
||||||
|
as_st * mk_smt_solver(bool auto_config, bool candidate_models) {
|
||||||
|
as_st * solver = mk_smt_solver_core(candidate_models);
|
||||||
|
params_ref solver_p;
|
||||||
|
solver_p.set_bool(":auto-config", auto_config);
|
||||||
|
return using_params(solver, solver_p);
|
||||||
|
};
|
31
src/smt/smt_solver_strategy.h
Normal file
31
src/smt/smt_solver_strategy.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
smt_solver_strategy.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Wraps a solver as an assertion_set strategy.
|
||||||
|
**Temporary code**
|
||||||
|
It should be deleted when we finish porting the assertion_set code to the tactic framework.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo (leonardo) 2012-10-20
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _SMT_SOLVER_STRATEGY_H_
|
||||||
|
#define _SMT_SOLVER_STRATEGY_H_
|
||||||
|
|
||||||
|
#include"assertion_set_strategy.h"
|
||||||
|
|
||||||
|
as_st * mk_smt_solver_core(bool candidate_models = false);
|
||||||
|
as_st * mk_smt_solver(bool auto_config = true, bool candidate_models = false);
|
||||||
|
|
||||||
|
MK_SIMPLE_ST_FACTORY(smt_solver_stf, mk_smt_solver());
|
||||||
|
|
||||||
|
#endif
|
2
src/spc/README
Normal file
2
src/spc/README
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Superposition Calculus.
|
||||||
|
This module is currently disabled.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue