Do not rewrite 1-constructor sygus testers to true (#2780)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Wed, 9 Jan 2019 21:39:07 +0000 (15:39 -0600)
committerGitHub <noreply@github.com>
Wed, 9 Jan 2019 21:39:07 +0000 (15:39 -0600)
src/theory/datatypes/datatypes_rewriter.cpp
test/regress/CMakeLists.txt
test/regress/regress2/sygus/min_IC_1.sy [new file with mode: 0644]

index 4469f0fe9866fd901520e592a83a6ab271ea0391..a2458e2eb77eb9dcb6e7ce7a544a132bda82ff97 100644 (file)
@@ -428,7 +428,7 @@ RewriteResponse DatatypesRewriter::rewriteTester(TNode in)
                            NodeManager::currentNM()->mkConst(result));
   }
   const Datatype& dt = static_cast<DatatypeType>(in[0].getType().toType()).getDatatype();
-  if (dt.getNumConstructors() == 1)
+  if (dt.getNumConstructors() == 1 && !dt.isSygus())
   {
     // only one constructor, so it must be
     Trace("datatypes-rewrite")
index 0b196855f3b58a49c9b503e453f06aade882f76e..e6e28336ef4529bc9682370a49550244e9d403a3 100644 (file)
@@ -1748,6 +1748,7 @@ set(regress_2_tests
   regress2/sygus/inv_gen_n_c11.sy
   regress2/sygus/lustre-real.sy
   regress2/sygus/max2-univ.sy
+  regress2/sygus/min_IC_1.sy
   regress2/sygus/mpg_guard1-dd.sy
   regress2/sygus/multi-udiv.sy
   regress2/sygus/nia-max-square.sy
diff --git a/test/regress/regress2/sygus/min_IC_1.sy b/test/regress/regress2/sygus/min_IC_1.sy
new file mode 100644 (file)
index 0000000..92e1713
--- /dev/null
@@ -0,0 +1,25 @@
+; REQUIRES: symfpu
+; EXPECT: unsat
+; COMMAND-LINE: --sygus-out=status
+(set-logic ALL)
+(define-sort FP () (_ FloatingPoint 3 5))
+(define-fun IC ((t FP)) Bool (=> (fp.isInfinite t) (fp.isNegative t)))
+
+(synth-fun simpIC ((t FP)) Bool
+  ((Start Bool (
+     (and Start Start)
+     (not Start)
+
+     (fp.isInfinite StartFP)
+     (fp.isNegative StartFP)
+     
+     (ite Start Start Start)
+   ))
+   (StartFP FP (
+     t
+   ))
+))
+
+(declare-var x FP)
+(constraint (= (simpIC x) (IC x)))
+(check-synth)