From 639540664a763a2a552d659eb594b04fb2656f5b Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Wed, 18 Nov 2020 09:07:08 -0600 Subject: Do not expand definitions of extended arithmetic operators (#5433) This PR makes it so that extended arithmetic operators are not expanded during expand definitions. Instead they are eliminated at theory preprocessing, which occurs as the last step of preprocessing. The motivation for this is three fold: (1) Some quantified LIA benchmarks lead to CVC4 failing to eliminate div functions from quantifier instantiation, this leads to spurious logic failures. A regression is included, which now is correctly solved. (2) We should allow better rewriting and preprocessing for extended arithmetic functions, especially for div/mod which is important for many users of QF_NIA. (3) More generally,Theory::expandDefinitions will be deleted. All functionalities in expandDefinitions should move to Theory::ppRewrite. This changes impacts many benchmarks that involve non-linear and quantifiers: Many benchmarks (as expected) give a warning during check-models since (/ n 0) cannot be evaluated. I've added -q to disable these warnings. Fully addressing this is part of an agenda to improve our support for --check-models. Several fuzzing benchmarks involving NL+quantifiers now time out. However, several can be solved by --sygus-inst, which is now the preferred instantiation strategy for NL+quantifiers. 2 other non-linear regressions time out, which are disabled in this PR. one sygus-inference benchmark (regress1/sygus/issue3498.smt2), now correctly times out (previously it did not timeout since the preprocessor was unable to apply sygus-inference and resorted to normal methods, now sygus-inference can apply but as expected times out). Fixes #5237. --- src/theory/arith/theory_arith.cpp | 6 ------ src/theory/arith/theory_arith.h | 2 -- src/theory/arith/theory_arith_private.cpp | 5 +++-- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'src/theory') diff --git a/src/theory/arith/theory_arith.cpp b/src/theory/arith/theory_arith.cpp index 532aaf55c..c77e64221 100644 --- a/src/theory/arith/theory_arith.cpp +++ b/src/theory/arith/theory_arith.cpp @@ -97,12 +97,6 @@ void TheoryArith::preRegisterTerm(TNode n) d_internal->preRegisterTerm(n); } -TrustNode TheoryArith::expandDefinition(Node node) -{ - // call eliminate operators - return d_arithPreproc.eliminate(node); -} - void TheoryArith::notifySharedTerm(TNode n) { d_internal->notifySharedTerm(n); } TrustNode TheoryArith::ppRewrite(TNode atom) diff --git a/src/theory/arith/theory_arith.h b/src/theory/arith/theory_arith.h index 0055273e4..e6029faef 100644 --- a/src/theory/arith/theory_arith.h +++ b/src/theory/arith/theory_arith.h @@ -74,8 +74,6 @@ class TheoryArith : public Theory { */ void preRegisterTerm(TNode n) override; - TrustNode expandDefinition(Node node) override; - //--------------------------------- standard check /** Pre-check, called before the fact queue of the theory is processed. */ bool preCheck(Effort level) override; diff --git a/src/theory/arith/theory_arith_private.cpp b/src/theory/arith/theory_arith_private.cpp index ac9ec7e77..2f758e621 100644 --- a/src/theory/arith/theory_arith_private.cpp +++ b/src/theory/arith/theory_arith_private.cpp @@ -1473,8 +1473,9 @@ ArithVar TheoryArithPrivate::requestArithVar(TNode x, bool aux, bool internal){ Assert(isLeaf(x) || VarList::isMember(x) || x.getKind() == PLUS || internal); if(getLogicInfo().isLinear() && Variable::isDivMember(x)){ stringstream ss; - ss << "A non-linear fact (involving div/mod/divisibility) was asserted to arithmetic in a linear logic: " << x << endl - << "if you only use division (or modulus) by a constant value, or if you only use the divisibility-by-k predicate, try using the --rewrite-divk option."; + ss << "A non-linear fact (involving div/mod/divisibility) was asserted to " + "arithmetic in a linear logic: " + << x << std::endl; throw LogicException(ss.str()); } Assert(!d_partialModel.hasArithVar(x)); -- cgit v1.2.3