Fix abduction with datatypes (#4566)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Thu, 4 Jun 2020 16:31:55 +0000 (11:31 -0500)
committerGitHub <noreply@github.com>
Thu, 4 Jun 2020 16:31:55 +0000 (11:31 -0500)
Previously we were treating constructor/selector/tester symbols as arguments to the abduct-to-synthesize.

src/theory/quantifiers/sygus/sygus_abduct.cpp
test/regress/CMakeLists.txt
test/regress/regress1/abduct-dt.smt2 [new file with mode: 0644]

index a58c5d841231fc2bcd49b8f7b701f362ad37c497..22b56eb6b21a87b7fc80ba28abe3f922c29400dd 100644 (file)
@@ -58,6 +58,12 @@ Node SygusAbduct::mkAbductionConjecture(const std::string& name,
   for (const Node& s : symset)
   {
     TypeNode tn = s.getType();
+    if (tn.isConstructor() || tn.isSelector() || tn.isTester())
+    {
+      // datatype symbols should be considered interpreted symbols here, not
+      // (higher-order) variables.
+      continue;
+    }
     // Notice that we allow for non-first class (e.g. function) variables here.
     // This is applicable to the case where we are doing get-abduct in a logic
     // with UF.
index 801f38b294e17d906c91fdf9e28c37ece557fd34..290fca6bcd6936cef7b7b145c1e7a2c508645eaa 100644 (file)
@@ -1200,6 +1200,7 @@ set(regress_0_tests
 # Regression level 1 tests
 
 set(regress_1_tests
+  regress1/abduct-dt.smt2
   regress1/arith/arith-int-004.cvc
   regress1/arith/arith-int-011.cvc
   regress1/arith/arith-int-012.cvc
diff --git a/test/regress/regress1/abduct-dt.smt2 b/test/regress/regress1/abduct-dt.smt2
new file mode 100644 (file)
index 0000000..d72d15a
--- /dev/null
@@ -0,0 +1,8 @@
+; COMMAND-LINE: --produce-abducts
+; SCRUBBER: grep -v -E '(\(define-fun)'
+; EXIT: 0
+(set-logic ALL)
+(declare-datatypes ((List 0)) (((nil) (cons (head Int) (tail List)))))
+(declare-fun x () List)
+(assert (distinct x nil))
+(get-abduct A (= x (cons (head x) (tail x))))