Fix rewrite for `(to_int real.pi)` (#8907)
authorAndres Noetzli <andres.noetzli@gmail.com>
Thu, 23 Jun 2022 13:44:41 +0000 (06:44 -0700)
committerGitHub <noreply@github.com>
Thu, 23 Jun 2022 13:44:41 +0000 (08:44 -0500)
Fixes #8905. (to_int real.pi) was returning a real constant instead of
an integer, making the type of the rewritten term wrong.

src/theory/arith/arith_rewriter.cpp
test/regress/cli/CMakeLists.txt
test/regress/cli/regress0/arith/issue8905-pi-to-int.smt2 [new file with mode: 0644]

index cfd4498c10d1ea132cecff67bd4199ff0cf1a804..c6ac2895051ddf05a82b10051e7a216e00171d1f 100644 (file)
@@ -793,7 +793,7 @@ RewriteResponse ArithRewriter::rewriteExtIntegerOp(TNode t)
   }
   if (t[0].getKind() == kind::PI)
   {
-    Node ret = isPred ? nm->mkConst(false) : nm->mkConstReal(Rational(3));
+    Node ret = isPred ? nm->mkConst(false) : nm->mkConstInt(Rational(3));
     return returnRewrite(t, ret, Rewrite::INT_EXT_PI);
   }
   else if (t[0].getKind() == kind::TO_REAL)
index 30f1d7177757a153982433628f5789ac775e2c9d..945f31ea8d5751e0f91862d39919a3a0760ed317 100644 (file)
@@ -68,6 +68,7 @@ set(regress_0_tests
   regress0/arith/issue8097-iid.smt2
   regress0/arith/issue8159-rewrite-intreal.smt2
   regress0/arith/issue8805-mixed-var-elim.smt2
+  regress0/arith/issue8905-pi-to-int.smt2
   regress0/arith/ite-lift.smt2
   regress0/arith/leq.01.smtv1.smt2
   regress0/arith/miplib.cvc.smt2
diff --git a/test/regress/cli/regress0/arith/issue8905-pi-to-int.smt2 b/test/regress/cli/regress0/arith/issue8905-pi-to-int.smt2
new file mode 100644 (file)
index 0000000..199a17b
--- /dev/null
@@ -0,0 +1,4 @@
+(set-logic QF_ALL)
+(assert (= 3 (to_int real.pi)))
+(set-info :status sat)
+(check-sat)