[SMTChecker] Add mod operator

This commit is contained in:
Leonardo Alt 2019-01-22 14:34:29 +01:00
parent 8992024302
commit 637546850f
3 changed files with 9 additions and 0 deletions

View File

@ -163,6 +163,8 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr)
return m_context.mkExpr(CVC4::kind::MULT, arguments[0], arguments[1]);
else if (n == "/")
return m_context.mkExpr(CVC4::kind::INTS_DIVISION_TOTAL, arguments[0], arguments[1]);
else if (n == "mod")
return m_context.mkExpr(CVC4::kind::INTS_MODULUS, arguments[0], arguments[1]);
else if (n == "select")
return m_context.mkExpr(CVC4::kind::SELECT, arguments[0], arguments[1]);
else if (n == "store")

View File

@ -141,6 +141,7 @@ public:
{"-", 2},
{"*", 2},
{"/", 2},
{"mod", 2},
{"select", 2},
{"store", 3}
};
@ -246,6 +247,10 @@ public:
{
return Expression("/", std::move(_a), std::move(_b), Kind::Int);
}
friend Expression operator%(Expression _a, Expression _b)
{
return Expression("mod", std::move(_a), std::move(_b), Kind::Int);
}
Expression operator()(std::vector<Expression> _arguments) const
{
solAssert(

View File

@ -162,6 +162,8 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr)
return arguments[0] * arguments[1];
else if (n == "/")
return arguments[0] / arguments[1];
else if (n == "mod")
return z3::mod(arguments[0], arguments[1]);
else if (n == "select")
return z3::select(arguments[0], arguments[1]);
else if (n == "store")