@@ -148,7 +148,7 @@ namespace intblast {
148
148
auto a = expr2literal (e);
149
149
auto b = mk_literal (r);
150
150
ctx.mark_relevant (b);
151
- // verbose_stream() << "add-predicate-axiom: " << mk_pp(e, m) << " == " << r << "\n";
151
+ // verbose_stream() << "add-predicate-axiom: " << mk_pp(e, m) << " == " << r << "\n";
152
152
add_equiv (a, b);
153
153
}
154
154
return true ;
@@ -305,28 +305,6 @@ namespace intblast {
305
305
sorted.push_back (arg);
306
306
}
307
307
}
308
-
309
- //
310
- // Add ground equalities to ensure the model is valid with respect to the current case splits.
311
- // This may cause more conflicts than necessary. Instead could use intblast on the base level, but using literal
312
- // assignment from complete level.
313
- // E.g., force the solver to completely backtrack, check satisfiability using the assignment obtained under a complete assignment.
314
- // If intblast is SAT, then force the model and literal assignment on the rest of the literals.
315
- //
316
- if (!is_ground (e))
317
- continue ;
318
- euf::enode* n = ctx.get_enode (e);
319
- if (!n)
320
- continue ;
321
- if (n == n->get_root ())
322
- continue ;
323
- expr* r = n->get_root ()->get_expr ();
324
- es.push_back (m.mk_eq (e, r));
325
- r = es.back ();
326
- if (!visited.is_marked (r) && !is_translated (r)) {
327
- visited.mark (r);
328
- sorted.push_back (r);
329
- }
330
308
}
331
309
else if (is_quantifier (e)) {
332
310
quantifier* q = to_quantifier (e);
@@ -646,7 +624,7 @@ namespace intblast {
646
624
}
647
625
case OP_BUDIV:
648
626
case OP_BUDIV_I: {
649
- expr* x = arg ( 0 ), * y = umod (e, 1 );
627
+ expr* x = umod (e, 0 ), * y = umod (e, 1 );
650
628
r = m.mk_ite (m.mk_eq (y, a.mk_int (0 )), a.mk_int (-1 ), a.mk_idiv (x, y));
651
629
break ;
652
630
}
@@ -978,13 +956,38 @@ namespace intblast {
978
956
arith::arith_value av (ctx);
979
957
rational r;
980
958
VERIFY (av.get_value (b2i->get_expr (), r));
981
- verbose_stream () << ctx.bpp (n) << " := " << r << " \n " ;
982
959
value = bv.mk_numeral (r, bv.get_bv_size (n->get_expr ()));
960
+ verbose_stream () << ctx.bpp (n) << " := " << value << " \n " ;
983
961
}
984
962
values.set (n->get_root_id (), value);
985
963
TRACE (" model" , tout << " add_value " << ctx.bpp (n) << " := " << value << " \n " );
986
964
}
987
965
966
+ void solver::finalize_model (model& mdl) {
967
+ for (auto n : ctx.get_egraph ().nodes ()) {
968
+ expr* e = n->get_expr ();
969
+ if (!bv.is_bv (e))
970
+ continue ;
971
+ if (!is_translated (e))
972
+ continue ;
973
+ expr* f = translated (e);
974
+ rational r1, r2;
975
+ expr_ref val1 = mdl (e);
976
+ expr_ref val2 = mdl (f);
977
+ if (bv.is_numeral (val1, r1) && a.is_numeral (val2, r2) && r1 != r2) {
978
+ rational N = rational::power_of_two (bv.get_bv_size (e));
979
+ r2 = mod (r2, N);
980
+ if (r1 == r2)
981
+ continue ;
982
+ verbose_stream () << " value mismatch : " << mk_bounded_pp (e, m) << " := " << val1 << " \n " ;
983
+ verbose_stream () << mk_bounded_pp (f, m) << " := " << r2 << " \n " ;
984
+ for (expr* arg : *to_app (e)) {
985
+ verbose_stream () << mk_bounded_pp (arg, m) << " := " << mdl (arg) << " \n " ;
986
+ }
987
+ }
988
+ }
989
+ }
990
+
988
991
sat::literal_vector const & solver::unsat_core () {
989
992
return m_core;
990
993
}
0 commit comments