Skip to content

Commit 029edcf

Browse files
fix #4114
1 parent 51c3778 commit 029edcf

File tree

5 files changed

+26
-27
lines changed

5 files changed

+26
-27
lines changed

src/smt/smt_setup.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ namespace smt {
566566
m_params.m_bv_cc = false;
567567
m_params.m_bb_ext_gates = true;
568568
m_params.m_nnf_cnf = false;
569-
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params, m_params));
569+
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params));
570570
}
571571

572572
void setup::setup_QF_AUFBV() {
@@ -575,7 +575,7 @@ namespace smt {
575575
m_params.m_bv_cc = false;
576576
m_params.m_bb_ext_gates = true;
577577
m_params.m_nnf_cnf = false;
578-
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params, m_params));
578+
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params));
579579
setup_arrays();
580580
}
581581

@@ -853,7 +853,7 @@ namespace smt {
853853
m_context.register_plugin(alloc(smt::theory_dummy, m_manager.mk_family_id("bv"), "no bit-vector"));
854854
break;
855855
case BS_BLASTER:
856-
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params, m_params));
856+
m_context.register_plugin(alloc(smt::theory_bv, m_manager, m_params));
857857
break;
858858
}
859859
}

src/smt/theory_bv.cpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ namespace smt {
127127
#if 0
128128
// possible fix for #2182, but effect of fix needs to be checked.
129129
if (idx < m_bits[v_arg].size()) {
130-
//std::cout << mk_pp(n, get_manager()) << "\n";
131130
ctx.mk_th_axiom(get_id(), m_bits[v_arg][idx], literal(bv, true));
132131
ctx.mk_th_axiom(get_id(), ~m_bits[v_arg][idx], literal(bv, false));
133132
}
@@ -162,7 +161,7 @@ namespace smt {
162161
e = ctx.get_enode(n);
163162
}
164163
else {
165-
e = ctx.mk_enode(n, !m_params.m_bv_reflect, false, m_params.m_bv_cc);
164+
e = ctx.mk_enode(n, !params().m_bv_reflect, false, params().m_bv_cc);
166165
mk_var(e);
167166
}
168167
// SASSERT(e->get_th_var(get_id()) != null_theory_var);
@@ -179,7 +178,7 @@ namespace smt {
179178
}
180179

181180
enode * theory_bv::get_arg(enode * n, unsigned idx) {
182-
if (m_params.m_bv_reflect) {
181+
if (params().m_bv_reflect) {
183182
return n->get_arg(idx);
184183
}
185184
else {
@@ -933,15 +932,15 @@ namespace smt {
933932
case OP_BSMOD0: return false;
934933
case OP_MKBV: internalize_mkbv(term); return true;
935934
case OP_INT2BV:
936-
if (m_params.m_bv_enable_int2bv2int) {
935+
if (params().m_bv_enable_int2bv2int) {
937936
internalize_int2bv(term);
938937
}
939-
return m_params.m_bv_enable_int2bv2int;
938+
return params().m_bv_enable_int2bv2int;
940939
case OP_BV2INT:
941-
if (m_params.m_bv_enable_int2bv2int) {
940+
if (params().m_bv_enable_int2bv2int) {
942941
internalize_bv2int(term);
943942
}
944-
return m_params.m_bv_enable_int2bv2int;
943+
return params().m_bv_enable_int2bv2int;
945944
default:
946945
TRACE("bv_op", tout << "unsupported operator: " << mk_ll_pp(term, get_manager()) << "\n";);
947946
UNREACHABLE();
@@ -985,7 +984,7 @@ namespace smt {
985984
/* relevancy() is true and m_bv_lazy_le is false (the default configuration). */ \
986985
/* So, we need to check also the m_bv_lazy_le flag here. */ \
987986
/* Maybe, we should rename the le_atom to bridge_atom, and m_bv_lazy_le option to m_bv_lazy_bridge. */ \
988-
if (!ctx.relevancy() || !m_params.m_bv_lazy_le) { \
987+
if (!ctx.relevancy() || !params().m_bv_lazy_le) { \
989988
ctx.mk_th_axiom(get_id(), l, ~def); \
990989
ctx.mk_th_axiom(get_id(), ~l, def); \
991990
} \
@@ -1018,7 +1017,7 @@ namespace smt {
10181017
le_atom * a = new (get_region()) le_atom(l, def);
10191018
insert_bv2a(l.var(), a);
10201019
m_trail_stack.push(mk_atom_trail(l.var()));
1021-
if (!ctx.relevancy() || !m_params.m_bv_lazy_le) {
1020+
if (!ctx.relevancy() || !params().m_bv_lazy_le) {
10221021
ctx.mk_th_axiom(get_id(), l, ~def);
10231022
ctx.mk_th_axiom(get_id(), ~l, def);
10241023
}
@@ -1120,14 +1119,14 @@ namespace smt {
11201119
// based on the number of bits used by the arguments.
11211120
//
11221121
bool theory_bv::approximate_term(app* n) {
1123-
if (m_params.m_bv_blast_max_size == INT_MAX) {
1122+
if (params().m_bv_blast_max_size == INT_MAX) {
11241123
return false;
11251124
}
11261125
unsigned num_args = n->get_num_args();
11271126
for (unsigned i = 0; i <= num_args; i++) {
11281127
expr* arg = (i == num_args)?n:n->get_arg(i);
11291128
sort* s = get_manager().get_sort(arg);
1130-
if (m_util.is_bv_sort(s) && m_util.get_bv_size(arg) > m_params.m_bv_blast_max_size) {
1129+
if (m_util.is_bv_sort(s) && m_util.get_bv_size(arg) > params().m_bv_blast_max_size) {
11311130
if (!m_approximates_large_bvs) {
11321131
TRACE("bv", tout << "found large size bit-vector:\n" << mk_pp(n, get_manager()) << "\n";);
11331132
get_context().push_trail(value_trail<context, bool>(m_approximates_large_bvs));
@@ -1253,9 +1252,6 @@ namespace smt {
12531252
// TRACE("bv", tout << "has th_justification\n";);
12541253
// return;
12551254
// }
1256-
//for (auto kv : m_prop_queue) {
1257-
// std::cout << "v" << kv.first << "[" << kv.second << "]\n";
1258-
//}
12591255
m_prop_queue.reset();
12601256
bit_atom * b = static_cast<bit_atom*>(a);
12611257
var_pos_occ * curr = b->m_occs;
@@ -1405,17 +1401,17 @@ namespace smt {
14051401
if (a && !a->is_bit()) {
14061402
le_atom * le = static_cast<le_atom*>(a);
14071403
ctx.mark_as_relevant(le->m_def);
1408-
if (m_params.m_bv_lazy_le) {
1404+
if (params().m_bv_lazy_le) {
14091405
ctx.mk_th_axiom(get_id(), le->m_var, ~le->m_def);
14101406
ctx.mk_th_axiom(get_id(), ~le->m_var, le->m_def);
14111407
}
14121408
}
14131409
}
1414-
else if (m_params.m_bv_enable_int2bv2int && m_util.is_bv2int(n)) {
1410+
else if (params().m_bv_enable_int2bv2int && m_util.is_bv2int(n)) {
14151411
ctx.mark_as_relevant(n->get_arg(0));
14161412
assert_bv2int_axiom(n);
14171413
}
1418-
else if (m_params.m_bv_enable_int2bv2int && m_util.is_int2bv(n)) {
1414+
else if (params().m_bv_enable_int2bv2int && m_util.is_int2bv(n)) {
14191415
ctx.mark_as_relevant(n->get_arg(0));
14201416
assert_int2bv_axiom(n);
14211417
}
@@ -1492,9 +1488,12 @@ namespace smt {
14921488
return false;
14931489
}
14941490

1495-
theory_bv::theory_bv(ast_manager & m, theory_bv_params const & params, bit_blaster_params const & bb_params):
1491+
smt_params const& theory_bv::params() const {
1492+
return get_context().get_fparams();
1493+
}
1494+
1495+
theory_bv::theory_bv(ast_manager & m, bit_blaster_params const & bb_params):
14961496
theory(m.mk_family_id("bv")),
1497-
m_params(params),
14981497
m_util(m),
14991498
m_autil(m),
15001499
m_bb(m, bb_params),
@@ -1509,7 +1508,7 @@ namespace smt {
15091508
}
15101509

15111510
theory* theory_bv::mk_fresh(context* new_ctx) {
1512-
return alloc(theory_bv, new_ctx->get_manager(), m_params, m_bb.get_params());
1511+
return alloc(theory_bv, new_ctx->get_manager(), new_ctx->get_fparams());
15131512
}
15141513

15151514

src/smt/theory_bv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ namespace smt {
106106
atom * get_bv2a(bool_var bv) const { return m_bool_var2atom.get(bv, 0); }
107107
#endif
108108
theory_bv_stats m_stats;
109-
theory_bv_params const & m_params;
110109
bv_util m_util;
111110
arith_util m_autil;
112111
bit_blaster m_bb;
@@ -253,8 +252,9 @@ namespace smt {
253252
void init_model(model_generator & m) override;
254253
model_value_proc * mk_value(enode * n, model_generator & mg) override;
255254

255+
smt_params const& params() const;
256256
public:
257-
theory_bv(ast_manager & m, theory_bv_params const & params, bit_blaster_params const & bb_params);
257+
theory_bv(ast_manager & m, bit_blaster_params const & bb_params);
258258
~theory_bv() override;
259259

260260
theory * mk_fresh(context * new_ctx) override;

src/smt/theory_pb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ namespace smt {
451451
}
452452

453453
theory * theory_pb::mk_fresh(context * new_ctx) {
454-
return alloc(theory_pb, new_ctx->get_manager(), m_params);
454+
return alloc(theory_pb, new_ctx->get_manager(), new_ctx->get_fparams());
455455
}
456456

457457
bool theory_pb::internalize_atom(app * atom, bool gate_ctx) {

src/smt/theory_seq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ namespace smt {
443443
void relevant_eh(app* n) override;
444444
bool should_research(expr_ref_vector &) override;
445445
void add_theory_assumptions(expr_ref_vector & assumptions) override;
446-
theory* mk_fresh(context* new_ctx) override { return alloc(theory_seq, new_ctx->get_manager(), m_params); }
446+
theory* mk_fresh(context* new_ctx) override { return alloc(theory_seq, new_ctx->get_manager(), new_ctx->get_fparams()); }
447447
char const * get_name() const override { return "seq"; }
448448
bool include_func_interp(func_decl* f) override { return m_util.str.is_nth_u(f); }
449449
bool is_safe_to_copy(bool_var v) const;

0 commit comments

Comments
 (0)