From: Alex Ozdemir Date: Tue, 29 Sep 2020 03:14:47 +0000 (-0700) Subject: Add utilities for arith/proof_checker and build it (#5157) X-Git-Tag: cvc5-1.0.0~2794 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b830fb6747b5a5304100217e91481d9cc6c4f1c5;p=cvc5.git Add utilities for arith/proof_checker and build it (#5157) The arith proof checker was not being built (not in cmake). Now it is. A few dependencies were missing. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 620bcc352..587f845d3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -371,6 +371,8 @@ libcvc4_add_sources( theory/arith/operator_elim.h theory/arith/partial_model.cpp theory/arith/partial_model.h + theory/arith/proof_checker.cpp + theory/arith/proof_checker.h theory/arith/simplex.cpp theory/arith/simplex.h theory/arith/simplex_update.cpp diff --git a/src/theory/arith/arith_utilities.cpp b/src/theory/arith/arith_utilities.cpp index f07c31141..cbd976b03 100644 --- a/src/theory/arith/arith_utilities.cpp +++ b/src/theory/arith/arith_utilities.cpp @@ -278,6 +278,40 @@ Node mkBounded(Node l, Node a, Node u) return nm->mkNode(AND, nm->mkNode(GEQ, a, l), nm->mkNode(LEQ, a, u)); } +Rational leastIntGreaterThan(const Rational& q) { return q.floor() + 1; } + +Rational greatestIntLessThan(const Rational& q) { return q.ceiling() - 1; } + +Node negateProofLiteral(TNode n) +{ + auto nm = NodeManager::currentNM(); + switch (n.getKind()) + { + case Kind::GT: + { + return nm->mkNode(Kind::LEQ, n[0], n[1]); + } + case Kind::LT: + { + return nm->mkNode(Kind::GEQ, n[0], n[1]); + } + case Kind::LEQ: + { + return nm->mkNode(Kind::GT, n[0], n[1]); + } + case Kind::GEQ: + { + return nm->mkNode(Kind::LT, n[0], n[1]); + } + case Kind::EQUAL: + case Kind::NOT: + { + return n.negate(); + } + default: Unhandled() << n; + } +} + } // namespace arith } // namespace theory } // namespace CVC4 diff --git a/src/theory/arith/arith_utilities.h b/src/theory/arith/arith_utilities.h index a64208330..9e421efc7 100644 --- a/src/theory/arith/arith_utilities.h +++ b/src/theory/arith/arith_utilities.h @@ -338,6 +338,13 @@ Node arithSubstitute(Node n, std::vector& vars, std::vector& subs); /** Make the node u >= a ^ a >= l */ Node mkBounded(Node l, Node a, Node u); +Rational leastIntGreaterThan(const Rational&); + +Rational greatestIntLessThan(const Rational&); + +/** Negates a node in arithmetic proof normal form. */ +Node negateProofLiteral(TNode n); + }/* CVC4::theory::arith namespace */ }/* CVC4::theory namespace */ }/* CVC4 namespace */