// Assert that floating-point addition is not associative:
// (a + (b + c)) != ((a + b) + c)
Expr rm = em.mkConst(RoundingMode.roundNearestTiesToEven);
- Expr lhs = em.mkExpr(Kind.FLOATINGPOINT_PLUS,
+ Expr lhs = em.mkExpr(Kind.FLOATINGPOINT_ADD,
rm,
a,
- em.mkExpr(Kind.FLOATINGPOINT_PLUS, rm, b, c));
- Expr rhs = em.mkExpr(Kind.FLOATINGPOINT_PLUS,
+ em.mkExpr(Kind.FLOATINGPOINT_ADD, rm, b, c));
+ Expr rhs = em.mkExpr(Kind.FLOATINGPOINT_ADD,
rm,
- em.mkExpr(Kind.FLOATINGPOINT_PLUS, rm, a, b),
+ em.mkExpr(Kind.FLOATINGPOINT_ADD, rm, a, b),
c);
smt.assertFormula(em.mkExpr(Kind.NOT, em.mkExpr(Kind.EQUAL, a, b)));
z = slv.mkConst(fp32, 'z')
# check floating-point arithmetic is commutative, i.e. x + y == y + x
- commutative = slv.mkTerm(kinds.FPEq, slv.mkTerm(kinds.FPPlus, rm, x, y), slv.mkTerm(kinds.FPPlus, rm, y, x))
+ commutative = slv.mkTerm(kinds.FPEq, slv.mkTerm(kinds.FPAdd, rm, x, y), slv.mkTerm(kinds.FPAdd, rm, y, x))
slv.push()
slv.assertFormula(slv.mkTerm(kinds.Not, commutative))
slv.assertFormula(slv.mkTerm(kinds.And, slv.mkTerm(kinds.And, bounds_x, bounds_y), bounds_z))
# (x + y) + z == x + (y + z)
- lhs = slv.mkTerm(kinds.FPPlus, rm, slv.mkTerm(kinds.FPPlus, rm, x, y), z)
- rhs = slv.mkTerm(kinds.FPPlus, rm, x, slv.mkTerm(kinds.FPPlus, rm, y, z))
+ lhs = slv.mkTerm(kinds.FPAdd, rm, slv.mkTerm(kinds.FPAdd, rm, x, y), z)
+ rhs = slv.mkTerm(kinds.FPAdd, rm, x, slv.mkTerm(kinds.FPAdd, rm, y, z))
associative = slv.mkTerm(kinds.Not, slv.mkTerm(kinds.FPEq, lhs, rhs))
slv.assertFormula(associative)
{FLOATINGPOINT_EQ, cvc5::Kind::FLOATINGPOINT_EQ},
{FLOATINGPOINT_ABS, cvc5::Kind::FLOATINGPOINT_ABS},
{FLOATINGPOINT_NEG, cvc5::Kind::FLOATINGPOINT_NEG},
- {FLOATINGPOINT_PLUS, cvc5::Kind::FLOATINGPOINT_PLUS},
+ {FLOATINGPOINT_ADD, cvc5::Kind::FLOATINGPOINT_ADD},
{FLOATINGPOINT_SUB, cvc5::Kind::FLOATINGPOINT_SUB},
{FLOATINGPOINT_MULT, cvc5::Kind::FLOATINGPOINT_MULT},
{FLOATINGPOINT_DIV, cvc5::Kind::FLOATINGPOINT_DIV},
{cvc5::Kind::FLOATINGPOINT_EQ, FLOATINGPOINT_EQ},
{cvc5::Kind::FLOATINGPOINT_ABS, FLOATINGPOINT_ABS},
{cvc5::Kind::FLOATINGPOINT_NEG, FLOATINGPOINT_NEG},
- {cvc5::Kind::FLOATINGPOINT_PLUS, FLOATINGPOINT_PLUS},
+ {cvc5::Kind::FLOATINGPOINT_ADD, FLOATINGPOINT_ADD},
{cvc5::Kind::FLOATINGPOINT_SUB, FLOATINGPOINT_SUB},
{cvc5::Kind::FLOATINGPOINT_MULT, FLOATINGPOINT_MULT},
{cvc5::Kind::FLOATINGPOINT_DIV, FLOATINGPOINT_DIV},
* - `Solver::mkTerm(Kind kind, const Term& child1, const Term& child2, const Term& child3) const`
* - `Solver::mkTerm(Kind kind, const std::vector<Term>& children) const`
*/
- FLOATINGPOINT_PLUS,
+ FLOATINGPOINT_ADD,
/**
* Floating-point sutraction.
*
addOperator(api::FLOATINGPOINT_EQ, "fp.eq");
addOperator(api::FLOATINGPOINT_ABS, "fp.abs");
addOperator(api::FLOATINGPOINT_NEG, "fp.neg");
- addOperator(api::FLOATINGPOINT_PLUS, "fp.add");
+ addOperator(api::FLOATINGPOINT_ADD, "fp.add");
addOperator(api::FLOATINGPOINT_SUB, "fp.sub");
addOperator(api::FLOATINGPOINT_MULT, "fp.mul");
addOperator(api::FLOATINGPOINT_DIV, "fp.div");
case kind::FLOATINGPOINT_EQ:
case kind::FLOATINGPOINT_ABS:
case kind::FLOATINGPOINT_NEG:
- case kind::FLOATINGPOINT_PLUS:
+ case kind::FLOATINGPOINT_ADD:
case kind::FLOATINGPOINT_SUB:
case kind::FLOATINGPOINT_MULT:
case kind::FLOATINGPOINT_DIV:
case kind::FLOATINGPOINT_EQ: return "fp.eq";
case kind::FLOATINGPOINT_ABS: return "fp.abs";
case kind::FLOATINGPOINT_NEG: return "fp.neg";
- case kind::FLOATINGPOINT_PLUS: return "fp.add";
+ case kind::FLOATINGPOINT_ADD: return "fp.add";
case kind::FLOATINGPOINT_SUB: return "fp.sub";
case kind::FLOATINGPOINT_MULT: return "fp.mul";
case kind::FLOATINGPOINT_DIV: return "fp.div";
}
break;
- case kind::FLOATINGPOINT_PLUS:
+ case kind::FLOATINGPOINT_ADD:
case kind::FLOATINGPOINT_SUB:
case kind::FLOATINGPOINT_MULT:
case kind::FLOATINGPOINT_DIV:
switch (current.getKind())
{
- case kind::FLOATINGPOINT_PLUS:
+ case kind::FLOATINGPOINT_ADD:
d_fpMap.insert(current,
symfpu::add<traits>(fpt(current.getType()),
(*mode).second,
operator FLOATINGPOINT_NEG 1 "floating-point negation"
typerule FLOATINGPOINT_NEG ::cvc5::theory::fp::FloatingPointOperationTypeRule
-operator FLOATINGPOINT_PLUS 3 "floating-point addition"
-typerule FLOATINGPOINT_PLUS ::cvc5::theory::fp::FloatingPointRoundingOperationTypeRule
+operator FLOATINGPOINT_ADD 3 "floating-point addition"
+typerule FLOATINGPOINT_ADD ::cvc5::theory::fp::FloatingPointRoundingOperationTypeRule
operator FLOATINGPOINT_SUB 3 "floating-point sutraction"
typerule FLOATINGPOINT_SUB ::cvc5::theory::fp::FloatingPointRoundingOperationTypeRule
d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_ABS);
d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_NEG);
- d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_PLUS);
+ d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_ADD);
// d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_SUB); // Removed
d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_MULT);
d_equalityEngine->addFunctionKind(kind::FLOATINGPOINT_DIV);
{
Assert(node.getKind() == kind::FLOATINGPOINT_SUB);
Node negation = NodeManager::currentNM()->mkNode(kind::FLOATINGPOINT_NEG,node[2]);
- Node addition = NodeManager::currentNM()->mkNode(kind::FLOATINGPOINT_PLUS,node[0],node[1],negation);
+ Node addition = NodeManager::currentNM()->mkNode(
+ kind::FLOATINGPOINT_ADD, node[0], node[1], negation);
return RewriteResponse(REWRITE_DONE, addition);
}
RewriteResponse reorderBinaryOperation (TNode node, bool isPreRewrite) {
Kind k = node.getKind();
- Assert((k == kind::FLOATINGPOINT_PLUS) || (k == kind::FLOATINGPOINT_MULT));
+ Assert((k == kind::FLOATINGPOINT_ADD) || (k == kind::FLOATINGPOINT_MULT));
Assert(!isPreRewrite); // Likely redundant in pre-rewrite
if (node[1] > node[2]) {
node[0].getConst<FloatingPoint>().negate()));
}
-RewriteResponse plus(TNode node, bool isPreRewrite)
+RewriteResponse add(TNode node, bool isPreRewrite)
{
- Assert(node.getKind() == kind::FLOATINGPOINT_PLUS);
+ Assert(node.getKind() == kind::FLOATINGPOINT_ADD);
Assert(node.getNumChildren() == 3);
RoundingMode rm(node[0].getConst<RoundingMode>());
Assert(arg1.getSize() == arg2.getSize());
- return RewriteResponse(
- REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1.plus(rm, arg2)));
+ return RewriteResponse(REWRITE_DONE,
+ NodeManager::currentNM()->mkConst(arg1.add(rm, arg2)));
}
RewriteResponse mult(TNode node, bool isPreRewrite)
d_preRewriteTable[kind::FLOATINGPOINT_FP] = rewrite::identity;
d_preRewriteTable[kind::FLOATINGPOINT_ABS] = rewrite::compactAbs;
d_preRewriteTable[kind::FLOATINGPOINT_NEG] = rewrite::removeDoubleNegation;
- d_preRewriteTable[kind::FLOATINGPOINT_PLUS] = rewrite::identity;
+ d_preRewriteTable[kind::FLOATINGPOINT_ADD] = rewrite::identity;
d_preRewriteTable[kind::FLOATINGPOINT_SUB] =
rewrite::convertSubtractionToAddition;
d_preRewriteTable[kind::FLOATINGPOINT_MULT] = rewrite::identity;
d_postRewriteTable[kind::FLOATINGPOINT_FP] = rewrite::identity;
d_postRewriteTable[kind::FLOATINGPOINT_ABS] = rewrite::compactAbs;
d_postRewriteTable[kind::FLOATINGPOINT_NEG] = rewrite::removeDoubleNegation;
- d_postRewriteTable[kind::FLOATINGPOINT_PLUS] =
- rewrite::reorderBinaryOperation;
+ d_postRewriteTable[kind::FLOATINGPOINT_ADD] = rewrite::reorderBinaryOperation;
d_postRewriteTable[kind::FLOATINGPOINT_SUB] = rewrite::identity;
d_postRewriteTable[kind::FLOATINGPOINT_MULT] =
rewrite::reorderBinaryOperation;
d_constantFoldTable[kind::FLOATINGPOINT_FP] = constantFold::fpLiteral;
d_constantFoldTable[kind::FLOATINGPOINT_ABS] = constantFold::abs;
d_constantFoldTable[kind::FLOATINGPOINT_NEG] = constantFold::neg;
- d_constantFoldTable[kind::FLOATINGPOINT_PLUS] = constantFold::plus;
+ d_constantFoldTable[kind::FLOATINGPOINT_ADD] = constantFold::add;
d_constantFoldTable[kind::FLOATINGPOINT_MULT] = constantFold::mult;
d_constantFoldTable[kind::FLOATINGPOINT_DIV] = constantFold::div;
d_constantFoldTable[kind::FLOATINGPOINT_FMA] = constantFold::fma;
}
// ternary ops with RM
std::vector<Kind> ternary_rm_kinds = {
- FLOATINGPOINT_PLUS,
+ FLOATINGPOINT_ADD,
FLOATINGPOINT_SUB,
FLOATINGPOINT_MULT,
FLOATINGPOINT_DIV,
return FloatingPoint(new FloatingPointLiteral(d_fpl->negate()));
}
-FloatingPoint FloatingPoint::plus(const RoundingMode& rm,
- const FloatingPoint& arg) const
+FloatingPoint FloatingPoint::add(const RoundingMode& rm,
+ const FloatingPoint& arg) const
{
return FloatingPoint(new FloatingPointLiteral(d_fpl->add(rm, *arg.d_fpl)));
}
/** Floating-point negation. */
FloatingPoint negate(void) const;
/** Floating-point addition. */
- FloatingPoint plus(const RoundingMode& rm, const FloatingPoint& arg) const;
+ FloatingPoint add(const RoundingMode& rm, const FloatingPoint& arg) const;
/** Floating-point subtraction. */
FloatingPoint sub(const RoundingMode& rm, const FloatingPoint& arg) const;
/** Floating-point multiplication. */