Fixes #8895. The benchmark in that issue now times out.
// reductions inference of the sine solver) may have introduced substitutions
// internally during check.
Node svalue = d_model.getSubstitutedForm(value);
- if (var.getType().isInteger() && svalue.getKind() == Kind::TO_REAL)
+ // ensure the value has integer type if var has integer type
+ if (var.getType().isInteger())
{
- svalue = svalue[0];
+ if (svalue.getKind() == Kind::TO_REAL)
+ {
+ svalue = svalue[0];
+ }
+ else if (svalue.getKind() == Kind::CONST_RATIONAL)
+ {
+ Assert(svalue.getConst<Rational>().isIntegral());
+ svalue =
+ NodeManager::currentNM()->mkConstInt(svalue.getConst<Rational>());
+ }
}
Trace("nl-cov") << "-> " << var << " = " << svalue << std::endl;
d_model.addSubstitution(var, svalue);
<< std::endl;
Assert(getSubstitutedForm(s) == s)
<< "Added a substitution whose range is not in substituted form " << s;
+ // cannot substitute real for integer
+ Assert(v.getType().isReal() || s.getType().isInteger());
// should not substitute the same variable twice
// should not set exact bound more than once
if (d_substitutions.contains(v))
continue;
}
// maps to constant of same type
- Assert(p.first.getType() == p.second.getType());
+ Assert(p.first.getType() == p.second.getType())
+ << "Bad type : " << p.first << " -> " << p.second;
if (m->assertEquality(p.first, p.second, true))
{
continue;
{
for (CVC5_UNUSED const auto& p : d_arithModelCache)
{
- Assert(p.first.getType() == p.second.getType());
+ Assert(p.first.getType() == p.second.getType())
+ << "Bad type: " << p.first << " -> " << p.second;
}
}
bool addedLemma = false;