Node BoundVarManager::getCacheValue(size_t i)
{
- return NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(i));
+ return NodeManager::currentNM()->mkConstInt(Rational(i));
}
Node BoundVarManager::getCacheValue(TNode cv, size_t i)
ss << "sel_" << index;
SkolemManager* sm = nm->getSkolemManager();
TypeNode stype = nm->mkSelectorType(dtt, t);
- Node nindex = nm->mkConst(CONST_RATIONAL, Rational(index));
+ Node nindex = nm->mkConstInt(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
case OR: nullTerm = nm->mkConst(false); break;
case AND:
case SEP_STAR: nullTerm = nm->mkConst(true); break;
- case PLUS: nullTerm = nm->mkConst(CONST_RATIONAL, Rational(0)); break;
+ case PLUS: nullTerm = nm->mkConstRealOrInt(tn, Rational(0)); break;
case MULT:
case NONLINEAR_MULT:
- nullTerm = nm->mkConst(CONST_RATIONAL, Rational(1));
+ nullTerm = nm->mkConstRealOrInt(tn, Rational(1));
break;
case STRING_CONCAT:
// handles strings and sequences
*/
Node mkConstInt(const Rational& r);
+ /**
+ * Make constant real or int, which calls one of the above methods based
+ * on the type tn.
+ */
+ Node mkConstRealOrInt(const TypeNode& tn, const Rational& r);
+
/** Create a node with children. */
TypeNode mkTypeNode(Kind kind, TypeNode child1);
TypeNode mkTypeNode(Kind kind, TypeNode child1, TypeNode child2);
return mkConst(kind::CONST_RATIONAL, r);
}
+Node NodeManager::mkConstRealOrInt(const TypeNode& tn, const Rational& r)
+{
+ Assert(tn.isRealOrInt()) << "Expected real or int for mkConstRealOrInt, got "
+ << tn;
+ if (tn.isReal())
+ {
+ return mkConstReal(r);
+ }
+ return mkConstInt(r);
+}
+
} // namespace cvc5
Node TCtxNode::computeNodeHash(Node n, uint32_t val)
{
NodeManager* nm = NodeManager::currentNM();
- return nm->mkNode(kind::SEXPR, n, nm->mkConst(CONST_RATIONAL, Rational(val)));
+ return nm->mkNode(kind::SEXPR, n, nm->mkConstInt(Rational(val)));
}
Node TCtxNode::decomposeNodeHash(Node h, uint32_t& val)
Node getNodeHash() const;
/**
* Get node hash, which is a unique node representation of the pair (n, val).
- * In particular, this returns (SEXPR n (CONST_RATIONAL val)).
+ * In particular, this returns (SEXPR n (CONST_INTEGER val)).
*/
static Node computeNodeHash(Node n, uint32_t val);
/**
}
else if (current.isConst())
{
- switch (current.getKind())
+ if (current.getType().isInteger())
{
- case kind::CONST_RATIONAL:
+ Rational constant = current.getConst<Rational>();
+ Assert (constant.isIntegral());
+ BitVector bv(size, constant.getNumerator());
+ if (bv.toSignedInteger() != constant.getNumerator())
{
- Rational constant = current.getConst<Rational>();
- if (constant.isIntegral()) {
- BitVector bv(size, constant.getNumerator());
- if (bv.toSignedInteger() != constant.getNumerator())
- {
- throw TypeCheckingExceptionPrivate(
- current,
- string("Not enough bits for constant in intToBV: ")
- + current.toString());
- }
- result = nm->mkConst(bv);
- }
- break;
+ throw TypeCheckingExceptionPrivate(
+ current,
+ string("Not enough bits for constant in intToBV: ")
+ + current.toString());
}
- default: break;
+ result = nm->mkConst(bv);
}
}
else
NodeManager* nm = NodeManager::currentNM();
SkolemManager* sm = nm->getSkolemManager();
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0)),
- one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node zero = nm->mkConstInt(Rational(0)), one = nm->mkConstInt(Rational(1));
Node trueNode = nm->mkConst(true);
unordered_map<TNode, Node> intVars;
break;
}
if ((*j1)[1].getKind() != kind::EQUAL
- || !(((*j1)[1][0].isVar()
- && (*j1)[1][1].getKind() == kind::CONST_RATIONAL)
- || ((*j1)[1][0].getKind() == kind::CONST_RATIONAL
- && (*j1)[1][1].isVar())))
+ || !(((*j1)[1][0].isVar() && (*j1)[1][1].isConst())
+ || ((*j1)[1][0].isConst() && (*j1)[1][1].isVar())))
{
eligible = false;
Debug("miplib") << " -- INELIGIBLE -- (=> (and X X) X)" << endl;
}
sort(posv.begin(), posv.end());
const Node pos = NodeManager::currentNM()->mkNode(kind::AND, posv);
- const TNode var = ((*j1)[1][0].getKind() == kind::CONST_RATIONAL)
- ? (*j1)[1][1]
- : (*j1)[1][0];
+ const TNode var = ((*j1)[1][0].isConst()) ? (*j1)[1][1] : (*j1)[1][0];
const pair<Node, Node> pos_var(pos, var);
- const Rational& constant =
- ((*j1)[1][0].getKind() == kind::CONST_RATIONAL)
- ? (*j1)[1][0].getConst<Rational>()
- : (*j1)[1][1].getConst<Rational>();
+ const Rational& constant = ((*j1)[1][0].isConst())
+ ? (*j1)[1][0].getConst<Rational>()
+ : (*j1)[1][1].getConst<Rational>();
uint64_t mark = 0;
unsigned countneg = 0, thepos = 0;
for (unsigned ii = 0; ii < pos.getNumChildren(); ++ii)
const bool xneg = (x.getKind() == kind::NOT);
x = xneg ? x[0] : x;
Debug("miplib") << " x:" << x << " " << xneg << endl;
- const TNode var = ((*j1)[1][0].getKind() == kind::CONST_RATIONAL)
- ? (*j1)[1][1]
- : (*j1)[1][0];
+ const TNode var = ((*j1)[1][0].isConst()) ? (*j1)[1][1] : (*j1)[1][0];
const pair<Node, Node> x_var(x, var);
- const Rational& constant =
- ((*j1)[1][0].getKind() == kind::CONST_RATIONAL)
- ? (*j1)[1][0].getConst<Rational>()
- : (*j1)[1][1].getConst<Rational>();
+ const Rational& constant = ((*j1)[1][0].isConst())
+ ? (*j1)[1][0].getConst<Rational>()
+ : (*j1)[1][1].getConst<Rational>();
unsigned mark = (xneg ? 0 : 1);
if ((marks[x_var] & (1u << mark)) != 0)
{
NodeBuilder sumb(kind::PLUS);
for (size_t jj = 0; jj < pos.getNumChildren(); ++jj)
{
- sumb << nm->mkNode(kind::MULT,
- nm->mkConst(CONST_RATIONAL, coef[pos_var][jj]),
- newVars[jj]);
+ sumb << nm->mkNode(
+ kind::MULT, nm->mkConstInt(coef[pos_var][jj]), newVars[jj]);
}
sum = sumb;
}
else
{
- sum = nm->mkNode(kind::MULT,
- nm->mkConst(CONST_RATIONAL, coef[pos_var][0]),
- newVars[0]);
+ sum = nm->mkNode(
+ kind::MULT, nm->mkConstInt(coef[pos_var][0]), newVars[0]);
}
Debug("miplib") << "vars[] " << var << endl
<< " eq " << rewrite(sum) << endl;
Node l = assertion[0];
Node r = assertion[1];
- if (r.getKind() != kind::CONST_RATIONAL)
+ if (!r.isConst())
{
Debug("pbs::rewrites") << "not rhs constant" << assertion << std::endl;
return false;
Node l = assertion[0];
Node r = assertion[1];
- if (r.getKind() == kind::CONST_RATIONAL)
+ if (r.isConst())
{
const Rational& rc = r.getConst<Rational>();
if (isIntVar(l))
else if (l.getKind() == kind::MULT && l.getNumChildren() == 2)
{
Node c = l[0], v = l[1];
- if (c.getKind() == kind::CONST_RATIONAL
- && c.getConst<Rational>().isNegativeOne())
+ if (c.isConst() && c.getConst<Rational>().isNegativeOne())
{
if (isIntVar(v))
{
if (!c.isNull())
{
Assert(c.isConst());
- coeffs.push_back(NodeManager::currentNM()->mkConst(
- CONST_RATIONAL,
+ coeffs.push_back(nm->mkConstInt(
Rational(c.getConst<Rational>().getDenominator())));
}
}
}
Node sumt =
sum.empty()
- ? 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(CONST_RATIONAL, Rational(0)));
+ ? nm->mkConstInt(Rational(0))
+ : (sum.size() == 1 ? sum[0] : nm->mkNode(kind::PLUS, sum));
+ ret = nm->mkNode(
+ ret_lit.getKind(), sumt, nm->mkConstInt(Rational(0)));
if (!ret_pol)
{
ret = ret.negate();
if (current.getType().isInteger())
{
// div/mult by 1 should have been simplified
- Assert(other != nm->mkConst(CONST_RATIONAL, Rational(1)));
+ Assert(other != nm->mkConstInt(Rational(1)));
// div by -1 should have been simplified
- if (other != nm->mkConst(CONST_RATIONAL, Rational(-1)))
+ if (other != nm->mkConstInt(Rational(-1)))
{
break;
}
}
// bound variable v is (bvar x T)
TypeNode intType = nm->integerType();
- Node x = nm->mkConst(CONST_RATIONAL, Rational(getOrAssignIndexForVar(n)));
+ Node x = nm->mkConstInt(Rational(getOrAssignIndexForVar(n)));
Node tc = typeAsNode(convertType(tn));
TypeNode ftype = nm->mkFunctionType({intType, d_sortType}, tn);
Node bvarOp = getSymbolInternal(k, ftype, "bvar");
TypeNode intType = nm->integerType();
TypeNode varType = nm->mkFunctionType({intType, d_sortType}, tn);
Node var = mkInternalSymbol("var", varType);
- Node index =
- nm->mkConst(CONST_RATIONAL, Rational(getOrAssignIndexForVar(n)));
+ Node index = nm->mkConstInt(Rational(getOrAssignIndexForVar(n)));
Node tc = typeAsNode(convertType(tn));
return nm->mkNode(APPLY_UF, var, index, tc);
}
Node hconstf = getSymbolInternal(k, tnh, "apply");
return nm->mkNode(APPLY_UF, hconstf, n[0], n[1]);
}
- else if (k == CONST_RATIONAL || k == CAST_TO_REAL)
+ else if (k == CONST_RATIONAL || k == CONST_INTEGER || k == CAST_TO_REAL)
{
if (k == CAST_TO_REAL)
{
do
{
n = n[0];
- Assert(n.getKind() == APPLY_UF || n.getKind() == CONST_RATIONAL);
- } while (n.getKind() != CONST_RATIONAL);
+ Assert(n.getKind() == APPLY_UF || n.getKind() == CONST_RATIONAL
+ || n.getKind() == CONST_INTEGER);
+ } while (n.getKind() != CONST_RATIONAL && n.getKind() != CONST_INTEGER);
}
TypeNode tnv = nm->mkFunctionType(tn, tn);
Node rconstf;
{
// use LFSC syntax for mpz negation
Node mpzn = getSymbolInternal(k, nm->mkFunctionType(tn, tn), "~");
- arg = nm->mkNode(APPLY_UF, mpzn, nm->mkConst(CONST_RATIONAL, r.abs()));
+ arg = nm->mkNode(APPLY_UF, mpzn, nm->mkConstInt(r.abs()));
}
else
{
Node rop = getSymbolInternal(
k, relType, printer::smt2::Smt2Printer::smtKindString(k));
RegExpLoop op = n.getOperator().getConst<RegExpLoop>();
- Node n1 = nm->mkConst(CONST_RATIONAL, Rational(op.d_loopMinOcc));
- Node n2 = nm->mkConst(CONST_RATIONAL, Rational(op.d_loopMaxOcc));
+ Node n1 = nm->mkConstInt(Rational(op.d_loopMinOcc));
+ Node n2 = nm->mkConstInt(Rational(op.d_loopMaxOcc));
return nm->mkNode(APPLY_UF, nm->mkNode(APPLY_UF, rop, n1, n2), n[0]);
}
else if (k == MATCH)
else if (k == BITVECTOR_TYPE)
{
tnn = d_typeKindToNodeCons[k];
- Node w = nm->mkConst(CONST_RATIONAL, Rational(tn.getBitVectorSize()));
+ Node w = nm->mkConstInt(Rational(tn.getBitVectorSize()));
tnn = nm->mkNode(APPLY_UF, tnn, w);
}
else if (k == FLOATINGPOINT_TYPE)
{
tnn = d_typeKindToNodeCons[k];
- Node e = nm->mkConst(CONST_RATIONAL,
- Rational(tn.getFloatingPointExponentSize()));
- Node s = nm->mkConst(CONST_RATIONAL,
- Rational(tn.getFloatingPointSignificandSize()));
+ Node e = nm->mkConstInt(Rational(tn.getFloatingPointExponentSize()));
+ Node s = nm->mkConstInt(Rational(tn.getFloatingPointSignificandSize()));
tnn = nm->mkNode(APPLY_UF, tnn, e, s);
}
else if (tn.getNumChildren() == 0)
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(CONST_RATIONAL, Rational(vec[i])));
+ Node cc = nm->mkNode(APPLY_UF, aconstf, nm->mkConstInt(Rational(vec[i])));
chars.push_back(cc);
}
}
case BITVECTOR_EXTRACT:
{
BitVectorExtract p = n.getConst<BitVectorExtract>();
- indices.push_back(nm->mkConst(CONST_RATIONAL, Rational(p.d_high)));
- indices.push_back(nm->mkConst(CONST_RATIONAL, Rational(p.d_low)));
+ indices.push_back(nm->mkConstInt(Rational(p.d_high)));
+ indices.push_back(nm->mkConstInt(Rational(p.d_low)));
break;
}
case BITVECTOR_REPEAT:
- indices.push_back(
- nm->mkConst(CONST_RATIONAL,
- Rational(n.getConst<BitVectorRepeat>().d_repeatAmount)));
+ indices.push_back(nm->mkConstInt(
+ Rational(n.getConst<BitVectorRepeat>().d_repeatAmount)));
break;
case BITVECTOR_ZERO_EXTEND:
- indices.push_back(nm->mkConst(
- CONST_RATIONAL,
+ indices.push_back(nm->mkConstInt(
Rational(n.getConst<BitVectorZeroExtend>().d_zeroExtendAmount)));
break;
case BITVECTOR_SIGN_EXTEND:
- indices.push_back(nm->mkConst(
- CONST_RATIONAL,
+ indices.push_back(nm->mkConstInt(
Rational(n.getConst<BitVectorSignExtend>().d_signExtendAmount)));
break;
case BITVECTOR_ROTATE_LEFT:
- indices.push_back(nm->mkConst(
- CONST_RATIONAL,
+ indices.push_back(nm->mkConstInt(
Rational(n.getConst<BitVectorRotateLeft>().d_rotateLeftAmount)));
break;
case BITVECTOR_ROTATE_RIGHT:
- indices.push_back(nm->mkConst(
- CONST_RATIONAL,
+ indices.push_back(nm->mkConstInt(
Rational(n.getConst<BitVectorRotateRight>().d_rotateRightAmount)));
break;
case INT_TO_BITVECTOR:
- indices.push_back(nm->mkConst(
- CONST_RATIONAL, Rational(n.getConst<IntToBitVector>().d_size)));
+ indices.push_back(
+ nm->mkConstInt(Rational(n.getConst<IntToBitVector>().d_size)));
break;
case IAND:
- indices.push_back(
- nm->mkConst(CONST_RATIONAL, Rational(n.getConst<IntAnd>().d_size)));
+ indices.push_back(nm->mkConstInt(Rational(n.getConst<IntAnd>().d_size)));
break;
case APPLY_TESTER:
{
Node LfscNodeConverter::getOperatorOfBoundVar(Node cop, Node v)
{
NodeManager* nm = NodeManager::currentNM();
- Node x = nm->mkConst(CONST_RATIONAL, Rational(getOrAssignIndexForVar(v)));
+ Node x = nm->mkConstInt(Rational(getOrAssignIndexForVar(v)));
Node tc = typeAsNode(convertType(v.getType()));
return nm->mkNode(APPLY_UF, cop, x, tc);
}
Node mkLfscRuleNode(LfscRule r)
{
- return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- Rational(static_cast<uint32_t>(r)));
+ return NodeManager::currentNM()->mkConstInt(
+ Rational(static_cast<uint32_t>(r)));
}
bool LfscProofLetifyTraverseCallback::shouldTraverse(const ProofNode* pn)
Node mkMethodId(MethodId id)
{
- return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- Rational(static_cast<uint32_t>(id)));
+ return NodeManager::currentNM()->mkConstInt(
+ Rational(static_cast<uint32_t>(id)));
}
bool getMethodId(TNode n, MethodId& i)
// UNDEFINED_KIND is negative, hence return null to avoid cast
return Node::null();
}
- return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- Rational(static_cast<uint32_t>(k)));
+ return NodeManager::currentNM()->mkConstInt(
+ Rational(static_cast<uint32_t>(k)));
}
ProofCheckerStatistics::ProofCheckerStatistics()
for (unsigned i = 0, size = node.getNumChildren(); i < size; ++i)
{
// Create a proof step for each n_i
- Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
+ Node iNode = nm->mkConstInt(i);
d_proof.addStep(node[i], PfRule::AND_ELIM, {node}, {iNode});
Trace("cnf") << "ProofCnfStream::convertAndAssertAnd: AND_ELIM " << i
<< " added norm " << node[i] << "\n";
for (unsigned i = 0, size = node.getNumChildren(); i < size; ++i)
{
// Create a proof step for each (not n_i)
- Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
+ Node iNode = nm->mkConstInt(i);
d_proof.addStep(
node[i].notNode(), PfRule::NOT_OR_ELIM, {node.notNode()}, {iNode});
Trace("cnf") << "ProofCnfStream::convertAndAssertOr: NOT_OR_ELIM " << i
if (added)
{
Node clauseNode = nm->mkNode(kind::OR, node.notNode(), node[i]);
- Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
+ Node iNode = nm->mkConstInt(i);
d_proof.addStep(clauseNode, PfRule::CNF_AND_POS, {}, {node, iNode});
Trace("cnf") << "ProofCnfStream::handleAnd: CNF_AND_POS " << i
<< " added " << clauseNode << "\n";
if (added)
{
Node clauseNode = nm->mkNode(kind::OR, node, node[i].notNode());
- Node iNode = nm->mkConst<Rational>(CONST_RATIONAL, i);
+ Node iNode = nm->mkConstInt(i);
d_proof.addStep(clauseNode, PfRule::CNF_OR_NEG, {}, {node, iNode});
Trace("cnf") << "ProofCnfStream::handleOr: CNF_OR_NEG " << i << " added "
<< clauseNode << "\n";
NodeManager* nm = NodeManager::currentNM();
for (const std::pair<const Node, uint64_t>& d : d_accMap)
{
- dmap[d.first] = nm->mkConst(CONST_RATIONAL, Rational(d.second));
+ dmap[d.first] = nm->mkConstInt(Rational(d.second));
}
}
for (size_t j = 0, nchildi = children[i].getNumChildren(); j < nchildi;
j++)
{
- Node nodej = nm->mkConst(CONST_RATIONAL, Rational(j));
+ Node nodej = nm->mkConstInt(Rational(j));
cdp->addStep(
children[i][j], PfRule::AND_ELIM, {children[i]}, {nodej});
}
TNode child = children[i];
TNode scalar = args[i];
bool isPos = scalar.getConst<Rational>() > 0;
- Node scalarCmp = nm->mkNode(
- isPos ? GT : LT, scalar, nm->mkConst(CONST_RATIONAL, Rational(0)));
+ Node scalarCmp =
+ nm->mkNode(isPos ? GT : LT,
+ scalar,
+ nm->mkConstRealOrInt(scalar.getType(), Rational(0)));
// (= scalarCmp true)
Node scalarCmpOrTrue = steps.tryStep(PfRule::EVALUATE, {}, {scalarCmp});
Assert(!scalarCmpOrTrue.isNull());
NodeManager* nm = NodeManager::currentNM();
d_false = nm->mkConst(false);
d_true = nm->mkConst(true);
- d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
- d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
- d_two = nm->mkConst(CONST_RATIONAL, Rational(2));
+ d_zero = nm->mkConstInt(Rational(0));
+ d_one = nm->mkConstInt(Rational(1));
+ d_two = nm->mkConstInt(Rational(2));
}
IAndSolver::~IAndSolver() {}
{
Assert(k >= 0);
NodeManager* nm = NodeManager::currentNM();
- return nm->mkConst(CONST_RATIONAL, Rational(intpow2(k)));
+ return nm->mkConstInt(Rational(intpow2(k)));
}
bool oneBitAnd(bool a, bool b) { return (a && b); }
IAndUtils::IAndUtils()
{
NodeManager* nm = NodeManager::currentNM();
- d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
- d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
- d_two = nm->mkConst(CONST_RATIONAL, Rational(2));
+ d_zero = nm->mkConstInt(Rational(0));
+ d_one = nm->mkConstInt(Rational(1));
+ d_two = nm->mkConstInt(Rational(2));
}
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(CONST_RATIONAL, Rational(table.at(std::make_pair(-1, -1))));
+ Node ite = nm->mkConstInt(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++)
// append the current value to the ite.
ite = nm->mkNode(
kind::ITE,
- 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)))),
+ nm->mkNode(kind::AND,
+ nm->mkNode(kind::EQUAL, x, nm->mkConstInt(Rational(i))),
+ nm->mkNode(kind::EQUAL, y, nm->mkConstInt(Rational(j)))),
+ nm->mkConstInt(Rational(table.at(std::make_pair(i, j)))),
ite);
}
}
// number of elements in the sum expression
uint64_t sumSize = bvsize / granularity;
// initialize the sum
- Node sumNode = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node sumNode = nm->mkConstInt(Rational(0));
// compute the table for the current granularity if needed
if (d_bvandTable.find(granularity) == d_bvandTable.end())
{
{
// could be faster
NodeManager* nm = NodeManager::currentNM();
- return nm->mkNode(kind::POW, d_two, nm->mkConst(CONST_RATIONAL, Rational(k)));
+ return nm->mkNode(kind::POW, d_two, nm->mkConstInt(Rational(k)));
}
Node IAndUtils::twoToKMinusOne(unsigned k) const
d_termReg(tr),
d_mapCache(userContext())
{
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
- d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
+ d_one = NodeManager::currentNM()->mkConstInt(Rational(1));
d_true = NodeManager::currentNM()->mkConst(true);
d_false = NodeManager::currentNM()->mkConst(false);
}
: d_statistics(statistics)
{
d_nm = NodeManager::currentNM();
- d_zero = d_nm->mkConst(CONST_RATIONAL, Rational(0));
- d_one = d_nm->mkConst(CONST_RATIONAL, Rational(1));
+ d_zero = d_nm->mkConstInt(Rational(0));
+ d_one = d_nm->mkConstInt(Rational(1));
}
RewriteResponse BagsRewriter::postRewrite(TNode n)
d_nm = NodeManager::currentNM();
d_sm = d_nm->getSkolemManager();
d_true = d_nm->mkConst(true);
- d_zero = d_nm->mkConst(CONST_RATIONAL, Rational(0));
- d_one = d_nm->mkConst(CONST_RATIONAL, Rational(1));
+ d_zero = d_nm->mkConstInt(Rational(0));
+ d_one = d_nm->mkConstInt(Rational(1));
}
InferInfo InferenceGenerator::nonNegativeCount(Node n, Node e)
}
TypeNode elementType = t.getBagElementType();
std::map<Node, Rational>::const_reverse_iterator it = elements.rbegin();
- Node bag = nm->mkBag(elementType,
- it->first,
- nm->mkConst<Rational>(CONST_RATIONAL, it->second));
+ Node bag = nm->mkBag(elementType, it->first, nm->mkConstInt(it->second));
while (++it != elements.rend())
{
- Node n = nm->mkBag(elementType,
- it->first,
- nm->mkConst<Rational>(CONST_RATIONAL, it->second));
+ Node n = nm->mkBag(elementType, it->first, nm->mkConstInt(it->second));
bag = nm->mkNode(BAG_UNION_DISJOINT, n, bag);
}
return bag;
NodeManager* nm = NodeManager::currentNM();
if (it != elements.end())
{
- Node count = nm->mkConst(CONST_RATIONAL, it->second);
+ Node count = nm->mkConstInt(it->second);
return count;
}
- return nm->mkConst(CONST_RATIONAL, Rational(0));
+ return nm->mkConstInt(Rational(0));
}
Node NormalForm::evaluateDuplicateRemoval(TNode n)
}
NodeManager* nm = NodeManager::currentNM();
- Node sumNode = nm->mkConst(CONST_RATIONAL, sum);
+ Node sumNode = nm->mkConstInt(sum);
return sumNode;
}
Node emptyBag = nm->mkConst(EmptyBag(bagType));
Node isEmpty = A.eqNode(emptyBag);
Node count = nm->mkNode(BAG_COUNT, x, A);
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstInt(Rational(1));
Node geqOne = nm->mkNode(GEQ, count, one);
Node geqOneAndEqual = geqOne.andNode(equal);
Node ite = nm->mkNode(ITE, isEmpty, equal, geqOneAndEqual);
BagEnumerator& BagEnumerator::operator++()
{
// increase the multiplicity by one
- Node one = d_nodeManager->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = d_nodeManager->mkConstInt(Rational(1));
TypeNode elementType = d_elementTypeEnumerator.getType();
Node singleton = d_nodeManager->mkBag(elementType, d_element, one);
if (d_currentBag.getKind() == kind::BAG_EMPTY)
/** Shorthand to create a Node from a constant number */
template <typename T>
-Node mkRat(T val)
+Node mkInt(T val)
{
- return NodeManager::currentNM()->mkConst<Rational>(CONST_RATIONAL, val);
+ return NodeManager::currentNM()->mkConstInt(Rational(val));
}
/**
return nullptr;
}
return mkProof(
- PfRule::AND_ELIM, {assume(d_parent)}, {mkRat(i - d_parent.begin())});
+ PfRule::AND_ELIM, {assume(d_parent)}, {mkInt(i - d_parent.begin())});
}
std::shared_ptr<ProofNode> ProofCircuitPropagatorBackward::orFalse(
}
return mkNot(mkProof(PfRule::NOT_OR_ELIM,
{assume(d_parent.notNode())},
- {mkRat(i - d_parent.begin())}));
+ {mkInt(i - d_parent.begin())}));
}
std::shared_ptr<ProofNode> ProofCircuitPropagatorBackward::iteC(bool c)
auto it = std::find(d_parent.begin(), d_parent.end(), d_child);
return mkResolution(
mkProof(
- PfRule::CNF_AND_POS, {}, {d_parent, mkRat(it - d_parent.begin())}),
+ PfRule::CNF_AND_POS, {}, {d_parent, mkInt(it - d_parent.begin())}),
d_child,
true);
}
}
auto it = std::find(d_parent.begin(), d_parent.end(), d_child);
return mkNot(mkResolution(
- mkProof(PfRule::CNF_OR_NEG, {}, {d_parent, mkRat(it - d_parent.begin())}),
+ mkProof(PfRule::CNF_OR_NEG, {}, {d_parent, mkInt(it - d_parent.begin())}),
d_child,
false));
}
Node BuiltinProofRuleChecker::mkTheoryIdNode(TheoryId tid)
{
- return NodeManager::currentNM()->mkConst(
- CONST_RATIONAL, Rational(static_cast<uint32_t>(tid)));
+ return NodeManager::currentNM()->mkConstInt(
+ Rational(static_cast<uint32_t>(tid)));
}
} // namespace builtin
d_context(userContext())
{
d_nm = NodeManager::currentNM();
- d_zero = d_nm->mkConst(CONST_RATIONAL, Rational(0));
- d_one = d_nm->mkConst(CONST_RATIONAL, Rational(1));
+ d_zero = d_nm->mkConstInt(0);
+ d_one = d_nm->mkConstInt(1);
};
IntBlaster::~IntBlaster() {}
{
Assert(k > 0);
Rational max_value = intpow2(k) - 1;
- return d_nm->mkConst(CONST_RATIONAL, max_value);
+ return d_nm->mkConstInt(max_value);
}
Node IntBlaster::pow2(uint64_t k)
{
Assert(k >= 0);
- return d_nm->mkConst(CONST_RATIONAL, intpow2(k));
+ return d_nm->mkConstInt(intpow2(k));
}
Node IntBlaster::modpow2(Node n, uint64_t exponent)
{
- Node p2 = d_nm->mkConst(CONST_RATIONAL, intpow2(exponent));
+ Node p2 = d_nm->mkConstInt(intpow2(exponent));
return d_nm->mkNode(kind::INTS_MODULUS_TOTAL, n, p2);
}
BitVector constant(original.getConst<BitVector>());
Integer c = constant.toInteger();
Rational r = Rational(c, Integer(1));
- translation = d_nm->mkConst(CONST_RATIONAL, r);
+ translation = d_nm->mkConstInt(r);
}
else
{
{
const unsigned size = utils::getSize(node[0]);
NodeManager* const nm = NodeManager::currentNM();
- const Node z = nm->mkConst(CONST_RATIONAL, Rational(0));
+ const Node z = nm->mkConstInt(Rational(0));
const Node bvone = utils::mkOne(1);
Integer i = 1;
nm->mkNode(kind::EQUAL,
nm->mkNode(nm->mkConst(BitVectorExtract(bit, bit)), node[0]),
bvone);
- children.push_back(nm->mkNode(
- kind::ITE, cond, nm->mkConst(CONST_RATIONAL, Rational(i)), z));
+ children.push_back(
+ nm->mkNode(kind::ITE, cond, nm->mkConstInt(Rational(i)), z));
}
// avoid plus with one child
return children.size() == 1 ? children[0] : nm->mkNode(kind::PLUS, children);
Integer i = 2;
while (v.size() < size)
{
- 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)));
+ Node cond = nm->mkNode(
+ kind::GEQ,
+ nm->mkNode(
+ kind::INTS_MODULUS_TOTAL, node[0], nm->mkConstInt(Rational(i))),
+ nm->mkConstInt(Rational(i, 2)));
v.push_back(nm->mkNode(kind::ITE, cond, bvone, bvzero));
i *= 2;
}
const DType& dt = utils::datatypeOf(constructor);
const DTypeConstructor& c = dt[constructorIndex];
unsigned weight = c.getWeight();
- children.push_back(nm->mkConst(CONST_RATIONAL, Rational(weight)));
+ children.push_back(nm->mkConstInt(Rational(weight)));
Node res =
children.size() == 1 ? children[0] : nm->mkNode(kind::PLUS, children);
Trace("datatypes-rewrite")
res = nm->mkConst(false);
break;
}
- children.push_back(nm->mkNode(kind::DT_HEIGHT_BOUND,
- in[0][i],
- nm->mkConst(CONST_RATIONAL, rmo)));
+ children.push_back(
+ nm->mkNode(kind::DT_HEIGHT_BOUND, in[0][i], nm->mkConstInt(rmo)));
}
}
if (res.isNull())
}
if (argSuccess)
{
- narg = nm->mkConst(CONST_RATIONAL, Rational(i));
+ narg = nm->mkConstInt(Rational(i));
break;
}
}
if (n >= 0)
{
Node t = exp[0];
- Node nn = nm->mkConst(CONST_RATIONAL, Rational(n));
+ Node nn = nm->mkConstInt(Rational(n));
Node eq = exp.eqNode(conc);
cdp->addStep(eq, PfRule::DT_INST, {}, {t, nn});
cdp->addStep(conc, PfRule::EQ_RESOLVE, {exp, eq}, {});
typerule DT_SIZE_BOUND ::cvc5::theory::datatypes::DtBoundTypeRule
operator DT_SYGUS_BOUND 2 "datatypes sygus bound"
-typerule DT_SYGUS_BOUND ::cvc5::theory::datatypes::DtSygusBoundTypeRule
+typerule DT_SYGUS_BOUND ::cvc5::theory::datatypes::DtBoundTypeRule
operator DT_SYGUS_EVAL 1: "datatypes sygus evaluation function"
-typerule DT_SYGUS_EVAL ::cvc5::theory::datatypes::DtSyguEvalTypeRule
+typerule DT_SYGUS_EVAL ::cvc5::theory::datatypes::DtSygusEvalTypeRule
# Kinds for match terms. For example, the match term
d_active_terms(context()),
d_currTermSize(context())
{
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
d_true = NodeManager::currentNM()->mkConst(true);
}
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(CONST_RATIONAL, Rational(0)));
+ Node mtlem =
+ nm->mkNode(kind::GEQ, d_measure_value, nm->mkConstInt(Rational(0)));
d_im.lemma(mtlem, InferenceId::DATATYPES_SYGUS_MT_POS);
}
return d_measure_value;
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(CONST_RATIONAL, Rational(0)));
+ Node mtlem = nm->mkNode(kind::GEQ, new_mt, nm->mkConstInt(Rational(0)));
d_measure_value_active = new_mt;
d_im.lemma(mtlem, InferenceId::DATATYPES_SYGUS_MT_POS);
}
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(CONST_RATIONAL, Rational(s)));
+ return nm->mkNode(DT_SYGUS_BOUND, d_this, nm->mkConstInt(Rational(s)));
}
int SygusExtension::getGuardStatus( Node g ) {
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(CONST_RATIONAL, Rational(1));
+ NodeManager::currentNM()->mkConstInt(Rational(1));
rt.d_children[1].d_req_type = dt[c].getArgType(0);
}
else if (k == LT || k == GEQ)
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(CONST_RATIONAL, Rational(1));
+ NodeManager::currentNM()->mkConstInt(Rational(1));
}
}
else if (pk == BITVECTOR_NOT)
{
d_true = NodeManager::currentNM()->mkConst( true );
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
d_dtfCounter = 0;
// indicate we are using the default theory state object
throw TypeCheckingExceptionPrivate(
n, "expecting datatype bound term to have datatype argument.");
}
- if (n[1].getKind() != kind::CONST_RATIONAL)
+ if (!n[1].isConst() || !n[1].getType().isInteger())
{
- throw TypeCheckingExceptionPrivate(n,
- "datatype bound must be a constant");
+ throw TypeCheckingExceptionPrivate(
+ n, "datatype bound must be a constant integer");
}
if (n[1].getConst<Rational>().getNumerator().sgn() == -1)
{
return nodeManager->booleanType();
}
-TypeNode DtSygusBoundTypeRule::computeType(NodeManager* nodeManager,
- TNode n,
- bool check)
-{
- if (check)
- {
- if (!n[0].getType().isDatatype())
- {
- throw TypeCheckingExceptionPrivate(
- n, "datatype sygus bound takes a datatype");
- }
- if (n[1].getKind() != kind::CONST_RATIONAL)
- {
- throw TypeCheckingExceptionPrivate(
- n, "datatype sygus bound must be a constant");
- }
- if (n[1].getConst<Rational>().getNumerator().sgn() == -1)
- {
- throw TypeCheckingExceptionPrivate(
- n, "datatype sygus bound must be non-negative");
- }
- }
- return nodeManager->booleanType();
-}
-
-TypeNode DtSyguEvalTypeRule::computeType(NodeManager* nodeManager,
- TNode n,
- bool check)
+TypeNode DtSygusEvalTypeRule::computeType(NodeManager* nodeManager,
+ TNode n,
+ bool check)
{
TypeNode headType = n[0].getType(check);
if (!headType.isDatatype())
static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
};
-class DtSygusBoundTypeRule {
- public:
- static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
-};
-
-class DtSyguEvalTypeRule
+class DtSygusEvalTypeRule
{
public:
static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
NodeManager* nm = NodeManager::currentNM();
for (const std::pair<const Node, uint64_t> p : d_dfmap)
{
- dmap[p.first] = nm->mkConst(CONST_RATIONAL, Rational(p.second));
+ dmap[p.first] = nm->mkConstInt(Rational(p.second));
}
}
Node mkInferenceIdNode(InferenceId i)
{
- return NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- Rational(static_cast<uint32_t>(i)));
+ return NodeManager::currentNM()->mkConstInt(
+ Rational(static_cast<uint32_t>(i)));
}
bool getInferenceId(TNode n, InferenceId& i)
}
else
{
- Assert(new_theta.getKind() == CONST_RATIONAL);
- Assert(pv_prop.d_coeff.getKind() == CONST_RATIONAL);
+ Assert(new_theta.isConst());
+ Assert(pv_prop.d_coeff.isConst());
NodeManager* nm = NodeManager::currentNM();
new_theta = nm->mkConst(CONST_RATIONAL,
Rational(new_theta.getConst<Rational>()
Node nn = NodeManager::currentNM()->mkNode(
MULT,
subs[i],
- NodeManager::currentNM()->mkConst(
- CONST_RATIONAL,
+ NodeManager::currentNM()->mkConstReal(
Rational(1) / prop[i].d_coeff.getConst<Rational>()));
nn = NodeManager::currentNM()->mkNode( kind::TO_INTEGER, nn );
nn = rewrite(nn);
for( std::map< Node, Node >::iterator it = msum.begin(); it != msum.end(); ++it ){
Node c_coeff;
if( !msum_coeff[it->first].isNull() ){
- c_coeff = rewrite(NodeManager::currentNM()->mkConst(
- CONST_RATIONAL,
+ c_coeff = rewrite(NodeManager::currentNM()->mkConstReal(
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;
}
}else{
atom_lhs = nm->mkNode(MINUS, atom[0], atom[1]);
atom_lhs = rewrite(atom_lhs);
- atom_rhs = nm->mkConst(CONST_RATIONAL, Rational(0));
+ atom_rhs = nm->mkConstRealOrInt(atom_lhs.getType(), Rational(0));
}
//must be an eligible term
if( isEligible( atom_lhs ) ){
d_added_cbqi_lemma(userContext()),
d_vtsCache(new VtsTermCache(env, qim)),
d_bv_invert(nullptr),
- d_small_const_multiplier(NodeManager::currentNM()->mkConst(
- CONST_RATIONAL, Rational(1) / Rational(1000000))),
+ d_small_const_multiplier(NodeManager::currentNM()->mkConstReal(
+ Rational(1) / Rational(1000000))),
d_small_const(d_small_const_multiplier)
{
d_check_vts_lemma_lc = false;
}
d_curr_quant = Node::null();
}else if( e==1 ){
+ NodeManager* nm = NodeManager::currentNM();
//minimize the free delta heuristically on demand
if( d_check_vts_lemma_lc ){
Trace("inst-alg") << "-> Minimize delta heuristic, for " << q << std::endl;
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(
+ Node inf_lem_lb = nm->mkNode(
GT,
inf[i],
- NodeManager::currentNM()->mkConst(
- CONST_RATIONAL,
- Rational(1) / d_small_const.getConst<Rational>()));
+ nm->mkConstReal(Rational(1) / d_small_const.getConst<Rational>()));
d_qim.lemma(inf_lem_lb, InferenceId::QUANTIFIERS_CEGQI_VTS_LB_INF);
}
}
VtsTermCache::VtsTermCache(Env& env, QuantifiersInferenceManager& qim)
: EnvObj(env), d_qim(qim)
{
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
}
void VtsTermCache::getVtsTerms(std::vector<Node>& t,
sm->mkDummySkolem("delta_free",
nm->realType(),
"free delta for virtual term substitution");
- Node delta_lem = nm->mkNode(GT, d_vts_delta_free, d_zero);
+ Node zero = nm->mkConstReal(Rational(0));
+ Node delta_lem = nm->mkNode(GT, d_vts_delta_free, zero);
d_qim.lemma(delta_lem, InferenceId::QUANTIFIERS_CEGQI_VTS_LB_DELTA);
}
if (d_vts_delta.isNull())
{
nlit = nm->mkConst(false);
}
- else if (res == 1)
- {
- nlit = nm->mkNode(GEQ, d_zero, slv);
- }
else
{
- nlit = nm->mkNode(GT, slv, d_zero);
+ Node zero = nm->mkConstRealOrInt(slv.getType(), Rational(0));
+ if (res == 1)
+ {
+ nlit = nm->mkNode(GEQ, zero, slv);
+ }
+ else
+ {
+ nlit = nm->mkNode(GT, slv, zero);
+ }
}
}
}
private:
/** Reference to the quantifiers inference manager */
QuantifiersInferenceManager& d_qim;
- /** constants */
- Node d_zero;
/** The virtual term substitution delta */
Node d_vts_delta;
/** The virtual term substitution "free delta" */
Assert(nc.isConst());
if (x.getType().isInteger())
{
- Node coeff =
- nm->mkConst(CONST_RATIONAL, nc.getConst<Rational>().abs());
+ Node coeff = nm->mkConstInt(nc.getConst<Rational>().abs());
if (!nc.getConst<Rational>().abs().isOne())
{
x = nm->mkNode(INTS_DIVISION_TOTAL, x, coeff);
}
else
{
- Node coeff = nm->mkConst(CONST_RATIONAL,
- Rational(1) / nc.getConst<Rational>());
+ Node coeff = nm->mkConstReal(Rational(1) / nc.getConst<Rational>());
x = nm->mkNode(MULT, x, coeff);
}
}
{
d_true = NodeManager::currentNM()->mkConst(true);
d_false = NodeManager::currentNM()->mkConst(false);
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_intZero = NodeManager::currentNM()->mkConstInt(Rational(0));
}
void ExtendedRewriter::setCache(Node n, Node ret) const
strings::ArithEntail aent(&d_rew);
// (str.substr s x y) --> "" if x < len(s) |= 0 >= y
Node n1_lt_tot_len = d_rew.rewrite(nm->mkNode(LT, node[1], tot_len));
- if (aent.checkWithAssumption(n1_lt_tot_len, d_zero, node[2], false))
+ if (aent.checkWithAssumption(n1_lt_tot_len, d_intZero, node[2], false))
{
Node ret = strings::Word::mkEmptyWord(node.getType());
debugExtendedRewrite(node, ret, "SS_START_ENTAILS_ZERO_LEN");
}
// (str.substr s x y) --> "" if 0 < y |= x >= str.len(s)
- Node non_zero_len = d_rew.rewrite(nm->mkNode(LT, d_zero, node[2]));
+ Node non_zero_len = d_rew.rewrite(nm->mkNode(LT, d_intZero, node[2]));
if (aent.checkWithAssumption(non_zero_len, node[1], tot_len, false))
{
Node ret = strings::Word::mkEmptyWord(node.getType());
return ret;
}
// (str.substr s x y) --> "" if x >= 0 |= 0 >= str.len(s)
- Node geq_zero_start = d_rew.rewrite(nm->mkNode(GEQ, node[1], d_zero));
- if (aent.checkWithAssumption(geq_zero_start, d_zero, tot_len, false))
+ Node geq_zero_start = d_rew.rewrite(nm->mkNode(GEQ, node[1], d_intZero));
+ if (aent.checkWithAssumption(geq_zero_start, d_intZero, tot_len, false))
{
Node ret = strings::Word::mkEmptyWord(node.getType());
debugExtendedRewrite(node, ret, "SS_GEQ_ZERO_START_ENTAILS_EMP_S");
/** Common constant nodes */
Node d_true;
Node d_false;
- Node d_zero;
+ Node d_intZero;
};
} // namespace quantifiers
Node BoundedIntegers::IntRangeDecisionHeuristic::mkLiteral(unsigned n)
{
NodeManager* nm = NodeManager::currentNM();
- Node cn = nm->mkConst(CONST_RATIONAL, Rational(n == 0 ? 0 : n - 1));
+ Node cn = nm->mkConstInt(Rational(n == 0 ? 0 : n - 1));
return nm->mkNode(n == 0 ? LT : LEQ, d_proxy_range, cn);
}
Node lem = nm->mkNode(
EQUAL,
currLit,
- nm->mkNode(
- curr == 0 ? LT : LEQ,
- d_range,
- nm->mkConst(CONST_RATIONAL, Rational(curr == 0 ? 0 : curr - 1))));
+ nm->mkNode(curr == 0 ? LT : LEQ,
+ d_range,
+ nm->mkConstInt(Rational(curr == 0 ? 0 : curr - 1))));
return lem;
}
}
choices.pop_back();
Node bvl = nm->mkNode(BOUND_VAR_LIST, choice_i);
- Node cMinCard =
- nm->mkNode(LEQ, srCardN, nm->mkConst(CONST_RATIONAL, Rational(i)));
+ Node cMinCard = nm->mkNode(LEQ, srCardN, nm->mkConstInt(Rational(i)));
choice_i = nm->mkNode(WITNESS, bvl, nm->mkNode(OR, cMinCard, cBody));
d_setm_choice[sro].push_back(choice_i);
}
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(CONST_RATIONAL, Rational(9999))));
+ Node ra =
+ rewrite(nm->mkNode(LEQ, range, nm->mkConstInt(Rational(9999))));
Node tl = l;
Node tu = u;
getBounds( q, v, rsi, tl, tu );
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(CONST_RATIONAL, Rational(k)));
+ Node t = nm->mkNode(PLUS, tl, nm->mkConstInt(Rational(k)));
t = rewrite(t);
elements.push_back( t );
}
if (!c.isLargeFinite())
{
NodeManager* nm = NodeManager::currentNM();
- Node card =
- nm->mkConst(CONST_RATIONAL, Rational(c.getFiniteCardinality()));
+ Node card = nm->mkConstInt(Rational(c.getFiniteCardinality()));
// check if less than fixed upper bound
- Node oth = nm->mkConst(CONST_RATIONAL, Rational(maxCard));
+ Node oth = nm->mkConstInt(Rational(maxCard));
Node eq = nm->mkNode(LEQ, card, oth);
eq = Rewriter::rewrite(eq);
mc = eq.isConst() && eq.getConst<bool>();
break;
}
}else{
- Node z = p->getZero( k );
+ Node z = p->getZero(d_vars[index].getType(), k);
if( !z.isNull() ){
Trace("qcf-tconstraint-debug") << "...set " << d_vars[vn] << " = " << z << std::endl;
assigned.push_back( vn );
if( slv_v!=-1 ){
Node lhs;
if( children.empty() ){
- lhs = p->getZero( k );
+ lhs = p->getZero(d_vars[index].getType(), k);
}else if( children.size()==1 ){
lhs = children[0];
}else{
{
}
-TNode QuantConflictFind::getZero( Kind k ) {
- std::map< Kind, Node >::iterator it = d_zero.find( k );
- if( it==d_zero.end() ){
+TNode QuantConflictFind::getZero(TypeNode tn, Kind k)
+{
+ std::pair<TypeNode, Kind> key(tn, k);
+ std::map<std::pair<TypeNode, Kind>, Node>::iterator it = d_zero.find(key);
+ if (it == d_zero.end())
+ {
Node nn;
if( k==PLUS ){
- nn = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ nn = NodeManager::currentNM()->mkConstRealOrInt(tn, Rational(0));
}
- d_zero[k] = nn;
+ d_zero[key] = nn;
return nn;
- }else{
- return it->second;
}
+ return it->second;
}
std::ostream& operator<<(std::ostream& os, const QuantConflictFind::Effort& e) {
private:
context::CDO< bool > d_conflict;
- std::map< Kind, Node > d_zero;
+ std::map<std::pair<TypeNode, Kind>, Node> d_zero;
//for storing nodes created during t-constraint solving (prevents memory leaks)
std::vector< Node > d_tempCache;
//optimization: list of quantifiers that depend on ground function applications
public: //for ground terms
Node d_true;
Node d_false;
- TNode getZero( Kind k );
-private:
+ TNode getZero(TypeNode tn, Kind k);
+
+ private:
std::map< Node, QuantInfo > d_qinfo;
private: //for equivalence classes
// type -> list(eqc)
for (size_t j = 0, nargs = c.getNumArgs(); j < nargs; j++)
{
TypeNode tn = tspec[j];
- Node rn = nm->mkConst(CONST_RATIONAL, Rational(j));
+ Node rn = nm->mkConstInt(Rational(j));
Node cacheVal = BoundVarManager::getCacheValue(body, lit, rn);
Node v = bvm->mkBoundVar<QRewDtExpandAttribute>(cacheVal, tn);
newChildren.push_back(v);
}
else if (options::intWfInduction() && tn.isInteger())
{
- Node icond = nm->mkNode(GEQ, k, nm->mkConst(CONST_RATIONAL, Rational(0)));
+ Node icond = nm->mkNode(GEQ, k, nm->mkConstInt(Rational(0)));
Node iret =
- ret.substitute(
- ind_vars[0],
- nm->mkNode(MINUS, k, nm->mkConst(CONST_RATIONAL, Rational(1))))
+ ret.substitute(ind_vars[0],
+ nm->mkNode(MINUS, k, nm->mkConstInt(Rational(1))))
.negate();
n_str_ind = nm->mkNode(OR, icond.negate(), iret);
n_str_ind = nm->mkNode(AND, icond, n_str_ind);
std::set<TypeNode> unresolvedTypes;
unresolvedTypes.insert(u);
std::vector<TypeNode> cargsEmpty;
- Node cr = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node cr = nm->mkConstInt(Rational(1));
sdt.addConstructor(cr, "1", cargsEmpty);
std::vector<TypeNode> cargsPlus;
cargsPlus.push_back(u);
if (pow_two > 0)
{
Node size_ve = nm->mkNode(DT_SIZE, d_virtual_enum);
- Node fair_lemma = nm->mkNode(
- GEQ, size_ve, nm->mkConst(CONST_RATIONAL, Rational(pow_two - 1)));
+ Node fair_lemma =
+ nm->mkNode(GEQ, size_ve, nm->mkConstInt(Rational(pow_two - 1)));
fair_lemma = nm->mkNode(OR, newLit, fair_lemma);
Trace("cegis-unif-enum-lemma")
<< "CegisUnifEnum::lemma, fairness size:" << fair_lemma << "\n";
// 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(CONST_RATIONAL, Rational(i));
+ Node n = nm->mkConstInt(Rational(i));
nToC[n] = i;
tnit.add(n, argTypes[i]);
}
Node c = cur;
if (tn.isRealOrInt())
{
- c = nm->mkConst(CONST_RATIONAL, c.getConst<Rational>().abs());
+ c = nm->mkConstRealOrInt(tn, c.getConst<Rational>().abs());
}
consts[tn].insert(c);
if (tn.isInteger())
{
+ c = nm->mkConstReal(c.getConst<Rational>().abs());
TypeNode rtype = nm->realType();
consts[rtype].insert(c);
}
NodeManager* nm = NodeManager::currentNM();
if (type.isRealOrInt())
{
- ops.push_back(nm->mkConst(CONST_RATIONAL, Rational(0)));
- ops.push_back(nm->mkConst(CONST_RATIONAL, Rational(1)));
+ ops.push_back(nm->mkConstRealOrInt(type, Rational(0)));
+ ops.push_back(nm->mkConstRealOrInt(type, Rational(1)));
}
else if (type.isBitVector())
{
Assert(bArgType.isRealOrInt() || bArgType.isBitVector());
if (bArgType.isRealOrInt())
{
- zarg = nm->mkConst(CONST_RATIONAL, Rational(0));
+ zarg = nm->mkConstRealOrInt(bArgType, Rational(0));
}
else
{
Trace("sygus-grammar-def") << "\t...add for 1 to Pos_Int\n";
std::vector<TypeNode> cargsEmpty;
sdts.back().addConstructor(
- nm->mkConst(CONST_RATIONAL, Rational(1)), "1", cargsEmpty);
+ nm->mkConstInt(Rational(1)), "1", cargsEmpty);
/* Add operator PLUS */
Kind kind = PLUS;
Trace("sygus-grammar-def") << "\t...add for PLUS to Pos_Int\n";
{
const SygusDatatypeConstructor& sdc = sdti.getConstructor(k);
Node sop = sdc.d_op;
- bool isBuiltinArithOp = (sop.getKind() == CONST_RATIONAL);
+ bool isBuiltinArithOp = (sop.getType().isRealOrInt() && sop.isConst());
bool hasExternalType = false;
for (unsigned j = 0, nargs = sdc.d_argTypes.size(); j < nargs; j++)
{
std::vector<Node> sum;
for (unsigned j = 0, size = vec.size(); j < size; j++)
{
- Node digit = nm->mkConst(CONST_RATIONAL, Rational(vec[j]) * curr);
+ Node digit = nm->mkConstInt(Rational(vec[j]) * curr);
sum.push_back(digit);
curr = curr * baser;
}
Node ret;
if (sum.empty())
{
- ret = nm->mkConst(CONST_RATIONAL, Rational(0));
+ ret = nm->mkConstInt(Rational(0));
}
else if (sum.size() == 1)
{
}
else
{
- return nm->mkConst(CONST_RATIONAL, sr / rr);
+ return nm->mkConstReal(sr / rr);
}
}
}
if (tn.isRealOrInt())
{
Rational c(val);
- n = NodeManager::currentNM()->mkConst(CONST_RATIONAL, c);
+ n = NodeManager::currentNM()->mkConstRealOrInt(tn, c);
}
else if (tn.isBitVector())
{
d_finite_type_constants_processed(false)
{
d_true = NodeManager::currentNM()->mkConst(true);
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
}
void CardinalityExtension::reset()
if (finiteType)
{
Node typeCardinality =
- nm->mkConst(CONST_RATIONAL, Rational(card.getFiniteCardinality()));
+ nm->mkConstInt(Rational(card.getFiniteCardinality()));
Node cardUniv = nm->mkNode(kind::SET_CARD, proxy);
Node leq = nm->mkNode(kind::LEQ, cardUniv, typeCardinality);
}
if (!members.empty())
{
- Node conc = nm->mkNode(
- GEQ, cardTerm, nm->mkConst(CONST_RATIONAL, Rational(members.size())));
+ Node conc =
+ nm->mkNode(GEQ, cardTerm, nm->mkConstInt(Rational(members.size())));
Node expn = exp.size() == 1 ? exp[0] : nm->mkNode(AND, exp);
d_im.assertInference(conc, InferenceId::SETS_CARD_MINIMAL, expn, 1);
}
{
d_true = NodeManager::currentNM()->mkConst(true);
d_false = NodeManager::currentNM()->mkConst(false);
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
}
TheorySetsPrivate::~TheorySetsPrivate()
case kind::RELATION_JOIN_IMAGE:
{
// these are logic exceptions, not type checking exceptions
- if (node[1].getKind() != kind::CONST_RATIONAL)
+ if (!node[1].isConst())
{
throw LogicException(
"JoinImage cardinality constraint must be a constant");
{
if(node[0].isConst()) {
std::set<Node> elements = NormalForm::getElementsFromNormalConstant(node[0]);
- return RewriteResponse(
- REWRITE_DONE, nm->mkConst(CONST_RATIONAL, Rational(elements.size())));
+ return RewriteResponse(REWRITE_DONE,
+ nm->mkConstInt(Rational(elements.size())));
}
else if (node[0].getKind() == kind::SET_SINGLETON)
{
- return RewriteResponse(REWRITE_DONE,
- nm->mkConst(CONST_RATIONAL, Rational(1)));
+ return RewriteResponse(REWRITE_DONE, nm->mkConstInt(Rational(1)));
}
else if (node[0].getKind() == kind::SET_UNION)
{
ArithEntail::ArithEntail(Rewriter* r) : d_rr(r)
{
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
}
Node ArithEntail::rewrite(Node a) { return d_rr->rewrite(a); }
return a.getConst<Rational>().sgn() >= (strict ? 1 : 0);
}
- Node ar = strict ? NodeManager::currentNM()->mkNode(
- kind::MINUS,
- a,
- NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1)))
- : a;
+ Node ar =
+ strict ? NodeManager::currentNM()->mkNode(
+ kind::MINUS, a, NodeManager::currentNM()->mkConstInt(Rational(1)))
+ : a;
ar = d_rr->rewrite(ar);
if (ar.getAttribute(StrCheckEntailArithComputedAttr()))
<< "Get approximations " << v << "..." << std::endl;
if (v.isNull())
{
- Node mn = c.isNull() ? nm->mkConst(CONST_RATIONAL, Rational(1)) : c;
+ Node mn = c.isNull() ? nm->mkConstInt(Rational(1)) : c;
aarSum.push_back(mn);
}
else
{
// x >= 0 implies
// x+1 >= len( int.to.str( x ) )
- approx.push_back(nm->mkNode(
- PLUS, nm->mkConst(CONST_RATIONAL, Rational(1)), a[0][0]));
+ approx.push_back(
+ nm->mkNode(PLUS, nm->mkConstInt(Rational(1)), a[0][0]));
}
}
}
{
// x >= 0 implies
// len( int.to.str( x ) ) >= 1
- approx.push_back(nm->mkConst(CONST_RATIONAL, Rational(1)));
+ approx.push_back(nm->mkConstInt(Rational(1)));
}
// other crazy things are possible here, e.g.
// len( int.to.str( len( y ) + 10 ) ) >= 2
// ...hard to test, runs risk of non-termination
// -1 <= indexof( x, y, n )
- approx.push_back(nm->mkConst(CONST_RATIONAL, Rational(-1)));
+ approx.push_back(nm->mkConstInt(Rational(-1)));
}
}
else if (ak == STRING_STOI)
else
{
// -1 <= str.to.int( x )
- approx.push_back(nm->mkConst(CONST_RATIONAL, Rational(-1)));
+ approx.push_back(nm->mkConstInt(Rational(-1)));
}
}
Trace("strings-ent-approx-debug") << "Return " << approx.size() << std::endl;
// (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(CONST_RATIONAL, Rational(1)));
+ x = nm->mkNode(
+ kind::MINUS, assumption[0][1], nm->mkConstInt(Rational(1)));
y = assumption[0][0];
}
if (s.isConst())
{
size_t len = Word::getLength(s);
- ret = nm->mkConst(CONST_RATIONAL, Rational(len));
+ ret = nm->mkConstInt(Rational(len));
}
else if (s.getKind() == STRING_CONCAT)
{
success = false;
break;
}
- Assert(b.getKind() == CONST_RATIONAL);
+ Assert(b.isConst());
sum = sum + b.getConst<Rational>();
}
if (success && (!isLower || sum.sgn() != 0))
{
- ret = nm->mkConst(CONST_RATIONAL, sum);
+ ret = nm->mkConstInt(sum);
}
}
if (ret.isNull() && isLower)
d_eqProc(context())
{
NodeManager* nm = NodeManager::currentNM();
- d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = nm->mkConstInt(Rational(0));
}
ArraySolver::~ArraySolver() {}
if (lr.isConst())
{
// if constant, compare
- Node cmp =
- nm->mkNode(GEQ, lr, nm->mkConst(CONST_RATIONAL, Rational(card_need)));
+ Node cmp = nm->mkNode(GEQ, lr, nm->mkConstInt(Rational(card_need)));
cmp = rewrite(cmp);
needsSplit = !cmp.getConst<bool>();
}
bool success = true;
while (r < card_need && success)
{
- Node rr = nm->mkConst(CONST_RATIONAL, Rational(r));
+ Node rr = nm->mkConstInt(Rational(r));
if (d_state.areDisequal(rr, lr))
{
r++;
<< std::endl;
if (int_k + 1 > ei->d_cardinalityLemK.get())
{
- Node k_node = nm->mkConst(CONST_RATIONAL, Rational(int_k));
+ Node k_node = nm->mkConstInt(Rational(int_k));
// add cardinality lemma
Node dist = nm->mkNode(DISTINCT, cols[i]);
std::vector<Node> expn;
d_nfPairs(context()),
d_extDeq(userContext())
{
- 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_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
+ d_one = NodeManager::currentNM()->mkConstInt(Rational(1));
+ d_neg_one = NodeManager::currentNM()->mkConstInt(Rational(-1));
d_true = NodeManager::currentNM()->mkConst( true );
d_false = NodeManager::currentNM()->mkConst( false );
}
{
// 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(CONST_RATIONAL, Rational(0))));
+ conc = nm->mkNode(
+ AND,
+ conc,
+ sk1.eqNode(emp).negate(),
+ nm->mkNode(
+ GT, nm->mkNode(STRING_LENGTH, sk1), nm->mkConstInt(Rational(0))));
}
}
else if (rule == PfRule::CONCAT_CSPLIT)
Assert(e != nullptr);
Assert(!t.isNull());
Node tb = t.isConst() ? t : getBoundForLength(t, isLower);
- Assert(!tb.isNull() && tb.getKind() == CONST_RATIONAL)
+ Assert(!tb.isNull() && tb.isConst() && tb.getType().isInteger())
<< "Unexpected bound " << tb << " from " << t;
Rational br = tb.getConst<Rational>();
Node prev = isLower ? e->d_firstBound : e->d_secondBound;
{
// convert to bound
Node prevb = prev.isConst() ? prev : getBoundForLength(prev, isLower);
- Assert(!prevb.isNull() && prevb.getKind() == CONST_RATIONAL);
+ Assert(!prevb.isNull() && prevb.isConst() && prevb.getType().isInteger());
Rational prevbr = prevb.getConst<Rational>();
if (prevbr == br || (br < prevbr) == isLower)
{
{
// are we in conflict?
Node prevob = prevo.isConst() ? prevo : getBoundForLength(prevo, !isLower);
- Assert(!prevob.isNull() && prevob.getKind() == CONST_RATIONAL);
+ Assert(!prevob.isNull() && prevob.isConst()
+ && prevob.getType().isInteger());
Rational prevobr = prevob.getConst<Rational>();
if (prevobr != br && (prevobr < br) == isLower)
{
{
// it should be the case that lenConstraint => lenReq
lenReq = nm->mkNode(STRING_LENGTH, t0)
- .eqNode(nm->mkConst(CONST_RATIONAL, Rational(0)))
+ .eqNode(nm->mkConstInt(Rational(0)))
.notNode();
lenSuccess = convertLengthPf(lenReq, lenConstraint, psb);
rule = PfRule::CONCAT_CSPLIT;
{
// it should be the case that lenConstraint => lenReq
lenReq = nm->mkNode(STRING_LENGTH, t0)
- .eqNode(nm->mkConst(CONST_RATIONAL, Rational(0)))
+ .eqNode(nm->mkConstInt(Rational(0)))
.notNode();
lenSuccess = convertLengthPf(lenReq, lenConstraint, psb);
rule = PfRule::CONCAT_CPROP;
std::vector<Node> childrenAE;
childrenAE.push_back(eunf);
std::vector<Node> argsAE;
- argsAE.push_back(nm->mkConst(CONST_RATIONAL, Rational(0)));
+ argsAE.push_back(nm->mkConstInt(Rational(0)));
Node eunfAE = psb.tryStep(PfRule::AND_ELIM, childrenAE, argsAE);
Trace("strings-ipc-prefix")
<< "--- and elim to " << eunfAE << std::endl;
: nullptr)
{
NodeManager* nm = NodeManager::currentNM();
- d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
- d_one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ d_zero = nm->mkConstInt(Rational(0));
+ d_one = nm->mkConstInt(Rational(1));
d_true = nm->mkConst(true);
d_false = nm->mkConst(false);
}
else if (id == PfRule::CONCAT_CSPLIT)
{
Assert(children.size() == 2);
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node zero = nm->mkConstInt(Rational(0));
+ Node one = nm->mkConstInt(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)
else if (id == PfRule::CONCAT_CPROP)
{
Assert(children.size() == 2);
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
Trace("pfcheck-strings-cprop")
<< "CONCAT_PROP, isRev=" << isRev << std::endl;
{
return Node::null();
}
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
Node clen = nm->mkNode(STRING_LENGTH, nemp[0][0]);
return clen.eqNode(zero).notNode();
}
&& 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(CONST_RATIONAL, Rational(-1)));
+ Node eqNegOne = c1.eqNode(nm->mkConstInt(Rational(-1)));
Node deq = c1.eqNode(c2).negate();
Node eqn = args[0].eqNode(args[1]);
return nm->mkNode(kind::OR, eqNegOne, deq, eqn);
Node x = atom[0];
Node lenx = nm->mkNode(STRING_LENGTH, x);
Node re = atom[1];
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
std::vector<Node> children;
utils::getConcat(re, children);
if (gap_minsize[i] > 0)
{
// the gap to this child is at least gap_minsize[i]
- prev_end =
- nm->mkNode(PLUS,
- prev_end,
- nm->mkConst(CONST_RATIONAL, Rational(gap_minsize[i])));
+ prev_end = nm->mkNode(
+ PLUS, prev_end, nm->mkConstInt(Rational(gap_minsize[i])));
}
prev_ends.push_back(prev_end);
Node sc = sep_children[i];
}
// 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(CONST_RATIONAL, Rational(i)));
+ Node cacheVal =
+ BoundVarManager::getCacheValue(atom, nm->mkConstInt(Rational(i)));
TypeNode intType = nm->integerType();
Node k =
bvm->mkBoundVar<ReElimConcatIndexAttribute>(cacheVal, intType);
prev_end = nm->mkNode(PLUS, prev_end, k);
}
Node curr = nm->mkNode(STRING_INDEXOF, x, sc, prev_end);
- Node idofFind =
- curr.eqNode(nm->mkConst(CONST_RATIONAL, Rational(-1))).negate();
+ Node idofFind = curr.eqNode(nm->mkConstInt(Rational(-1))).negate();
conj.push_back(idofFind);
prev_end = nm->mkNode(PLUS, curr, lensc);
}
// 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(CONST_RATIONAL, Rational(gap_minsize_end));
+ Node cEnd = nm->mkConstInt(Rational(gap_minsize_end));
if (gap_exact_end)
{
Assert(!sep_children.empty());
}
else
{
- Node cacheVal = BoundVarManager::getCacheValue(
- atom, nm->mkConst(CONST_RATIONAL, Rational(i)));
+ Node cacheVal =
+ BoundVarManager::getCacheValue(atom, nm->mkConstInt(Rational(i)));
TypeNode intType = nm->integerType();
k = bvm->mkBoundVar<ReElimConcatIndexAttribute>(cacheVal, intType);
Node bound =
Node x = atom[0];
Node lenx = nm->mkNode(STRING_LENGTH, x);
Node re = atom[1];
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
// for regular expression star,
// if the period is a fixed constant, we can turn it into a bounded
// quantifier
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(CONST_RATIONAL, Rational(1)));
+ Node substr_ch =
+ nm->mkNode(STRING_SUBSTR, x, index, nm->mkConstInt(Rational(1)));
substr_ch = Rewriter::rewrite(substr_ch);
// handle the case where it is purely characters
for (const Node& r : disj)
}
else
{
- Node num2 = nm->mkConst(CONST_RATIONAL, cvc5::Rational(u - 1));
+ Node num2 = nm->mkConstInt(cvc5::Rational(u - 1));
Node r2 = nm->mkNode(REGEXP_LOOP, r[0], r[1], num2);
if (testConstStringInRegExp(s, index_start + len, r2))
{
cvc5::String t = s.substr(index_start, len);
if (testConstStringInRegExp(t, 0, r[0]))
{
- Node num2 = nm->mkConst(CONST_RATIONAL, cvc5::Rational(l - 1));
+ Node num2 = nm->mkConstInt(cvc5::Rational(l - 1));
Node r2 = nm->mkNode(REGEXP_LOOP, r[0], num2, num2);
if (testConstStringInRegExp(s, index_start + len, r2))
{
}
else if (k == REGEXP_ALLCHAR || k == REGEXP_RANGE)
{
- return nm->mkConst(CONST_RATIONAL, Rational(1));
+ return nm->mkConstInt(Rational(1));
}
else if (k == REGEXP_UNION || k == REGEXP_INTER)
{
d_false(NodeManager::currentNM()->mkConst(false)),
d_emptyRegexp(NodeManager::currentNM()->mkNode(kind::REGEXP_NONE,
std::vector<Node>{})),
- d_zero(NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- ::cvc5::Rational(0))),
- d_one(NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- ::cvc5::Rational(1))),
+ d_zero(NodeManager::currentNM()->mkConstInt(Rational(0))),
+ d_one(NodeManager::currentNM()->mkConstInt(Rational(1))),
d_sigma(NodeManager::currentNM()->mkNode(kind::REGEXP_ALLCHAR,
std::vector<Node>{})),
d_sigma_star(
Node r = mem[0][1];
NodeManager* nm = NodeManager::currentNM();
Kind k = r.getKind();
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
Node conc;
if (k == REGEXP_CONCAT)
{
Node r = mem[0][1];
NodeManager* nm = NodeManager::currentNM();
Assert(r.getKind() == REGEXP_CONCAT);
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
// The following simplification states that
// ~( s in R1 ++ R2 ++... ++ Rn )
// is equivalent to
}
else
{
- Node ivalue = nm->mkConst(CONST_RATIONAL, Rational(i));
+ Node ivalue = nm->mkConstInt(Rational(i));
Node sk = sm->mkSkolemFunction(SkolemFunId::RE_UNFOLD_POS_COMPONENT,
s.getType(),
{mem[0], mem[1], ivalue});
rt = itr2->second;
} else {
std::map< PairNodes, Node > cache2(cache);
- cache2[p] = NodeManager::currentNM()->mkNode(
- kind::REGEXP_RV,
- NodeManager::currentNM()->mkConst(CONST_RATIONAL,
- cvc5::Rational(cnt)));
+ cache2[p] =
+ nm->mkNode(kind::REGEXP_RV, nm->mkConstInt(Rational(cnt)));
rt = intersectInternal(r1l, r2l, cache2, cnt+1);
cacheX[ pp ] = rt;
}
}
else if (ne.getKind() == STRING_SUBSTR)
{
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
if (d_arithEntail.check(ne[1], false)
&& d_arithEntail.check(ne[2], true))
Kind nk0 = node[0].getKind();
if (node[0].isConst())
{
- Node retNode =
- nm->mkConst(CONST_RATIONAL, Rational(Word::getLength(node[0])));
+ Node retNode = nm->mkConstInt(Rational(Word::getLength(node[0])));
return returnRewrite(node, retNode, Rewrite::LEN_EVAL);
}
else if (nk0 == kind::STRING_CONCAT)
{
if (tmpNode[i].isConst())
{
- node_vec.push_back(nm->mkConst(
- CONST_RATIONAL, Rational(Word::getLength(tmpNode[i]))));
+ node_vec.push_back(
+ nm->mkConstInt(Rational(Word::getLength(tmpNode[i]))));
}
else
{
}
else if (nk0 == SEQ_UNIT)
{
- Node retNode = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node retNode = nm->mkConstInt(Rational(1));
return returnRewrite(node, retNode, Rewrite::LEN_SEQ_UNIT);
}
return node;
}
else if (r.getKind() == kind::REGEXP_ALLCHAR)
{
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstInt(Rational(1));
Node retNode = one.eqNode(nm->mkNode(STRING_LENGTH, x));
return returnRewrite(node, retNode, Rewrite::RE_IN_SIGMA);
}
Node flr = RegExpEntail::getFixedLengthForRegexp(r[0]);
if (!flr.isNull())
{
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstInt(Rational(1));
if (flr == one)
{
NodeBuilder nb(AND);
if (constStr.isNull())
{
// x in re.++(_*, _, _) ---> str.len(x) >= 2
- Node num = nm->mkConst(CONST_RATIONAL, Rational(allSigmaMinSize));
+ Node num = nm->mkConstInt(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);
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(CONST_RATIONAL, Rational(0)), n),
- nm->mkNode(LT, n, nm->mkNode(STRING_LENGTH, s)));
+ Node cond = nm->mkNode(AND,
+ nm->mkNode(LEQ, nm->mkConstInt(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);
{
Assert(node.getKind() == STRING_CHARAT);
NodeManager* nm = NodeManager::currentNM();
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstInt(Rational(1));
Node retNode = nm->mkNode(STRING_SUBSTR, node[0], node[1], one);
return returnRewrite(node, retNode, Rewrite::CHARAT_ELIM);
}
}
}
}
- Node zero = nm->mkConst(CONST_RATIONAL, cvc5::Rational(0));
+ Node zero = nm->mkConstInt(cvc5::Rational(0));
// if entailed non-positive length or negative start point
if (d_arithEntail.check(zero, node[1], true))
if (node[2].isConst() && node[2].getConst<Rational>().sgn() < 0)
{
// z<0 implies str.indexof( x, y, z ) --> -1
- Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::IDOF_NEG);
}
// 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(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::IDOF_MAX);
}
Assert(node[2].getConst<Rational>().sgn() >= 0);
std::size_t ret = Word::find(s, t, start);
if (ret != std::string::npos)
{
- Node retv =
- nm->mkConst(CONST_RATIONAL, Rational(static_cast<unsigned>(ret)));
+ Node retv = nm->mkConstInt(Rational(static_cast<unsigned>(ret)));
return returnRewrite(node, retv, Rewrite::IDOF_FIND);
}
else if (children0.size() == 1)
{
- Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::IDOF_NFIND);
}
}
if (node[2].getConst<Rational>().sgn() == 0)
{
// indexof( x, x, 0 ) --> 0
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(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(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::IDOF_EQ_NSTART);
}
Node emp = Word::mkEmptyWord(stype);
if (d_arithEntail.check(len1, len0m2, true))
{
// len(x)-z < len(y) implies indexof( x, y, z ) ----> -1
- Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::IDOF_LEN);
}
else
{
// str.contains( x, y ) --> false implies str.indexof(x,y,z) --> -1
- Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::IDOF_NCTN);
}
}
Node s = node[0];
Node r = node[1];
Node n = node[2];
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(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(CONST_RATIONAL, Rational(-1));
+ Node ret = nm->mkConstInt(Rational(-1));
return returnRewrite(node, ret, Rewrite::INDEXOF_RE_INVALID_INDEX);
}
// 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(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
return returnRewrite(node, negone, Rewrite::INDEXOF_RE_MAX_INDEX);
}
uint32_t start = nrat.getNumerator().toUnsignedInt();
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,
+ Node ret = nm->mkConstInt(
Rational(match.first == string::npos
? -1
: static_cast<int64_t>(start + match.first)));
nm->mkNode(kind::STRING_LENGTH, utils::mkConcat(children1, stype));
Node maxLen1 = nm->mkNode(kind::PLUS, partLen1, lastChild1[2]);
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node zero = nm->mkConstInt(Rational(0));
+ Node one = nm->mkConstInt(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
Node val;
if (isPrefix)
{
- val =
- NodeManager::currentNM()->mkConst(CONST_RATIONAL, ::cvc5::Rational(0));
+ val = NodeManager::currentNM()->mkConstInt(::cvc5::Rational(0));
}
else
{
NodeManager* nm = NodeManager::currentNM();
Node res;
- if (len.getKind() == CONST_RATIONAL)
+ if (len.isConst())
{
// c -> "A" repeated c times
Rational ratLen = len.getConst<Rational>();
{
NodeManager* nm = NodeManager::currentNM();
d_strType = nm->stringType();
- d_zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = nm->mkConstInt(Rational(0));
}
Node SkolemCache::mkSkolemCached(Node a, Node b, SkolemId id, const char* c)
{
// SK_ID_VC_SPT(x, y) ---> SK_SUFFIX_REM(x, 1)
id = SK_SUFFIX_REM;
- b = nm->mkConst(CONST_RATIONAL, Rational(1));
+ b = nm->mkConstInt(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(CONST_RATIONAL, Rational(1)));
+ b = nm->mkNode(
+ MINUS, nm->mkNode(STRING_LENGTH, a), nm->mkConstInt(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(CONST_RATIONAL, Rational(1));
+ b = nm->mkConstInt(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(CONST_RATIONAL, Rational(1));
+ b = nm->mkConstInt(Rational(1));
}
else if (id == SK_ID_DEQ_X)
{
d_pendingConflictSet(env.getContext(), false),
d_pendingConflict(InferenceId::UNKNOWN)
{
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
+ d_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
d_false = NodeManager::currentNM()->mkConst(false);
}
Assert(dir == 1 || dir == -1);
Assert(nr.empty());
NodeManager* nm = NodeManager::currentNM();
- Node zero = nm->mkConst(CONST_RATIONAL, cvc5::Rational(0));
+ Node zero = nm->mkConstInt(cvc5::Rational(0));
bool ret = false;
bool success = true;
unsigned sindex = 0;
Assert(d_arithEntail.check(curr, true));
Node s = n1[sindex_use];
size_t slen = Word::getLength(s);
- Node ncl = nm->mkConst(CONST_RATIONAL, cvc5::Rational(slen));
+ Node ncl = nm->mkConstInt(cvc5::Rational(slen));
Node next_s = nm->mkNode(MINUS, lowerBound, ncl);
next_s = d_rr->rewrite(next_s);
Assert(next_s.isConst());
{
n1rb = nm->mkNode(STRING_SUBSTR,
n2[0],
- nm->mkConst(CONST_RATIONAL, Rational(0)),
+ nm->mkConstInt(Rational(0)),
start_pos);
}
if (dir != 1)
bool StringsEntail::checkLengthOne(Node s, bool strict)
{
NodeManager* nm = NodeManager::currentNM();
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstInt(Rational(1));
Node len = nm->mkNode(STRING_LENGTH, s);
len = d_rr->rewrite(len);
return d_arithEntail.check(one, len)
return Node::null();
}
NodeManager* nm = NodeManager::currentNM();
- Node lit = nm->mkNode(
- LEQ, d_inputVarLsum.get(), nm->mkConst(CONST_RATIONAL, Rational(i)));
+ Node lit = nm->mkNode(LEQ, d_inputVarLsum.get(), nm->mkConstInt(Rational(i)));
Trace("strings-fmf") << "StringsFMF::mkLiteral: " << lit << std::endl;
return lit;
}
String s = node[0].getConst<String>();
if (s.isNumber())
{
- ret = nm->mkConst(CONST_RATIONAL, s.toNumber());
+ ret = nm->mkConstInt(s.toNumber());
}
else
{
- ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ ret = nm->mkConstInt(Rational(-1));
}
return returnRewrite(node, ret, Rewrite::STOI_EVAL);
}
String t = nc.getConst<String>();
if (!t.isNumber())
{
- Node ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node ret = nm->mkConstInt(Rational(-1));
return returnRewrite(node, ret, Rewrite::STOI_CONCAT_NONNUM);
}
}
{
std::vector<unsigned> vec = s.getVec();
Assert(vec.size() == 1);
- ret = nm->mkConst(CONST_RATIONAL, Rational(vec[0]));
+ ret = nm->mkConstInt(Rational(vec[0]));
}
else
{
- ret = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ ret = nm->mkConstInt(Rational(-1));
}
return returnRewrite(n, ret, Rewrite::TO_CODE_EVAL);
}
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(CONST_RATIONAL, Rational(48)), t),
- nm->mkNode(LEQ, t, nm->mkConst(CONST_RATIONAL, Rational(57))));
+ Node retNode = nm->mkNode(AND,
+ nm->mkNode(LEQ, nm->mkConstInt(Rational(48)), t),
+ nm->mkNode(LEQ, t, nm->mkConstInt(Rational(57))));
return returnRewrite(n, retNode, Rewrite::IS_DIGIT_ELIM);
}
: nullptr)
{
NodeManager* nm = NodeManager::currentNM();
- 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));
+ d_zero = nm->mkConstInt(Rational(0));
+ d_one = nm->mkConstInt(Rational(1));
+ d_negOne = NodeManager::currentNM()->mkConstInt(Rational(-1));
Assert(options().strings.stringsAlphaCard <= String::num_codes());
d_alphaCard = options().strings.stringsAlphaCard;
}
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(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))));
+ Node code_len = utils::mkNLength(t[0]).eqNode(nm->mkConstInt(Rational(1)));
+ Node code_eq_neg1 = t.eqNode(nm->mkConstInt(Rational(-1)));
+ Node code_range =
+ nm->mkNode(AND,
+ nm->mkNode(GEQ, t, nm->mkConstInt(Rational(0))),
+ nm->mkNode(LT, t, nm->mkConstInt(Rational(alphaCard))));
lemma = nm->mkNode(ITE, code_len, code_range, code_eq_neg1);
}
else if (tk == STRING_INDEXOF || tk == STRING_INDEXOF_RE)
//
// where f in { str.indexof, str.indexof_re }
Node l = nm->mkNode(STRING_LENGTH, t[0]);
- lemma = nm->mkNode(
- AND,
- nm->mkNode(OR,
- t.eqNode(nm->mkConst(CONST_RATIONAL, Rational(-1))),
- nm->mkNode(GEQ, t, t[2])),
- nm->mkNode(LEQ, t, l));
+ lemma = nm->mkNode(AND,
+ nm->mkNode(OR,
+ t.eqNode(nm->mkConstInt(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(CONST_RATIONAL, Rational(-1)));
+ lemma = nm->mkNode(GEQ, t, nm->mkConstInt(Rational(-1)));
}
else if (tk == STRING_CONTAINS)
{
Node TermRegistry::lengthPositive(Node t)
{
NodeManager* nm = NodeManager::currentNM();
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstInt(Rational(0));
Node emp = Word::mkEmptyWord(t.getType());
Node tlen = nm->mkNode(STRING_LENGTH, t);
Node tlenEqZero = tlen.eqNode(zero);
}
else if (n.isConst())
{
- lsum = nm->mkConst(CONST_RATIONAL, Rational(Word::getLength(n)));
+ lsum = nm->mkConstInt(Rational(Word::getLength(n)));
}
Assert(!lsum.isNull());
d_proxyVarToLength[sk] = lsum;
{
lenN = nm->mkNode(STRING_LENGTH, n[2]);
}
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstInt(Rational(1));
return d_aent.checkEq(lenN, one);
}
{
d_termReg.finishInit(&d_im);
- 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_zero = NodeManager::currentNM()->mkConstInt(Rational(0));
+ d_one = NodeManager::currentNM()->mkConstInt(Rational(1));
+ d_neg_one = NodeManager::currentNM()->mkConstInt(Rational(-1));
d_true = NodeManager::currentNM()->mkConst( true );
d_false = NodeManager::currentNM()->mkConst( false );
lvalue++;
}
Trace("strings-model") << "*** Decide to make length of " << lvalue << std::endl;
- lts_values[i] = nm->mkConst(CONST_RATIONAL, Rational(lvalue));
+ lts_values[i] = nm->mkConstInt(Rational(lvalue));
values_used[lvalue] = Node::null();
}
Trace("strings-model") << "Need to assign values of length " << lts_values[i] << " to equivalence classes ";
SkolemCache* sc = d_termReg.getSkolemCache();
Node k = sc->mkSkolemCached(atom, SkolemCache::SK_PURIFY, "kFromCode");
Node t = atom[0];
- Node card = nm->mkConst(CONST_RATIONAL,
- Rational(d_termReg.getAlphabetCardinality()));
+ Node card = nm->mkConstInt(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());
<< "StringsPreprocess::reduce: " << t << std::endl;
Node retNode = t;
NodeManager* nm = NodeManager::currentNM();
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
- Node negOne = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node zero = nm->mkConstInt(Rational(0));
+ Node one = nm->mkConstInt(Rational(1));
+ Node negOne = nm->mkConstInt(Rational(-1));
if( t.getKind() == kind::STRING_SUBSTR ) {
// processing term: substr( s, n, m )
Node skk = sc->mkTypedSkolemCached(
nm->integerType(), t, SkolemCache::SK_PURIFY, "iok");
- Node negone = nm->mkConst(CONST_RATIONAL, Rational(-1));
+ Node negone = nm->mkConstInt(Rational(-1));
// substr( x, n, len( x ) - n )
Node st = nm->mkNode(STRING_SUBSTR,
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(CONST_RATIONAL, Rational(10));
+ Node ten = nm->mkConstInt(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));
MINUS,
nm->mkNode(STRING_TO_CODE, nm->mkNode(STRING_SUBSTR, s, k, one)),
c0);
- Node ten = nm->mkConst(CONST_RATIONAL, Rational(10));
+ Node ten = nm->mkConstInt(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)));
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(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 lb = nm->mkConstInt(Rational(t.getKind() == STRING_TOUPPER ? 97 : 65));
+ Node ub =
+ nm->mkConstInt(Rational(t.getKind() == STRING_TOUPPER ? 122 : 90));
+ Node offset =
+ nm->mkConstInt(Rational(t.getKind() == STRING_TOUPPER ? -32 : 32));
Node res = nm->mkNode(
ITE,
Node mkPrefix(Node t, Node n)
{
NodeManager* nm = NodeManager::currentNM();
- return nm->mkNode(
- STRING_SUBSTR, t, nm->mkConst(CONST_RATIONAL, Rational(0)), n);
+ return nm->mkNode(STRING_SUBSTR, t, nm->mkConstInt(Rational(0)), n);
}
Node mkSuffix(Node t, Node n)