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

pull unstable

Signed-off-by: Nikolaj Bjorner <nbjorner@hotmail.com>
This commit is contained in:
Nikolaj Bjorner 2015-04-01 14:57:11 -07:00
commit 52619b9dbb
337 changed files with 24943 additions and 30606 deletions

View file

@ -142,7 +142,7 @@ namespace datalog {
steps.push_back(step());
obj_map<proof, unsigned> index;
index.insert(m_proof, 0);
for (unsigned j = 0; j < rules.size(); ++j) {
proof* p = rules[j];
proof_ref_vector premises(m);

View file

@ -187,10 +187,10 @@ namespace datalog {
if (m_trail.get_num_scopes() == 0) {
throw default_exception("there are no backtracking points to pop to");
}
if(m_engine.get()){
if(get_engine() != DUALITY_ENGINE)
throw default_exception("operation is not supported by engine");
}
if(m_engine.get()){
if(get_engine() != DUALITY_ENGINE)
throw default_exception("operation is not supported by engine");
}
m_trail.pop_scope(1);
}
@ -292,7 +292,7 @@ namespace datalog {
void context::set_unbound_compressor(bool f) { m_unbound_compressor = f; }
bool context::similarity_compressor() const { return m_params->datalog_similarity_compressor(); }
unsigned context::similarity_compressor_threshold() const { return m_params->datalog_similarity_compressor_threshold(); }
unsigned context::soft_timeout() const { return m_fparams.m_soft_timeout; }
unsigned context::soft_timeout() const { return m_fparams.m_timeout; }
unsigned context::initial_restart_timeout() const { return m_params->datalog_initial_restart_timeout(); }
bool context::generate_explanations() const { return m_params->datalog_generate_explanations(); }
bool context::explanations_on_relation_level() const { return m_params->datalog_explanations_on_relation_level(); }
@ -452,7 +452,7 @@ namespace datalog {
void context::add_rule(expr* rl, symbol const& name, unsigned bound) {
m_rule_fmls.push_back(rl);
m_rule_names.push_back(name);
m_rule_bounds.push_back(bound);
m_rule_bounds.push_back(bound);
}
void context::flush_add_rules() {
@ -863,10 +863,10 @@ namespace datalog {
flush_add_rules();
break;
case DUALITY_ENGINE:
// this lets us use duality with SAS 2013 abstraction
if(quantify_arrays())
flush_add_rules();
break;
// this lets us use duality with SAS 2013 abstraction
if(quantify_arrays())
flush_add_rules();
break;
default:
UNREACHABLE();
}

View file

@ -46,6 +46,35 @@ namespace datalog {
typedef ptr_vector<rule> rule_vector;
struct uninterpreted_function_finder_proc {
ast_manager& m;
datatype_util m_dt;
dl_decl_util m_dl;
bool m_found;
func_decl* m_func;
uninterpreted_function_finder_proc(ast_manager& m):
m(m), m_dt(m), m_dl(m), m_found(false), m_func(0) {}
void operator()(var * n) { }
void operator()(quantifier * n) { }
void operator()(app * n) {
if (is_uninterp(n) && !m_dl.is_rule_sort(n->get_decl()->get_range())) {
m_found = true;
m_func = n->get_decl();
}
else if (m_dt.is_accessor(n)) {
sort* s = m.get_sort(n->get_arg(0));
SASSERT(m_dt.is_datatype(s));
if (m_dt.get_datatype_constructors(s)->size() > 1) {
m_found = true;
m_func = n->get_decl();
}
}
}
void reset() { m_found = false; m_func = 0; }
bool found(func_decl*& f) const { f = m_func; return m_found; }
};
struct quantifier_finder_proc {
bool m_exist;
bool m_univ;
@ -64,36 +93,6 @@ namespace datalog {
void reset() { m_exist = m_univ = false; }
};
struct uninterpreted_function_finder_proc {
ast_manager& m;
datatype_util m_dt;
bool m_found;
func_decl* m_func;
uninterpreted_function_finder_proc(ast_manager& m):
m(m), m_dt(m), m_found(false), m_func(0) {}
void reset() { m_found = false; m_func = 0; }
void operator()(var * n) { }
void operator()(quantifier * n) { }
void operator()(app * n) {
if (is_uninterp(n)) {
m_found = true;
m_func = n->get_decl();
}
else if (m_dt.is_accessor(n)) {
sort* s = m.get_sort(n->get_arg(0));
SASSERT(m_dt.is_datatype(s));
if (m_dt.get_datatype_constructors(s)->size() > 1) {
m_found = true;
m_func = n->get_decl();
}
}
}
bool found(func_decl*& f) const { f = m_func; return m_found; }
};
/**
\brief Manager for the \c rule class

View file

@ -59,7 +59,7 @@ namespace datalog {
{
// m_fparams.m_relevancy_lvl = 0;
m_fparams.m_mbqi = false;
m_fparams.m_soft_timeout = 1000;
m_fparams.m_timeout = 1000;
}
~imp() {}

View file

@ -77,12 +77,12 @@ namespace Duality {
old_rs = 0;
}
~duality_data(){
if(old_rs)
dealloc(old_rs);
if(rpfp)
dealloc(rpfp);
if(ls)
dealloc(ls);
if(old_rs)
dealloc(old_rs);
if(rpfp)
dealloc(rpfp);
if(ls)
dealloc(ls);
}
};
@ -171,16 +171,16 @@ lbool dl_interface::query(::expr * query) {
query_ref = m_ctx.get_manager().mk_false();
else {
func_decl_ref query_pred(m_ctx.get_manager());
query_pred = m_ctx.get_rules().get_output_predicate();
ptr_vector<sort> sorts;
unsigned nargs = query_pred.get()->get_arity();
expr_ref_vector vars(m_ctx.get_manager());
for(unsigned i = 0; i < nargs; i++){
::sort *s = query_pred.get()->get_domain(i);
vars.push_back(m_ctx.get_manager().mk_var(nargs-1-i,s));
}
query_ref = m_ctx.get_manager().mk_app(query_pred.get(),nargs,vars.c_ptr());
query = query_ref.get();
query_pred = m_ctx.get_rules().get_output_predicate();
ptr_vector<sort> sorts;
unsigned nargs = query_pred.get()->get_arity();
expr_ref_vector vars(m_ctx.get_manager());
for(unsigned i = 0; i < nargs; i++){
::sort *s = query_pred.get()->get_domain(i);
vars.push_back(m_ctx.get_manager().mk_var(nargs-1-i,s));
}
query_ref = m_ctx.get_manager().mk_app(query_pred.get(),nargs,vars.c_ptr());
query = query_ref.get();
}
unsigned nrules = rs.get_num_rules();
for(unsigned i = 0; i < nrules; i++){
@ -250,16 +250,16 @@ lbool dl_interface::query(::expr * query) {
while(true){
if(cl.is_app()){
decl_kind k = cl.decl().get_decl_kind();
if(k == Implies)
cl = cl.arg(1);
else {
heads.insert(cl.decl());
break;
}
decl_kind k = cl.decl().get_decl_kind();
if(k == Implies)
cl = cl.arg(1);
else {
heads.insert(cl.decl());
break;
}
}
else if(cl.is_quantifier())
cl = cl.body();
cl = cl.body();
else break;
}
}
@ -268,18 +268,18 @@ lbool dl_interface::query(::expr * query) {
::ast *fa = pinned[i];
if(is_func_decl(fa)){
::func_decl *fd = to_func_decl(fa);
if(m_ctx.is_predicate(fd)) {
func_decl f(_d->ctx,fd);
if(!heads.contains(fd)){
int arity = f.arity();
std::vector<expr> args;
for(int j = 0; j < arity; j++)
args.push_back(_d->ctx.fresh_func_decl("X",f.domain(j))());
expr c = implies(_d->ctx.bool_val(false),f(args));
c = _d->ctx.make_quant(Forall,args,c);
clauses.push_back(c);
bounds.push_back(UINT_MAX);
}
if (m_ctx.is_predicate(fd)) {
func_decl f(_d->ctx, fd);
if (!heads.contains(fd)) {
int arity = f.arity();
std::vector<expr> args;
for (int j = 0; j < arity; j++)
args.push_back(_d->ctx.fresh_func_decl("X", f.domain(j))());
expr c = implies(_d->ctx.bool_val(false), f(args));
c = _d->ctx.make_quant(Forall, args, c);
clauses.push_back(c);
bounds.push_back(UINT_MAX);
}
}
}
}
@ -483,17 +483,17 @@ void dl_interface::display_certificate_non_const(std::ostream& out) {
model orig_model = _d->cex.get_tree()->dualModel;
for(unsigned i = 0; i < orig_model.num_consts(); i++){
func_decl cnst = orig_model.get_const_decl(i);
if(locals.find(cnst) == locals.end()){
expr thing = orig_model.get_const_interp(cnst);
mod.register_decl(to_func_decl(cnst.raw()),to_expr(thing.raw()));
if (locals.find(cnst) == locals.end()) {
expr thing = orig_model.get_const_interp(cnst);
mod.register_decl(to_func_decl(cnst.raw()), to_expr(thing.raw()));
}
}
for(unsigned i = 0; i < orig_model.num_funcs(); i++){
func_decl cnst = orig_model.get_func_decl(i);
if(locals.find(cnst) == locals.end()){
func_interp thing = orig_model.get_func_interp(cnst);
::func_interp *thing_raw = thing;
mod.register_decl(to_func_decl(cnst.raw()),thing_raw->copy());
if (locals.find(cnst) == locals.end()) {
func_interp thing = orig_model.get_func_interp(cnst);
::func_interp *thing_raw = thing;
mod.register_decl(to_func_decl(cnst.raw()), thing_raw->copy());
}
}
model_v2_pp(out,mod);

View file

@ -110,7 +110,7 @@ struct dl_context {
m_trail.push(push_back_vector<dl_context, svector<symbol> >(m_collected_cmds->m_names));
}
else {
m_context->add_rule(rule, name, bound);
m_context->add_rule(rule, name, bound);
}
}
@ -261,11 +261,11 @@ public:
print_certificate(ctx);
break;
case l_undef:
if(dlctx.get_status() == datalog::BOUNDED){
ctx.regular_stream() << "bounded\n";
print_certificate(ctx);
break;
}
if(dlctx.get_status() == datalog::BOUNDED){
ctx.regular_stream() << "bounded\n";
print_certificate(ctx);
break;
}
ctx.regular_stream() << "unknown\n";
switch(dlctx.get_status()) {
case datalog::INPUT_ERROR:

View file

@ -188,8 +188,7 @@ namespace datalog {
union_find_default_ctx uf_ctx;
union_find<> uf(uf_ctx); //the numbers in uf correspond to column indexes after the join
for(unsigned i=0; i<join_sig_sz; i++) {
unsigned v = uf.mk_var();
SASSERT(v==i);
VERIFY(uf.mk_var() == i);
}
for(unsigned i=0; i<joined_col_cnt; i++) {

View file

@ -829,7 +829,6 @@ namespace datalog {
m_e_fact_relation = static_cast<explanation_relation *>(expl_singleton);
}
func_decl_set predicates(m_context.get_predicates());
decl_set::iterator it = predicates.begin();
decl_set::iterator end = predicates.end();
for (; it!=end; ++it) {

View file

@ -756,6 +756,7 @@ namespace datalog {
relation_union_fn * relation_manager::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
TRACE("dl", tout << src.get_plugin().get_name() << " " << tgt.get_plugin().get_name() << "\n";);
relation_union_fn * res = tgt.get_plugin().mk_union_fn(tgt, src, delta);
if(!res && &tgt.get_plugin()!=&src.get_plugin()) {
res = src.get_plugin().mk_union_fn(tgt, src, delta);

View file

@ -136,9 +136,9 @@ namespace datalog {
lbool rel_context::saturate(scoped_query& sq) {
m_context.ensure_closed();
bool time_limit = m_context.soft_timeout()!=0;
unsigned remaining_time_limit = m_context.soft_timeout();
unsigned restart_time = m_context.initial_restart_timeout();
bool time_limit = remaining_time_limit != 0;
instruction_block termination_code;

View file

@ -1369,7 +1369,7 @@ namespace datalog {
{
// m_fparams.m_relevancy_lvl = 0;
m_fparams.m_mbqi = false;
m_fparams.m_soft_timeout = 1000;
m_fparams.m_timeout = 1000;
}
~imp() {}

View file

@ -219,7 +219,7 @@ namespace datalog {
class mk_bit_blast::impl {
context & m_context;
context & m_context;
ast_manager & m;
params_ref m_params;
mk_interp_tail_simplifier m_simplifier;