Skip to content

Commit 1fec4bb

Browse files
fix output
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent 0a8b924 commit 1fec4bb

File tree

3 files changed

+34
-31
lines changed

3 files changed

+34
-31
lines changed

src/smt/smt_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace smt {
7474

7575
std::ostream& display_last_failure(std::ostream& out) const;
7676
std::string last_failure_as_string() const;
77-
void set_reason_unknown(char const* msg) { m_unknown = msg; std::cout << m_unknown << "\n"; }
77+
void set_reason_unknown(char const* msg) { m_unknown = msg; }
7878
void set_progress_callback(progress_callback *callback);
7979

8080

src/smt/smt_model_generator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ namespace smt {
489489

490490
proto_model * model_generator::mk_model() {
491491
SASSERT(!m_model);
492-
TRACE("model", m_context->display(tout););
492+
TRACE("model_verbose", m_context->display(tout););
493493
init_model();
494494
register_existing_model_values();
495495
mk_bool_model();

src/smt/theory_arith_core.h

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,35 @@ namespace smt {
3939

4040
template<typename Ext>
4141
void theory_arith<Ext>::found_underspecified_op(app * n) {
42+
context& ctx = get_context();
4243
m_underspecified_ops.push_back(n);
43-
get_context().push_trail(push_back_vector<context, ptr_vector<app>>(m_underspecified_ops));
44+
ctx.push_trail(push_back_vector<context, ptr_vector<app>>(m_underspecified_ops));
4445
if (!m_found_underspecified_op) {
4546
TRACE("arith", tout << "found underspecified expression:\n" << mk_pp(n, get_manager()) << "\n";);
46-
get_context().push_trail(value_trail<context, bool>(m_found_underspecified_op));
47+
ctx.push_trail(value_trail<context, bool>(m_found_underspecified_op));
4748
m_found_underspecified_op = true;
4849
}
50+
51+
expr* e = nullptr;
52+
if (m_util.is_div(n)) {
53+
e = m_util.mk_div0(n->get_arg(0), n->get_arg(1));
54+
}
55+
else if (m_util.is_idiv(n)) {
56+
e = m_util.mk_idiv0(n->get_arg(0), n->get_arg(1));
57+
}
58+
else if (m_util.is_rem(n)) {
59+
e = m_util.mk_rem0(n->get_arg(0), n->get_arg(1));
60+
}
61+
else if (m_util.is_mod(n)) {
62+
e = m_util.mk_mod0(n->get_arg(0), n->get_arg(1));
63+
}
64+
else if (m_util.is_power(n)) {
65+
e = m_util.mk_power0(n->get_arg(0), n->get_arg(1));
66+
}
67+
if (e) {
68+
ctx.assign(mk_eq(e, n, false), nullptr);
69+
}
70+
4971
}
5072

5173
template<typename Ext>
@@ -389,9 +411,9 @@ namespace smt {
389411
template<typename Ext>
390412
theory_var theory_arith<Ext>::internalize_div(app * n) {
391413
rational r(1);
392-
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
393414
theory_var s = mk_binary_op(n);
394415
context & ctx = get_context();
416+
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
395417
if (!ctx.relevancy())
396418
mk_div_axiom(n->get_arg(0), n->get_arg(1));
397419
return s;
@@ -400,9 +422,9 @@ namespace smt {
400422
template<typename Ext>
401423
theory_var theory_arith<Ext>::internalize_idiv(app * n) {
402424
rational r;
403-
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
404425
theory_var s = mk_binary_op(n);
405426
context & ctx = get_context();
427+
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
406428
app * mod = m_util.mk_mod(n->get_arg(0), n->get_arg(1));
407429
ctx.internalize(mod, false);
408430
if (ctx.relevancy())
@@ -414,9 +436,9 @@ namespace smt {
414436
theory_var theory_arith<Ext>::internalize_mod(app * n) {
415437
TRACE("arith_mod", tout << "internalizing...\n" << mk_pp(n, get_manager()) << "\n";);
416438
rational r(1);
417-
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
418439
theory_var s = mk_binary_op(n);
419440
context & ctx = get_context();
441+
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
420442
if (!ctx.relevancy())
421443
mk_idiv_mod_axioms(n->get_arg(0), n->get_arg(1));
422444
return s;
@@ -425,9 +447,9 @@ namespace smt {
425447
template<typename Ext>
426448
theory_var theory_arith<Ext>::internalize_rem(app * n) {
427449
rational r(1);
428-
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
429450
theory_var s = mk_binary_op(n);
430451
context & ctx = get_context();
452+
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
431453
if (!ctx.relevancy()) {
432454
mk_rem_axiom(n->get_arg(0), n->get_arg(1));
433455
}
@@ -3265,36 +3287,17 @@ namespace smt {
32653287

32663288
template<typename Ext>
32673289
void theory_arith<Ext>::init_model(model_generator & m) {
3268-
TRACE("theory_arith", tout << "init model invoked...\n";);
3290+
TRACE("theory_arith", tout << "init model invoked...\n";
3291+
for (app* n : m_underspecified_ops) {
3292+
tout << mk_pp(n, get_manager()) << "\n";
3293+
});
32693294
context& ctx = get_context();
32703295
m_factory = alloc(arith_factory, get_manager());
32713296
m.register_factory(m_factory);
32723297
compute_epsilon();
32733298
if (!m_model_depends_on_computed_epsilon) {
32743299
refine_epsilon();
32753300
}
3276-
for (app* n : m_underspecified_ops) {
3277-
enode* e = nullptr;
3278-
if (m_util.is_div(n)) {
3279-
e = mk_enode(m_util.mk_div0(n->get_arg(0), n->get_arg(1)));
3280-
}
3281-
else if (m_util.is_idiv(n)) {
3282-
e = mk_enode(m_util.mk_idiv0(n->get_arg(0), n->get_arg(1)));
3283-
}
3284-
else if (m_util.is_rem(n)) {
3285-
e = mk_enode(m_util.mk_rem0(n->get_arg(0), n->get_arg(1)));
3286-
}
3287-
else if (m_util.is_mod(n)) {
3288-
e = mk_enode(m_util.mk_mod0(n->get_arg(0), n->get_arg(1)));
3289-
}
3290-
else if (m_util.is_power(n)) {
3291-
e = mk_enode(m_util.mk_power0(n->get_arg(0), n->get_arg(1)));
3292-
}
3293-
if (e) {
3294-
ctx.mark_as_relevant(e);
3295-
ctx.add_eq(e, ctx.get_enode(n), eq_justification());
3296-
}
3297-
}
32983301
}
32993302

33003303
template<typename Ext>

0 commit comments

Comments
 (0)