Enable cegqi (with model values) for floating point by default (#2023)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Mon, 4 Jun 2018 18:58:14 +0000 (13:58 -0500)
committerAndres Noetzli <andres.noetzli@gmail.com>
Mon, 4 Jun 2018 18:58:14 +0000 (11:58 -0700)
src/smt/smt_engine.cpp
src/theory/fp/theory_fp_rewriter.cpp
src/theory/quantifiers/cegqi/ceg_instantiator.cpp
test/regress/Makefile.tests
test/regress/regress1/quantifiers/fp-cegqi-unsat.smt2 [new file with mode: 0644]

index 9d10e72bea324b873e50b81b924a05a687399df8..2836f73b4cd8f7df0f3b8c0e7d5cdc31d5f37a93 100644 (file)
@@ -2071,11 +2071,15 @@ void SmtEngine::setDefaults() {
   }
   //counterexample-guided instantiation for non-sygus
   // enable if any possible quantifiers with arithmetic, datatypes or bitvectors
-  if( d_logic.isQuantified() && 
-      ( ( options::decisionMode()!=decision::DECISION_STRATEGY_INTERNAL &&
-          ( d_logic.isTheoryEnabled(THEORY_ARITH) || d_logic.isTheoryEnabled(THEORY_DATATYPES) || d_logic.isTheoryEnabled(THEORY_BV) ) ) ||
-        d_logic.isPure(THEORY_ARITH) || d_logic.isPure(THEORY_BV) ||
-        options::cbqiAll() ) ){
+  if (d_logic.isQuantified()
+      && ((options::decisionMode() != decision::DECISION_STRATEGY_INTERNAL
+           && (d_logic.isTheoryEnabled(THEORY_ARITH)
+               || d_logic.isTheoryEnabled(THEORY_DATATYPES)
+               || d_logic.isTheoryEnabled(THEORY_BV)
+               || d_logic.isTheoryEnabled(THEORY_FP)))
+          || d_logic.isPure(THEORY_ARITH) || d_logic.isPure(THEORY_BV)
+          || options::cbqiAll()))
+  {
     if( !options::cbqi.wasSetByUser() ){
       options::cbqi.set( true );
     }
index 496066ebce39e6d63f9b732c30a26b358ecce69a..574f2e0f0de9d6b8635d6ac18540c10f2947c863 100644 (file)
@@ -980,6 +980,7 @@ RewriteFunction TheoryFpRewriter::constantFoldTable[kind::LAST_KIND];
     preRewriteTable[kind::VARIABLE] = rewrite::variable;
     preRewriteTable[kind::BOUND_VARIABLE] = rewrite::variable;
     preRewriteTable[kind::SKOLEM] = rewrite::variable;
+    preRewriteTable[kind::INST_CONSTANT] = rewrite::variable;
 
     preRewriteTable[kind::EQUAL] = rewrite::equal;
 
@@ -1062,6 +1063,7 @@ RewriteFunction TheoryFpRewriter::constantFoldTable[kind::LAST_KIND];
     postRewriteTable[kind::VARIABLE] = rewrite::variable;
     postRewriteTable[kind::BOUND_VARIABLE] = rewrite::variable;
     postRewriteTable[kind::SKOLEM] = rewrite::variable;
+    postRewriteTable[kind::INST_CONSTANT] = rewrite::variable;
 
     postRewriteTable[kind::EQUAL] = rewrite::equal;
 
index 9dd0bdb04645d60c2d86649ae612f4ed1d8246f5..b18ebcdcec716ac875bc641259de21128c816c5e 100644 (file)
@@ -153,7 +153,8 @@ CegHandledStatus CegInstantiator::isCbqiKind(Kind k)
 
   // CBQI typically works for satisfaction-complete theories
   TheoryId t = kindToTheoryId(k);
-  if (t == THEORY_BV || t == THEORY_DATATYPES || t == THEORY_BOOL)
+  if (t == THEORY_BV || t == THEORY_FP || t == THEORY_DATATYPES
+      || t == THEORY_BOOL)
   {
     return CEG_HANDLED;
   }
@@ -221,7 +222,8 @@ CegHandledStatus CegInstantiator::isCbqiSort(
     return itv->second;
   }
   CegHandledStatus ret = CEG_UNHANDLED;
-  if (tn.isInteger() || tn.isReal() || tn.isBoolean() || tn.isBitVector())
+  if (tn.isInteger() || tn.isReal() || tn.isBoolean() || tn.isBitVector()
+      || tn.isFloatingPoint())
   {
     ret = CEG_HANDLED;
   }
index 2eaa6fb813a98d308459130cf7518d2b075abc58..2ac299177f10bc6c3cad7e6257c50722c79af96e 100644 (file)
@@ -1259,6 +1259,7 @@ REG1_TESTS = \
        regress1/quantifiers/ext-ex-deq-trigger.smt2 \
        regress1/quantifiers/extract-nproc.smt2 \
        regress1/quantifiers/florian-case-ax.smt2 \
+       regress1/quantifiers/fp-cegqi-unsat.smt2 \
        regress1/quantifiers/gauss_init_0030.fof.smt2 \
        regress1/quantifiers/horn-simple.smt2 \
        regress1/quantifiers/inst-max-level-segf.smt2 \
diff --git a/test/regress/regress1/quantifiers/fp-cegqi-unsat.smt2 b/test/regress/regress1/quantifiers/fp-cegqi-unsat.smt2
new file mode 100644 (file)
index 0000000..1ee8e6c
--- /dev/null
@@ -0,0 +1,10 @@
+; REQUIRES: symfpu
+(set-info :smt-lib-version 2.6)
+(set-logic FP)
+(set-info :status unsat)
+(declare-fun c_main_~E0~7 () (_ FloatingPoint 11 53))
+(declare-fun c_main_~S~7 () (_ FloatingPoint 11 53))
+(assert (and (= ((_ to_fp 11 53) RNE (_ bv0 32)) c_main_~S~7) (fp.geq c_main_~E0~7 (fp.neg ((_ to_fp 11 53) RNE 1.0))) (fp.leq c_main_~E0~7 ((_ to_fp 11 53) RNE 1.0))))
+(assert (not (and (exists ((main_~E0~7 (_ FloatingPoint 11 53)) (main_~E1~7 (_ FloatingPoint 11 53))) (and (fp.geq main_~E1~7 (fp.neg ((_ to_fp 11 53) RNE 1.0))) (= c_main_~S~7 (fp.sub RNE (fp.add RNE (fp.mul RNE ((_ to_fp 11 53) RNE 0.999) ((_ to_fp 11 53) RNE (_ bv0 32))) main_~E0~7) main_~E1~7)) (fp.geq main_~E0~7 (fp.neg ((_ to_fp 11 53) RNE 1.0))) (fp.leq main_~E0~7 ((_ to_fp 11 53) RNE 1.0)) (fp.leq main_~E1~7 ((_ to_fp 11 53) RNE 1.0)))) (fp.geq c_main_~E0~7 (fp.neg ((_ to_fp 11 53) RNE 1.0))) (fp.leq c_main_~E0~7 ((_ to_fp 11 53) RNE 1.0)))))
+(check-sat)
+(exit)