Use cbqi-full for sygus (#2346)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Tue, 21 Aug 2018 17:10:38 +0000 (12:10 -0500)
committerGitHub <noreply@github.com>
Tue, 21 Aug 2018 17:10:38 +0000 (12:10 -0500)
src/smt/smt_engine.cpp
src/theory/quantifiers/sygus/ce_guided_instantiation.cpp
test/regress/Makefile.tests
test/regress/regress1/sygus/max2-bv.sy [new file with mode: 0644]

index 1e8ae40339356b08d3b6264768ea0376a9a4e6e7..cabe825be87a1a2647c4055bbe96fcf7f1d79d3b 100644 (file)
@@ -1934,6 +1934,7 @@ void SmtEngine::setDefaults() {
       options::ceGuidedInst.set( true );
     }
   }
+  // if sygus is enabled, set the defaults for sygus
   if( options::ceGuidedInst() ){
     //counterexample-guided instantiation for sygus
     if( !options::cegqiSingleInvMode.wasSetByUser() ){
@@ -1945,6 +1946,11 @@ void SmtEngine::setDefaults() {
     if( !options::instNoEntail.wasSetByUser() ){
       options::instNoEntail.set( false );
     }
+    if (!options::cbqiFullEffort.wasSetByUser())
+    {
+      // should use full effort cbqi for single invocation and repair const
+      options::cbqiFullEffort.set(true);
+    }
     if (options::sygusRew())
     {
       options::sygusRewSynth.set(true);
index b3cb98bc523666ef9928dbf3dc33b30e7119fe56..1e0b36a3ca39051811c7e5df664a67ed0565caf0 100644 (file)
@@ -267,20 +267,32 @@ void CegInstantiation::checkCegConjecture( CegConjecture * conj ) {
 
   if( !conj->needsRefinement() ){
     Trace("cegqi-engine-debug") << "Do conjecture check..." << std::endl;
-    std::vector<Node> clems;
-    conj->doSingleInvCheck(clems);
-    if (!clems.empty())
+    if (conj->isSingleInvocation())
     {
-      d_last_inst_si = true;
-      for (const Node& lem : clems)
+      std::vector<Node> clems;
+      conj->doSingleInvCheck(clems);
+      if (!clems.empty())
       {
-        Trace("cegqi-lemma")
-            << "Cegqi::Lemma : single invocation instantiation : " << lem
+        d_last_inst_si = true;
+        for (const Node& lem : clems)
+        {
+          Trace("cegqi-lemma")
+              << "Cegqi::Lemma : single invocation instantiation : " << lem
+              << std::endl;
+          d_quantEngine->addLemma(lem);
+        }
+        d_statistics.d_cegqi_si_lemmas += clems.size();
+        Trace("cegqi-engine") << "  ...try single invocation." << std::endl;
+      }
+      else
+      {
+        // This can happen for non-monotonic instantiation strategies. We
+        // set --cbqi-full to ensure that for most strategies (e.g. BV), we
+        // are using a monotonic strategy.
+        Trace("cegqi-warn")
+            << "  ...FAILED to add cbqi instantiation for single invocation!"
             << std::endl;
-        d_quantEngine->addLemma(lem);
       }
-      d_statistics.d_cegqi_si_lemmas += clems.size();
-      Trace("cegqi-engine") << "  ...try single invocation." << std::endl;
       return;
     }
 
index 08f64a92584c217ceafcb03419966a0f09d7c785..e773bf698791389eaa5d6ac06dbb5e2478e06d1e 100644 (file)
@@ -1549,6 +1549,7 @@ REG1_TESTS = \
        regress1/sygus/list-head-x.sy \
        regress1/sygus/logiccell_help.sy \
        regress1/sygus/max.sy \
+       regress1/sygus/max2-bv.sy \
        regress1/sygus/multi-fun-polynomial2.sy \
        regress1/sygus/nflat-fwd-3.sy \
        regress1/sygus/nflat-fwd.sy \
diff --git a/test/regress/regress1/sygus/max2-bv.sy b/test/regress/regress1/sygus/max2-bv.sy
new file mode 100644 (file)
index 0000000..297bd91
--- /dev/null
@@ -0,0 +1,26 @@
+; EXPECT: unsat
+; COMMAND-LINE: --sygus-out=status
+(set-logic BV)
+
+(synth-fun max2 ((x (BitVec 32))(y (BitVec 32))) (BitVec 32)
+)
+
+(declare-var x (BitVec 32))
+
+(declare-var y (BitVec 32))
+
+(constraint 
+(bvuge (max2 x y) x)
+)
+
+(constraint 
+(bvuge (max2 x y) y)
+)
+
+(constraint 
+(or (= x (max2 x y)) (= y (max2 x y)))
+)
+
+(check-synth)
+
+