Ignoring FP benchmarks with "unsafe" sizes unless option (#2931)
authorHaniel Barbosa <hanielbbarbosa@gmail.com>
Thu, 4 Apr 2019 17:31:21 +0000 (12:31 -0500)
committerGitHub <noreply@github.com>
Thu, 4 Apr 2019 17:31:21 +0000 (12:31 -0500)
src/options/fp_options.toml
src/theory/fp/theory_fp.cpp
test/regress/regress0/fp/abs-unsound.smt2
test/regress/regress0/fp/abs-unsound2.smt2
test/regress/regress0/fp/wrong-model.smt2

index eb8c933afc8eeb4309e0ba691e149369c02f43d0..af8d044f7516f0cb562c92cd1f9f03d9da2df236 100644 (file)
@@ -1,3 +1,11 @@
 id     = "FP"
 name   = "Fp"
 header = "options/fp_options.h"
+
+[[option]]
+  name       = "fpExp"
+  category   = "regular"
+  long       = "fp-exp"
+  type       = "bool"
+  default    = "false"
+  help       = "Allow floating-point sorts of all sizes, rather than only Float32 (8/24) or Float64 (11/53) (experimental)"
index 9dae2a5c3ee73c807412867a8a744dc14cf1dc49..ee35f9e2a5d2f6703550862370d07aab75b0a565 100644 (file)
  ** \todo document this file
  **/
 
-#include "theory/fp/theory_fp.h"
+
+#include "options/fp_options.h"
 #include "theory/rewriter.h"
 #include "theory/theory_model.h"
+#include "theory/fp/theory_fp.h"
+
 
 #include <set>
 #include <stack>
@@ -306,7 +309,7 @@ Node TheoryFp::toRealUF(Node node) {
     std::vector<TypeNode> args(1);
     args[0] = t;
     fun = nm->mkSkolem("floatingpoint_to_real_infinity_and_NaN_case",
-                      nm->mkFunctionType(args, nm->realType()),
+                       nm->mkFunctionType(args, nm->realType()),
                        "floatingpoint_to_real_infinity_and_NaN_case",
                        NodeManager::SKOLEM_EXACT_NAME);
     d_toRealMap.insert(t, fun);
@@ -876,7 +879,21 @@ bool TheoryFp::isRegistered(TNode node) {
   return !(d_registeredTerms.find(node) == d_registeredTerms.end());
 }
 
-void TheoryFp::preRegisterTerm(TNode node) {
+void TheoryFp::preRegisterTerm(TNode node)
+{
+  if (Configuration::isBuiltWithSymFPU() && !options::fpExp())
+  {
+    TypeNode tn = node.getType();
+    unsigned exp_sz = tn.getFloatingPointExponentSize();
+    unsigned sig_sz = tn.getFloatingPointSignificandSize();
+    if (!((exp_sz == 8 && sig_sz == 24) || (exp_sz == 11 && sig_sz == 53)))
+    {
+      std::stringstream ss;
+      ss << "FP types with sizes other than 8/24 or 11/53 are not supported in "
+            "default mode, try the experimental solver via --fp-exp";
+      throw LogicException(ss.str());
+    }
+  }
   Trace("fp-preRegisterTerm")
       << "TheoryFp::preRegisterTerm(): " << node << std::endl;
   registerTerm(node);
index 4ac53b8307208cd13002fa2b6d43e39a2e9cf252..b5aa0452efa7b2f15ca4b5312217302d389b7bc3 100644 (file)
@@ -1,4 +1,5 @@
 ; REQUIRES: symfpu
+; COMMAND-LINE: --fp-exp
 ; EXPECT: sat
 (set-logic QF_FP)
 (set-info :status sat)
index a6172b157e6994fba0ae47dc4c3695d5e10ffa78..ad603f8c984d9526c9b481caae7c15bbaec950a6 100644 (file)
@@ -1,4 +1,5 @@
 ; REQUIRES: symfpu
+; COMMAND-LINE: --fp-exp
 ; EXPECT: unsat
 (set-logic QF_FP)
 (set-info :status unsat)
index 4bb7645d5da9a333632a13278a9e5d56675b503f..7694d8a35fb198cbe9e70579cf0d3840ebb09627 100644 (file)
@@ -1,10 +1,11 @@
 ; REQUIRES: symfpu
+; COMMAND-LINE: --fp-exp
 ; EXPECT: sat
 
 ; NOTE: the (set-logic ALL) is on purpose because the problem was not triggered
 ; with QF_FP.
 (set-logic ALL)
-(declare-const r RoundingMode) 
+(declare-const r RoundingMode)
 (declare-const x (_ FloatingPoint 5 11))
 (declare-const y (_ FloatingPoint 5 11))
 (assert (not (= (fp.isSubnormal x) false)))