Towards eliminating subtyping Int/Real.
res,
nm->mkNode(kind::SEXPR, d_cl, res),
children,
- {nm->mkConst(CONST_RATIONAL, Rational(1))},
+ {nm->mkConstInt(Rational(1))},
*cdp);
}
default:
{
Node vp1 = nm->mkNode(kind::SEXPR, d_cl, children[0], res);
std::vector<Node> new_children = {vp1, children[0]};
- new_args.push_back(nm->mkConst<Rational>(CONST_RATIONAL, 1));
+ new_args.push_back(nm->mkConstInt(Rational(1)));
return addAletheStep(AletheRule::LA_GENERIC, vp1, vp1, {}, new_args, *cdp)
&& addAletheStep(AletheRule::RESOLUTION,
res,
{
Node vp1 = nm->mkNode(kind::SEXPR, d_cl, children[0], res);
std::vector<Node> new_children = {vp1, children[0]};
- new_args.push_back(nm->mkConst<Rational>(CONST_RATIONAL, 1));
+ new_args.push_back(nm->mkConstInt(Rational(1)));
return addAletheStep(AletheRule::LA_GENERIC, vp1, vp1, {}, new_args, *cdp)
&& addAletheStep(AletheRule::RESOLUTION,
res,
if (id != PfRule::ALETHE_RULE)
{
std::vector<Node> sanitized_args{
- res,
- res,
- nm->mkConst<Rational>(CONST_RATIONAL,
- static_cast<unsigned>(AletheRule::ASSUME))};
+ res, res, nm->mkConstInt(static_cast<uint32_t>(AletheRule::ASSUME))};
for (const Node& arg : args)
{
sanitized_args.push_back(d_anc.convert(arg));
}
std::vector<Node> new_args = std::vector<Node>();
- new_args.push_back(NodeManager::currentNM()->mkConst(
- CONST_RATIONAL, Rational(static_cast<unsigned>(rule))));
+ new_args.push_back(NodeManager::currentNM()->mkConstInt(
+ Rational(static_cast<uint32_t>(rule))));
new_args.push_back(res);
new_args.push_back(sanitized_conclusion);
new_args.insert(new_args.end(), args.begin(), args.end());
FactoringCheck::FactoringCheck(Env& env, ExtState* data)
: EnvObj(env), d_data(data)
{
- d_zero = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(0));
d_one = NodeManager::currentNM()->mkConst(CONST_RATIONAL, Rational(1));
}
poly.size() == 1 ? poly[0] : nm->mkNode(Kind::PLUS, poly);
Trace("nl-ext-factor")
<< "...factored polynomial : " << polyn << std::endl;
- Node conc_lit = nm->mkNode(atom.getKind(), polyn, d_zero);
+ Node zero = nm->mkConstRealOrInt(polyn.getType(), Rational(0));
+ Node conc_lit = nm->mkNode(atom.getKind(), polyn, zero);
conc_lit = rewrite(conc_lit);
if (!polarity)
{
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));
}
Pow2Solver::~Pow2Solver() {}
proof->addStep(lem,
PfRule::ARITH_TRANS_EXP_APPROX_BELOW,
{},
- {nm->mkConst(CONST_RATIONAL, Rational(d)), e[0]});
+ {nm->mkConstInt(Rational(d)), e[0]});
}
d_data->d_im.addPendingLemma(
lem, InferenceId::ARITH_NL_T_TANGENT, proof, true);
PfRule id, const std::vector<Node>& children, const std::vector<Node>& args)
{
NodeManager* nm = NodeManager::currentNM();
- 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);
+ Node zero = nm->mkConstReal(Rational(0));
+ Node one = nm->mkConstReal(Rational(1));
+ Node mone = nm->mkConstReal(Rational(-1));
+ Node pi = nm->mkNullaryOperator(nm->realType(), Kind::PI);
+ Node mpi = nm->mkNode(Kind::MULT, mone, pi);
Trace("nl-trans-checker") << "Checking " << id << std::endl;
Trace("nl-trans-checker") << "Children:" << std::endl;
for (const auto& c : children)
{
Assert(children.empty());
Assert(args.size() == 4);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
- Assert(args[2].isConst() && args[2].getKind() == Kind::CONST_RATIONAL);
- Assert(args[3].isConst() && args[3].getKind() == Kind::CONST_RATIONAL);
+ Assert(args[2].isConst() && args[2].getType().isRealOrInt());
+ Assert(args[3].isConst() && args[3].getType().isRealOrInt());
std::uint64_t d =
args[0].getConst<Rational>().getNumerator().toUnsignedInt();
Node t = args[1];
{
Assert(children.empty());
Assert(args.size() == 4);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
- Assert(args[2].isConst() && args[2].getKind() == Kind::CONST_RATIONAL);
- Assert(args[3].isConst() && args[3].getKind() == Kind::CONST_RATIONAL);
+ Assert(args[2].isConst() && args[2].getType().isRealOrInt());
+ Assert(args[3].isConst() && args[3].getType().isRealOrInt());
std::uint64_t d =
args[0].getConst<Rational>().getNumerator().toUnsignedInt();
Node t = args[1];
{
Assert(children.empty());
Assert(args.size() == 2);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
std::uint64_t d =
args[0].getConst<Rational>().getNumerator().toUnsignedInt();
x.eqNode(
nm->mkNode(Kind::PLUS,
y,
- nm->mkNode(Kind::MULT,
- nm->mkConst<Rational>(CONST_RATIONAL, 2),
- s,
- pi)))),
+ nm->mkNode(Kind::MULT, nm->mkConstReal(2), s, pi)))),
nm->mkNode(Kind::SINE, y).eqNode(nm->mkNode(Kind::SINE, x))});
}
else if (id == PfRule::ARITH_TRANS_SINE_SYMMETRY)
{
Assert(children.empty());
Assert(args.size() == 6);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
Assert(args[2].getType().isReal());
Assert(args[3].getType().isReal());
- Assert(args[4].isConst() && args[4].getKind() == Kind::CONST_RATIONAL);
- Assert(args[5].isConst() && args[5].getKind() == Kind::CONST_RATIONAL);
+ Assert(args[4].isConst() && args[4].getType().isRealOrInt());
+ Assert(args[5].isConst() && args[5].getType().isRealOrInt());
std::uint64_t d =
args[0].getConst<Rational>().getNumerator().toUnsignedInt();
Node t = args[1];
{
Assert(children.empty());
Assert(args.size() == 5);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
Assert(args[2].getType().isReal());
Assert(args[3].getType().isReal());
{
Assert(children.empty());
Assert(args.size() == 6);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
Assert(args[2].getType().isReal());
Assert(args[3].getType().isReal());
- Assert(args[4].isConst() && args[4].getKind() == Kind::CONST_RATIONAL);
- Assert(args[5].isConst() && args[5].getKind() == Kind::CONST_RATIONAL);
+ Assert(args[4].isConst() && args[4].getType().isRealOrInt());
+ Assert(args[5].isConst() && args[5].getType().isRealOrInt());
std::uint64_t d =
args[0].getConst<Rational>().getNumerator().toUnsignedInt();
Node t = args[1];
{
Assert(children.empty());
Assert(args.size() == 5);
- Assert(args[0].isConst() && args[0].getKind() == Kind::CONST_RATIONAL
- && args[0].getConst<Rational>().isIntegral());
+ Assert(args[0].isConst() && args[0].getType().isInteger());
Assert(args[1].getType().isReal());
Assert(args[2].getType().isReal());
Assert(args[3].getType().isReal());
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(CONST_RATIONAL, Rational(2)),
- shift,
- d_data->d_pi)))),
+ a[0].eqNode(nm->mkNode(Kind::PLUS,
+ y,
+ nm->mkNode(Kind::MULT,
+ nm->mkConstReal(Rational(2)),
+ shift,
+ d_data->d_pi)))),
new_a.eqNode(a));
CDProof* proof = nullptr;
if (d_data->isProofEnabled())
proof->addStep(lem,
PfRule::ARITH_TRANS_SINE_APPROX_BELOW_NEG,
{},
- {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
+ {nm->mkConstInt(Rational(2 * d)),
e[0],
c,
regionToLowerBound(region),
proof->addStep(lem,
PfRule::ARITH_TRANS_SINE_APPROX_BELOW_NEG,
{},
- {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
+ {nm->mkConstInt(Rational(2 * d)),
e[0],
c,
c,
proof->addStep(lem,
PfRule::ARITH_TRANS_SINE_APPROX_ABOVE_POS,
{},
- {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
+ {nm->mkConstInt(Rational(2 * d)),
e[0],
c,
regionToLowerBound(region),
proof->addStep(lem,
PfRule::ARITH_TRANS_SINE_APPROX_ABOVE_POS,
{},
- {nm->mkConst(CONST_RATIONAL, Rational(2 * d)),
+ {nm->mkConstInt(Rational(2 * d)),
e[0],
c,
c,
// the current factorial `counter!`
Integer factorial = 1;
// the current variable power `x^counter`
- Node varpow = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node varpow = nm->mkConstReal(Rational(1));
std::vector<Node> sum;
for (std::uint64_t counter = 1; counter <= n; ++counter)
{
// Maclaurin series for exponential:
// \sum_{n=0}^\infty x^n / n!
sum.push_back(
- nm->mkNode(Kind::DIVISION,
- varpow,
- nm->mkConst<Rational>(CONST_RATIONAL, factorial)));
+ nm->mkNode(Kind::DIVISION, varpow, nm->mkConstReal(factorial)));
}
else if (k == Kind::SINE)
{
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>(CONST_RATIONAL, sign),
- nm->mkConst<Rational>(CONST_RATIONAL, factorial)),
- varpow));
+ sum.push_back(nm->mkNode(Kind::MULT,
+ nm->mkNode(Kind::DIVISION,
+ nm->mkConstReal(sign),
+ nm->mkConstReal(factorial)),
+ varpow));
}
}
factorial *= counter;
varpow = nm->mkNode(Kind::MULT, d_taylor_real_fv, varpow);
}
Node taylor_sum = (sum.size() == 1 ? sum[0] : nm->mkNode(Kind::PLUS, sum));
- Node taylor_rem = nm->mkNode(
- Kind::DIVISION, varpow, nm->mkConst<Rational>(CONST_RATIONAL, factorial));
+ Node taylor_rem =
+ nm->mkNode(Kind::DIVISION, varpow, nm->mkConstReal(factorial));
auto res = std::make_pair(taylor_sum, taylor_rem);
{
pbounds.d_lower = taylor_sum;
pbounds.d_upperNeg = nm->mkNode(Kind::PLUS, taylor_sum, ru);
- pbounds.d_upperPos = nm->mkNode(
- Kind::MULT,
- taylor_sum,
- nm->mkNode(Kind::PLUS, nm->mkConst(CONST_RATIONAL, Rational(1)), ru));
+ pbounds.d_upperPos =
+ nm->mkNode(Kind::MULT,
+ taylor_sum,
+ nm->mkNode(Kind::PLUS, nm->mkConstReal(Rational(1)), ru));
}
else
{
// at zero, its trivial
if (k == Kind::SINE)
{
- Node zero = nm->mkConst(CONST_RATIONAL, Rational(0));
+ Node zero = nm->mkConstReal(Rational(0));
return std::pair<Node, Node>(zero, zero);
}
Assert(k == Kind::EXPONENTIAL);
- Node one = nm->mkConst(CONST_RATIONAL, Rational(1));
+ Node one = nm->mkConstReal(Rational(1));
return std::pair<Node, Node>(one, one);
}
bool isNeg = csign == -1;
{
d_true = NodeManager::currentNM()->mkConst(true);
d_false = NodeManager::currentNM()->mkConst(false);
- 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()->mkConstReal(Rational(0));
+ d_one = NodeManager::currentNM()->mkConstReal(Rational(1));
+ d_neg_one = NodeManager::currentNM()->mkConstReal(Rational(-1));
if (d_env.isTheoryProofProducing())
{
d_proof.reset(new CDProofSet<CDProof>(
if (d_pi.isNull())
{
d_pi = nm->mkNullaryOperator(nm->realType(), Kind::PI);
- d_pi_2 = rewrite(
- nm->mkNode(Kind::MULT,
- d_pi,
- nm->mkConst(CONST_RATIONAL, Rational(1) / Rational(2))));
- d_pi_neg_2 = rewrite(
- nm->mkNode(Kind::MULT,
- d_pi,
- nm->mkConst(CONST_RATIONAL, Rational(-1) / Rational(2))));
- d_pi_neg = rewrite(nm->mkNode(
- Kind::MULT, d_pi, nm->mkConst(CONST_RATIONAL, Rational(-1))));
+ d_pi_2 = rewrite(nm->mkNode(
+ Kind::MULT, d_pi, nm->mkConstReal(Rational(1) / Rational(2))));
+ d_pi_neg_2 = rewrite(nm->mkNode(
+ Kind::MULT, d_pi, nm->mkConstReal(Rational(-1) / Rational(2))));
+ d_pi_neg =
+ rewrite(nm->mkNode(Kind::MULT, d_pi, nm->mkConstReal(Rational(-1))));
// initialize bounds
- d_pi_bound[0] =
- nm->mkConst(CONST_RATIONAL, Rational(103993) / Rational(33102));
- d_pi_bound[1] =
- nm->mkConst(CONST_RATIONAL, Rational(104348) / Rational(33215));
+ d_pi_bound[0] = nm->mkConstReal(Rational(103993) / Rational(33102));
+ d_pi_bound[1] = nm->mkConstReal(Rational(104348) / Rational(33215));
}
}
proof->addStep(lem,
PfRule::ARITH_TRANS_EXP_APPROX_ABOVE_POS,
{},
- {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
- tf[0],
- lower,
- upper});
+ {nm->mkConstInt(2 * actual_d), tf[0], lower, upper});
}
else
{
proof->addStep(lem,
PfRule::ARITH_TRANS_EXP_APPROX_ABOVE_NEG,
{},
- {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
- tf[0],
- lower,
- upper});
+ {nm->mkConstInt(2 * actual_d), tf[0], lower, upper});
}
}
else if (tf.getKind() == Kind::SINE)
{
if (convexity == Convexity::CONCAVE)
{
- proof->addStep(lem,
- PfRule::ARITH_TRANS_SINE_APPROX_BELOW_POS,
- {},
- {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
- tf[0],
- lower,
- upper,
- lapprox,
- uapprox
+ proof->addStep(
+ lem,
+ PfRule::ARITH_TRANS_SINE_APPROX_BELOW_POS,
+ {},
+ {nm->mkConstInt(2 * actual_d), tf[0], lower, upper, lapprox, uapprox
- });
+ });
}
else
{
proof->addStep(lem,
PfRule::ARITH_TRANS_SINE_APPROX_ABOVE_NEG,
{},
- {nm->mkConst<Rational>(CONST_RATIONAL, 2 * actual_d),
+ {nm->mkConstInt(2 * actual_d),
tf[0],
lower,
upper,
nm->mkNode(
MULT,
den,
- nm->mkNode(
- PLUS, v, nm->mkConst(CONST_RATIONAL, Rational(1))))));
+ nm->mkNode(PLUS, v, nm->mkConstInt(Rational(1))))));
}
else
{
lem = nm->mkNode(
AND,
leqNum,
- nm->mkNode(LT,
- num,
- nm->mkNode(MULT,
- den,
- nm->mkNode(PLUS,
- v,
- nm->mkConst(CONST_RATIONAL,
- Rational(-1))))));
+ nm->mkNode(
+ LT,
+ num,
+ nm->mkNode(
+ MULT,
+ den,
+ nm->mkNode(PLUS, v, nm->mkConstInt(Rational(-1))))));
}
}
else
AND,
nm->mkNode(
IMPLIES,
- nm->mkNode(GT, den, nm->mkConst(CONST_RATIONAL, Rational(0))),
+ nm->mkNode(GT, den, nm->mkConstInt(Rational(0))),
nm->mkNode(
AND,
leqNum,
nm->mkNode(
LT,
num,
- nm->mkNode(MULT,
- den,
- nm->mkNode(PLUS,
- v,
- nm->mkConst(CONST_RATIONAL,
- Rational(1))))))),
+ nm->mkNode(
+ MULT,
+ den,
+ nm->mkNode(
+ PLUS, v, nm->mkConstInt(Rational(1))))))),
nm->mkNode(
IMPLIES,
- nm->mkNode(LT, den, nm->mkConst(CONST_RATIONAL, Rational(0))),
+ nm->mkNode(LT, den, nm->mkConstInt(Rational(0))),
nm->mkNode(
AND,
leqNum,
nm->mkNode(
LT,
num,
- nm->mkNode(MULT,
- den,
- nm->mkNode(PLUS,
- v,
- nm->mkConst(CONST_RATIONAL,
- Rational(-1))))))));
+ nm->mkNode(
+ MULT,
+ den,
+ nm->mkNode(
+ PLUS, v, nm->mkConstInt(Rational(-1))))))));
}
Node intVar = mkWitnessTerm(
v, lem, "linearIntDiv", "the result of an intdiv-by-k term", lems);
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(CONST_RATIONAL, Rational(0))).negate(),
- nm->mkNode(MULT, den, v).eqNode(num));
+ Node lem = nm->mkNode(IMPLIES,
+ den.eqNode(nm->mkConstReal(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;
{
checkNonLinearLogic(node);
Node divByZeroNum = getArithSkolemApp(num, SkolemFunId::DIV_BY_ZERO);
- Node denEq0 =
- nm->mkNode(EQUAL, den, nm->mkConst(CONST_RATIONAL, Rational(0)));
+ Node denEq0 = nm->mkNode(EQUAL, den, nm->mkConstReal(Rational(0)));
ret = nm->mkNode(ITE, denEq0, divByZeroNum, ret);
}
return ret;
checkNonLinearLogic(node);
Node intDivByZeroNum =
getArithSkolemApp(num, SkolemFunId::INT_DIV_BY_ZERO);
- Node denEq0 =
- nm->mkNode(EQUAL, den, nm->mkConst(CONST_RATIONAL, Rational(0)));
+ Node denEq0 = nm->mkNode(EQUAL, den, nm->mkConstInt(Rational(0)));
ret = nm->mkNode(ITE, denEq0, intDivByZeroNum, ret);
}
return ret;
{
checkNonLinearLogic(node);
Node modZeroNum = getArithSkolemApp(num, SkolemFunId::MOD_BY_ZERO);
- Node denEq0 =
- nm->mkNode(EQUAL, den, nm->mkConst(CONST_RATIONAL, Rational(0)));
+ Node denEq0 = nm->mkNode(EQUAL, den, nm->mkConstInt(Rational(0)));
ret = nm->mkNode(ITE, denEq0, modZeroNum, ret);
}
return ret;
{
return nm->mkNode(
ITE,
- nm->mkNode(LT, node[0], nm->mkConst(CONST_RATIONAL, Rational(0))),
+ nm->mkNode(LT,
+ node[0],
+ nm->mkConstRealOrInt(node[0].getType(), Rational(0))),
nm->mkNode(UMINUS, node[0]),
node[0]);
break;
// 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(CONST_RATIONAL, Rational(0))),
- nonNeg,
- uf);
+ lem = nm->mkNode(ITE,
+ nm->mkNode(GEQ, node[0], nm->mkConstReal(Rational(0))),
+ nonNeg,
+ uf);
}
else
{
Node rlem;
if (k == ARCSINE || k == ARCTANGENT || k == ARCCOSECANT)
{
- Node half = nm->mkConst(CONST_RATIONAL, Rational(1) / Rational(2));
+ Node half = nm->mkConstReal(Rational(1) / Rational(2));
Node pi2 = nm->mkNode(MULT, half, pi);
- Node npi2 =
- nm->mkNode(MULT, nm->mkConst(CONST_RATIONAL, Rational(-1)), pi2);
+ Node npi2 = nm->mkNode(MULT, nm->mkConstReal(Rational(-1)), pi2);
// -pi/2 < var <= pi/2
rlem = nm->mkNode(
AND, nm->mkNode(LT, npi2, var), nm->mkNode(LEQ, var, pi2));
else
{
// 0 <= var < pi
- rlem = nm->mkNode(
- AND,
- nm->mkNode(LEQ, nm->mkConst(CONST_RATIONAL, Rational(0)), var),
- nm->mkNode(LT, var, pi));
+ rlem = nm->mkNode(AND,
+ nm->mkNode(LEQ, nm->mkConstReal(Rational(0)), var),
+ nm->mkNode(LT, var, pi));
}
Kind rk =
const std::vector<Node>& args)
{
NodeManager* nm = NodeManager::currentNM();
- auto zero = nm->mkConst<Rational>(CONST_RATIONAL, 0);
if (Debug.isOn("arith::pf::check"))
{
Debug("arith::pf::check") << "Arith PfRule:" << id << std::endl;
|| rel == Kind::LEQ || rel == Kind::GT || rel == Kind::GEQ);
Node lhs = args[1][0];
Node rhs = args[1][1];
+ Node zero = nm->mkConstRealOrInt(mult.getType(), Rational(0));
return nm->mkNode(Kind::IMPLIES,
nm->mkAnd(std::vector<Node>{
nm->mkNode(Kind::GT, mult, zero), args[1]}),
Kind rel_inv = (rel == Kind::DISTINCT ? rel : reverseRelationKind(rel));
Node lhs = args[1][0];
Node rhs = args[1][1];
+ Node zero = nm->mkConstRealOrInt(mult.getType(), Rational(0));
return nm->mkNode(Kind::IMPLIES,
nm->mkAnd(std::vector<Node>{
nm->mkNode(Kind::LT, mult, zero), args[1]}),
<< "Bad kind: " << children[i].getKind() << std::endl;
}
}
- 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]);
+ leftSum << nm->mkNode(Kind::MULT, args[i], children[i][0]);
+ rightSum << nm->mkNode(Kind::MULT, args[i], children[i][1]);
}
Node r = nm->mkNode(strict ? Kind::LT : Kind::LEQ,
leftSum.constructNode(),
if (children.size() != 1
|| (children[0].getKind() != Kind::GT
&& children[0].getKind() != Kind::GEQ)
- || !children[0][0].getType().isInteger()
- || children[0][1].getKind() != Kind::CONST_RATIONAL)
+ || !children[0][0].getType().isInteger() || !children[0][1].isConst())
{
Debug("arith::pf::check") << "Illformed input: " << children;
return Node::null();
{
Rational originalBound = children[0][1].getConst<Rational>();
Rational newBound = leastIntGreaterThan(originalBound);
- Node rational = nm->mkConst<Rational>(CONST_RATIONAL, newBound);
+ Node rational = nm->mkConstInt(newBound);
return nm->mkNode(kind::GEQ, children[0][0], rational);
}
}
if (children.size() != 1
|| (children[0].getKind() != Kind::LT
&& children[0].getKind() != Kind::LEQ)
- || !children[0][0].getType().isInteger()
- || children[0][1].getKind() != Kind::CONST_RATIONAL)
+ || !children[0][0].getType().isInteger() || !children[0][1].isConst())
{
Debug("arith::pf::check") << "Illformed input: " << children;
return Node::null();
{
Rational originalBound = children[0][1].getConst<Rational>();
Rational newBound = greatestIntLessThan(originalBound);
- Node rational = nm->mkConst<Rational>(CONST_RATIONAL, newBound);
+ Node rational = nm->mkConstInt(newBound);
return nm->mkNode(kind::LEQ, children[0][0], rational);
}
}
Node f = node[0];
Node t = node[1];
Node A = node[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));
// types
TypeNode bagType = A.getType();
TypeNode elementType = A.getType().getBagElementType();
{
Node powNode = pow2(bvsize - 1);
Node modNode = d_nm->mkNode(kind::INTS_MODULUS_TOTAL, x, powNode);
- Node two = d_nm->mkConst(CONST_RATIONAL, Rational(2));
+ Node two = d_nm->mkConstInt(Rational(2));
Node twoTimesNode = d_nm->mkNode(kind::MULT, two, modNode);
return d_nm->mkNode(kind::MINUS, twoTimesNode, x);
}
Rational max_of_amount = intpow2(amount) - 1;
Rational mul = max_of_amount * intpow2(bvsize);
Rational sum = mul + c;
- returnNode = d_nm->mkConst(CONST_RATIONAL, sum);
+ returnNode = d_nm->mkConstInt(sum);
}
}
else
else
{
Rational twoToKMinusOne(intpow2(bvsize - 1));
- Node minSigned = d_nm->mkConst(CONST_RATIONAL, twoToKMinusOne);
+ Node minSigned = d_nm->mkConstInt(twoToKMinusOne);
/* condition checks whether the msb is 1.
* This holds when the integer value is smaller than
* 100...0, which is 2^{bvsize-1}.
ite = d_nm->mkNode(
kind::ITE,
d_nm->mkNode(
- kind::EQUAL,
- y,
- d_nm->mkConst(CONST_RATIONAL, Rational(Integer(i), Integer(1)))),
+ kind::EQUAL, y, d_nm->mkConstInt(Rational(Integer(i), Integer(1)))),
body,
ite);
}
RegExpEntail::RegExpEntail(Rewriter* r) : d_rewriter(r), d_aent(r)
{
- 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));
}
Node RegExpEntail::simpleRegexpConsume(std::vector<Node>& mchildren,
continue;
}
}
- Assert(bc.getKind() == CONST_RATIONAL);
+ Assert(bc.isConst() && bc.getType().isInteger());
Rational r = bc.getConst<Rational>();
if (k == REGEXP_CONCAT)
{
// if we were successful and didn't ignore all components
if (success && !firstTime)
{
- ret = nm->mkConst(CONST_RATIONAL, rr);
+ ret = nm->mkConstInt(rr);
}
}
if (ret.isNull() && isLower)