diff --git a/src/api/api_config_params.cpp b/src/api/api_config_params.cpp index fd7c94f22..1b551bd73 100644 --- a/src/api/api_config_params.cpp +++ b/src/api/api_config_params.cpp @@ -47,7 +47,7 @@ extern "C" { env_params::updt_params(); } - Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) { + Z3_bool Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) { memory::initialize(UINT_MAX); LOG_Z3_global_param_get(param_id, param_value); *param_value = nullptr; diff --git a/src/api/z3_api.h b/src/api/z3_api.h index d5bd1e11c..3f964adc6 100644 --- a/src/api/z3_api.h +++ b/src/api/z3_api.h @@ -1516,7 +1516,7 @@ extern "C" { def_API('Z3_global_param_get', BOOL, (_in(STRING), _out(STRING))) */ - Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value); + Z3_bool Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value); /**@}*/ @@ -4325,7 +4325,7 @@ extern "C" { def_API('Z3_get_finite_domain_sort_size', BOOL, (_in(CONTEXT), _in(SORT), _out(UINT64))) */ - Z3_bool_opt Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, uint64_t* r); + Z3_bool Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, uint64_t* r); /** \brief Return the domain of the given array sort. @@ -5264,7 +5264,7 @@ extern "C" { def_API('Z3_model_eval', BOOL, (_in(CONTEXT), _in(MODEL), _in(AST), _in(BOOL), _out(AST))) */ - Z3_bool_opt Z3_API Z3_model_eval(Z3_context c, Z3_model m, Z3_ast t, bool model_completion, Z3_ast * v); + Z3_bool Z3_API Z3_model_eval(Z3_context c, Z3_model m, Z3_ast t, bool model_completion, Z3_ast * v); /** \brief Return the interpretation (i.e., assignment) of constant \c a in the model \c m. diff --git a/src/api/z3_macros.h b/src/api/z3_macros.h index d1ac18804..d42eb508a 100644 --- a/src/api/z3_macros.h +++ b/src/api/z3_macros.h @@ -4,9 +4,6 @@ Copyright (c) 2015 Microsoft Corporation --*/ -#ifndef Z3_bool_opt -#define Z3_bool_opt Z3_bool -#endif #ifndef Z3_API # ifdef __GNUC__ diff --git a/src/ast/rewriter/bool_rewriter.cpp b/src/ast/rewriter/bool_rewriter.cpp index 4c2ed7e12..1e58db340 100644 --- a/src/ast/rewriter/bool_rewriter.cpp +++ b/src/ast/rewriter/bool_rewriter.cpp @@ -722,12 +722,12 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) { return BR_DONE; } - if (m().is_not(rhs)) + if (m().is_not(rhs)) std::swap(lhs, rhs); - if (m().is_not(lhs, lhs)) { - result = m().mk_not(m().mk_eq(lhs, rhs)); - return BR_REWRITE2; + if (m().is_not(lhs, lhs)) { + result = m().mk_not(m().mk_eq(lhs, rhs)); + return BR_REWRITE2; } if (unfolded) { diff --git a/src/sat/smt/q_mam.cpp b/src/sat/smt/q_mam.cpp index a968314c2..3debc3e47 100644 --- a/src/sat/smt/q_mam.cpp +++ b/src/sat/smt/q_mam.cpp @@ -424,15 +424,19 @@ namespace q { friend class compiler; friend class code_tree_manager; - void display_seq(std::ostream & out, instruction * head, unsigned indent) const { - for (unsigned i = 0; i < indent; i++) { + void spaces(std::ostream& out, unsigned indent) const { + for (unsigned i = 0; i < indent; i++) out << " "; - } + } + + void display_seq(std::ostream & out, instruction * head, unsigned indent) const { + spaces(out, indent); instruction * curr = head; out << *curr; curr = curr->m_next; while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) { out << "\n"; + spaces(out, indent); out << *curr; curr = curr->m_next; } @@ -598,7 +602,7 @@ namespace q { ast_manager & m = m_egraph->get_manager(); out << "patterns:\n"; for (auto [q, a] : m_patterns) - out << mk_pp(q, m) << " " << mk_pp(a, m) << "\n"; + out << q->get_id() << ": " << mk_pp(q, m) << " " << mk_pp(a, m) << "\n"; } #endif out << "function: " << m_root_lbl->get_name(); @@ -2878,8 +2882,10 @@ namespace q { if (tree->expected_num_args() == p->get_num_args()) m_compiler.insert(tree, qa, mp, first_idx, false); } - DEBUG_CODE(m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp)); - ctx.push(push_back_trail, false>(m_trees[lbl_id]->get_patterns()));); + DEBUG_CODE(if (first_idx == 0) { + m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp)); + ctx.push(push_back_trail, false>(m_trees[lbl_id]->get_patterns())); + }); TRACE("trigger_bug", tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout);); } diff --git a/src/sat/smt/q_queue.cpp b/src/sat/smt/q_queue.cpp index d74ee4e39..c30009127 100644 --- a/src/sat/smt/q_queue.cpp +++ b/src/sat/smt/q_queue.cpp @@ -149,12 +149,7 @@ namespace q { if (false && em.propagate(true, f.nodes(), gen, *f.c, new_propagation)) return; -#if 0 - std::cout << mk_pp(q, m) << "\n"; - std::cout << num_bindings << "\n"; - for (unsigned i = 0; i < num_bindings; ++i) - std::cout << mk_pp(f[i]->get_expr(), m) << " " << mk_pp(f[i]->get_sort(), m) << "\n"; -#endif + auto* ebindings = m_subst(q, num_bindings); for (unsigned i = 0; i < num_bindings; ++i) ebindings[i] = f[i]->get_expr(); @@ -168,7 +163,14 @@ namespace q { m_stats.m_num_instances++; - // f.display(ctx, std::cout << mk_pp(f.q(), m) << "\n" << instance << "\n") << "\n"; + std::cout << "instantiate\n"; + for (unsigned i = 0; i < num_bindings; ++i) + std::cout << ctx.bpp(f[i]) << " "; + std::cout << "\n"; + std::cout << mk_pp(q, m) << "\n"; + + +// f.display(ctx, std::cout << mk_pp(f.q(), m) << "\n" << instance << "\n") << "\n"; euf::solver::scoped_generation _sg(ctx, gen); diff --git a/src/smt/qi_queue.cpp b/src/smt/qi_queue.cpp index f359136af..7c21c1362 100644 --- a/src/smt/qi_queue.cpp +++ b/src/smt/qi_queue.cpp @@ -226,6 +226,7 @@ namespace smt { ebindings[i] = bindings[i]->get_expr(); expr_ref instance = m_subst(); + TRACE("qi_queue", tout << "new instance:\n" << mk_pp(instance, m) << "\n";); TRACE("qi_queue_instance", tout << "new instance:\n" << mk_pp(instance, m) << "\n";); expr_ref s_instance(m); @@ -244,6 +245,13 @@ namespace smt { return; } + std::cout << "instantiate\n"; + enode_vector _bindings(num_bindings, bindings); + for (auto * b : _bindings) + std::cout << enode_pp(b, m_context) << " "; + std::cout << "\n"; + std::cout << mk_pp(q, m) << "\n"; + TRACE("qi_queue", tout << "simplified instance:\n" << s_instance << "\n";); stat->inc_num_instances(); if (stat->get_num_instances() % m_params.m_qi_profile_freq == 0) {