@@ -39,13 +39,35 @@ namespace smt {
39
39
40
40
template <typename Ext>
41
41
void theory_arith<Ext>::found_underspecified_op(app * n) {
42
+ context& ctx = get_context ();
42
43
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));
44
45
if (!m_found_underspecified_op) {
45
46
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));
47
48
m_found_underspecified_op = true ;
48
49
}
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
+
49
71
}
50
72
51
73
template <typename Ext>
@@ -389,9 +411,9 @@ namespace smt {
389
411
template <typename Ext>
390
412
theory_var theory_arith<Ext>::internalize_div(app * n) {
391
413
rational r (1 );
392
- if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
393
414
theory_var s = mk_binary_op (n);
394
415
context & ctx = get_context ();
416
+ if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
395
417
if (!ctx.relevancy ())
396
418
mk_div_axiom (n->get_arg (0 ), n->get_arg (1 ));
397
419
return s;
@@ -400,9 +422,9 @@ namespace smt {
400
422
template <typename Ext>
401
423
theory_var theory_arith<Ext>::internalize_idiv(app * n) {
402
424
rational r;
403
- if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
404
425
theory_var s = mk_binary_op (n);
405
426
context & ctx = get_context ();
427
+ if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
406
428
app * mod = m_util.mk_mod (n->get_arg (0 ), n->get_arg (1 ));
407
429
ctx.internalize (mod, false );
408
430
if (ctx.relevancy ())
@@ -414,9 +436,9 @@ namespace smt {
414
436
theory_var theory_arith<Ext>::internalize_mod(app * n) {
415
437
TRACE (" arith_mod" , tout << " internalizing...\n " << mk_pp (n, get_manager ()) << " \n " ;);
416
438
rational r (1 );
417
- if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
418
439
theory_var s = mk_binary_op (n);
419
440
context & ctx = get_context ();
441
+ if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
420
442
if (!ctx.relevancy ())
421
443
mk_idiv_mod_axioms (n->get_arg (0 ), n->get_arg (1 ));
422
444
return s;
@@ -425,9 +447,9 @@ namespace smt {
425
447
template <typename Ext>
426
448
theory_var theory_arith<Ext>::internalize_rem(app * n) {
427
449
rational r (1 );
428
- if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
429
450
theory_var s = mk_binary_op (n);
430
451
context & ctx = get_context ();
452
+ if (!m_util.is_numeral (n->get_arg (1 ), r) || r.is_zero ()) found_underspecified_op (n);
431
453
if (!ctx.relevancy ()) {
432
454
mk_rem_axiom (n->get_arg (0 ), n->get_arg (1 ));
433
455
}
@@ -3265,36 +3287,17 @@ namespace smt {
3265
3287
3266
3288
template <typename Ext>
3267
3289
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
+ });
3269
3294
context& ctx = get_context ();
3270
3295
m_factory = alloc (arith_factory, get_manager ());
3271
3296
m.register_factory (m_factory);
3272
3297
compute_epsilon ();
3273
3298
if (!m_model_depends_on_computed_epsilon) {
3274
3299
refine_epsilon ();
3275
3300
}
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
- }
3298
3301
}
3299
3302
3300
3303
template <typename Ext>
0 commit comments