@@ -1335,6 +1335,23 @@ namespace smt {
1335
1335
return;
1336
1336
}
1337
1337
SASSERT(ex->get_num_args() == 3);
1338
+
1339
+ {
1340
+ // Attempt to rewrite to an integer constant. If this succeeds,
1341
+ // assert equality with that constant.
1342
+ // The rewriter normally takes care of this for terms that are in scope
1343
+ // at the beginning of the search.
1344
+ // We perform the check here to catch terms that are added during the search.
1345
+ expr_ref rwex(ex, m);
1346
+ rw(rwex);
1347
+ if (m_autil.is_numeral(rwex)) {
1348
+ TRACE("str", tout << "constant expression " << mk_pp(ex, m) << " simplifies to " << mk_pp(rwex, m) << std::endl;);
1349
+ assert_axiom(ctx.mk_eq_atom(ex, rwex));
1350
+ axiomatized_terms.insert(ex);
1351
+ return;
1352
+ }
1353
+ }
1354
+
1338
1355
// if the third argument is exactly the integer 0, we can use this "simple" indexof;
1339
1356
// otherwise, we call the "extended" version
1340
1357
expr * startingPosition = ex->get_arg(2);
@@ -1516,6 +1533,7 @@ namespace smt {
1516
1533
{
1517
1534
expr_ref premise(m.mk_not(u.str.mk_contains(H, N)), m);
1518
1535
expr_ref conclusion(ctx.mk_eq_atom(e, minus_one), m);
1536
+ rw(premise);
1519
1537
assert_implication(premise, conclusion);
1520
1538
}
1521
1539
// case 4: 0 < i < len(H), N non-empty, and H contains N
0 commit comments