Fix non-linear equality solving that involves mixed real/integer arithmetic (#3739)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Wed, 12 Feb 2020 00:20:25 +0000 (18:20 -0600)
committerGitHub <noreply@github.com>
Wed, 12 Feb 2020 00:20:25 +0000 (16:20 -0800)
* Fix non-linear equality solving that involves mixed real/integer.

* Format

* Fix

* Revert

Co-authored-by: Ahmed Irfan <43099566+ahmed-irfan@users.noreply.github.com>
src/theory/arith/nl_model.cpp

index 54ae4c52acb1a4767dd6f7406d720050b8bc90ce..8a4145552551020e34eab8bb54ebdeba9f5b41e5 100644 (file)
@@ -534,8 +534,11 @@ bool NlModel::solveEqualitySimple(Node eq,
         if (ArithMSum::isolate(uv, msum, veqc, slv, EQUAL) != 0)
         {
           Assert(!slv.isNull());
-          // currently do not support substitution-with-coefficients
-          if (veqc.isNull() && !expr::hasSubterm(slv, uv))
+          // Currently do not support substitution-with-coefficients.
+          // We also ensure types are correct here, which avoids substituting
+          // a term of non-integer type for a variable of integer type.
+          if (veqc.isNull() && !expr::hasSubterm(slv, uv)
+              && slv.getType().isSubtypeOf(uv.getType()))
           {
             Trace("nl-ext-cm")
                 << "check-model-subs : " << uv << " -> " << slv << std::endl;