summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2021-11-11 16:03:12 -0800
committerAndres Noetzli <andres.noetzli@gmail.com>2021-11-11 19:19:10 -0800
commit01cc6aab4031f633bdf6cb41a0a8aa6345bb24eb (patch)
tree55c33c54d8f3be5f5b4835be6b48d13d63f0c079
parentf826638031ae919a03bd48c2003eed82cea7279a (diff)
Remove `ConstantMap<Rational>`
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.
-rw-r--r--src/api/cpp/cvc5.cpp94
-rw-r--r--src/api/cpp/cvc5.h3
-rw-r--r--src/expr/bound_var_manager.cpp4
-rw-r--r--src/expr/dtype.cpp2
-rwxr-xr-xsrc/expr/mkmetakind48
-rw-r--r--src/expr/nary_term_util.cpp6
-rw-r--r--src/expr/node_manager.h28
-rw-r--r--src/expr/term_context_node.cpp4
-rw-r--r--src/parser/antlr_input.cpp1
-rw-r--r--src/parser/input.cpp1
-rw-r--r--src/parser/parser.cpp1
-rw-r--r--src/preprocessing/passes/bv_to_int.cpp27
-rw-r--r--src/preprocessing/passes/miplib_trick.cpp20
-rw-r--r--src/preprocessing/passes/real_to_int.cpp10
-rw-r--r--src/preprocessing/passes/unconstrained_simplifier.cpp14
-rw-r--r--src/proof/alethe/alethe_post_processor.cpp8
-rw-r--r--src/proof/lfsc/lfsc_node_converter.cpp42
-rw-r--r--src/proof/lfsc/lfsc_util.cpp5
-rw-r--r--src/proof/method_id.cpp5
-rw-r--r--src/proof/proof_checker.cpp3
-rw-r--r--src/prop/proof_cnf_stream.cpp10
-rw-r--r--src/smt/difficulty_post_processor.cpp2
-rw-r--r--src/smt/proof_post_processor.cpp6
-rw-r--r--src/smt_util/nary_builder.cpp6
-rw-r--r--src/theory/arith/arith_msum.cpp38
-rw-r--r--src/theory/arith/arith_rewriter.cpp52
-rw-r--r--src/theory/arith/arith_utilities.cpp2
-rw-r--r--src/theory/arith/arith_utilities.h2
-rw-r--r--src/theory/arith/bound_inference.cpp14
-rw-r--r--src/theory/arith/congruence_manager.cpp13
-rw-r--r--src/theory/arith/constraint.cpp28
-rw-r--r--src/theory/arith/infer_bounds.cpp4
-rw-r--r--src/theory/arith/kinds6
-rw-r--r--src/theory/arith/nl/cad/cdcac.cpp4
-rw-r--r--src/theory/arith/nl/cad/proof_generator.cpp4
-rw-r--r--src/theory/arith/nl/ext/ext_state.cpp8
-rw-r--r--src/theory/arith/nl/ext/factoring_check.cpp6
-rw-r--r--src/theory/arith/nl/ext/monomial.cpp2
-rw-r--r--src/theory/arith/nl/ext/monomial_bounds_check.cpp6
-rw-r--r--src/theory/arith/nl/ext/proof_checker.cpp6
-rw-r--r--src/theory/arith/nl/ext/tangent_plane_check.cpp21
-rw-r--r--src/theory/arith/nl/ext_theory_callback.cpp2
-rw-r--r--src/theory/arith/nl/iand_solver.cpp6
-rw-r--r--src/theory/arith/nl/iand_utils.cpp29
-rw-r--r--src/theory/arith/nl/nl_model.cpp14
-rw-r--r--src/theory/arith/nl/nonlinear_extension.cpp6
-rw-r--r--src/theory/arith/nl/poly_conversion.cpp123
-rw-r--r--src/theory/arith/nl/pow2_solver.cpp6
-rw-r--r--src/theory/arith/nl/transcendental/exponential_solver.cpp4
-rw-r--r--src/theory/arith/nl/transcendental/proof_checker.cpp17
-rw-r--r--src/theory/arith/nl/transcendental/sine_solver.cpp23
-rw-r--r--src/theory/arith/nl/transcendental/taylor_generator.cpp36
-rw-r--r--src/theory/arith/nl/transcendental/transcendental_state.cpp54
-rw-r--r--src/theory/arith/operator_elim.cpp92
-rw-r--r--src/theory/arith/proof_checker.cpp18
-rw-r--r--src/theory/arith/theory_arith_private.cpp19
-rw-r--r--src/theory/arith/type_enumerator.h8
-rw-r--r--src/theory/bags/bag_solver.cpp4
-rw-r--r--src/theory/bags/bags_rewriter.cpp4
-rw-r--r--src/theory/bags/inference_generator.cpp4
-rw-r--r--src/theory/bags/normal_form.cpp16
-rw-r--r--src/theory/bags/theory_bags.cpp2
-rw-r--r--src/theory/bags/theory_bags_type_enumerator.cpp4
-rw-r--r--src/theory/booleans/proof_circuit_propagator.cpp4
-rw-r--r--src/theory/builtin/proof_checker.cpp2
-rw-r--r--src/theory/bv/int_blaster.cpp16
-rw-r--r--src/theory/bv/theory_bv_utils.cpp17
-rw-r--r--src/theory/datatypes/datatypes_rewriter.cpp7
-rw-r--r--src/theory/datatypes/infer_proof_cons.cpp4
-rw-r--r--src/theory/datatypes/sygus_extension.cpp12
-rw-r--r--src/theory/datatypes/sygus_simple_sym.cpp4
-rw-r--r--src/theory/datatypes/theory_datatypes.cpp2
-rw-r--r--src/theory/difficulty_manager.cpp4
-rw-r--r--src/theory/evaluator.cpp4
-rw-r--r--src/theory/fp/theory_fp.cpp15
-rw-r--r--src/theory/fp/theory_fp_rewriter.cpp10
-rw-r--r--src/theory/inference_id.cpp5
-rw-r--r--src/theory/quantifiers/cegqi/ceg_arith_instantiator.cpp37
-rw-r--r--src/theory/quantifiers/cegqi/ceg_instantiator.cpp18
-rw-r--r--src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp11
-rw-r--r--src/theory/quantifiers/cegqi/vts_term_cache.cpp2
-rw-r--r--src/theory/quantifiers/ematching/inst_match_generator.cpp8
-rw-r--r--src/theory/quantifiers/ematching/pattern_term_selector.cpp6
-rw-r--r--src/theory/quantifiers/ematching/relational_match_generator.cpp5
-rw-r--r--src/theory/quantifiers/extended_rewrite.cpp2
-rw-r--r--src/theory/quantifiers/fmf/bounded_integers.cpp24
-rw-r--r--src/theory/quantifiers/quant_bound_inference.cpp5
-rw-r--r--src/theory/quantifiers/quant_conflict_find.cpp2
-rw-r--r--src/theory/quantifiers/quantifiers_rewriter.cpp2
-rw-r--r--src/theory/quantifiers/skolemize.cpp10
-rw-r--r--src/theory/quantifiers/sygus/cegis_unif.cpp6
-rw-r--r--src/theory/quantifiers/sygus/sygus_enumerator.cpp2
-rw-r--r--src/theory/quantifiers/sygus/sygus_grammar_cons.cpp11
-rw-r--r--src/theory/quantifiers/sygus_sampler.cpp8
-rw-r--r--src/theory/quantifiers/term_util.cpp2
-rw-r--r--src/theory/sets/cardinality_extension.cpp9
-rw-r--r--src/theory/sets/theory_sets_private.cpp2
-rw-r--r--src/theory/sets/theory_sets_rewriter.cpp6
-rw-r--r--src/theory/strings/arith_entail.cpp26
-rw-r--r--src/theory/strings/array_solver.cpp2
-rw-r--r--src/theory/strings/base_solver.cpp7
-rw-r--r--src/theory/strings/core_solver.cpp18
-rw-r--r--src/theory/strings/infer_proof_cons.cpp6
-rw-r--r--src/theory/strings/inference_manager.cpp4
-rw-r--r--src/theory/strings/proof_checker.cpp10
-rw-r--r--src/theory/strings/regexp_elim.cpp25
-rw-r--r--src/theory/strings/regexp_entail.cpp6
-rw-r--r--src/theory/strings/regexp_operation.cpp15
-rw-r--r--src/theory/strings/sequences_rewriter.cpp59
-rw-r--r--src/theory/strings/skolem_cache.cpp13
-rw-r--r--src/theory/strings/solver_state.cpp2
-rw-r--r--src/theory/strings/strings_entail.cpp12
-rw-r--r--src/theory/strings/strings_fmf.cpp3
-rw-r--r--src/theory/strings/strings_rewriter.cpp17
-rw-r--r--src/theory/strings/term_registry.cpp32
-rw-r--r--src/theory/strings/theory_strings.cpp11
-rw-r--r--src/theory/strings/theory_strings_preprocess.cpp22
-rw-r--r--src/theory/strings/theory_strings_utils.cpp3
-rw-r--r--test/unit/node/node_algorithm_black.cpp4
-rw-r--r--test/unit/node/node_black.cpp10
-rw-r--r--test/unit/node/node_builder_black.cpp2
-rw-r--r--test/unit/node/node_manager_black.cpp2
-rw-r--r--test/unit/node/node_manager_white.cpp5
-rw-r--r--test/unit/node/node_white.cpp2
-rw-r--r--test/unit/node/type_node_white.cpp3
-rw-r--r--test/unit/preprocessing/pass_foreign_theory_rewrite_white.cpp8
-rw-r--r--test/unit/theory/arith_poly_white.cpp14
-rw-r--r--test/unit/theory/evaluator_white.cpp14
-rw-r--r--test/unit/theory/sequences_rewriter_white.cpp73
-rw-r--r--test/unit/theory/theory_arith_cad_white.cpp29
-rw-r--r--test/unit/theory/theory_arith_pow2_white.cpp2
-rw-r--r--test/unit/theory/theory_arith_white.cpp8
-rw-r--r--test/unit/theory/theory_bags_normal_form_white.cpp319
-rw-r--r--test/unit/theory/theory_bags_rewriter_white.cpp197
-rw-r--r--test/unit/theory/theory_bags_type_rules_white.cpp53
-rw-r--r--test/unit/theory/theory_black.cpp4
-rw-r--r--test/unit/theory/theory_bv_int_blaster_white.cpp4
-rw-r--r--test/unit/theory/theory_engine_white.cpp6
-rw-r--r--test/unit/theory/theory_int_opt_white.cpp26
-rw-r--r--test/unit/theory/theory_sets_type_rules_white.cpp8
-rw-r--r--test/unit/theory/theory_strings_skolem_cache_black.cpp8
-rw-r--r--test/unit/theory/type_enumerator_white.cpp130
-rw-r--r--test/unit/util/array_store_all_white.cpp24
-rw-r--r--test/unit/util/datatype_black.cpp4
144 files changed, 1518 insertions, 1075 deletions
diff --git a/src/api/cpp/cvc5.cpp b/src/api/cpp/cvc5.cpp
index 797d2e473..e62a3249d 100644
--- a/src/api/cpp/cvc5.cpp
+++ b/src/api/cpp/cvc5.cpp
@@ -1947,75 +1947,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:
@@ -2023,20 +2022,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:
@@ -2044,47 +2041,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;
}
@@ -2093,7 +2086,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:
@@ -5022,6 +5015,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
@@ -5030,7 +5031,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)
{
@@ -5324,7 +5325,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;
@@ -5754,7 +5756,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;
////////
@@ -5780,7 +5782,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;
@@ -5790,7 +5792,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;
diff --git a/src/api/cpp/cvc5.h b/src/api/cpp/cvc5.h
index 5b0cc0b45..73e3c6942 100644
--- a/src/api/cpp/cvc5.h
+++ b/src/api/cpp/cvc5.h
@@ -48,6 +48,7 @@ class SolverEngine;
class TypeNode;
class Options;
class Random;
+class Rational;
class Result;
class StatisticsRegistry;
@@ -4487,6 +4488,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. */
diff --git a/src/expr/bound_var_manager.cpp b/src/expr/bound_var_manager.cpp
index 820c82d22..53c87fb97 100644
--- a/src/expr/bound_var_manager.cpp
+++ b/src/expr/bound_var_manager.cpp
@@ -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)
diff --git a/src/expr/dtype.cpp b/src/expr/dtype.cpp
index 4a0ed994f..a5719a7ff 100644
--- a/src/expr/dtype.cpp
+++ b/src/expr/dtype.cpp
@@ -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
diff --git a/src/expr/mkmetakind b/src/expr/mkmetakind
index f9b49fc0a..fa52617d5 100755
--- a/src/expr/mkmetakind
+++ b/src/expr/mkmetakind
@@ -213,9 +213,17 @@ function constant {
echo "$kf:$lineno: warning: constant $1 hasher \`$4' isn't fully-qualified (e.g., ::cvc5::RationalHashFunction)" >&2
fi
+ if [[ "$3" =~ '+'$ ]]; then
+ class="${3::-1}"
+ 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 +234,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 +281,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;
"
}
diff --git a/src/expr/nary_term_util.cpp b/src/expr/nary_term_util.cpp
index 4071e0d0e..a872c64c7 100644
--- a/src/expr/nary_term_util.cpp
+++ b/src/expr/nary_term_util.cpp
@@ -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);
diff --git a/src/expr/node_manager.h b/src/expr/node_manager.h
index 1208a0e03..d301c857c 100644
--- a/src/expr/node_manager.h
+++ b/src/expr/node_manager.h
@@ -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);
diff --git a/src/expr/term_context_node.cpp b/src/expr/term_context_node.cpp
index dbf4cccae..3be9faad0 100644
--- a/src/expr/term_context_node.cpp
+++ b/src/expr/term_context_node.cpp
@@ -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)
diff --git a/src/parser/antlr_input.cpp b/src/parser/antlr_input.cpp
index 89d56a108..236eb534c 100644
--- a/src/parser/antlr_input.cpp
+++ b/src/parser/antlr_input.cpp
@@ -34,7 +34,6 @@
using namespace std;
using namespace cvc5;
using namespace cvc5::parser;
-using namespace cvc5::kind;
namespace cvc5 {
namespace parser {
diff --git a/src/parser/input.cpp b/src/parser/input.cpp
index c8c005b36..0fb44b4a9 100644
--- a/src/parser/input.cpp
+++ b/src/parser/input.cpp
@@ -26,7 +26,6 @@
using namespace std;
using namespace cvc5;
using namespace cvc5::parser;
-using namespace cvc5::kind;
namespace cvc5 {
namespace parser {
diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp
index 83b1f5025..570f1369a 100644
--- a/src/parser/parser.cpp
+++ b/src/parser/parser.cpp
@@ -31,7 +31,6 @@
#include "smt/command.h"
using namespace std;
-using namespace cvc5::kind;
namespace cvc5 {
namespace parser {
diff --git a/src/preprocessing/passes/bv_to_int.cpp b/src/preprocessing/passes/bv_to_int.cpp
index 6515ef90a..33f3dd445 100644
--- a/src/preprocessing/passes/bv_to_int.cpp
+++ b/src/preprocessing/passes/bv_to_int.cpp
@@ -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;
}
diff --git a/src/preprocessing/passes/miplib_trick.cpp b/src/preprocessing/passes/miplib_trick.cpp
index 59f046262..66646b766 100644
--- a/src/preprocessing/passes/miplib_trick.cpp
+++ b/src/preprocessing/passes/miplib_trick.cpp
@@ -33,13 +33,14 @@
#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;
diff --git a/src/preprocessing/passes/real_to_int.cpp b/src/preprocessing/passes/real_to_int.cpp
index 9e2170ffd..5c4539808 100644
--- a/src/preprocessing/passes/real_to_int.cpp
+++ b/src/preprocessing/passes/real_to_int.cpp
@@ -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();
diff --git a/src/preprocessing/passes/unconstrained_simplifier.cpp b/src/preprocessing/passes/unconstrained_simplifier.cpp
index db6cb8b72..ae05d6b87 100644
--- a/src/preprocessing/passes/unconstrained_simplifier.cpp
+++ b/src/preprocessing/passes/unconstrained_simplifier.cpp
@@ -30,13 +30,14 @@
#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;
diff --git a/src/proof/alethe/alethe_post_processor.cpp b/src/proof/alethe/alethe_post_processor.cpp
index c97dc2313..b984119ae 100644
--- a/src/proof/alethe/alethe_post_processor.cpp
+++ b/src/proof/alethe/alethe_post_processor.cpp
@@ -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:
@@ -1391,8 +1393,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());
diff --git a/src/proof/lfsc/lfsc_node_converter.cpp b/src/proof/lfsc/lfsc_node_converter.cpp
index 7ec0b2bd5..33529df39 100644
--- a/src/proof/lfsc/lfsc_node_converter.cpp
+++ b/src/proof/lfsc/lfsc_node_converter.cpp
@@ -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);
}
diff --git a/src/proof/lfsc/lfsc_util.cpp b/src/proof/lfsc/lfsc_util.cpp
index d8bd8f548..06bedb895 100644
--- a/src/proof/lfsc/lfsc_util.cpp
+++ b/src/proof/lfsc/lfsc_util.cpp
@@ -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)
diff --git a/src/proof/method_id.cpp b/src/proof/method_id.cpp
index c5e8458cd..9567590a8 100644
--- a/src/proof/method_id.cpp
+++ b/src/proof/method_id.cpp
@@ -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)
diff --git a/src/proof/proof_checker.cpp b/src/proof/proof_checker.cpp
index c178ccebf..5289d77ff 100644
--- a/src/proof/proof_checker.cpp
+++ b/src/proof/proof_checker.cpp
@@ -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()
diff --git a/src/prop/proof_cnf_stream.cpp b/src/prop/proof_cnf_stream.cpp
index d09854bce..61a1a298c 100644
--- a/src/prop/proof_cnf_stream.cpp
+++ b/src/prop/proof_cnf_stream.cpp
@@ -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";
diff --git a/src/smt/difficulty_post_processor.cpp b/src/smt/difficulty_post_processor.cpp
index 748092238..31797ba5e 100644
--- a/src/smt/difficulty_post_processor.cpp
+++ b/src/smt/difficulty_post_processor.cpp
@@ -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));
}
}
diff --git a/src/smt/proof_post_processor.cpp b/src/smt/proof_post_processor.cpp
index 56a759866..a292fec8f 100644
--- a/src/smt/proof_post_processor.cpp
+++ b/src/smt/proof_post_processor.cpp
@@ -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());
diff --git a/src/smt_util/nary_builder.cpp b/src/smt_util/nary_builder.cpp
index ff9f7ef03..6d6259d73 100644
--- a/src/smt_util/nary_builder.cpp
+++ b/src/smt_util/nary_builder.cpp
@@ -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();
}
diff --git a/src/theory/arith/arith_msum.cpp b/src/theory/arith/arith_msum.cpp
index 3ca649211..ac3780b36 100644
--- a/src/theory/arith/arith_msum.cpp
+++ b/src/theory/arith/arith_msum.cpp
@@ -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;
}
diff --git a/src/theory/arith/arith_rewriter.cpp b/src/theory/arith/arith_rewriter.cpp
index 5baaaf317..19b5c1204 100644
--- a/src/theory/arith/arith_rewriter.cpp
+++ b/src/theory/arith/arith_rewriter.cpp
@@ -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;
diff --git a/src/theory/arith/arith_utilities.cpp b/src/theory/arith/arith_utilities.cpp
index 5645542d0..a9fd97079 100644
--- a/src/theory/arith/arith_utilities.cpp
+++ b/src/theory/arith/arith_utilities.cpp
@@ -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
{
diff --git a/src/theory/arith/arith_utilities.h b/src/theory/arith/arith_utilities.h
index 0d7f214d7..b926af2e0 100644
--- a/src/theory/arith/arith_utilities.h
+++ b/src/theory/arith/arith_utilities.h
@@ -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){
diff --git a/src/theory/arith/bound_inference.cpp b/src/theory/arith/bound_inference.cpp
index 5824d8239..cd688660a 100644
--- a/src/theory/arith/bound_inference.cpp
+++ b/src/theory/arith/bound_inference.cpp
@@ -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 << " "
diff --git a/src/theory/arith/congruence_manager.cpp b/src/theory/arith/congruence_manager.cpp
index ae782eed2..de68a4987 100644
--- a/src/theory/arith/congruence_manager.cpp
+++ b/src/theory/arith/congruence_manager.cpp
@@ -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};
diff --git a/src/theory/arith/constraint.cpp b/src/theory/arith/constraint.cpp
index 2958b5f48..cffacdc39 100644
--- a/src/theory/arith/constraint.cpp
+++ b/src/theory/arith/constraint.cpp
@@ -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();
diff --git a/src/theory/arith/infer_bounds.cpp b/src/theory/arith/infer_bounds.cpp
index 4cbb8211d..aae9bae62 100644
--- a/src/theory/arith/infer_bounds.cpp
+++ b/src/theory/arith/infer_bounds.cpp
@@ -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){
diff --git a/src/theory/arith/kinds b/src/theory/arith/kinds
index 0c93db90f..0f3e345ee 100644
--- a/src/theory/arith/kinds
+++ b/src/theory/arith/kinds
@@ -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"
diff --git a/src/theory/arith/nl/cad/cdcac.cpp b/src/theory/arith/nl/cad/cdcac.cpp
index 4a2709cf8..0c61c088a 100644
--- a/src/theory/arith/nl/cad/cdcac.cpp
+++ b/src/theory/arith/nl/cad/cdcac.cpp
@@ -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(
diff --git a/src/theory/arith/nl/cad/proof_generator.cpp b/src/theory/arith/nl/cad/proof_generator.cpp
index b56c2755a..fcc07cbf0 100644
--- a/src/theory/arith/nl/cad/proof_generator.cpp
+++ b/src/theory/arith/nl/cad/proof_generator.cpp
@@ -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()
diff --git a/src/theory/arith/nl/ext/ext_state.cpp b/src/theory/arith/nl/ext/ext_state.cpp
index b196f9990..172d09f31 100644
--- a/src/theory/arith/nl/ext/ext_state.cpp
+++ b/src/theory/arith/nl/ext/ext_state.cpp
@@ -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>(
diff --git a/src/theory/arith/nl/ext/factoring_check.cpp b/src/theory/arith/nl/ext/factoring_check.cpp
index e41639c58..06d6aeaab 100644
--- a/src/theory/arith/nl/ext/factoring_check.cpp
+++ b/src/theory/arith/nl/ext/factoring_check.cpp
@@ -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,
diff --git a/src/theory/arith/nl/ext/monomial.cpp b/src/theory/arith/nl/ext/monomial.cpp
index c969fe0e7..83d0ff71f 100644
--- a/src/theory/arith/nl/ext/monomial.cpp
+++ b/src/theory/arith/nl/ext/monomial.cpp
@@ -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)
diff --git a/src/theory/arith/nl/ext/monomial_bounds_check.cpp b/src/theory/arith/nl/ext/monomial_bounds_check.cpp
index 1f50b3112..e97f8b772 100644
--- a/src/theory/arith/nl/ext/monomial_bounds_check.cpp
+++ b/src/theory/arith/nl/ext/monomial_bounds_check.cpp
@@ -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]))
diff --git a/src/theory/arith/nl/ext/proof_checker.cpp b/src/theory/arith/nl/ext/proof_checker.cpp
index 67679d7a6..7acee487d 100644
--- a/src/theory/arith/nl/ext/proof_checker.cpp
+++ b/src/theory/arith/nl/ext/proof_checker.cpp
@@ -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;
diff --git a/src/theory/arith/nl/ext/tangent_plane_check.cpp b/src/theory/arith/nl/ext/tangent_plane_check.cpp
index ebdca33dd..fbf8caf6a 100644
--- a/src/theory/arith/nl/ext/tangent_plane_check.cpp
+++ b/src/theory/arith/nl/ext/tangent_plane_check.cpp
@@ -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,
diff --git a/src/theory/arith/nl/ext_theory_callback.cpp b/src/theory/arith/nl/ext_theory_callback.cpp
index 02914f938..f2a4aa2e3 100644
--- a/src/theory/arith/nl/ext_theory_callback.cpp
+++ b/src/theory/arith/nl/ext_theory_callback.cpp
@@ -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(
diff --git a/src/theory/arith/nl/iand_solver.cpp b/src/theory/arith/nl/iand_solver.cpp
index b773f6baf..5d4862307 100644
--- a/src/theory/arith/nl/iand_solver.cpp
+++ b/src/theory/arith/nl/iand_solver.cpp
@@ -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() {}
diff --git a/src/theory/arith/nl/iand_utils.cpp b/src/theory/arith/nl/iand_utils.cpp
index 45881e1bb..50e03bfa5 100644
--- a/src/theory/arith/nl/iand_utils.cpp
+++ b/src/theory/arith/nl/iand_utils.cpp
@@ -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;
}
diff --git a/src/theory/arith/nl/nl_model.cpp b/src/theory/arith/nl/nl_model.cpp
index 77a3ea530..8d06f41d0 100644
--- a/src/theory/arith/nl/nl_model.cpp
+++ b/src/theory/arith/nl/nl_model.cpp
@@ -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;
}
diff --git a/src/theory/arith/nl/nonlinear_extension.cpp b/src/theory/arith/nl/nonlinear_extension.cpp
index 56bdd652a..e75741096 100644
--- a/src/theory/arith/nl/nonlinear_extension.cpp
+++ b/src/theory/arith/nl/nonlinear_extension.cpp
@@ -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())
{
diff --git a/src/theory/arith/nl/poly_conversion.cpp b/src/theory/arith/nl/poly_conversion.cpp
index 7fbe08b9f..ebe76e018 100644
--- a/src/theory/arith/nl/poly_conversion.cpp
+++ b/src/theory/arith/nl/poly_conversion.cpp
@@ -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)
diff --git a/src/theory/arith/nl/pow2_solver.cpp b/src/theory/arith/nl/pow2_solver.cpp
index c91284be7..e3a26397e 100644
--- a/src/theory/arith/nl/pow2_solver.cpp
+++ b/src/theory/arith/nl/pow2_solver.cpp
@@ -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() {}
diff --git a/src/theory/arith/nl/transcendental/exponential_solver.cpp b/src/theory/arith/nl/transcendental/exponential_solver.cpp
index 17b5d259c..c4f7f6ca9 100644
--- a/src/theory/arith/nl/transcendental/exponential_solver.cpp
+++ b/src/theory/arith/nl/transcendental/exponential_solver.cpp
@@ -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);
diff --git a/src/theory/arith/nl/transcendental/proof_checker.cpp b/src/theory/arith/nl/transcendental/proof_checker.cpp
index ca62fe394..ca1afb9f6 100644
--- a/src/theory/arith/nl/transcendental/proof_checker.cpp
+++ b/src/theory/arith/nl/transcendental/proof_checker.cpp
@@ -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)
diff --git a/src/theory/arith/nl/transcendental/sine_solver.cpp b/src/theory/arith/nl/transcendental/sine_solver.cpp
index ed37ee91c..b6b5c92c1 100644
--- a/src/theory/arith/nl/transcendental/sine_solver.cpp
+++ b/src/theory/arith/nl/transcendental/sine_solver.cpp
@@ -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,
diff --git a/src/theory/arith/nl/transcendental/taylor_generator.cpp b/src/theory/arith/nl/transcendental/taylor_generator.cpp
index d64eb8f19..2a231bc2b 100644
--- a/src/theory/arith/nl/transcendental/taylor_generator.cpp
+++ b/src/theory/arith/nl/transcendental/taylor_generator.cpp
@@ -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;
diff --git a/src/theory/arith/nl/transcendental/transcendental_state.cpp b/src/theory/arith/nl/transcendental/transcendental_state.cpp
index 2fcbcdb38..870eddc86 100644
--- a/src/theory/arith/nl/transcendental/transcendental_state.cpp
+++ b/src/theory/arith/nl/transcendental/transcendental_state.cpp
@@ -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,
diff --git a/src/theory/arith/operator_elim.cpp b/src/theory/arith/operator_elim.cpp
index 5c43189ea..17efa53a5 100644
--- a/src/theory/arith/operator_elim.cpp
+++ b/src/theory/arith/operator_elim.cpp
@@ -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 =
diff --git a/src/theory/arith/proof_checker.cpp b/src/theory/arith/proof_checker.cpp
index 171cdf182..69fe98734 100644
--- a/src/theory/arith/proof_checker.cpp
+++ b/src/theory/arith/proof_checker.cpp
@@ -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);
}
}
diff --git a/src/theory/arith/theory_arith_private.cpp b/src/theory/arith/theory_arith_private.cpp
index f49a295c7..6a43ed09b 100644
--- a/src/theory/arith/theory_arith_private.cpp
+++ b/src/theory/arith/theory_arith_private.cpp
@@ -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(
diff --git a/src/theory/arith/type_enumerator.h b/src/theory/arith/type_enumerator.h
index 2b5582956..d57c4ba24 100644
--- a/src/theory/arith/type_enumerator.h
+++ b/src/theory/arith/type_enumerator.h
@@ -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
diff --git a/src/theory/bags/bag_solver.cpp b/src/theory/bags/bag_solver.cpp
index 341798eb2..c2d73d625 100644
--- a/src/theory/bags/bag_solver.cpp
+++ b/src/theory/bags/bag_solver.cpp
@@ -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);
}
diff --git a/src/theory/bags/bags_rewriter.cpp b/src/theory/bags/bags_rewriter.cpp
index 593145f6f..31c33b901 100644
--- a/src/theory/bags/bags_rewriter.cpp
+++ b/src/theory/bags/bags_rewriter.cpp
@@ -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)
diff --git a/src/theory/bags/inference_generator.cpp b/src/theory/bags/inference_generator.cpp
index 66c38ab86..9c067caf6 100644
--- a/src/theory/bags/inference_generator.cpp
+++ b/src/theory/bags/inference_generator.cpp
@@ -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)
diff --git a/src/theory/bags/normal_form.cpp b/src/theory/bags/normal_form.cpp
index 59344cf0b..69d76bd88 100644
--- a/src/theory/bags/normal_form.cpp
+++ b/src/theory/bags/normal_form.cpp
@@ -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;
}
diff --git a/src/theory/bags/theory_bags.cpp b/src/theory/bags/theory_bags.cpp
index 813f45669..3ab184eab 100644
--- a/src/theory/bags/theory_bags.cpp
+++ b/src/theory/bags/theory_bags.cpp
@@ -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);
diff --git a/src/theory/bags/theory_bags_type_enumerator.cpp b/src/theory/bags/theory_bags_type_enumerator.cpp
index be9e0cd4d..06771a418 100644
--- a/src/theory/bags/theory_bags_type_enumerator.cpp
+++ b/src/theory/bags/theory_bags_type_enumerator.cpp
@@ -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)
diff --git a/src/theory/booleans/proof_circuit_propagator.cpp b/src/theory/booleans/proof_circuit_propagator.cpp
index 1ec8f7b67..9190f423f 100644
--- a/src/theory/booleans/proof_circuit_propagator.cpp
+++ b/src/theory/booleans/proof_circuit_propagator.cpp
@@ -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);
}
/**
diff --git a/src/theory/builtin/proof_checker.cpp b/src/theory/builtin/proof_checker.cpp
index d5b856456..9c05407b7 100644
--- a/src/theory/builtin/proof_checker.cpp
+++ b/src/theory/builtin/proof_checker.cpp
@@ -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
diff --git a/src/theory/bv/int_blaster.cpp b/src/theory/bv/int_blaster.cpp
index ba0e51595..eff5ec611 100644
--- a/src/theory/bv/int_blaster.cpp
+++ b/src/theory/bv/int_blaster.cpp
@@ -32,9 +32,11 @@
#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
{
diff --git a/src/theory/bv/theory_bv_utils.cpp b/src/theory/bv/theory_bv_utils.cpp
index bc6096cbb..adb067045 100644
--- a/src/theory/bv/theory_bv_utils.cpp
+++ b/src/theory/bv/theory_bv_utils.cpp
@@ -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;
}
diff --git a/src/theory/datatypes/datatypes_rewriter.cpp b/src/theory/datatypes/datatypes_rewriter.cpp
index fd957baaa..4cda9f728 100644
--- a/src/theory/datatypes/datatypes_rewriter.cpp
+++ b/src/theory/datatypes/datatypes_rewriter.cpp
@@ -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())
diff --git a/src/theory/datatypes/infer_proof_cons.cpp b/src/theory/datatypes/infer_proof_cons.cpp
index 4aace5f1c..7ca58905f 100644
--- a/src/theory/datatypes/infer_proof_cons.cpp
+++ b/src/theory/datatypes/infer_proof_cons.cpp
@@ -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}, {});
diff --git a/src/theory/datatypes/sygus_extension.cpp b/src/theory/datatypes/sygus_extension.cpp
index bacbf8c47..88a3e43d7 100644
--- a/src/theory/datatypes/sygus_extension.cpp
+++ b/src/theory/datatypes/sygus_extension.cpp
@@ -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 ) {
diff --git a/src/theory/datatypes/sygus_simple_sym.cpp b/src/theory/datatypes/sygus_simple_sym.cpp
index 63e60a478..1b5e37bc3 100644
--- a/src/theory/datatypes/sygus_simple_sym.cpp
+++ b/src/theory/datatypes/sygus_simple_sym.cpp
@@ -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)
diff --git a/src/theory/datatypes/theory_datatypes.cpp b/src/theory/datatypes/theory_datatypes.cpp
index 055b06c47..b19eb53af 100644
--- a/src/theory/datatypes/theory_datatypes.cpp
+++ b/src/theory/datatypes/theory_datatypes.cpp
@@ -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
diff --git a/src/theory/difficulty_manager.cpp b/src/theory/difficulty_manager.cpp
index 3df86383f..c09120771 100644
--- a/src/theory/difficulty_manager.cpp
+++ b/src/theory/difficulty_manager.cpp
@@ -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));
}
}
diff --git a/src/theory/evaluator.cpp b/src/theory/evaluator.cpp
index f7c5ddf0f..27e67dd9f 100644
--- a/src/theory/evaluator.cpp
+++ b/src/theory/evaluator.cpp
@@ -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:
diff --git a/src/theory/fp/theory_fp.cpp b/src/theory/fp/theory_fp.cpp
index 6f2ddbf63..d8e35d8e5 100644
--- a/src/theory/fp/theory_fp.cpp
+++ b/src/theory/fp/theory_fp.cpp
@@ -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(
diff --git a/src/theory/fp/theory_fp_rewriter.cpp b/src/theory/fp/theory_fp_rewriter.cpp
index 91fe183ec..32c3cff41 100644
--- a/src/theory/fp/theory_fp_rewriter.cpp
+++ b/src/theory/fp/theory_fp_rewriter.cpp
@@ -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);
diff --git a/src/theory/inference_id.cpp b/src/theory/inference_id.cpp
index 594834226..9b5f1a581 100644
--- a/src/theory/inference_id.cpp
+++ b/src/theory/inference_id.cpp
@@ -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)
diff --git a/src/theory/quantifiers/cegqi/ceg_arith_instantiator.cpp b/src/theory/quantifiers/cegqi/ceg_arith_instantiator.cpp
index 163a49b8c..425ab0484 100644
--- a/src/theory/quantifiers/cegqi/ceg_arith_instantiator.cpp
+++ b/src/theory/quantifiers/cegqi/ceg_arith_instantiator.cpp
@@ -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)
diff --git a/src/theory/quantifiers/cegqi/ceg_instantiator.cpp b/src/theory/quantifiers/cegqi/ceg_instantiator.cpp
index 9dc11955b..494ac8e53 100644
--- a/src/theory/quantifiers/cegqi/ceg_instantiator.cpp
+++ b/src/theory/quantifiers/cegqi/ceg_instantiator.cpp
@@ -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 ) ){
diff --git a/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp b/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp
index 6340e2a2a..65ad79e29 100644
--- a/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp
+++ b/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp
@@ -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);
}
}
diff --git a/src/theory/quantifiers/cegqi/vts_term_cache.cpp b/src/theory/quantifiers/cegqi/vts_term_cache.cpp
index fe47f1dd1..37ded9b7f 100644
--- a/src/theory/quantifiers/cegqi/vts_term_cache.cpp
+++ b/src/theory/quantifiers/cegqi/vts_term_cache.cpp
@@ -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,
diff --git a/src/theory/quantifiers/ematching/inst_match_generator.cpp b/src/theory/quantifiers/ematching/inst_match_generator.cpp
index 075299583..8c2d8e6c4 100644
--- a/src/theory/quantifiers/ematching/inst_match_generator.cpp
+++ b/src/theory/quantifiers/ematching/inst_match_generator.cpp
@@ -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)
{
diff --git a/src/theory/quantifiers/ematching/pattern_term_selector.cpp b/src/theory/quantifiers/ematching/pattern_term_selector.cpp
index 332346f3f..0ab6e1098 100644
--- a/src/theory/quantifiers/ematching/pattern_term_selector.cpp
+++ b/src/theory/quantifiers/ematching/pattern_term_selector.cpp
@@ -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);
}
}
diff --git a/src/theory/quantifiers/ematching/relational_match_generator.cpp b/src/theory/quantifiers/ematching/relational_match_generator.cpp
index 8981a7a2d..dc8f64f6d 100644
--- a/src/theory/quantifiers/ematching/relational_match_generator.cpp
+++ b/src/theory/quantifiers/ematching/relational_match_generator.cpp
@@ -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")
diff --git a/src/theory/quantifiers/extended_rewrite.cpp b/src/theory/quantifiers/extended_rewrite.cpp
index 3d20f66b3..5aab618c0 100644
--- a/src/theory/quantifiers/extended_rewrite.cpp
+++ b/src/theory/quantifiers/extended_rewrite.cpp
@@ -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
diff --git a/src/theory/quantifiers/fmf/bounded_integers.cpp b/src/theory/quantifiers/fmf/bounded_integers.cpp
index 26b526315..b5b9e7d88 100644
--- a/src/theory/quantifiers/fmf/bounded_integers.cpp
+++ b/src/theory/quantifiers/fmf/bounded_integers.cpp
@@ -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 );
}
diff --git a/src/theory/quantifiers/quant_bound_inference.cpp b/src/theory/quantifiers/quant_bound_inference.cpp
index 83e48bf9c..af72e2a7c 100644
--- a/src/theory/quantifiers/quant_bound_inference.cpp
+++ b/src/theory/quantifiers/quant_bound_inference.cpp
@@ -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>();
diff --git a/src/theory/quantifiers/quant_conflict_find.cpp b/src/theory/quantifiers/quant_conflict_find.cpp
index f04514480..9f7b270de 100644
--- a/src/theory/quantifiers/quant_conflict_find.cpp
+++ b/src/theory/quantifiers/quant_conflict_find.cpp
@@ -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;
diff --git a/src/theory/quantifiers/quantifiers_rewriter.cpp b/src/theory/quantifiers/quantifiers_rewriter.cpp
index 88c6cd96f..adb91fddd 100644
--- a/src/theory/quantifiers/quantifiers_rewriter.cpp
+++ b/src/theory/quantifiers/quantifiers_rewriter.cpp
@@ -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);
diff --git a/src/theory/quantifiers/skolemize.cpp b/src/theory/quantifiers/skolemize.cpp
index 6dcb318f3..4dea0dc22 100644
--- a/src/theory/quantifiers/skolemize.cpp
+++ b/src/theory/quantifiers/skolemize.cpp
@@ -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);
}
diff --git a/src/theory/quantifiers/sygus/cegis_unif.cpp b/src/theory/quantifiers/sygus/cegis_unif.cpp
index b60bc2736..be80992ea 100644
--- a/src/theory/quantifiers/sygus/cegis_unif.cpp
+++ b/src/theory/quantifiers/sygus/cegis_unif.cpp
@@ -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";
diff --git a/src/theory/quantifiers/sygus/sygus_enumerator.cpp b/src/theory/quantifiers/sygus/sygus_enumerator.cpp
index 959532d98..674183b20 100644
--- a/src/theory/quantifiers/sygus/sygus_enumerator.cpp
+++ b/src/theory/quantifiers/sygus/sygus_enumerator.cpp
@@ -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]);
}
diff --git a/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp b/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
index 034f5f23c..b8981c13d 100644
--- a/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
+++ b/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
@@ -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";
diff --git a/src/theory/quantifiers/sygus_sampler.cpp b/src/theory/quantifiers/sygus_sampler.cpp
index 2fc7f0c29..89cee0145 100644
--- a/src/theory/quantifiers/sygus_sampler.cpp
+++ b/src/theory/quantifiers/sygus_sampler.cpp
@@ -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);
}
}
}
diff --git a/src/theory/quantifiers/term_util.cpp b/src/theory/quantifiers/term_util.cpp
index de4c56552..8e76c0a3a 100644
--- a/src/theory/quantifiers/term_util.cpp
+++ b/src/theory/quantifiers/term_util.cpp
@@ -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())
{
diff --git a/src/theory/sets/cardinality_extension.cpp b/src/theory/sets/cardinality_extension.cpp
index f65c41b53..57b49570d 100644
--- a/src/theory/sets/cardinality_extension.cpp
+++ b/src/theory/sets/cardinality_extension.cpp
@@ -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);
}
diff --git a/src/theory/sets/theory_sets_private.cpp b/src/theory/sets/theory_sets_private.cpp
index 7b596be86..407352d94 100644
--- a/src/theory/sets/theory_sets_private.cpp
+++ b/src/theory/sets/theory_sets_private.cpp
@@ -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()
diff --git a/src/theory/sets/theory_sets_rewriter.cpp b/src/theory/sets/theory_sets_rewriter.cpp
index 181a659c5..3ae937f3b 100644
--- a/src/theory/sets/theory_sets_rewriter.cpp
+++ b/src/theory/sets/theory_sets_rewriter.cpp
@@ -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)
{
diff --git a/src/theory/strings/arith_entail.cpp b/src/theory/strings/arith_entail.cpp
index 9e3d8ad38..d8a4e85aa 100644
--- a/src/theory/strings/arith_entail.cpp
+++ b/src/theory/strings/arith_entail.cpp
@@ -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)
diff --git a/src/theory/strings/array_solver.cpp b/src/theory/strings/array_solver.cpp
index 09e3aefdd..1ff2e2da8 100644
--- a/src/theory/strings/array_solver.cpp
+++ b/src/theory/strings/array_solver.cpp
@@ -42,7 +42,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() {}
diff --git a/src/theory/strings/base_solver.cpp b/src/theory/strings/base_solver.cpp
index 1e30b1623..69d41e9d7 100644
--- a/src/theory/strings/base_solver.cpp
+++ b/src/theory/strings/base_solver.cpp
@@ -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;
diff --git a/src/theory/strings/core_solver.cpp b/src/theory/strings/core_solver.cpp
index 3cf08a8d6..cc9365d38 100644
--- a/src/theory/strings/core_solver.cpp
+++ b/src/theory/strings/core_solver.cpp
@@ -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)
diff --git a/src/theory/strings/infer_proof_cons.cpp b/src/theory/strings/infer_proof_cons.cpp
index 5090b15cb..edfb91c64 100644
--- a/src/theory/strings/infer_proof_cons.cpp
+++ b/src/theory/strings/infer_proof_cons.cpp
@@ -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;
diff --git a/src/theory/strings/inference_manager.cpp b/src/theory/strings/inference_manager.cpp
index 277cc72e1..5247e222d 100644
--- a/src/theory/strings/inference_manager.cpp
+++ b/src/theory/strings/inference_manager.cpp
@@ -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);
}
diff --git a/src/theory/strings/proof_checker.cpp b/src/theory/strings/proof_checker.cpp
index b9038e3c8..edb38e702 100644
--- a/src/theory/strings/proof_checker.cpp
+++ b/src/theory/strings/proof_checker.cpp
@@ -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);
diff --git a/src/theory/strings/regexp_elim.cpp b/src/theory/strings/regexp_elim.cpp
index d5b7606f2..8a96e22d2 100644
--- a/src/theory/strings/regexp_elim.cpp
+++ b/src/theory/strings/regexp_elim.cpp
@@ -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)
diff --git a/src/theory/strings/regexp_entail.cpp b/src/theory/strings/regexp_entail.cpp
index 530f34455..c9d890358 100644
--- a/src/theory/strings/regexp_entail.cpp
+++ b/src/theory/strings/regexp_entail.cpp
@@ -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)
{
diff --git a/src/theory/strings/regexp_operation.cpp b/src/theory/strings/regexp_operation.cpp
index fff512f98..a7ba37b18 100644
--- a/src/theory/strings/regexp_operation.cpp
+++ b/src/theory/strings/regexp_operation.cpp
@@ -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;
}
diff --git a/src/theory/strings/sequences_rewriter.cpp b/src/theory/strings/sequences_rewriter.cpp
index babf260fc..721d875d0 100644
--- a/src/theory/strings/sequences_rewriter.cpp
+++ b/src/theory/strings/sequences_rewriter.cpp
@@ -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
{
diff --git a/src/theory/strings/skolem_cache.cpp b/src/theory/strings/skolem_cache.cpp
index dd4093e30..eb09ff187 100644
--- a/src/theory/strings/skolem_cache.cpp
+++ b/src/theory/strings/skolem_cache.cpp
@@ -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)
{
diff --git a/src/theory/strings/solver_state.cpp b/src/theory/strings/solver_state.cpp
index dfb246954..045347cbb 100644
--- a/src/theory/strings/solver_state.cpp
+++ b/src/theory/strings/solver_state.cpp
@@ -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);
}
diff --git a/src/theory/strings/strings_entail.cpp b/src/theory/strings/strings_entail.cpp
index 3b90338fc..6e4ba25a5 100644
--- a/src/theory/strings/strings_entail.cpp
+++ b/src/theory/strings/strings_entail.cpp
@@ -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)
diff --git a/src/theory/strings/strings_fmf.cpp b/src/theory/strings/strings_fmf.cpp
index b1050f480..2951c86a2 100644
--- a/src/theory/strings/strings_fmf.cpp
+++ b/src/theory/strings/strings_fmf.cpp
@@ -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;
}
diff --git a/src/theory/strings/strings_rewriter.cpp b/src/theory/strings/strings_rewriter.cpp
index 46b36986a..e4b91d4d8 100644
--- a/src/theory/strings/strings_rewriter.cpp
+++ b/src/theory/strings/strings_rewriter.cpp
@@ -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);
}
diff --git a/src/theory/strings/term_registry.cpp b/src/theory/strings/term_registry.cpp
index 1124be488..85027370e 100644
--- a/src/theory/strings/term_registry.cpp
+++ b/src/theory/strings/term_registry.cpp
@@ -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);
}
diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp
index 799becd29..8324e3edb 100644
--- a/src/theory/strings/theory_strings.cpp
+++ b/src/theory/strings/theory_strings.cpp
@@ -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());
diff --git a/src/theory/strings/theory_strings_preprocess.cpp b/src/theory/strings/theory_strings_preprocess.cpp
index 31f43d565..4f27371ff 100644
--- a/src/theory/strings/theory_strings_preprocess.cpp
+++ b/src/theory/strings/theory_strings_preprocess.cpp
@@ -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,
diff --git a/src/theory/strings/theory_strings_utils.cpp b/src/theory/strings/theory_strings_utils.cpp
index 59bb0755c..a133babba 100644
--- a/src/theory/strings/theory_strings_utils.cpp
+++ b/src/theory/strings/theory_strings_utils.cpp
@@ -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)
diff --git a/test/unit/node/node_algorithm_black.cpp b/test/unit/node/node_algorithm_black.cpp
index df8fb9383..8dac2cfda 100644
--- a/test/unit/node/node_algorithm_black.cpp
+++ b/test/unit/node/node_algorithm_black.cpp
@@ -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);
diff --git a/test/unit/node/node_black.cpp b/test/unit/node/node_black.cpp
index b170ccbb6..50e766e61 100644
--- a/test/unit/node/node_black.cpp
+++ b/test/unit/node/node_black.cpp
@@ -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());
diff --git a/test/unit/node/node_builder_black.cpp b/test/unit/node/node_builder_black.cpp
index 05ccfc90c..779397e04 100644
--- a/test/unit/node/node_builder_black.cpp
+++ b/test/unit/node/node_builder_black.cpp
@@ -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));
diff --git a/test/unit/node/node_manager_black.cpp b/test/unit/node/node_manager_black.cpp
index b02790cb5..ad41155c3 100644
--- a/test/unit/node/node_manager_black.cpp
+++ b/test/unit/node/node_manager_black.cpp
@@ -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);
}
diff --git a/test/unit/node/node_manager_white.cpp b/test/unit/node/node_manager_white.cpp
index fe06f85d3..64f6a70f5 100644
--- a/test/unit/node/node_manager_white.cpp
+++ b/test/unit/node/node_manager_white.cpp
@@ -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());
}
diff --git a/test/unit/node/node_white.cpp b/test/unit/node/node_white.cpp
index eb6f77bdc..8061526d5 100644
--- a/test/unit/node/node_white.cpp
+++ b/test/unit/node/node_white.cpp
@@ -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);
diff --git a/test/unit/node/type_node_white.cpp b/test/unit/node/type_node_white.cpp
index 9f93017f0..424fee989 100644
--- a/test/unit/node/type_node_white.cpp
+++ b/test/unit/node/type_node_white.cpp
@@ -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;
diff --git a/test/unit/preprocessing/pass_foreign_theory_rewrite_white.cpp b/test/unit/preprocessing/pass_foreign_theory_rewrite_white.cpp
index a6af29315..6687f2459 100644
--- a/test/unit/preprocessing/pass_foreign_theory_rewrite_white.cpp
+++ b/test/unit/preprocessing/pass_foreign_theory_rewrite_white.cpp
@@ -19,10 +19,10 @@
#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);
diff --git a/test/unit/theory/arith_poly_white.cpp b/test/unit/theory/arith_poly_white.cpp
index 3e0bb6c17..9127fadff 100644
--- a/test/unit/theory/arith_poly_white.cpp
+++ b/test/unit/theory/arith_poly_white.cpp
@@ -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);
diff --git a/test/unit/theory/evaluator_white.cpp b/test/unit/theory/evaluator_white.cpp
index 438f28c2d..4ff6d174f 100644
--- a/test/unit/theory/evaluator_white.cpp
+++ b/test/unit/theory/evaluator_white.cpp
@@ -25,10 +25,10 @@
#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
diff --git a/test/unit/theory/sequences_rewriter_white.cpp b/test/unit/theory/sequences_rewriter_white.cpp
index 165479b78..005e5cc3f 100644
--- a/test/unit/theory/sequences_rewriter_white.cpp
+++ b/test/unit/theory/sequences_rewriter_white.cpp
@@ -28,11 +28,11 @@
#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:
//
diff --git a/test/unit/theory/theory_arith_cad_white.cpp b/test/unit/theory/theory_arith_cad_white.cpp
index 719b76cab..8d5ca9923 100644
--- a/test/unit/theory/theory_arith_cad_white.cpp
+++ b/test/unit/theory/theory_arith_cad_white.cpp
@@ -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");
diff --git a/test/unit/theory/theory_arith_pow2_white.cpp b/test/unit/theory/theory_arith_pow2_white.cpp
index 697073434..fd942c5b5 100644
--- a/test/unit/theory/theory_arith_pow2_white.cpp
+++ b/test/unit/theory/theory_arith_pow2_white.cpp
@@ -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;
diff --git a/test/unit/theory/theory_arith_white.cpp b/test/unit/theory/theory_arith_white.cpp
index a41378106..8805c7119 100644
--- a/test/unit/theory/theory_arith_white.cpp
+++ b/test/unit/theory/theory_arith_white.cpp
@@ -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);
diff --git a/test/unit/theory/theory_bags_normal_form_white.cpp b/test/unit/theory/theory_bags_normal_form_white.cpp
index 9634d55c2..6c52f539d 100644
--- a/test/unit/theory/theory_bags_normal_form_white.cpp
+++ b/test/unit/theory/theory_bags_normal_form_white.cpp
@@ -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;
diff --git a/test/unit/theory/theory_bags_rewriter_white.cpp b/test/unit/theory/theory_bags_rewriter_white.cpp
index 7250f581c..639de0a66 100644
--- a/test/unit/theory/theory_bags_rewriter_white.cpp
+++ b/test/unit/theory/theory_bags_rewriter_white.cpp
@@ -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);
}
diff --git a/test/unit/theory/theory_bags_type_rules_white.cpp b/test/unit/theory/theory_bags_type_rules_white.cpp
index 682ae5bb2..b516685af 100644
--- a/test/unit/theory/theory_bags_type_rules_white.cpp
+++ b/test/unit/theory/theory_bags_type_rules_white.cpp
@@ -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);
diff --git a/test/unit/theory/theory_black.cpp b/test/unit/theory/theory_black.cpp
index d8ae8e468..1aea9e481 100644
--- a/test/unit/theory/theory_black.cpp
+++ b/test/unit/theory/theory_black.cpp
@@ -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());
diff --git a/test/unit/theory/theory_bv_int_blaster_white.cpp b/test/unit/theory/theory_bv_int_blaster_white.cpp
index 39ae835e0..106a0a39e 100644
--- a/test/unit/theory/theory_bv_int_blaster_white.cpp
+++ b/test/unit/theory/theory_bv_int_blaster_white.cpp
@@ -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
diff --git a/test/unit/theory/theory_engine_white.cpp b/test/unit/theory/theory_engine_white.cpp
index 8185c2354..9aeedbfe6 100644
--- a/test/unit/theory/theory_engine_white.cpp
+++ b/test/unit/theory/theory_engine_white.cpp
@@ -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);
diff --git a/test/unit/theory/theory_int_opt_white.cpp b/test/unit/theory/theory_int_opt_white.cpp
index 5f440006b..aee6a249b 100644
--- a/test/unit/theory/theory_int_opt_white.cpp
+++ b/test/unit/theory/theory_int_opt_white.cpp
@@ -18,11 +18,11 @@
#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);
diff --git a/test/unit/theory/theory_sets_type_rules_white.cpp b/test/unit/theory/theory_sets_type_rules_white.cpp
index 2fcd626e3..f5ca53451 100644
--- a/test/unit/theory/theory_sets_type_rules_white.cpp
+++ b/test/unit/theory/theory_sets_type_rules_white.cpp
@@ -19,10 +19,9 @@
#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));
diff --git a/test/unit/theory/theory_strings_skolem_cache_black.cpp b/test/unit/theory/theory_strings_skolem_cache_black.cpp
index 24ed0cd06..bb4b8122b 100644
--- a/test/unit/theory/theory_strings_skolem_cache_black.cpp
+++ b/test/unit/theory/theory_strings_skolem_cache_black.cpp
@@ -21,10 +21,10 @@
#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());
diff --git a/test/unit/theory/type_enumerator_white.cpp b/test/unit/theory/type_enumerator_white.cpp
index bb7ef871c..ac7472560 100644
--- a/test/unit/theory/type_enumerator_white.cpp
+++ b/test/unit/theory/type_enumerator_white.cpp
@@ -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());
diff --git a/test/unit/util/array_store_all_white.cpp b/test/unit/util/array_store_all_white.cpp
index 1272926db..887a214dd 100644
--- a/test/unit/util/array_store_all_white.cpp
+++ b/test/unit/util/array_store_all_white.cpp
@@ -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
diff --git a/test/unit/util/datatype_black.cpp b/test/unit/util/datatype_black.cpp
index 760bb2f75..15dde0cc2 100644
--- a/test/unit/util/datatype_black.cpp
+++ b/test/unit/util/datatype_black.cpp
@@ -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);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback