3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-19 12:23:38 +00:00

remove Z3_bool_opt #5757

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-01-07 11:52:10 -08:00
parent 7baa4f88b0
commit 199daead50
7 changed files with 37 additions and 24 deletions

View file

@ -47,7 +47,7 @@ extern "C" {
env_params::updt_params(); 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); memory::initialize(UINT_MAX);
LOG_Z3_global_param_get(param_id, param_value); LOG_Z3_global_param_get(param_id, param_value);
*param_value = nullptr; *param_value = nullptr;

View file

@ -1516,7 +1516,7 @@ extern "C" {
def_API('Z3_global_param_get', BOOL, (_in(STRING), _out(STRING))) 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))) 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. \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))) 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. \brief Return the interpretation (i.e., assignment) of constant \c a in the model \c m.

View file

@ -4,9 +4,6 @@ Copyright (c) 2015 Microsoft Corporation
--*/ --*/
#ifndef Z3_bool_opt
#define Z3_bool_opt Z3_bool
#endif
#ifndef Z3_API #ifndef Z3_API
# ifdef __GNUC__ # ifdef __GNUC__

View file

@ -722,12 +722,12 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
return BR_DONE; return BR_DONE;
} }
if (m().is_not(rhs)) if (m().is_not(rhs))
std::swap(lhs, rhs); std::swap(lhs, rhs);
if (m().is_not(lhs, lhs)) { if (m().is_not(lhs, lhs)) {
result = m().mk_not(m().mk_eq(lhs, rhs)); result = m().mk_not(m().mk_eq(lhs, rhs));
return BR_REWRITE2; return BR_REWRITE2;
} }
if (unfolded) { if (unfolded) {

View file

@ -424,15 +424,19 @@ namespace q {
friend class compiler; friend class compiler;
friend class code_tree_manager; friend class code_tree_manager;
void display_seq(std::ostream & out, instruction * head, unsigned indent) const { void spaces(std::ostream& out, unsigned indent) const {
for (unsigned i = 0; i < indent; i++) { for (unsigned i = 0; i < indent; i++)
out << " "; out << " ";
} }
void display_seq(std::ostream & out, instruction * head, unsigned indent) const {
spaces(out, indent);
instruction * curr = head; instruction * curr = head;
out << *curr; out << *curr;
curr = curr->m_next; curr = curr->m_next;
while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) { while (curr != nullptr && curr->m_opcode != CHOOSE && curr->m_opcode != NOOP) {
out << "\n"; out << "\n";
spaces(out, indent);
out << *curr; out << *curr;
curr = curr->m_next; curr = curr->m_next;
} }
@ -598,7 +602,7 @@ namespace q {
ast_manager & m = m_egraph->get_manager(); ast_manager & m = m_egraph->get_manager();
out << "patterns:\n"; out << "patterns:\n";
for (auto [q, a] : m_patterns) 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 #endif
out << "function: " << m_root_lbl->get_name(); out << "function: " << m_root_lbl->get_name();
@ -2878,8 +2882,10 @@ namespace q {
if (tree->expected_num_args() == p->get_num_args()) if (tree->expected_num_args() == p->get_num_args())
m_compiler.insert(tree, qa, mp, first_idx, false); m_compiler.insert(tree, qa, mp, first_idx, false);
} }
DEBUG_CODE(m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp)); DEBUG_CODE(if (first_idx == 0) {
ctx.push(push_back_trail<std::pair<quantifier*,app*>, false>(m_trees[lbl_id]->get_patterns()));); m_trees[lbl_id]->get_patterns().push_back(std::make_pair(qa, mp));
ctx.push(push_back_trail<std::pair<quantifier*, app*>, 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);); TRACE("trigger_bug", tout << "after add_pattern, first_idx: " << first_idx << "\n"; m_trees[lbl_id]->display(tout););
} }

View file

@ -149,12 +149,7 @@ namespace q {
if (false && em.propagate(true, f.nodes(), gen, *f.c, new_propagation)) if (false && em.propagate(true, f.nodes(), gen, *f.c, new_propagation))
return; 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); auto* ebindings = m_subst(q, num_bindings);
for (unsigned i = 0; i < num_bindings; ++i) for (unsigned i = 0; i < num_bindings; ++i)
ebindings[i] = f[i]->get_expr(); ebindings[i] = f[i]->get_expr();
@ -168,7 +163,14 @@ namespace q {
m_stats.m_num_instances++; 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); euf::solver::scoped_generation _sg(ctx, gen);

View file

@ -226,6 +226,7 @@ namespace smt {
ebindings[i] = bindings[i]->get_expr(); ebindings[i] = bindings[i]->get_expr();
expr_ref instance = m_subst(); expr_ref instance = m_subst();
TRACE("qi_queue", tout << "new instance:\n" << mk_pp(instance, m) << "\n";); 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";); TRACE("qi_queue_instance", tout << "new instance:\n" << mk_pp(instance, m) << "\n";);
expr_ref s_instance(m); expr_ref s_instance(m);
@ -244,6 +245,13 @@ namespace smt {
return; 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";); TRACE("qi_queue", tout << "simplified instance:\n" << s_instance << "\n";);
stat->inc_num_instances(); stat->inc_num_instances();
if (stat->get_num_instances() % m_params.m_qi_profile_freq == 0) { if (stat->get_num_instances() % m_params.m_qi_profile_freq == 0) {