Fix real to int for parameterized kinds (#4016)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Wed, 11 Mar 2020 00:17:40 +0000 (19:17 -0500)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 00:17:40 +0000 (19:17 -0500)
src/preprocessing/passes/real_to_int.cpp
test/regress/CMakeLists.txt
test/regress/regress0/nl/issue4007-rint-uf.smt2 [new file with mode: 0644]

index cc98726c6f9d8499c969a1b5e04f2ae343f020ea..f50cecd1bec3b1f5f76827a20a5c2422c3079de3 100644 (file)
@@ -151,6 +151,10 @@ Node RealToInt::realToIntInternal(TNode n, NodeMap& cache, std::vector<Node>& va
         }
         if (childChanged)
         {
+          if (n.getMetaKind() == kind::metakind::PARAMETERIZED)
+          {
+            children.insert(children.begin(), n.getOperator());
+          }
           ret = NodeManager::currentNM()->mkNode(n.getKind(), children);
         }
       }
index 1ca43b2fe3533b1bffd2d3dbfcc24e40feef60e3..62c9c87b1c19ddf78289e02ce92b083c8c05cfcb 100644 (file)
@@ -579,6 +579,7 @@ set(regress_0_tests
   regress0/nl/issue3719.smt2
   regress0/nl/issue3729-cm-solved-tf.smt2
   regress0/nl/issue3959.smt2
+  regress0/nl/issue4007-rint-uf.smt2
   regress0/nl/magnitude-wrong-1020-m.smt2
   regress0/nl/mult-po.smt2
   regress0/nl/nia-wrong-tl.smt2
diff --git a/test/regress/regress0/nl/issue4007-rint-uf.smt2 b/test/regress/regress0/nl/issue4007-rint-uf.smt2
new file mode 100644 (file)
index 0000000..9d9a752
--- /dev/null
@@ -0,0 +1,8 @@
+; COMMAND-LINE: --solve-real-as-int
+; EXPECT: sat
+(set-logic QF_UFNIRA)
+(set-info :status sat)
+(declare-fun f (Real) Int)
+(declare-fun a () Real)
+(assert (= (f a) 0))
+(check-sat)