Remove `ConstantMap<Rational>` (#7635)
authorAndres Noetzli <andres.noetzli@gmail.com>
Fri, 12 Nov 2021 14:14:49 +0000 (06:14 -0800)
committerGitHub <noreply@github.com>
Fri, 12 Nov 2021 14:14:49 +0000 (08:14 -0600)
This is in preparation of having two different kinds (CONST_RATIONAL
and CONST_INT) share the same payload. To do so, we cannot rely on
ConstantMap<Rational> anymore to map the payload type to a kind. This
commit extends support in the mkmetakind script to deal with such
payloads by adding a + suffix to the type. The commit also does some
minor refactoring of NodeManager::mkConst() and
NodeManager::mkConstInternal() to support setting the kind explicitly.
Finally, the commit addresses all instances where mkConst<Rational>()
is used, including the API.

144 files changed:
src/api/cpp/cvc5.cpp
src/api/cpp/cvc5.h
src/expr/bound_var_manager.cpp
src/expr/dtype.cpp
src/expr/mkmetakind
src/expr/nary_term_util.cpp
src/expr/node_manager.h
src/expr/term_context_node.cpp
src/parser/antlr_input.cpp
src/parser/input.cpp
src/parser/parser.cpp
src/preprocessing/passes/bv_to_int.cpp
src/preprocessing/passes/miplib_trick.cpp
src/preprocessing/passes/real_to_int.cpp
src/preprocessing/passes/unconstrained_simplifier.cpp
src/proof/alethe/alethe_post_processor.cpp
src/proof/lfsc/lfsc_node_converter.cpp
src/proof/lfsc/lfsc_util.cpp
src/proof/method_id.cpp
src/proof/proof_checker.cpp
src/prop/proof_cnf_stream.cpp
src/smt/difficulty_post_processor.cpp
src/smt/proof_post_processor.cpp
src/smt_util/nary_builder.cpp
src/theory/arith/arith_msum.cpp
src/theory/arith/arith_rewriter.cpp
src/theory/arith/arith_utilities.cpp
src/theory/arith/arith_utilities.h
src/theory/arith/bound_inference.cpp
src/theory/arith/congruence_manager.cpp
src/theory/arith/constraint.cpp
src/theory/arith/infer_bounds.cpp
src/theory/arith/kinds
src/theory/arith/nl/cad/cdcac.cpp
src/theory/arith/nl/cad/proof_generator.cpp
src/theory/arith/nl/ext/ext_state.cpp
src/theory/arith/nl/ext/factoring_check.cpp
src/theory/arith/nl/ext/monomial.cpp
src/theory/arith/nl/ext/monomial_bounds_check.cpp
src/theory/arith/nl/ext/proof_checker.cpp
src/theory/arith/nl/ext/tangent_plane_check.cpp
src/theory/arith/nl/ext_theory_callback.cpp
src/theory/arith/nl/iand_solver.cpp
src/theory/arith/nl/iand_utils.cpp
src/theory/arith/nl/nl_model.cpp
src/theory/arith/nl/nonlinear_extension.cpp
src/theory/arith/nl/poly_conversion.cpp
src/theory/arith/nl/pow2_solver.cpp
src/theory/arith/nl/transcendental/exponential_solver.cpp
src/theory/arith/nl/transcendental/proof_checker.cpp
src/theory/arith/nl/transcendental/sine_solver.cpp
src/theory/arith/nl/transcendental/taylor_generator.cpp
src/theory/arith/nl/transcendental/transcendental_state.cpp
src/theory/arith/operator_elim.cpp
src/theory/arith/proof_checker.cpp
src/theory/arith/theory_arith_private.cpp
src/theory/arith/type_enumerator.h
src/theory/bags/bag_solver.cpp
src/theory/bags/bags_rewriter.cpp
src/theory/bags/inference_generator.cpp
src/theory/bags/normal_form.cpp
src/theory/bags/theory_bags.cpp
src/theory/bags/theory_bags_type_enumerator.cpp
src/theory/booleans/proof_circuit_propagator.cpp
src/theory/builtin/proof_checker.cpp
src/theory/bv/int_blaster.cpp
src/theory/bv/theory_bv_utils.cpp
src/theory/datatypes/datatypes_rewriter.cpp
src/theory/datatypes/infer_proof_cons.cpp
src/theory/datatypes/sygus_extension.cpp
src/theory/datatypes/sygus_simple_sym.cpp
src/theory/datatypes/theory_datatypes.cpp
src/theory/difficulty_manager.cpp
src/theory/evaluator.cpp
src/theory/fp/theory_fp.cpp
src/theory/fp/theory_fp_rewriter.cpp
src/theory/inference_id.cpp
src/theory/quantifiers/cegqi/ceg_arith_instantiator.cpp
src/theory/quantifiers/cegqi/ceg_instantiator.cpp
src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp
src/theory/quantifiers/cegqi/vts_term_cache.cpp
src/theory/quantifiers/ematching/inst_match_generator.cpp
src/theory/quantifiers/ematching/pattern_term_selector.cpp
src/theory/quantifiers/ematching/relational_match_generator.cpp
src/theory/quantifiers/extended_rewrite.cpp
src/theory/quantifiers/fmf/bounded_integers.cpp
src/theory/quantifiers/quant_bound_inference.cpp
src/theory/quantifiers/quant_conflict_find.cpp
src/theory/quantifiers/quantifiers_rewriter.cpp
src/theory/quantifiers/skolemize.cpp
src/theory/quantifiers/sygus/cegis_unif.cpp
src/theory/quantifiers/sygus/sygus_enumerator.cpp
src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
src/theory/quantifiers/sygus_sampler.cpp
src/theory/quantifiers/term_util.cpp
src/theory/sets/cardinality_extension.cpp
src/theory/sets/theory_sets_private.cpp
src/theory/sets/theory_sets_rewriter.cpp
src/theory/strings/arith_entail.cpp
src/theory/strings/array_solver.cpp
src/theory/strings/base_solver.cpp
src/theory/strings/core_solver.cpp
src/theory/strings/infer_proof_cons.cpp
src/theory/strings/inference_manager.cpp
src/theory/strings/proof_checker.cpp
src/theory/strings/regexp_elim.cpp
src/theory/strings/regexp_entail.cpp
src/theory/strings/regexp_operation.cpp
src/theory/strings/sequences_rewriter.cpp
src/theory/strings/skolem_cache.cpp
src/theory/strings/solver_state.cpp
src/theory/strings/strings_entail.cpp
src/theory/strings/strings_fmf.cpp
src/theory/strings/strings_rewriter.cpp
src/theory/strings/term_registry.cpp
src/theory/strings/theory_strings.cpp
src/theory/strings/theory_strings_preprocess.cpp
src/theory/strings/theory_strings_utils.cpp
test/unit/node/node_algorithm_black.cpp
test/unit/node/node_black.cpp
test/unit/node/node_builder_black.cpp
test/unit/node/node_manager_black.cpp
test/unit/node/node_manager_white.cpp
test/unit/node/node_white.cpp
test/unit/node/type_node_white.cpp
test/unit/preprocessing/pass_foreign_theory_rewrite_white.cpp
test/unit/theory/arith_poly_white.cpp
test/unit/theory/evaluator_white.cpp
test/unit/theory/sequences_rewriter_white.cpp
test/unit/theory/theory_arith_cad_white.cpp
test/unit/theory/theory_arith_pow2_white.cpp
test/unit/theory/theory_arith_white.cpp
test/unit/theory/theory_bags_normal_form_white.cpp
test/unit/theory/theory_bags_rewriter_white.cpp
test/unit/theory/theory_bags_type_rules_white.cpp
test/unit/theory/theory_black.cpp
test/unit/theory/theory_bv_int_blaster_white.cpp
test/unit/theory/theory_engine_white.cpp
test/unit/theory/theory_int_opt_white.cpp
test/unit/theory/theory_sets_type_rules_white.cpp
test/unit/theory/theory_strings_skolem_cache_black.cpp
test/unit/theory/type_enumerator_white.cpp
test/unit/util/array_store_all_white.cpp
test/unit/util/datatype_black.cpp

index 18879a4eb9495e14789a6f15443c57e4afe25ac9..39277b7e8259af42e0360d3b3aa36f4a761fe76b 100644 (file)
@@ -1948,75 +1948,74 @@ Term Op::getIndexHelper(size_t index) const
   {
     case DIVISIBLE:
     {
-      t = d_solver->mkValHelper<Rational>(
+      t = d_solver->mkRationalValHelper(
           Rational(d_node->getConst<Divisible>().k));
       break;
     }
     case BITVECTOR_REPEAT:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<BitVectorRepeat>().d_repeatAmount);
       break;
     }
     case BITVECTOR_ZERO_EXTEND:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<BitVectorZeroExtend>().d_zeroExtendAmount);
       break;
     }
     case BITVECTOR_SIGN_EXTEND:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<BitVectorSignExtend>().d_signExtendAmount);
       break;
     }
     case BITVECTOR_ROTATE_LEFT:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<BitVectorRotateLeft>().d_rotateLeftAmount);
       break;
     }
     case BITVECTOR_ROTATE_RIGHT:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<BitVectorRotateRight>().d_rotateRightAmount);
       break;
     }
     case INT_TO_BITVECTOR:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<IntToBitVector>().d_size);
       break;
     }
     case IAND:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
-          d_node->getConst<IntAnd>().d_size);
+      t = d_solver->mkRationalValHelper(d_node->getConst<IntAnd>().d_size);
       break;
     }
     case FLOATINGPOINT_TO_UBV:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<FloatingPointToUBV>().d_bv_size.d_size);
       break;
     }
     case FLOATINGPOINT_TO_SBV:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<FloatingPointToSBV>().d_bv_size.d_size);
       break;
     }
     case REGEXP_REPEAT:
     {
-      t = d_solver->mkValHelper<cvc5::Rational>(
+      t = d_solver->mkRationalValHelper(
           d_node->getConst<RegExpRepeat>().d_repeatAmount);
       break;
     }
     case BITVECTOR_EXTRACT:
     {
       cvc5::BitVectorExtract ext = d_node->getConst<BitVectorExtract>();
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(ext.d_high)
-                     : d_solver->mkValHelper<cvc5::Rational>(ext.d_low);
+      t = index == 0 ? d_solver->mkRationalValHelper(ext.d_high)
+                     : d_solver->mkRationalValHelper(ext.d_low);
       break;
     }
     case FLOATINGPOINT_TO_FP_IEEE_BITVECTOR:
@@ -2024,20 +2023,18 @@ Term Op::getIndexHelper(size_t index) const
       cvc5::FloatingPointToFPIEEEBitVector ext =
           d_node->getConst<FloatingPointToFPIEEEBitVector>();
 
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(
-              ext.getSize().exponentWidth())
-                     : d_solver->mkValHelper<cvc5::Rational>(
-                         ext.getSize().significandWidth());
+      t = index == 0
+              ? d_solver->mkRationalValHelper(ext.getSize().exponentWidth())
+              : d_solver->mkRationalValHelper(ext.getSize().significandWidth());
       break;
     }
     case FLOATINGPOINT_TO_FP_FLOATINGPOINT:
     {
       cvc5::FloatingPointToFPFloatingPoint ext =
           d_node->getConst<FloatingPointToFPFloatingPoint>();
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(
-              ext.getSize().exponentWidth())
-                     : d_solver->mkValHelper<cvc5::Rational>(
-                         ext.getSize().significandWidth());
+      t = index == 0
+              ? d_solver->mkRationalValHelper(ext.getSize().exponentWidth())
+              : d_solver->mkRationalValHelper(ext.getSize().significandWidth());
       break;
     }
     case FLOATINGPOINT_TO_FP_REAL:
@@ -2045,47 +2042,43 @@ Term Op::getIndexHelper(size_t index) const
       cvc5::FloatingPointToFPReal ext =
           d_node->getConst<FloatingPointToFPReal>();
 
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(
-              ext.getSize().exponentWidth())
-                     : d_solver->mkValHelper<cvc5::Rational>(
-                         ext.getSize().significandWidth());
+      t = index == 0
+              ? d_solver->mkRationalValHelper(ext.getSize().exponentWidth())
+              : d_solver->mkRationalValHelper(ext.getSize().significandWidth());
       break;
     }
     case FLOATINGPOINT_TO_FP_SIGNED_BITVECTOR:
     {
       cvc5::FloatingPointToFPSignedBitVector ext =
           d_node->getConst<FloatingPointToFPSignedBitVector>();
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(
-              ext.getSize().exponentWidth())
-                     : d_solver->mkValHelper<cvc5::Rational>(
-                         ext.getSize().significandWidth());
+      t = index == 0
+              ? d_solver->mkRationalValHelper(ext.getSize().exponentWidth())
+              : d_solver->mkRationalValHelper(ext.getSize().significandWidth());
       break;
     }
     case FLOATINGPOINT_TO_FP_UNSIGNED_BITVECTOR:
     {
       cvc5::FloatingPointToFPUnsignedBitVector ext =
           d_node->getConst<FloatingPointToFPUnsignedBitVector>();
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(
-              ext.getSize().exponentWidth())
-                     : d_solver->mkValHelper<cvc5::Rational>(
-                         ext.getSize().significandWidth());
+      t = index == 0
+              ? d_solver->mkRationalValHelper(ext.getSize().exponentWidth())
+              : d_solver->mkRationalValHelper(ext.getSize().significandWidth());
       break;
     }
     case FLOATINGPOINT_TO_FP_GENERIC:
     {
       cvc5::FloatingPointToFPGeneric ext =
           d_node->getConst<FloatingPointToFPGeneric>();
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(
-              ext.getSize().exponentWidth())
-                     : d_solver->mkValHelper<cvc5::Rational>(
-                         ext.getSize().significandWidth());
+      t = index == 0
+              ? d_solver->mkRationalValHelper(ext.getSize().exponentWidth())
+              : d_solver->mkRationalValHelper(ext.getSize().significandWidth());
       break;
     }
     case REGEXP_LOOP:
     {
       cvc5::RegExpLoop ext = d_node->getConst<RegExpLoop>();
-      t = index == 0 ? d_solver->mkValHelper<cvc5::Rational>(ext.d_loopMinOcc)
-                     : d_solver->mkValHelper<cvc5::Rational>(ext.d_loopMaxOcc);
+      t = index == 0 ? d_solver->mkRationalValHelper(ext.d_loopMinOcc)
+                     : d_solver->mkRationalValHelper(ext.d_loopMaxOcc);
 
       break;
     }
@@ -2094,7 +2087,7 @@ Term Op::getIndexHelper(size_t index) const
     {
       const std::vector<uint32_t>& projectionIndices =
           d_node->getConst<TupleProjectOp>().getIndices();
-      t = d_solver->mkValHelper<cvc5::Rational>(projectionIndices[index]);
+      t = d_solver->mkRationalValHelper(projectionIndices[index]);
       break;
     }
     default:
@@ -5046,6 +5039,14 @@ Term Solver::mkValHelper(T t) const
   return Term(this, res);
 }
 
+Term Solver::mkRationalValHelper(const Rational& r) const
+{
+  //////// all checks before this line
+  Node res = getNodeManager()->mkConst(kind::CONST_RATIONAL, r);
+  (void)res.getType(true); /* kick off type checking */
+  return Term(this, res);
+}
+
 Term Solver::mkRealFromStrHelper(const std::string& s) const
 {
   //////// all checks before this line
@@ -5054,7 +5055,7 @@ Term Solver::mkRealFromStrHelper(const std::string& s) const
     cvc5::Rational r = s.find('/') != std::string::npos
                            ? cvc5::Rational(s)
                            : cvc5::Rational::fromDecimal(s);
-    return mkValHelper<cvc5::Rational>(r);
+    return mkRationalValHelper(r);
   }
   catch (const std::invalid_argument& e)
   {
@@ -5352,7 +5353,8 @@ Term Solver::ensureTermSort(const Term& term, const Sort& sort) const
     res = Term(this,
                d_nodeMgr->mkNode(extToIntKind(DIVISION),
                                  *res.d_node,
-                                 d_nodeMgr->mkConst(cvc5::Rational(1))));
+                                 d_nodeMgr->mkConst(kind::CONST_RATIONAL,
+                                                    cvc5::Rational(1))));
   }
   Assert(res.getSort() == sort);
   return res;
@@ -5782,7 +5784,7 @@ Term Solver::mkInteger(int64_t val) const
 {
   CVC5_API_TRY_CATCH_BEGIN;
   //////// all checks before this line
-  Term integer = mkValHelper<cvc5::Rational>(cvc5::Rational(val));
+  Term integer = mkRationalValHelper(cvc5::Rational(val));
   Assert(integer.getSort() == getIntegerSort());
   return integer;
   ////////
@@ -5808,7 +5810,7 @@ Term Solver::mkReal(int64_t val) const
 {
   CVC5_API_TRY_CATCH_BEGIN;
   //////// all checks before this line
-  Term rational = mkValHelper<cvc5::Rational>(cvc5::Rational(val));
+  Term rational = mkRationalValHelper(cvc5::Rational(val));
   return ensureRealSort(rational);
   ////////
   CVC5_API_TRY_CATCH_END;
@@ -5818,7 +5820,7 @@ Term Solver::mkReal(int64_t num, int64_t den) const
 {
   CVC5_API_TRY_CATCH_BEGIN;
   //////// all checks before this line
-  Term rational = mkValHelper<cvc5::Rational>(cvc5::Rational(num, den));
+  Term rational = mkRationalValHelper(cvc5::Rational(num, den));
   return ensureRealSort(rational);
   ////////
   CVC5_API_TRY_CATCH_END;
index 46678b0d8757dc1e83c78cac469cb378b6fcd1a1..ad6f4c7df71c36a8be935d77bf8fbc315f8151d0 100644 (file)
@@ -48,6 +48,7 @@ class SolverEngine;
 class TypeNode;
 class Options;
 class Random;
+class Rational;
 class Result;
 class StatisticsRegistry;
 
@@ -4504,6 +4505,8 @@ class CVC5_EXPORT Solver
   /** Helper for mk-functions that call d_nodeMgr->mkConst(). */
   template <typename T>
   Term mkValHelper(T t) const;
+  /** Helper for making rational values. */
+  Term mkRationalValHelper(const Rational& r) const;
   /** Helper for mkReal functions that take a string as argument. */
   Term mkRealFromStrHelper(const std::string& s) const;
   /** Helper for mkBitVector functions that take a string as argument. */
index 820c82d228ee8e01209b56faa091a2ad29c07d0e..53c87fb970def06254f2980053379299cd5d8e22 100644 (file)
@@ -18,6 +18,8 @@
 #include "expr/node_manager_attributes.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 
 BoundVarManager::BoundVarManager() : d_keepCacheVals(false) {}
@@ -51,7 +53,7 @@ Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, size_t i)
 
 Node BoundVarManager::getCacheValue(size_t i)
 {
-  return NodeManager::currentNM()->mkConst(Rational(i));
+  return NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(i));
 }
 
 Node BoundVarManager::getCacheValue(TNode cv, size_t i)
index 4a0ed994fbbf90bc9174d394c3fe5dd2b08b64a0..a5719a7ff0225567c6f0b2a7f62f3e247be47387 100644 (file)
@@ -866,7 +866,7 @@ Node DType::getSharedSelector(TypeNode dtt, TypeNode t, size_t index) const
   ss << "sel_" << index;
   SkolemManager* sm = nm->getSkolemManager();
   TypeNode stype = nm->mkSelectorType(dtt, t);
-  Node nindex = nm->mkConst(Rational(index));
+  Node nindex = nm->mkConst(CONST_RATIONAL, Rational(index));
   s = sm->mkSkolemFunction(SkolemFunId::SHARED_SELECTOR, stype, nindex);
   d_sharedSel[dtt][t][index] = s;
   Trace("dt-shared-sel") << "Made " << s << " of type " << dtt << " -> " << t
index f9b49fc0acd994397fbc30b4661c2f077254cf3a..f8282a99806723e8adbc35fffd7c10a8fcaad9c8 100755 (executable)
@@ -213,9 +213,18 @@ function constant {
     echo "$kf:$lineno: warning: constant $1 hasher \`$4' isn't fully-qualified (e.g., ::cvc5::RationalHashFunction)" >&2
   fi
 
+  if [[ "$3" =~ '+'$ ]]; then
+    # Remove last character
+    class="${3%?}"
+    skip_const_map=true
+  else
+    class="$3"
+    skip_const_map=false
+  fi
+
   if [[ "$2" != "skip" ]]; then
     metakind_fwd_decls="${metakind_fwd_decls}
-$2 $3;"
+$2 ${class};"
   fi
 
   # Avoid including the same header multiple times
@@ -226,37 +235,41 @@ $2 $3;"
   register_metakind CONSTANT "$1" 0
   metakind_getConst_decls="${metakind_getConst_decls}
 template <>
-$3 const& NodeValue::getConst< $3 >() const;
+${class} const& NodeValue::getConst< ${class} >() const;
 "
-  metakind_constantMaps_decls="${metakind_constantMaps_decls}
+  if [ "${skip_const_map}" != true ]; then
+    metakind_constantMaps_decls="${metakind_constantMaps_decls}
 template <>
-struct ConstantMap< $3 > {
-  // typedef $theory_class OwningTheory;
-  enum { kind = ::cvc5::kind::$1 };
-};/* ConstantMap< $3 > */
+struct ConstantMap< ${class} > {
+  static constexpr Kind kind = ::cvc5::kind::$1;
+};/* ConstantMap< ${class} > */
+"
+  fi
 
+  metakind_constantMaps_decls="${metakind_constantMaps_decls}
 template <>
 struct ConstantMapReverse< ::cvc5::kind::$1 > {
-  typedef $3 T;
+  using T = ${class};
 };/* ConstantMapReverse< ::cvc5::kind::$1 > */
-  "
+"
+
   metakind_constantMaps="${metakind_constantMaps}
-// The reinterpret_cast of d_children to \"$3 const*\"
+// The reinterpret_cast of d_children to \"${class} const*\"
 // flags a \"strict aliasing\" warning; it's okay, because we never access
 // the embedded constant as a NodeValue* child, and never access an embedded
 // NodeValue* child as a constant.
 #pragma GCC diagnostic ignored \"-Wstrict-aliasing\"
 
 template <>
-$3 const& NodeValue::getConst< $3 >() const {
+${class} const& NodeValue::getConst< ${class} >() const {
   AssertArgument(getKind() == ::cvc5::kind::$1, *this,
-                 \"Improper kind for getConst<$3>()\");
+                 \"Improper kind for getConst<${class}>()\");
   // To support non-inlined CONSTANT-kinded NodeValues (those that are
   // \"constructed\" when initially checking them against the NodeManager
   // pool), we must check d_nchildren here.
   return d_nchildren == 0
-    ? *reinterpret_cast< $3 const* >(d_children)
-    : *reinterpret_cast< $3 const* >(d_children[0]);
+    ? *reinterpret_cast< ${class} const* >(d_children)
+    : *reinterpret_cast< ${class} const* >(d_children[0]);
 }
 
 // re-enable the warning
@@ -269,17 +282,17 @@ $3 const& NodeValue::getConst< $3 >() const {
 "
   metakind_constHashes="${metakind_constHashes}
   case kind::$1:
-    return $4()(nv->getConst< $3 >());
+    return $4()(nv->getConst< ${class} >());
 "
   metakind_constPrinters="${metakind_constPrinters}
   case kind::$1:
-    out << nv->getConst< $3 >();
+    out << nv->getConst< ${class} >();
     break;
 "
-  cname=`echo "$3" | awk 'BEGIN {FS="::"} {print$NF}'`
+  cname=`echo "${class}" | awk 'BEGIN {FS="::"} {print$NF}'`
   metakind_constDeleters="${metakind_constDeleters}
   case kind::$1:
-    std::destroy_at(reinterpret_cast< $3* >(nv->d_children));
+    std::destroy_at(reinterpret_cast< ${class}* >(nv->d_children));
     break;
 "
 }
index 4071e0d0ee2946217df237ecf8c8f196bec16f16..a872c64c787a0d7ae04fd211d4a53079a7313d2c 100644 (file)
@@ -119,9 +119,11 @@ Node getNullTerminator(Kind k, TypeNode tn)
     case OR: nullTerm = nm->mkConst(false); break;
     case AND:
     case SEP_STAR: nullTerm = nm->mkConst(true); break;
-    case PLUS: nullTerm = nm->mkConst(Rational(0)); break;
+    case PLUS: nullTerm = nm->mkConst(CONST_RATIONAL, Rational(0)); break;
     case MULT:
-    case NONLINEAR_MULT: nullTerm = nm->mkConst(Rational(1)); break;
+    case NONLINEAR_MULT:
+      nullTerm = nm->mkConst(CONST_RATIONAL, Rational(1));
+      break;
     case STRING_CONCAT:
       // handles strings and sequences
       nullTerm = theory::strings::Word::mkEmptyWord(tn);
index 1208a0e03aa3d857a57a9498f77030490978e93f..d301c857c59d900abf97f068feabab7e8ffdb6e8 100644 (file)
@@ -522,11 +522,17 @@ class NodeManager
   template <class T>
   Node mkConst(const T&);
 
+  /**
+   * Create a constant of type `T` with an explicit kind `k`.
+   */
+  template <class T>
+  Node mkConst(Kind k, const T&);
+
   template <class T>
   TypeNode mkTypeConst(const T&);
 
   template <class NodeClass, class T>
-  NodeClass mkConstInternal(const T&);
+  NodeClass mkConstInternal(Kind k, const T&);
 
   /** Create a node with children. */
   TypeNode mkTypeNode(Kind kind, TypeNode child1);
@@ -1187,22 +1193,29 @@ inline TypeNode NodeManager::mkTypeNode(Kind kind,
 
 template <class T>
 Node NodeManager::mkConst(const T& val) {
-  return mkConstInternal<Node, T>(val);
+  return mkConstInternal<Node, T>(kind::metakind::ConstantMap<T>::kind, val);
+}
+
+template <class T>
+Node NodeManager::mkConst(Kind k, const T& val)
+{
+  return mkConstInternal<Node, T>(k, val);
 }
 
 template <class T>
 TypeNode NodeManager::mkTypeConst(const T& val) {
-  return mkConstInternal<TypeNode, T>(val);
+  return mkConstInternal<TypeNode, T>(kind::metakind::ConstantMap<T>::kind,
+                                      val);
 }
 
 template <class NodeClass, class T>
-NodeClass NodeManager::mkConstInternal(const T& val) {
-  // typedef typename kind::metakind::constantMap<T>::OwningTheory theory_t;
+NodeClass NodeManager::mkConstInternal(Kind k, const T& val)
+{
   NVStorage<1> nvStorage;
   expr::NodeValue& nvStack = reinterpret_cast<expr::NodeValue&>(nvStorage);
 
   nvStack.d_id = 0;
-  nvStack.d_kind = kind::metakind::ConstantMap<T>::kind;
+  nvStack.d_kind = k;
   nvStack.d_rc = 0;
   nvStack.d_nchildren = 1;
 
@@ -1230,11 +1243,10 @@ NodeClass NodeManager::mkConstInternal(const T& val) {
   }
 
   nv->d_nchildren = 0;
-  nv->d_kind = kind::metakind::ConstantMap<T>::kind;
+  nv->d_kind = k;
   nv->d_id = next_id++;// FIXME multithreading
   nv->d_rc = 0;
 
-  //OwningTheory::mkConst(val);
   new (&nv->d_children) T(val);
 
   poolInsert(nv);
index dbf4cccaedaa28e487abc4893448dd98c990e6fb..3be9faad0223a700eb0128d3db7b22e78219d48b 100644 (file)
@@ -18,6 +18,8 @@
 #include "expr/term_context.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 
 TCtxNode::TCtxNode(Node n, const TermContext* tctx)
@@ -52,7 +54,7 @@ Node TCtxNode::getNodeHash() const { return computeNodeHash(d_node, d_val); }
 Node TCtxNode::computeNodeHash(Node n, uint32_t val)
 {
   NodeManager* nm = NodeManager::currentNM();
-  return nm->mkNode(kind::SEXPR, n, nm->mkConst(Rational(val)));
+  return nm->mkNode(kind::SEXPR, n, nm->mkConst(CONST_RATIONAL, Rational(val)));
 }
 
 Node TCtxNode::decomposeNodeHash(Node h, uint32_t& val)
index 89d56a10847047edfddff69ca3387e59a9eb1d49..236eb534c7b0facf8634d73fe917cae1f60861b3 100644 (file)
@@ -34,7 +34,6 @@
 using namespace std;
 using namespace cvc5;
 using namespace cvc5::parser;
-using namespace cvc5::kind;
 
 namespace cvc5 {
 namespace parser {
index c8c005b3602634c13005948a5556735e4767ccbc..0fb44b4a9e268586c4113f22a89120a022916267 100644 (file)
@@ -26,7 +26,6 @@
 using namespace std;
 using namespace cvc5;
 using namespace cvc5::parser;
-using namespace cvc5::kind;
 
 namespace cvc5 {
 namespace parser {
index 83b1f5025dc98d2da33749081894e4b2a02e6cf6..570f1369afae6a9fc8784a2a54afb4bbc92b4ae1 100644 (file)
@@ -31,7 +31,6 @@
 #include "smt/command.h"
 
 using namespace std;
-using namespace cvc5::kind;
 
 namespace cvc5 {
 namespace parser {
index 6515ef90a70cf0e82aab715d934e4109cb6cd47f..33f3dd445f97cf15a6889e91c22ca9114f1c34c0 100644 (file)
@@ -43,6 +43,7 @@ namespace preprocessing {
 namespace passes {
 
 using namespace std;
+using namespace cvc5::kind;
 using namespace cvc5::theory;
 using namespace cvc5::theory::bv;
 
@@ -67,18 +68,18 @@ Node BVToInt::maxInt(uint64_t k)
 {
   Assert(k > 0);
   Rational max_value = intpow2(k) - 1;
-  return d_nm->mkConst<Rational>(max_value);
+  return d_nm->mkConst(CONST_RATIONAL, max_value);
 }
 
 Node BVToInt::pow2(uint64_t k)
 {
   Assert(k >= 0);
-  return d_nm->mkConst<Rational>(intpow2(k));
+  return d_nm->mkConst(CONST_RATIONAL, Rational(intpow2(k)));
 }
 
 Node BVToInt::modpow2(Node n, uint64_t exponent)
 {
-  Node p2 = d_nm->mkConst<Rational>(intpow2(exponent));
+  Node p2 = d_nm->mkConst(CONST_RATIONAL, Rational(intpow2(exponent)));
   return d_nm->mkNode(kind::INTS_MODULUS_TOTAL, n, p2);
 }
 
@@ -545,7 +546,7 @@ Node BVToInt::translateWithChildren(Node original,
           Rational max_of_amount = intpow2(amount) - 1;
           Rational mul = max_of_amount * intpow2(bvsize);
           Rational sum = mul + c;
-          returnNode = d_nm->mkConst(sum);
+          returnNode = d_nm->mkConst(CONST_RATIONAL, sum);
         }
       }
       else
@@ -558,7 +559,7 @@ Node BVToInt::translateWithChildren(Node original,
         else
         {
           Rational twoToKMinusOne(intpow2(bvsize - 1));
-          Node minSigned = d_nm->mkConst(twoToKMinusOne);
+          Node minSigned = d_nm->mkConst(CONST_RATIONAL, twoToKMinusOne);
           /* condition checks whether the msb is 1.
            * This holds when the integer value is smaller than
            * 100...0, which is 2^{bvsize-1}.
@@ -766,7 +767,7 @@ Node BVToInt::translateNoChildren(Node original)
       // Bit-vector constants are transformed into their integer value.
       BitVector constant(original.getConst<BitVector>());
       Integer c = constant.toInteger();
-      translation = d_nm->mkConst<Rational>(c);
+      translation = d_nm->mkConst(CONST_RATIONAL, Rational(c));
     }
     else
     {
@@ -935,8 +936,8 @@ BVToInt::BVToInt(PreprocessingPassContext* preprocContext)
       d_rangeAssertions(userContext())
 {
   d_nm = NodeManager::currentNM();
-  d_zero = d_nm->mkConst<Rational>(0);
-  d_one = d_nm->mkConst<Rational>(1);
+  d_zero = d_nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = d_nm->mkConst(CONST_RATIONAL, Rational(1));
 };
 
 PreprocessingPassResult BVToInt::applyInternal(
@@ -1002,10 +1003,12 @@ Node BVToInt::createShiftNode(vector<Node> children,
     {
       body = d_nm->mkNode(kind::INTS_DIVISION_TOTAL, x, pow2(i));
     }
-    ite = d_nm->mkNode(kind::ITE,
-                       d_nm->mkNode(kind::EQUAL, y, d_nm->mkConst<Rational>(i)),
-                       body,
-                       ite);
+    ite = d_nm->mkNode(
+        kind::ITE,
+        d_nm->mkNode(
+            kind::EQUAL, y, d_nm->mkConst(CONST_RATIONAL, Rational(i))),
+        body,
+        ite);
   }
   return ite;
 }
index 59f0462625eb0c01afb6755fa28bc223c3c69ce6..66646b76697ad9c5a56c6d7a367bb1400a7e88e7 100644 (file)
 #include "theory/trust_substitutions.h"
 #include "util/rational.h"
 
+using namespace std;
+using namespace cvc5::kind;
+using namespace cvc5::theory;
+
 namespace cvc5 {
 namespace preprocessing {
 namespace passes {
 
-using namespace std;
-using namespace cvc5::theory;
-
 namespace {
 
 /**
@@ -212,7 +213,8 @@ PreprocessingPassResult MipLibTrick::applyInternal(
 
   NodeManager* nm = NodeManager::currentNM();
   SkolemManager* sm = nm->getSkolemManager();
-  Node zero = nm->mkConst(Rational(0)), one = nm->mkConst(Rational(1));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0)),
+       one = nm->mkConst(CONST_RATIONAL, Rational(1));
   Node trueNode = nm->mkConst(true);
 
   unordered_map<TNode, Node> intVars;
@@ -571,15 +573,17 @@ PreprocessingPassResult MipLibTrick::applyInternal(
             NodeBuilder sumb(kind::PLUS);
             for (size_t jj = 0; jj < pos.getNumChildren(); ++jj)
             {
-              sumb << nm->mkNode(
-                  kind::MULT, nm->mkConst(coef[pos_var][jj]), newVars[jj]);
+              sumb << nm->mkNode(kind::MULT,
+                                 nm->mkConst(CONST_RATIONAL, coef[pos_var][jj]),
+                                 newVars[jj]);
             }
             sum = sumb;
           }
           else
           {
-            sum = nm->mkNode(
-                kind::MULT, nm->mkConst(coef[pos_var][0]), newVars[0]);
+            sum = nm->mkNode(kind::MULT,
+                             nm->mkConst(CONST_RATIONAL, coef[pos_var][0]),
+                             newVars[0]);
           }
           Debug("miplib") << "vars[] " << var << endl
                           << "    eq " << rewrite(sum) << endl;
index 9e2170ffd18b323117f2c06ba8f4732801c2bf14..5c453980816c36b8466fc5cf3ea5f960283cc3b3 100644 (file)
@@ -27,6 +27,7 @@
 #include "theory/theory_model.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
 using namespace cvc5::theory;
 
 namespace cvc5 {
@@ -78,6 +79,7 @@ Node RealToInt::realToIntInternal(TNode n, NodeMap& cache, std::vector<Node>& va
               {
                 Assert(c.isConst());
                 coeffs.push_back(NodeManager::currentNM()->mkConst(
+                    CONST_RATIONAL,
                     Rational(c.getConst<Rational>().getDenominator())));
               }
             }
@@ -97,7 +99,8 @@ Node RealToInt::realToIntInternal(TNode n, NodeMap& cache, std::vector<Node>& va
               Node s;
               if (c.isNull())
               {
-                c = cc.isNull() ? NodeManager::currentNM()->mkConst(Rational(1))
+                c = cc.isNull() ? NodeManager::currentNM()->mkConst(
+                        CONST_RATIONAL, Rational(1))
                                 : cc;
               }
               else
@@ -131,14 +134,15 @@ Node RealToInt::realToIntInternal(TNode n, NodeMap& cache, std::vector<Node>& va
             }
             Node sumt =
                 sum.empty()
-                    ? NodeManager::currentNM()->mkConst(Rational(0))
+                    ? NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                                        Rational(0))
                     : (sum.size() == 1
                            ? sum[0]
                            : NodeManager::currentNM()->mkNode(kind::PLUS, sum));
             ret = NodeManager::currentNM()->mkNode(
                 ret_lit.getKind(),
                 sumt,
-                NodeManager::currentNM()->mkConst(Rational(0)));
+                NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0)));
             if (!ret_pol)
             {
               ret = ret.negate();
index db6cb8b7256f4551387b30e87a62393c70b9293d..ae05d6b871fa1cf1094481bd0feb9e3725300ae1 100644 (file)
 #include "util/bitvector.h"
 #include "util/rational.h"
 
+using namespace std;
+using namespace cvc5::kind;
+using namespace cvc5::theory;
+
 namespace cvc5 {
 namespace preprocessing {
 namespace passes {
 
-using namespace std;
-using namespace cvc5::theory;
-
 UnconstrainedSimplifier::UnconstrainedSimplifier(
     PreprocessingPassContext* preprocContext)
     : PreprocessingPass(preprocContext, "unconstrained-simplifier"),
@@ -514,9 +515,9 @@ void UnconstrainedSimplifier::processUnconstrained()
             if (current.getType().isInteger())
             {
               // div/mult by 1 should have been simplified
-              Assert(other != nm->mkConst<Rational>(1));
+              Assert(other != nm->mkConst(CONST_RATIONAL, Rational(1)));
               // div by -1 should have been simplified
-              if (other != nm->mkConst<Rational>(-1))
+              if (other != nm->mkConst(CONST_RATIONAL, Rational(-1)))
               {
                 break;
               }
@@ -529,7 +530,8 @@ void UnconstrainedSimplifier::processUnconstrained()
             else
             {
               // TODO(#2377): could build ITE here
-              Node test = other.eqNode(nm->mkConst<Rational>(0));
+              Node test =
+                  other.eqNode(nm->mkConst(CONST_RATIONAL, Rational(0)));
               if (rewrite(test) != nm->mkConst<bool>(false))
               {
                 break;
index b94072ecbeaa291830d725d149a3823021e8966c..994fe83d2d73cb612f562e56a7ad3ea68595f410 100644 (file)
@@ -22,6 +22,8 @@
 #include "theory/builtin/proof_checker.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 
 namespace proof {
@@ -456,7 +458,7 @@ bool AletheProofPostprocessCallback::update(Node res,
                                    res,
                                    nm->mkNode(kind::SEXPR, d_cl, res),
                                    children,
-                                   {nm->mkConst(Rational(1))},
+                                   {nm->mkConst(CONST_RATIONAL, Rational(1))},
                                    *cdp);
             }
             default:
@@ -1442,7 +1444,7 @@ bool AletheProofPostprocessCallback::update(Node res,
     {
       Node vp1 = nm->mkNode(kind::SEXPR, d_cl, children[0], res);
       std::vector<Node> new_children = {vp1, children[0]};
-      new_args.push_back(nm->mkConst<Rational>(1));
+      new_args.push_back(nm->mkConst<Rational>(CONST_RATIONAL, 1));
       return addAletheStep(AletheRule::LA_GENERIC, vp1, vp1, {}, new_args, *cdp)
              && addAletheStep(AletheRule::RESOLUTION,
                               res,
@@ -1465,7 +1467,7 @@ bool AletheProofPostprocessCallback::update(Node res,
     {
       Node vp1 = nm->mkNode(kind::SEXPR, d_cl, children[0], res);
       std::vector<Node> new_children = {vp1, children[0]};
-      new_args.push_back(nm->mkConst<Rational>(1));
+      new_args.push_back(nm->mkConst<Rational>(CONST_RATIONAL, 1));
       return addAletheStep(AletheRule::LA_GENERIC, vp1, vp1, {}, new_args, *cdp)
              && addAletheStep(AletheRule::RESOLUTION,
                               res,
@@ -1502,8 +1504,8 @@ bool AletheProofPostprocessCallback::addAletheStep(
   }
 
   std::vector<Node> new_args = std::vector<Node>();
-  new_args.push_back(
-      NodeManager::currentNM()->mkConst<Rational>(static_cast<unsigned>(rule)));
+  new_args.push_back(NodeManager::currentNM()->mkConst(
+      CONST_RATIONAL, Rational(static_cast<unsigned>(rule))));
   new_args.push_back(res);
   new_args.push_back(sanitized_conclusion);
   new_args.insert(new_args.end(), args.begin(), args.end());
index 7ec0b2bd5e5261e290fc2a4295524274ba47e341..33529df398073befbee8ee206abbc37071e65d91 100644 (file)
@@ -89,7 +89,7 @@ Node LfscNodeConverter::postConvert(Node n)
     }
     // bound variable v is (bvar x T)
     TypeNode intType = nm->integerType();
-    Node x = nm->mkConst(Rational(getOrAssignIndexForVar(n)));
+    Node x = nm->mkConst(CONST_RATIONAL, Rational(getOrAssignIndexForVar(n)));
     Node tc = typeAsNode(convertType(tn));
     TypeNode ftype = nm->mkFunctionType({intType, d_sortType}, tn);
     Node bvarOp = getSymbolInternal(k, ftype, "bvar");
@@ -136,7 +136,8 @@ Node LfscNodeConverter::postConvert(Node n)
     TypeNode intType = nm->integerType();
     TypeNode varType = nm->mkFunctionType({intType, d_sortType}, tn);
     Node var = mkInternalSymbol("var", varType);
-    Node index = nm->mkConst(Rational(getOrAssignIndexForVar(n)));
+    Node index =
+        nm->mkConst(CONST_RATIONAL, Rational(getOrAssignIndexForVar(n)));
     Node tc = typeAsNode(convertType(tn));
     return nm->mkNode(APPLY_UF, var, index, tc);
   }
@@ -197,7 +198,7 @@ Node LfscNodeConverter::postConvert(Node n)
       {
         // use LFSC syntax for mpz negation
         Node mpzn = getSymbolInternal(k, nm->mkFunctionType(tn, tn), "~");
-        arg = nm->mkNode(APPLY_UF, mpzn, nm->mkConst(r.abs()));
+        arg = nm->mkNode(APPLY_UF, mpzn, nm->mkConst(CONST_RATIONAL, r.abs()));
       }
       else
       {
@@ -343,8 +344,8 @@ Node LfscNodeConverter::postConvert(Node n)
     Node rop = getSymbolInternal(
         k, relType, printer::smt2::Smt2Printer::smtKindString(k));
     RegExpLoop op = n.getOperator().getConst<RegExpLoop>();
-    Node n1 = nm->mkConst(Rational(op.d_loopMinOcc));
-    Node n2 = nm->mkConst(Rational(op.d_loopMaxOcc));
+    Node n1 = nm->mkConst(CONST_RATIONAL, Rational(op.d_loopMinOcc));
+    Node n2 = nm->mkConst(CONST_RATIONAL, Rational(op.d_loopMaxOcc));
     return nm->mkNode(APPLY_UF, nm->mkNode(APPLY_UF, rop, n1, n2), n[0]);
   }
   else if (k == MATCH)
@@ -484,14 +485,16 @@ TypeNode LfscNodeConverter::postConvertType(TypeNode tn)
   else if (k == BITVECTOR_TYPE)
   {
     tnn = d_typeKindToNodeCons[k];
-    Node w = nm->mkConst(Rational(tn.getBitVectorSize()));
+    Node w = nm->mkConst(CONST_RATIONAL, Rational(tn.getBitVectorSize()));
     tnn = nm->mkNode(APPLY_UF, tnn, w);
   }
   else if (k == FLOATINGPOINT_TYPE)
   {
     tnn = d_typeKindToNodeCons[k];
-    Node e = nm->mkConst(Rational(tn.getFloatingPointExponentSize()));
-    Node s = nm->mkConst(Rational(tn.getFloatingPointSignificandSize()));
+    Node e = nm->mkConst(CONST_RATIONAL,
+                         Rational(tn.getFloatingPointExponentSize()));
+    Node s = nm->mkConst(CONST_RATIONAL,
+                         Rational(tn.getFloatingPointSignificandSize()));
     tnn = nm->mkNode(APPLY_UF, tnn, e, s);
   }
   else if (tn.getNumChildren() == 0)
@@ -719,7 +722,8 @@ void LfscNodeConverter::getCharVectorInternal(Node c, std::vector<Node>& chars)
   Node aconstf = getSymbolInternal(CONST_STRING, tnc, "char");
   for (unsigned i = 0, size = vec.size(); i < size; i++)
   {
-    Node cc = nm->mkNode(APPLY_UF, aconstf, nm->mkConst(Rational(vec[i])));
+    Node cc = nm->mkNode(
+        APPLY_UF, aconstf, nm->mkConst(CONST_RATIONAL, Rational(vec[i])));
     chars.push_back(cc);
   }
 }
@@ -742,36 +746,42 @@ std::vector<Node> LfscNodeConverter::getOperatorIndices(Kind k, Node n)
     case BITVECTOR_EXTRACT:
     {
       BitVectorExtract p = n.getConst<BitVectorExtract>();
-      indices.push_back(nm->mkConst(Rational(p.d_high)));
-      indices.push_back(nm->mkConst(Rational(p.d_low)));
+      indices.push_back(nm->mkConst(CONST_RATIONAL, Rational(p.d_high)));
+      indices.push_back(nm->mkConst(CONST_RATIONAL, Rational(p.d_low)));
       break;
     }
     case BITVECTOR_REPEAT:
       indices.push_back(
-          nm->mkConst(Rational(n.getConst<BitVectorRepeat>().d_repeatAmount)));
+          nm->mkConst(CONST_RATIONAL,
+                      Rational(n.getConst<BitVectorRepeat>().d_repeatAmount)));
       break;
     case BITVECTOR_ZERO_EXTEND:
       indices.push_back(nm->mkConst(
+          CONST_RATIONAL,
           Rational(n.getConst<BitVectorZeroExtend>().d_zeroExtendAmount)));
       break;
     case BITVECTOR_SIGN_EXTEND:
       indices.push_back(nm->mkConst(
+          CONST_RATIONAL,
           Rational(n.getConst<BitVectorSignExtend>().d_signExtendAmount)));
       break;
     case BITVECTOR_ROTATE_LEFT:
       indices.push_back(nm->mkConst(
+          CONST_RATIONAL,
           Rational(n.getConst<BitVectorRotateLeft>().d_rotateLeftAmount)));
       break;
     case BITVECTOR_ROTATE_RIGHT:
       indices.push_back(nm->mkConst(
+          CONST_RATIONAL,
           Rational(n.getConst<BitVectorRotateRight>().d_rotateRightAmount)));
       break;
     case INT_TO_BITVECTOR:
-      indices.push_back(
-          nm->mkConst(Rational(n.getConst<IntToBitVector>().d_size)));
+      indices.push_back(nm->mkConst(
+          CONST_RATIONAL, Rational(n.getConst<IntToBitVector>().d_size)));
       break;
     case IAND:
-      indices.push_back(nm->mkConst(Rational(n.getConst<IntAnd>().d_size)));
+      indices.push_back(
+          nm->mkConst(CONST_RATIONAL, Rational(n.getConst<IntAnd>().d_size)));
       break;
     case APPLY_TESTER:
     {
@@ -1012,7 +1022,7 @@ Node LfscNodeConverter::getOperatorOfClosure(Node q, bool macroApply)
 Node LfscNodeConverter::getOperatorOfBoundVar(Node cop, Node v)
 {
   NodeManager* nm = NodeManager::currentNM();
-  Node x = nm->mkConst(Rational(getOrAssignIndexForVar(v)));
+  Node x = nm->mkConst(CONST_RATIONAL, Rational(getOrAssignIndexForVar(v)));
   Node tc = typeAsNode(convertType(v.getType()));
   return nm->mkNode(APPLY_UF, cop, x, tc);
 }
index d8bd8f548b6ffc93bedce0cd70e2480974e08252..06bedb8952b01dae8be39b099a1244f0d6298002 100644 (file)
@@ -18,6 +18,8 @@
 #include "proof/proof_checker.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace proof {
 
@@ -66,7 +68,8 @@ LfscRule getLfscRule(Node n)
 
 Node mkLfscRuleNode(LfscRule r)
 {
-  return NodeManager::currentNM()->mkConst(Rational(static_cast<uint32_t>(r)));
+  return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                           Rational(static_cast<uint32_t>(r)));
 }
 
 bool LfscProofLetifyTraverseCallback::shouldTraverse(const ProofNode* pn)
index c5e8458cd7735d52c1e4282f90083bdbf2c92ac5..9567590a80553d536f0d968cab88717cc89b3309 100644 (file)
@@ -18,6 +18,8 @@
 #include "proof/proof_checker.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 
 const char* toString(MethodId id)
@@ -49,7 +51,8 @@ std::ostream& operator<<(std::ostream& out, MethodId id)
 
 Node mkMethodId(MethodId id)
 {
-  return NodeManager::currentNM()->mkConst(Rational(static_cast<uint32_t>(id)));
+  return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                           Rational(static_cast<uint32_t>(id)));
 }
 
 bool getMethodId(TNode n, MethodId& i)
index c178ccebf9855bbe61c4d660fd55978a86d4f198..5289d77ffd700e947e34099d260ddbf248936783 100644 (file)
@@ -74,7 +74,8 @@ Node ProofRuleChecker::mkKindNode(Kind k)
     // UNDEFINED_KIND is negative, hence return null to avoid cast
     return Node::null();
   }
-  return NodeManager::currentNM()->mkConst(Rational(static_cast<uint32_t>(k)));
+  return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                           Rational(static_cast<uint32_t>(k)));
 }
 
 ProofCheckerStatistics::ProofCheckerStatistics()
index d09854bcebd50c256e658bef83fedebc140fb6c5..61a1a298c0305b0318e289dd024cde5cd5b8d689 100644 (file)
@@ -20,6 +20,8 @@
 #include "theory/builtin/proof_checker.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace prop {
 
@@ -171,7 +173,7 @@ void ProofCnfStream::convertAndAssertAnd(TNode node, bool negated)
     for (unsigned i = 0, size = node.getNumChildren(); i < size; ++i)
     {
       // Create a proof step for each n_i
-      Node iNode = nm->mkConst<Rational>(i);
+      Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
       d_proof.addStep(node[i], PfRule::AND_ELIM, {node}, {iNode});
       Trace("cnf") << "ProofCnfStream::convertAndAssertAnd: AND_ELIM " << i
                    << " added norm " << node[i] << "\n";
@@ -230,7 +232,7 @@ void ProofCnfStream::convertAndAssertOr(TNode node, bool negated)
     for (unsigned i = 0, size = node.getNumChildren(); i < size; ++i)
     {
       // Create a proof step for each (not n_i)
-      Node iNode = nm->mkConst<Rational>(i);
+      Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
       d_proof.addStep(
           node[i].notNode(), PfRule::NOT_OR_ELIM, {node.notNode()}, {iNode});
       Trace("cnf") << "ProofCnfStream::convertAndAssertOr: NOT_OR_ELIM " << i
@@ -685,7 +687,7 @@ SatLiteral ProofCnfStream::handleAnd(TNode node)
     if (added)
     {
       Node clauseNode = nm->mkNode(kind::OR, node.notNode(), node[i]);
-      Node iNode = nm->mkConst<Rational>(i);
+      Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
       d_proof.addStep(clauseNode, PfRule::CNF_AND_POS, {}, {node, iNode});
       Trace("cnf") << "ProofCnfStream::handleAnd: CNF_AND_POS " << i
                    << " added " << clauseNode << "\n";
@@ -745,7 +747,7 @@ SatLiteral ProofCnfStream::handleOr(TNode node)
     if (added)
     {
       Node clauseNode = nm->mkNode(kind::OR, node, node[i].notNode());
-      Node iNode = nm->mkConst<Rational>(i);
+      Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
       d_proof.addStep(clauseNode, PfRule::CNF_OR_NEG, {}, {node, iNode});
       Trace("cnf") << "ProofCnfStream::handleOr: CNF_OR_NEG " << i << " added "
                    << clauseNode << "\n";
index 74809223801ba943f85bd01aefb8e7082ea952b4..31797ba5e88a45d9bf4645a9b11b65176978eb66 100644 (file)
@@ -69,7 +69,7 @@ void DifficultyPostprocessCallback::getDifficultyMap(
   NodeManager* nm = NodeManager::currentNM();
   for (const std::pair<const Node, uint64_t>& d : d_accMap)
   {
-    dmap[d.first] = nm->mkConst(Rational(d.second));
+    dmap[d.first] = nm->mkConst(CONST_RATIONAL, Rational(d.second));
   }
 }
 
index 56a7598662e83904210ed46e49a8cbe5ccb9f13e..a292fec8f588f4169ea468dd9d4d1d755517c5f8 100644 (file)
@@ -855,7 +855,7 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
         for (size_t j = 0, nchildi = children[i].getNumChildren(); j < nchildi;
              j++)
         {
-          Node nodej = nm->mkConst(Rational(j));
+          Node nodej = nm->mkConst(CONST_RATIONAL, Rational(j));
           cdp->addStep(
               children[i][j], PfRule::AND_ELIM, {children[i]}, {nodej});
         }
@@ -1086,8 +1086,8 @@ Node ProofPostprocessCallback::expandMacros(PfRule id,
       TNode child = children[i];
       TNode scalar = args[i];
       bool isPos = scalar.getConst<Rational>() > 0;
-      Node scalarCmp =
-          nm->mkNode(isPos ? GT : LT, scalar, nm->mkConst(Rational(0)));
+      Node scalarCmp = nm->mkNode(
+          isPos ? GT : LT, scalar, nm->mkConst(CONST_RATIONAL, Rational(0)));
       // (= scalarCmp true)
       Node scalarCmpOrTrue = steps.tryStep(PfRule::EVALUATE, {}, {scalarCmp});
       Assert(!scalarCmpOrTrue.isNull());
index ff9f7ef0376b9cd771dc9e50c8f57c8626c67aeb..6d6259d731791e3bdf1483f1dc816afb57946a7c 100644 (file)
@@ -105,10 +105,8 @@ Node NaryBuilder::zeroArity(Kind k){
     return nm->mkConst(true);
   case OR:
     return nm->mkConst(false);
-  case PLUS:
-    return nm->mkConst(Rational(0));
-  case MULT:
-    return nm->mkConst(Rational(1));
+  case PLUS: return nm->mkConst(CONST_RATIONAL, Rational(0));
+  case MULT: return nm->mkConst(CONST_RATIONAL, Rational(1));
   default:
     return Node::null();
   }
index 3ca6492117551e9d98f7318dce1836f57495f1da..ac3780b367cd7f9cac44673f7b6fc81d77d9bded 100644 (file)
@@ -103,16 +103,20 @@ bool ArithMSum::getMonomialSumLit(Node lit, std::map<Node, Node>& msum)
             std::map<Node, Node>::iterator it2 = msum.find(it->first);
             if (it2 != msum.end())
             {
-              Node r = nm->mkNode(
-                  MINUS,
-                  it2->second.isNull() ? nm->mkConst(Rational(1)) : it2->second,
-                  it->second.isNull() ? nm->mkConst(Rational(1)) : it->second);
+              Node r = nm->mkNode(MINUS,
+                                  it2->second.isNull()
+                                      ? nm->mkConst(CONST_RATIONAL, Rational(1))
+                                      : it2->second,
+                                  it->second.isNull()
+                                      ? nm->mkConst(CONST_RATIONAL, Rational(1))
+                                      : it->second);
               msum[it->first] = Rewriter::rewrite(r);
             }
             else
             {
-              msum[it->first] = it->second.isNull() ? nm->mkConst(Rational(-1))
-                                                    : negate(it->second);
+              msum[it->first] = it->second.isNull()
+                                    ? nm->mkConst(CONST_RATIONAL, Rational(-1))
+                                    : negate(it->second);
             }
           }
           return true;
@@ -142,9 +146,10 @@ Node ArithMSum::mkNode(const std::map<Node, Node>& msum)
     }
     children.push_back(m);
   }
-  return children.size() > 1
-             ? nm->mkNode(PLUS, children)
-             : (children.size() == 1 ? children[0] : nm->mkConst(Rational(0)));
+  return children.size() > 1 ? nm->mkNode(PLUS, children)
+                             : (children.size() == 1
+                                    ? children[0]
+                                    : nm->mkConst(CONST_RATIONAL, Rational(0)));
 }
 
 int ArithMSum::isolate(
@@ -179,21 +184,22 @@ int ArithMSum::isolate(
       }
       val = children.size() > 1
                 ? NodeManager::currentNM()->mkNode(PLUS, children)
-                : (children.size() == 1
-                       ? children[0]
-                       : NodeManager::currentNM()->mkConst(Rational(0)));
+                : (children.size() == 1 ? children[0]
+                                        : NodeManager::currentNM()->mkConst(
+                                            CONST_RATIONAL, Rational(0)));
       if (!r.isOne() && !r.isNegativeOne())
       {
         if (v.getType().isInteger())
         {
-          veq_c = NodeManager::currentNM()->mkConst(r.abs());
+          veq_c = NodeManager::currentNM()->mkConst(CONST_RATIONAL, r.abs());
         }
         else
         {
           val = NodeManager::currentNM()->mkNode(
               MULT,
               val,
-              NodeManager::currentNM()->mkConst(Rational(1) / r.abs()));
+              NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                                Rational(1) / r.abs()));
         }
       }
       val = r.sgn() == 1 ? negate(val) : Rewriter::rewrite(val);
@@ -288,7 +294,7 @@ bool ArithMSum::decompose(Node n, Node v, Node& coeff, Node& rem)
 Node ArithMSum::negate(Node t)
 {
   Node tt = NodeManager::currentNM()->mkNode(
-      MULT, NodeManager::currentNM()->mkConst(Rational(-1)), t);
+      MULT, NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1)), t);
   tt = Rewriter::rewrite(tt);
   return tt;
 }
@@ -296,7 +302,7 @@ Node ArithMSum::negate(Node t)
 Node ArithMSum::offset(Node t, int i)
 {
   Node tt = NodeManager::currentNM()->mkNode(
-      PLUS, NodeManager::currentNM()->mkConst(Rational(i)), t);
+      PLUS, NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(i)), t);
   tt = Rewriter::rewrite(tt);
   return tt;
 }
index 5baaaf317af8ef86dbcf2d4b73e8e8a5e074ff1b..19b5c1204094bcdf899c61ac5332d06c51944b26 100644 (file)
@@ -33,6 +33,8 @@
 #include "util/divisible.h"
 #include "util/iand.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -138,8 +140,9 @@ RewriteResponse ArithRewriter::preRewriteTerm(TNode t){
         if(rat >= 0) {
           return RewriteResponse(REWRITE_DONE, t[0]);
         } else {
-          return RewriteResponse(REWRITE_DONE,
-                                 NodeManager::currentNM()->mkConst(-rat));
+          return RewriteResponse(
+              REWRITE_DONE,
+              NodeManager::currentNM()->mkConst(CONST_RATIONAL, -rat));
         }
       }
       return RewriteResponse(REWRITE_DONE, t);
@@ -202,8 +205,9 @@ RewriteResponse ArithRewriter::postRewriteTerm(TNode t){
         if(rat >= 0) {
           return RewriteResponse(REWRITE_DONE, t[0]);
         } else {
-          return RewriteResponse(REWRITE_DONE,
-                                 NodeManager::currentNM()->mkConst(-rat));
+          return RewriteResponse(
+              REWRITE_DONE,
+              NodeManager::currentNM()->mkConst(CONST_RATIONAL, -rat));
         }
       }
       return RewriteResponse(REWRITE_DONE, t);
@@ -211,7 +215,10 @@ RewriteResponse ArithRewriter::postRewriteTerm(TNode t){
     case kind::CAST_TO_REAL: return RewriteResponse(REWRITE_DONE, t[0]);
     case kind::TO_INTEGER:
       if(t[0].isConst()) {
-        return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(Rational(t[0].getConst<Rational>().floor())));
+        return RewriteResponse(
+            REWRITE_DONE,
+            NodeManager::currentNM()->mkConst(
+                CONST_RATIONAL, Rational(t[0].getConst<Rational>().floor())));
       }
       if(t[0].getType().isInteger()) {
         return RewriteResponse(REWRITE_DONE, t[0]);
@@ -403,10 +410,11 @@ RewriteResponse ArithRewriter::postRewritePow2(TNode t)
     {
       return RewriteResponse(
           REWRITE_DONE,
-          nm->mkConst<Rational>(Rational(Integer(0), Integer(1))));
+          nm->mkConst(CONST_RATIONAL, Rational(Integer(0), Integer(1))));
     }
     unsigned long k = i.getUnsignedLong();
-    Node ret = nm->mkConst<Rational>(Rational(Integer(2).pow(k), Integer(1)));
+    Node ret =
+        nm->mkConst(CONST_RATIONAL, Rational(Integer(2).pow(k), Integer(1)));
     return RewriteResponse(REWRITE_DONE, ret);
   }
   return RewriteResponse(REWRITE_DONE, t);
@@ -464,7 +472,7 @@ RewriteResponse ArithRewriter::postRewriteTranscendental(TNode t) {
   switch( t.getKind() ){
   case kind::EXPONENTIAL: {
     if(t[0].getKind() == kind::CONST_RATIONAL){
-      Node one = nm->mkConst(Rational(1));
+      Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
       if(t[0].getConst<Rational>().sgn()>=0 && t[0].getType().isInteger() && t[0]!=one){
         return RewriteResponse(
             REWRITE_AGAIN,
@@ -491,12 +499,14 @@ RewriteResponse ArithRewriter::postRewriteTranscendental(TNode t) {
     if(t[0].getKind() == kind::CONST_RATIONAL){
       const Rational& rat = t[0].getConst<Rational>();
       if(rat.sgn() == 0){
-        return RewriteResponse(REWRITE_DONE, nm->mkConst(Rational(0)));
+        return RewriteResponse(REWRITE_DONE,
+                               nm->mkConst(CONST_RATIONAL, Rational(0)));
       }
       else if (rat.sgn() == -1)
       {
-        Node ret =
-            nm->mkNode(kind::UMINUS, nm->mkNode(kind::SINE, nm->mkConst(-rat)));
+        Node ret = nm->mkNode(
+            kind::UMINUS,
+            nm->mkNode(kind::SINE, nm->mkConst(CONST_RATIONAL, -rat)));
         return RewriteResponse(REWRITE_AGAIN_FULL, ret);
       }
     }else{
@@ -612,7 +622,8 @@ RewriteResponse ArithRewriter::postRewriteTranscendental(TNode t) {
         nm->mkNode(kind::SINE,
                    nm->mkNode(kind::MINUS,
                               nm->mkNode(kind::MULT,
-                                         nm->mkConst(Rational(1) / Rational(2)),
+                                         nm->mkConst(CONST_RATIONAL,
+                                                     Rational(1) / Rational(2)),
                                          mkPi()),
                               t[0])));
   }
@@ -672,7 +683,17 @@ RewriteResponse ArithRewriter::postRewriteAtom(TNode atom){
     if(atom.getOperator().getConst<Divisible>().k.isOne()) {
       return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(true));
     }
-    return RewriteResponse(REWRITE_AGAIN, NodeManager::currentNM()->mkNode(kind::EQUAL, NodeManager::currentNM()->mkNode(kind::INTS_MODULUS_TOTAL, atom[0], NodeManager::currentNM()->mkConst(Rational(atom.getOperator().getConst<Divisible>().k))), NodeManager::currentNM()->mkConst(Rational(0))));
+    return RewriteResponse(
+        REWRITE_AGAIN,
+        NodeManager::currentNM()->mkNode(
+            kind::EQUAL,
+            NodeManager::currentNM()->mkNode(
+                kind::INTS_MODULUS_TOTAL,
+                atom[0],
+                NodeManager::currentNM()->mkConst(
+                    CONST_RATIONAL,
+                    Rational(atom.getOperator().getConst<Divisible>().k))),
+            NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0))));
   }
 
   // left |><| right
@@ -804,7 +825,7 @@ RewriteResponse ArithRewriter::rewriteIntsDivMod(TNode t, bool pre)
 {
   NodeManager* nm = NodeManager::currentNM();
   Kind k = t.getKind();
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   if (k == kind::INTS_MODULUS)
   {
     if (t[1].isConst() && !t[1].getConst<Rational>().isZero())
@@ -857,7 +878,8 @@ RewriteResponse ArithRewriter::rewriteIntsDivModTotal(TNode t, bool pre)
     // pull negation
     // (div x (- c)) ---> (- (div x c))
     // (mod x (- c)) ---> (mod x c)
-    Node nn = nm->mkNode(k, t[0], nm->mkConst(-t[1].getConst<Rational>()));
+    Node nn = nm->mkNode(
+        k, t[0], nm->mkConst(CONST_RATIONAL, -t[1].getConst<Rational>()));
     Node ret = (k == kind::INTS_DIVISION || k == kind::INTS_DIVISION_TOTAL)
                    ? nm->mkNode(kind::UMINUS, nn)
                    : nn;
index 5645542d0323cc86bf69f48f28054c366626b8bc..a9fd970796588a516a112f177058aeae16ed511b 100644 (file)
@@ -164,7 +164,7 @@ Node getApproximateConstant(Node c, bool isLower, unsigned prec)
         curr_r = Rational(curr - 1) / den;
       }
       curr_r = curr_r * pow_ten;
-      cret = nm->mkConst(csign == 1 ? curr_r : -curr_r);
+      cret = nm->mkConst(CONST_RATIONAL, csign == 1 ? curr_r : -curr_r);
     }
     else
     {
index 0d7f214d7ea2216cbe2cafc583b7160b91a15ba1..b926af2e08756ed5954a22ac590fc7a09f05f897 100644 (file)
@@ -44,7 +44,7 @@ typedef std::unordered_map<Node, ArithVar> NodeToArithVarMap;
 typedef DenseMap<Node> ArithVarToNodeMap;
 
 inline Node mkRationalNode(const Rational& q){
-  return NodeManager::currentNM()->mkConst<Rational>(q);
+  return NodeManager::currentNM()->mkConst(kind::CONST_RATIONAL, q);
 }
 
 inline Node mkBoolNode(bool b){
index 5824d8239137f3b89c63259c57c63840222f6d35..cd688660acee941eac973accdb647d53cf8c83c9 100644 (file)
@@ -18,6 +18,8 @@
 #include "theory/arith/normal_form.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -76,16 +78,20 @@ bool BoundInference::add(const Node& n, bool onlyVariables)
     auto* nm = NodeManager::currentNM();
     switch (relation)
     {
-      case Kind::LEQ: bound = nm->mkConst<Rational>(br.floor()); break;
+      case Kind::LEQ:
+        bound = nm->mkConst<Rational>(CONST_RATIONAL, br.floor());
+        break;
       case Kind::LT:
-        bound = nm->mkConst<Rational>((br - 1).ceiling());
+        bound = nm->mkConst<Rational>(CONST_RATIONAL, (br - 1).ceiling());
         relation = Kind::LEQ;
         break;
       case Kind::GT:
-        bound = nm->mkConst<Rational>((br + 1).floor());
+        bound = nm->mkConst<Rational>(CONST_RATIONAL, (br + 1).floor());
         relation = Kind::GEQ;
         break;
-      case Kind::GEQ: bound = nm->mkConst<Rational>(br.ceiling()); break;
+      case Kind::GEQ:
+        bound = nm->mkConst<Rational>(CONST_RATIONAL, br.ceiling());
+        break;
       default:;
     }
     Trace("bound-inf") << "Strengthened " << n << " to " << lhs << " "
index ae782eed25d86df097af4e755e14693144529e10..de68a498798784cf08a844f19f57d701e8bf6243 100644 (file)
@@ -32,6 +32,8 @@
 #include "theory/uf/equality_engine.h"
 #include "theory/uf/proof_equality_engine.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -329,11 +331,12 @@ void ArithCongruenceManager::watchedVariableCannotBeZero(ConstraintCP c){
       TNode isZero = d_watchedEqualities[s];
       const auto isZeroPf = d_pnm->mkAssume(isZero);
       const auto nm = NodeManager::currentNM();
-      const auto sumPf = d_pnm->mkNode(
-          PfRule::MACRO_ARITH_SCALE_SUM_UB,
-          {isZeroPf, pf},
-          // Trick for getting correct, opposing signs.
-          {nm->mkConst(Rational(-1 * cSign)), nm->mkConst(Rational(cSign))});
+      const auto sumPf =
+          d_pnm->mkNode(PfRule::MACRO_ARITH_SCALE_SUM_UB,
+                        {isZeroPf, pf},
+                        // Trick for getting correct, opposing signs.
+                        {nm->mkConst(CONST_RATIONAL, Rational(-1 * cSign)),
+                         nm->mkConst(CONST_RATIONAL, Rational(cSign))});
       const auto botPf = d_pnm->mkNode(
           PfRule::MACRO_SR_PRED_TRANSFORM, {sumPf}, {nm->mkConst(false)});
       std::vector<Node> assumption = {isZero};
index 2958b5f48227b834fe55dcec312bb18fda20a119..cffacdc39b4c23a3d41bfbf4c765bf68564a2178 100644 (file)
@@ -1122,10 +1122,11 @@ TrustNode Constraint::split()
     auto nGeqPf = d_database->d_pnm->mkAssume(geqNode.negate());
     auto ltPf = d_database->d_pnm->mkNode(
         PfRule::MACRO_SR_PRED_TRANSFORM, {nGeqPf}, {ltNode});
-    auto sumPf = d_database->d_pnm->mkNode(
-        PfRule::MACRO_ARITH_SCALE_SUM_UB,
-        {gtPf, ltPf},
-        {nm->mkConst<Rational>(-1), nm->mkConst<Rational>(1)});
+    auto sumPf =
+        d_database->d_pnm->mkNode(PfRule::MACRO_ARITH_SCALE_SUM_UB,
+                                  {gtPf, ltPf},
+                                  {nm->mkConst(CONST_RATIONAL, Rational(-1)),
+                                   nm->mkConst(CONST_RATIONAL, Rational(1))});
     auto botPf = d_database->d_pnm->mkNode(
         PfRule::MACRO_SR_PRED_TRANSFORM, {sumPf}, {nm->mkConst(false)});
     std::vector<Node> a = {leqNode.negate(), geqNode.negate()};
@@ -1808,7 +1809,7 @@ std::shared_ptr<ProofNode> Constraint::externalExplain(
           std::vector<Node> farkasCoeffs;
           for (Rational r : *getFarkasCoefficients())
           {
-            farkasCoeffs.push_back(nm->mkConst<Rational>(r));
+            farkasCoeffs.push_back(nm->mkConst(CONST_RATIONAL, Rational(r)));
           }
 
           // Apply the scaled-sum rule.
@@ -2088,7 +2089,8 @@ Node Constraint::getProofLiteral() const
     default: Unreachable() << d_type;
   }
   NodeManager* nm = NodeManager::currentNM();
-  Node constPart = nm->mkConst<Rational>(d_value.getNoninfinitesimalPart());
+  Node constPart =
+      nm->mkConst(CONST_RATIONAL, Rational(d_value.getNoninfinitesimalPart()));
   Node posLit = nm->mkNode(cmp, varPart, constPart);
   return neg ? posLit.negate() : posLit;
 }
@@ -2112,13 +2114,13 @@ void ConstraintDatabase::proveOr(std::vector<TrustNode>& out,
                                    {d_pnm->mkAssume(lb.negate())},
                                    {b->getNegation()->getProofLiteral()});
     int sndSign = negateSecond ? -1 : 1;
-    auto bot_pf =
-        d_pnm->mkNode(PfRule::MACRO_SR_PRED_TRANSFORM,
-                      {d_pnm->mkNode(PfRule::MACRO_ARITH_SCALE_SUM_UB,
-                                     {pf_neg_la, pf_neg_lb},
-                                     {nm->mkConst<Rational>(-1 * sndSign),
-                                      nm->mkConst<Rational>(sndSign)})},
-                      {nm->mkConst(false)});
+    auto bot_pf = d_pnm->mkNode(
+        PfRule::MACRO_SR_PRED_TRANSFORM,
+        {d_pnm->mkNode(PfRule::MACRO_ARITH_SCALE_SUM_UB,
+                       {pf_neg_la, pf_neg_lb},
+                       {nm->mkConst(CONST_RATIONAL, Rational(-1 * sndSign)),
+                        nm->mkConst(CONST_RATIONAL, Rational(sndSign))})},
+        {nm->mkConst(false)});
     std::vector<Node> as;
     std::transform(orN.begin(), orN.end(), std::back_inserter(as), [](Node n) {
       return n.negate();
index 4cbb8211d575b35c2d4ce259cb2387d675f49012..aae9bae620c8781024bf95ccf8679a24471f8d29 100644 (file)
@@ -19,6 +19,8 @@
 #include "theory/arith/infer_bounds.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -149,7 +151,7 @@ Node InferBoundsResult::getTerm() const { return d_term; }
 Node InferBoundsResult::getLiteral() const{
   const Rational& q = getValue().getNoninfinitesimalPart();
   NodeManager* nm = NodeManager::currentNM();
-  Node qnode = nm->mkConst(q);
+  Node qnode = nm->mkConst(CONST_RATIONAL, q);
 
   Kind k;
   if(d_upperBound){
index 0c93db90f2c9c5c253e3ba65a149259193c208ce..0f3e345ee4cc689e923d219dd5d883430f81fb55 100644 (file)
@@ -54,19 +54,19 @@ constant DIVISIBLE_OP \
 sort REAL_TYPE \
     Cardinality::REALS \
     well-founded \
-        "NodeManager::currentNM()->mkConst(Rational(0))" \
+        "NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0))" \
         "expr/node_manager.h" \
     "real type"
 sort INTEGER_TYPE \
     Cardinality::INTEGERS \
     well-founded \
-        "NodeManager::currentNM()->mkConst(Rational(0))" \
+        "NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0))" \
         "expr/node_manager.h" \
     "integer type"
 
 constant CONST_RATIONAL \
     class \
-    Rational \
+    Rational+ \
     ::cvc5::RationalHashFunction \
     "util/rational.h" \
     "a multiple-precision rational constant; payload is an instance of the cvc5::Rational class"
index 4a2709cf8335237d341de6279dee59ffb6546ec8..0c61c088a4e57e5c68f77cb3e755786d55dac2f4 100644 (file)
@@ -25,6 +25,8 @@
 #include "theory/arith/nl/nl_model.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace std {
 /** Generic streaming operator for std::vector. */
 template <typename T>
@@ -271,7 +273,7 @@ PolyVector requiredCoefficientsLazardModified(
 
   // construct phi := (and (= p_i 0)) with p_i the coefficients of p
   std::vector<Node> conditions;
-  auto zero = NodeManager::currentNM()->mkConst(Rational(0));
+  auto zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
   for (const auto& coeff : poly::coefficients(p))
   {
     conditions.emplace_back(NodeManager::currentNM()->mkNode(
index b56c2755ae257a1ae4af2d955e228bfff98da05b..fcc07cbf06bdd6245c6ad8eebe9c95681ed472b7 100644 (file)
@@ -21,6 +21,8 @@
 #include "theory/arith/nl/poly_conversion.h"
 #include "util/indexed_root_predicate.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -94,7 +96,7 @@ CADProofGenerator::CADProofGenerator(context::Context* ctx,
     : d_pnm(pnm), d_proofs(pnm, ctx), d_current(nullptr)
 {
   d_false = NodeManager::currentNM()->mkConst<bool>(false);
-  d_zero = NodeManager::currentNM()->mkConst<Rational>(0);
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 void CADProofGenerator::startNewProof()
index b196f9990b6d4f090b60e74165166188d6bad80c..172d09f31217f9db8a0806e15363a340bb283b50 100644 (file)
@@ -25,6 +25,8 @@
 #include "theory/arith/nl/nl_model.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -35,9 +37,9 @@ ExtState::ExtState(InferenceManager& im, NlModel& model, Env& env)
 {
   d_false = NodeManager::currentNM()->mkConst(false);
   d_true = NodeManager::currentNM()->mkConst(true);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
-  d_neg_one = NodeManager::currentNM()->mkConst(Rational(-1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+  d_neg_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1));
   if (d_env.isTheoryProofProducing())
   {
     d_proof.reset(new CDProofSet<CDProof>(
index e41639c58b817854e603c0ef5838f70c6136aa3c..06d6aeaab3501f777a1c86b945300301a1ff1572 100644 (file)
@@ -25,6 +25,8 @@
 #include "theory/rewriter.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -33,8 +35,8 @@ namespace nl {
 FactoringCheck::FactoringCheck(Env& env, ExtState* data)
     : EnvObj(env), d_data(data)
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
 }
 
 void FactoringCheck::check(const std::vector<Node>& asserts,
index c969fe0e788f5dd970893cfb4689ac98c3fda01e..83d0ff71fae6f02d14b14c60dc42a0a368c1dca4 100644 (file)
@@ -124,7 +124,7 @@ void MonomialIndex::addTerm(Node n,
 
 MonomialDb::MonomialDb()
 {
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
 }
 
 void MonomialDb::registerMonomial(Node n)
index 1f50b311283c2883a64f2c317e2da30dd652bc02..e97f8b7727cf38d6b71eb06ec1fe1267e5f81661 100644 (file)
@@ -25,6 +25,8 @@
 #include "theory/arith/nl/nl_model.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -361,11 +363,11 @@ void MonomialBoundsCheck::checkBounds(const std::vector<Node>& asserts,
                 proof->addStep(exp[1][0],
                                PfRule::AND_ELIM,
                                {exp[1]},
-                               {nm->mkConst(Rational(0))});
+                               {nm->mkConst(CONST_RATIONAL, Rational(0))});
                 proof->addStep(exp[1][1],
                                PfRule::AND_ELIM,
                                {exp[1]},
-                               {nm->mkConst(Rational(1))});
+                               {nm->mkConst(CONST_RATIONAL, Rational(1))});
                 Node lb = nm->mkNode(Kind::GEQ, simpleeq[0], simpleeq[1]);
                 Node rb = nm->mkNode(Kind::LEQ, simpleeq[0], simpleeq[1]);
                 if (rew->rewrite(lb) == rew->rewrite(exp[1][0]))
index 67679d7a63fd9716eccd12bf66b4dac8857fc646..7acee487da9a0f6b8ade0684e50340b00c2b0df5 100644 (file)
@@ -37,9 +37,9 @@ Node ExtProofRuleChecker::checkInternal(PfRule id,
                                         const std::vector<Node>& args)
 {
   NodeManager* nm = NodeManager::currentNM();
-  auto zero = nm->mkConst<Rational>(0);
-  auto one = nm->mkConst<Rational>(1);
-  auto mone = nm->mkConst<Rational>(-1);
+  auto zero = nm->mkConst<Rational>(CONST_RATIONAL, 0);
+  auto one = nm->mkConst<Rational>(CONST_RATIONAL, 1);
+  auto mone = nm->mkConst<Rational>(CONST_RATIONAL, -1);
   auto pi = nm->mkNullaryOperator(nm->realType(), Kind::PI);
   auto mpi = nm->mkNode(Kind::MULT, mone, pi);
   Trace("nl-ext-checker") << "Checking " << id << std::endl;
index ebdca33dda89d96596d02615e96b5269031dd8bd..fbf8caf6a62ebef92106b05e77ae7cfade0d0e62 100644 (file)
@@ -24,6 +24,8 @@
 #include "theory/rewriter.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -144,15 +146,16 @@ void TangentPlaneCheck::check(bool asWaitingLemmas)
               if (d_data->isProofEnabled())
               {
                 proof = d_data->getProof();
-                proof->addStep(tlem,
-                               PfRule::ARITH_MULT_TANGENT,
-                               {},
-                               {t,
-                                a,
-                                b,
-                                a_v,
-                                b_v,
-                                nm->mkConst(Rational(d == 0 ? -1 : 1))});
+                proof->addStep(
+                    tlem,
+                    PfRule::ARITH_MULT_TANGENT,
+                    {},
+                    {t,
+                     a,
+                     b,
+                     a_v,
+                     b_v,
+                     nm->mkConst(CONST_RATIONAL, Rational(d == 0 ? -1 : 1))});
               }
               d_data->d_im.addPendingLemma(tlem,
                                            InferenceId::ARITH_NL_TANGENT_PLANE,
index 02914f938eee89220b52ffcb422ac7edfd62a77e..f2a4aa2e3ef6170c4b5405281fbc07a7ffbf15f7 100644 (file)
@@ -27,7 +27,7 @@ namespace nl {
 
 NlExtTheoryCallback::NlExtTheoryCallback(eq::EqualityEngine* ee) : d_ee(ee)
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 bool NlExtTheoryCallback::getCurrentSubstitution(
index b773f6baf65d906308185f024a8aaf0476b5002f..5d486230760079a9981e9ad2f264d4487f049ba6 100644 (file)
@@ -47,9 +47,9 @@ IAndSolver::IAndSolver(Env& env,
   NodeManager* nm = NodeManager::currentNM();
   d_false = nm->mkConst(false);
   d_true = nm->mkConst(true);
-  d_zero = nm->mkConst(Rational(0));
-  d_one = nm->mkConst(Rational(1));
-  d_two = nm->mkConst(Rational(2));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
+  d_two = nm->mkConst(CONST_RATIONAL, Rational(2));
 }
 
 IAndSolver::~IAndSolver() {}
index 45881e1bb738c6e6a1ab61f4aa36f97744d0298a..50e03bfa5f42389d65086c0bf0083f43b69824f3 100644 (file)
@@ -22,6 +22,8 @@
 #include "theory/rewriter.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -36,7 +38,7 @@ Node pow2(uint64_t k)
 {
   Assert(k >= 0);
   NodeManager* nm = NodeManager::currentNM();
-  return nm->mkConst<Rational>(intpow2(k));
+  return nm->mkConst(CONST_RATIONAL, Rational(intpow2(k)));
 }
 
 bool oneBitAnd(bool a, bool b) { return (a && b); }
@@ -58,9 +60,9 @@ Node intExtract(Node x, uint64_t i, uint64_t size)
 IAndUtils::IAndUtils()
 {
   NodeManager* nm = NodeManager::currentNM();
-  d_zero = nm->mkConst(Rational(0));
-  d_one = nm->mkConst(Rational(1));
-  d_two = nm->mkConst(Rational(2));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
+  d_two = nm->mkConst(CONST_RATIONAL, Rational(2));
 }
 
 Node IAndUtils::createITEFromTable(
@@ -78,7 +80,8 @@ Node IAndUtils::createITEFromTable(
   Assert(table.size() == 1 + ((uint64_t)(num_of_values * num_of_values)));
   // start with the default, most common value.
   // this value is represented in the table by (-1, -1).
-  Node ite = nm->mkConst<Rational>(table.at(std::make_pair(-1, -1)));
+  Node ite =
+      nm->mkConst(CONST_RATIONAL, Rational(table.at(std::make_pair(-1, -1))));
   for (uint64_t i = 0; i < num_of_values; i++)
   {
     for (uint64_t j = 0; j < num_of_values; j++)
@@ -91,10 +94,13 @@ Node IAndUtils::createITEFromTable(
       // append the current value to the ite.
       ite = nm->mkNode(
           kind::ITE,
-          nm->mkNode(kind::AND,
-                     nm->mkNode(kind::EQUAL, x, nm->mkConst<Rational>(i)),
-                     nm->mkNode(kind::EQUAL, y, nm->mkConst<Rational>(j))),
-          nm->mkConst<Rational>(table.at(std::make_pair(i, j))),
+          nm->mkNode(
+              kind::AND,
+              nm->mkNode(
+                  kind::EQUAL, x, nm->mkConst(CONST_RATIONAL, Rational(i))),
+              nm->mkNode(
+                  kind::EQUAL, y, nm->mkConst(CONST_RATIONAL, Rational(j)))),
+          nm->mkConst(CONST_RATIONAL, Rational(table.at(std::make_pair(i, j)))),
           ite);
     }
   }
@@ -133,7 +139,7 @@ Node IAndUtils::createSumNode(Node x,
   // number of elements in the sum expression
   uint64_t sumSize = bvsize / granularity;
   // initialize the sum
-  Node sumNode = nm->mkConst<Rational>(0);
+  Node sumNode = nm->mkConst(CONST_RATIONAL, Rational(0));
   // compute the table for the current granularity if needed
   if (d_bvandTable.find(granularity) == d_bvandTable.end())
   {
@@ -260,7 +266,8 @@ Node IAndUtils::twoToK(unsigned k) const
 {
   // could be faster
   NodeManager* nm = NodeManager::currentNM();
-  Node ret = nm->mkNode(kind::POW, d_two, nm->mkConst(Rational(k)));
+  Node ret =
+      nm->mkNode(kind::POW, d_two, nm->mkConst(CONST_RATIONAL, Rational(k)));
   ret = Rewriter::rewrite(ret);
   return ret;
 }
index 77a3ea5305699db00934175dec2751c104453d23..8d06f41d0f3b8d5d844535530c93e09544037732 100644 (file)
@@ -36,9 +36,9 @@ NlModel::NlModel() : d_used_approx(false)
 {
   d_true = NodeManager::currentNM()->mkConst(true);
   d_false = NodeManager::currentNM()->mkConst(false);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
-  d_two = NodeManager::currentNM()->mkConst(Rational(2));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+  d_two = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(2));
 }
 
 NlModel::~NlModel() {}
@@ -538,7 +538,8 @@ bool NlModel::solveEqualitySimple(Node eq,
       Assert(false);
       return false;
     }
-    Node val = nm->mkConst(-c.getConst<Rational>() / b.getConst<Rational>());
+    Node val = nm->mkConst(CONST_RATIONAL,
+                           -c.getConst<Rational>() / b.getConst<Rational>());
     if (Trace.isOn("nl-ext-cm"))
     {
       Trace("nl-ext-cm") << "check-model-bound : exact : " << var << " = ";
@@ -1069,8 +1070,9 @@ void NlModel::getModelValueRepair(
       if (witnessToValue)
       {
         // witness is the midpoint
-        witness = nm->mkNode(
-            MULT, nm->mkConst(Rational(1, 2)), nm->mkNode(PLUS, l, u));
+        witness = nm->mkNode(MULT,
+                             nm->mkConst(CONST_RATIONAL, Rational(1, 2)),
+                             nm->mkNode(PLUS, l, u));
         witness = Rewriter::rewrite(witness);
         Trace("nl-model") << v << " witness is " << witness << std::endl;
       }
index 56bdd652af6fd2045d5b8073cc058bb2cf15cacb..e757410966ce913c66c6cf6fb31882149ed7ea30 100644 (file)
@@ -68,9 +68,9 @@ NonlinearExtension::NonlinearExtension(Env& env,
   d_extTheory.addFunctionKind(kind::IAND);
   d_extTheory.addFunctionKind(kind::POW2);
   d_true = NodeManager::currentNM()->mkConst(true);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
-  d_neg_one = NodeManager::currentNM()->mkConst(Rational(-1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+  d_neg_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1));
 
   if (d_env.isTheoryProofProducing())
   {
index 7fbe08b9f6e08c9fb7acccf6d221fbb614eaed92..ebe76e0180150c2508f743b8c1abccb24691c8b1 100644 (file)
@@ -22,6 +22,8 @@
 #include "theory/arith/bound_inference.h"
 #include "util/poly_util.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -70,13 +72,14 @@ cvc5::Node as_cvc_upolynomial(const poly::UPolynomial& p, const cvc5::Node& var)
 
   auto* nm = NodeManager::currentNM();
 
-  Node res = nm->mkConst(Rational(0));
-  Node monomial = nm->mkConst(Rational(1));
+  Node res = nm->mkConst(CONST_RATIONAL, Rational(0));
+  Node monomial = nm->mkConst(CONST_RATIONAL, Rational(1));
   for (std::size_t i = 0, n = coeffs.size(); i < n; ++i)
   {
     if (!is_zero(coeffs[i]))
     {
-      Node coeff = nm->mkConst(poly_utils::toRational(coeffs[i]));
+      Node coeff =
+          nm->mkConst(CONST_RATIONAL, poly_utils::toRational(coeffs[i]));
       Node term = nm->mkNode(Kind::MULT, coeff, monomial);
       res = nm->mkNode(Kind::PLUS, res, term);
     }
@@ -235,15 +238,15 @@ void collect_monomials(const lp_polynomial_context_t* ctx,
 {
   CollectMonomialData* d = static_cast<CollectMonomialData*>(data);
   // constant
-  Node term =
-      d->d_nm->mkConst<Rational>(poly_utils::toRational(poly::Integer(&m->a)));
+  Node term = d->d_nm->mkConst<Rational>(
+      CONST_RATIONAL, poly_utils::toRational(poly::Integer(&m->a)));
   for (std::size_t i = 0; i < m->n; ++i)
   {
     // variable exponent pair
     Node var = d->d_vm(m->p[i].x);
     if (m->p[i].d > 1)
     {
-      Node exp = d->d_nm->mkConst<Rational>(m->p[i].d);
+      Node exp = d->d_nm->mkConst<Rational>(CONST_RATIONAL, m->p[i].d);
       term = d->d_nm->mkNode(
           Kind::NONLINEAR_MULT, term, d->d_nm->mkNode(Kind::POW, var, exp));
     }
@@ -264,7 +267,7 @@ cvc5::Node as_cvc_polynomial(const poly::Polynomial& p, VariableMapper& vm)
 
   if (cmd.d_terms.empty())
   {
-    return cmd.d_nm->mkConst<Rational>(0);
+    return cmd.d_nm->mkConst<Rational>(CONST_RATIONAL, 0);
   }
   if (cmd.d_terms.size() == 1)
   {
@@ -371,23 +374,26 @@ Node ran_to_node(const poly::AlgebraicNumber& an, const Node& ran_variable)
   const poly::DyadicInterval& di = get_isolating_interval(an);
   if (is_point(di))
   {
-    return nm->mkConst(poly_utils::toRational(get_point(di)));
+    return nm->mkConst(CONST_RATIONAL, poly_utils::toRational(get_point(di)));
   }
   Assert(di.get_internal()->a_open && di.get_internal()->b_open)
       << "We assume an open interval here.";
 
   Node poly = as_cvc_upolynomial(get_defining_polynomial(an), ran_variable);
-  Node lower = nm->mkConst(poly_utils::toRational(get_lower(di)));
-  Node upper = nm->mkConst(poly_utils::toRational(get_upper(di)));
+  Node lower =
+      nm->mkConst(CONST_RATIONAL, poly_utils::toRational(get_lower(di)));
+  Node upper =
+      nm->mkConst(CONST_RATIONAL, poly_utils::toRational(get_upper(di)));
 
   // Construct witness:
-  return nm->mkNode(Kind::AND,
-                    // poly(var) == 0
-                    nm->mkNode(Kind::EQUAL, poly, nm->mkConst(Rational(0))),
-                    // lower_bound < var
-                    nm->mkNode(Kind::LT, lower, ran_variable),
-                    // var < upper_bound
-                    nm->mkNode(Kind::LT, ran_variable, upper));
+  return nm->mkNode(
+      Kind::AND,
+      // poly(var) == 0
+      nm->mkNode(Kind::EQUAL, poly, nm->mkConst(CONST_RATIONAL, Rational(0))),
+      // lower_bound < var
+      nm->mkNode(Kind::LT, lower, ran_variable),
+      // var < upper_bound
+      nm->mkNode(Kind::LT, ran_variable, upper));
 }
 
 Node value_to_node(const poly::Value& v, const Node& ran_variable)
@@ -403,18 +409,19 @@ Node value_to_node(const poly::Value& v, const Node& ran_variable)
   auto* nm = NodeManager::currentNM();
   if (is_dyadic_rational(v))
   {
-    return nm->mkConst(poly_utils::toRational(as_dyadic_rational(v)));
+    return nm->mkConst(CONST_RATIONAL,
+                       poly_utils::toRational(as_dyadic_rational(v)));
   }
   if (is_integer(v))
   {
-    return nm->mkConst(poly_utils::toRational(as_integer(v)));
+    return nm->mkConst(CONST_RATIONAL, poly_utils::toRational(as_integer(v)));
   }
   if (is_rational(v))
   {
-    return nm->mkConst(poly_utils::toRational(as_rational(v)));
+    return nm->mkConst(CONST_RATIONAL, poly_utils::toRational(as_rational(v)));
   }
   Assert(false) << "All cases should be covered.";
-  return nm->mkConst(Rational(0));
+  return nm->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 Node lower_bound_as_node(const Node& var,
@@ -425,16 +432,18 @@ Node lower_bound_as_node(const Node& var,
   auto* nm = NodeManager::currentNM();
   if (!poly::is_algebraic_number(lower))
   {
-    return nm->mkNode(open ? Kind::LEQ : Kind::LT,
-                      var,
-                      nm->mkConst(poly_utils::toRationalAbove(lower)));
+    return nm->mkNode(
+        open ? Kind::LEQ : Kind::LT,
+        var,
+        nm->mkConst(CONST_RATIONAL, poly_utils::toRationalAbove(lower)));
   }
   if (poly::represents_rational(lower))
   {
     return nm->mkNode(
         open ? Kind::LEQ : Kind::LT,
         var,
-        nm->mkConst(poly_utils::toRationalAbove(poly::get_rational(lower))));
+        nm->mkConst(CONST_RATIONAL,
+                    poly_utils::toRationalAbove(poly::get_rational(lower))));
   }
   if (!allowNonlinearLemma)
   {
@@ -469,10 +478,12 @@ Node lower_bound_as_node(const Node& var,
   }
   return nm->mkNode(
       Kind::OR,
-      nm->mkNode(Kind::LEQ, var, nm->mkConst(l)),
-      nm->mkNode(Kind::AND,
-                 nm->mkNode(Kind::LT, var, nm->mkConst(u)),
-                 nm->mkNode(relation, poly, nm->mkConst(Rational(0)))));
+      nm->mkNode(Kind::LEQ, var, nm->mkConst(CONST_RATIONAL, l)),
+      nm->mkNode(
+          Kind::AND,
+          nm->mkNode(Kind::LT, var, nm->mkConst(CONST_RATIONAL, u)),
+          nm->mkNode(
+              relation, poly, nm->mkConst(CONST_RATIONAL, Rational(0)))));
 }
 
 Node upper_bound_as_node(const Node& var,
@@ -483,16 +494,18 @@ Node upper_bound_as_node(const Node& var,
   auto* nm = NodeManager::currentNM();
   if (!poly::is_algebraic_number(upper))
   {
-    return nm->mkNode(open ? Kind::GEQ : Kind::GT,
-                      var,
-                      nm->mkConst(poly_utils::toRationalAbove(upper)));
+    return nm->mkNode(
+        open ? Kind::GEQ : Kind::GT,
+        var,
+        nm->mkConst(CONST_RATIONAL, poly_utils::toRationalAbove(upper)));
   }
   if (poly::represents_rational(upper))
   {
     return nm->mkNode(
         open ? Kind::GEQ : Kind::GT,
         var,
-        nm->mkConst(poly_utils::toRationalAbove(poly::get_rational(upper))));
+        nm->mkConst(CONST_RATIONAL,
+                    poly_utils::toRationalAbove(poly::get_rational(upper))));
   }
   if (!allowNonlinearLemma)
   {
@@ -527,10 +540,12 @@ Node upper_bound_as_node(const Node& var,
   }
   return nm->mkNode(
       Kind::OR,
-      nm->mkNode(Kind::GEQ, var, nm->mkConst(u)),
-      nm->mkNode(Kind::AND,
-                 nm->mkNode(Kind::GT, var, nm->mkConst(l)),
-                 nm->mkNode(relation, poly, nm->mkConst(Rational(0)))));
+      nm->mkNode(Kind::GEQ, var, nm->mkConst(CONST_RATIONAL, u)),
+      nm->mkNode(
+          Kind::AND,
+          nm->mkNode(Kind::GT, var, nm->mkConst(CONST_RATIONAL, l)),
+          nm->mkNode(
+              relation, poly, nm->mkConst(CONST_RATIONAL, Rational(0)))));
 }
 
 Node excluding_interval_to_lemma(const Node& variable,
@@ -552,10 +567,12 @@ Node excluding_interval_to_lemma(const Node& variable,
       if (poly::is_rational(alg))
       {
         Trace("nl-cad") << "Rational point interval: " << interval << std::endl;
-        return nm->mkNode(Kind::DISTINCT,
-                          variable,
-                          nm->mkConst(poly_utils::toRational(
-                              poly::to_rational_approximation(alg))));
+        return nm->mkNode(
+            Kind::DISTINCT,
+            variable,
+            nm->mkConst(
+                CONST_RATIONAL,
+                poly_utils::toRational(poly::to_rational_approximation(alg))));
       }
       Trace("nl-cad") << "Algebraic point interval: " << interval << std::endl;
       // p(x) != 0 or x <= lb or ub <= x
@@ -564,22 +581,26 @@ Node excluding_interval_to_lemma(const Node& variable,
         Node poly = as_cvc_upolynomial(get_defining_polynomial(alg), variable);
         return nm->mkNode(
             Kind::OR,
-            nm->mkNode(Kind::DISTINCT, poly, nm->mkConst(Rational(0))),
-            nm->mkNode(Kind::LT,
-                       variable,
-                       nm->mkConst(poly_utils::toRationalBelow(lv))),
-            nm->mkNode(Kind::GT,
-                       variable,
-                       nm->mkConst(poly_utils::toRationalAbove(lv))));
+            nm->mkNode(
+                Kind::DISTINCT, poly, nm->mkConst(CONST_RATIONAL, Rational(0))),
+            nm->mkNode(
+                Kind::LT,
+                variable,
+                nm->mkConst(CONST_RATIONAL, poly_utils::toRationalBelow(lv))),
+            nm->mkNode(
+                Kind::GT,
+                variable,
+                nm->mkConst(CONST_RATIONAL, poly_utils::toRationalAbove(lv))));
       }
       return Node();
     }
     else
     {
       Trace("nl-cad") << "Rational point interval: " << interval << std::endl;
-      return nm->mkNode(Kind::DISTINCT,
-                        variable,
-                        nm->mkConst(poly_utils::toRationalBelow(lv)));
+      return nm->mkNode(
+          Kind::DISTINCT,
+          variable,
+          nm->mkConst(CONST_RATIONAL, poly_utils::toRationalBelow(lv)));
     }
   }
   if (li)
index c91284be783b65ab440a95a89f214cd64d7dea12..e3a26397ee0a0737ff4041f040c00ad8ca4b2d20 100644 (file)
@@ -42,9 +42,9 @@ Pow2Solver::Pow2Solver(Env& env,
   NodeManager* nm = NodeManager::currentNM();
   d_false = nm->mkConst(false);
   d_true = nm->mkConst(true);
-  d_zero = nm->mkConst(Rational(0));
-  d_one = nm->mkConst(Rational(1));
-  d_two = nm->mkConst(Rational(2));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
+  d_two = nm->mkConst(CONST_RATIONAL, Rational(2));
 }
 
 Pow2Solver::~Pow2Solver() {}
index 17b5d259c50f57a8a05979bef9069b133aefba15..c4f7f6ca96b309260665bfa2b32c4ca2b9c3655b 100644 (file)
@@ -29,6 +29,8 @@
 #include "theory/arith/nl/transcendental/transcendental_state.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -228,7 +230,7 @@ void ExponentialSolver::doTangentLemma(TNode e,
     proof->addStep(lem,
                    PfRule::ARITH_TRANS_EXP_APPROX_BELOW,
                    {},
-                   {nm->mkConst<Rational>(d), e[0]});
+                   {nm->mkConst(CONST_RATIONAL, Rational(d)), e[0]});
   }
   d_data->d_im.addPendingLemma(
       lem, InferenceId::ARITH_NL_T_TANGENT, proof, true);
index ca62fe3949569282540e0813783a062f7beca237..ca1afb9f6e71b7e34cbd5fa6ab2adcbb9501c857 100644 (file)
@@ -83,9 +83,9 @@ Node TranscendentalProofRuleChecker::checkInternal(
     PfRule id, const std::vector<Node>& children, const std::vector<Node>& args)
 {
   NodeManager* nm = NodeManager::currentNM();
-  auto zero = nm->mkConst<Rational>(0);
-  auto one = nm->mkConst<Rational>(1);
-  auto mone = nm->mkConst<Rational>(-1);
+  auto zero = nm->mkConst<Rational>(CONST_RATIONAL, 0);
+  auto one = nm->mkConst<Rational>(CONST_RATIONAL, 1);
+  auto mone = nm->mkConst<Rational>(CONST_RATIONAL, -1);
   auto pi = nm->mkNullaryOperator(nm->realType(), Kind::PI);
   auto mpi = nm->mkNode(Kind::MULT, mone, pi);
   Trace("nl-trans-checker") << "Checking " << id << std::endl;
@@ -237,10 +237,13 @@ Node TranscendentalProofRuleChecker::checkInternal(
                 nm->mkNode(Kind::LEQ, x, pi),
             }),
             x.eqNode(y),
-            x.eqNode(nm->mkNode(
-                Kind::PLUS,
-                y,
-                nm->mkNode(Kind::MULT, nm->mkConst<Rational>(2), s, pi)))),
+            x.eqNode(
+                nm->mkNode(Kind::PLUS,
+                           y,
+                           nm->mkNode(Kind::MULT,
+                                      nm->mkConst<Rational>(CONST_RATIONAL, 2),
+                                      s,
+                                      pi)))),
         nm->mkNode(Kind::SINE, y).eqNode(nm->mkNode(Kind::SINE, x))});
   }
   else if (id == PfRule::ARITH_TRANS_SINE_SYMMETRY)
index ed37ee91c61b3ea4df8103563632edef95bb197e..b6b5c92c12fd692d72b6743fa6f86d150dd22f29 100644 (file)
@@ -30,6 +30,8 @@
 #include "theory/arith/nl/transcendental/transcendental_state.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -73,12 +75,13 @@ void SineSolver::doPhaseShift(TNode a, TNode new_a, TNode y)
       nm->mkNode(Kind::ITE,
                  mkValidPhase(a[0], d_data->d_pi),
                  a[0].eqNode(y),
-                 a[0].eqNode(nm->mkNode(Kind::PLUS,
-                                        y,
-                                        nm->mkNode(Kind::MULT,
-                                                   nm->mkConst(Rational(2)),
-                                                   shift,
-                                                   d_data->d_pi)))),
+                 a[0].eqNode(nm->mkNode(
+                     Kind::PLUS,
+                     y,
+                     nm->mkNode(Kind::MULT,
+                                nm->mkConst(CONST_RATIONAL, Rational(2)),
+                                shift,
+                                d_data->d_pi)))),
       new_a.eqNode(a));
   CDProof* proof = nullptr;
   if (d_data->isProofEnabled())
@@ -399,7 +402,7 @@ void SineSolver::doTangentLemma(
         proof->addStep(lem,
                        PfRule::ARITH_TRANS_SINE_APPROX_BELOW_NEG,
                        {},
-                       {nm->mkConst<Rational>(2 * d),
+                       {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
                         e[0],
                         c,
                         regionToLowerBound(region),
@@ -410,7 +413,7 @@ void SineSolver::doTangentLemma(
         proof->addStep(lem,
                        PfRule::ARITH_TRANS_SINE_APPROX_BELOW_NEG,
                        {},
-                       {nm->mkConst<Rational>(2 * d),
+                       {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
                         e[0],
                         c,
                         c,
@@ -424,7 +427,7 @@ void SineSolver::doTangentLemma(
         proof->addStep(lem,
                        PfRule::ARITH_TRANS_SINE_APPROX_ABOVE_POS,
                        {},
-                       {nm->mkConst<Rational>(2 * d),
+                       {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
                         e[0],
                         c,
                         regionToLowerBound(region),
@@ -435,7 +438,7 @@ void SineSolver::doTangentLemma(
         proof->addStep(lem,
                        PfRule::ARITH_TRANS_SINE_APPROX_ABOVE_POS,
                        {},
-                       {nm->mkConst<Rational>(2 * d),
+                       {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
                         e[0],
                         c,
                         c,
index d64eb8f1923e9ad0ac23ad22eff8a75497d7f263..2a231bc2b4c13cd9aab704632c3e9f20ac82a418 100644 (file)
@@ -19,6 +19,8 @@
 #include "theory/arith/nl/nl_model.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -48,7 +50,7 @@ std::pair<Node, Node> TaylorGenerator::getTaylor(Kind k, std::uint64_t n)
   // the current factorial `counter!`
   Integer factorial = 1;
   // the current variable power `x^counter`
-  Node varpow = nm->mkConst(Rational(1));
+  Node varpow = nm->mkConst(CONST_RATIONAL, Rational(1));
   std::vector<Node> sum;
   for (std::uint64_t counter = 1; counter <= n; ++counter)
   {
@@ -57,7 +59,9 @@ std::pair<Node, Node> TaylorGenerator::getTaylor(Kind k, std::uint64_t n)
       // Maclaurin series for exponential:
       //   \sum_{n=0}^\infty x^n / n!
       sum.push_back(
-          nm->mkNode(Kind::DIVISION, varpow, nm->mkConst<Rational>(factorial)));
+          nm->mkNode(Kind::DIVISION,
+                     varpow,
+                     nm->mkConst<Rational>(CONST_RATIONAL, factorial)));
     }
     else if (k == Kind::SINE)
     {
@@ -66,11 +70,12 @@ std::pair<Node, Node> TaylorGenerator::getTaylor(Kind k, std::uint64_t n)
       if (counter % 2 == 0)
       {
         int sign = (counter % 4 == 0 ? -1 : 1);
-        sum.push_back(nm->mkNode(Kind::MULT,
-                                 nm->mkNode(Kind::DIVISION,
-                                            nm->mkConst<Rational>(sign),
-                                            nm->mkConst<Rational>(factorial)),
-                                 varpow));
+        sum.push_back(nm->mkNode(
+            Kind::MULT,
+            nm->mkNode(Kind::DIVISION,
+                       nm->mkConst<Rational>(CONST_RATIONAL, sign),
+                       nm->mkConst<Rational>(CONST_RATIONAL, factorial)),
+            varpow));
       }
     }
     factorial *= counter;
@@ -80,7 +85,9 @@ std::pair<Node, Node> TaylorGenerator::getTaylor(Kind k, std::uint64_t n)
   Node taylor_sum =
       Rewriter::rewrite(sum.size() == 1 ? sum[0] : nm->mkNode(Kind::PLUS, sum));
   Node taylor_rem = Rewriter::rewrite(
-      nm->mkNode(Kind::DIVISION, varpow, nm->mkConst<Rational>(factorial)));
+      nm->mkNode(Kind::DIVISION,
+                 varpow,
+                 nm->mkConst<Rational>(CONST_RATIONAL, factorial)));
 
   auto res = std::make_pair(taylor_sum, taylor_rem);
 
@@ -113,10 +120,11 @@ void TaylorGenerator::getPolynomialApproximationBounds(
       pbounds.d_lower = taylor_sum;
       pbounds.d_upperNeg =
           Rewriter::rewrite(nm->mkNode(Kind::PLUS, taylor_sum, ru));
-      pbounds.d_upperPos = Rewriter::rewrite(
-          nm->mkNode(Kind::MULT,
-                     taylor_sum,
-                     nm->mkNode(Kind::PLUS, nm->mkConst(Rational(1)), ru)));
+      pbounds.d_upperPos = Rewriter::rewrite(nm->mkNode(
+          Kind::MULT,
+          taylor_sum,
+          nm->mkNode(
+              Kind::PLUS, nm->mkConst(CONST_RATIONAL, Rational(1)), ru)));
     }
     else
     {
@@ -198,11 +206,11 @@ std::pair<Node, Node> TaylorGenerator::getTfModelBounds(Node tf,
     // at zero, its trivial
     if (k == Kind::SINE)
     {
-      Node zero = nm->mkConst(Rational(0));
+      Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
       return std::pair<Node, Node>(zero, zero);
     }
     Assert(k == Kind::EXPONENTIAL);
-    Node one = nm->mkConst(Rational(1));
+    Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
     return std::pair<Node, Node>(one, one);
   }
   bool isNeg = csign == -1;
index 2fcbcdb384f022e7ad888bb6dcd47b241ac8e2c1..870eddc869b19e79f3bcaca90e1b223eb103803d 100644 (file)
@@ -22,6 +22,8 @@
 #include "theory/arith/nl/transcendental/taylor_generator.h"
 #include "theory/rewriter.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -35,9 +37,9 @@ TranscendentalState::TranscendentalState(InferenceManager& im,
 {
   d_true = NodeManager::currentNM()->mkConst(true);
   d_false = NodeManager::currentNM()->mkConst(false);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
-  d_neg_one = NodeManager::currentNM()->mkConst(Rational(-1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+  d_neg_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1));
   if (d_env.isTheoryProofProducing())
   {
     d_proof.reset(new CDProofSet<CDProof>(
@@ -203,14 +205,20 @@ void TranscendentalState::mkPi()
   {
     d_pi = nm->mkNullaryOperator(nm->realType(), Kind::PI);
     d_pi_2 = Rewriter::rewrite(
-        nm->mkNode(Kind::MULT, d_pi, nm->mkConst(Rational(1) / Rational(2))));
+        nm->mkNode(Kind::MULT,
+                   d_pi,
+                   nm->mkConst(CONST_RATIONAL, Rational(1) / Rational(2))));
     d_pi_neg_2 = Rewriter::rewrite(
-        nm->mkNode(Kind::MULT, d_pi, nm->mkConst(Rational(-1) / Rational(2))));
-    d_pi_neg = Rewriter::rewrite(
-        nm->mkNode(Kind::MULT, d_pi, nm->mkConst(Rational(-1))));
+        nm->mkNode(Kind::MULT,
+                   d_pi,
+                   nm->mkConst(CONST_RATIONAL, Rational(-1) / Rational(2))));
+    d_pi_neg = Rewriter::rewrite(nm->mkNode(
+        Kind::MULT, d_pi, nm->mkConst(CONST_RATIONAL, Rational(-1))));
     // initialize bounds
-    d_pi_bound[0] = nm->mkConst(Rational(103993) / Rational(33102));
-    d_pi_bound[1] = nm->mkConst(Rational(104348) / Rational(33215));
+    d_pi_bound[0] =
+        nm->mkConst(CONST_RATIONAL, Rational(103993) / Rational(33102));
+    d_pi_bound[1] =
+        nm->mkConst(CONST_RATIONAL, Rational(104348) / Rational(33215));
   }
 }
 
@@ -336,19 +344,23 @@ NlLemma TranscendentalState::mkSecantLemma(TNode lower,
     {
       if (csign == 1)
       {
-        proof->addStep(
-            lem,
-            PfRule::ARITH_TRANS_EXP_APPROX_ABOVE_POS,
-            {},
-            {nm->mkConst<Rational>(2 * actual_d), tf[0], lower, upper});
+        proof->addStep(lem,
+                       PfRule::ARITH_TRANS_EXP_APPROX_ABOVE_POS,
+                       {},
+                       {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
+                        tf[0],
+                        lower,
+                        upper});
       }
       else
       {
-        proof->addStep(
-            lem,
-            PfRule::ARITH_TRANS_EXP_APPROX_ABOVE_NEG,
-            {},
-            {nm->mkConst<Rational>(2 * actual_d), tf[0], lower, upper});
+        proof->addStep(lem,
+                       PfRule::ARITH_TRANS_EXP_APPROX_ABOVE_NEG,
+                       {},
+                       {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
+                        tf[0],
+                        lower,
+                        upper});
       }
     }
     else if (tf.getKind() == Kind::SINE)
@@ -358,7 +370,7 @@ NlLemma TranscendentalState::mkSecantLemma(TNode lower,
         proof->addStep(lem,
                        PfRule::ARITH_TRANS_SINE_APPROX_BELOW_POS,
                        {},
-                       {nm->mkConst<Rational>(2 * actual_d),
+                       {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
                         tf[0],
                         lower,
                         upper,
@@ -372,7 +384,7 @@ NlLemma TranscendentalState::mkSecantLemma(TNode lower,
         proof->addStep(lem,
                        PfRule::ARITH_TRANS_SINE_APPROX_ABOVE_NEG,
                        {},
-                       {nm->mkConst<Rational>(2 * actual_d),
+                       {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
                         tf[0],
                         lower,
                         upper,
index 5c43189eabd50084f4ca8ec2c23e79278a62b238..17efa53a524434f49d0549479258888e35d107d3 100644 (file)
@@ -170,21 +170,25 @@ Node OperatorElim::eliminateOperators(Node node,
               nm->mkNode(
                   LT,
                   num,
-                  nm->mkNode(MULT,
-                             den,
-                             nm->mkNode(PLUS, v, nm->mkConst(Rational(1))))));
+                  nm->mkNode(
+                      MULT,
+                      den,
+                      nm->mkNode(
+                          PLUS, v, nm->mkConst(CONST_RATIONAL, Rational(1))))));
         }
         else
         {
           lem = nm->mkNode(
               AND,
               leqNum,
-              nm->mkNode(
-                  LT,
-                  num,
-                  nm->mkNode(MULT,
-                             den,
-                             nm->mkNode(PLUS, v, nm->mkConst(Rational(-1))))));
+              nm->mkNode(LT,
+                         num,
+                         nm->mkNode(MULT,
+                                    den,
+                                    nm->mkNode(PLUS,
+                                               v,
+                                               nm->mkConst(CONST_RATIONAL,
+                                                           Rational(-1))))));
         }
       }
       else
@@ -194,30 +198,34 @@ Node OperatorElim::eliminateOperators(Node node,
             AND,
             nm->mkNode(
                 IMPLIES,
-                nm->mkNode(GT, den, nm->mkConst(Rational(0))),
+                nm->mkNode(GT, den, nm->mkConst(CONST_RATIONAL, Rational(0))),
                 nm->mkNode(
                     AND,
                     leqNum,
                     nm->mkNode(
                         LT,
                         num,
-                        nm->mkNode(
-                            MULT,
-                            den,
-                            nm->mkNode(PLUS, v, nm->mkConst(Rational(1))))))),
+                        nm->mkNode(MULT,
+                                   den,
+                                   nm->mkNode(PLUS,
+                                              v,
+                                              nm->mkConst(CONST_RATIONAL,
+                                                          Rational(1))))))),
             nm->mkNode(
                 IMPLIES,
-                nm->mkNode(LT, den, nm->mkConst(Rational(0))),
+                nm->mkNode(LT, den, nm->mkConst(CONST_RATIONAL, Rational(0))),
                 nm->mkNode(
                     AND,
                     leqNum,
                     nm->mkNode(
                         LT,
                         num,
-                        nm->mkNode(
-                            MULT,
-                            den,
-                            nm->mkNode(PLUS, v, nm->mkConst(Rational(-1))))))));
+                        nm->mkNode(MULT,
+                                   den,
+                                   nm->mkNode(PLUS,
+                                              v,
+                                              nm->mkConst(CONST_RATIONAL,
+                                                          Rational(-1))))))));
       }
       Node intVar = mkWitnessTerm(
           v, lem, "linearIntDiv", "the result of an intdiv-by-k term", lems);
@@ -251,9 +259,10 @@ Node OperatorElim::eliminateOperators(Node node,
       checkNonLinearLogic(node);
       Node rw = nm->mkNode(k, num, den);
       Node v = bvm->mkBoundVar<ArithWitnessVarAttribute>(rw, nm->realType());
-      Node lem = nm->mkNode(IMPLIES,
-                            den.eqNode(nm->mkConst(Rational(0))).negate(),
-                            nm->mkNode(MULT, den, v).eqNode(num));
+      Node lem = nm->mkNode(
+          IMPLIES,
+          den.eqNode(nm->mkConst(CONST_RATIONAL, Rational(0))).negate(),
+          nm->mkNode(MULT, den, v).eqNode(num));
       return mkWitnessTerm(
           v, lem, "nonlinearDiv", "the result of a non-linear div term", lems);
       break;
@@ -267,7 +276,8 @@ Node OperatorElim::eliminateOperators(Node node,
       {
         checkNonLinearLogic(node);
         Node divByZeroNum = getArithSkolemApp(num, SkolemFunId::DIV_BY_ZERO);
-        Node denEq0 = nm->mkNode(EQUAL, den, nm->mkConst(Rational(0)));
+        Node denEq0 =
+            nm->mkNode(EQUAL, den, nm->mkConst(CONST_RATIONAL, Rational(0)));
         ret = nm->mkNode(ITE, denEq0, divByZeroNum, ret);
       }
       return ret;
@@ -285,7 +295,8 @@ Node OperatorElim::eliminateOperators(Node node,
         checkNonLinearLogic(node);
         Node intDivByZeroNum =
             getArithSkolemApp(num, SkolemFunId::INT_DIV_BY_ZERO);
-        Node denEq0 = nm->mkNode(EQUAL, den, nm->mkConst(Rational(0)));
+        Node denEq0 =
+            nm->mkNode(EQUAL, den, nm->mkConst(CONST_RATIONAL, Rational(0)));
         ret = nm->mkNode(ITE, denEq0, intDivByZeroNum, ret);
       }
       return ret;
@@ -302,7 +313,8 @@ Node OperatorElim::eliminateOperators(Node node,
       {
         checkNonLinearLogic(node);
         Node modZeroNum = getArithSkolemApp(num, SkolemFunId::MOD_BY_ZERO);
-        Node denEq0 = nm->mkNode(EQUAL, den, nm->mkConst(Rational(0)));
+        Node denEq0 =
+            nm->mkNode(EQUAL, den, nm->mkConst(CONST_RATIONAL, Rational(0)));
         ret = nm->mkNode(ITE, denEq0, modZeroNum, ret);
       }
       return ret;
@@ -311,10 +323,11 @@ Node OperatorElim::eliminateOperators(Node node,
 
     case ABS:
     {
-      return nm->mkNode(ITE,
-                        nm->mkNode(LT, node[0], nm->mkConst(Rational(0))),
-                        nm->mkNode(UMINUS, node[0]),
-                        node[0]);
+      return nm->mkNode(
+          ITE,
+          nm->mkNode(LT, node[0], nm->mkConst(CONST_RATIONAL, Rational(0))),
+          nm->mkNode(UMINUS, node[0]),
+          node[0]);
       break;
     }
     case SQRT:
@@ -350,10 +363,11 @@ Node OperatorElim::eliminateOperators(Node node,
         // satisfiable. On the original formula, this would require that we
         // simultaneously interpret sqrt(1) as 1 and -1, which is not a valid
         // model.
-        lem = nm->mkNode(ITE,
-                         nm->mkNode(GEQ, node[0], nm->mkConst(Rational(0))),
-                         nonNeg,
-                         uf);
+        lem = nm->mkNode(
+            ITE,
+            nm->mkNode(GEQ, node[0], nm->mkConst(CONST_RATIONAL, Rational(0))),
+            nonNeg,
+            uf);
       }
       else
       {
@@ -363,9 +377,10 @@ Node OperatorElim::eliminateOperators(Node node,
         Node rlem;
         if (k == ARCSINE || k == ARCTANGENT || k == ARCCOSECANT)
         {
-          Node half = nm->mkConst(Rational(1) / Rational(2));
+          Node half = nm->mkConst(CONST_RATIONAL, Rational(1) / Rational(2));
           Node pi2 = nm->mkNode(MULT, half, pi);
-          Node npi2 = nm->mkNode(MULT, nm->mkConst(Rational(-1)), pi2);
+          Node npi2 =
+              nm->mkNode(MULT, nm->mkConst(CONST_RATIONAL, Rational(-1)), pi2);
           // -pi/2 < var <= pi/2
           rlem = nm->mkNode(
               AND, nm->mkNode(LT, npi2, var), nm->mkNode(LEQ, var, pi2));
@@ -373,9 +388,10 @@ Node OperatorElim::eliminateOperators(Node node,
         else
         {
           // 0 <= var < pi
-          rlem = nm->mkNode(AND,
-                            nm->mkNode(LEQ, nm->mkConst(Rational(0)), var),
-                            nm->mkNode(LT, var, pi));
+          rlem = nm->mkNode(
+              AND,
+              nm->mkNode(LEQ, nm->mkConst(CONST_RATIONAL, Rational(0)), var),
+              nm->mkNode(LT, var, pi));
         }
 
         Kind rk =
index 171cdf1820d737620499effe985ec7314d5b62d2..69fe9873404f5dc785cf12362d8ff6b4b729060a 100644 (file)
@@ -25,6 +25,8 @@
 #include "theory/arith/normal_form.h"
 #include "theory/arith/operator_elim.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace arith {
@@ -47,7 +49,7 @@ Node ArithProofRuleChecker::checkInternal(PfRule id,
                                           const std::vector<Node>& args)
 {
   NodeManager* nm = NodeManager::currentNM();
-  auto zero = nm->mkConst<Rational>(0);
+  auto zero = nm->mkConst<Rational>(CONST_RATIONAL, 0);
   if (Debug.isOn("arith::pf::check"))
   {
     Debug("arith::pf::check") << "Arith PfRule:" << id << std::endl;
@@ -241,10 +243,12 @@ Node ArithProofRuleChecker::checkInternal(PfRule id,
                 << "Bad kind: " << children[i].getKind() << std::endl;
           }
         }
-        leftSum << nm->mkNode(
-            Kind::MULT, nm->mkConst<Rational>(scalar), children[i][0]);
-        rightSum << nm->mkNode(
-            Kind::MULT, nm->mkConst<Rational>(scalar), children[i][1]);
+        leftSum << nm->mkNode(Kind::MULT,
+                              nm->mkConst<Rational>(CONST_RATIONAL, scalar),
+                              children[i][0]);
+        rightSum << nm->mkNode(Kind::MULT,
+                               nm->mkConst<Rational>(CONST_RATIONAL, scalar),
+                               children[i][1]);
       }
       Node r = nm->mkNode(strict ? Kind::LT : Kind::LEQ,
                           leftSum.constructNode(),
@@ -271,7 +275,7 @@ Node ArithProofRuleChecker::checkInternal(PfRule id,
       {
         Rational originalBound = children[0][1].getConst<Rational>();
         Rational newBound = leastIntGreaterThan(originalBound);
-        Node rational = nm->mkConst<Rational>(newBound);
+        Node rational = nm->mkConst<Rational>(CONST_RATIONAL, newBound);
         return nm->mkNode(kind::GEQ, children[0][0], rational);
       }
     }
@@ -296,7 +300,7 @@ Node ArithProofRuleChecker::checkInternal(PfRule id,
       {
         Rational originalBound = children[0][1].getConst<Rational>();
         Rational newBound = greatestIntLessThan(originalBound);
-        Node rational = nm->mkConst<Rational>(newBound);
+        Node rational = nm->mkConst<Rational>(CONST_RATIONAL, newBound);
         return nm->mkNode(kind::LEQ, children[0][0], rational);
       }
     }
index f49a295c7dd4d3382c9e39d7cc8f9a671937b1ce..6a43ed09b93e842adf1f311c8ce21d96ab8f8f6d 100644 (file)
@@ -1427,10 +1427,10 @@ TrustNode TheoryArithPrivate::dioCutting()
       Pf pfNotGeq = d_pnm->mkAssume(geq.getNode().negate());
       Pf pfLt =
           d_pnm->mkNode(PfRule::MACRO_SR_PRED_TRANSFORM, {pfNotGeq}, {lt});
-      Pf pfSum =
-          d_pnm->mkNode(PfRule::MACRO_ARITH_SCALE_SUM_UB,
-                        {pfGt, pfLt},
-                        {nm->mkConst<Rational>(-1), nm->mkConst<Rational>(1)});
+      Pf pfSum = d_pnm->mkNode(PfRule::MACRO_ARITH_SCALE_SUM_UB,
+                               {pfGt, pfLt},
+                               {nm->mkConst<Rational>(CONST_RATIONAL, -1),
+                                nm->mkConst<Rational>(CONST_RATIONAL, 1)});
       Pf pfBot = d_pnm->mkNode(
           PfRule::MACRO_SR_PRED_TRANSFORM, {pfSum}, {nm->mkConst<bool>(false)});
       std::vector<Node> assumptions = {leq.getNode().negate(),
@@ -4474,11 +4474,12 @@ bool TheoryArithPrivate::rowImplicationCanBeApplied(RowIndex ridx, bool rowUp, C
         std::vector<Node> farkasCoefficients;
         farkasCoefficients.reserve(coeffs->size());
         auto nm = NodeManager::currentNM();
-        std::transform(
-            coeffs->begin(),
-            coeffs->end(),
-            std::back_inserter(farkasCoefficients),
-            [nm](const Rational& r) { return nm->mkConst<Rational>(r); });
+        std::transform(coeffs->begin(),
+                       coeffs->end(),
+                       std::back_inserter(farkasCoefficients),
+                       [nm](const Rational& r) {
+                         return nm->mkConst<Rational>(CONST_RATIONAL, r);
+                       });
 
         // Prove bottom.
         auto sumPf = d_pnm->mkNode(
index 2b55829568db8e3721993761e9ae94551ee61763..d57c4ba24dc4c3e1f2754dab84379c09bdbe8ac4 100644 (file)
@@ -39,7 +39,10 @@ class RationalEnumerator : public TypeEnumeratorBase<RationalEnumerator> {
            && type.getConst<TypeConstant>() == REAL_TYPE);
   }
 
-  Node operator*() override { return NodeManager::currentNM()->mkConst(d_rat); }
+  Node operator*() override
+  {
+    return NodeManager::currentNM()->mkConst(kind::CONST_RATIONAL, d_rat);
+  }
   RationalEnumerator& operator++() override
   {
     // sequence is 0, then diagonal with negatives interleaved
@@ -82,7 +85,8 @@ class IntegerEnumerator : public TypeEnumeratorBase<IntegerEnumerator> {
 
   Node operator*() override
   {
-    return NodeManager::currentNM()->mkConst(Rational(d_int));
+    return NodeManager::currentNM()->mkConst(kind::CONST_RATIONAL,
+                                             Rational(d_int));
   }
 
   IntegerEnumerator& operator++() override
index 341798eb2b96e185890bf052028d308fa37865b1..c2d73d625ae16de92e60acc62e4d9ff33d736ef4 100644 (file)
@@ -42,8 +42,8 @@ BagSolver::BagSolver(Env& env,
       d_termReg(tr),
       d_mapCache(userContext())
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
   d_true = NodeManager::currentNM()->mkConst(true);
   d_false = NodeManager::currentNM()->mkConst(false);
 }
index 593145f6fd4c36b15e8031400685b2306b4ffb62..31c33b901a88193ba3e9db7481e6cce7923c0313 100644 (file)
@@ -45,8 +45,8 @@ BagsRewriter::BagsRewriter(HistogramStat<Rewrite>* statistics)
     : d_statistics(statistics)
 {
   d_nm = NodeManager::currentNM();
-  d_zero = d_nm->mkConst(Rational(0));
-  d_one = d_nm->mkConst(Rational(1));
+  d_zero = d_nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = d_nm->mkConst(CONST_RATIONAL, Rational(1));
 }
 
 RewriteResponse BagsRewriter::postRewrite(TNode n)
index a746a2cbaf77a31a2a187957e57e9fe1d4fa1e15..c65f5ccc26ffd7523b4ef6a0c2d590301eb23d6f 100644 (file)
@@ -36,8 +36,8 @@ InferenceGenerator::InferenceGenerator(SolverState* state, InferenceManager* im)
   d_nm = NodeManager::currentNM();
   d_sm = d_nm->getSkolemManager();
   d_true = d_nm->mkConst(true);
-  d_zero = d_nm->mkConst(Rational(0));
-  d_one = d_nm->mkConst(Rational(1));
+  d_zero = d_nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = d_nm->mkConst(CONST_RATIONAL, Rational(1));
 }
 
 InferInfo InferenceGenerator::nonNegativeCount(Node n, Node e)
index 59344cf0bc281310cbd44b95ab249724d67a4fc0..69d76bd88c7e74360e2360a7110ad546b6e955e7 100644 (file)
@@ -202,12 +202,14 @@ Node NormalForm::constructConstantBagFromElements(
   }
   TypeNode elementType = t.getBagElementType();
   std::map<Node, Rational>::const_reverse_iterator it = elements.rbegin();
-  Node bag =
-      nm->mkBag(elementType, it->first, nm->mkConst<Rational>(it->second));
+  Node bag = nm->mkBag(elementType,
+                       it->first,
+                       nm->mkConst<Rational>(CONST_RATIONAL, it->second));
   while (++it != elements.rend())
   {
-    Node n =
-        nm->mkBag(elementType, it->first, nm->mkConst<Rational>(it->second));
+    Node n = nm->mkBag(elementType,
+                       it->first,
+                       nm->mkConst<Rational>(CONST_RATIONAL, it->second));
     bag = nm->mkNode(UNION_DISJOINT, n, bag);
   }
   return bag;
@@ -260,10 +262,10 @@ Node NormalForm::evaluateBagCount(TNode n)
   NodeManager* nm = NodeManager::currentNM();
   if (it != elements.end())
   {
-    Node count = nm->mkConst(it->second);
+    Node count = nm->mkConst(CONST_RATIONAL, it->second);
     return count;
   }
-  return nm->mkConst(Rational(0));
+  return nm->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 Node NormalForm::evaluateDuplicateRemoval(TNode n)
@@ -590,7 +592,7 @@ Node NormalForm::evaluateCard(TNode n)
   }
 
   NodeManager* nm = NodeManager::currentNM();
-  Node sumNode = nm->mkConst(sum);
+  Node sumNode = nm->mkConst(CONST_RATIONAL, sum);
   return sumNode;
 }
 
index 813f45669e4743a8c6c535292b35dfcfb53d3842..3ab184eab0cc1159571c43d59f9c3632070eb90d 100644 (file)
@@ -119,7 +119,7 @@ TrustNode TheoryBags::expandChooseOperator(const Node& node,
   Node emptyBag = nm->mkConst(EmptyBag(bagType));
   Node isEmpty = A.eqNode(emptyBag);
   Node count = nm->mkNode(BAG_COUNT, x, A);
-  Node one = nm->mkConst(Rational(1));
+  Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
   Node geqOne = nm->mkNode(GEQ, count, one);
   Node geqOneAndEqual = geqOne.andNode(equal);
   Node ite = nm->mkNode(ITE, isEmpty, equal, geqOneAndEqual);
index be9e0cd4da5457d32424bf7f67fdfa5d18ea6b8a..06771a4185cca74090801b24444eae03c0cabd52 100644 (file)
@@ -20,6 +20,8 @@
 #include "theory_bags_type_enumerator.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace bags {
@@ -55,7 +57,7 @@ Node BagEnumerator::operator*()
 BagEnumerator& BagEnumerator::operator++()
 {
   // increase the multiplicity by one
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   TypeNode elementType = d_elementTypeEnumerator.getType();
   Node singleton = d_nodeManager->mkBag(elementType, d_element, one);
   if (d_currentBag.getKind() == kind::EMPTYBAG)
index 1ec8f7b67ca228b160e3031c94e13bda5e019b69..9190f423fbe121352551513e1e7789b6ff3c5587 100644 (file)
@@ -21,6 +21,8 @@
 #include "proof/proof_node_manager.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace booleans {
@@ -31,7 +33,7 @@ namespace {
 template <typename T>
 Node mkRat(T val)
 {
-  return NodeManager::currentNM()->mkConst<Rational>(val);
+  return NodeManager::currentNM()->mkConst<Rational>(CONST_RATIONAL, val);
 }
 
 /**
index d5b856456f9b76077a808731f688119d7016b220..9c05407b76fbb0073fe6b7c6952fbc692f30c2a7 100644 (file)
@@ -400,7 +400,7 @@ bool BuiltinProofRuleChecker::getTheoryId(TNode n, TheoryId& tid)
 Node BuiltinProofRuleChecker::mkTheoryIdNode(TheoryId tid)
 {
   return NodeManager::currentNM()->mkConst(
-      Rational(static_cast<uint32_t>(tid)));
+      CONST_RATIONAL, Rational(static_cast<uint32_t>(tid)));
 }
 
 }  // namespace builtin
index ba0e51595478ce14413e85ac12008d625cb95e30..eff5ec611eea5d7f1a687382b8a048ff3d713adc 100644 (file)
 #include "util/iand.h"
 #include "util/rational.h"
 
-namespace cvc5 {
+using namespace cvc5::kind;
 using namespace cvc5::theory;
 
+namespace cvc5 {
+
 namespace {
 
 // A helper function to compute 2^b as a Rational
@@ -57,8 +59,8 @@ IntBlaster::IntBlaster(Env& env,
       d_introduceFreshIntVars(introduceFreshIntVars)
 {
   d_nm = NodeManager::currentNM();
-  d_zero = d_nm->mkConst<Rational>(0);
-  d_one = d_nm->mkConst<Rational>(1);
+  d_zero = d_nm->mkConst<Rational>(CONST_RATIONAL, 0);
+  d_one = d_nm->mkConst<Rational>(CONST_RATIONAL, 1);
 };
 
 IntBlaster::~IntBlaster() {}
@@ -80,18 +82,18 @@ Node IntBlaster::maxInt(uint64_t k)
 {
   Assert(k > 0);
   Rational max_value = intpow2(k) - 1;
-  return d_nm->mkConst<Rational>(max_value);
+  return d_nm->mkConst<Rational>(CONST_RATIONAL, max_value);
 }
 
 Node IntBlaster::pow2(uint64_t k)
 {
   Assert(k >= 0);
-  return d_nm->mkConst<Rational>(intpow2(k));
+  return d_nm->mkConst<Rational>(CONST_RATIONAL, intpow2(k));
 }
 
 Node IntBlaster::modpow2(Node n, uint64_t exponent)
 {
-  Node p2 = d_nm->mkConst<Rational>(intpow2(exponent));
+  Node p2 = d_nm->mkConst<Rational>(CONST_RATIONAL, intpow2(exponent));
   return d_nm->mkNode(kind::INTS_MODULUS_TOTAL, n, p2);
 }
 
@@ -657,7 +659,7 @@ Node IntBlaster::translateNoChildren(Node original,
       // Bit-vector constants are transformed into their integer value.
       BitVector constant(original.getConst<BitVector>());
       Integer c = constant.toInteger();
-      translation = d_nm->mkConst<Rational>(c);
+      translation = d_nm->mkConst<Rational>(CONST_RATIONAL, c);
     }
     else
     {
index bc6096cbb153925951f0d3218b025ac110f969eb..adb067045efb96d6228ab869384a6b18245b1ef8 100644 (file)
@@ -23,6 +23,8 @@
 #include "util/bitvector.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace bv {
@@ -465,7 +467,7 @@ Node eliminateBv2Nat(TNode node)
 {
   const unsigned size = utils::getSize(node[0]);
   NodeManager* const nm = NodeManager::currentNM();
-  const Node z = nm->mkConst(Rational(0));
+  const Node z = nm->mkConst(CONST_RATIONAL, Rational(0));
   const Node bvone = utils::mkOne(1);
 
   Integer i = 1;
@@ -476,8 +478,8 @@ Node eliminateBv2Nat(TNode node)
         nm->mkNode(kind::EQUAL,
                    nm->mkNode(nm->mkConst(BitVectorExtract(bit, bit)), node[0]),
                    bvone);
-    children.push_back(
-        nm->mkNode(kind::ITE, cond, nm->mkConst(Rational(i)), z));
+    children.push_back(nm->mkNode(
+        kind::ITE, cond, nm->mkConst(CONST_RATIONAL, Rational(i)), z));
   }
   // avoid plus with one child
   return children.size() == 1 ? children[0] : nm->mkNode(kind::PLUS, children);
@@ -494,10 +496,11 @@ Node eliminateInt2Bv(TNode node)
   Integer i = 2;
   while (v.size() < size)
   {
-    Node cond = nm->mkNode(
-        kind::GEQ,
-        nm->mkNode(kind::INTS_MODULUS_TOTAL, node[0], nm->mkConst(Rational(i))),
-        nm->mkConst(Rational(i, 2)));
+    Node cond = nm->mkNode(kind::GEQ,
+                           nm->mkNode(kind::INTS_MODULUS_TOTAL,
+                                      node[0],
+                                      nm->mkConst(CONST_RATIONAL, Rational(i))),
+                           nm->mkConst(CONST_RATIONAL, Rational(i, 2)));
     v.push_back(nm->mkNode(kind::ITE, cond, bvone, bvzero));
     i *= 2;
   }
index fd957baaaf82b7350b3472cae45d9259ca85fd42..4cda9f728651f28a230c72f4b6458f4b19bf7270 100644 (file)
@@ -78,7 +78,7 @@ RewriteResponse DatatypesRewriter::postRewrite(TNode in)
       const DType& dt = utils::datatypeOf(constructor);
       const DTypeConstructor& c = dt[constructorIndex];
       unsigned weight = c.getWeight();
-      children.push_back(nm->mkConst(Rational(weight)));
+      children.push_back(nm->mkConst(CONST_RATIONAL, Rational(weight)));
       Node res =
           children.size() == 1 ? children[0] : nm->mkNode(kind::PLUS, children);
       Trace("datatypes-rewrite")
@@ -104,8 +104,9 @@ RewriteResponse DatatypesRewriter::postRewrite(TNode in)
             res = nm->mkConst(false);
             break;
           }
-          children.push_back(
-              nm->mkNode(kind::DT_HEIGHT_BOUND, in[0][i], nm->mkConst(rmo)));
+          children.push_back(nm->mkNode(kind::DT_HEIGHT_BOUND,
+                                        in[0][i],
+                                        nm->mkConst(CONST_RATIONAL, rmo)));
         }
       }
       if (res.isNull())
index 4aace5f1c74b3ac4494a05d8d12ed0d750db09ef..7ca58905f2d796b6fb5080152f3fc1171a909e93 100644 (file)
@@ -108,7 +108,7 @@ void InferProofCons::convert(InferenceId infer, TNode conc, TNode exp, CDProof*
         }
         if (argSuccess)
         {
-          narg = nm->mkConst(Rational(i));
+          narg = nm->mkConst(CONST_RATIONAL, Rational(i));
           break;
         }
       }
@@ -141,7 +141,7 @@ void InferProofCons::convert(InferenceId infer, TNode conc, TNode exp, CDProof*
         if (n >= 0)
         {
           Node t = exp[0];
-          Node nn = nm->mkConst(Rational(n));
+          Node nn = nm->mkConst(CONST_RATIONAL, Rational(n));
           Node eq = exp.eqNode(conc);
           cdp->addStep(eq, PfRule::DT_INST, {}, {t, nn});
           cdp->addStep(conc, PfRule::EQ_RESOLVE, {exp, eq}, {});
index bacbf8c4788213ff04633f15af8d98e11f042e45..88a3e43d7a7e1dc43e6a9458bd9089f2ab478f6b 100644 (file)
@@ -57,7 +57,7 @@ SygusExtension::SygusExtension(Env& env,
       d_active_terms(context()),
       d_currTermSize(context())
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
   d_true = NodeManager::currentNM()->mkConst(true);
 }
 
@@ -1772,8 +1772,8 @@ Node SygusExtension::SygusSizeDecisionStrategy::getOrMkMeasureValue()
     NodeManager* nm = NodeManager::currentNM();
     SkolemManager* sm = nm->getSkolemManager();
     d_measure_value = sm->mkDummySkolem("mt", nm->integerType());
-    Node mtlem =
-        nm->mkNode(kind::GEQ, d_measure_value, nm->mkConst(Rational(0)));
+    Node mtlem = nm->mkNode(
+        kind::GEQ, d_measure_value, nm->mkConst(CONST_RATIONAL, Rational(0)));
     d_im.lemma(mtlem, InferenceId::DATATYPES_SYGUS_MT_POS);
   }
   return d_measure_value;
@@ -1787,7 +1787,8 @@ Node SygusExtension::SygusSizeDecisionStrategy::getOrMkActiveMeasureValue(
     NodeManager* nm = NodeManager::currentNM();
     SkolemManager* sm = nm->getSkolemManager();
     Node new_mt = sm->mkDummySkolem("mt", nm->integerType());
-    Node mtlem = nm->mkNode(kind::GEQ, new_mt, nm->mkConst(Rational(0)));
+    Node mtlem =
+        nm->mkNode(kind::GEQ, new_mt, nm->mkConst(CONST_RATIONAL, Rational(0)));
     d_measure_value_active = new_mt;
     d_im.lemma(mtlem, InferenceId::DATATYPES_SYGUS_MT_POS);
   }
@@ -1816,7 +1817,8 @@ Node SygusExtension::SygusSizeDecisionStrategy::mkLiteral(unsigned s)
   NodeManager* nm = NodeManager::currentNM();
   Trace("sygus-engine") << "******* Sygus : allocate size literal " << s
                         << " for " << d_this << std::endl;
-  return nm->mkNode(DT_SYGUS_BOUND, d_this, nm->mkConst(Rational(s)));
+  return nm->mkNode(
+      DT_SYGUS_BOUND, d_this, nm->mkConst(CONST_RATIONAL, Rational(s)));
 }
 
 int SygusExtension::getGuardStatus( Node g ) {
index 63e60a4786c14eb0de146b0214e912d133a03d67..1b5e37bc3e7742765d72a9f57d023b1abf04e67d 100644 (file)
@@ -245,7 +245,7 @@ bool SygusSimpleSymBreak::considerArgKind(
           rt.d_children[0].d_req_kind = PLUS;
           rt.d_children[0].d_children[0].d_req_type = dt[c].getArgType(1);
           rt.d_children[0].d_children[1].d_req_const =
-              NodeManager::currentNM()->mkConst(Rational(1));
+              NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
           rt.d_children[1].d_req_type = dt[c].getArgType(0);
         }
         else if (k == LT || k == GEQ)
@@ -256,7 +256,7 @@ bool SygusSimpleSymBreak::considerArgKind(
           rt.d_children[1].d_req_kind = PLUS;
           rt.d_children[1].d_children[0].d_req_type = dt[c].getArgType(0);
           rt.d_children[1].d_children[1].d_req_const =
-              NodeManager::currentNM()->mkConst(Rational(1));
+              NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
         }
       }
       else if (pk == BITVECTOR_NOT)
index 055b06c4782f217c1940bc35eda9bd10bbdc5caf..b19eb53afd25a84571ec1017f1a16bc304a751dd 100644 (file)
@@ -68,7 +68,7 @@ TheoryDatatypes::TheoryDatatypes(Env& env,
 {
 
   d_true = NodeManager::currentNM()->mkConst( true );
-  d_zero = NodeManager::currentNM()->mkConst( Rational(0) );
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
   d_dtfCounter = 0;
 
   // indicate we are using the default theory state object
index 3df86383ffe8bff48be2a99fe0730f856786be11..c0912077170f41af90bb9b399390a7b2b7217acb 100644 (file)
@@ -20,6 +20,8 @@
 #include "theory/theory_model.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 
@@ -33,7 +35,7 @@ void DifficultyManager::getDifficultyMap(std::map<Node, Node>& dmap)
   NodeManager* nm = NodeManager::currentNM();
   for (const std::pair<const Node, uint64_t> p : d_dfmap)
   {
-    dmap[p.first] = nm->mkConst(Rational(p.second));
+    dmap[p.first] = nm->mkConst(CONST_RATIONAL, Rational(p.second));
   }
 }
 
index f7c5ddf0f2dd68908eb42b87a251014b6f06dbe1..27e67dd9faa20c39475f12f901712a21ee859b57 100644 (file)
@@ -21,6 +21,8 @@
 #include "theory/theory.h"
 #include "util/integer.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 
@@ -115,7 +117,7 @@ Node EvalResult::toNode() const
   {
     case EvalResult::BOOL: return nm->mkConst(d_bool);
     case EvalResult::BITVECTOR: return nm->mkConst(d_bv);
-    case EvalResult::RATIONAL: return nm->mkConst(d_rat);
+    case EvalResult::RATIONAL: return nm->mkConst(CONST_RATIONAL, d_rat);
     case EvalResult::STRING: return nm->mkConst(d_str);
     case EvalResult::UCONST: return nm->mkConst(d_uc);
     default:
index 6f2ddbf63509a0e247bde4bfcba277f30b9d0141..d8e35d8e540d1323081301caef2bf745e19ea240 100644 (file)
@@ -31,6 +31,7 @@
 #include "util/floatingpoint.h"
 
 using namespace std;
+using namespace cvc5::kind;
 
 namespace cvc5 {
 namespace theory {
@@ -363,7 +364,7 @@ bool TheoryFp::refineAbstraction(TheoryModel *m, TNode abstract, TNode concrete)
         Node realValueOfAbstract =
             rewrite(nm->mkNode(kind::FLOATINGPOINT_TO_REAL_TOTAL,
                                abstractValue,
-                               nm->mkConst(Rational(0U))));
+                               nm->mkConst(CONST_RATIONAL, Rational(0U))));
 
         Node bg = nm->mkNode(
             kind::IMPLIES,
@@ -566,10 +567,11 @@ void TheoryFp::registerTerm(TNode node)
                    nm->mkNode(kind::EQUAL, node, node[1]));
     handleLemma(pd, InferenceId::FP_REGISTER_TERM);
 
-    Node z =
-        nm->mkNode(kind::IMPLIES,
-                   nm->mkNode(kind::FLOATINGPOINT_ISZ, node[0]),
-                   nm->mkNode(kind::EQUAL, node, nm->mkConst(Rational(0U))));
+    Node z = nm->mkNode(
+        kind::IMPLIES,
+        nm->mkNode(kind::FLOATINGPOINT_ISZ, node[0]),
+        nm->mkNode(
+            kind::EQUAL, node, nm->mkConst(CONST_RATIONAL, Rational(0U))));
     handleLemma(z, InferenceId::FP_REGISTER_TERM);
     return;
 
@@ -590,7 +592,8 @@ void TheoryFp::registerTerm(TNode node)
 
     Node z = nm->mkNode(
         kind::IMPLIES,
-        nm->mkNode(kind::EQUAL, node[1], nm->mkConst(Rational(0U))),
+        nm->mkNode(
+            kind::EQUAL, node[1], nm->mkConst(CONST_RATIONAL, Rational(0U))),
         nm->mkNode(kind::EQUAL,
                    node,
                    nm->mkConst(FloatingPoint::makeZero(
index 91fe183ecfc5d1c36d9943b0fecc898928af94f6..32c3cff41219c97fc5a86cfa7c3645f13982b2d3 100644 (file)
@@ -41,6 +41,8 @@
 #include "theory/fp/fp_word_blaster.h"
 #include "util/floatingpoint.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace fp {
@@ -913,7 +915,7 @@ RewriteResponse maxTotal(TNode node, bool isPreRewrite)
     FloatingPoint::PartialRational res(arg.convertToRational());
 
     if (res.second) {
-      Node lit = NodeManager::currentNM()->mkConst(res.first);
+      Node lit = NodeManager::currentNM()->mkConst(CONST_RATIONAL, res.first);
       return RewriteResponse(REWRITE_DONE, lit);
     } else {
       // Can't constant fold the underspecified case
@@ -996,15 +998,15 @@ RewriteResponse maxTotal(TNode node, bool isPreRewrite)
       Rational partialValue(node[1].getConst<Rational>());
 
       Rational folded(arg.convertToRationalTotal(partialValue));
-      Node lit = NodeManager::currentNM()->mkConst(folded);
+      Node lit = NodeManager::currentNM()->mkConst(CONST_RATIONAL, folded);
       return RewriteResponse(REWRITE_DONE, lit);
 
     } else {
       FloatingPoint::PartialRational res(arg.convertToRational());
 
       if (res.second) {
-       Node lit = NodeManager::currentNM()->mkConst(res.first);
-       return RewriteResponse(REWRITE_DONE, lit);
+        Node lit = NodeManager::currentNM()->mkConst(CONST_RATIONAL, res.first);
+        return RewriteResponse(REWRITE_DONE, lit);
       } else {
        // Can't constant fold the underspecified case
        return RewriteResponse(REWRITE_DONE, node);
index 68801457491aaf7a337f490695e09d5c25edcde6..4747aeaf2e4663c66155b2c53406b64438ad09b2 100644 (file)
@@ -19,6 +19,8 @@
 #include "proof/proof_checker.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 
@@ -466,7 +468,8 @@ std::ostream& operator<<(std::ostream& out, InferenceId i)
 
 Node mkInferenceIdNode(InferenceId i)
 {
-  return NodeManager::currentNM()->mkConst(Rational(static_cast<uint32_t>(i)));
+  return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                           Rational(static_cast<uint32_t>(i)));
 }
 
 bool getInferenceId(TNode n, InferenceId& i)
index 163a49b8cc2684504d5991b7b7a929be1c168761..425ab0484c0fbbe0d387ca3ed9becde0e824f3d5 100644 (file)
@@ -36,8 +36,8 @@ namespace quantifiers {
 ArithInstantiator::ArithInstantiator(Env& env, TypeNode tn, VtsTermCache* vtc)
     : Instantiator(env, tn), d_vtc(vtc)
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
-  d_one = NodeManager::currentNM()->mkConst(Rational(1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
 }
 
 void ArithInstantiator::reset(CegInstantiator* ci,
@@ -185,7 +185,8 @@ bool ArithInstantiator::processAssertion(CegInstantiator* ci,
           uval = nm->mkNode(
               PLUS,
               val,
-              nm->mkConst(Rational(isUpperBoundCTT(uires) ? 1 : -1)));
+              nm->mkConst(CONST_RATIONAL,
+                          Rational(isUpperBoundCTT(uires) ? 1 : -1)));
           uval = rewrite(uval);
         }
         else
@@ -252,8 +253,11 @@ bool ArithInstantiator::processAssertion(CegInstantiator* ci,
       if (d_type.isInteger())
       {
         uires = is_upper ? CEG_TT_LOWER : CEG_TT_UPPER;
-        uval = nm->mkNode(
-            PLUS, val, nm->mkConst(Rational(isUpperBoundCTT(uires) ? 1 : -1)));
+        uval =
+            nm->mkNode(PLUS,
+                       val,
+                       nm->mkConst(CONST_RATIONAL,
+                                   Rational(isUpperBoundCTT(uires) ? 1 : -1)));
         uval = rewrite(uval);
       }
       else
@@ -274,8 +278,8 @@ bool ArithInstantiator::processAssertion(CegInstantiator* ci,
     {
       if (options().quantifiers.cegqiModel)
       {
-        Node delta_coeff =
-            nm->mkConst(Rational(isUpperBoundCTT(uires) ? 1 : -1));
+        Node delta_coeff = nm->mkConst(
+            CONST_RATIONAL, Rational(isUpperBoundCTT(uires) ? 1 : -1));
         if (vts_coeff_delta.isNull())
         {
           vts_coeff_delta = delta_coeff;
@@ -451,8 +455,9 @@ bool ArithInstantiator::processAssertions(CegInstantiator* ci,
             Assert(d_mbp_coeff[rr][j].isConst());
             value[t] = nm->mkNode(
                 MULT,
-                nm->mkConst(Rational(1)
-                            / d_mbp_coeff[rr][j].getConst<Rational>()),
+                nm->mkConst(
+                    CONST_RATIONAL,
+                    Rational(1) / d_mbp_coeff[rr][j].getConst<Rational>()),
                 value[t]);
             value[t] = rewrite(value[t]);
           }
@@ -606,9 +611,10 @@ bool ArithInstantiator::processAssertions(CegInstantiator* ci,
       }
       else
       {
-        val = nm->mkNode(MULT,
-                         nm->mkNode(PLUS, vals[0], vals[1]),
-                         nm->mkConst(Rational(1) / Rational(2)));
+        val =
+            nm->mkNode(MULT,
+                       nm->mkNode(PLUS, vals[0], vals[1]),
+                       nm->mkConst(CONST_RATIONAL, Rational(1) / Rational(2)));
         val = rewrite(val);
       }
     }
@@ -803,7 +809,7 @@ CegTermType ArithInstantiator::solve_arith(CegInstantiator* ci,
         vts_coeff[t] = itminf->second;
         if (vts_coeff[t].isNull())
         {
-          vts_coeff[t] = nm->mkConst(Rational(1));
+          vts_coeff[t] = nm->mkConst(CONST_RATIONAL, Rational(1));
         }
         // negate if coefficient on variable is positive
         std::map<Node, Node>::iterator itv = msum.find(pv);
@@ -820,7 +826,8 @@ CegTermType ArithInstantiator::solve_arith(CegInstantiator* ci,
             {
               vts_coeff[t] = nm->mkNode(
                   MULT,
-                  nm->mkConst(Rational(-1) / itv->second.getConst<Rational>()),
+                  nm->mkConst(CONST_RATIONAL,
+                              Rational(-1) / itv->second.getConst<Rational>()),
                   vts_coeff[t]);
               vts_coeff[t] = rewrite(vts_coeff[t]);
             }
@@ -880,7 +887,7 @@ CegTermType ArithInstantiator::solve_arith(CegInstantiator* ci,
       }
     }
     // multiply everything by this coefficient
-    Node rcoeff = nm->mkConst(Rational(coeff));
+    Node rcoeff = nm->mkConst(CONST_RATIONAL, Rational(coeff));
     std::vector<Node> real_part;
     for (std::map<Node, Node>::iterator it = msum.begin(); it != msum.end();
          ++it)
index 9dc11955bbed073b8dcec9a5fe8f81d87c07d327..494ac8e53175873d9a3b66d7dd01277efcade1fc 100644 (file)
@@ -138,7 +138,8 @@ void TermProperties::composeProperty(TermProperties& p)
   else
   {
     NodeManager* nm = NodeManager::currentNM();
-    d_coeff = nm->mkConst(Rational(d_coeff.getConst<Rational>()
+    d_coeff = nm->mkConst(CONST_RATIONAL,
+                          Rational(d_coeff.getConst<Rational>()
                                    * p.d_coeff.getConst<Rational>()));
   }
 }
@@ -165,7 +166,8 @@ void SolvedForm::push_back(Node pv, Node n, TermProperties& pv_prop)
     Assert(new_theta.getKind() == CONST_RATIONAL);
     Assert(pv_prop.d_coeff.getKind() == CONST_RATIONAL);
     NodeManager* nm = NodeManager::currentNM();
-    new_theta = nm->mkConst(Rational(new_theta.getConst<Rational>()
+    new_theta = nm->mkConst(CONST_RATIONAL,
+                            Rational(new_theta.getConst<Rational>()
                                      * pv_prop.d_coeff.getConst<Rational>()));
   }
   d_theta.push_back(new_theta);
@@ -1151,7 +1153,12 @@ Node CegInstantiator::applySubstitution( TypeNode tn, Node n, std::vector< Node
         if( !prop[i].d_coeff.isNull() ){
           Assert(vars[i].getType().isInteger());
           Assert(prop[i].d_coeff.isConst());
-          Node nn = NodeManager::currentNM()->mkNode( MULT, subs[i], NodeManager::currentNM()->mkConst( Rational(1)/prop[i].d_coeff.getConst<Rational>() ) );
+          Node nn = NodeManager::currentNM()->mkNode(
+              MULT,
+              subs[i],
+              NodeManager::currentNM()->mkConst(
+                  CONST_RATIONAL,
+                  Rational(1) / prop[i].d_coeff.getConst<Rational>()));
           nn = NodeManager::currentNM()->mkNode( kind::TO_INTEGER, nn );
           nn = rewrite(nn);
           nsubs.push_back( nn );
@@ -1199,8 +1206,9 @@ Node CegInstantiator::applySubstitution( TypeNode tn, Node n, std::vector< Node
             Node c_coeff;
             if( !msum_coeff[it->first].isNull() ){
               c_coeff = rewrite(NodeManager::currentNM()->mkConst(
+                  CONST_RATIONAL,
                   pv_prop.d_coeff.getConst<Rational>()
-                  / msum_coeff[it->first].getConst<Rational>()));
+                      / msum_coeff[it->first].getConst<Rational>()));
             }else{
               c_coeff = pv_prop.d_coeff;
             }
@@ -1264,7 +1272,7 @@ Node CegInstantiator::applySubstitutionToLiteral( Node lit, std::vector< Node >&
       }else{
         atom_lhs = nm->mkNode(MINUS, atom[0], atom[1]);
         atom_lhs = rewrite(atom_lhs);
-        atom_rhs = nm->mkConst(Rational(0));
+        atom_rhs = nm->mkConst(CONST_RATIONAL, Rational(0));
       }
       //must be an eligible term
       if( isEligible( atom_lhs ) ){
index 6340e2a2a79617c7ecbac4cc363a82b28b0a55cc..65ad79e299291cbee4d46271828c6800f560aa02 100644 (file)
@@ -58,8 +58,8 @@ InstStrategyCegqi::InstStrategyCegqi(Env& env,
       d_added_cbqi_lemma(userContext()),
       d_vtsCache(new VtsTermCache(qim)),
       d_bv_invert(nullptr),
-      d_small_const_multiplier(
-          NodeManager::currentNM()->mkConst(Rational(1) / Rational(1000000))),
+      d_small_const_multiplier(NodeManager::currentNM()->mkConst(
+          CONST_RATIONAL, Rational(1) / Rational(1000000))),
       d_small_const(d_small_const_multiplier)
 {
   d_check_vts_lemma_lc = false;
@@ -453,7 +453,12 @@ void InstStrategyCegqi::process( Node q, Theory::Effort effort, int e ) {
       d_vtsCache->getVtsTerms(inf, true, false, false);
       for( unsigned i=0; i<inf.size(); i++ ){
         Trace("quant-vts-debug") << "Infinity lemma for " << inf[i] << " " << d_small_const << std::endl;
-        Node inf_lem_lb = NodeManager::currentNM()->mkNode( GT, inf[i], NodeManager::currentNM()->mkConst( Rational(1)/d_small_const.getConst<Rational>() ) );
+        Node inf_lem_lb = NodeManager::currentNM()->mkNode(
+            GT,
+            inf[i],
+            NodeManager::currentNM()->mkConst(
+                CONST_RATIONAL,
+                Rational(1) / d_small_const.getConst<Rational>()));
         d_qim.lemma(inf_lem_lb, InferenceId::QUANTIFIERS_CEGQI_VTS_LB_INF);
       }
     }
index fe47f1dd13e4f57d4492bbe48504bee3542c6afc..37ded9b7f69101d75514562c782ffaa6c085e2ce 100644 (file)
@@ -30,7 +30,7 @@ namespace quantifiers {
 
 VtsTermCache::VtsTermCache(QuantifiersInferenceManager& qim) : d_qim(qim)
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 void VtsTermCache::getVtsTerms(std::vector<Node>& t,
index 0752995830ff7bc949fdbdbb9faae296bff06d12..8c2d8e6c450195503eb1591effdb9a8335fdea01 100644 (file)
@@ -364,7 +364,8 @@ int InstMatchGenerator::getMatch(Node f, Node t, InstMatch& m)
     {
       if (pat.getKind() == GT)
       {
-        t_match = nm->mkNode(MINUS, t, nm->mkConst(Rational(1)));
+        t_match =
+            nm->mkNode(MINUS, t, nm->mkConst(CONST_RATIONAL, Rational(1)));
       }else{
         t_match = t;
       }
@@ -380,12 +381,13 @@ int InstMatchGenerator::getMatch(Node f, Node t, InstMatch& m)
         else
         {
           Assert(t.getType().isReal());
-          t_match = nm->mkNode(PLUS, t, nm->mkConst(Rational(1)));
+          t_match =
+              nm->mkNode(PLUS, t, nm->mkConst(CONST_RATIONAL, Rational(1)));
         }
       }
       else if (pat.getKind() == GEQ)
       {
-        t_match = nm->mkNode(PLUS, t, nm->mkConst(Rational(1)));
+        t_match = nm->mkNode(PLUS, t, nm->mkConst(CONST_RATIONAL, Rational(1)));
       }
       else if (pat.getKind() == GT)
       {
index 332346f3fea699389f3b5dd0d4f2d36fbb22d250..0ab6e1098a42c7409d83a3686f458060b3ae6f53 100644 (file)
@@ -678,7 +678,8 @@ Node PatternTermSelector::getInversion(Node n, Node x)
           Assert(nc.isConst());
           if (x.getType().isInteger())
           {
-            Node coeff = nm->mkConst(nc.getConst<Rational>().abs());
+            Node coeff =
+                nm->mkConst(CONST_RATIONAL, nc.getConst<Rational>().abs());
             if (!nc.getConst<Rational>().abs().isOne())
             {
               x = nm->mkNode(INTS_DIVISION_TOTAL, x, coeff);
@@ -690,7 +691,8 @@ Node PatternTermSelector::getInversion(Node n, Node x)
           }
           else
           {
-            Node coeff = nm->mkConst(Rational(1) / nc.getConst<Rational>());
+            Node coeff = nm->mkConst(CONST_RATIONAL,
+                                     Rational(1) / nc.getConst<Rational>());
             x = nm->mkNode(MULT, x, coeff);
           }
         }
index 8981a7a2df282250aea205de32983f744e250b7a..dc8f64f6df8cf0c18d96ba3f3f7cf1021a8f9e97 100644 (file)
@@ -94,7 +94,10 @@ int RelationalMatchGenerator::getNextMatch(Node q, InstMatch& m)
     s = rhs;
     if (!checkPol)
     {
-      s = nm->mkNode(PLUS, s, nm->mkConst(Rational(d_rel == GEQ ? -1 : 1)));
+      s = nm->mkNode(
+          PLUS,
+          s,
+          nm->mkConst(CONST_RATIONAL, Rational(d_rel == GEQ ? -1 : 1)));
     }
     d_counter++;
     Trace("relational-match-gen")
index 3d20f66b37fea41b4eaaac775a51b28cea16ac5b..5aab618c05c97df343ee384bf1730ecbcded0094 100644 (file)
@@ -49,7 +49,7 @@ ExtendedRewriter::ExtendedRewriter(Rewriter& rew, bool aggr)
 {
   d_true = NodeManager::currentNM()->mkConst(true);
   d_false = NodeManager::currentNM()->mkConst(false);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 void ExtendedRewriter::setCache(Node n, Node ret) const
index 26b52631572dfef5669dd9ff4dbad2006a15dcf9..b5b9e7d887ed3f0f07cc0d2b55b1e3318da9c78c 100644 (file)
@@ -59,7 +59,7 @@ BoundedIntegers::IntRangeDecisionHeuristic::IntRangeDecisionHeuristic(
 Node BoundedIntegers::IntRangeDecisionHeuristic::mkLiteral(unsigned n)
 {
   NodeManager* nm = NodeManager::currentNM();
-  Node cn = nm->mkConst(Rational(n == 0 ? 0 : n - 1));
+  Node cn = nm->mkConst(CONST_RATIONAL, Rational(n == 0 ? 0 : n - 1));
   return nm->mkNode(n == 0 ? LT : LEQ, d_proxy_range, cn);
 }
 
@@ -81,12 +81,13 @@ Node BoundedIntegers::IntRangeDecisionHeuristic::proxyCurrentRangeLemma()
   d_ranges_proxied[curr] = true;
   NodeManager* nm = NodeManager::currentNM();
   Node currLit = getLiteral(curr);
-  Node lem =
-      nm->mkNode(EQUAL,
-                 currLit,
-                 nm->mkNode(curr == 0 ? LT : LEQ,
-                            d_range,
-                            nm->mkConst(Rational(curr == 0 ? 0 : curr - 1))));
+  Node lem = nm->mkNode(
+      EQUAL,
+      currLit,
+      nm->mkNode(
+          curr == 0 ? LT : LEQ,
+          d_range,
+          nm->mkConst(CONST_RATIONAL, Rational(curr == 0 ? 0 : curr - 1))));
   return lem;
 }
 
@@ -692,7 +693,8 @@ Node BoundedIntegers::getSetRangeValue( Node q, Node v, RepSetIterator * rsi ) {
       }
       choices.pop_back();
       Node bvl = nm->mkNode(BOUND_VAR_LIST, choice_i);
-      Node cMinCard = nm->mkNode(LEQ, srCardN, nm->mkConst(Rational(i)));
+      Node cMinCard =
+          nm->mkNode(LEQ, srCardN, nm->mkConst(CONST_RATIONAL, Rational(i)));
       choice_i = nm->mkNode(WITNESS, bvl, nm->mkNode(OR, cMinCard, cBody));
       d_setm_choice[sro].push_back(choice_i);
     }
@@ -816,7 +818,8 @@ bool BoundedIntegers::getBoundElements( RepSetIterator * rsi, bool initial, Node
         Node range = rewrite(nm->mkNode(MINUS, u, l));
         // 9999 is an arbitrary range past which we do not do exhaustive
         // bounded instantation, based on the check below.
-        Node ra = rewrite(nm->mkNode(LEQ, range, nm->mkConst(Rational(9999))));
+        Node ra = rewrite(nm->mkNode(
+            LEQ, range, nm->mkConst(CONST_RATIONAL, Rational(9999))));
         Node tl = l;
         Node tu = u;
         getBounds( q, v, rsi, tl, tu );
@@ -827,7 +830,8 @@ bool BoundedIntegers::getBoundElements( RepSetIterator * rsi, bool initial, Node
           Trace("bound-int-rsi")  << "Actual bound range is " << rr << std::endl;
           for (long k = 0; k < rr; k++)
           {
-            Node t = nm->mkNode(PLUS, tl, nm->mkConst(Rational(k)));
+            Node t =
+                nm->mkNode(PLUS, tl, nm->mkConst(CONST_RATIONAL, Rational(k)));
             t = rewrite(t);
             elements.push_back( t );
           }
index 83e48bf9cdb845027d16594b2e29accc998bf7c9..af72e2a7c0e1f18fc99adda7bc3c335d9561322f 100644 (file)
@@ -61,9 +61,10 @@ bool QuantifiersBoundInference::mayComplete(TypeNode tn, unsigned maxCard)
     if (!c.isLargeFinite())
     {
       NodeManager* nm = NodeManager::currentNM();
-      Node card = nm->mkConst(Rational(c.getFiniteCardinality()));
+      Node card =
+          nm->mkConst(CONST_RATIONAL, Rational(c.getFiniteCardinality()));
       // check if less than fixed upper bound
-      Node oth = nm->mkConst(Rational(maxCard));
+      Node oth = nm->mkConst(CONST_RATIONAL, Rational(maxCard));
       Node eq = nm->mkNode(LEQ, card, oth);
       eq = Rewriter::rewrite(eq);
       mc = eq.isConst() && eq.getConst<bool>();
index f045144800faad2bd3f1290a0fe27882dde30878..9f7b270de0aac5f1820da848734a0578a982c1b9 100644 (file)
@@ -2281,7 +2281,7 @@ TNode QuantConflictFind::getZero( Kind k ) {
   if( it==d_zero.end() ){
     Node nn;
     if( k==PLUS ){
-      nn = NodeManager::currentNM()->mkConst( Rational(0) );
+      nn = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
     }
     d_zero[k] = nn;
     return nn;
index 88c6cd96fedac33e2741378ba1a46f991de4ae2a..adb91fdddac042d050f5663fba3b81f9aa626d5f 100644 (file)
@@ -920,7 +920,7 @@ bool QuantifiersRewriter::getVarElimLit(Node body,
       for (size_t j = 0, nargs = c.getNumArgs(); j < nargs; j++)
       {
         TypeNode tn = tspec[j];
-        Node rn = nm->mkConst(Rational(j));
+        Node rn = nm->mkConst(CONST_RATIONAL, Rational(j));
         Node cacheVal = BoundVarManager::getCacheValue(body, lit, rn);
         Node v = bvm->mkBoundVar<QRewDtExpandAttribute>(cacheVal, tn);
         newChildren.push_back(v);
index 6dcb318f3672d280e81cda036703a63faf63377e..4dea0dc22fe5b10f055f30cacf04a0c4a9d84c8d 100644 (file)
@@ -285,10 +285,12 @@ Node Skolemize::mkSkolemizedBody(Node f,
     }
     else if (options::intWfInduction() && tn.isInteger())
     {
-      Node icond = nm->mkNode(GEQ, k, nm->mkConst(Rational(0)));
-      Node iret = ret.substitute(ind_vars[0],
-                                 nm->mkNode(MINUS, k, nm->mkConst(Rational(1))))
-                      .negate();
+      Node icond = nm->mkNode(GEQ, k, nm->mkConst(CONST_RATIONAL, Rational(0)));
+      Node iret =
+          ret.substitute(
+                 ind_vars[0],
+                 nm->mkNode(MINUS, k, nm->mkConst(CONST_RATIONAL, Rational(1))))
+              .negate();
       n_str_ind = nm->mkNode(OR, icond.negate(), iret);
       n_str_ind = nm->mkNode(AND, icond, n_str_ind);
     }
index b60bc27361a026607bed20c8b06dd003115880a0..be80992eaa0cec7921a0109aa014371f026cb244 100644 (file)
@@ -480,7 +480,7 @@ Node CegisUnifEnumDecisionStrategy::mkLiteral(unsigned n)
       std::set<TypeNode> unresolvedTypes;
       unresolvedTypes.insert(u);
       std::vector<TypeNode> cargsEmpty;
-      Node cr = nm->mkConst(Rational(1));
+      Node cr = nm->mkConst(CONST_RATIONAL, Rational(1));
       sdt.addConstructor(cr, "1", cargsEmpty);
       std::vector<TypeNode> cargsPlus;
       cargsPlus.push_back(u);
@@ -503,8 +503,8 @@ Node CegisUnifEnumDecisionStrategy::mkLiteral(unsigned n)
     if (pow_two > 0)
     {
       Node size_ve = nm->mkNode(DT_SIZE, d_virtual_enum);
-      Node fair_lemma =
-          nm->mkNode(GEQ, size_ve, nm->mkConst(Rational(pow_two - 1)));
+      Node fair_lemma = nm->mkNode(
+          GEQ, size_ve, nm->mkConst(CONST_RATIONAL, Rational(pow_two - 1)));
       fair_lemma = nm->mkNode(OR, newLit, fair_lemma);
       Trace("cegis-unif-enum-lemma")
           << "CegisUnifEnum::lemma, fairness size:" << fair_lemma << "\n";
index 959532d9848f19241016b4e974f7a7228e85e921..674183b20cb8f2f709614ca61cce311b576f2636 100644 (file)
@@ -257,7 +257,7 @@ void SygusEnumerator::TermCache::initialize(SygusStatistics* s,
         // more aggressive merging of constructor classes. On the negative side,
         // this adds another level of indirection to remember which argument
         // positions the argument types occur in, for each constructor.
-        Node n = nm->mkConst(Rational(i));
+        Node n = nm->mkConst(CONST_RATIONAL, Rational(i));
         nToC[n] = i;
         tnit.add(n, argTypes[i]);
       }
index 99170427e19d1ec1ebac9b2919793a0bf0397458..cca1d76e222b4f4ccf94620448de967687f2659d 100644 (file)
@@ -84,7 +84,7 @@ void CegGrammarConstructor::collectTerms(
         TypeNode tn = cur.getType();
         Node c = cur;
         if( tn.isReal() ){
-          c = nm->mkConst( c.getConst<Rational>().abs() );
+          c = nm->mkConst(CONST_RATIONAL, c.getConst<Rational>().abs());
         }
         consts[tn].insert(c);
         if (tn.isInteger())
@@ -409,8 +409,8 @@ void CegGrammarConstructor::mkSygusConstantsForType(TypeNode type,
   NodeManager* nm = NodeManager::currentNM();
   if (type.isReal())
   {
-    ops.push_back(nm->mkConst(Rational(0)));
-    ops.push_back(nm->mkConst(Rational(1)));
+    ops.push_back(nm->mkConst(CONST_RATIONAL, Rational(0)));
+    ops.push_back(nm->mkConst(CONST_RATIONAL, Rational(1)));
   }
   else if (type.isBitVector())
   {
@@ -555,7 +555,7 @@ Node CegGrammarConstructor::createLambdaWithZeroArg(
   Assert(bArgType.isReal() || bArgType.isBitVector());
   if (bArgType.isReal())
   {
-    zarg = nm->mkConst(Rational(0));
+    zarg = nm->mkConst(CONST_RATIONAL, Rational(0));
   }
   else
   {
@@ -798,7 +798,8 @@ void CegGrammarConstructor::mkSygusDefaultGrammar(
         /* Add operator 1 */
         Trace("sygus-grammar-def") << "\t...add for 1 to Pos_Int\n";
         std::vector<TypeNode> cargsEmpty;
-        sdts.back().addConstructor(nm->mkConst(Rational(1)), "1", cargsEmpty);
+        sdts.back().addConstructor(
+            nm->mkConst(CONST_RATIONAL, Rational(1)), "1", cargsEmpty);
         /* Add operator PLUS */
         Kind kind = PLUS;
         Trace("sygus-grammar-def") << "\t...add for PLUS to Pos_Int\n";
index 2fc7f0c29d826bc304084815bd1987c600e1e47b..89cee0145264f3394dc61232f02b8f59d1c4bb30 100644 (file)
@@ -32,6 +32,8 @@
 #include "util/sampler.h"
 #include "util/string.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace theory {
 namespace quantifiers {
@@ -587,14 +589,14 @@ Node SygusSampler::getRandomValue(TypeNode tn)
       std::vector<Node> sum;
       for (unsigned j = 0, size = vec.size(); j < size; j++)
       {
-        Node digit = nm->mkConst(Rational(vec[j]) * curr);
+        Node digit = nm->mkConst(CONST_RATIONAL, Rational(vec[j]) * curr);
         sum.push_back(digit);
         curr = curr * baser;
       }
       Node ret;
       if (sum.empty())
       {
-        ret = nm->mkConst(Rational(0));
+        ret = nm->mkConst(CONST_RATIONAL, Rational(0));
       }
       else if (sum.size() == 1)
       {
@@ -629,7 +631,7 @@ Node SygusSampler::getRandomValue(TypeNode tn)
       }
       else
       {
-        return nm->mkConst(sr / rr);
+        return nm->mkConst(CONST_RATIONAL, sr / rr);
       }
     }
   }
index 704951f521f3869910aa2a55d982c1128a4a04ea..cb8bad1744de2871db9e6d9ce3379b9d36f83fa6 100644 (file)
@@ -332,7 +332,7 @@ Node TermUtil::mkTypeValue(TypeNode tn, int32_t val)
   if (tn.isInteger() || tn.isReal())
   {
     Rational c(val);
-    n = NodeManager::currentNM()->mkConst(c);
+    n = NodeManager::currentNM()->mkConst(CONST_RATIONAL, c);
   }
   else if (tn.isBitVector())
   {
index c35eaf49a55d698be7a360aa99fa2ec9e1533033..e2181b4c6d6aa96a94b049d274458da6721f91c7 100644 (file)
@@ -47,7 +47,7 @@ CardinalityExtension::CardinalityExtension(Env& env,
       d_finite_type_constants_processed(false)
 {
   d_true = NodeManager::currentNM()->mkConst(true);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 void CardinalityExtension::reset()
@@ -133,7 +133,8 @@ void CardinalityExtension::checkCardinalityExtended(TypeNode& t)
 
   if (finiteType)
   {
-    Node typeCardinality = nm->mkConst(Rational(card.getFiniteCardinality()));
+    Node typeCardinality =
+        nm->mkConst(CONST_RATIONAL, Rational(card.getFiniteCardinality()));
     Node cardUniv = nm->mkNode(kind::SET_CARD, proxy);
     Node leq = nm->mkNode(kind::LEQ, cardUniv, typeCardinality);
 
@@ -979,8 +980,8 @@ void CardinalityExtension::checkMinCard()
     }
     if (!members.empty())
     {
-      Node conc =
-          nm->mkNode(GEQ, cardTerm, nm->mkConst(Rational(members.size())));
+      Node conc = nm->mkNode(
+          GEQ, cardTerm, nm->mkConst(CONST_RATIONAL, Rational(members.size())));
       Node expn = exp.size() == 1 ? exp[0] : nm->mkNode(AND, exp);
       d_im.assertInference(conc, InferenceId::SETS_CARD_MINIMAL, expn, 1);
     }
index 50ff3f09c3e431b91da6b00af84d0a6b6ccdf0e7..f065802920e88f54552b463a596f3eed016e6469 100644 (file)
@@ -59,7 +59,7 @@ TheorySetsPrivate::TheorySetsPrivate(Env& env,
 {
   d_true = NodeManager::currentNM()->mkConst(true);
   d_false = NodeManager::currentNM()->mkConst(false);
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 TheorySetsPrivate::~TheorySetsPrivate()
index 277b6bc840ec372669d6b8581591c50c14938f76..d63368f191c6d360f6928a1f2376883208a4b720 100644 (file)
@@ -272,11 +272,13 @@ RewriteResponse TheorySetsRewriter::postRewrite(TNode node) {
   {
     if(node[0].isConst()) {
       std::set<Node> elements = NormalForm::getElementsFromNormalConstant(node[0]);
-      return RewriteResponse(REWRITE_DONE, nm->mkConst(Rational(elements.size())));
+      return RewriteResponse(
+          REWRITE_DONE, nm->mkConst(CONST_RATIONAL, Rational(elements.size())));
     }
     else if (node[0].getKind() == kind::SET_SINGLETON)
     {
-      return RewriteResponse(REWRITE_DONE, nm->mkConst(Rational(1)));
+      return RewriteResponse(REWRITE_DONE,
+                             nm->mkConst(CONST_RATIONAL, Rational(1)));
     }
     else if (node[0].getKind() == kind::SET_UNION)
     {
index 9e3d8ad381a14beb7a29b79741c8e7d33fe7fd13..d8a4e85aa85f93c39644182ed470ee6bd159caee 100644 (file)
@@ -32,7 +32,7 @@ namespace strings {
 
 ArithEntail::ArithEntail(Rewriter* r) : d_rr(r)
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 Node ArithEntail::rewrite(Node a) { return d_rr->rewrite(a); }
@@ -77,7 +77,9 @@ bool ArithEntail::check(Node a, bool strict)
   }
 
   Node ar = strict ? NodeManager::currentNM()->mkNode(
-                kind::MINUS, a, NodeManager::currentNM()->mkConst(Rational(1)))
+                kind::MINUS,
+                a,
+                NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1)))
                    : a;
   ar = d_rr->rewrite(ar);
 
@@ -131,7 +133,7 @@ bool ArithEntail::checkApprox(Node ar)
         << "Get approximations " << v << "..." << std::endl;
     if (v.isNull())
     {
-      Node mn = c.isNull() ? nm->mkConst(Rational(1)) : c;
+      Node mn = c.isNull() ? nm->mkConst(CONST_RATIONAL, Rational(1)) : c;
       aarSum.push_back(mn);
     }
     else
@@ -494,8 +496,8 @@ void ArithEntail::getArithApproximations(Node a,
           {
             // x >= 0 implies
             //   x+1 >= len( int.to.str( x ) )
-            approx.push_back(
-                nm->mkNode(PLUS, nm->mkConst(Rational(1)), a[0][0]));
+            approx.push_back(nm->mkNode(
+                PLUS, nm->mkConst(CONST_RATIONAL, Rational(1)), a[0][0]));
           }
         }
       }
@@ -505,7 +507,7 @@ void ArithEntail::getArithApproximations(Node a,
         {
           // x >= 0 implies
           //   len( int.to.str( x ) ) >= 1
-          approx.push_back(nm->mkConst(Rational(1)));
+          approx.push_back(nm->mkConst(CONST_RATIONAL, Rational(1)));
         }
         // other crazy things are possible here, e.g.
         // len( int.to.str( len( y ) + 10 ) ) >= 2
@@ -539,7 +541,7 @@ void ArithEntail::getArithApproximations(Node a,
       // ...hard to test, runs risk of non-termination
 
       // -1 <= indexof( x, y, n )
-      approx.push_back(nm->mkConst(Rational(-1)));
+      approx.push_back(nm->mkConst(CONST_RATIONAL, Rational(-1)));
     }
   }
   else if (ak == STRING_STOI)
@@ -554,7 +556,7 @@ void ArithEntail::getArithApproximations(Node a,
     else
     {
       // -1 <= str.to.int( x )
-      approx.push_back(nm->mkConst(Rational(-1)));
+      approx.push_back(nm->mkConst(CONST_RATIONAL, Rational(-1)));
     }
   }
   Trace("strings-ent-approx-debug") << "Return " << approx.size() << std::endl;
@@ -659,7 +661,9 @@ bool ArithEntail::checkWithAssumption(Node assumption,
       // (not (>= s t)) --> (>= (t - 1) s)
       Assert(assumption.getKind() == kind::NOT
              && assumption[0].getKind() == kind::GEQ);
-      x = nm->mkNode(kind::MINUS, assumption[0][1], nm->mkConst(Rational(1)));
+      x = nm->mkNode(kind::MINUS,
+                     assumption[0][1],
+                     nm->mkConst(CONST_RATIONAL, Rational(1)));
       y = assumption[0][0];
     }
 
@@ -859,7 +863,7 @@ Node ArithEntail::getConstantBoundLength(Node s, bool isLower)
   NodeManager* nm = NodeManager::currentNM();
   if (s.isConst())
   {
-    ret = nm->mkConst(Rational(Word::getLength(s)));
+    ret = nm->mkConst(CONST_RATIONAL, Rational(Word::getLength(s)));
   }
   else if (s.getKind() == STRING_CONCAT)
   {
@@ -883,7 +887,7 @@ Node ArithEntail::getConstantBoundLength(Node s, bool isLower)
     }
     if (success)
     {
-      ret = nm->mkConst(sum);
+      ret = nm->mkConst(CONST_RATIONAL, sum);
     }
   }
   else if (isLower)
index b3e2aa457cdfb8a54d73390ddea8ee468f734b72..65ff4cde461d1d8f498789d69be61f55a7fcd992 100644 (file)
@@ -44,7 +44,7 @@ ArraySolver::ArraySolver(Env& env,
       d_eqProc(context())
 {
   NodeManager* nm = NodeManager::currentNM();
-  d_zero = nm->mkConst(Rational(0));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 ArraySolver::~ArraySolver() {}
index 1e30b1623f34eaceb6771cffffe741c966bd7e94..69d41e9d7c82520df8768546f77a9aced914cb98 100644 (file)
@@ -604,7 +604,8 @@ void BaseSolver::checkCardinalityType(TypeNode tn,
     if (lr.isConst())
     {
       // if constant, compare
-      Node cmp = nm->mkNode(GEQ, lr, nm->mkConst(Rational(card_need)));
+      Node cmp =
+          nm->mkNode(GEQ, lr, nm->mkConst(CONST_RATIONAL, Rational(card_need)));
       cmp = rewrite(cmp);
       needsSplit = !cmp.getConst<bool>();
     }
@@ -618,7 +619,7 @@ void BaseSolver::checkCardinalityType(TypeNode tn,
       bool success = true;
       while (r < card_need && success)
       {
-        Node rr = nm->mkConst(Rational(r));
+        Node rr = nm->mkConst(CONST_RATIONAL, Rational(r));
         if (d_state.areDisequal(rr, lr))
         {
           r++;
@@ -668,7 +669,7 @@ void BaseSolver::checkCardinalityType(TypeNode tn,
                           << std::endl;
     if (int_k + 1 > ei->d_cardinalityLemK.get())
     {
-      Node k_node = nm->mkConst(Rational(int_k));
+      Node k_node = nm->mkConst(CONST_RATIONAL, Rational(int_k));
       // add cardinality lemma
       Node dist = nm->mkNode(DISTINCT, cols[i]);
       std::vector<Node> expn;
index 3cf08a8d6c92356ada780b6f7d421f59ae52bdf4..cc9365d38a2834b345a1a1ac9e612205005a9435 100644 (file)
@@ -50,9 +50,9 @@ CoreSolver::CoreSolver(Env& env,
       d_nfPairs(context()),
       d_extDeq(userContext())
 {
-  d_zero = NodeManager::currentNM()->mkConst( Rational( 0 ) );
-  d_one = NodeManager::currentNM()->mkConst( Rational( 1 ) );
-  d_neg_one = NodeManager::currentNM()->mkConst(Rational(-1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+  d_neg_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1));
   d_true = NodeManager::currentNM()->mkConst( true );
   d_false = NodeManager::currentNM()->mkConst( false );
 }
@@ -776,12 +776,12 @@ Node CoreSolver::getConclusion(Node x,
     {
       // we can assume its length is greater than zero
       Node emp = Word::mkEmptyWord(sk1.getType());
-      conc = nm->mkNode(
-          AND,
-          conc,
-          sk1.eqNode(emp).negate(),
-          nm->mkNode(
-              GT, nm->mkNode(STRING_LENGTH, sk1), nm->mkConst(Rational(0))));
+      conc = nm->mkNode(AND,
+                        conc,
+                        sk1.eqNode(emp).negate(),
+                        nm->mkNode(GT,
+                                   nm->mkNode(STRING_LENGTH, sk1),
+                                   nm->mkConst(CONST_RATIONAL, Rational(0))));
     }
   }
   else if (rule == PfRule::CONCAT_CSPLIT)
index 5090b15cba34c74a23940b2d4695d8c28a11c151..edfb91c64686cc829a8a697931a916d94f76ef9d 100644 (file)
@@ -499,7 +499,7 @@ void InferProofCons::convert(InferenceId infer,
         {
           // it should be the case that lenConstraint => lenReq
           lenReq = nm->mkNode(STRING_LENGTH, t0)
-                       .eqNode(nm->mkConst(Rational(0)))
+                       .eqNode(nm->mkConst(CONST_RATIONAL, Rational(0)))
                        .notNode();
           lenSuccess = convertLengthPf(lenReq, lenConstraint, psb);
           rule = PfRule::CONCAT_CSPLIT;
@@ -530,7 +530,7 @@ void InferProofCons::convert(InferenceId infer,
         {
           // it should be the case that lenConstraint => lenReq
           lenReq = nm->mkNode(STRING_LENGTH, t0)
-                       .eqNode(nm->mkConst(Rational(0)))
+                       .eqNode(nm->mkConst(CONST_RATIONAL, Rational(0)))
                        .notNode();
           lenSuccess = convertLengthPf(lenReq, lenConstraint, psb);
           rule = PfRule::CONCAT_CPROP;
@@ -837,7 +837,7 @@ void InferProofCons::convert(InferenceId infer,
             std::vector<Node> childrenAE;
             childrenAE.push_back(eunf);
             std::vector<Node> argsAE;
-            argsAE.push_back(nm->mkConst(Rational(0)));
+            argsAE.push_back(nm->mkConst(CONST_RATIONAL, Rational(0)));
             Node eunfAE = psb.tryStep(PfRule::AND_ELIM, childrenAE, argsAE);
             Trace("strings-ipc-prefix")
                 << "--- and elim to " << eunfAE << std::endl;
index 277cc72e138d285d7b06438e8bd658df0dbbf2ea..5247e222d4ed9e6227abaae0b908438cbba23dc9 100644 (file)
@@ -51,8 +51,8 @@ InferenceManager::InferenceManager(Env& env,
                  : nullptr)
 {
   NodeManager* nm = NodeManager::currentNM();
-  d_zero = nm->mkConst(Rational(0));
-  d_one = nm->mkConst(Rational(1));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
   d_true = nm->mkConst(true);
   d_false = nm->mkConst(false);
 }
index b9038e3c82eea39e4a2a29aac6fff6d40df731ad..edb38e70266088994f751d684aa2784f27c882eb 100644 (file)
@@ -212,8 +212,8 @@ Node StringProofRuleChecker::checkInternal(PfRule id,
     else if (id == PfRule::CONCAT_CSPLIT)
     {
       Assert(children.size() == 2);
-      Node zero = nm->mkConst(Rational(0));
-      Node one = nm->mkConst(Rational(1));
+      Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+      Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
       if (children[1].getKind() != NOT || children[1][0].getKind() != EQUAL
           || children[1][0][0].getKind() != STRING_LENGTH
           || children[1][0][0][0] != t0 || children[1][0][1] != zero)
@@ -240,7 +240,7 @@ Node StringProofRuleChecker::checkInternal(PfRule id,
     else if (id == PfRule::CONCAT_CPROP)
     {
       Assert(children.size() == 2);
-      Node zero = nm->mkConst(Rational(0));
+      Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
 
       Trace("pfcheck-strings-cprop")
           << "CONCAT_PROP, isRev=" << isRev << std::endl;
@@ -352,7 +352,7 @@ Node StringProofRuleChecker::checkInternal(PfRule id,
     {
       return Node::null();
     }
-    Node zero = nm->mkConst(Rational(0));
+    Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
     Node clen = nm->mkNode(STRING_LENGTH, nemp[0][0]);
     return clen.eqNode(zero).notNode();
   }
@@ -462,7 +462,7 @@ Node StringProofRuleChecker::checkInternal(PfRule id,
            && args[1].getType().isStringLike());
     Node c1 = nm->mkNode(STRING_TO_CODE, args[0]);
     Node c2 = nm->mkNode(STRING_TO_CODE, args[1]);
-    Node eqNegOne = c1.eqNode(nm->mkConst(Rational(-1)));
+    Node eqNegOne = c1.eqNode(nm->mkConst(CONST_RATIONAL, Rational(-1)));
     Node deq = c1.eqNode(c2).negate();
     Node eqn = args[0].eqNode(args[1]);
     return nm->mkNode(kind::OR, eqNegOne, deq, eqn);
index d5b7606f2689dfaee336f27e86d0a9da85b6f26f..8a96e22d2f0bc658c87b2933c87c6a1432f6c639 100644 (file)
@@ -98,7 +98,7 @@ Node RegExpElimination::eliminateConcat(Node atom, bool isAgg)
   Node x = atom[0];
   Node lenx = nm->mkNode(STRING_LENGTH, x);
   Node re = atom[1];
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   std::vector<Node> children;
   utils::getConcat(re, children);
 
@@ -253,7 +253,9 @@ Node RegExpElimination::eliminateConcat(Node atom, bool isAgg)
       {
         // the gap to this child is at least gap_minsize[i]
         prev_end =
-            nm->mkNode(PLUS, prev_end, nm->mkConst(Rational(gap_minsize[i])));
+            nm->mkNode(PLUS,
+                       prev_end,
+                       nm->mkConst(CONST_RATIONAL, Rational(gap_minsize[i])));
       }
       prev_ends.push_back(prev_end);
       Node sc = sep_children[i];
@@ -278,8 +280,8 @@ Node RegExpElimination::eliminateConcat(Node atom, bool isAgg)
           }
           // if the gap after this one is strict, we need a non-greedy find
           // thus, we add a symbolic constant
-          Node cacheVal =
-              BoundVarManager::getCacheValue(atom, nm->mkConst(Rational(i)));
+          Node cacheVal = BoundVarManager::getCacheValue(
+              atom, nm->mkConst(CONST_RATIONAL, Rational(i)));
           TypeNode intType = nm->integerType();
           Node k =
               bvm->mkBoundVar<ReElimConcatIndexAttribute>(cacheVal, intType);
@@ -287,7 +289,8 @@ Node RegExpElimination::eliminateConcat(Node atom, bool isAgg)
           prev_end = nm->mkNode(PLUS, prev_end, k);
         }
         Node curr = nm->mkNode(STRING_INDEXOF, x, sc, prev_end);
-        Node idofFind = curr.eqNode(nm->mkConst(Rational(-1))).negate();
+        Node idofFind =
+            curr.eqNode(nm->mkConst(CONST_RATIONAL, Rational(-1))).negate();
         conj.push_back(idofFind);
         prev_end = nm->mkNode(PLUS, curr, lensc);
       }
@@ -302,7 +305,7 @@ Node RegExpElimination::eliminateConcat(Node atom, bool isAgg)
       // then the last indexof/substr constraint entails the following
       // constraint, so it is not necessary to add.
       // Below, we may write "A" for (str.to.re "A") and _ for re.allchar:
-      Node cEnd = nm->mkConst(Rational(gap_minsize_end));
+      Node cEnd = nm->mkConst(CONST_RATIONAL, Rational(gap_minsize_end));
       if (gap_exact_end)
       {
         Assert(!sep_children.empty());
@@ -474,8 +477,8 @@ Node RegExpElimination::eliminateConcat(Node atom, bool isAgg)
       }
       else
       {
-        Node cacheVal =
-            BoundVarManager::getCacheValue(atom, nm->mkConst(Rational(i)));
+        Node cacheVal = BoundVarManager::getCacheValue(
+            atom, nm->mkConst(CONST_RATIONAL, Rational(i)));
         TypeNode intType = nm->integerType();
         k = bvm->mkBoundVar<ReElimConcatIndexAttribute>(cacheVal, intType);
         Node bound =
@@ -538,7 +541,7 @@ Node RegExpElimination::eliminateStar(Node atom, bool isAgg)
   Node x = atom[0];
   Node lenx = nm->mkNode(STRING_LENGTH, x);
   Node re = atom[1];
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   // for regular expression star,
   // if the period is a fixed constant, we can turn it into a bounded
   // quantifier
@@ -558,8 +561,8 @@ Node RegExpElimination::eliminateStar(Node atom, bool isAgg)
   std::vector<Node> char_constraints;
   TypeNode intType = nm->integerType();
   Node index = bvm->mkBoundVar<ReElimStarIndexAttribute>(atom, intType);
-  Node substr_ch =
-      nm->mkNode(STRING_SUBSTR, x, index, nm->mkConst(Rational(1)));
+  Node substr_ch = nm->mkNode(
+      STRING_SUBSTR, x, index, nm->mkConst(CONST_RATIONAL, Rational(1)));
   substr_ch = Rewriter::rewrite(substr_ch);
   // handle the case where it is purely characters
   for (const Node& r : disj)
index 530f34455275690419d12941121012f857bd7654..c9d890358d4aa58bdca2ae77e381b07d48c60d83 100644 (file)
@@ -574,7 +574,7 @@ bool RegExpEntail::testConstStringInRegExp(cvc5::String& s,
               }
               else
               {
-                Node num2 = nm->mkConst(cvc5::Rational(u - 1));
+                Node num2 = nm->mkConst(CONST_RATIONAL, cvc5::Rational(u - 1));
                 Node r2 = nm->mkNode(REGEXP_LOOP, r[0], r[1], num2);
                 if (testConstStringInRegExp(s, index_start + len, r2))
                 {
@@ -606,7 +606,7 @@ bool RegExpEntail::testConstStringInRegExp(cvc5::String& s,
             cvc5::String t = s.substr(index_start, len);
             if (testConstStringInRegExp(t, 0, r[0]))
             {
-              Node num2 = nm->mkConst(cvc5::Rational(l - 1));
+              Node num2 = nm->mkConst(CONST_RATIONAL, cvc5::Rational(l - 1));
               Node r2 = nm->mkNode(REGEXP_LOOP, r[0], num2, num2);
               if (testConstStringInRegExp(s, index_start + len, r2))
               {
@@ -657,7 +657,7 @@ Node RegExpEntail::getFixedLengthForRegexp(Node n)
   }
   else if (n.getKind() == REGEXP_ALLCHAR || n.getKind() == REGEXP_RANGE)
   {
-    return nm->mkConst(Rational(1));
+    return nm->mkConst(CONST_RATIONAL, Rational(1));
   }
   else if (n.getKind() == REGEXP_UNION || n.getKind() == REGEXP_INTER)
   {
index fff512f9891036f9632506529afe1bfacc40f15c..a7ba37b183d8b8a2fa658ecb72696b806457b219 100644 (file)
@@ -37,8 +37,10 @@ RegExpOpr::RegExpOpr(Env& env, SkolemCache* sc)
       d_false(NodeManager::currentNM()->mkConst(false)),
       d_emptyRegexp(NodeManager::currentNM()->mkNode(kind::REGEXP_NONE,
                                                      std::vector<Node>{})),
-      d_zero(NodeManager::currentNM()->mkConst(::cvc5::Rational(0))),
-      d_one(NodeManager::currentNM()->mkConst(::cvc5::Rational(1))),
+      d_zero(NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                               ::cvc5::Rational(0))),
+      d_one(NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                              ::cvc5::Rational(1))),
       d_sigma(NodeManager::currentNM()->mkNode(kind::REGEXP_ALLCHAR,
                                                std::vector<Node>{})),
       d_sigma_star(
@@ -909,7 +911,7 @@ Node RegExpOpr::reduceRegExpNeg(Node mem)
   Node r = mem[0][1];
   NodeManager* nm = NodeManager::currentNM();
   Kind k = r.getKind();
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   Node conc;
   if (k == REGEXP_CONCAT)
   {
@@ -953,7 +955,7 @@ Node RegExpOpr::reduceRegExpNegConcatFixed(Node mem, Node reLen, size_t index)
   Node r = mem[0][1];
   NodeManager* nm = NodeManager::currentNM();
   Assert(r.getKind() == REGEXP_CONCAT);
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   // The following simplification states that
   //    ~( s in R1 ++ R2 ++... ++ Rn )
   // is equivalent to
@@ -1038,7 +1040,7 @@ Node RegExpOpr::reduceRegExpPos(Node mem,
       }
       else
       {
-        Node ivalue = nm->mkConst(Rational(i));
+        Node ivalue = nm->mkConst(CONST_RATIONAL, Rational(i));
         Node sk = sm->mkSkolemFunction(SkolemFunId::RE_UNFOLD_POS_COMPONENT,
                                        s.getType(),
                                        {mem[0], mem[1], ivalue});
@@ -1321,7 +1323,8 @@ Node RegExpOpr::intersectInternal( Node r1, Node r2, std::map< PairNodes, Node >
             std::map< PairNodes, Node > cache2(cache);
             cache2[p] = NodeManager::currentNM()->mkNode(
                 kind::REGEXP_RV,
-                NodeManager::currentNM()->mkConst(cvc5::Rational(cnt)));
+                NodeManager::currentNM()->mkConst(CONST_RATIONAL,
+                                                  cvc5::Rational(cnt)));
             rt = intersectInternal(r1l, r2l, cache2, cnt+1);
             cacheX[ pp ] = rt;
           }
index babf260fc2fbe034cf3ee0d3b0a328af0aa76268..721d875d015f6ff1375f5138e31f137af6cf4c17 100644 (file)
@@ -352,7 +352,7 @@ Node SequencesRewriter::rewriteStrEqualityExt(Node node)
       }
       else if (ne.getKind() == STRING_SUBSTR)
       {
-        Node zero = nm->mkConst(Rational(0));
+        Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
 
         if (d_arithEntail.check(ne[1], false)
             && d_arithEntail.check(ne[2], true))
@@ -586,7 +586,8 @@ Node SequencesRewriter::rewriteLength(Node node)
   Kind nk0 = node[0].getKind();
   if (node[0].isConst())
   {
-    Node retNode = nm->mkConst(Rational(Word::getLength(node[0])));
+    Node retNode =
+        nm->mkConst(CONST_RATIONAL, Rational(Word::getLength(node[0])));
     return returnRewrite(node, retNode, Rewrite::LEN_EVAL);
   }
   else if (nk0 == kind::STRING_CONCAT)
@@ -599,8 +600,8 @@ Node SequencesRewriter::rewriteLength(Node node)
       {
         if (tmpNode[i].isConst())
         {
-          node_vec.push_back(
-              nm->mkConst(Rational(Word::getLength(tmpNode[i]))));
+          node_vec.push_back(nm->mkConst(
+              CONST_RATIONAL, Rational(Word::getLength(tmpNode[i]))));
         }
         else
         {
@@ -633,7 +634,7 @@ Node SequencesRewriter::rewriteLength(Node node)
   }
   else if (nk0 == SEQ_UNIT)
   {
-    Node retNode = nm->mkConst(Rational(1));
+    Node retNode = nm->mkConst(CONST_RATIONAL, Rational(1));
     return returnRewrite(node, retNode, Rewrite::LEN_SEQ_UNIT);
   }
   return node;
@@ -1214,7 +1215,7 @@ Node SequencesRewriter::rewriteMembership(TNode node)
   }
   else if (r.getKind() == kind::REGEXP_ALLCHAR)
   {
-    Node one = nm->mkConst(Rational(1));
+    Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
     Node retNode = one.eqNode(nm->mkNode(STRING_LENGTH, x));
     return returnRewrite(node, retNode, Rewrite::RE_IN_SIGMA);
   }
@@ -1247,7 +1248,7 @@ Node SequencesRewriter::rewriteMembership(TNode node)
       Node flr = RegExpEntail::getFixedLengthForRegexp(r[0]);
       if (!flr.isNull())
       {
-        Node one = nm->mkConst(Rational(1));
+        Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
         if (flr == one)
         {
           NodeBuilder nb(AND);
@@ -1310,7 +1311,7 @@ Node SequencesRewriter::rewriteMembership(TNode node)
       if (constStr.isNull())
       {
         // x in re.++(_*, _, _) ---> str.len(x) >= 2
-        Node num = nm->mkConst(Rational(allSigmaMinSize));
+        Node num = nm->mkConst(CONST_RATIONAL, Rational(allSigmaMinSize));
         Node lenx = nm->mkNode(STRING_LENGTH, x);
         Node retNode = nm->mkNode(allSigmaStrict ? EQUAL : GEQ, lenx, num);
         return returnRewrite(node, retNode, Rewrite::RE_CONCAT_PURE_ALLCHAR);
@@ -1602,9 +1603,10 @@ TrustNode SequencesRewriter::expandDefinition(Node node)
     Node s = node[0];
     Node n = node[1];
     // seq.nth(s, n) --> ite(0 <= n < len(s), seq.nth_total(s,n), Uf(s, n))
-    Node cond = nm->mkNode(AND,
-                           nm->mkNode(LEQ, nm->mkConst(Rational(0)), n),
-                           nm->mkNode(LT, n, nm->mkNode(STRING_LENGTH, s)));
+    Node cond =
+        nm->mkNode(AND,
+                   nm->mkNode(LEQ, nm->mkConst(CONST_RATIONAL, Rational(0)), n),
+                   nm->mkNode(LT, n, nm->mkNode(STRING_LENGTH, s)));
     Node ss = nm->mkNode(SEQ_NTH_TOTAL, s, n);
     Node uf = SkolemCache::mkSkolemSeqNth(s.getType(), "Uf");
     Node u = nm->mkNode(APPLY_UF, uf, s, n);
@@ -1654,7 +1656,7 @@ Node SequencesRewriter::rewriteCharAt(Node node)
 {
   Assert(node.getKind() == STRING_CHARAT);
   NodeManager* nm = NodeManager::currentNM();
-  Node one = nm->mkConst(Rational(1));
+  Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
   Node retNode = nm->mkNode(STRING_SUBSTR, node[0], node[1], one);
   return returnRewrite(node, retNode, Rewrite::CHARAT_ELIM);
 }
@@ -1732,7 +1734,7 @@ Node SequencesRewriter::rewriteSubstr(Node node)
       }
     }
   }
-  Node zero = nm->mkConst(cvc5::Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, cvc5::Rational(0));
 
   // if entailed non-positive length or negative start point
   if (d_arithEntail.check(zero, node[1], true))
@@ -2331,7 +2333,7 @@ Node SequencesRewriter::rewriteIndexof(Node node)
   if (node[2].isConst() && node[2].getConst<Rational>().sgn() < 0)
   {
     // z<0  implies  str.indexof( x, y, z ) --> -1
-    Node negone = nm->mkConst(Rational(-1));
+    Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
     return returnRewrite(node, negone, Rewrite::IDOF_NEG);
   }
 
@@ -2349,7 +2351,7 @@ Node SequencesRewriter::rewriteIndexof(Node node)
       // We know that, due to limitations on the size of string constants
       // in our implementation, that accessing a position greater than
       // rMaxInt is guaranteed to be out of bounds.
-      Node negone = nm->mkConst(Rational(-1));
+      Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
       return returnRewrite(node, negone, Rewrite::IDOF_MAX);
     }
     Assert(node[2].getConst<Rational>().sgn() >= 0);
@@ -2360,12 +2362,13 @@ Node SequencesRewriter::rewriteIndexof(Node node)
     std::size_t ret = Word::find(s, t, start);
     if (ret != std::string::npos)
     {
-      Node retv = nm->mkConst(Rational(static_cast<unsigned>(ret)));
+      Node retv =
+          nm->mkConst(CONST_RATIONAL, Rational(static_cast<unsigned>(ret)));
       return returnRewrite(node, retv, Rewrite::IDOF_FIND);
     }
     else if (children0.size() == 1)
     {
-      Node negone = nm->mkConst(Rational(-1));
+      Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
       return returnRewrite(node, negone, Rewrite::IDOF_NFIND);
     }
   }
@@ -2377,14 +2380,14 @@ Node SequencesRewriter::rewriteIndexof(Node node)
       if (node[2].getConst<Rational>().sgn() == 0)
       {
         // indexof( x, x, 0 ) --> 0
-        Node zero = nm->mkConst(Rational(0));
+        Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
         return returnRewrite(node, zero, Rewrite::IDOF_EQ_CST_START);
       }
     }
     if (d_arithEntail.check(node[2], true))
     {
       // y>0  implies  indexof( x, x, y ) --> -1
-      Node negone = nm->mkConst(Rational(-1));
+      Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
       return returnRewrite(node, negone, Rewrite::IDOF_EQ_NSTART);
     }
     Node emp = Word::mkEmptyWord(stype);
@@ -2415,7 +2418,7 @@ Node SequencesRewriter::rewriteIndexof(Node node)
   if (d_arithEntail.check(len1, len0m2, true))
   {
     // len(x)-z < len(y)  implies  indexof( x, y, z ) ----> -1
-    Node negone = nm->mkConst(Rational(-1));
+    Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
     return returnRewrite(node, negone, Rewrite::IDOF_LEN);
   }
 
@@ -2497,7 +2500,7 @@ Node SequencesRewriter::rewriteIndexof(Node node)
     else
     {
       // str.contains( x, y ) --> false  implies  str.indexof(x,y,z) --> -1
-      Node negone = nm->mkConst(Rational(-1));
+      Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
       return returnRewrite(node, negone, Rewrite::IDOF_NCTN);
     }
   }
@@ -2552,12 +2555,12 @@ Node SequencesRewriter::rewriteIndexofRe(Node node)
   Node s = node[0];
   Node r = node[1];
   Node n = node[2];
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   Node slen = nm->mkNode(STRING_LENGTH, s);
 
   if (d_arithEntail.check(zero, n, true) || d_arithEntail.check(n, slen, true))
   {
-    Node ret = nm->mkConst(Rational(-1));
+    Node ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
     return returnRewrite(node, ret, Rewrite::INDEXOF_RE_INVALID_INDEX);
   }
 
@@ -2572,7 +2575,7 @@ Node SequencesRewriter::rewriteIndexofRe(Node node)
         // We know that, due to limitations on the size of string constants
         // in our implementation, that accessing a position greater than
         // rMaxInt is guaranteed to be out of bounds.
-        Node negone = nm->mkConst(Rational(-1));
+        Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
         return returnRewrite(node, negone, Rewrite::INDEXOF_RE_MAX_INDEX);
       }
 
@@ -2580,6 +2583,7 @@ Node SequencesRewriter::rewriteIndexofRe(Node node)
       Node rem = nm->mkConst(s.getConst<String>().substr(start));
       std::pair<size_t, size_t> match = firstMatch(rem, r);
       Node ret = nm->mkConst(
+          CONST_RATIONAL,
           Rational(match.first == string::npos
                        ? -1
                        : static_cast<int64_t>(start + match.first)));
@@ -2843,8 +2847,8 @@ Node SequencesRewriter::rewriteReplace(Node node)
         nm->mkNode(kind::STRING_LENGTH, utils::mkConcat(children1, stype));
     Node maxLen1 = nm->mkNode(kind::PLUS, partLen1, lastChild1[2]);
 
-    Node zero = nm->mkConst(Rational(0));
-    Node one = nm->mkConst(Rational(1));
+    Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+    Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
     Node len0 = nm->mkNode(kind::STRING_LENGTH, node[0]);
     Node len0_1 = nm->mkNode(kind::PLUS, len0, one);
     // Check len(t) + j > len(x) + 1
@@ -3367,7 +3371,8 @@ Node SequencesRewriter::rewritePrefixSuffix(Node n)
   Node val;
   if (isPrefix)
   {
-    val = NodeManager::currentNM()->mkConst(::cvc5::Rational(0));
+    val =
+        NodeManager::currentNM()->mkConst(CONST_RATIONAL, ::cvc5::Rational(0));
   }
   else
   {
index dd4093e30ee73ca02d87a245eaef588be651a5fa..eb09ff187ecdb17c6042048cf13fbe1dd84154ac 100644 (file)
@@ -54,7 +54,7 @@ SkolemCache::SkolemCache(Rewriter* rr) : d_rr(rr)
 {
   NodeManager* nm = NodeManager::currentNM();
   d_strType = nm->stringType();
-  d_zero = nm->mkConst(Rational(0));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
 }
 
 Node SkolemCache::mkSkolemCached(Node a, Node b, SkolemId id, const char* c)
@@ -217,26 +217,27 @@ SkolemCache::normalizeStringSkolem(SkolemId id, Node a, Node b)
   {
     // SK_ID_VC_SPT(x, y) ---> SK_SUFFIX_REM(x, 1)
     id = SK_SUFFIX_REM;
-    b = nm->mkConst(Rational(1));
+    b = nm->mkConst(CONST_RATIONAL, Rational(1));
   }
   else if (id == SK_ID_VC_SPT_REV)
   {
     // SK_ID_VC_SPT_REV(x, y) ---> SK_PREFIX(x, (- (str.len x) 1))
     id = SK_PREFIX;
-    b = nm->mkNode(
-        MINUS, nm->mkNode(STRING_LENGTH, a), nm->mkConst(Rational(1)));
+    b = nm->mkNode(MINUS,
+                   nm->mkNode(STRING_LENGTH, a),
+                   nm->mkConst(CONST_RATIONAL, Rational(1)));
   }
   else if (id == SK_ID_DC_SPT)
   {
     // SK_ID_DC_SPT(x, y) ---> SK_PREFIX(x, 1)
     id = SK_PREFIX;
-    b = nm->mkConst(Rational(1));
+    b = nm->mkConst(CONST_RATIONAL, Rational(1));
   }
   else if (id == SK_ID_DC_SPT_REM)
   {
     // SK_ID_DC_SPT_REM(x, y) ---> SK_SUFFIX_REM(x, 1)
     id = SK_SUFFIX_REM;
-    b = nm->mkConst(Rational(1));
+    b = nm->mkConst(CONST_RATIONAL, Rational(1));
   }
   else if (id == SK_ID_DEQ_X)
   {
index dfb246954bd97a702c0c5a54e4eaa706f02d4c5b..045347cbb6fdc87ff04e78559d24e4f9fb03e48e 100644 (file)
@@ -34,7 +34,7 @@ SolverState::SolverState(Env& env, Valuation& v)
       d_pendingConflictSet(env.getContext(), false),
       d_pendingConflict(InferenceId::UNKNOWN)
 {
-  d_zero = NodeManager::currentNM()->mkConst(Rational(0));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
   d_false = NodeManager::currentNM()->mkConst(false);
 }
 
index 3b90338fc82ec64ab275948c3260997fbba8a60b..6e4ba25a564de19a68db71a6bba36e8bf5326ddd 100644 (file)
@@ -123,7 +123,7 @@ bool StringsEntail::stripSymbolicLength(std::vector<Node>& n1,
   Assert(dir == 1 || dir == -1);
   Assert(nr.empty());
   NodeManager* nm = NodeManager::currentNM();
-  Node zero = nm->mkConst(cvc5::Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, cvc5::Rational(0));
   bool ret = false;
   bool success = true;
   unsigned sindex = 0;
@@ -145,7 +145,7 @@ bool StringsEntail::stripSymbolicLength(std::vector<Node>& n1,
           Assert(d_arithEntail.check(curr, true));
           Node s = n1[sindex_use];
           size_t slen = Word::getLength(s);
-          Node ncl = nm->mkConst(cvc5::Rational(slen));
+          Node ncl = nm->mkConst(CONST_RATIONAL, cvc5::Rational(slen));
           Node next_s = nm->mkNode(MINUS, lowerBound, ncl);
           next_s = d_rr->rewrite(next_s);
           Assert(next_s.isConst());
@@ -459,8 +459,10 @@ bool StringsEntail::componentContainsBase(
               }
               if (dir != -1)
               {
-                n1rb = nm->mkNode(
-                    STRING_SUBSTR, n2[0], nm->mkConst(Rational(0)), start_pos);
+                n1rb = nm->mkNode(STRING_SUBSTR,
+                                  n2[0],
+                                  nm->mkConst(CONST_RATIONAL, Rational(0)),
+                                  start_pos);
               }
               if (dir != 1)
               {
@@ -712,7 +714,7 @@ bool StringsEntail::checkNonEmpty(Node a)
 bool StringsEntail::checkLengthOne(Node s, bool strict)
 {
   NodeManager* nm = NodeManager::currentNM();
-  Node one = nm->mkConst(Rational(1));
+  Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
   Node len = nm->mkNode(STRING_LENGTH, s);
   len = d_rr->rewrite(len);
   return d_arithEntail.check(one, len)
index b1050f480849a4d64924ad371929f816020a308c..2951c86a2108449c9e8f81d0adabd9c7e672d1be 100644 (file)
@@ -85,7 +85,8 @@ Node StringsFmf::StringSumLengthDecisionStrategy::mkLiteral(unsigned i)
     return Node::null();
   }
   NodeManager* nm = NodeManager::currentNM();
-  Node lit = nm->mkNode(LEQ, d_inputVarLsum.get(), nm->mkConst(Rational(i)));
+  Node lit = nm->mkNode(
+      LEQ, d_inputVarLsum.get(), nm->mkConst(CONST_RATIONAL, Rational(i)));
   Trace("strings-fmf") << "StringsFMF::mkLiteral: " << lit << std::endl;
   return lit;
 }
index 46b36986a3134edfef6326cc540128d8ce94568a..e4b91d4d81d1083c2b81ff987e2629d53d903b3c 100644 (file)
@@ -100,11 +100,11 @@ Node StringsRewriter::rewriteStrToInt(Node node)
     String s = node[0].getConst<String>();
     if (s.isNumber())
     {
-      ret = nm->mkConst(s.toNumber());
+      ret = nm->mkConst(CONST_RATIONAL, s.toNumber());
     }
     else
     {
-      ret = nm->mkConst(Rational(-1));
+      ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
     }
     return returnRewrite(node, ret, Rewrite::STOI_EVAL);
   }
@@ -117,7 +117,7 @@ Node StringsRewriter::rewriteStrToInt(Node node)
         String t = nc.getConst<String>();
         if (!t.isNumber())
         {
-          Node ret = nm->mkConst(Rational(-1));
+          Node ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
           return returnRewrite(node, ret, Rewrite::STOI_CONCAT_NONNUM);
         }
       }
@@ -303,11 +303,11 @@ Node StringsRewriter::rewriteStringToCode(Node n)
     {
       std::vector<unsigned> vec = s.getVec();
       Assert(vec.size() == 1);
-      ret = nm->mkConst(Rational(vec[0]));
+      ret = nm->mkConst(CONST_RATIONAL, Rational(vec[0]));
     }
     else
     {
-      ret = nm->mkConst(Rational(-1));
+      ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
     }
     return returnRewrite(n, ret, Rewrite::TO_CODE_EVAL);
   }
@@ -320,9 +320,10 @@ Node StringsRewriter::rewriteStringIsDigit(Node n)
   NodeManager* nm = NodeManager::currentNM();
   // eliminate str.is_digit(s) ----> 48 <= str.to_code(s) <= 57
   Node t = nm->mkNode(STRING_TO_CODE, n[0]);
-  Node retNode = nm->mkNode(AND,
-                            nm->mkNode(LEQ, nm->mkConst(Rational(48)), t),
-                            nm->mkNode(LEQ, t, nm->mkConst(Rational(57))));
+  Node retNode =
+      nm->mkNode(AND,
+                 nm->mkNode(LEQ, nm->mkConst(CONST_RATIONAL, Rational(48)), t),
+                 nm->mkNode(LEQ, t, nm->mkConst(CONST_RATIONAL, Rational(57))));
   return returnRewrite(n, retNode, Rewrite::IS_DIGIT_ELIM);
 }
 
index 1124be488618c88e80ac91a00775cac39a5e1ba5..85027370ea5048583f1466cd88c7f21edaf05cbc 100644 (file)
@@ -60,9 +60,9 @@ TermRegistry::TermRegistry(Env& env,
               : nullptr)
 {
   NodeManager* nm = NodeManager::currentNM();
-  d_zero = nm->mkConst(Rational(0));
-  d_one = nm->mkConst(Rational(1));
-  d_negOne = NodeManager::currentNM()->mkConst(Rational(-1));
+  d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
+  d_negOne = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1));
   Assert(options().strings.stringsAlphaCard <= String::num_codes());
   d_alphaCard = options().strings.stringsAlphaCard;
 }
@@ -81,12 +81,13 @@ Node TermRegistry::eagerReduce(Node t, SkolemCache* sc, uint32_t alphaCard)
   if (tk == STRING_TO_CODE)
   {
     // ite( str.len(s)==1, 0 <= str.code(s) < |A|, str.code(s)=-1 )
-    Node code_len = utils::mkNLength(t[0]).eqNode(nm->mkConst(Rational(1)));
-    Node code_eq_neg1 = t.eqNode(nm->mkConst(Rational(-1)));
-    Node code_range =
-        nm->mkNode(AND,
-                   nm->mkNode(GEQ, t, nm->mkConst(Rational(0))),
-                   nm->mkNode(LT, t, nm->mkConst(Rational(alphaCard))));
+    Node code_len =
+        utils::mkNLength(t[0]).eqNode(nm->mkConst(CONST_RATIONAL, Rational(1)));
+    Node code_eq_neg1 = t.eqNode(nm->mkConst(CONST_RATIONAL, Rational(-1)));
+    Node code_range = nm->mkNode(
+        AND,
+        nm->mkNode(GEQ, t, nm->mkConst(CONST_RATIONAL, Rational(0))),
+        nm->mkNode(LT, t, nm->mkConst(CONST_RATIONAL, Rational(alphaCard))));
     lemma = nm->mkNode(ITE, code_len, code_range, code_eq_neg1);
   }
   else if (tk == STRING_INDEXOF || tk == STRING_INDEXOF_RE)
@@ -99,14 +100,15 @@ Node TermRegistry::eagerReduce(Node t, SkolemCache* sc, uint32_t alphaCard)
     Node l = nm->mkNode(STRING_LENGTH, t[0]);
     lemma = nm->mkNode(
         AND,
-        nm->mkNode(
-            OR, t.eqNode(nm->mkConst(Rational(-1))), nm->mkNode(GEQ, t, t[2])),
+        nm->mkNode(OR,
+                   t.eqNode(nm->mkConst(CONST_RATIONAL, Rational(-1))),
+                   nm->mkNode(GEQ, t, t[2])),
         nm->mkNode(LEQ, t, l));
   }
   else if (tk == STRING_STOI)
   {
     // (>= (str.to_int x) (- 1))
-    lemma = nm->mkNode(GEQ, t, nm->mkConst(Rational(-1)));
+    lemma = nm->mkNode(GEQ, t, nm->mkConst(CONST_RATIONAL, Rational(-1)));
   }
   else if (tk == STRING_CONTAINS)
   {
@@ -124,7 +126,7 @@ Node TermRegistry::eagerReduce(Node t, SkolemCache* sc, uint32_t alphaCard)
 Node TermRegistry::lengthPositive(Node t)
 {
   NodeManager* nm = NodeManager::currentNM();
-  Node zero = nm->mkConst(Rational(0));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
   Node emp = Word::mkEmptyWord(t.getType());
   Node tlen = nm->mkNode(STRING_LENGTH, t);
   Node tlenEqZero = tlen.eqNode(zero);
@@ -414,7 +416,7 @@ TrustNode TermRegistry::getRegisterTermLemma(Node n)
   }
   else if (n.isConst())
   {
-    lsum = nm->mkConst(Rational(Word::getLength(n)));
+    lsum = nm->mkConst(CONST_RATIONAL, Rational(Word::getLength(n)));
   }
   Assert(!lsum.isNull());
   d_proxyVarToLength[sk] = lsum;
@@ -484,7 +486,7 @@ bool TermRegistry::isHandledUpdate(Node n)
   {
     lenN = nm->mkNode(STRING_LENGTH, n[2]);
   }
-  Node one = nm->mkConst(Rational(1));
+  Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
   return d_aent.checkEq(lenN, one);
 }
 
index 799becd2927e0f344efd1311046a025b06a2c3c5..8324e3edbd488287c4c17b372aebd1366cfac6a7 100644 (file)
@@ -83,9 +83,9 @@ TheoryStrings::TheoryStrings(Env& env, OutputChannel& out, Valuation valuation)
 {
   d_termReg.finishInit(&d_im);
 
-  d_zero = NodeManager::currentNM()->mkConst( Rational( 0 ) );
-  d_one = NodeManager::currentNM()->mkConst( Rational( 1 ) );
-  d_neg_one = NodeManager::currentNM()->mkConst(Rational(-1));
+  d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+  d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+  d_neg_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(-1));
   d_true = NodeManager::currentNM()->mkConst( true );
   d_false = NodeManager::currentNM()->mkConst( false );
 
@@ -421,7 +421,7 @@ bool TheoryStrings::collectModelInfoType(
           lvalue++;
         }
         Trace("strings-model") << "*** Decide to make length of " << lvalue << std::endl;
-        lts_values[i] = nm->mkConst(Rational(lvalue));
+        lts_values[i] = nm->mkConst(CONST_RATIONAL, Rational(lvalue));
         values_used[lvalue] = Node::null();
       }
       Trace("strings-model") << "Need to assign values of length " << lts_values[i] << " to equivalence classes ";
@@ -1006,7 +1006,8 @@ TrustNode TheoryStrings::ppRewrite(TNode atom, std::vector<SkolemLemma>& lems)
     SkolemCache* sc = d_termReg.getSkolemCache();
     Node k = sc->mkSkolemCached(atom, SkolemCache::SK_PURIFY, "kFromCode");
     Node t = atom[0];
-    Node card = nm->mkConst(Rational(d_termReg.getAlphabetCardinality()));
+    Node card = nm->mkConst(CONST_RATIONAL,
+                            Rational(d_termReg.getAlphabetCardinality()));
     Node cond =
         nm->mkNode(AND, nm->mkNode(LEQ, d_zero, t), nm->mkNode(LT, t, card));
     Node emp = Word::mkEmptyWord(atom.getType());
index 31f43d565b8facd5a7d5ccb171a2cf9b0b73c282..4f27371ffad7ceb916ad0d281ac5f05fcc5ef590 100644 (file)
@@ -53,9 +53,9 @@ Node StringsPreprocess::reduce(Node t,
       << "StringsPreprocess::reduce: " << t << std::endl;
   Node retNode = t;
   NodeManager* nm = NodeManager::currentNM();
-  Node zero = nm->mkConst(Rational(0));
-  Node one = nm->mkConst(Rational(1));
-  Node negOne = nm->mkConst(Rational(-1));
+  Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+  Node negOne = nm->mkConst(CONST_RATIONAL, Rational(-1));
 
   if( t.getKind() == kind::STRING_SUBSTR ) {
     // processing term:  substr( s, n, m )
@@ -184,7 +184,7 @@ Node StringsPreprocess::reduce(Node t,
     Node skk = sc->mkTypedSkolemCached(
         nm->integerType(), t, SkolemCache::SK_PURIFY, "iok");
 
-    Node negone = nm->mkConst(Rational(-1));
+    Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
 
     // substr( x, n, len( x ) - n )
     Node st = nm->mkNode(STRING_SUBSTR,
@@ -364,7 +364,7 @@ Node StringsPreprocess::reduce(Node t,
     Node c0 = nm->mkNode(STRING_TO_CODE, nm->mkConst(String("0")));
     Node c = nm->mkNode(MINUS, nm->mkNode(STRING_TO_CODE, sx), c0);
 
-    Node ten = nm->mkConst(Rational(10));
+    Node ten = nm->mkConst(CONST_RATIONAL, Rational(10));
     Node eq = ux1.eqNode(nm->mkNode(PLUS, c, nm->mkNode(MULT, ten, ux)));
     Node leadingZeroPos =
         nm->mkNode(AND, x.eqNode(zero), nm->mkNode(GT, leni, one));
@@ -431,7 +431,7 @@ Node StringsPreprocess::reduce(Node t,
         MINUS,
         nm->mkNode(STRING_TO_CODE, nm->mkNode(STRING_SUBSTR, s, k, one)),
         c0);
-    Node ten = nm->mkConst(Rational(10));
+    Node ten = nm->mkConst(CONST_RATIONAL, Rational(10));
     Node kc3 = nm->mkNode(
         OR, nm->mkNode(LT, codeSk, zero), nm->mkNode(GEQ, codeSk, ten));
     conc1.push_back(nm->mkNode(OR, sEmpty, nm->mkNode(AND, kc1, kc2, kc3)));
@@ -865,10 +865,12 @@ Node StringsPreprocess::reduce(Node t,
     Node ci = nm->mkNode(STRING_TO_CODE, nm->mkNode(STRING_SUBSTR, x, i, one));
     Node ri = nm->mkNode(STRING_TO_CODE, nm->mkNode(STRING_SUBSTR, r, i, one));
 
-    Node lb = nm->mkConst(Rational(t.getKind() == STRING_TOUPPER ? 97 : 65));
-    Node ub = nm->mkConst(Rational(t.getKind() == STRING_TOUPPER ? 122 : 90));
-    Node offset =
-        nm->mkConst(Rational(t.getKind() == STRING_TOUPPER ? -32 : 32));
+    Node lb = nm->mkConst(CONST_RATIONAL,
+                          Rational(t.getKind() == STRING_TOUPPER ? 97 : 65));
+    Node ub = nm->mkConst(CONST_RATIONAL,
+                          Rational(t.getKind() == STRING_TOUPPER ? 122 : 90));
+    Node offset = nm->mkConst(
+        CONST_RATIONAL, Rational(t.getKind() == STRING_TOUPPER ? -32 : 32));
 
     Node res = nm->mkNode(
         ITE,
index 59bb0755cd32555bf91c9999cf653deb07b0cc54..a133babba2f00b14557b6cc7a59882c7262af04d 100644 (file)
@@ -165,7 +165,8 @@ Node mkNLength(Node t)
 Node mkPrefix(Node t, Node n)
 {
   NodeManager* nm = NodeManager::currentNM();
-  return nm->mkNode(STRING_SUBSTR, t, nm->mkConst(Rational(0)), n);
+  return nm->mkNode(
+      STRING_SUBSTR, t, nm->mkConst(CONST_RATIONAL, Rational(0)), n);
 }
 
 Node mkSuffix(Node t, Node n)
index df8fb9383850af86fca50b8e750574d83d632347..8dac2cfda0196bfe32f73c9725d3928ef3e1cd32 100644 (file)
@@ -140,8 +140,8 @@ TEST_F(TestNodeBlackNodeAlgorithm, match)
 {
   TypeNode integer = d_nodeManager->integerType();
 
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
 
   Node x = d_nodeManager->mkBoundVar(integer);
   Node a = d_skolemManager->mkDummySkolem("a", integer);
index b170ccbb646aaa87eb44e59490054e2f442ea480..50e766e6183cb8d646b507bb00e654d7d1d74e6a 100644 (file)
@@ -732,15 +732,15 @@ TEST_F(TestNodeBlackNode, isConst)
   Node cons_1_nil =
       d_nodeManager->mkNode(APPLY_CONSTRUCTOR,
                             cons,
-                            d_nodeManager->mkConst(Rational(1)),
+                            d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)),
                             d_nodeManager->mkNode(APPLY_CONSTRUCTOR, nil));
   Node cons_1_cons_2_nil = d_nodeManager->mkNode(
       APPLY_CONSTRUCTOR,
       cons,
-      d_nodeManager->mkConst(Rational(1)),
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)),
       d_nodeManager->mkNode(APPLY_CONSTRUCTOR,
                             cons,
-                            d_nodeManager->mkConst(Rational(2)),
+                            d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)),
                             d_nodeManager->mkNode(APPLY_CONSTRUCTOR, nil)));
   ASSERT_TRUE(d_nodeManager->mkNode(APPLY_CONSTRUCTOR, nil).isConst());
   ASSERT_FALSE(cons_x_nil.isConst());
@@ -749,8 +749,8 @@ TEST_F(TestNodeBlackNode, isConst)
 
   TypeNode arrType = d_nodeManager->mkArrayType(d_nodeManager->integerType(),
                                                 d_nodeManager->integerType());
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   Node storeAll = d_nodeManager->mkConst(ArrayStoreAll(arrType, zero));
   ASSERT_TRUE(storeAll.isConst());
 
index 05ccfc90ce6bb12f0d8985ff0bfc7014843010e7..779397e047e249df0fa6d9eb097fd8b275df3971 100644 (file)
@@ -312,7 +312,7 @@ TEST_F(TestNodeBlackNodeBuilder, append)
 
   Node p = d_nodeManager->mkNode(
       EQUAL,
-      d_nodeManager->mkConst<Rational>(0),
+      d_nodeManager->mkConst<Rational>(CONST_RATIONAL, 0),
       d_nodeManager->mkNode(PLUS, r, d_nodeManager->mkNode(UMINUS, s), t));
   Node q = d_nodeManager->mkNode(AND, x, z, d_nodeManager->mkNode(NOT, y));
 
index b02790cb5cb64ea2c5a26eaa6ec4589684f6c7fd..ad41155c3c0b56c2181f339751fdd0c69a0def02 100644 (file)
@@ -140,7 +140,7 @@ TEST_F(TestNodeBlackNodeManager, mkConst_bool)
 TEST_F(TestNodeBlackNodeManager, mkConst_rational)
 {
   Rational r("3/2");
-  Node n = d_nodeManager->mkConst(r);
+  Node n = d_nodeManager->mkConst(CONST_RATIONAL, r);
   ASSERT_EQ(n.getConst<Rational>(), r);
 }
 
index fe06f85d35d1558f083af2fdc247bde5dd3271de..64f6a70f55e0fb901155d8ad27ce074a683e88b3 100644 (file)
@@ -23,6 +23,7 @@
 namespace cvc5 {
 
 using namespace cvc5::expr;
+using namespace cvc5::kind;
 
 namespace test {
 
@@ -33,8 +34,8 @@ class TestNodeWhiteNodeManager : public TestNode
 TEST_F(TestNodeWhiteNodeManager, mkConst_rational)
 {
   Rational i("3");
-  Node n = d_nodeManager->mkConst(i);
-  Node m = d_nodeManager->mkConst(i);
+  Node n = d_nodeManager->mkConst(CONST_RATIONAL, i);
+  Node m = d_nodeManager->mkConst(CONST_RATIONAL, i);
   ASSERT_EQ(n.getId(), m.getId());
 }
 
index eb6f77bdc904175968757fa86de634e6c9d9d155..8061526d5c95126485f20bc2d7c436d9f5e5859c 100644 (file)
@@ -49,7 +49,7 @@ TEST_F(TestNodeWhiteNode, iterators)
   Node x = d_nodeManager->mkVar("x", d_nodeManager->integerType());
   Node y = d_nodeManager->mkVar("y", d_nodeManager->integerType());
   Node x_plus_y = d_nodeManager->mkNode(PLUS, x, y);
-  Node two = d_nodeManager->mkConst(Rational(2));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
   Node x_times_2 = d_nodeManager->mkNode(MULT, x, two);
 
   Node n = d_nodeManager->mkNode(PLUS, x_times_2, x_plus_y, y);
index 9f93017f0bfc568db5112b754c712d8d1731fe68..424fee98961bfae8ac4be6b591ba3525765b849a 100644 (file)
@@ -50,7 +50,8 @@ TEST_F(TestNodeWhiteTypeNode, sub_types)
   TypeNode bvType = d_nodeManager->mkBitVectorType(32);
 
   Node x = d_nodeManager->mkBoundVar("x", realType);
-  Node xPos = d_nodeManager->mkNode(GT, x, d_nodeManager->mkConst(Rational(0)));
+  Node xPos = d_nodeManager->mkNode(
+      GT, x, d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
   TypeNode funtype = d_nodeManager->mkFunctionType(integerType, booleanType);
   Node lambda = d_nodeManager->mkVar("lambda", funtype);
   std::vector<Node> formals;
index a6af293150a605686a1104866821409cfc3956d3..6687f245967270d47609453d6ed80b6b77fcb142 100644 (file)
 #include "test_smt.h"
 #include "util/rational.h"
 
-namespace cvc5 {
-
-using namespace preprocessing::passes;
+using namespace cvc5::kind;
+using namespace cvc5::preprocessing::passes;
 
+namespace cvc5 {
 namespace test {
 
 class TestPPWhiteForeignTheoryRewrite : public TestSmt
@@ -35,7 +35,7 @@ TEST_F(TestPPWhiteForeignTheoryRewrite, simplify)
   std::cout << "len(x) >= 0 is simplified to true" << std::endl;
   Node x = d_nodeManager->mkVar("x", d_nodeManager->stringType());
   Node len_x = d_nodeManager->mkNode(kind::STRING_LENGTH, x);
-  Node zero = d_nodeManager->mkConst<Rational>(0);
+  Node zero = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, 0);
   Node geq1 = d_nodeManager->mkNode(kind::GEQ, len_x, zero);
   Node tt = d_nodeManager->mkConst<bool>(true);
   Node simplified1 = ftr.foreignRewrite(geq1);
index 3e0bb6c17f1954c8c45b7a6ed08204a24ce2b753..9127fadff01d43d02e9594bb479f02b50f1d2af1 100644 (file)
@@ -40,9 +40,9 @@ class TestTheoryWhiteArithPolyNorm : public TestSmt
 TEST_F(TestTheoryWhiteArithPolyNorm, check_poly_norm_int)
 {
   TypeNode intType = d_nodeManager->integerType();
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
   Node x = d_nodeManager->mkVar("x", intType);
   Node y = d_nodeManager->mkVar("y", intType);
   Node z = d_nodeManager->mkVar("z", intType);
@@ -101,10 +101,10 @@ TEST_F(TestTheoryWhiteArithPolyNorm, check_poly_norm_int)
 TEST_F(TestTheoryWhiteArithPolyNorm, check_poly_norm_real)
 {
   TypeNode realType = d_nodeManager->realType();
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node half = d_nodeManager->mkConst(Rational(1) / Rational(2));
-  Node two = d_nodeManager->mkConst(Rational(2));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node half = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1) / Rational(2));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
   Node x = d_nodeManager->mkVar("x", realType);
   Node y = d_nodeManager->mkVar("y", realType);
 
index 438f28c2d788398b6e1c7bbecc01916acb5c8624..4ff6d174f0167ec9404df676e64e907ce254f658 100644 (file)
 #include "theory/rewriter.h"
 #include "util/rational.h"
 
-namespace cvc5 {
-
-using namespace theory;
+using namespace cvc5::kind;
+using namespace cvc5::theory;
 
+namespace cvc5 {
 namespace test {
 
 class TestTheoryWhiteEvaluator : public TestSmt
@@ -103,8 +103,8 @@ TEST_F(TestTheoryWhiteEvaluator, strIdOf)
 {
   Node a = d_nodeManager->mkConst(String("A"));
   Node empty = d_nodeManager->mkConst(String(""));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
 
   std::vector<Node> args;
   std::vector<Node> vals;
@@ -150,14 +150,14 @@ TEST_F(TestTheoryWhiteEvaluator, code)
   {
     Node n = d_nodeManager->mkNode(kind::STRING_TO_CODE, a);
     Node r = eval.eval(n, args, vals);
-    ASSERT_EQ(r, d_nodeManager->mkConst(Rational(65)));
+    ASSERT_EQ(r, d_nodeManager->mkConst(CONST_RATIONAL, Rational(65)));
   }
 
   // (str.code "") ---> -1
   {
     Node n = d_nodeManager->mkNode(kind::STRING_TO_CODE, empty);
     Node r = eval.eval(n, args, vals);
-    ASSERT_EQ(r, d_nodeManager->mkConst(Rational(-1)));
+    ASSERT_EQ(r, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1)));
   }
 }
 }  // namespace test
index 165479b7802214590302b854e48a9f4433459b96..005e5cc3f8902cda56080e27e4a25333a3db7891 100644 (file)
 #include "util/rational.h"
 #include "util/string.h"
 
-namespace cvc5 {
-
-using namespace theory;
-using namespace theory::strings;
+using namespace cvc5::kind;
+using namespace cvc5::theory;
+using namespace cvc5::theory::strings;
 
+namespace cvc5 {
 namespace test {
 
 class TestTheoryWhiteSequencesRewriter : public TestSmt
@@ -93,11 +93,11 @@ TEST_F(TestTheoryWhiteSequencesRewriter, check_entail_length_one)
   Node b = d_nodeManager->mkConst(::cvc5::String("B"));
   Node x = d_nodeManager->mkVar("x", strType);
   Node y = d_nodeManager->mkVar("y", strType);
-  Node negOne = d_nodeManager->mkConst(Rational(-1));
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
-  Node three = d_nodeManager->mkConst(Rational(3));
+  Node negOne = d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
   Node i = d_nodeManager->mkVar("i", intType);
 
   ASSERT_TRUE(se.checkLengthOne(a));
@@ -128,7 +128,7 @@ TEST_F(TestTheoryWhiteSequencesRewriter, check_entail_arith)
 
   Node z = d_nodeManager->mkVar("z", strType);
   Node n = d_nodeManager->mkVar("n", intType);
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
 
   // 1 >= (str.len (str.substr z n 1)) ---> true
   Node substr_z = d_nodeManager->mkNode(
@@ -150,8 +150,8 @@ TEST_F(TestTheoryWhiteSequencesRewriter, check_entail_with_with_assumption)
   Node y = d_nodeManager->mkVar("y", strType);
   Node z = d_nodeManager->mkVar("z", intType);
 
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
 
   Node empty = d_nodeManager->mkConst(::cvc5::String(""));
   Node a = d_nodeManager->mkConst(::cvc5::String("A"));
@@ -184,8 +184,8 @@ TEST_F(TestTheoryWhiteSequencesRewriter, check_entail_with_with_assumption)
   ASSERT_TRUE(ae.checkWithAssumption(
       x_plus_slen_y_plus_slen_y_eq_zero, zero, x, false));
 
-  Node five = d_nodeManager->mkConst(Rational(5));
-  Node six = d_nodeManager->mkConst(Rational(6));
+  Node five = d_nodeManager->mkConst(CONST_RATIONAL, Rational(5));
+  Node six = d_nodeManager->mkConst(CONST_RATIONAL, Rational(6));
   Node x_plus_five = d_nodeManager->mkNode(kind::PLUS, x, five);
   Node x_plus_five_lt_six =
       d_rewriter->rewrite(d_nodeManager->mkNode(kind::LT, x_plus_five, six));
@@ -226,11 +226,11 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_substr)
   Node a = d_nodeManager->mkConst(::cvc5::String("A"));
   Node b = d_nodeManager->mkConst(::cvc5::String("B"));
   Node abcd = d_nodeManager->mkConst(::cvc5::String("ABCD"));
-  Node negone = d_nodeManager->mkConst(Rational(-1));
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
-  Node three = d_nodeManager->mkConst(Rational(3));
+  Node negone = d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
 
   Node s = d_nodeManager->mkVar("s", strType);
   Node s2 = d_nodeManager->mkVar("s2", strType);
@@ -246,7 +246,8 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_substr)
   n = d_nodeManager->mkNode(
       kind::STRING_SUBSTR,
       a,
-      d_nodeManager->mkNode(kind::PLUS, x, d_nodeManager->mkConst(Rational(1))),
+      d_nodeManager->mkNode(
+          kind::PLUS, x, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1))),
       x);
   sameNormalForm(n, empty);
 
@@ -362,8 +363,8 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_concat)
 
   Node empty = d_nodeManager->mkConst(::cvc5::String(""));
   Node a = d_nodeManager->mkConst(::cvc5::String("A"));
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node three = d_nodeManager->mkConst(Rational(3));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
 
   Node i = d_nodeManager->mkVar("i", intType);
   Node s = d_nodeManager->mkVar("s", strType);
@@ -468,11 +469,11 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_indexOf)
   Node ccc = d_nodeManager->mkConst(::cvc5::String("CCC"));
   Node x = d_nodeManager->mkVar("x", strType);
   Node y = d_nodeManager->mkVar("y", strType);
-  Node negOne = d_nodeManager->mkConst(Rational(-1));
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
-  Node three = d_nodeManager->mkConst(Rational(3));
+  Node negOne = d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
   Node i = d_nodeManager->mkVar("i", intType);
   Node j = d_nodeManager->mkVar("j", intType);
 
@@ -549,8 +550,8 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_replace)
   Node x = d_nodeManager->mkVar("x", strType);
   Node y = d_nodeManager->mkVar("y", strType);
   Node z = d_nodeManager->mkVar("z", strType);
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   Node n = d_nodeManager->mkVar("n", intType);
 
   // (str.replace (str.replace x "B" x) x "A") -->
@@ -970,10 +971,10 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_contains)
   Node z = d_nodeManager->mkVar("z", strType);
   Node n = d_nodeManager->mkVar("n", intType);
   Node m = d_nodeManager->mkVar("m", intType);
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
-  Node three = d_nodeManager->mkConst(Rational(3));
-  Node four = d_nodeManager->mkConst(Rational(4));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
+  Node four = d_nodeManager->mkConst(CONST_RATIONAL, Rational(4));
   Node t = d_nodeManager->mkConst(true);
   Node f = d_nodeManager->mkConst(false);
 
@@ -1396,9 +1397,9 @@ TEST_F(TestTheoryWhiteSequencesRewriter, rewrite_equality_ext)
   Node xxa = d_nodeManager->mkNode(kind::STRING_CONCAT, x, x, a);
   Node f = d_nodeManager->mkConst(false);
   Node n = d_nodeManager->mkVar("n", intType);
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node three = d_nodeManager->mkConst(Rational(3));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
 
   // Same normal form for:
   //
index 719b76cab89e98bdd96d32d3d0117d5890232402..8d5ca9923153ada07e3c43a11922ff30584d779e 100644 (file)
@@ -37,6 +37,7 @@
 namespace cvc5::test {
 
 using namespace cvc5;
+using namespace cvc5::kind;
 using namespace cvc5::theory;
 using namespace cvc5::theory::arith;
 using namespace cvc5::theory::arith::nl;
@@ -54,7 +55,10 @@ class TestTheoryWhiteArithCAD : public TestSmt
     nodeManager = d_nodeManager;
   }
 
-  Node dummy(int i) const { return d_nodeManager->mkConst(Rational(i)); }
+  Node dummy(int i) const
+  {
+    return d_nodeManager->mkConst(CONST_RATIONAL, Rational(i));
+  }
 
   Theory::Effort d_level = Theory::EFFORT_FULL;
   std::unique_ptr<TypeNode> d_realType;
@@ -181,14 +185,15 @@ TEST_F(TestTheoryWhiteArithCAD, lazard_simp)
   Node a = d_nodeManager->mkVar(*d_realType);
   Node c = d_nodeManager->mkVar(*d_realType);
   Node orig = d_nodeManager->mkAnd(std::vector<Node>{
-      d_nodeManager->mkNode(Kind::EQUAL, a, d_nodeManager->mkConst(d_zero)),
+      d_nodeManager->mkNode(
+          Kind::EQUAL, a, d_nodeManager->mkConst(CONST_RATIONAL, d_zero)),
       d_nodeManager->mkNode(
           Kind::EQUAL,
           d_nodeManager->mkNode(
               Kind::PLUS,
               d_nodeManager->mkNode(Kind::NONLINEAR_MULT, a, c),
-              d_nodeManager->mkConst(d_one)),
-          d_nodeManager->mkConst(d_zero))});
+              d_nodeManager->mkConst(CONST_RATIONAL, d_one)),
+          d_nodeManager->mkConst(CONST_RATIONAL, d_zero))});
 
   {
     Node rewritten = Rewriter::rewrite(orig);
@@ -356,10 +361,10 @@ void test_delta(const std::vector<Node>& a)
 TEST_F(TestTheoryWhiteArithCAD, test_delta_one)
 {
   std::vector<Node> a;
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node mone = d_nodeManager->mkConst(Rational(-1));
-  Node fifth = d_nodeManager->mkConst(Rational(1, 2));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node mone = d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1));
+  Node fifth = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 2));
   Node g = make_real_variable("g");
   Node l = make_real_variable("l");
   Node q = make_real_variable("q");
@@ -379,10 +384,10 @@ TEST_F(TestTheoryWhiteArithCAD, test_delta_one)
 TEST_F(TestTheoryWhiteArithCAD, test_delta_two)
 {
   std::vector<Node> a;
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node mone = d_nodeManager->mkConst(Rational(-1));
-  Node fifth = d_nodeManager->mkConst(Rational(1, 2));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node mone = d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1));
+  Node fifth = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 2));
   Node g = make_real_variable("g");
   Node l = make_real_variable("l");
   Node q = make_real_variable("q");
index 6970734348125bd605b469ce75ab2d93dcee30bf..fd942c5b50709ac3ff53a1370b0427d90bef3b88 100644 (file)
@@ -37,7 +37,7 @@ class TestTheoryWhiteArithPow2 : public TestSmtNoFinishInit
     d_slvEngine->setOption("produce-models", "true");
     d_slvEngine->finishInit();
     d_true = d_nodeManager->mkConst<bool>(true);
-    d_one = d_nodeManager->mkConst<Rational>(Rational(1));
+    d_one = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, Rational(1));
   }
   Node d_true;
   Node d_one;
index a41378106d3eabac8a1ee34a00a2186539573693..8805c7119a7c55d055e182f5b6f61eaf289d8c8f 100644 (file)
@@ -68,7 +68,7 @@ class TestTheoryWhiteArith : public TestSmtNoFinishInit
 TEST_F(TestTheoryWhiteArith, assert)
 {
   Node x = d_nodeManager->mkVar(*d_realType);
-  Node c = d_nodeManager->mkConst<Rational>(d_zero);
+  Node c = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, d_zero);
 
   Node gt = d_nodeManager->mkNode(GT, x, c);
   Node leq = Rewriter::rewrite(gt.notNode());
@@ -83,9 +83,9 @@ TEST_F(TestTheoryWhiteArith, int_normal_form)
 {
   Node x = d_nodeManager->mkVar(*d_intType);
   Node xr = d_nodeManager->mkVar(*d_realType);
-  Node c0 = d_nodeManager->mkConst<Rational>(d_zero);
-  Node c1 = d_nodeManager->mkConst<Rational>(d_one);
-  Node c2 = d_nodeManager->mkConst<Rational>(Rational(2));
+  Node c0 = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, d_zero);
+  Node c1 = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, d_one);
+  Node c2 = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, Rational(2));
 
   Node geq0 = d_nodeManager->mkNode(GEQ, x, c0);
   Node geq1 = d_nodeManager->mkNode(GEQ, x, c1);
index 9634d55c259fe7edb2d5a1c5b97b92da2bcbac13..6c52f539d9c981907ce303143a899c836d12da0e 100644 (file)
@@ -72,15 +72,18 @@ TEST_F(TestTheoryWhiteBagsNormalForm, empty_bag_normal_form)
 TEST_F(TestTheoryWhiteBagsNormalForm, mkBag_constant_element)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node negative = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       elements[0],
-                                       d_nodeManager->mkConst(Rational(-1)));
-  Node zero = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                   elements[0],
-                                   d_nodeManager->mkConst(Rational(0)));
-  Node positive = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       elements[0],
-                                       d_nodeManager->mkConst(Rational(1)));
+  Node negative = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1)));
+  Node zero =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
+  Node positive =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
   Node emptybag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
 
@@ -101,19 +104,25 @@ TEST_F(TestTheoryWhiteBagsNormalForm, bag_count)
   // (bag.count "x" (union_disjoint (mkBag "x" 4) (mkBag "y" 5)) = 4
   // (bag.count "x" (union_disjoint (mkBag "y" 5) (mkBag "z" 5)) = 0
 
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node four = d_nodeManager->mkConst(Rational(4));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node four = d_nodeManager->mkConst(CONST_RATIONAL, Rational(4));
   Node empty = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node y_5 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(5)));
-  Node z_5 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), z, d_nodeManager->mkConst(Rational(5)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node y_5 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
+  Node z_5 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           z,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
 
   Node input1 = d_nodeManager->mkNode(BAG_COUNT, x, empty);
   Node output1 = zero;
@@ -156,15 +165,23 @@ TEST_F(TestTheoryWhiteBagsNormalForm, duplicate_removal)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
 
-  Node x_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(1)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
-
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node y_5 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(5)));
+  Node x_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
+
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node y_5 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
 
   Node input2 = d_nodeManager->mkNode(DUPLICATE_REMOVAL, x_4);
   Node output2 = x_1;
@@ -191,16 +208,26 @@ TEST_F(TestTheoryWhiteBagsNormalForm, union_max)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node x_3 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(3)));
-  Node x_7 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(7)));
-  Node z_2 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), z, d_nodeManager->mkConst(Rational(2)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node x_3 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node x_7 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(7)));
+  Node z_2 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           z,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node A = d_nodeManager->mkNode(UNION_DISJOINT, x_4, z_2);
   Node B = d_nodeManager->mkNode(UNION_DISJOINT, x_3, y_1);
@@ -219,15 +246,18 @@ TEST_F(TestTheoryWhiteBagsNormalForm, union_disjoint1)
   std::vector<Node> elements = getNStrings(3);
   Node emptybag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(2)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(3)));
-  Node C = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[2],
-                                d_nodeManager->mkConst(Rational(4)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)));
+  Node B =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[1],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node C =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[2],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
 
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
   // unionDisjointAB is already in a normal form
@@ -250,9 +280,10 @@ TEST_F(TestTheoryWhiteBagsNormalForm, union_disjoint1)
   ASSERT_EQ(unionDisjointA_BC, NormalForm::evaluate(unionDisjointAB_C));
 
   Node unionDisjointAA = d_nodeManager->mkNode(UNION_DISJOINT, A, A);
-  Node AA = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                 elements[0],
-                                 d_nodeManager->mkConst(Rational(4)));
+  Node AA =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
   ASSERT_FALSE(unionDisjointAA.isConst());
   ASSERT_TRUE(AA.isConst());
   ASSERT_EQ(AA, NormalForm::evaluate(unionDisjointAA));
@@ -273,16 +304,26 @@ TEST_F(TestTheoryWhiteBagsNormalForm, union_disjoint2)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node x_3 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(3)));
-  Node x_7 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(7)));
-  Node z_2 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), z, d_nodeManager->mkConst(Rational(2)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node x_3 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node x_7 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(7)));
+  Node z_2 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           z,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node A = d_nodeManager->mkNode(UNION_DISJOINT, x_4, z_2);
   Node B = d_nodeManager->mkNode(UNION_DISJOINT, x_3, y_1);
@@ -309,16 +350,26 @@ TEST_F(TestTheoryWhiteBagsNormalForm, intersection_min)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node x_3 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(3)));
-  Node x_7 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(7)));
-  Node z_2 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), z, d_nodeManager->mkConst(Rational(2)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node x_3 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node x_7 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(7)));
+  Node z_2 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           z,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node A = d_nodeManager->mkNode(UNION_DISJOINT, x_4, z_2);
   Node B = d_nodeManager->mkNode(UNION_DISJOINT, x_3, y_1);
@@ -344,18 +395,30 @@ TEST_F(TestTheoryWhiteBagsNormalForm, difference_subtract)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(1)));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node x_3 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(3)));
-  Node x_7 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(7)));
-  Node z_2 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), z, d_nodeManager->mkConst(Rational(2)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node x_3 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node x_7 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(7)));
+  Node z_2 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           z,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node A = d_nodeManager->mkNode(UNION_DISJOINT, x_4, z_2);
   Node B = d_nodeManager->mkNode(UNION_DISJOINT, x_3, y_1);
@@ -381,18 +444,30 @@ TEST_F(TestTheoryWhiteBagsNormalForm, difference_remove)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(1)));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node x_3 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(3)));
-  Node x_7 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(7)));
-  Node z_2 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), z, d_nodeManager->mkConst(Rational(2)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node x_3 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node x_7 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(7)));
+  Node z_2 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           z,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(2)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node A = d_nodeManager->mkNode(UNION_DISJOINT, x_4, z_2);
   Node B = d_nodeManager->mkNode(UNION_DISJOINT, x_3, y_1);
@@ -417,23 +492,27 @@ TEST_F(TestTheoryWhiteBagsNormalForm, bag_card)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node input1 = d_nodeManager->mkNode(BAG_CARD, empty);
-  Node output1 = d_nodeManager->mkConst(Rational(0));
+  Node output1 = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
 
   ASSERT_EQ(output1, NormalForm::evaluate(input1));
 
   Node input2 = d_nodeManager->mkNode(BAG_CARD, x_4);
-  Node output2 = d_nodeManager->mkConst(Rational(4));
+  Node output2 = d_nodeManager->mkConst(CONST_RATIONAL, Rational(4));
   ASSERT_EQ(output2, NormalForm::evaluate(input2));
 
   Node union_disjoint = d_nodeManager->mkNode(UNION_DISJOINT, x_4, y_1);
   Node input3 = d_nodeManager->mkNode(BAG_CARD, union_disjoint);
-  Node output3 = d_nodeManager->mkConst(Rational(5));
+  Node output3 = d_nodeManager->mkConst(CONST_RATIONAL, Rational(5));
   ASSERT_EQ(output3, NormalForm::evaluate(input3));
 }
 
@@ -453,12 +532,18 @@ TEST_F(TestTheoryWhiteBagsNormalForm, is_singleton)
   Node x = d_nodeManager->mkConst(String("x"));
   Node y = d_nodeManager->mkConst(String("y"));
   Node z = d_nodeManager->mkConst(String("z"));
-  Node x_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(1)));
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node input1 = d_nodeManager->mkNode(BAG_IS_SINGLETON, empty);
   Node output1 = falseNode;
@@ -501,10 +586,14 @@ TEST_F(TestTheoryWhiteBagsNormalForm, from_set)
   Node xSingleton = d_nodeManager->mkSingleton(d_nodeManager->stringType(), x);
   Node ySingleton = d_nodeManager->mkSingleton(d_nodeManager->stringType(), y);
 
-  Node x_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(1)));
-  Node y_1 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(1)));
+  Node x_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
+  Node y_1 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   Node input2 = d_nodeManager->mkNode(BAG_FROM_SET, xSingleton);
   Node output2 = x_1;
@@ -540,10 +629,14 @@ TEST_F(TestTheoryWhiteBagsNormalForm, to_set)
   Node xSingleton = d_nodeManager->mkSingleton(d_nodeManager->stringType(), x);
   Node ySingleton = d_nodeManager->mkSingleton(d_nodeManager->stringType(), y);
 
-  Node x_4 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(4)));
-  Node y_5 = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), y, d_nodeManager->mkConst(Rational(5)));
+  Node x_4 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node y_5 =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           y,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
 
   Node input2 = d_nodeManager->mkNode(BAG_TO_SET, x_4);
   Node output2 = xSingleton;
index 7250f581c276514c6eee9e5b69cdd32455ab7ed3..639de0a6677a792794cb81f456407124359c2884 100644 (file)
@@ -75,9 +75,10 @@ TEST_F(TestTheoryWhiteBagsRewriter, bag_equality)
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
   Node emptyString = d_nodeManager->mkConst(String(""));
-  Node constantBag = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                          emptyString,
-                                          d_nodeManager->mkConst(Rational(1)));
+  Node constantBag =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           emptyString,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   // (= A A) = true where A is a bag
   Node n1 = A.eqNode(A);
@@ -106,15 +107,18 @@ TEST_F(TestTheoryWhiteBagsRewriter, bag_equality)
 TEST_F(TestTheoryWhiteBagsRewriter, mkBag_constant_element)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node negative = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       elements[0],
-                                       d_nodeManager->mkConst(Rational(-1)));
-  Node zero = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                   elements[0],
-                                   d_nodeManager->mkConst(Rational(0)));
-  Node positive = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       elements[0],
-                                       d_nodeManager->mkConst(Rational(1)));
+  Node negative = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1)));
+  Node zero =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
+  Node positive =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
   Node emptybag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
   RewriteResponse negativeResponse = d_rewriter->postRewrite(negative);
@@ -136,16 +140,22 @@ TEST_F(TestTheoryWhiteBagsRewriter, mkBag_variable_element)
 {
   Node skolem =
       d_skolemManager->mkDummySkolem("x", d_nodeManager->stringType());
-  Node variable = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       skolem,
-                                       d_nodeManager->mkConst(Rational(-1)));
-  Node negative = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       skolem,
-                                       d_nodeManager->mkConst(Rational(-1)));
-  Node zero = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), skolem, d_nodeManager->mkConst(Rational(0)));
-  Node positive = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), skolem, d_nodeManager->mkConst(Rational(1)));
+  Node variable = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      skolem,
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1)));
+  Node negative = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      skolem,
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1)));
+  Node zero =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           skolem,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
+  Node positive =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           skolem,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
   Node emptybag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
   RewriteResponse negativeResponse = d_rewriter->postRewrite(negative);
@@ -165,9 +175,9 @@ TEST_F(TestTheoryWhiteBagsRewriter, mkBag_variable_element)
 
 TEST_F(TestTheoryWhiteBagsRewriter, bag_count)
 {
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node three = d_nodeManager->mkConst(Rational(3));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
   Node skolem =
       d_skolemManager->mkDummySkolem("x", d_nodeManager->stringType());
   Node emptyBag = d_nodeManager->mkConst(
@@ -193,14 +203,18 @@ TEST_F(TestTheoryWhiteBagsRewriter, bag_count)
 TEST_F(TestTheoryWhiteBagsRewriter, duplicate_removal)
 {
   Node x = d_skolemManager->mkDummySkolem("x", d_nodeManager->stringType());
-  Node bag = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(5)));
+  Node bag =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
 
   // (duplicate_removal (mkBag x n)) = (mkBag x 1)
   Node n = d_nodeManager->mkNode(DUPLICATE_REMOVAL, bag);
   RewriteResponse response = d_rewriter->postRewrite(n);
-  Node noDuplicate = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(1)));
+  Node noDuplicate =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
   ASSERT_TRUE(response.d_node == noDuplicate
               && response.d_status == REWRITE_AGAIN_FULL);
 }
@@ -211,12 +225,14 @@ TEST_F(TestTheoryWhiteBagsRewriter, union_max)
   std::vector<Node> elements = getNStrings(2);
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(n)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(n + 1)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(n)));
+  Node B = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[1],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(n + 1)));
   Node unionMaxAB = d_nodeManager->mkNode(UNION_MAX, A, B);
   Node unionMaxBA = d_nodeManager->mkNode(UNION_MAX, B, A);
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
@@ -295,15 +311,18 @@ TEST_F(TestTheoryWhiteBagsRewriter, union_disjoint)
   std::vector<Node> elements = getNStrings(3);
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(n)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(n + 1)));
-  Node C = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[2],
-                                d_nodeManager->mkConst(Rational(n + 2)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(n)));
+  Node B = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[1],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(n + 1)));
+  Node C = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[2],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(n + 2)));
 
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
   Node unionDisjointBA = d_nodeManager->mkNode(UNION_DISJOINT, B, A);
@@ -356,12 +375,14 @@ TEST_F(TestTheoryWhiteBagsRewriter, intersection_min)
   std::vector<Node> elements = getNStrings(2);
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(n)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(n + 1)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(n)));
+  Node B = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[1],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(n + 1)));
   Node unionMaxAB = d_nodeManager->mkNode(UNION_MAX, A, B);
   Node unionMaxBA = d_nodeManager->mkNode(UNION_MAX, B, A);
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
@@ -440,12 +461,14 @@ TEST_F(TestTheoryWhiteBagsRewriter, difference_subtract)
   std::vector<Node> elements = getNStrings(2);
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(n)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(n + 1)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(n)));
+  Node B = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[1],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(n + 1)));
   Node unionMaxAB = d_nodeManager->mkNode(UNION_MAX, A, B);
   Node unionMaxBA = d_nodeManager->mkNode(UNION_MAX, B, A);
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
@@ -526,12 +549,14 @@ TEST_F(TestTheoryWhiteBagsRewriter, difference_remove)
   std::vector<Node> elements = getNStrings(2);
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(n)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(n + 1)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(n)));
+  Node B = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[1],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(n + 1)));
   Node unionMaxAB = d_nodeManager->mkNode(UNION_MAX, A, B);
   Node unionMaxBA = d_nodeManager->mkNode(UNION_MAX, B, A);
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
@@ -597,7 +622,7 @@ TEST_F(TestTheoryWhiteBagsRewriter, difference_remove)
 TEST_F(TestTheoryWhiteBagsRewriter, choose)
 {
   Node x = d_skolemManager->mkDummySkolem("x", d_nodeManager->stringType());
-  Node c = d_nodeManager->mkConst(Rational(3));
+  Node c = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
   Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(), x, c);
 
   // (bag.choose (mkBag x c)) = x where c is a constant > 0
@@ -612,16 +637,18 @@ TEST_F(TestTheoryWhiteBagsRewriter, bag_card)
   Node x = d_skolemManager->mkDummySkolem("x", d_nodeManager->stringType());
   Node emptyBag = d_nodeManager->mkConst(
       EmptyBag(d_nodeManager->mkBagType(d_nodeManager->stringType())));
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node c = d_nodeManager->mkConst(Rational(3));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node c = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
   Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(), x, c);
   std::vector<Node> elements = getNStrings(2);
-  Node A = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[0],
-                                d_nodeManager->mkConst(Rational(4)));
-  Node B = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                elements[1],
-                                d_nodeManager->mkConst(Rational(5)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
+  Node B =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[1],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
 
   // TODO(projects#223): enable this test after implementing bags normal form
@@ -665,7 +692,7 @@ TEST_F(TestTheoryWhiteBagsRewriter, is_singleton)
   // (bag.is_singleton (mkBag x c) = (c == 1)
   Node n2 = d_nodeManager->mkNode(BAG_IS_SINGLETON, bag);
   RewriteResponse response2 = d_rewriter->postRewrite(n2);
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   Node equal = c.eqNode(one);
   ASSERT_TRUE(response2.d_node == equal
               && response2.d_status == REWRITE_AGAIN_FULL);
@@ -679,7 +706,7 @@ TEST_F(TestTheoryWhiteBagsRewriter, from_set)
   // (bag.from_set (singleton (singleton_op Int) x)) = (mkBag x 1)
   Node n = d_nodeManager->mkNode(BAG_FROM_SET, singleton);
   RewriteResponse response = d_rewriter->postRewrite(n);
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(), x, one);
   ASSERT_TRUE(response.d_node == bag
               && response.d_status == REWRITE_AGAIN_FULL);
@@ -688,8 +715,10 @@ TEST_F(TestTheoryWhiteBagsRewriter, from_set)
 TEST_F(TestTheoryWhiteBagsRewriter, to_set)
 {
   Node x = d_skolemManager->mkDummySkolem("x", d_nodeManager->stringType());
-  Node bag = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), x, d_nodeManager->mkConst(Rational(5)));
+  Node bag =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           x,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(5)));
 
   // (bag.to_set (mkBag x n)) = (singleton (singleton_op T) x)
   Node n = d_nodeManager->mkNode(BAG_TO_SET, bag);
@@ -719,10 +748,14 @@ TEST_F(TestTheoryWhiteBagsRewriter, map)
   std::vector<Node> elements = getNStrings(2);
   Node a = d_nodeManager->mkConst(String("a"));
   Node b = d_nodeManager->mkConst(String("b"));
-  Node A = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), a, d_nodeManager->mkConst(Rational(3)));
-  Node B = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), b, d_nodeManager->mkConst(Rational(4)));
+  Node A =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           a,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(3)));
+  Node B =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           b,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(4)));
   Node unionDisjointAB = d_nodeManager->mkNode(UNION_DISJOINT, A, B);
 
   ASSERT_TRUE(unionDisjointAB.isConst());
@@ -732,8 +765,10 @@ TEST_F(TestTheoryWhiteBagsRewriter, map)
   Node n2 = d_nodeManager->mkNode(BAG_MAP, lambda, unionDisjointAB);
 
   Node rewritten = Rewriter::rewrite(n2);
-  Node bag = d_nodeManager->mkBag(
-      d_nodeManager->stringType(), empty, d_nodeManager->mkConst(Rational(7)));
+  Node bag =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           empty,
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(7)));
   ASSERT_TRUE(rewritten == bag);
 }
 
index 682ae5bb2b1411b7d3e424c3d41f087394e2935b..b516685afe4a17767214197e3d2abd61b67172e7 100644 (file)
@@ -51,12 +51,13 @@ class TestTheoryWhiteBagsTypeRule : public TestSmt
 TEST_F(TestTheoryWhiteBagsTypeRule, count_operator)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                  elements[0],
-                                  d_nodeManager->mkConst(Rational(100)));
+  Node bag = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(100)));
 
   Node count = d_nodeManager->mkNode(BAG_COUNT, elements[0], bag);
-  Node node = d_nodeManager->mkConst(Rational(10));
+  Node node = d_nodeManager->mkConst(CONST_RATIONAL, Rational(10));
 
   // node of type Int is not compatible with bag of type (Bag String)
   ASSERT_THROW(d_nodeManager->mkNode(BAG_COUNT, node, bag).getType(true),
@@ -66,9 +67,10 @@ TEST_F(TestTheoryWhiteBagsTypeRule, count_operator)
 TEST_F(TestTheoryWhiteBagsTypeRule, duplicate_removal_operator)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                  elements[0],
-                                  d_nodeManager->mkConst(Rational(10)));
+  Node bag = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(10)));
   ASSERT_NO_THROW(d_nodeManager->mkNode(DUPLICATE_REMOVAL, bag));
   ASSERT_EQ(d_nodeManager->mkNode(DUPLICATE_REMOVAL, bag).getType(),
             bag.getType());
@@ -77,15 +79,18 @@ TEST_F(TestTheoryWhiteBagsTypeRule, duplicate_removal_operator)
 TEST_F(TestTheoryWhiteBagsTypeRule, mkBag_operator)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node negative = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       elements[0],
-                                       d_nodeManager->mkConst(Rational(-1)));
-  Node zero = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                   elements[0],
-                                   d_nodeManager->mkConst(Rational(0)));
-  Node positive = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                       elements[0],
-                                       d_nodeManager->mkConst(Rational(1)));
+  Node negative = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1)));
+  Node zero =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
+  Node positive =
+      d_nodeManager->mkBag(d_nodeManager->stringType(),
+                           elements[0],
+                           d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)));
 
   // only positive multiplicity are constants
   ASSERT_FALSE(MkBagTypeRule::computeIsConst(d_nodeManager, negative));
@@ -105,9 +110,10 @@ TEST_F(TestTheoryWhiteBagsTypeRule, from_set_operator)
 TEST_F(TestTheoryWhiteBagsTypeRule, to_set_operator)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                  elements[0],
-                                  d_nodeManager->mkConst(Rational(10)));
+  Node bag = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(10)));
   ASSERT_NO_THROW(d_nodeManager->mkNode(BAG_TO_SET, bag));
   ASSERT_TRUE(d_nodeManager->mkNode(BAG_TO_SET, bag).getType().isSet());
 }
@@ -115,9 +121,10 @@ TEST_F(TestTheoryWhiteBagsTypeRule, to_set_operator)
 TEST_F(TestTheoryWhiteBagsTypeRule, map_operator)
 {
   std::vector<Node> elements = getNStrings(1);
-  Node bag = d_nodeManager->mkBag(d_nodeManager->stringType(),
-                                  elements[0],
-                                  d_nodeManager->mkConst(Rational(10)));
+  Node bag = d_nodeManager->mkBag(
+      d_nodeManager->stringType(),
+      elements[0],
+      d_nodeManager->mkConst(CONST_RATIONAL, Rational(10)));
   Node set =
       d_nodeManager->mkSingleton(d_nodeManager->stringType(), elements[0]);
 
@@ -134,7 +141,7 @@ TEST_F(TestTheoryWhiteBagsTypeRule, map_operator)
   ASSERT_EQ(d_nodeManager->integerType(),
             mappedBag.getType().getBagElementType());
 
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   Node x2 = d_nodeManager->mkBoundVar("x", d_nodeManager->integerType());
   std::vector<Node> args2;
   args2.push_back(x2);
index d8ae8e4682387c2d935afa84f82427619c9a2066..1aea9e481f68f3971d6d6435b1e275c11b70d065 100644 (file)
@@ -41,8 +41,8 @@ TEST_F(TestTheoryBlack, array_const)
 {
   TypeNode arrType = d_nodeManager->mkArrayType(d_nodeManager->integerType(),
                                                 d_nodeManager->integerType());
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
   Node storeAll = d_nodeManager->mkConst(ArrayStoreAll(arrType, zero));
   ASSERT_TRUE(storeAll.isConst());
 
index 39ae835e0b1e38b38142cc5e06ced527819e9992..106a0a39e276a9490f80f3ec4ba2b4d92db391da 100644 (file)
@@ -40,7 +40,7 @@ class TestTheoryWhiteBvIntblaster : public TestSmtNoFinishInit
     d_slvEngine->setOption("produce-models", "true");
     d_slvEngine->finishInit();
     d_true = d_nodeManager->mkConst<bool>(true);
-    d_one = d_nodeManager->mkConst<Rational>(Rational(1));
+    d_one = d_nodeManager->mkConst<Rational>(CONST_RATIONAL, Rational(1));
   }
   Node d_true;
   Node d_one;
@@ -64,7 +64,7 @@ TEST_F(TestTheoryWhiteBvIntblaster, intblaster_constants)
   IntBlaster intBlaster(
       env, options::SolveBVAsIntMode::SUM, 1, false);
   Node result = intBlaster.translateNoChildren(bv7_4, lemmas, skolems);
-  Node seven = d_nodeManager->mkConst(Rational(7));
+  Node seven = d_nodeManager->mkConst(CONST_RATIONAL, Rational(7));
   ASSERT_EQ(seven, result);
 
   // translating integer constants should not change them
index 8185c2354ce124d69e3d6743c50bb2e0d3c80cc1..9aeedbfe6ae1a9714ff5f92c8c28c199df98880a 100644 (file)
@@ -80,7 +80,7 @@ TEST_F(TestTheoryWhiteEngine, rewriter_simple)
   Node z = d_nodeManager->mkVar("z", d_nodeManager->integerType());
 
   // make the expression (PLUS x y (MULT z 0))
-  Node zero = d_nodeManager->mkConst(Rational("0"));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational("0"));
   Node zTimesZero = d_nodeManager->mkNode(MULT, z, zero);
   Node n = d_nodeManager->mkNode(PLUS, x, y, zTimesZero);
 
@@ -111,8 +111,8 @@ TEST_F(TestTheoryWhiteEngine, rewriter_complex)
       "g",
       d_nodeManager->mkFunctionType(d_nodeManager->realType(),
                                     d_nodeManager->integerType()));
-  Node one = d_nodeManager->mkConst(Rational("1"));
-  Node two = d_nodeManager->mkConst(Rational("2"));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational("1"));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational("2"));
 
   Node f1 = d_nodeManager->mkNode(APPLY_UF, f, one);
   Node f2 = d_nodeManager->mkNode(APPLY_UF, f, two);
index 5f440006b4c4d7abf7c8a7e8d11cf643d58d328d..aee6a249b866bdb751c2b614f20b85e7d7636e78 100644 (file)
 #include "test_smt.h"
 #include "util/rational.h"
 
-namespace cvc5 {
-
-using namespace theory;
-using namespace smt;
+using namespace cvc5::kind;
+using namespace cvc5::theory;
+using namespace cvc5::smt;
 
+namespace cvc5 {
 namespace test {
 
 class TestTheoryWhiteIntOpt : public TestSmtNoFinishInit
@@ -44,8 +44,8 @@ class TestTheoryWhiteIntOpt : public TestSmtNoFinishInit
 
 TEST_F(TestTheoryWhiteIntOpt, max)
 {
-  Node ub = d_nodeManager->mkConst(Rational("100"));
-  Node lb = d_nodeManager->mkConst(Rational("0"));
+  Node ub = d_nodeManager->mkConst(CONST_RATIONAL, Rational("100"));
+  Node lb = d_nodeManager->mkConst(CONST_RATIONAL, Rational("0"));
 
   // Objectives to be optimized max_cost is max objective
   Node max_cost = d_nodeManager->mkVar(*d_intType);
@@ -75,8 +75,8 @@ TEST_F(TestTheoryWhiteIntOpt, max)
 
 TEST_F(TestTheoryWhiteIntOpt, min)
 {
-  Node ub = d_nodeManager->mkConst(Rational("100"));
-  Node lb = d_nodeManager->mkConst(Rational("0"));
+  Node ub = d_nodeManager->mkConst(CONST_RATIONAL, Rational("100"));
+  Node lb = d_nodeManager->mkConst(CONST_RATIONAL, Rational("0"));
 
   // Objectives to be optimized max_cost is max objective
   Node max_cost = d_nodeManager->mkVar(*d_intType);
@@ -106,8 +106,8 @@ TEST_F(TestTheoryWhiteIntOpt, min)
 
 TEST_F(TestTheoryWhiteIntOpt, result)
 {
-  Node ub = d_nodeManager->mkConst(Rational("100"));
-  Node lb = d_nodeManager->mkConst(Rational("0"));
+  Node ub = d_nodeManager->mkConst(CONST_RATIONAL, Rational("100"));
+  Node lb = d_nodeManager->mkConst(CONST_RATIONAL, Rational("0"));
 
   // Objectives to be optimized max_cost is max objective
   Node max_cost = d_nodeManager->mkVar(*d_intType);
@@ -134,9 +134,9 @@ TEST_F(TestTheoryWhiteIntOpt, result)
 
 TEST_F(TestTheoryWhiteIntOpt, open_interval)
 {
-  Node ub1 = d_nodeManager->mkConst(Rational("100"));
-  Node lb1 = d_nodeManager->mkConst(Rational("0"));
-  Node lb2 = d_nodeManager->mkConst(Rational("110"));
+  Node ub1 = d_nodeManager->mkConst(CONST_RATIONAL, Rational("100"));
+  Node lb1 = d_nodeManager->mkConst(CONST_RATIONAL, Rational("0"));
+  Node lb2 = d_nodeManager->mkConst(CONST_RATIONAL, Rational("110"));
 
   Node cost1 = d_nodeManager->mkVar(*d_intType);
   Node cost2 = d_nodeManager->mkVar(*d_intType);
index 2fcd626e31ddd6307f066c7696264b44485f5198..f5ca534511e788e58575fff603c29762f3dac865 100644 (file)
 #include "theory/sets/singleton_op.h"
 #include "util/rational.h"
 
-namespace cvc5 {
-
 using namespace cvc5::api;
 
+namespace cvc5 {
 namespace test {
 
 class TestTheoryWhiteSetsTypeRuleApi : public TestApi
@@ -68,8 +67,9 @@ TEST_F(TestTheoryWhiteSetsTypeRuleInternal, singleton_node)
       d_nodeManager->mkConst(SetSingletonOp(d_nodeManager->integerType()));
   Node singletonReal =
       d_nodeManager->mkConst(SetSingletonOp(d_nodeManager->realType()));
-  Node intConstant = d_nodeManager->mkConst(Rational(1));
-  Node realConstant = d_nodeManager->mkConst(Rational(1, 5));
+  Node intConstant = d_nodeManager->mkConst(kind::CONST_RATIONAL, Rational(1));
+  Node realConstant =
+      d_nodeManager->mkConst(kind::CONST_RATIONAL, Rational(1, 5));
   // (singleton (singleton_op Real) 1)
   ASSERT_NO_THROW(
       d_nodeManager->mkSingleton(d_nodeManager->realType(), intConstant));
index 24ed0cd06319acb446b5e26ccc871c54f490fe96..bb4b8122b8591ac1eb9d32eb1d4693211f7ef4cc 100644 (file)
 #include "util/rational.h"
 #include "util/string.h"
 
-namespace cvc5 {
-
-using namespace theory::strings;
+using namespace cvc5::kind;
+using namespace cvc5::theory::strings;
 
+namespace cvc5 {
 namespace test {
 
 class TestTheoryBlackStringsSkolemCache : public TestSmt
@@ -33,7 +33,7 @@ class TestTheoryBlackStringsSkolemCache : public TestSmt
 
 TEST_F(TestTheoryBlackStringsSkolemCache, mkSkolemCached)
 {
-  Node zero = d_nodeManager->mkConst(Rational(0));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
   Node n = d_skolemManager->mkDummySkolem("n", d_nodeManager->integerType());
   Node a = d_skolemManager->mkDummySkolem("a", d_nodeManager->stringType());
   Node b = d_skolemManager->mkDummySkolem("b", d_nodeManager->stringType());
index bb7ef871c97b710735750d4ad3ef1e133c05f023..ac7472560c01c24b83630c92919a2f268179ca73 100644 (file)
@@ -75,64 +75,64 @@ TEST_F(TestTheoryWhiteTypeEnumerator, arith)
 {
   TypeEnumerator te(d_nodeManager->integerType());
   ASSERT_FALSE(te.isFinished());
-  ASSERT_EQ(*te, d_nodeManager->mkConst(Rational(0)));
+  ASSERT_EQ(*te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
   for (int i = 1; i <= 100; ++i)
   {
     ASSERT_FALSE(te.isFinished());
-    ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(i)));
+    ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(i)));
     ASSERT_FALSE(te.isFinished());
-    ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-i)));
+    ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-i)));
   }
   ASSERT_FALSE(te.isFinished());
 
   te = TypeEnumerator(d_nodeManager->realType());
   ASSERT_FALSE(te.isFinished());
-  ASSERT_EQ(*te, d_nodeManager->mkConst(Rational(0, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(2, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-2, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 2)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 2)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(3, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-3, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 3)));
+  ASSERT_EQ(*te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(0, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(2, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-2, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 2)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 2)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(3, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-3, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 3)));
   ASSERT_FALSE(te.isFinished());
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(4, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-4, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(3, 2)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-3, 2)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(2, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-2, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 4)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 4)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(5, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-5, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(4, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-4, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(3, 2)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-3, 2)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(2, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-2, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 4)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 4)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(5, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-5, 1)));
   ASSERT_FALSE(te.isFinished());
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 5)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 5)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(6, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-6, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(5, 2)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-5, 2)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(4, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-4, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(3, 4)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-3, 4)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(2, 5)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-2, 5)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 6)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 5)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 5)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(6, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-6, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(5, 2)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-5, 2)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(4, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-4, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(3, 4)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-3, 4)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(2, 5)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-2, 5)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 6)));
   ASSERT_FALSE(te.isFinished());
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 6)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(7, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-7, 1)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(5, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-5, 3)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(3, 5)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-3, 5)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(1, 7)));
-  ASSERT_EQ(*++te, d_nodeManager->mkConst(Rational(-1, 7)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 6)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(7, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-7, 1)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(5, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-5, 3)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(3, 5)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-3, 5)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1, 7)));
+  ASSERT_EQ(*++te, d_nodeManager->mkConst(CONST_RATIONAL, Rational(-1, 7)));
   ASSERT_FALSE(te.isFinished());
 }
 
@@ -265,26 +265,26 @@ TEST_F(TestTheoryWhiteTypeEnumerator, arrays_infinite)
   // ensure that certain items were found
   TypeNode arrayType = d_nodeManager->mkArrayType(d_nodeManager->integerType(),
                                                   d_nodeManager->integerType());
-  Node zeroes = d_nodeManager->mkConst(
-      ArrayStoreAll(arrayType, d_nodeManager->mkConst(Rational(0))));
-  Node ones = d_nodeManager->mkConst(
-      ArrayStoreAll(arrayType, d_nodeManager->mkConst(Rational(1))));
-  Node twos = d_nodeManager->mkConst(
-      ArrayStoreAll(arrayType, d_nodeManager->mkConst(Rational(2))));
-  Node threes = d_nodeManager->mkConst(
-      ArrayStoreAll(arrayType, d_nodeManager->mkConst(Rational(3))));
-  Node fours = d_nodeManager->mkConst(
-      ArrayStoreAll(arrayType, d_nodeManager->mkConst(Rational(4))));
-  Node tens = d_nodeManager->mkConst(
-      ArrayStoreAll(arrayType, d_nodeManager->mkConst(Rational(10))));
+  Node zeroes = d_nodeManager->mkConst(ArrayStoreAll(
+      arrayType, d_nodeManager->mkConst(CONST_RATIONAL, Rational(0))));
+  Node ones = d_nodeManager->mkConst(ArrayStoreAll(
+      arrayType, d_nodeManager->mkConst(CONST_RATIONAL, Rational(1))));
+  Node twos = d_nodeManager->mkConst(ArrayStoreAll(
+      arrayType, d_nodeManager->mkConst(CONST_RATIONAL, Rational(2))));
+  Node threes = d_nodeManager->mkConst(ArrayStoreAll(
+      arrayType, d_nodeManager->mkConst(CONST_RATIONAL, Rational(3))));
+  Node fours = d_nodeManager->mkConst(ArrayStoreAll(
+      arrayType, d_nodeManager->mkConst(CONST_RATIONAL, Rational(4))));
+  Node tens = d_nodeManager->mkConst(ArrayStoreAll(
+      arrayType, d_nodeManager->mkConst(CONST_RATIONAL, Rational(10))));
 
-  Node zero = d_nodeManager->mkConst(Rational(0));
-  Node one = d_nodeManager->mkConst(Rational(1));
-  Node two = d_nodeManager->mkConst(Rational(2));
-  Node three = d_nodeManager->mkConst(Rational(3));
-  Node four = d_nodeManager->mkConst(Rational(4));
-  Node five = d_nodeManager->mkConst(Rational(5));
-  Node eleven = d_nodeManager->mkConst(Rational(11));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
+  Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+  Node two = d_nodeManager->mkConst(CONST_RATIONAL, Rational(2));
+  Node three = d_nodeManager->mkConst(CONST_RATIONAL, Rational(3));
+  Node four = d_nodeManager->mkConst(CONST_RATIONAL, Rational(4));
+  Node five = d_nodeManager->mkConst(CONST_RATIONAL, Rational(5));
+  Node eleven = d_nodeManager->mkConst(CONST_RATIONAL, Rational(11));
 
   ASSERT_EQ(elts.find(d_nodeManager->mkNode(STORE, ones, zero, zero)),
             elts.end());
index 1272926db18849f87e0cd8792fb9d924001fe058..887a214ddd37f0bef9b700a1b7355290ce97a8b1 100644 (file)
@@ -18,6 +18,8 @@
 #include "test_smt.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace test {
 
@@ -30,15 +32,15 @@ TEST_F(TestUtilWhiteArrayStoreAll, store_all)
   TypeNode usort = d_nodeManager->mkSort("U");
   ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->integerType(),
                                            d_nodeManager->realType()),
-                d_nodeManager->mkConst(Rational(9, 2)));
+                d_nodeManager->mkConst(CONST_RATIONAL, Rational(9, 2)));
   ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->mkSort("U"), usort),
                 d_nodeManager->mkConst(UninterpretedConstant(usort, 0)));
   ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->mkBitVectorType(8),
                                            d_nodeManager->realType()),
-                d_nodeManager->mkConst(Rational(0)));
+                d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
   ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->mkBitVectorType(8),
                                            d_nodeManager->integerType()),
-                d_nodeManager->mkConst(Rational(0)));
+                d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)));
 }
 
 TEST_F(TestUtilWhiteArrayStoreAll, type_errors)
@@ -47,13 +49,14 @@ TEST_F(TestUtilWhiteArrayStoreAll, type_errors)
                              d_nodeManager->mkConst(UninterpretedConstant(
                                  d_nodeManager->mkSort("U"), 0))),
                IllegalArgumentException);
-  ASSERT_THROW(ArrayStoreAll(d_nodeManager->integerType(),
-                             d_nodeManager->mkConst(Rational(9, 2))),
-               IllegalArgumentException);
+  ASSERT_THROW(
+      ArrayStoreAll(d_nodeManager->integerType(),
+                    d_nodeManager->mkConst(CONST_RATIONAL, Rational(9, 2))),
+      IllegalArgumentException);
   ASSERT_THROW(
       ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->integerType(),
                                                d_nodeManager->mkSort("U")),
-                    d_nodeManager->mkConst(Rational(9, 2))),
+                    d_nodeManager->mkConst(CONST_RATIONAL, Rational(9, 2))),
       IllegalArgumentException);
 }
 
@@ -70,9 +73,10 @@ TEST_F(TestUtilWhiteArrayStoreAll, const_error)
       IllegalArgumentException);
   ASSERT_THROW(
       ArrayStoreAll(d_nodeManager->integerType(),
-                    d_nodeManager->mkNode(kind::PLUS,
-                                          d_nodeManager->mkConst(Rational(1)),
-                                          d_nodeManager->mkConst(Rational(0)))),
+                    d_nodeManager->mkNode(
+                        kind::PLUS,
+                        d_nodeManager->mkConst(CONST_RATIONAL, Rational(1)),
+                        d_nodeManager->mkConst(CONST_RATIONAL, Rational(0)))),
       IllegalArgumentException);
 }
 }  // namespace test
index 760bb2f75b22573d8a01141a1d85dae99ad8823b..15dde0cc248092551c84b1a5d3e028681cab1300 100644 (file)
@@ -21,6 +21,8 @@
 #include "test_smt.h"
 #include "util/rational.h"
 
+using namespace cvc5::kind;
+
 namespace cvc5 {
 namespace test {
 
@@ -247,7 +249,7 @@ TEST_F(TestUtilBlackDatatype, listIntUpdate)
   const DType& ldt = listType.getDType();
   Node updater = ldt[0][0].getUpdater();
   Node gt = listType.mkGroundTerm();
-  Node zero = d_nodeManager->mkConst(Rational(0));
+  Node zero = d_nodeManager->mkConst(CONST_RATIONAL, Rational(0));
   Node truen = d_nodeManager->mkConst(true);
   // construct an update term
   Node uterm = d_nodeManager->mkNode(kind::APPLY_UPDATER, updater, gt, zero);