diff options
Diffstat (limited to 'src/theory')
147 files changed, 1569 insertions, 1537 deletions
diff --git a/src/theory/arith/approx_simplex.cpp b/src/theory/arith/approx_simplex.cpp index ea349a383..6b277a10a 100644 --- a/src/theory/arith/approx_simplex.cpp +++ b/src/theory/arith/approx_simplex.cpp @@ -85,7 +85,9 @@ struct VirtualBound { , d(coeff) , y(bounding) , c(orig) - { Assert(k == kind::LEQ || k == kind::GEQ); } + { + Assert(k == kind::LEQ || k == kind::GEQ); + } }; struct CutScratchPad { @@ -621,8 +623,6 @@ ApproxGLPK::ApproxGLPK(const ArithVariables& v, TreeLog& l, ApproximateStatistic Assert(numRows > 0); Assert(numCols > 0); - - glp_add_rows(d_inputProb, numRows); glp_add_cols(d_inputProb, numCols); @@ -994,7 +994,7 @@ ApproxGLPK::~ApproxGLPK(){ ApproximateSimplex::Solution ApproxGLPK::extractSolution(bool mip) const { Assert(d_solvedRelaxation); - Assert(!mip || d_solvedMIP); + Assert(!mip || d_solvedMIP); ApproximateSimplex::Solution sol; DenseSet& newBasis = sol.newBasis; @@ -1737,8 +1737,6 @@ MipResult ApproxGLPK::solveMIP(bool activelyLog){ } } - - // Node explainSet(const set<ConstraintP>& inp){ // Assert(!inp.empty()); // NodeBuilder<> nb(kind::AND); @@ -2434,7 +2432,7 @@ bool ApproxGLPK::replaceSlacksOnCuts(){ ArithVar x = *iter; SlackReplace rep = d_pad.d_slacks[x]; if(d_vars.isIntegerInput(x)){ - Assert(rep == SlackLB || rep == SlackUB); + Assert(rep == SlackLB || rep == SlackUB); Rational& a = cut.get(x); const DeltaRational& bound = (rep == SlackLB) ? @@ -2835,7 +2833,7 @@ bool ApproxGLPK::gaussianElimConstructTableRow(int nid, int M, const PrimitiveVe // r_p : 0 = -1 * other + sum a_i x_i // rid : 0 = e * other + sum b_i x_i // rid += e * r_p - // : 0 = 0 * other + ... + // : 0 = 0 * other + ... Assert(!e.getCoefficient().isZero()); Rational cp = e.getCoefficient(); diff --git a/src/theory/arith/arith_ite_utils.cpp b/src/theory/arith/arith_ite_utils.cpp index 454d6c11f..3930d7359 100644 --- a/src/theory/arith/arith_ite_utils.cpp +++ b/src/theory/arith/arith_ite_utils.cpp @@ -390,8 +390,8 @@ Node ArithIteUtils::findIteCnd(TNode tb, TNode fb) const{ bool ArithIteUtils::solveBinOr(TNode binor){ Assert(binor.getKind() == kind::OR); Assert(binor.getNumChildren() == 2); - Assert(binor[0].getKind() == kind::EQUAL); - Assert(binor[1].getKind() == kind::EQUAL); + Assert(binor[0].getKind() == kind::EQUAL); + Assert(binor[1].getKind() == kind::EQUAL); //Node n = Node n = applySubstitutions(binor); @@ -411,8 +411,8 @@ bool ArithIteUtils::solveBinOr(TNode binor){ TNode l = n[0]; TNode r = n[1]; - Assert(l.getKind() == kind::EQUAL); - Assert(r.getKind() == kind::EQUAL); + Assert(l.getKind() == kind::EQUAL); + Assert(r.getKind() == kind::EQUAL); Debug("arith::ite") << "bin or " << n << endl; diff --git a/src/theory/arith/arith_rewriter.cpp b/src/theory/arith/arith_rewriter.cpp index 86e5b3195..c8a03fab1 100644 --- a/src/theory/arith/arith_rewriter.cpp +++ b/src/theory/arith/arith_rewriter.cpp @@ -50,7 +50,7 @@ RewriteResponse ArithRewriter::rewriteVariable(TNode t){ } RewriteResponse ArithRewriter::rewriteMinus(TNode t, bool pre){ - Assert(t.getKind()== kind::MINUS); + Assert(t.getKind() == kind::MINUS); if(pre){ if(t[0] == t[1]){ @@ -70,7 +70,7 @@ RewriteResponse ArithRewriter::rewriteMinus(TNode t, bool pre){ } RewriteResponse ArithRewriter::rewriteUMinus(TNode t, bool pre){ - Assert(t.getKind()== kind::UMINUS); + Assert(t.getKind() == kind::UMINUS); if(t[0].getKind() == kind::CONST_RATIONAL){ Rational neg = -(t[0].getConst<Rational>()); @@ -143,8 +143,7 @@ RewriteResponse ArithRewriter::preRewriteTerm(TNode t){ return RewriteResponse(REWRITE_DONE, t); case kind::PI: return RewriteResponse(REWRITE_DONE, t); - default: - Unhandled(k); + default: Unhandled() << k; } } } @@ -263,7 +262,7 @@ RewriteResponse ArithRewriter::postRewriteTerm(TNode t){ RewriteResponse ArithRewriter::preRewriteMult(TNode t){ - Assert(t.getKind()== kind::MULT || t.getKind()== kind::NONLINEAR_MULT); + Assert(t.getKind() == kind::MULT || t.getKind() == kind::NONLINEAR_MULT); if(t.getNumChildren() == 2){ if(t[0].getKind() == kind::CONST_RATIONAL @@ -321,7 +320,7 @@ static Node flatten(Kind k, TNode t){ } RewriteResponse ArithRewriter::preRewritePlus(TNode t){ - Assert(t.getKind()== kind::PLUS); + Assert(t.getKind() == kind::PLUS); if(canFlatten(kind::PLUS, t)){ return RewriteResponse(REWRITE_DONE, flatten(kind::PLUS, t)); @@ -331,7 +330,7 @@ RewriteResponse ArithRewriter::preRewritePlus(TNode t){ } RewriteResponse ArithRewriter::postRewritePlus(TNode t){ - Assert(t.getKind()== kind::PLUS); + Assert(t.getKind() == kind::PLUS); std::vector<Monomial> monomials; std::vector<Polynomial> polynomials; @@ -357,7 +356,7 @@ RewriteResponse ArithRewriter::postRewritePlus(TNode t){ } RewriteResponse ArithRewriter::postRewriteMult(TNode t){ - Assert(t.getKind()== kind::MULT || t.getKind()==kind::NONLINEAR_MULT); + Assert(t.getKind() == kind::MULT || t.getKind() == kind::NONLINEAR_MULT); Polynomial res = Polynomial::mkOne(); @@ -462,7 +461,7 @@ RewriteResponse ArithRewriter::postRewriteTranscendental(TNode t) { pi_factor, nm->mkNode(kind::MULT, ntwo, ra_div_two)); }else{ - Assert( r.sgn()==-1 ); + Assert(r.sgn() == -1); new_pi_factor = nm->mkNode(kind::PLUS, pi_factor, @@ -671,7 +670,7 @@ Node ArithRewriter::makeSubtractionNode(TNode l, TNode r){ } RewriteResponse ArithRewriter::rewriteDiv(TNode t, bool pre){ - Assert(t.getKind() == kind::DIVISION_TOTAL || t.getKind()== kind::DIVISION); + Assert(t.getKind() == kind::DIVISION_TOTAL || t.getKind() == kind::DIVISION); Node left = t[0]; Node right = t[1]; diff --git a/src/theory/arith/arith_static_learner.cpp b/src/theory/arith/arith_static_learner.cpp index 2138b513e..e17605ead 100644 --- a/src/theory/arith/arith_static_learner.cpp +++ b/src/theory/arith/arith_static_learner.cpp @@ -163,8 +163,8 @@ void ArithStaticLearner::iteMinMax(TNode n, NodeBuilder<>& learned){ if(t == cleft && e == cright){ // t == cleft && e == cright - Assert( t == cleft ); - Assert( e == cright ); + Assert(t == cleft); + Assert(e == cright); switch(k){ case LT: // (ite (< x y) x y) case LEQ: { // (ite (<= x y) x y) @@ -270,9 +270,7 @@ void ArithStaticLearner::addBound(TNode n) { Debug("arith::static") << "adding bound " << n << endl; } break; - default: - Unhandled(k); - break; + default: Unhandled() << k; break; } } diff --git a/src/theory/arith/arith_utilities.h b/src/theory/arith/arith_utilities.h index 4588a5848..d737fefeb 100644 --- a/src/theory/arith/arith_utilities.h +++ b/src/theory/arith/arith_utilities.h @@ -207,10 +207,8 @@ inline Node negateConjunctionAsClause(TNode conjunction){ } inline Node maybeUnaryConvert(NodeBuilder<>& builder){ - Assert(builder.getKind() == kind::OR || - builder.getKind() == kind::AND || - builder.getKind() == kind::PLUS || - builder.getKind() == kind::MULT); + Assert(builder.getKind() == kind::OR || builder.getKind() == kind::AND + || builder.getKind() == kind::PLUS || builder.getKind() == kind::MULT); Assert(builder.getNumChildren() >= 1); if(builder.getNumChildren() == 1){ return builder[0]; diff --git a/src/theory/arith/attempt_solution_simplex.cpp b/src/theory/arith/attempt_solution_simplex.cpp index f269847de..8173f2cea 100644 --- a/src/theory/arith/attempt_solution_simplex.cpp +++ b/src/theory/arith/attempt_solution_simplex.cpp @@ -138,7 +138,7 @@ Result::Sat AttemptSolutionSDP::attempt(const ApproximateSimplex::Solution& sol) return Result::UNSAT; } } - Assert( d_conflictVariables.empty() ); + Assert(d_conflictVariables.empty()); if(d_errorSet.errorEmpty()){ return Result::SAT; diff --git a/src/theory/arith/bound_counts.h b/src/theory/arith/bound_counts.h index 7bd69190e..43fa4e437 100644 --- a/src/theory/arith/bound_counts.h +++ b/src/theory/arith/bound_counts.h @@ -20,7 +20,7 @@ #include <stdint.h> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "theory/arith/arithvar.h" #include "util/dense_map.h" @@ -66,7 +66,7 @@ public: } inline BoundCounts operator-(BoundCounts bc) const { - Assert( *this >= bc ); + Assert(*this >= bc); return BoundCounts(d_lowerBoundCount - bc.d_lowerBoundCount, d_upperBoundCount - bc.d_upperBoundCount); } diff --git a/src/theory/arith/callbacks.cpp b/src/theory/arith/callbacks.cpp index a11dd729b..158a81e8d 100644 --- a/src/theory/arith/callbacks.cpp +++ b/src/theory/arith/callbacks.cpp @@ -93,13 +93,13 @@ void FarkasConflictBuilder::reset(){ /* Adds a constraint to the constraint under construction. */ void FarkasConflictBuilder::addConstraint(ConstraintCP c, const Rational& fc){ - Assert(!PROOF_ON() || - (!underConstruction() && d_constraints.empty() && d_farkas.empty()) || - (underConstruction() && d_constraints.size() + 1 == d_farkas.size())); + Assert( + !PROOF_ON() + || (!underConstruction() && d_constraints.empty() && d_farkas.empty()) + || (underConstruction() && d_constraints.size() + 1 == d_farkas.size())); Assert(PROOF_ON() || d_farkas.empty()); Assert(c->isTrue()); - if(d_consequent == NullConstraint){ d_consequent = c; } else { @@ -136,7 +136,7 @@ void FarkasConflictBuilder::makeLastConsequent(){ d_consequentSet = true; } - Assert(! d_consequent->negationHasProof() ); + Assert(!d_consequent->negationHasProof()); Assert(d_consequentSet); } @@ -144,9 +144,10 @@ void FarkasConflictBuilder::makeLastConsequent(){ ConstraintCP FarkasConflictBuilder::commitConflict(){ Assert(underConstruction()); Assert(!d_constraints.empty()); - Assert(!PROOF_ON() || - (!underConstruction() && d_constraints.empty() && d_farkas.empty()) || - (underConstruction() && d_constraints.size() + 1 == d_farkas.size())); + Assert( + !PROOF_ON() + || (!underConstruction() && d_constraints.empty() && d_farkas.empty()) + || (underConstruction() && d_constraints.size() + 1 == d_farkas.size())); Assert(PROOF_ON() || d_farkas.empty()); Assert(d_consequentSet); @@ -156,7 +157,7 @@ ConstraintCP FarkasConflictBuilder::commitConflict(){ reset(); Assert(!underConstruction()); - Assert( not_c->inConflict() ); + Assert(not_c->inConflict()); Assert(!d_consequentSet); return not_c; } diff --git a/src/theory/arith/congruence_manager.cpp b/src/theory/arith/congruence_manager.cpp index ce45141ef..5a6bf6f31 100644 --- a/src/theory/arith/congruence_manager.cpp +++ b/src/theory/arith/congruence_manager.cpp @@ -489,7 +489,7 @@ bool ArithCongruenceManager::fixpointInfer() { explain( eq_exp, assumptions ); }else{ //eq_exp should be true - Assert( eq_exp==d_true ); + Assert(eq_exp == d_true); } Node req_exp; if( assumptions.empty() ){ diff --git a/src/theory/arith/constraint.cpp b/src/theory/arith/constraint.cpp index c7251d4c4..e7b1289a4 100644 --- a/src/theory/arith/constraint.cpp +++ b/src/theory/arith/constraint.cpp @@ -63,8 +63,7 @@ ConstraintType Constraint::constraintTypeOfComparison(const Comparison& cmp){ return Equality; case DISTINCT: return Disequality; - default: - Unhandled(k); + default: Unhandled() << k; } } @@ -322,20 +321,11 @@ void ValueCollection::add(ConstraintP c){ ConstraintP ValueCollection::getConstraintOfType(ConstraintType t) const{ switch(t){ - case LowerBound: - Assert(hasLowerBound()); - return d_lowerBound; - case Equality: - Assert(hasEquality()); - return d_equality; - case UpperBound: - Assert(hasUpperBound()); - return d_upperBound; - case Disequality: - Assert(hasDisequality()); - return d_disequality; - default: - Unreachable(); + case LowerBound: Assert(hasLowerBound()); return d_lowerBound; + case Equality: Assert(hasEquality()); return d_equality; + case UpperBound: Assert(hasUpperBound()); return d_upperBound; + case Disequality: Assert(hasDisequality()); return d_disequality; + default: Unreachable(); } } @@ -613,7 +603,7 @@ void ConstraintRule::print(std::ostream& out) const { out << "_"; } out << " * (" << *antecedent << ")" << std::endl; - + Assert((coeffs == RationalVectorCPSentinel) || coeffIterator > 0); --p; coeffIterator = (coeffs != RationalVectorCPSentinel) ? coeffIterator-1 : 0; @@ -862,7 +852,8 @@ ConstraintP ConstraintDatabase::getConstraint(ArithVar v, ConstraintType t, cons pair<SortedConstraintMapIterator, bool> negInsertAttempt; negInsertAttempt = scm.insert(make_pair(negC->getValue(), ValueCollection())); Assert(negInsertAttempt.second - || ! negInsertAttempt.first->second.hasConstraintOfType(negC->getType())); + || !negInsertAttempt.first->second.hasConstraintOfType( + negC->getType())); negPos = negInsertAttempt.first; } @@ -1108,7 +1099,7 @@ void Constraint::setAssumption(bool nowInConflict){ Assert(assertedToTheTheory()); d_database->pushConstraintRule(ConstraintRule(this, AssumeAP)); - + Assert(inConflict() == nowInConflict); if(Debug.isOn("constraint::conflictCommit") && inConflict()){ Debug("constraint::conflictCommit") << "inConflict@setAssumption " << this << std::endl; @@ -1149,7 +1140,6 @@ void Constraint::impliedByUnate(ConstraintCP imp, bool nowInConflict){ Assert(imp->hasProof()); Assert(negationHasProof() == nowInConflict); - d_database->d_antecedents.push_back(NullConstraint); d_database->d_antecedents.push_back(imp); @@ -1283,7 +1273,7 @@ void Constraint::impliedByFarkas(const ConstraintCPVec& a, RationalVectorCP coef Assert(negationHasProof() == nowInConflict); Assert(allHaveProof(a)); - Assert( PROOF_ON() == (coeffs != RationalVectorCPSentinel) ); + Assert(PROOF_ON() == (coeffs != RationalVectorCPSentinel)); // !PROOF_ON() => coeffs == RationalVectorCPSentinel // PROOF_ON() => coeffs->size() == a.size() + 1 Assert(!PROOF_ON() || coeffs->size() == a.size() + 1); @@ -1404,7 +1394,8 @@ void Constraint::assertionFringe(ConstraintCPVec& v){ v[writePos] = vi; writePos++; }else{ - Assert(vi->hasTrichotomyProof() || vi->hasFarkasProof() || vi->hasIntHoleProof() ); + Assert(vi->hasTrichotomyProof() || vi->hasFarkasProof() + || vi->hasIntHoleProof()); AntecedentId p = vi->getEndAntecedent(); ConstraintCP antecedent = antecedents[p]; @@ -1561,7 +1552,7 @@ ConstraintP Constraint::getStrictlyWeakerUpperBound(bool hasLiteral, bool assert ConstraintP ConstraintDatabase::getBestImpliedBound(ArithVar v, ConstraintType t, const DeltaRational& r) const { Assert(variableDatabaseIsSetup(v)); - Assert(t == UpperBound || t == LowerBound); + Assert(t == UpperBound || t == LowerBound); SortedConstraintMap& scm = getVariableSCM(v); if(t == UpperBound){ diff --git a/src/theory/arith/delta_rational.h b/src/theory/arith/delta_rational.h index 831c631f8..7fd4e2031 100644 --- a/src/theory/arith/delta_rational.h +++ b/src/theory/arith/delta_rational.h @@ -21,8 +21,8 @@ #include <ostream> +#include "base/check.h" #include "base/exception.h" -#include "base/cvc4_assert.h" #include "util/integer.h" #include "util/rational.h" diff --git a/src/theory/arith/dio_solver.cpp b/src/theory/arith/dio_solver.cpp index b30dc515b..11cf55354 100644 --- a/src/theory/arith/dio_solver.cpp +++ b/src/theory/arith/dio_solver.cpp @@ -279,7 +279,6 @@ void DioSolver::enqueueInputConstraints(){ void DioSolver::moveMinimumByAbsToQueueFront(){ Assert(!queueEmpty()); - //Select the minimum element. size_t indexInQueue = 0; Monomial minMonomial = d_trail[d_currentF[indexInQueue]].d_minimalMonomial; @@ -399,7 +398,12 @@ DioSolver::TrailIndex DioSolver::impliedGcdOfOne(){ Debug("arith::dio") << "extendedReduction combine" << endl; TrailIndex next = combineEqAtIndexes(current, s, inQueue, t); - Assert(d_trail[next].d_eq.getPolynomial().getCoefficient(vl).getValue().getNumerator() == g); + Assert(d_trail[next] + .d_eq.getPolynomial() + .getCoefficient(vl) + .getValue() + .getNumerator() + == g); current = next; currentCoeff = g; @@ -633,7 +637,8 @@ std::pair<DioSolver::SubIndex, DioSolver::TrailIndex> DioSolver::solveIndex(DioS d_subs.push_back(Substitution(Node::null(), var, ci)); Debug("arith::dio") << "after solveIndex " << d_trail[ci].d_eq.getNode() << " for " << av.getNode() << endl; - Assert(d_trail[ci].d_eq.getPolynomial().getCoefficient(vl) == Constant::mkConstant(-1)); + Assert(d_trail[ci].d_eq.getPolynomial().getCoefficient(vl) + == Constant::mkConstant(-1)); return make_pair(subBy, i); } @@ -690,7 +695,8 @@ std::pair<DioSolver::SubIndex, DioSolver::TrailIndex> DioSolver::decomposeIndex( Debug("arith::dio") << "Decompose ci(" << ci <<":" << d_trail[ci].d_eq.getNode() << ") for " << d_trail[i].d_minimalMonomial.getNode() << endl; - Assert(d_trail[ci].d_eq.getPolynomial().getCoefficient(vl) == Constant::mkConstant(-1)); + Assert(d_trail[ci].d_eq.getPolynomial().getCoefficient(vl) + == Constant::mkConstant(-1)); SumPair newFact = r + fresh_a; @@ -717,7 +723,10 @@ DioSolver::TrailIndex DioSolver::applySubstitution(DioSolver::SubIndex si, DioSo if(!a.isZero()){ Integer one(1); TrailIndex afterSub = combineEqAtIndexes(ti, one, subIndex, a.getValue().getNumerator()); - Assert(d_trail[afterSub].d_eq.getPolynomial().getCoefficient(VarList(var)).isZero()); + Assert(d_trail[afterSub] + .d_eq.getPolynomial() + .getCoefficient(VarList(var)) + .isZero()); return afterSub; }else{ return ti; diff --git a/src/theory/arith/dio_solver.h b/src/theory/arith/dio_solver.h index 0c26f9c55..fa6c08696 100644 --- a/src/theory/arith/dio_solver.h +++ b/src/theory/arith/dio_solver.h @@ -74,7 +74,8 @@ private: NodeToInputConstraintIndexMap d_varToInputConstraintMap; Node proofVariableToReason(const Variable& v) const{ - Assert(d_varToInputConstraintMap.find(v.getNode()) != d_varToInputConstraintMap.end()); + Assert(d_varToInputConstraintMap.find(v.getNode()) + != d_varToInputConstraintMap.end()); InputConstraintIndex pos = (*(d_varToInputConstraintMap.find(v.getNode()))).second; Assert(pos < d_inputConstraints.size()); return d_inputConstraints[pos].d_reason; diff --git a/src/theory/arith/error_set.h b/src/theory/arith/error_set.h index 8839739a2..9e3e7c630 100644 --- a/src/theory/arith/error_set.h +++ b/src/theory/arith/error_set.h @@ -152,8 +152,16 @@ public: inline ArithVar getVariable() const { return d_variable; } bool isRelaxed() const { return d_relaxed; } - void setRelaxed(){ Assert(!d_relaxed); d_relaxed = true; } - void setUnrelaxed(){ Assert(d_relaxed); d_relaxed = false; } + void setRelaxed() + { + Assert(!d_relaxed); + d_relaxed = true; + } + void setUnrelaxed() + { + Assert(d_relaxed); + d_relaxed = false; + } inline int sgn() const { return d_sgn; } diff --git a/src/theory/arith/fc_simplex.cpp b/src/theory/arith/fc_simplex.cpp index 827323302..29177d3f4 100644 --- a/src/theory/arith/fc_simplex.cpp +++ b/src/theory/arith/fc_simplex.cpp @@ -118,8 +118,7 @@ Result::Sat FCSimplexDecisionProcedure::findModel(bool exactResult){ }else if(d_errorSet.errorEmpty()){ //if(verbose){ Message() << "fcFindModel("<< instance <<") fixed itself" << endl; } Debug("arith::findModel") << "fcFindModel("<< instance <<") fixed itself" << endl; - if(verbose) - Assert(!d_errorSet.moreSignals()); + if (verbose) Assert(!d_errorSet.moreSignals()); Assert(d_conflictVariables.empty()); return Result::SAT; } @@ -264,7 +263,7 @@ WitnessImprovement FCSimplexDecisionProcedure::adjustFocusShrank(const ArithVarV WitnessImprovement FCSimplexDecisionProcedure::focusDownToJust(ArithVar v){ // uint32_t newErrorSize = d_errorSet.errorSize(); // uint32_t newFocusSize = d_errorSet.focusSize(); - Assert(d_focusSize == d_errorSet.focusSize()); + Assert(d_focusSize == d_errorSet.focusSize()); Assert(d_focusSize > 1); Assert(d_errorSet.inFocus(v)); @@ -558,7 +557,8 @@ void FCSimplexDecisionProcedure::updateAndSignal(const UpdateInfo& selected, Wit int prevFocusSgn = d_errorSet.popSignal(); if(d_tableau.isBasic(updated)){ - Assert(!d_variables.assignmentIsConsistent(updated) == d_errorSet.inError(updated)); + Assert(!d_variables.assignmentIsConsistent(updated) + == d_errorSet.inError(updated)); if(Debug.isOn("updateAndSignal")){debugPrintSignal(updated);} if(!d_variables.assignmentIsConsistent(updated)){ if(checkBasicForConflict(updated)){ @@ -582,7 +582,8 @@ void FCSimplexDecisionProcedure::updateAndSignal(const UpdateInfo& selected, Wit } if(Debug.isOn("error")){ d_errorSet.debugPrint(Debug("error")); } - Assert(debugSelectedErrorDropped(selected, d_errorSize, d_errorSet.errorSize())); + Assert( + debugSelectedErrorDropped(selected, d_errorSize, d_errorSet.errorSize())); adjustFocusAndError(selected, focusChanges); } @@ -729,7 +730,6 @@ Result::Sat FCSimplexDecisionProcedure::dualLike(){ Assert(d_conflictVariables.empty()); Assert(d_focusErrorVar == ARITHVAR_SENTINEL); - d_scores.purge(); d_focusErrorVar = constructInfeasiblityFunction(d_statistics.d_fcFocusConstructionTimer); @@ -752,8 +752,8 @@ Result::Sat FCSimplexDecisionProcedure::dualLike(){ d_focusSize = d_errorSet.focusSize(); - Assert( d_errorSize == d_focusSize); - Assert( d_errorSize >= 1 ); + Assert(d_errorSize == d_focusSize); + Assert(d_errorSize >= 1); d_focusErrorVar = constructInfeasiblityFunction(d_statistics.d_fcFocusConstructionTimer); @@ -795,7 +795,8 @@ Result::Sat FCSimplexDecisionProcedure::dualLike(){ if(verbose){ debugDualLike(w, Message(), instance, prevFocusSize, prevErrorSize); } - Assert(debugDualLike(w, Debug("dualLike"), instance, prevFocusSize, prevErrorSize)); + Assert(debugDualLike( + w, Debug("dualLike"), instance, prevFocusSize, prevErrorSize)); } diff --git a/src/theory/arith/linear_equality.cpp b/src/theory/arith/linear_equality.cpp index 7f729751b..8c7d22088 100644 --- a/src/theory/arith/linear_equality.cpp +++ b/src/theory/arith/linear_equality.cpp @@ -365,7 +365,6 @@ void LinearEqualityModule::debugCheckTracking(){ << "computed " << computed << " tracking " << d_btracking[ridx] << endl; Assert(computed == d_btracking[ridx]); - } } } @@ -574,12 +573,10 @@ void LinearEqualityModule::propagateRow(ConstraintCPVec& into, RowIndex ridx, bo Assert(sgn != 0); bool selectUb = rowUp ? (sgn > 0) : (sgn < 0); - Assert( nonbasic != v || - ( rowUp && a_ij.sgn() > 0 && c->isLowerBound()) || - ( rowUp && a_ij.sgn() < 0 && c->isUpperBound()) || - (!rowUp && a_ij.sgn() > 0 && c->isUpperBound()) || - (!rowUp && a_ij.sgn() < 0 && c->isLowerBound()) - ); + Assert(nonbasic != v || (rowUp && a_ij.sgn() > 0 && c->isLowerBound()) + || (rowUp && a_ij.sgn() < 0 && c->isUpperBound()) + || (!rowUp && a_ij.sgn() > 0 && c->isUpperBound()) + || (!rowUp && a_ij.sgn() < 0 && c->isLowerBound())); if(Debug.isOn("arith::propagateRow")){ if(nonbasic == v){ @@ -743,7 +740,7 @@ ConstraintCP LinearEqualityModule::minimallyWeakConflict(bool aboveUpper, ArithV fcs.addConstraint(c, coeff, adjustSgn); if(basicVar == v){ - Assert(! c->negationHasProof() ); + Assert(!c->negationHasProof()); fcs.makeLastConsequent(); } } @@ -1400,8 +1397,8 @@ void LinearEqualityModule::pop_block(BorderHeap& heap, int& brokenInBlock, int& heap.pop_heap(); }else{ // does not belong to the block - Assert((heap.direction() > 0) ? - (blockValue < top.d_diff) : (blockValue > top.d_diff)); + Assert((heap.direction() > 0) ? (blockValue < top.d_diff) + : (blockValue > top.d_diff)); break; } } diff --git a/src/theory/arith/matrix.h b/src/theory/arith/matrix.h index 02b8dc194..c845ccb05 100644 --- a/src/theory/arith/matrix.h +++ b/src/theory/arith/matrix.h @@ -478,7 +478,6 @@ protected: Assert(newEntry.getCoefficient() != 0); - ++d_entriesInUse; d_rows[row].insert(newId); @@ -650,7 +649,6 @@ public: Assert(mult != 0); - RowIterator i = getRow(to).begin(); RowIterator i_end = getRow(to).end(); while(i != i_end){ @@ -710,7 +708,6 @@ public: Assert(mult != 0); - RowIterator i = getRow(to).begin(); RowIterator i_end = getRow(to).end(); while(i != i_end){ diff --git a/src/theory/arith/nonlinear_extension.cpp b/src/theory/arith/nonlinear_extension.cpp index 4747727c8..839520c0b 100644 --- a/src/theory/arith/nonlinear_extension.cpp +++ b/src/theory/arith/nonlinear_extension.cpp @@ -975,7 +975,7 @@ bool NonlinearExtension::addCheckModelSubstitution(TNode v, TNode s) { Trace("nl-ext-model") << "...ERROR: already has value." << std::endl; // this should never happen since substitutions should be applied eagerly - Assert( false ); + Assert(false); return false; } // if we previously had an approximate bound, the exact bound should be in its @@ -1876,8 +1876,8 @@ int NonlinearExtension::checkLastCall(const std::vector<Node>& assertions, /* //mark processed if has a "one" factor (will look at reduced monomial) std::map< Node, std::map< Node, unsigned > >::iterator itme = - d_m_exp.find( a ); Assert( itme!=d_m_exp.end() ); for( std::map< Node, - unsigned >::iterator itme2 = itme->second.begin(); itme2 != + d_m_exp.find( a ); Assert( itme!=d_m_exp.end() ); for( std::map< + Node, unsigned >::iterator itme2 = itme->second.begin(); itme2 != itme->second.end(); ++itme2 ){ Node v = itme->first; Assert( d_mv[0].find( v )!=d_mv[0].end() ); Node mvv = d_mv[0][ v ]; if( mvv==d_one || mvv==d_neg_one ){ ms_proc[ a ] = true; @@ -1957,7 +1957,7 @@ int NonlinearExtension::checkLastCall(const std::vector<Node>& assertions, } else { - Assert( false ); + Assert(false); } } // initialize pi if necessary @@ -2669,7 +2669,7 @@ void NonlinearExtension::printModelValue(const char* c, int NonlinearExtension::compare_value(Node i, Node j, unsigned orderType) const { Assert(orderType >= 0 && orderType <= 3); - Assert( i.isConst() && j.isConst() ); + Assert(i.isConst() && j.isConst()); Trace("nl-ext-debug") << "compare value " << i << " " << j << ", o = " << orderType << std::endl; int ret; @@ -2725,8 +2725,8 @@ int NonlinearExtension::compareSign(Node oa, Node a, unsigned a_index, Node av = d_m_vlist[a][a_index]; unsigned aexp = d_m_exp[a][av]; // take current sign in model - Assert( d_mv[1].find(av) != d_mv[0].end() ); - Assert( d_mv[1][av].isConst() ); + Assert(d_mv[1].find(av) != d_mv[0].end()); + Assert(d_mv[1][av].isConst()); int sgn = d_mv[1][av].getConst<Rational>().sgn(); Trace("nl-ext-debug") << "Process var " << av << "^" << aexp << ", model sign = " << sgn << std::endl; @@ -3032,7 +3032,7 @@ std::vector<Node> NonlinearExtension::checkMonomialMagnitude( unsigned c ) { // compare magnitude against variables for (unsigned k = 0; k < d_ms_vars.size(); k++) { Node v = d_ms_vars[k]; - Assert( d_mv[0].find( v )!=d_mv[0].end() ); + Assert(d_mv[0].find(v) != d_mv[0].end()); if( d_mv[0][v].isConst() ){ std::vector<Node> exp; NodeMultiset a_exp_proc; @@ -3185,7 +3185,7 @@ std::vector<Node> NonlinearExtension::checkTangentPlanes() { Node curr_v = p<=1 ? a_v_c : b_v_c; if( prevRefine ){ Node pt_v = d_tangent_val_bound[p][a][b]; - Assert( !pt_v.isNull() ); + Assert(!pt_v.isNull()); if( curr_v!=pt_v ){ Node do_extend = nm->mkNode((p == 1 || p == 3) ? GT : LT, curr_v, pt_v); @@ -3424,8 +3424,8 @@ std::vector<Node> NonlinearExtension::checkMonomialInferBounds( Kind type = itcr->second; for (unsigned j = 0; j < itm->second.size(); j++) { Node y = itm->second[j]; - Assert(d_m_contain_mult[x].find(y) != - d_m_contain_mult[x].end()); + Assert(d_m_contain_mult[x].find(y) + != d_m_contain_mult[x].end()); Node mult = d_m_contain_mult[x][y]; // x <k> t => m*x <k'> t where y = m*x // get the sign of mult @@ -3583,7 +3583,7 @@ std::vector<Node> NonlinearExtension::checkFactoring( poly.push_back(NodeManager::currentNM()->mkNode(MULT, x, kf)); std::map<Node, std::vector<Node> >::iterator itfo = factor_to_mono_orig.find(x); - Assert( itfo!=factor_to_mono_orig.end() ); + Assert(itfo != factor_to_mono_orig.end()); for( std::map<Node, Node>::iterator itm = msum.begin(); itm != msum.end(); ++itm ){ if( std::find( itfo->second.begin(), itfo->second.end(), itm->first )==itfo->second.end() ){ poly.push_back(ArithMSum::mkCoeffTerm( @@ -3781,7 +3781,7 @@ std::vector<Node> NonlinearExtension::checkTranscendentalInitialRefine() { Kind k = tfl.first; for (const Node& t : tfl.second) { - Assert( d_mv[1].find( t )!=d_mv[1].end() ); + Assert(d_mv[1].find(t) != d_mv[1].end()); //initial refinements if( d_tf_initial_refine.find( t )==d_tf_initial_refine.end() ){ d_tf_initial_refine[t] = true; @@ -3921,10 +3921,10 @@ std::vector<Node> NonlinearExtension::checkTranscendentalMonotonic() { for (unsigned i = 0; i < sorted_tf_args[k].size(); i++) { Node targ = sorted_tf_args[k][i]; - Assert( d_mv[1].find( targ )!=d_mv[1].end() ); + Assert(d_mv[1].find(targ) != d_mv[1].end()); Trace("nl-ext-tf-mono") << " " << targ << " -> " << d_mv[1][targ] << std::endl; Node t = tf_arg_to_term[k][targ]; - Assert( d_mv[1].find( t )!=d_mv[1].end() ); + Assert(d_mv[1].find(t) != d_mv[1].end()); Trace("nl-ext-tf-mono") << " f-val : " << d_mv[1][t] << std::endl; } std::vector< Node > mpoints; @@ -3947,7 +3947,7 @@ std::vector<Node> NonlinearExtension::checkTranscendentalMonotonic() { Node mpv; if( !mpoints[i].isNull() ){ mpv = computeModelValue( mpoints[i], 1 ); - Assert( mpv.isConst() ); + Assert(mpv.isConst()); } mpoints_vals.push_back( mpv ); } @@ -3959,14 +3959,14 @@ std::vector<Node> NonlinearExtension::checkTranscendentalMonotonic() { for (unsigned i = 0, size = sorted_tf_args[k].size(); i < size; i++) { Node sarg = sorted_tf_args[k][i]; - Assert( d_mv[1].find( sarg )!=d_mv[1].end() ); + Assert(d_mv[1].find(sarg) != d_mv[1].end()); Node sargval = d_mv[1][sarg]; - Assert( sargval.isConst() ); + Assert(sargval.isConst()); Node s = tf_arg_to_term[k][ sarg ]; - Assert( d_mv[1].find( s )!=d_mv[1].end() ); + Assert(d_mv[1].find(s) != d_mv[1].end()); Node sval = d_mv[1][s]; - Assert( sval.isConst() ); - + Assert(sval.isConst()); + //increment to the proper monotonicity region bool increment = true; while (increment && mdir_index < mpoints.size()) @@ -3976,7 +3976,7 @@ std::vector<Node> NonlinearExtension::checkTranscendentalMonotonic() { increment = true; }else{ Node pval = mpoints_vals[mdir_index]; - Assert( pval.isConst() ); + Assert(pval.isConst()); if( sargval.getConst<Rational>() < pval.getConst<Rational>() ){ increment = true; Trace("nl-ext-tf-mono") << "...increment at " << sarg << " since model value is less than " << mpoints[mdir_index] << std::endl; @@ -4017,7 +4017,7 @@ std::vector<Node> NonlinearExtension::checkTranscendentalMonotonic() { } if( !mono_lem.isNull() ){ if( !mono_bounds[0].isNull() ){ - Assert( !mono_bounds[1].isNull() ); + Assert(!mono_bounds[1].isNull()); mono_lem = NodeManager::currentNM()->mkNode( IMPLIES, NodeManager::currentNM()->mkNode( diff --git a/src/theory/arith/normal_form.cpp b/src/theory/arith/normal_form.cpp index ee298bc66..c0658b9af 100644 --- a/src/theory/arith/normal_form.cpp +++ b/src/theory/arith/normal_form.cpp @@ -69,11 +69,7 @@ bool Variable::isLeafMember(Node n){ (Theory::isLeafOf(n, theory::THEORY_ARITH)); } -VarList::VarList(Node n) - : NodeWrapper(n) -{ - Assert(isSorted(begin(), end())); -} +VarList::VarList(Node n) : NodeWrapper(n) { Assert(isSorted(begin(), end())); } bool Variable::isDivMember(Node n){ switch(n.getKind()){ @@ -275,11 +271,13 @@ Monomial Monomial::operator*(const Monomial& mono) const { return Monomial::mkMonomial(newConstant, newVL); } -// vector<Monomial> Monomial::sumLikeTerms(const std::vector<Monomial> & monos) { +// vector<Monomial> Monomial::sumLikeTerms(const std::vector<Monomial> & monos) +// { // Assert(isSorted(monos)); // vector<Monomial> outMonomials; // typedef vector<Monomial>::const_iterator iterator; -// for(iterator rangeIter = monos.begin(), end=monos.end(); rangeIter != end;) { +// for(iterator rangeIter = monos.begin(), end=monos.end(); rangeIter != end;) +// { // Rational constant = (*rangeIter).getConstant().getValue(); // VarList varList = (*rangeIter).getVarList(); // ++rangeIter; @@ -334,7 +332,7 @@ void Monomial::combineAdjacentMonomials(std::vector<Monomial>& monos) { writePos++; } } - Assert(rangeEnd>readPos); + Assert(rangeEnd > readPos); readPos = rangeEnd; } if(writePos > 0 ){ @@ -526,7 +524,7 @@ Integer Polynomial::numeratorGCD() const { //We'll use the standardization that gcd(0, 0) = 0 //So that the gcd of the zero polynomial is gcd{0} = 0 iterator i=begin(), e=end(); - Assert(i!=e); + Assert(i != e); Integer d = (*i).getConstant().getValue().getNumerator().abs(); if(d.isOne()){ @@ -683,13 +681,7 @@ SumPair SumPair::mkSumPair(const Polynomial& p){ } } -Comparison::Comparison(TNode n) - : NodeWrapper(n) -{ - Assert(isNormalForm()); -} - - +Comparison::Comparison(TNode n) : NodeWrapper(n) { Assert(isNormalForm()); } SumPair Comparison::toSumPair() const { Kind cmpKind = comparisonKind(); @@ -727,8 +719,7 @@ SumPair Comparison::toSumPair() const { return SumPair(left - right, Constant::mkZero()); } } - default: - Unhandled(cmpKind); + default: Unhandled() << cmpKind; } } @@ -766,8 +757,7 @@ Polynomial Comparison::normalizedVariablePart() const { } } } - default: - Unhandled(cmpKind); + default: Unhandled() << cmpKind; } } @@ -816,8 +806,7 @@ DeltaRational Comparison::normalizedDeltaRational() const { return DeltaRational(0, 0); } } - default: - Unhandled(cmpKind); + default: Unhandled() << cmpKind; } } @@ -834,8 +823,7 @@ Node Comparison::toNode(Kind k, const Polynomial& l, const Constant& r) { case kind::GEQ: case kind::GT: return NodeManager::currentNM()->mkNode(k, l.getNode(), r.getNode()); - default: - Unhandled(k); + default: Unhandled() << k; } } @@ -875,9 +863,7 @@ size_t Comparison::getComplexity() const{ case kind::GT: case kind::GEQ: return getLeft().getComplexity() + getRight().getComplexity(); - default: - Unhandled(comparisonKind()); - return -1; + default: Unhandled() << comparisonKind(); return -1; } } @@ -895,8 +881,7 @@ Polynomial Comparison::getLeft() const { case kind::GEQ: left = getNode()[0]; break; - default: - Unhandled(k); + default: Unhandled() << k; } return Polynomial::parsePolynomial(left); } @@ -915,8 +900,7 @@ Polynomial Comparison::getRight() const { case kind::GEQ: right = getNode()[1]; break; - default: - Unhandled(k); + default: Unhandled() << k; } return Polynomial::parsePolynomial(right); } @@ -1290,8 +1274,7 @@ Comparison Comparison::mkComparison(Kind k, const Polynomial& l, const Polynomia result = isInteger ? mkIntInequality(k, diff) : mkRatInequality(k, diff); break; - default: - Unhandled(k); + default: Unhandled() << k; } Assert(!result.isNull()); if(result.getKind() == kind::NOT && result[0].getKind() == kind::CONST_BOOLEAN){ diff --git a/src/theory/arith/normal_form.h b/src/theory/arith/normal_form.h index a3d173cc7..8099339ae 100644 --- a/src/theory/arith/normal_form.h +++ b/src/theory/arith/normal_form.h @@ -224,48 +224,44 @@ public: class Variable : public NodeWrapper { public: - Variable(Node n) : NodeWrapper(n) { - Assert(isMember(getNode())); - } - - // TODO: check if it's a theory leaf also - static bool isMember(Node n) { - Kind k = n.getKind(); - switch(k){ - case kind::CONST_RATIONAL: - return false; - case kind::INTS_DIVISION: - case kind::INTS_MODULUS: - case kind::DIVISION: - case kind::INTS_DIVISION_TOTAL: - case kind::INTS_MODULUS_TOTAL: - case kind::DIVISION_TOTAL: - return isDivMember(n); - case kind::EXPONENTIAL: - case kind::SINE: - case kind::COSINE: - case kind::TANGENT: - case kind::COSECANT: - case kind::SECANT: - case kind::COTANGENT: - case kind::ARCSINE: - case kind::ARCCOSINE: - case kind::ARCTANGENT: - case kind::ARCCOSECANT: - case kind::ARCSECANT: - case kind::ARCCOTANGENT: - case kind::SQRT: - case kind::PI: - return isTranscendentalMember(n); - case kind::ABS: - case kind::TO_INTEGER: - // Treat to_int as a variable; it is replaced in early preprocessing - // by a variable. - return true; - default: - return isLeafMember(n); - } - } + Variable(Node n) : NodeWrapper(n) { Assert(isMember(getNode())); } + + // TODO: check if it's a theory leaf also + static bool isMember(Node n) + { + Kind k = n.getKind(); + switch (k) + { + case kind::CONST_RATIONAL: return false; + case kind::INTS_DIVISION: + case kind::INTS_MODULUS: + case kind::DIVISION: + case kind::INTS_DIVISION_TOTAL: + case kind::INTS_MODULUS_TOTAL: + case kind::DIVISION_TOTAL: return isDivMember(n); + case kind::EXPONENTIAL: + case kind::SINE: + case kind::COSINE: + case kind::TANGENT: + case kind::COSECANT: + case kind::SECANT: + case kind::COTANGENT: + case kind::ARCSINE: + case kind::ARCCOSINE: + case kind::ARCTANGENT: + case kind::ARCCOSECANT: + case kind::ARCSECANT: + case kind::ARCCOTANGENT: + case kind::SQRT: + case kind::PI: return isTranscendentalMember(n); + case kind::ABS: + case kind::TO_INTEGER: + // Treat to_int as a variable; it is replaced in early preprocessing + // by a variable. + return true; + default: return isLeafMember(n); + } + } static bool isLeafMember(Node n); static bool isDivMember(Node n); @@ -306,7 +302,7 @@ public: if(n < m){ return -1; }else{ - Assert( n != m ); + Assert(n != m); return 1; } }else{ @@ -339,20 +335,17 @@ public: class Constant : public NodeWrapper { public: - Constant(Node n) : NodeWrapper(n) { - Assert(isMember(getNode())); - } + Constant(Node n) : NodeWrapper(n) { Assert(isMember(getNode())); } - static bool isMember(Node n) { - return n.getKind() == kind::CONST_RATIONAL; - } + static bool isMember(Node n) { return n.getKind() == kind::CONST_RATIONAL; } - bool isNormalForm() { return isMember(getNode()); } + bool isNormalForm() { return isMember(getNode()); } - static Constant mkConstant(Node n) { - Assert(n.getKind() == kind::CONST_RATIONAL); - return Constant(n); - } + static Constant mkConstant(Node n) + { + Assert(n.getKind() == kind::CONST_RATIONAL); + return Constant(n); + } static Constant mkConstant(const Rational& rat); @@ -597,8 +590,8 @@ private: Monomial(Node n, const Constant& c, const VarList& vl): NodeWrapper(n), constant(c), varList(vl) { - Assert(!c.isZero() || vl.empty() ); - Assert( c.isZero() || !vl.empty() ); + Assert(!c.isZero() || vl.empty()); + Assert(c.isZero() || !vl.empty()); Assert(!c.isOne() || !multStructured(n)); } @@ -623,15 +616,15 @@ private: Monomial(const VarList& vl): NodeWrapper(vl.getNode()), constant(Constant::mkConstant(1)), varList(vl) { - Assert( !varList.empty() ); + Assert(!varList.empty()); } Monomial(const Constant& c, const VarList& vl): NodeWrapper(makeMultNode(c,vl)), constant(c), varList(vl) { - Assert( !c.isZero() ); - Assert( !c.isOne() ); - Assert( !varList.empty() ); + Assert(!c.isZero()); + Assert(!c.isOne()); + Assert(!varList.empty()); Assert(multStructured(getNode())); } @@ -843,8 +836,8 @@ public: Polynomial(const std::vector<Monomial>& m): NodeWrapper(makePlusNode(m)), d_singleton(false) { - Assert( m.size() >= 2); - Assert( Monomial::isStrictlySorted(m) ); + Assert(m.size() >= 2); + Assert(Monomial::isStrictlySorted(m)); } static Polynomial mkPolynomial(const Constant& c){ @@ -901,7 +894,7 @@ public: } Polynomial getTail() const { - Assert(! singleton()); + Assert(!singleton()); iterator tailStart = begin(); ++tailStart; @@ -1097,14 +1090,9 @@ private: return NodeManager::currentNM()->mkNode(kind::PLUS, p.getNode(), c.getNode()); } - SumPair(TNode n) : - NodeWrapper(n) - { - Assert(isNormalForm()); - } - -public: + SumPair(TNode n) : NodeWrapper(n) { Assert(isNormalForm()); } + public: SumPair(const Polynomial& p): NodeWrapper(toNode(p, Constant::mkConstant(0))) { diff --git a/src/theory/arith/simplex.cpp b/src/theory/arith/simplex.cpp index 77872fb55..bf27af36a 100644 --- a/src/theory/arith/simplex.cpp +++ b/src/theory/arith/simplex.cpp @@ -57,8 +57,7 @@ SimplexDecisionProcedure::~SimplexDecisionProcedure(){ bool SimplexDecisionProcedure::standardProcessSignals(TimerStat &timer, IntStat& conflicts) { TimerStat::CodeTimer codeTimer(timer); - Assert( d_conflictVariables.empty() ); - + Assert(d_conflictVariables.empty()); while(d_errorSet.moreSignals()){ ArithVar curr = d_errorSet.topSignal(); @@ -99,7 +98,6 @@ void SimplexDecisionProcedure::reportConflict(ArithVar basic){ } ConstraintCP SimplexDecisionProcedure::generateConflictForBasic(ArithVar basic) const { - Assert(d_tableau.isBasic(basic)); Assert(checkBasicForConflict(basic)); @@ -198,7 +196,7 @@ ArithVar SimplexDecisionProcedure::constructInfeasiblityFunction(TimerStat& time TimerStat::CodeTimer codeTimer(timer); Assert(!d_errorSet.focusEmpty()); Assert(debugIsASet(set)); - + ArithVar inf = requestVariable(); Assert(inf != ARITHVAR_SENTINEL); diff --git a/src/theory/arith/simplex_update.h b/src/theory/arith/simplex_update.h index cfd00ac30..b1153d36f 100644 --- a/src/theory/arith/simplex_update.h +++ b/src/theory/arith/simplex_update.h @@ -257,7 +257,7 @@ public: /** Sets the focusDirection. */ void setFocusDirection(int fd){ - Assert(-1 <= fd && fd <= 1); + Assert(-1 <= fd && fd <= 1); d_focusDirection = fd; updateWitness(); } diff --git a/src/theory/arith/soi_simplex.cpp b/src/theory/arith/soi_simplex.cpp index e23273a09..e50d9d060 100644 --- a/src/theory/arith/soi_simplex.cpp +++ b/src/theory/arith/soi_simplex.cpp @@ -405,7 +405,8 @@ void SumOfInfeasibilitiesSPD::updateAndSignal(const UpdateInfo& selected, Witnes int prevFocusSgn = d_errorSet.popSignal(); if(d_tableau.isBasic(updated)){ - Assert(!d_variables.assignmentIsConsistent(updated) == d_errorSet.inError(updated)); + Assert(!d_variables.assignmentIsConsistent(updated) + == d_errorSet.inError(updated)); if(Debug.isOn("updateAndSignal")){debugPrintSignal(updated);} if(!d_variables.assignmentIsConsistent(updated)){ if(checkBasicForConflict(updated)){ @@ -642,7 +643,7 @@ std::vector< ArithVarVec > SumOfInfeasibilitiesSPD::greedyConflictSubsets(){ if(d_errorSize <= 2){ ArithVarVec inError; d_errorSet.pushFocusInto(inError); - + Assert(debugIsASet(inError)); subsets.push_back(inError); return subsets; @@ -712,7 +713,7 @@ std::vector< ArithVarVec > SumOfInfeasibilitiesSPD::greedyConflictSubsets(){ if(hasParticipated.isMember(v)){ continue; } hasParticipated.add(v); - + Assert(d_soiVar == ARITHVAR_SENTINEL); //d_soiVar's row = \sumofinfeasibilites underConstruction ArithVarVec underConstruction; @@ -770,7 +771,6 @@ std::vector< ArithVarVec > SumOfInfeasibilitiesSPD::greedyConflictSubsets(){ // } } - Assert(d_soiVar == ARITHVAR_SENTINEL); Debug("arith::greedyConflictSubsets") << "greedyConflictSubsets done" << endl; return subsets; @@ -781,7 +781,7 @@ bool SumOfInfeasibilitiesSPD::generateSOIConflict(const ArithVarVec& subset){ d_soiVar = constructInfeasiblityFunction(d_statistics.d_soiConflictMinimization, subset); Assert(!subset.empty()); Assert(!d_conflictBuilder->underConstruction()); - + Debug("arith::generateSOIConflict") << "SumOfInfeasibilitiesSPD::generateSOIConflict(...) start" << endl; bool success = false; @@ -791,7 +791,6 @@ bool SumOfInfeasibilitiesSPD::generateSOIConflict(const ArithVarVec& subset){ ConstraintP violated = d_errorSet.getViolated(e); Assert(violated != NullConstraint); - int sgn = d_errorSet.getSgn(e); const Rational& violatedCoeff = sgn > 0 ? d_negOne : d_posOne; Debug("arith::generateSOIConflict") << "basic error var: " @@ -815,7 +814,7 @@ bool SumOfInfeasibilitiesSPD::generateSOIConflict(const ArithVarVec& subset){ // pick a violated constraint arbitrarily. any of them may be selected for the conflict Assert(d_conflictBuilder->underConstruction()); Assert(d_conflictBuilder->consequentIsSet()); - + for(Tableau::RowIterator i = d_tableau.basicRowIterator(d_soiVar); !i.atEnd(); ++i){ const Tableau::Entry& entry = *i; ArithVar v = entry.getColVar(); @@ -864,7 +863,7 @@ WitnessImprovement SumOfInfeasibilitiesSPD::SOIConflict(){ generateSOIConflict(d_qeConflict); }else{ vector<ArithVarVec> subsets = greedyConflictSubsets(); - Assert( d_soiVar == ARITHVAR_SENTINEL); + Assert(d_soiVar == ARITHVAR_SENTINEL); bool anySuccess = false; Assert(!subsets.empty()); for(vector<ArithVarVec>::const_iterator i = subsets.begin(), end = subsets.end(); i != end; ++i){ @@ -879,7 +878,7 @@ WitnessImprovement SumOfInfeasibilitiesSPD::SOIConflict(){ } Assert(anySuccess); } - Assert( d_soiVar == ARITHVAR_SENTINEL); + Assert(d_soiVar == ARITHVAR_SENTINEL); d_soiVar = constructInfeasiblityFunction(d_statistics.d_soiConflictMinimization); //reportConflict(conf); do not do this. We need a custom explanations! @@ -965,7 +964,6 @@ Result::Sat SumOfInfeasibilitiesSPD::sumOfInfeasibilities(){ Assert(d_conflictVariables.empty()); Assert(d_soiVar == ARITHVAR_SENTINEL); - //d_scores.purge(); d_soiVar = constructInfeasiblityFunction(d_statistics.d_soiFocusConstructionTimer); diff --git a/src/theory/arith/tableau.cpp b/src/theory/arith/tableau.cpp index aa4c3d454..82b46bf30 100644 --- a/src/theory/arith/tableau.cpp +++ b/src/theory/arith/tableau.cpp @@ -102,7 +102,7 @@ void Tableau::addRow(ArithVar basic, { Assert(basic < getNumColumns()); Assert(debugIsASet(variables)); - Assert(coefficients.size() == variables.size() ); + Assert(coefficients.size() == variables.size()); Assert(!isBasic(basic)); RowIndex newRow = Matrix<Rational>::addRow(coefficients, variables); diff --git a/src/theory/arith/theory_arith_private.cpp b/src/theory/arith/theory_arith_private.cpp index c775a2611..62be1fcc1 100644 --- a/src/theory/arith/theory_arith_private.cpp +++ b/src/theory/arith/theory_arith_private.cpp @@ -691,7 +691,6 @@ bool TheoryArithPrivate::AssertLower(ConstraintP constraint){ Assert(constraint->isLowerBound()); Assert(constraint->isTrue()); Assert(!constraint->negationHasProof()); - ArithVar x_i = constraint->getVariable(); const DeltaRational& c_i = constraint->getValue(); @@ -733,7 +732,6 @@ bool TheoryArithPrivate::AssertLower(ConstraintP constraint){ const ValueCollection& vc = constraint->getValueCollection(); if(vc.hasEquality()){ - Assert(vc.hasDisequality()); ConstraintP eq = vc.getEquality(); ConstraintP diseq = vc.getDisequality(); @@ -828,7 +826,7 @@ bool TheoryArithPrivate::AssertUpper(ConstraintP constraint){ Assert(constraint->isUpperBound()); Assert(constraint->isTrue()); Assert(!constraint->negationHasProof()); - + ArithVar x_i = constraint->getVariable(); const DeltaRational& c_i = constraint->getValue(); @@ -1001,7 +999,6 @@ bool TheoryArithPrivate::AssertEquality(ConstraintP constraint){ Assert(cmpToLB >= 0); Assert(cmpToUB < 0 || cmpToLB > 0); - if(isInteger(x_i)){ d_constantIntegerVariables.push_back(x_i); Debug("dio::push") << "dio::push " << x_i << endl; @@ -1211,7 +1208,7 @@ Node TheoryArithPrivate::ppRewriteTerms(TNode n) { case kind::INTS_MODULUS: case kind::DIVISION: // these should be removed during expand definitions - Assert( false ); + Assert(false); break; case kind::INTS_DIVISION_TOTAL: @@ -1433,8 +1430,8 @@ ArithVar TheoryArithPrivate::findShortestBasicRow(ArithVar variable){ bestRowLength = rowLength; } } - Assert(bestBasic == ARITHVAR_SENTINEL || - bestRowLength < std::numeric_limits<uint32_t>::max()); + Assert(bestBasic == ARITHVAR_SENTINEL + || bestRowLength < std::numeric_limits<uint32_t>::max()); return bestBasic; } @@ -1528,7 +1525,8 @@ void TheoryArithPrivate::setupDivLike(const Variable& v){ } Node vnode = v.getNode(); - Assert(isSetup(vnode)); // Otherwise there is some invariant breaking recursion + Assert( + isSetup(vnode)); // Otherwise there is some invariant breaking recursion Polynomial m = Polynomial::parsePolynomial(vnode[0]); Polynomial n = Polynomial::parsePolynomial(vnode[1]); @@ -1541,7 +1539,7 @@ void TheoryArithPrivate::setupDivLike(const Variable& v){ case INTS_DIVISION: case INTS_MODULUS: // these should be removed during expand definitions - Assert( false ); + Assert(false); break; case DIVISION_TOTAL: lem = axiomIteForTotalDivision(vnode); @@ -1743,7 +1741,7 @@ ArithVar TheoryArithPrivate::requestArithVar(TNode x, bool aux, bool internal){ throw LogicException(ss.str()); } Assert(!d_partialModel.hasArithVar(x)); - Assert(x.getType().isReal()); // real or integer + Assert(x.getType().isReal()); // real or integer ArithVar max = d_partialModel.getNumberOfVariables(); ArithVar varX = d_partialModel.allocate(x, aux); @@ -1897,7 +1895,6 @@ Node TheoryArithPrivate::callDioSolver(){ Assert(isInteger(v)); Assert(d_partialModel.boundsAreEqual(v)); - ConstraintP lb = d_partialModel.getLowerBoundConstraint(v); ConstraintP ub = d_partialModel.getUpperBoundConstraint(v); @@ -1937,7 +1934,7 @@ ConstraintP TheoryArithPrivate::constraintFromFactQueue(){ Kind simpleKind = Comparison::comparisonKind(assertion); ConstraintP constraint = d_constraintDatabase.lookup(assertion); if(constraint == NullConstraint){ - Assert(simpleKind == EQUAL || simpleKind == DISTINCT ); + Assert(simpleKind == EQUAL || simpleKind == DISTINCT); bool isDistinct = simpleKind == DISTINCT; Node eq = (simpleKind == DISTINCT) ? assertion[0] : assertion; Assert(!isSetup(eq)); @@ -1945,8 +1942,8 @@ ConstraintP TheoryArithPrivate::constraintFromFactQueue(){ if(reEq.getKind() == CONST_BOOLEAN){ if(reEq.getConst<bool>() == isDistinct){ // if is (not true), or false - Assert((reEq.getConst<bool>() && isDistinct) || - (!reEq.getConst<bool>() && !isDistinct)); + Assert((reEq.getConst<bool>() && isDistinct) + || (!reEq.getConst<bool>() && !isDistinct)); raiseBlackBoxConflict(assertion); } return NullConstraint; @@ -2209,7 +2206,8 @@ void TheoryArithPrivate::outputLemma(TNode lem) { // void TheoryArithPrivate::branchVector(const std::vector<ArithVar>& lemmas){ // //output the lemmas -// for(vector<ArithVar>::const_iterator i = lemmas.begin(); i != lemmas.end(); ++i){ +// for(vector<ArithVar>::const_iterator i = lemmas.begin(); i != lemmas.end(); +// ++i){ // ArithVar v = *i; // Assert(!d_cutInContext.contains(v)); // d_cutInContext.insert(v); @@ -2343,7 +2341,7 @@ std::pair<ConstraintP, ArithVar> TheoryArithPrivate::replayGetConstraint(const D << " " << rhs << endl; - Assert( k == kind::LEQ || k == kind::GEQ ); + Assert(k == kind::LEQ || k == kind::GEQ); Node comparison = NodeManager::currentNM()->mkNode(k, sum, mkRationalNode(rhs)); Node rewritten = Rewriter::rewrite(comparison); @@ -2508,7 +2506,7 @@ void TheoryArithPrivate::tryBranchCut(ApproximateSimplex* approx, int nid, Branc pair<ConstraintP, ArithVar> p = replayGetConstraint(bci); Assert(p.second == ARITHVAR_SENTINEL); ConstraintP bc = p.first; - Assert(bc != NullConstraint); + Assert(bc != NullConstraint); if(bc->hasProof()){ return; } @@ -2538,7 +2536,7 @@ void TheoryArithPrivate::tryBranchCut(ApproximateSimplex* approx, int nid, Branc conflicts.push_back(ConstraintCPVec()); intHoleConflictToVector(d_conflicts[i], conflicts.back()); Constraint::assertionFringe(conflicts.back()); - + // ConstraintCP conflicting = d_conflicts[i]; // ConstraintCP negConflicting = conflicting->getNegation(); // Assert(conflicting->hasProof()); @@ -2891,7 +2889,6 @@ std::vector<ConstraintCPVec> TheoryArithPrivate::replayLogRec(ApproximateSimplex } Assert(d_acTmp.empty()); - /* Garbage collect the constraints from this call */ while(d_replayConstraints.size() > rpcons_size){ ConstraintP c = d_replayConstraints.back(); @@ -3165,11 +3162,12 @@ void TheoryArithPrivate::solveInteger(Theory::Effort effortLevel){ if(mipRes == MipClosed){ d_likelyIntegerInfeasible = true; replayLog(approx); - AlwaysAssert(anyConflict() || d_qflraStatus != Result::SAT); + AlwaysAssert(anyConflict() || d_qflraStatus != Result::SAT); - if(!anyConflict()){ - solveRealRelaxation(effortLevel); - } + if (!anyConflict()) + { + solveRealRelaxation(effortLevel); + } } if(!(anyConflict() || !d_approxCuts.empty())){ turnOffApproxFor(options::replayNumericFailurePenalty()); @@ -3749,8 +3747,8 @@ void TheoryArithPrivate::check(Theory::Effort effortLevel){ d_currentPropagationList.pop_front(); ConstraintType t = curr->getType(); - Assert(t != Disequality, "Disequalities are not allowed in d_currentPropagation"); - + Assert(t != Disequality) + << "Disequalities are not allowed in d_currentPropagation"; switch(t){ case LowerBound: @@ -3776,8 +3774,7 @@ void TheoryArithPrivate::check(Theory::Effort effortLevel){ d_constraintDatabase.unatePropEquality(curr, prevLB, prevUB); break; } - default: - Unhandled(curr->getType()); + default: Unhandled() << curr->getType(); } } @@ -3796,7 +3793,7 @@ void TheoryArithPrivate::check(Theory::Effort effortLevel){ TimerStat::CodeTimer codeTimer(d_statistics.d_newPropTime); d_currentPropagationList.clear(); } - Assert( d_currentPropagationList.empty()); + Assert(d_currentPropagationList.empty()); Debug("arith::ems") << "ems: " << emmittedConflictOrSplit << "post unate" << endl; @@ -3903,7 +3900,7 @@ Node TheoryArithPrivate::branchIntegerVariable(ArithVar x) const { const Rational& i = d.getInfinitesimalPart(); Trace("integers") << "integers: assignment to [[" << d_partialModel.asNode(x) << "]] is " << r << "[" << i << "]" << endl; - Assert(! (r.getDenominator() == 1 && i.getNumerator() == 0)); + Assert(!(r.getDenominator() == 1 && i.getNumerator() == 0)); Assert(!d.isIntegral()); TNode var = d_partialModel.asNode(x); Integer floor_d = d.floor(); @@ -4134,7 +4131,9 @@ void TheoryArithPrivate::propagate(Theory::Effort e) { Debug("arith::prop") << c->getNegation()->externalExplainByAssertions() << endl; } - Assert(!c->negationHasProof(), "A constraint has been propagated on the constraint propagation queue, but the negation has been set to true. Contact Tim now!"); + Assert(!c->negationHasProof()) + << "A constraint has been propagated on the constraint propagation " + "queue, but the negation has been set to true. Contact Tim now!"; if(!c->assertedToTheTheory()){ Node literal = c->getLiteral(); @@ -4302,7 +4301,7 @@ Rational TheoryArithPrivate::deltaValueForTotalOrder() const{ bool TheoryArithPrivate::collectModelInfo(TheoryModel* m) { - AlwaysAssert(d_qflraStatus == Result::SAT); + AlwaysAssert(d_qflraStatus == Result::SAT); //AlwaysAssert(!d_nlIncomplete, "Arithmetic solver cannot currently produce models for input with nonlinear arithmetic constraints"); if(Debug.isOn("arith::collectModelInfo")){ @@ -4463,8 +4462,7 @@ void TheoryArithPrivate::presolve(){ d_constraintDatabase.outputUnateInequalityLemmas(lemmas); d_constraintDatabase.outputUnateEqualityLemmas(lemmas); break; - default: - Unhandled(options::arithUnateLemmaMode()); + default: Unhandled() << options::arithUnateLemmaMode(); } } @@ -4525,10 +4523,14 @@ bool TheoryArithPrivate::propagateCandidateBound(ArithVar basic, bool upperBound if(bestImplied != NullConstraint){ //This should be stronger Assert(!upperBound || bound <= bestImplied->getValue()); - Assert(!upperBound || d_partialModel.lessThanUpperBound(basic, bestImplied->getValue())); - - Assert( upperBound || bound >= bestImplied->getValue()); - Assert( upperBound || d_partialModel.greaterThanLowerBound(basic, bestImplied->getValue())); + Assert( + !upperBound + || d_partialModel.lessThanUpperBound(basic, bestImplied->getValue())); + + Assert(upperBound || bound >= bestImplied->getValue()); + Assert(upperBound + || d_partialModel.greaterThanLowerBound(basic, + bestImplied->getValue())); //slightly changed // ConstraintP c = d_constraintDatabase.lookup(bestImplied); @@ -5152,7 +5154,8 @@ Node TheoryArithPrivate::getArithSkolemApp(LogicRequest& logicRequest, return skolem; } -// InferBoundsResult TheoryArithPrivate::inferBound(TNode term, const InferBoundsParameters& param){ +// InferBoundsResult TheoryArithPrivate::inferBound(TNode term, const +// InferBoundsParameters& param){ // Node t = Rewriter::rewrite(term); // Assert(Polynomial::isMember(t)); // Polynomial p = Polynomial::parsePolynomial(t); @@ -5168,8 +5171,8 @@ Node TheoryArithPrivate::getArithSkolemApp(LogicRequest& logicRequest, // if(res.foundBound()){ // DeltaRational newBound = res.getValue() + c.getValue(); // if(tail.isIntegral()){ -// Integer asInt = (param.findLowerBound()) ? newBound.ceiling() : newBound.floor(); -// newBound = DeltaRational(asInt); +// Integer asInt = (param.findLowerBound()) ? newBound.ceiling() : +// newBound.floor(); newBound = DeltaRational(asInt); // } // res.setBound(newBound, res.getExplanation()); // } @@ -5202,14 +5205,16 @@ Node TheoryArithPrivate::getArithSkolemApp(LogicRequest& logicRequest, // { // InferBoundsResult lookup = inferUpperBoundLookup(t, param); // if(lookup.foundBound()){ -// if(param.getEffort() == InferBoundsParameters::LookupAndSimplexOnFailure || +// if(param.getEffort() == +// InferBoundsParameters::LookupAndSimplexOnFailure || // lookup.boundIsOptimal()){ // return lookup; // } // } // InferBoundsResult simplex = inferUpperBoundSimplex(t, param); // if(lookup.foundBound() && simplex.foundBound()){ -// return (lookup.getValue() <= simplex.getValue()) ? lookup : simplex; +// return (lookup.getValue() <= simplex.getValue()) ? lookup : +// simplex; // }else if(lookup.foundBound()){ // return lookup; // }else{ @@ -5223,7 +5228,6 @@ Node TheoryArithPrivate::getArithSkolemApp(LogicRequest& logicRequest, // } // } - std::pair<bool, Node> TheoryArithPrivate::entailmentCheck(TNode lit, const ArithEntailmentCheckParameters& params, ArithEntailmentCheckSideEffects& out){ using namespace inferbounds; @@ -5351,7 +5355,8 @@ std::pair<bool, Node> TheoryArithPrivate::entailmentCheck(TNode lit, const Arith << " <= " << primDir << "*" << dm << "*" << bestPrimDiff.second << " <= " << primDir << "*" << sep << endl << " by " << bestPrimDiff.first << endl; - Assert(bestPrimDiff.second * (Rational(primDir)* dm) <= (sep * Rational(primDir))); + Assert(bestPrimDiff.second * (Rational(primDir) * dm) + <= (sep * Rational(primDir))); return make_pair(true, bestPrimDiff.first); } } @@ -5842,7 +5847,8 @@ std::pair<Node, DeltaRational> TheoryArithPrivate::entailmentCheckSimplex(int sg } } -// InferBoundsResult TheoryArithPrivate::inferUpperBoundSimplex(TNode t, const inferbounds::InferBoundAlgorithm& param){ +// InferBoundsResult TheoryArithPrivate::inferUpperBoundSimplex(TNode t, const +// inferbounds::InferBoundAlgorithm& param){ // Assert(param.findUpperBound()); // if(!(d_qflraStatus == Result::SAT && d_errorSet.noSignals())){ @@ -5907,7 +5913,8 @@ std::pair<Node, DeltaRational> TheoryArithPrivate::entailmentCheckSimplex(int sg // // TODO improve upon bland's // ArithVar entering = ARITHVAR_SENTINEL; // const Tableau::Entry* enteringEntry = NULL; -// for(Tableau::RowIterator ri = d_tableau.ridRowIterator(ridx); !ri.atEnd(); ++ri){ +// for(Tableau::RowIterator ri = d_tableau.ridRowIterator(ridx); +// !ri.atEnd(); ++ri){ // const Tableau::Entry& entry = *ri; // ArithVar v = entry.getColVar(); // if(v != optVar){ @@ -5975,7 +5982,6 @@ std::pair<Node, DeltaRational> TheoryArithPrivate::entailmentCheckSimplex(int sg // } // } - // if(leaving == ARITHVAR_SENTINEL){ // finalState = NoBound; // break; @@ -6003,7 +6009,8 @@ std::pair<Node, DeltaRational> TheoryArithPrivate::entailmentCheckSimplex(int sg // case Inferred: // { // NodeBuilder<> nb(kind::AND); -// for(Tableau::RowIterator ri = d_tableau.ridRowIterator(ridx); !ri.atEnd(); ++ri){ +// for(Tableau::RowIterator ri = d_tableau.ridRowIterator(ridx); +// !ri.atEnd(); ++ri){ // const Tableau::Entry& e =*ri; // ArithVar colVar = e.getColVar(); // if(colVar != optVar){ diff --git a/src/theory/arith/type_enumerator.h b/src/theory/arith/type_enumerator.h index 5c6bf63ce..bb1612928 100644 --- a/src/theory/arith/type_enumerator.h +++ b/src/theory/arith/type_enumerator.h @@ -36,8 +36,8 @@ class RationalEnumerator : public TypeEnumeratorBase<RationalEnumerator> { RationalEnumerator(TypeNode type, TypeEnumeratorProperties* tep = nullptr) : TypeEnumeratorBase<RationalEnumerator>(type), d_rat(0) { - Assert(type.getKind() == kind::TYPE_CONSTANT && - type.getConst<TypeConstant>() == REAL_TYPE); + Assert(type.getKind() == kind::TYPE_CONSTANT + && type.getConst<TypeConstant>() == REAL_TYPE); } Node operator*() override { return NodeManager::currentNM()->mkConst(d_rat); } @@ -77,8 +77,8 @@ class IntegerEnumerator : public TypeEnumeratorBase<IntegerEnumerator> { IntegerEnumerator(TypeNode type, TypeEnumeratorProperties* tep = nullptr) : TypeEnumeratorBase<IntegerEnumerator>(type), d_int(0) { - Assert(type.getKind() == kind::TYPE_CONSTANT && - type.getConst<TypeConstant>() == INTEGER_TYPE); + Assert(type.getKind() == kind::TYPE_CONSTANT + && type.getConst<TypeConstant>() == INTEGER_TYPE); } Node operator*() override diff --git a/src/theory/arrays/array_info.cpp b/src/theory/arrays/array_info.cpp index 0d1095a23..3103f4ecc 100644 --- a/src/theory/arrays/array_info.cpp +++ b/src/theory/arrays/array_info.cpp @@ -134,7 +134,7 @@ void ArrayInfo::mergeLists(CTNodeList* la, const CTNodeList* lb) const{ void ArrayInfo::addIndex(const Node a, const TNode i) { Assert(a.getType().isArray()); - Assert(!i.getType().isArray()); // temporary for flat arrays + Assert(!i.getType().isArray()); // temporary for flat arrays Trace("arrays-ind")<<"Arrays::addIndex "<<a<<"["<<i<<"]\n"; CTNodeList* temp_indices; @@ -160,7 +160,7 @@ void ArrayInfo::addIndex(const Node a, const TNode i) { void ArrayInfo::addStore(const Node a, const TNode st){ Assert(a.getType().isArray()); - Assert(st.getKind()== kind::STORE); // temporary for flat arrays + Assert(st.getKind() == kind::STORE); // temporary for flat arrays CTNodeList* temp_store; Info* temp_info; diff --git a/src/theory/arrays/array_info.h b/src/theory/arrays/array_info.h index 7e18f9ed2..982317350 100644 --- a/src/theory/arrays/array_info.h +++ b/src/theory/arrays/array_info.h @@ -78,7 +78,7 @@ public: * prints the information */ void print() const { - Assert(indices != NULL && stores!= NULL && in_stores != NULL); + Assert(indices != NULL && stores != NULL && in_stores != NULL); Trace("arrays-info")<<" indices "; printList(indices); Trace("arrays-info")<<" stores "; diff --git a/src/theory/arrays/static_fact_manager.cpp b/src/theory/arrays/static_fact_manager.cpp index 63dfae173..546db649c 100644 --- a/src/theory/arrays/static_fact_manager.cpp +++ b/src/theory/arrays/static_fact_manager.cpp @@ -18,7 +18,7 @@ #include <iostream> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "expr/node.h" #include "theory/arrays/static_fact_manager.h" @@ -97,7 +97,8 @@ void StaticFactManager::addEq(TNode eq) { // CNodeTNodesMap::iterator deq_ib = d_disequalities.find(b); // if(deq_ib != d_disequalities.end()) { // CTNodeListAlloc* deq = (*deq_ib).second; - // for(CTNodeListAlloc::const_iterator j = deq->begin(); j!=deq->end(); j++) { + // for(CTNodeListAlloc::const_iterator j = deq->begin(); j!=deq->end(); + // j++) { // TNode deqn = *j; // TNode s = deqn[0]; // TNode t = deqn[1]; @@ -120,12 +121,11 @@ void StaticFactManager::addEq(TNode eq) { // */ // CTNodeListAlloc* deqa = (*deq_ia).second; - // for(CTNodeListAlloc::const_iterator i = deqa->begin(); i!= deqa->end(); i++) { + // for(CTNodeListAlloc::const_iterator i = deqa->begin(); i!= deqa->end(); + // i++) { // TNode deqn = (*i); - // Assert(deqn.getKind() == kind::EQUAL || deqn.getKind() == kind::IFF); - // TNode s = deqn[0]; - // TNode t = deqn[1]; - // TNode sp = find(s); + // Assert(deqn.getKind() == kind::EQUAL || deqn.getKind() == + // kind::IFF); TNode s = deqn[0]; TNode t = deqn[1]; TNode sp = find(s); // TNode tp = find(t); // if(find(s) == find(t)) { diff --git a/src/theory/arrays/theory_arrays.cpp b/src/theory/arrays/theory_arrays.cpp index 003bb0d68..f2beec0b8 100644 --- a/src/theory/arrays/theory_arrays.cpp +++ b/src/theory/arrays/theory_arrays.cpp @@ -189,7 +189,8 @@ void TheoryArrays::setMasterEqualityEngine(eq::EqualityEngine* eq) { bool TheoryArrays::ppDisequal(TNode a, TNode b) { bool termsExist = d_ppEqualityEngine.hasTerm(a) && d_ppEqualityEngine.hasTerm(b); - Assert(!termsExist || !a.isConst() || !b.isConst() || a == b || d_ppEqualityEngine.areDisequal(a, b, false)); + Assert(!termsExist || !a.isConst() || !b.isConst() || a == b + || d_ppEqualityEngine.areDisequal(a, b, false)); return ((termsExist && d_ppEqualityEngine.areDisequal(a, b, false)) || Rewriter::rewrite(a.eqNode(b)) == d_false); } @@ -621,14 +622,17 @@ void TheoryArrays::checkWeakEquiv(bool arraysMerged) { Assert(pointer.isNull() == (weakEquivGetRep(n) == n)); Assert(!pointer.isNull() || secondary.isNull()); Assert(!index.isNull() || secondary.isNull()); - Assert(d_infoMap.getWeakEquivSecondaryReason(n).isNull() || !secondary.isNull()); + Assert(d_infoMap.getWeakEquivSecondaryReason(n).isNull() + || !secondary.isNull()); if (!pointer.isNull()) { if (index.isNull()) { Assert(d_equalityEngine.areEqual(n, pointer)); } else { - Assert((n.getKind() == kind::STORE && n[0] == pointer && n[1] == index) || - (pointer.getKind() == kind::STORE && pointer[0] == n && pointer[1] == index)); + Assert( + (n.getKind() == kind::STORE && n[0] == pointer && n[1] == index) + || (pointer.getKind() == kind::STORE && pointer[0] == n + && pointer[1] == index)); } } } @@ -694,7 +698,7 @@ void TheoryArrays::preRegisterTermInternal(TNode node) TNode s = *it; if (!d_infoMap.rIntro1Applied(s)) { d_infoMap.setRIntro1Applied(s); - Assert(s.getKind()==kind::STORE); + Assert(s.getKind() == kind::STORE); Node ni = nm->mkNode(kind::SELECT, s, s[1]); if (ni != node) { preRegisterTermInternal(ni); @@ -823,7 +827,8 @@ void TheoryArrays::preRegisterTermInternal(TNode node) } // Invariant: preregistered terms are exactly the terms in the equality engine // Disabled, see comment above for kind::EQUAL - // Assert(d_equalityEngine.hasTerm(node) || !d_equalityEngine.consistent()); + // Assert(d_equalityEngine.hasTerm(node) || + // !d_equalityEngine.consistent()); } @@ -915,7 +920,8 @@ void TheoryArrays::checkPair(TNode r1, TNode r2) if (r1[0] != r2[0]) { // If arrays are known to be disequal, or cannot become equal, we can continue - Assert(d_mayEqualEqualityEngine.hasTerm(r1[0]) && d_mayEqualEqualityEngine.hasTerm(r2[0])); + Assert(d_mayEqualEqualityEngine.hasTerm(r1[0]) + && d_mayEqualEqualityEngine.hasTerm(r2[0])); if (r1[0].getType() != r2[0].getType() || d_equalityEngine.areDisequal(r1[0], r2[0], false)) { Debug("arrays::sharing") << "TheoryArrays::computeCareGraph(): arrays can't be equal, skipping" << std::endl; @@ -976,7 +982,8 @@ void TheoryArrays::computeCareGraph() if (eqStatusArr != EQUALITY_UNKNOWN) { continue; } - Assert(d_valuation.getEqualityStatus((*it1), (*it2)) == EQUALITY_UNKNOWN); + Assert(d_valuation.getEqualityStatus((*it1), (*it2)) + == EQUALITY_UNKNOWN); addCarePair((*it1), (*it2)); ++d_numSharedArrayVarSplits; return; @@ -1133,7 +1140,7 @@ bool TheoryArrays::collectModelInfo(TheoryModel* m) size_t it = 0; for(; it < instores->size(); ++it) { TNode instore = (*instores)[it]; - Assert(instore.getKind()==kind::STORE); + Assert(instore.getKind() == kind::STORE); if (termSet.find(instore) != termSet.end() && !d_equalityEngine.areEqual(instore[1],n[1])) { Node r = nm->mkNode(kind::SELECT, instore, n[1]); @@ -1203,7 +1210,8 @@ bool TheoryArrays::collectModelInfo(TheoryModel* m) TypeNode valueType = nrep.getType().getArrayConstituentType(); rep = defaultValuesSet.nextTypeEnum(valueType); if (rep.isNull()) { - Assert(defaultValuesSet.getSet(valueType)->begin() != defaultValuesSet.getSet(valueType)->end()); + Assert(defaultValuesSet.getSet(valueType)->begin() + != defaultValuesSet.getSet(valueType)->end()); rep = *(defaultValuesSet.getSet(valueType)->begin()); } Trace("arrays-models") << "New default value = " << rep << endl; @@ -1558,7 +1566,8 @@ Node TheoryArrays::mkAnd(std::vector<TNode>& conjunctions, bool invert, unsigned explained.insert(t); } else { // EXT lemma - Assert(t[1].getKind() == kind::NOT && t[1][0].getKind() == kind::EQUAL); + Assert(t[1].getKind() == kind::NOT + && t[1][0].getKind() == kind::EQUAL); Assert(t[0].getKind() == kind::EQUAL); all.insert(t[0].notNode()); explained.insert(t); @@ -1618,7 +1627,7 @@ void TheoryArrays::setNonLinear(TNode a) // Propagate non-linearity down chain of stores for( ; it < st_a->size(); ++it) { TNode store = (*st_a)[it]; - Assert(store.getKind()==kind::STORE); + Assert(store.getKind() == kind::STORE); setNonLinear(store[0]); } @@ -1847,7 +1856,7 @@ void TheoryArrays::checkStore(TNode a) { d_infoMap.getInfo(a)->print(); } Assert(a.getType().isArray()); - Assert(a.getKind()==kind::STORE); + Assert(a.getKind() == kind::STORE); TNode b = a[0]; TNode i = a[1]; @@ -1898,7 +1907,7 @@ void TheoryArrays::checkRowForIndex(TNode i, TNode a) for(; it < stores->size(); ++it) { TNode store = (*stores)[it]; - Assert(store.getKind()==kind::STORE); + Assert(store.getKind() == kind::STORE); TNode j = store[1]; if (i == j) continue; lem = std::make_tuple(store, store[0], j, i); @@ -1910,7 +1919,7 @@ void TheoryArrays::checkRowForIndex(TNode i, TNode a) it = 0; for(; it < instores->size(); ++it) { TNode instore = (*instores)[it]; - Assert(instore.getKind()==kind::STORE); + Assert(instore.getKind() == kind::STORE); TNode j = instore[1]; if (i == j) continue; lem = std::make_tuple(instore, instore[0], j, i); diff --git a/src/theory/arrays/theory_arrays_type_rules.h b/src/theory/arrays/theory_arrays_type_rules.h index 78756176d..223d742eb 100644 --- a/src/theory/arrays/theory_arrays_type_rules.h +++ b/src/theory/arrays/theory_arrays_type_rules.h @@ -218,7 +218,8 @@ struct ArraysProperties { struct ArrayPartialSelectTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::PARTIAL_SELECT_0 || n.getKind() == kind::PARTIAL_SELECT_1); + Assert(n.getKind() == kind::PARTIAL_SELECT_0 + || n.getKind() == kind::PARTIAL_SELECT_1); return nodeManager->integerType(); } };/* struct ArrayPartialSelectTypeRule */ diff --git a/src/theory/arrays/union_find.cpp b/src/theory/arrays/union_find.cpp index af2cf3c3f..0afa94a8e 100644 --- a/src/theory/arrays/union_find.cpp +++ b/src/theory/arrays/union_find.cpp @@ -18,7 +18,6 @@ #include <iostream> -#include "base/cvc4_assert.h" #include "expr/node.h" #include "theory/arrays/union_find.h" diff --git a/src/theory/booleans/circuit_propagator.cpp b/src/theory/booleans/circuit_propagator.cpp index 150403b67..f9631c94d 100644 --- a/src/theory/booleans/circuit_propagator.cpp +++ b/src/theory/booleans/circuit_propagator.cpp @@ -138,7 +138,7 @@ void CircuitPropagator::propagateBackward(TNode parent, bool parentAssignment) { } break; case kind::EQUAL: - Assert( parent[0].getType().isBoolean() ); + Assert(parent[0].getType().isBoolean()); if (parentAssignment) { // IFF x y = TRUE: if x [resp y] is assigned, assign(y = x.assignment [resp x = y.assignment]) if (isAssigned(parent[0])) { @@ -289,7 +289,7 @@ void CircuitPropagator::propagateForward(TNode child, bool childAssignment) { } break; case kind::EQUAL: - Assert( parent[0].getType().isBoolean() ); + Assert(parent[0].getType().isBoolean()); if (isAssigned(parent[0]) && isAssigned(parent[1])) { // IFF x y: if x or y is assigned, assign(IFF = (x.assignment <=> y.assignment)) assignAndEnqueue(parent, getAssignment(parent[0]) == getAssignment(parent[1])); diff --git a/src/theory/booleans/type_enumerator.h b/src/theory/booleans/type_enumerator.h index 361216b10..b0bae3e47 100644 --- a/src/theory/booleans/type_enumerator.h +++ b/src/theory/booleans/type_enumerator.h @@ -34,8 +34,8 @@ class BooleanEnumerator : public TypeEnumeratorBase<BooleanEnumerator> { BooleanEnumerator(TypeNode type, TypeEnumeratorProperties* tep = nullptr) : TypeEnumeratorBase<BooleanEnumerator>(type), d_value(FALSE) { - Assert(type.getKind() == kind::TYPE_CONSTANT && - type.getConst<TypeConstant>() == BOOLEAN_TYPE); + Assert(type.getKind() == kind::TYPE_CONSTANT + && type.getConst<TypeConstant>() == BOOLEAN_TYPE); } Node operator*() override { diff --git a/src/theory/builtin/theory_builtin_rewriter.cpp b/src/theory/builtin/theory_builtin_rewriter.cpp index 63d08b0ef..d483bf994 100644 --- a/src/theory/builtin/theory_builtin_rewriter.cpp +++ b/src/theory/builtin/theory_builtin_rewriter.cpp @@ -28,7 +28,6 @@ namespace theory { namespace builtin { Node TheoryBuiltinRewriter::blastDistinct(TNode in) { - Assert(in.getKind() == kind::DISTINCT); if(in.getNumChildren() == 2) { @@ -54,7 +53,6 @@ Node TheoryBuiltinRewriter::blastDistinct(TNode in) { } Node TheoryBuiltinRewriter::blastChain(TNode in) { - Assert(in.getKind() == kind::CHAIN); Kind chainedOp = in.getOperator().getConst<Chain>().getOperator(); @@ -77,7 +75,7 @@ RewriteResponse TheoryBuiltinRewriter::postRewrite(TNode node) { Trace("builtin-rewrite") << "Rewriting lambda " << node << "..." << std::endl; Node anode = getArrayRepresentationForLambda( node ); if( !anode.isNull() ){ - Assert( anode.getType().isArray() ); + Assert(anode.getType().isArray()); //must get the standard bound variable list Node varList = NodeManager::currentNM()->getBoundVarListForFunctionType( node.getType() ); Node retNode = getLambdaForArrayRepresentation( anode, varList ); @@ -86,8 +84,8 @@ RewriteResponse TheoryBuiltinRewriter::postRewrite(TNode node) { Trace("builtin-rewrite") << " input : " << node << std::endl; Trace("builtin-rewrite") << " output : " << retNode << ", constant = " << retNode.isConst() << std::endl; Trace("builtin-rewrite") << " array rep : " << anode << ", constant = " << anode.isConst() << std::endl; - Assert( anode.isConst()==retNode.isConst() ); - Assert( retNode.getType()==node.getType() ); + Assert(anode.isConst() == retNode.isConst()); + Assert(retNode.getType() == node.getType()); Assert(expr::hasFreeVar(node) == expr::hasFreeVar(retNode)); return RewriteResponse(REWRITE_DONE, retNode); } @@ -148,7 +146,7 @@ Node TheoryBuiltinRewriter::getLambdaForArrayRepresentationRec( TNode a, TNode b if( it==visited.end() ){ Node ret; if( bvlIndex<bvl.getNumChildren() ){ - Assert( a.getType().isArray() ); + Assert(a.getType().isArray()); if( a.getKind()==kind::STORE ){ // convert the array recursively Node body = getLambdaForArrayRepresentationRec( a[0], bvl, bvlIndex, visited ); @@ -156,8 +154,11 @@ Node TheoryBuiltinRewriter::getLambdaForArrayRepresentationRec( TNode a, TNode b // convert the value recursively (bounded by the number of arguments in bvl) Node val = getLambdaForArrayRepresentationRec( a[2], bvl, bvlIndex+1, visited ); if( !val.isNull() ){ - Assert( !TypeNode::leastCommonTypeNode( a[1].getType(), bvl[bvlIndex].getType() ).isNull() ); - Assert( !TypeNode::leastCommonTypeNode( val.getType(), body.getType() ).isNull() ); + Assert(!TypeNode::leastCommonTypeNode(a[1].getType(), + bvl[bvlIndex].getType()) + .isNull()); + Assert(!TypeNode::leastCommonTypeNode(val.getType(), body.getType()) + .isNull()); Node cond = bvl[bvlIndex].eqNode( a[1] ); ret = NodeManager::currentNM()->mkNode( kind::ITE, cond, val, body ); } @@ -179,7 +180,7 @@ Node TheoryBuiltinRewriter::getLambdaForArrayRepresentationRec( TNode a, TNode b } Node TheoryBuiltinRewriter::getLambdaForArrayRepresentation( TNode a, TNode bvl ){ - Assert( a.getType().isArray() ); + Assert(a.getType().isArray()); std::unordered_map< TNode, Node, TNodeHashFunction > visited; Trace("builtin-rewrite-debug") << "Get lambda for : " << a << ", with variables " << bvl << std::endl; Node body = getLambdaForArrayRepresentationRec( a, bvl, 0, visited ); @@ -196,7 +197,7 @@ Node TheoryBuiltinRewriter::getLambdaForArrayRepresentation( TNode a, TNode bvl Node TheoryBuiltinRewriter::getArrayRepresentationForLambdaRec(TNode n, TypeNode retType) { - Assert( n.getKind()==kind::LAMBDA ); + Assert(n.getKind() == kind::LAMBDA); NodeManager* nm = NodeManager::currentNM(); Trace("builtin-rewrite-debug") << "Get array representation for : " << n << std::endl; @@ -343,14 +344,14 @@ Node TheoryBuiltinRewriter::getArrayRepresentationForLambdaRec(TNode n, array_type = NodeManager::currentNM()->mkArrayType( n[0][index].getType(), array_type ); } Trace("builtin-rewrite-debug2") << " make array store all " << curr.getType() << " annotated : " << array_type << std::endl; - Assert( curr.getType().isSubtypeOf( array_type.getArrayConstituentType() ) ); + Assert(curr.getType().isSubtypeOf(array_type.getArrayConstituentType())); curr = NodeManager::currentNM()->mkConst(ArrayStoreAll(((ArrayType)array_type.toType()), curr.toExpr())); Trace("builtin-rewrite-debug2") << " build array..." << std::endl; // can only build if default value is constant (since array store all must be constant) Trace("builtin-rewrite-debug2") << " got constant base " << curr << std::endl; // construct store chain for( int i=((int)conds.size()-1); i>=0; i-- ){ - Assert( conds[i].getType().isSubtypeOf( first_arg.getType() ) ); + Assert(conds[i].getType().isSubtypeOf(first_arg.getType())); curr = NodeManager::currentNM()->mkNode( kind::STORE, curr, conds[i], vals[i] ); } Trace("builtin-rewrite-debug") << "...got array " << curr << " for " << n << std::endl; @@ -363,7 +364,7 @@ Node TheoryBuiltinRewriter::getArrayRepresentationForLambdaRec(TNode n, Node TheoryBuiltinRewriter::getArrayRepresentationForLambda(TNode n) { - Assert( n.getKind()==kind::LAMBDA ); + Assert(n.getKind() == kind::LAMBDA); // must carry the overall return type to deal with cases like (lambda ((x Int)(y Int)) (ite (= x _) 0.5 0.0)), // where the inner construction for the else case about should be (arraystoreall (Array Int Real) 0.0) Node anode = getArrayRepresentationForLambdaRec(n, n[1].getType()); diff --git a/src/theory/builtin/theory_builtin_type_rules.h b/src/theory/builtin/theory_builtin_type_rules.h index db427d21e..96e2e7e6f 100644 --- a/src/theory/builtin/theory_builtin_type_rules.h +++ b/src/theory/builtin/theory_builtin_type_rules.h @@ -134,7 +134,7 @@ class LambdaTypeRule { //get array representation of this function, if possible Node na = TheoryBuiltinRewriter::getArrayRepresentationForLambda(n); if( !na.isNull() ){ - Assert( na.getType().isArray() ); + Assert(na.getType().isArray()); Trace("lambda-const") << "Array representation for " << n << " is " << na << " " << na.getType() << std::endl; // must have the standard bound variable list Node bvl = NodeManager::currentNM()->getBoundVarListForFunctionType( n.getType() ); diff --git a/src/theory/bv/abstraction.cpp b/src/theory/bv/abstraction.cpp index cb829aba6..d9de9731a 100644 --- a/src/theory/bv/abstraction.cpp +++ b/src/theory/bv/abstraction.cpp @@ -140,7 +140,7 @@ Node AbstractionModule::reverseAbstraction(Node assertion, NodeNodeMap& seen) { if (isAbstraction(assertion)) { Node interp = getInterpretation(assertion); seen[assertion] = interp; - Assert (interp.getType() == assertion.getType()); + Assert(interp.getType() == assertion.getType()); return interp; } @@ -319,7 +319,7 @@ bool AbstractionModule::hasSignature(Node node) { Node AbstractionModule::getGeneralizedSignature(Node node) { NodeNodeMap::const_iterator it = d_assertionToSignature.find(node); - Assert (it != d_assertionToSignature.end()); + Assert(it != d_assertionToSignature.end()); Node generalized_signature = getGeneralization(it->second); return generalized_signature; } @@ -417,14 +417,14 @@ TNode AbstractionModule::getGeneralization(TNode term) { return term; TNode generalization = getGeneralization(it->second); - Assert (generalization != term); + Assert(generalization != term); d_sigToGeneralization[term] = generalization; return generalization; } void AbstractionModule::storeGeneralization(TNode s, TNode t) { - Assert (s == getGeneralization(s)); - Assert (t == getGeneralization(t)); + Assert(s == getGeneralization(s)); + Assert(t == getGeneralization(t)); d_sigToGeneralization[s] = t; } @@ -559,13 +559,13 @@ void AbstractionModule::collectArguments(TNode node, TNode signature, std::vecto args.push_back(node); seen.insert(node); } else { - Assert (signature.getKind() == kind::CONST_BITVECTOR); + Assert(signature.getKind() == kind::CONST_BITVECTOR); } // return; } - Assert (node.getKind() == signature.getKind() && - node.getNumChildren() == signature.getNumChildren()); + Assert(node.getKind() == signature.getKind() + && node.getNumChildren() == signature.getNumChildren()); for (unsigned i = 0; i < node.getNumChildren(); ++i) { collectArguments(node[i], signature[i], args, seen); @@ -618,8 +618,8 @@ bool AbstractionModule::isAbstraction(TNode node) { TNode constant = node[0].getKind() == kind::CONST_BITVECTOR ? node[0] : node[1]; TNode func = node[0].getKind() == kind::APPLY_UF ? node[0] : node[1]; - Assert (constant.getKind() == kind::CONST_BITVECTOR && - func.getKind() == kind::APPLY_UF); + Assert(constant.getKind() == kind::CONST_BITVECTOR + && func.getKind() == kind::APPLY_UF); if (utils::getSize(constant) != 1) return false; if (constant != utils::mkConst(1, 1u)) @@ -633,14 +633,14 @@ bool AbstractionModule::isAbstraction(TNode node) { } Node AbstractionModule::getInterpretation(TNode node) { - Assert (isAbstraction(node)); + Assert(isAbstraction(node)); TNode constant = node[0].getKind() == kind::CONST_BITVECTOR ? node[0] : node[1]; TNode apply = node[0].getKind() == kind::APPLY_UF ? node[0] : node[1]; - Assert (constant.getKind() == kind::CONST_BITVECTOR && - apply.getKind() == kind::APPLY_UF); + Assert(constant.getKind() == kind::CONST_BITVECTOR + && apply.getKind() == kind::APPLY_UF); Node func = apply.getOperator(); - Assert (d_funcToSignature.find(func) != d_funcToSignature.end()); + Assert(d_funcToSignature.find(func) != d_funcToSignature.end()); Node sig = d_funcToSignature[func]; @@ -648,8 +648,8 @@ Node AbstractionModule::getInterpretation(TNode node) { TNodeTNodeMap seen; unsigned index = 0; Node result = substituteArguments(sig, apply, index, seen); - Assert (result.getType().isBoolean()); - Assert (index == apply.getNumChildren()); + Assert(result.getType().isBoolean()); + Assert(index == apply.getNumChildren()); // Debug("bv-abstraction") << "AbstractionModule::getInterpretation " << node << "\n"; // Debug("bv-abstraction") << " => " << result << "\n"; return result; @@ -726,10 +726,8 @@ Node AbstractionModule::simplifyConflict(TNode conflict) { continue; } - Assert (!subst.hasSubstitution(s)); - Assert (!t.isNull() && - !s.isNull() && - s!= t); + Assert(!subst.hasSubstitution(s)); + Assert(!t.isNull() && !s.isNull() && s != t); subst.addSubstitution(s, t); for (unsigned k = 0; k < conjuncts.size(); k++) { @@ -789,14 +787,14 @@ void AbstractionModule::generalizeConflict(TNode conflict, std::vector<Node>& le // collect abstract functions if (conflict.getKind() != kind::AND) { if (isAbstraction(conflict)) { - Assert (conflict[0].getKind() == kind::APPLY_UF); + Assert(conflict[0].getKind() == kind::APPLY_UF); functions.push_back(conflict[0]); } } else { for (unsigned i = 0; i < conflict.getNumChildren(); ++i) { TNode conjunct = conflict[i]; if (isAbstraction(conjunct)) { - Assert (conjunct[0].getKind() == kind::APPLY_UF); + Assert(conjunct[0].getKind() == kind::APPLY_UF); functions.push_back(conjunct[0]); } } @@ -871,7 +869,7 @@ bool AbstractionModule::LemmaInstantiatior::isConsistent(const vector<int>& stac TNode func = d_functions[current]; ArgsTableEntry& matches = d_argsTable.getEntry(func.getOperator()); ArgsVec& args = matches.getEntry(stack[current]); - Assert (args.size() == func.getNumChildren()); + Assert(args.size() == func.getNumChildren()); for (unsigned k = 0; k < args.size(); ++k) { TNode s = func[k]; TNode t = args[k]; @@ -905,8 +903,8 @@ bool AbstractionModule::LemmaInstantiatior::isConsistent(const vector<int>& stac continue; } - Assert (s0.getMetaKind() == kind::metakind::VARIABLE && - t0.getMetaKind() == kind::metakind::VARIABLE); + Assert(s0.getMetaKind() == kind::metakind::VARIABLE + && t0.getMetaKind() == kind::metakind::VARIABLE); if (s0 != t0) { d_subst.addSubstitution(s0, t0); @@ -952,7 +950,7 @@ void AbstractionModule::LemmaInstantiatior::generateInstantiations(std::vector<N std::vector<int> stack; backtrack(stack); - Assert (d_ctx->getLevel() == 0); + Assert(d_ctx->getLevel() == 0); Debug("bv-abstraction-gen") << "numLemmas=" << d_lemmas.size() <<"\n"; lemmas.swap(d_lemmas); } @@ -976,8 +974,8 @@ void AbstractionModule::makeFreshSkolems(TNode node, SubstitutionMap& map, Subst } void AbstractionModule::makeFreshArgs(TNode func, std::vector<Node>& fresh_args) { - Assert (fresh_args.size() == 0); - Assert (func.getKind() == kind::APPLY_UF); + Assert(fresh_args.size() == 0); + Assert(func.getKind() == kind::APPLY_UF); TNodeNodeMap d_map; for (unsigned i = 0; i < func.getNumChildren(); ++i) { TNode arg = func[i]; @@ -985,7 +983,7 @@ void AbstractionModule::makeFreshArgs(TNode func, std::vector<Node>& fresh_args) fresh_args.push_back(arg); continue; } - Assert (arg.getMetaKind() == kind::metakind::VARIABLE); + Assert(arg.getMetaKind() == kind::metakind::VARIABLE); TNodeNodeMap::iterator it = d_map.find(arg); if (it != d_map.end()) { fresh_args.push_back(it->second); @@ -995,11 +993,11 @@ void AbstractionModule::makeFreshArgs(TNode func, std::vector<Node>& fresh_args) fresh_args.push_back(skolem); } } - Assert (fresh_args.size() == func.getNumChildren()); + Assert(fresh_args.size() == func.getNumChildren()); } Node AbstractionModule::tryMatching(const std::vector<Node>& ss, const std::vector<TNode>& tt, TNode conflict) { - Assert (ss.size() == tt.size()); + Assert(ss.size() == tt.size()); Debug("bv-abstraction-dbg") << "AbstractionModule::tryMatching conflict = " << conflict << "\n"; if (Debug.isOn("bv-abstraction-dbg")) { @@ -1044,10 +1042,10 @@ Node AbstractionModule::tryMatching(const std::vector<Node>& ss, const std::vect continue; } - Assert (s0.getMetaKind() == kind::metakind::VARIABLE && - t0.getMetaKind() == kind::metakind::VARIABLE); + Assert(s0.getMetaKind() == kind::metakind::VARIABLE + && t0.getMetaKind() == kind::metakind::VARIABLE); - Assert (s0 != t0); + Assert(s0 != t0); subst.addSubstitution(s0, t0); } @@ -1062,20 +1060,20 @@ void AbstractionModule::storeLemma(TNode lemma) { for (unsigned i = 0; i < lemma.getNumChildren(); i++) { TNode atom = lemma[i]; atom = atom.getKind() == kind::NOT ? atom[0] : atom; - Assert (atom.getKind() != kind::NOT); - Assert (utils::isBVPredicate(atom)); + Assert(atom.getKind() != kind::NOT); + Assert(utils::isBVPredicate(atom)); d_lemmaAtoms.insert(atom); } } else { lemma = lemma.getKind() == kind::NOT? lemma[0] : lemma; - Assert (utils::isBVPredicate(lemma)); + Assert(utils::isBVPredicate(lemma)); d_lemmaAtoms.insert(lemma); } } bool AbstractionModule::isLemmaAtom(TNode node) const { - Assert (node.getType().isBoolean()); + Assert(node.getType().isBoolean()); node = node.getKind() == kind::NOT? node[0] : node; return d_inputAtoms.find(node) == d_inputAtoms.end() && @@ -1089,7 +1087,7 @@ void AbstractionModule::addInputAtom(TNode atom) { } void AbstractionModule::ArgsTableEntry::addArguments(const ArgsVec& args) { - Assert (args.size() == d_arity); + Assert(args.size() == d_arity); d_data.push_back(args); } @@ -1107,7 +1105,7 @@ bool AbstractionModule::ArgsTable::hasEntry(TNode signature) const { } AbstractionModule::ArgsTableEntry& AbstractionModule::ArgsTable::getEntry(TNode signature) { - Assert (hasEntry(signature)); + Assert(hasEntry(signature)); return d_data.find(signature)->second; } diff --git a/src/theory/bv/abstraction.h b/src/theory/bv/abstraction.h index 5472aa5a2..4895d1818 100644 --- a/src/theory/bv/abstraction.h +++ b/src/theory/bv/abstraction.h @@ -60,7 +60,11 @@ class AbstractionModule { iterator end() { return d_data.end(); } unsigned getArity() { return d_arity; } unsigned getNumEntries() { return d_data.size(); } - ArgsVec& getEntry(unsigned i ) { Assert (i < d_data.size()); return d_data[i]; } + ArgsVec& getEntry(unsigned i) + { + Assert(i < d_data.size()); + return d_data[i]; + } }; class ArgsTable { diff --git a/src/theory/bv/bitblast/aig_bitblaster.cpp b/src/theory/bv/bitblast/aig_bitblaster.cpp index 3ed926f84..c2bc9e6e8 100644 --- a/src/theory/bv/bitblast/aig_bitblaster.cpp +++ b/src/theory/bv/bitblast/aig_bitblaster.cpp @@ -18,7 +18,7 @@ #include "theory/bv/bitblast/aig_bitblaster.h" -#include "base/cvc4_check.h" +#include "base/check.h" #include "options/bv_options.h" #include "prop/sat_solver_factory.h" #include "smt/smt_statistics_registry.h" @@ -46,7 +46,7 @@ namespace bv { template <> inline std::string toString<Abc_Obj_t*> (const std::vector<Abc_Obj_t*>& bits) { - Unreachable("Don't know how to print AIG"); + Unreachable() << "Don't know how to print AIG"; } @@ -72,7 +72,7 @@ Abc_Obj_t* mkOr<Abc_Obj_t*>(Abc_Obj_t* a, Abc_Obj_t* b) { template <> inline Abc_Obj_t* mkOr<Abc_Obj_t*>(const std::vector<Abc_Obj_t*>& children) { - Assert (children.size()); + Assert(children.size()); if (children.size() == 1) return children[0]; @@ -91,7 +91,7 @@ Abc_Obj_t* mkAnd<Abc_Obj_t*>(Abc_Obj_t* a, Abc_Obj_t* b) { template <> inline Abc_Obj_t* mkAnd<Abc_Obj_t*>(const std::vector<Abc_Obj_t*>& children) { - Assert (children.size()); + Assert(children.size()); if (children.size() == 1) return children[0]; @@ -172,7 +172,7 @@ AigBitblaster::AigBitblaster() AigBitblaster::~AigBitblaster() {} Abc_Obj_t* AigBitblaster::bbFormula(TNode node) { - Assert (node.getType().isBoolean()); + Assert(node.getType().isBoolean()); Debug("bitvector-bitblast") << "AigBitblaster::bbFormula "<< node << "\n"; if (hasAig(node)) @@ -211,7 +211,7 @@ Abc_Obj_t* AigBitblaster::bbFormula(TNode node) { } case kind::IMPLIES: { - Assert (node.getNumChildren() == 2); + Assert(node.getNumChildren() == 2); Abc_Obj_t* child1 = bbFormula(node[0]); Abc_Obj_t* child2 = bbFormula(node[1]); @@ -220,7 +220,7 @@ Abc_Obj_t* AigBitblaster::bbFormula(TNode node) { } case kind::ITE: { - Assert (node.getNumChildren() == 3); + Assert(node.getNumChildren() == 3); Abc_Obj_t* a = bbFormula(node[0]); Abc_Obj_t* b = bbFormula(node[1]); Abc_Obj_t* c = bbFormula(node[2]); @@ -241,7 +241,7 @@ Abc_Obj_t* AigBitblaster::bbFormula(TNode node) { case kind::EQUAL: { if( node[0].getType().isBoolean() ){ - Assert (node.getNumChildren() == 2); + Assert(node.getNumChildren() == 2); Abc_Obj_t* child1 = bbFormula(node[0]); Abc_Obj_t* child2 = bbFormula(node[1]); @@ -283,18 +283,18 @@ void AigBitblaster::bbTerm(TNode node, Bits& bits) { getBBTerm(node, bits); return; } - Assert( node.getType().isBitVector() ); + Assert(node.getType().isBitVector()); Debug("bitvector-bitblast") << "Bitblasting term " << node <<"\n"; d_termBBStrategies[node.getKind()] (node, bits, this); - Assert (bits.size() == utils::getSize(node)); + Assert(bits.size() == utils::getSize(node)); storeBBTerm(node, bits); } void AigBitblaster::cacheAig(TNode node, Abc_Obj_t* aig) { - Assert (!hasAig(node)); + Assert(!hasAig(node)); d_aigCache.insert(std::make_pair(node, aig)); } bool AigBitblaster::hasAig(TNode node) { @@ -317,9 +317,9 @@ void AigBitblaster::makeVariable(TNode node, Bits& bits) { } Abc_Obj_t* AigBitblaster::mkInput(TNode input) { - Assert (!hasInput(input)); - Assert(input.getKind() == kind::BITVECTOR_BITOF || - (input.getType().isBoolean() && input.isVar())); + Assert(!hasInput(input)); + Assert(input.getKind() == kind::BITVECTOR_BITOF + || (input.getType().isBoolean() && input.isVar())); Abc_Obj_t* aig_input = Abc_NtkCreatePi(currentAigNtk()); // d_aigCache.insert(std::make_pair(input, aig_input)); d_nodeToAigInput.insert(std::make_pair(input, aig_input)); @@ -333,7 +333,7 @@ bool AigBitblaster::hasInput(TNode input) { bool AigBitblaster::solve(TNode node) { // setting output of network to be the query - Assert (d_aigOutputNode == NULL); + Assert(d_aigOutputNode == NULL); Abc_Obj_t* query = bbFormula(node); d_aigOutputNode = Abc_NtkCreatePo(currentAigNtk()); Abc_ObjAddFanin(d_aigOutputNode, query); @@ -345,7 +345,7 @@ bool AigBitblaster::solve(TNode node) { TimerStat::CodeTimer solveTimer(d_statistics.d_solveTime); prop::SatValue result = d_satSolver->solve(); - Assert (result != prop::SAT_VALUE_UNKNOWN); + Assert(result != prop::SAT_VALUE_UNKNOWN); return result == prop::SAT_VALUE_TRUE; } @@ -356,7 +356,7 @@ void AigBitblaster::simplifyAig() { TimerStat::CodeTimer simpTimer(d_statistics.d_simplificationTime); Abc_AigCleanup(currentAigM()); - Assert (Abc_NtkCheck(currentAigNtk())); + Assert(Abc_NtkCheck(currentAigNtk())); const char* command = options::bitvectorAigSimplifications().c_str(); Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame(); @@ -376,8 +376,8 @@ void AigBitblaster::convertToCnfAndAssert() { Aig_Man_t * pMan = NULL; Cnf_Dat_t * pCnf = NULL; - Assert( Abc_NtkIsStrash(currentAigNtk()) ); - + Assert(Abc_NtkIsStrash(currentAigNtk())); + // convert to the AIG manager pMan = Abc_NtkToDar(currentAigNtk(), 0, 0 ); Abc_Stop(); @@ -385,9 +385,9 @@ void AigBitblaster::convertToCnfAndAssert() { // // free old network // Abc_NtkDelete(currentAigNtk()); // s_abcAigNetwork = NULL; - - Assert (pMan != NULL); - Assert (Aig_ManCheck(pMan)); + + Assert(pMan != NULL); + Assert(Aig_ManCheck(pMan)); pCnf = Cnf_DeriveFast( pMan, 0 ); assertToSatSolver(pCnf); @@ -416,9 +416,9 @@ void AigBitblaster::assertToSatSolver(Cnf_Dat_t* pCnf) { prop::SatClause clause; for (pLit = pCnf->pClauses[i], pStop = pCnf->pClauses[i+1]; pLit < pStop; pLit++ ) { int int_lit = Cnf_Lit2Var(*pLit); - Assert (int_lit != 0); + Assert(int_lit != 0); unsigned index = int_lit < 0? -int_lit : int_lit; - Assert (index - 1 < sat_variables.size()); + Assert(index - 1 < sat_variables.size()); prop::SatLiteral lit(sat_variables[index-1], int_lit < 0); clause.push_back(lit); } @@ -464,7 +464,7 @@ void AigBitblaster::storeBBAtom(TNode atom, Abc_Obj_t* atom_bb) { } Abc_Obj_t* AigBitblaster::getBBAtom(TNode atom) const { - Assert (hasBBAtom(atom)); + Assert(hasBBAtom(atom)); return d_bbAtoms.find(atom)->second; } diff --git a/src/theory/bv/bitblast/bitblast_strategies_template.h b/src/theory/bv/bitblast/bitblast_strategies_template.h index 9e668e258..047396506 100644 --- a/src/theory/bv/bitblast/bitblast_strategies_template.h +++ b/src/theory/bv/bitblast/bitblast_strategies_template.h @@ -50,7 +50,7 @@ T UndefinedAtomBBStrategy(TNode node, TBitblaster<T>* bb) { template <class T> T DefaultEqBB(TNode node, TBitblaster<T>* bb) { Debug("bitvector-bb") << "Bitblasting node " << node << "\n"; - + Assert(node.getKind() == kind::EQUAL); std::vector<T> lhs, rhs; bb->bbTerm(node[0], lhs); @@ -75,7 +75,7 @@ T AdderUltBB(TNode node, TBitblaster<T>* bb) { bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); Assert(a.size() == b.size()); - + // a < b <=> ~ (add(a, ~b, 1).carry_out) std::vector<T> not_b; negateBits(b, not_b); @@ -98,7 +98,7 @@ T DefaultUltBB(TNode node, TBitblaster<T>* bb) { bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); Assert(a.size() == b.size()); - + // construct bitwise comparison T res = uLessThanBB(a, b, false); return res; @@ -139,7 +139,7 @@ T DefaultSltBB(TNode node, TBitblaster<T>* bb){ bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); Assert(a.size() == b.size()); - + T res = sLessThanBB(a, b, false); return res; } @@ -152,7 +152,7 @@ T DefaultSleBB(TNode node, TBitblaster<T>* bb){ bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); Assert(a.size() == b.size()); - + T res = sLessThanBB(a, b, true); return res; } @@ -204,13 +204,13 @@ void DefaultConstBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultConstBB bitblasting " << node << "\n"; Assert(node.getKind() == kind::CONST_BITVECTOR); Assert(bits.size() == 0); - + for (unsigned i = 0; i < utils::getSize(node); ++i) { Integer bit = node.getConst<BitVector>().extract(i, i).getValue(); if(bit == Integer(0)){ bits.push_back(mkFalse<T>()); } else { - Assert (bit == Integer(1)); + Assert(bit == Integer(1)); bits.push_back(mkTrue<T>()); } } @@ -234,8 +234,8 @@ template <class T> void DefaultConcatBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultConcatBB bitblasting " << node << "\n"; Assert(bits.size() == 0); - - Assert (node.getKind() == kind::BITVECTOR_CONCAT); + + Assert(node.getKind() == kind::BITVECTOR_CONCAT); for (int i = node.getNumChildren() -1 ; i >= 0; --i ) { TNode current = node[i]; std::vector<T> current_bits; @@ -245,7 +245,7 @@ void DefaultConcatBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { bits.push_back(current_bits[j]); } } - Assert (bits.size() == utils::getSize(node)); + Assert(bits.size() == utils::getSize(node)); if(Debug.isOn("bitvector-bb")) { Debug("bitvector-bb") << "with bits: " << toString(bits) << "\n"; } @@ -254,9 +254,8 @@ void DefaultConcatBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { template <class T> void DefaultAndBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultAndBB bitblasting " << node << "\n"; - - Assert(node.getKind() == kind::BITVECTOR_AND && - bits.size() == 0); + + Assert(node.getKind() == kind::BITVECTOR_AND && bits.size() == 0); bb->bbTerm(node[0], bits); std::vector<T> current; @@ -267,15 +266,14 @@ void DefaultAndBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { } current.clear(); } - Assert (bits.size() == utils::getSize(node)); + Assert(bits.size() == utils::getSize(node)); } template <class T> void DefaultOrBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultOrBB bitblasting " << node << "\n"; - Assert(node.getKind() == kind::BITVECTOR_OR && - bits.size() == 0); + Assert(node.getKind() == kind::BITVECTOR_OR && bits.size() == 0); bb->bbTerm(node[0], bits); std::vector<T> current; @@ -286,15 +284,14 @@ void DefaultOrBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { } current.clear(); } - Assert (bits.size() == utils::getSize(node)); + Assert(bits.size() == utils::getSize(node)); } template <class T> void DefaultXorBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultXorBB bitblasting " << node << "\n"; - Assert(node.getKind() == kind::BITVECTOR_XOR && - bits.size() == 0); + Assert(node.getKind() == kind::BITVECTOR_XOR && bits.size() == 0); bb->bbTerm(node[0], bits); std::vector<T> current; @@ -305,21 +302,20 @@ void DefaultXorBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { } current.clear(); } - Assert (bits.size() == utils::getSize(node)); + Assert(bits.size() == utils::getSize(node)); } template <class T> void DefaultXnorBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultXnorBB bitblasting " << node << "\n"; - Assert(node.getNumChildren() == 2 && - node.getKind() == kind::BITVECTOR_XNOR && - bits.size() == 0); + Assert(node.getNumChildren() == 2 && node.getKind() == kind::BITVECTOR_XNOR + && bits.size() == 0); std::vector<T> lhs, rhs; bb->bbTerm(node[0], lhs); bb->bbTerm(node[1], rhs); - Assert(lhs.size() == rhs.size()); - + Assert(lhs.size() == rhs.size()); + for (unsigned i = 0; i < lhs.size(); ++i) { bits.push_back(mkIff(lhs[i], rhs[i])); } @@ -342,7 +338,8 @@ template <class T> void DefaultCompBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector") << "theory::bv:: DefaultCompBB bitblasting "<< node << "\n"; - Assert(utils::getSize(node) == 1 && bits.size() == 0 && node.getKind() == kind::BITVECTOR_COMP); + Assert(utils::getSize(node) == 1 && bits.size() == 0 + && node.getKind() == kind::BITVECTOR_COMP); std::vector<T> a, b; bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); @@ -359,8 +356,7 @@ void DefaultCompBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { template <class T> void DefaultMultBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { Debug("bitvector") << "theory::bv:: DefaultMultBB bitblasting "<< node << "\n"; - Assert(res.size() == 0 && - node.getKind() == kind::BITVECTOR_MULT); + Assert(res.size() == 0 && node.getKind() == kind::BITVECTOR_MULT); // if (node.getNumChildren() == 2) { // std::vector<T> a; @@ -401,8 +397,7 @@ void DefaultMultBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { template <class T> void DefaultPlusBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultPlusBB bitblasting " << node << "\n"; - Assert(node.getKind() == kind::BITVECTOR_PLUS && - res.size() == 0); + Assert(node.getKind() == kind::BITVECTOR_PLUS && res.size() == 0); bb->bbTerm(node[0], res); @@ -415,7 +410,7 @@ void DefaultPlusBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { rippleCarryAdder(res, current, newres, mkFalse<T>()); res = newres; } - + Assert(res.size() == utils::getSize(node)); } @@ -423,13 +418,12 @@ void DefaultPlusBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { template <class T> void DefaultSubBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultSubBB bitblasting " << node << "\n"; - Assert(node.getKind() == kind::BITVECTOR_SUB && - node.getNumChildren() == 2 && - bits.size() == 0); - + Assert(node.getKind() == kind::BITVECTOR_SUB && node.getNumChildren() == 2 + && bits.size() == 0); + std::vector<T> a, b; bb->bbTerm(node[0], a); - bb->bbTerm(node[1], b); + bb->bbTerm(node[1], b); Assert(a.size() == b.size() && utils::getSize(node) == a.size()); // bvsub a b = adder(a, ~b, 1) @@ -442,7 +436,7 @@ template <class T> void DefaultNegBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultNegBB bitblasting " << node << "\n"; Assert(node.getKind() == kind::BITVECTOR_NEG); - + std::vector<T> a; bb->bbTerm(node[0], a); Assert(utils::getSize(node) == a.size()); @@ -458,7 +452,7 @@ void DefaultNegBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { template <class T> void uDivModRec(const std::vector<T>& a, const std::vector<T>& b, std::vector<T>& q, std::vector<T>& r, unsigned rec_width) { - Assert( q.size() == 0 && r.size() == 0); + Assert(q.size() == 0 && r.size() == 0); if(rec_width == 0 || isZero(a)) { makeZero(q, a.size()); @@ -788,7 +782,7 @@ void DefaultUltbvBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); Assert(a.size() == b.size()); - + // construct bitwise comparison res.push_back(uLessThanBB(a, b, false)); } @@ -801,7 +795,7 @@ void DefaultSltbvBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { bb->bbTerm(node[0], a); bb->bbTerm(node[1], b); Assert(a.size() == b.size()); - + // construct bitwise comparison res.push_back(sLessThanBB(a, b, false)); } @@ -814,7 +808,7 @@ void DefaultIteBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { bb->bbTerm(node[0], cond); bb->bbTerm(node[1], thenpart); bb->bbTerm(node[2], elsepart); - + Assert(cond.size() == 1); Assert(thenpart.size() == elsepart.size()); @@ -826,9 +820,9 @@ void DefaultIteBB (TNode node, std::vector<T>& res, TBitblaster<T>* bb) { template <class T> void DefaultExtractBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { - Assert (node.getKind() == kind::BITVECTOR_EXTRACT); + Assert(node.getKind() == kind::BITVECTOR_EXTRACT); Assert(bits.size() == 0); - + std::vector<T> base_bits; bb->bbTerm(node[0], base_bits); unsigned high = utils::getExtractHigh(node); @@ -837,7 +831,7 @@ void DefaultExtractBB (TNode node, std::vector<T>& bits, TBitblaster<T>* bb) { for (unsigned i = low; i <= high; ++i) { bits.push_back(base_bits[i]); } - Assert (bits.size() == high - low + 1); + Assert(bits.size() == high - low + 1); if(Debug.isOn("bitvector-bb")) { Debug("bitvector-bb") << "theory::bv::DefaultExtractBB bitblasting " << node << "\n"; @@ -868,8 +862,7 @@ template <class T> void DefaultSignExtendBB (TNode node, std::vector<T>& res_bits, TBitblaster<T>* bb) { Debug("bitvector-bb") << "theory::bv::DefaultSignExtendBB bitblasting " << node << "\n"; - Assert (node.getKind() == kind::BITVECTOR_SIGN_EXTEND && - res_bits.size() == 0); + Assert(node.getKind() == kind::BITVECTOR_SIGN_EXTEND && res_bits.size() == 0); std::vector<T> bits; bb->bbTerm(node[0], bits); @@ -884,8 +877,8 @@ void DefaultSignExtendBB (TNode node, std::vector<T>& res_bits, TBitblaster<T>* for (unsigned i = 0 ; i < amount ; ++i ) { res_bits.push_back(sign_bit); } - - Assert (res_bits.size() == amount + bits.size()); + + Assert(res_bits.size() == amount + bits.size()); } template <class T> diff --git a/src/theory/bv/bitblast/bitblast_utils.h b/src/theory/bv/bitblast/bitblast_utils.h index f2bee22e5..03e0aa349 100644 --- a/src/theory/bv/bitblast/bitblast_utils.h +++ b/src/theory/bv/bitblast/bitblast_utils.h @@ -81,7 +81,7 @@ Node mkOr<Node>(Node a, Node b) { template <> inline Node mkOr<Node>(const std::vector<Node>& children) { - Assert (children.size()); + Assert(children.size()); if (children.size() == 1) return children[0]; return NodeManager::currentNM()->mkNode(kind::OR, children); @@ -95,7 +95,7 @@ Node mkAnd<Node>(Node a, Node b) { template <> inline Node mkAnd<Node>(const std::vector<Node>& children) { - Assert (children.size()); + Assert(children.size()); if (children.size() == 1) return children[0]; return NodeManager::currentNM()->mkNode(kind::AND, children); @@ -123,7 +123,7 @@ Node mkIte<Node>(Node cond, Node a, Node b) { template <class T> void inline extractBits(const std::vector<T>& b, std::vector<T>& dest, unsigned lo, unsigned hi) { - Assert ( lo < b.size() && hi < b.size() && lo <= hi); + Assert(lo < b.size() && hi < b.size() && lo <= hi); for (unsigned i = lo; i <= hi; ++i) { dest.push_back(b[i]); } @@ -168,7 +168,7 @@ void inline lshift(std::vector<T>& bits, unsigned amount) { template <class T> void inline makeZero(std::vector<T>& bits, unsigned width) { - Assert(bits.size() == 0); + Assert(bits.size() == 0); for(unsigned i = 0; i < width; ++i) { bits.push_back(mkFalse<T>()); } @@ -188,7 +188,7 @@ void inline makeZero(std::vector<T>& bits, unsigned width) { template <class T> T inline rippleCarryAdder(const std::vector<T>&a, const std::vector<T>& b, std::vector<T>& res, T carry) { Assert(a.size() == b.size() && res.size() == 0); - + for (unsigned i = 0 ; i < a.size(); ++i) { T sum = mkXor(mkXor(a[i], b[i]), carry); carry = mkOr( mkAnd(a[i], b[i]), @@ -222,8 +222,8 @@ inline void shiftAddMultiplier(const std::vector<T>&a, const std::vector<T>&b, s template <class T> T inline uLessThanBB(const std::vector<T>&a, const std::vector<T>& b, bool orEqual) { - Assert (a.size() && b.size()); - + Assert(a.size() && b.size()); + T res = mkAnd(mkNot(a[0]), b[0]); if(orEqual) { @@ -240,7 +240,7 @@ T inline uLessThanBB(const std::vector<T>&a, const std::vector<T>& b, bool orEqu template <class T> T inline sLessThanBB(const std::vector<T>&a, const std::vector<T>& b, bool orEqual) { - Assert (a.size() && b.size()); + Assert(a.size() && b.size()); if (a.size() == 1) { if(orEqual) { return mkOr(mkIff(a[0], b[0]), diff --git a/src/theory/bv/bitblast/eager_bitblaster.cpp b/src/theory/bv/bitblast/eager_bitblaster.cpp index 0d3d3b483..9d43355cc 100644 --- a/src/theory/bv/bitblast/eager_bitblaster.cpp +++ b/src/theory/bv/bitblast/eager_bitblaster.cpp @@ -60,7 +60,7 @@ EagerBitblaster::EagerBitblaster(TheoryBV* theory_bv, context::Context* c) solver = prop::SatSolverFactory::createCryptoMinisat( smtStatisticsRegistry(), "EagerBitblaster"); break; - default: Unreachable("Unknown SAT solver type"); + default: Unreachable() << "Unknown SAT solver type"; } d_satSolver.reset(solver); d_cnfStream.reset( diff --git a/src/theory/bv/bitblast/lazy_bitblaster.cpp b/src/theory/bv/bitblast/lazy_bitblaster.cpp index 845fd399e..2018590f7 100644 --- a/src/theory/bv/bitblast/lazy_bitblaster.cpp +++ b/src/theory/bv/bitblast/lazy_bitblaster.cpp @@ -232,7 +232,7 @@ void TLazyBitblaster::bbTerm(TNode node, Bits& bits) { getBBTerm(node, bits); return; } - Assert( node.getType().isBitVector() ); + Assert(node.getType().isBitVector()); d_bv->spendResource(options::bitblastStep()); Debug("bitvector-bitblast") << "Bitblasting term " << node <<"\n"; @@ -240,7 +240,7 @@ void TLazyBitblaster::bbTerm(TNode node, Bits& bits) { d_termBBStrategies[node.getKind()] (node, bits,this); - Assert (bits.size() == utils::getSize(node)); + Assert(bits.size() == utils::getSize(node)); storeBBTerm(node, bits); } @@ -257,7 +257,7 @@ void TLazyBitblaster::explain(TNode atom, std::vector<TNode>& explanation) { ++(d_statistics.d_numExplainedPropagations); if (options::bvEagerExplanations()) { - Assert (d_explanations->find(lit) != d_explanations->end()); + Assert(d_explanations->find(lit) != d_explanations->end()); const std::vector<prop::SatLiteral>& literal_explanation = (*d_explanations)[lit].get(); for (unsigned i = 0; i < literal_explanation.size(); ++i) { explanation.push_back(d_cnfStream->getNode(literal_explanation[i])); @@ -292,9 +292,9 @@ bool TLazyBitblaster::assertToSat(TNode lit, bool propagate) { } else { atom = lit; } - Assert( utils::isBitblastAtom( atom ) ); + Assert(utils::isBitblastAtom(atom)); - Assert (hasBBAtom(atom)); + Assert(hasBBAtom(atom)); prop::SatLiteral markerLit = d_cnfStream->getLiteral(atom); @@ -483,7 +483,7 @@ bool TLazyBitblaster::isSharedTerm(TNode node) { } bool TLazyBitblaster::hasValue(TNode a) { - Assert (hasBBTerm(a)); + Assert(hasBBTerm(a)); Bits bits; getBBTerm(a, bits); for (int i = bits.size() -1; i >= 0; --i) { @@ -522,7 +522,7 @@ Node TLazyBitblaster::getModelFromSatSolver(TNode a, bool fullModel) { if (d_cnfStream->hasLiteral(bits[i])) { prop::SatLiteral bit = d_cnfStream->getLiteral(bits[i]); bit_value = d_satSolver->value(bit); - Assert (bit_value != prop::SAT_VALUE_UNKNOWN); + Assert(bit_value != prop::SAT_VALUE_UNKNOWN); } else { if (!fullModel) return Node(); // unconstrained bits default to false @@ -545,12 +545,12 @@ bool TLazyBitblaster::collectModelInfo(TheoryModel* m, bool fullModel) if (d_variables.find(var) == d_variables.end()) continue; - Assert (Theory::theoryOf(var) == theory::THEORY_BV || isSharedTerm(var)); + Assert(Theory::theoryOf(var) == theory::THEORY_BV || isSharedTerm(var)); // only shared terms could not have been bit-blasted - Assert (hasBBTerm(var) || isSharedTerm(var)); + Assert(hasBBTerm(var) || isSharedTerm(var)); Node const_value = getModelFromSatSolver(var, true); - Assert (const_value.isNull() || const_value.isConst()); + Assert(const_value.isNull() || const_value.isConst()); if(const_value != Node()) { Debug("bitvector-model") << "TLazyBitblaster::collectModelInfo (assert (= " << var << " " @@ -565,7 +565,7 @@ bool TLazyBitblaster::collectModelInfo(TheoryModel* m, bool fullModel) } void TLazyBitblaster::clearSolver() { - Assert (d_ctx->getLevel() == 0); + Assert(d_ctx->getLevel() == 0); d_assertedAtoms->deleteSelf(); d_assertedAtoms = new(true) context::CDList<prop::SatLiteral>(d_ctx); d_explanations->deleteSelf(); diff --git a/src/theory/bv/bv_inequality_graph.cpp b/src/theory/bv/bv_inequality_graph.cpp index 89d5e1883..ed8756456 100644 --- a/src/theory/bv/bv_inequality_graph.cpp +++ b/src/theory/bv/bv_inequality_graph.cpp @@ -36,7 +36,7 @@ bool InequalityGraph::addInequality(TNode a, TNode b, bool strict, TNode reason) TermId id_b = registerTerm(b); ReasonId id_reason = registerReason(reason); - Assert (!(isConst(id_a) && isConst(id_b))); + Assert(!(isConst(id_a) && isConst(id_b))); BitVector a_val = getValue(id_a); BitVector b_val = getValue(id_b); @@ -73,7 +73,7 @@ bool InequalityGraph::addInequality(TNode a, TNode b, bool strict, TNode reason) // add the inequality edge addEdge(id_a, id_b, strict, id_reason); BFSQueue queue(&d_modelValues); - Assert (hasModelValue(id_a)); + Assert(hasModelValue(id_a)); queue.push(id_a); return processQueue(queue, id_a); } @@ -141,7 +141,7 @@ bool InequalityGraph::processQueue(BFSQueue& queue, TermId start) { // it means we have an overflow and hence a conflict std::vector<TermId> conflict; conflict.push_back(it->reason); - Assert (hasModelValue(start)); + Assert(hasModelValue(start)); ReasonId start_reason = getModelValue(start).reason; if (start_reason != UndefinedReasonId) { conflict.push_back(start_reason); @@ -193,9 +193,9 @@ void InequalityGraph::computeExplanation(TermId from, TermId to, std::vector<Rea while(hasReason(to) && from != to && !seen.count(to)) { seen.insert(to); const ModelValue& exp = getModelValue(to); - Assert (exp.reason != UndefinedReasonId); + Assert(exp.reason != UndefinedReasonId); explanation.push_back(exp.reason); - Assert (exp.parent != UndefinedTermId); + Assert(exp.parent != UndefinedTermId); to = exp.parent; Debug("bv-inequality-internal") << " parent: " << getTermNode(to) << "\n" << " reason: " << getReasonNode(exp.reason) << "\n"; @@ -213,8 +213,8 @@ void InequalityGraph::addEdge(TermId a, TermId b, bool strict, TermId reason) { } void InequalityGraph::initializeModelValue(TNode node) { - TermId id = getTermId(node); - Assert (!hasModelValue(id)); + TermId id = getTermId(node); + Assert(!hasModelValue(id)); bool isConst = node.getKind() == kind::CONST_BITVECTOR; unsigned size = utils::getSize(node); BitVector value = isConst? node.getConst<BitVector>() : BitVector(size, 0u); @@ -248,10 +248,10 @@ TermId InequalityGraph::registerTerm(TNode term) { bool isConst = term.getKind() == kind::CONST_BITVECTOR; InequalityNode ineq = InequalityNode(id, size, isConst); - Assert (d_ineqNodes.size() == id); + Assert(d_ineqNodes.size() == id); d_ineqNodes.push_back(ineq); - - Assert (d_ineqEdges.size() == id); + + Assert(d_ineqEdges.size() == id); d_ineqEdges.push_back(Edges()); initializeModelValue(term); @@ -272,22 +272,22 @@ ReasonId InequalityGraph::registerReason(TNode reason) { } TNode InequalityGraph::getReasonNode(ReasonId id) const { - Assert (d_reasonNodes.size() > id); + Assert(d_reasonNodes.size() > id); return d_reasonNodes[id]; } TNode InequalityGraph::getTermNode(TermId id) const { - Assert (d_termNodes.size() > id); + Assert(d_termNodes.size() > id); return d_termNodes[id]; } TermId InequalityGraph::getTermId(TNode node) const { - Assert (d_termNodeToIdMap.find(node) != d_termNodeToIdMap.end()); + Assert(d_termNodeToIdMap.find(node) != d_termNodeToIdMap.end()); return d_termNodeToIdMap.find(node)->second; } void InequalityGraph::setConflict(const std::vector<ReasonId>& conflict) { - Assert (!d_inConflict); + Assert(!d_inConflict); d_inConflict = true; d_conflict.clear(); for (unsigned i = 0; i < conflict.size(); ++i) { @@ -314,7 +314,7 @@ void InequalityGraph::setModelValue(TermId term, const ModelValue& mv) { } InequalityGraph::ModelValue InequalityGraph::getModelValue(TermId term) const { - Assert (d_modelValues.find(term) != d_modelValues.end()); + Assert(d_modelValues.find(term) != d_modelValues.end()); return (*(d_modelValues.find(term))).second; } @@ -323,7 +323,7 @@ bool InequalityGraph::hasModelValue(TermId id) const { } BitVector InequalityGraph::getValue(TermId id) const { - Assert (hasModelValue(id)); + Assert(hasModelValue(id)); return (*(d_modelValues.find(id))).second.value; } @@ -387,10 +387,12 @@ bool InequalityGraph::addDisequality(TNode a, TNode b, TNode reason) { } // void InequalityGraph::splitDisequality(TNode diseq) { -// Debug("bv-inequality-internal")<<"InequalityGraph::splitDisequality " << diseq <<"\n"; -// Assert (diseq.getKind() == kind::NOT && diseq[0].getKind() == kind::EQUAL); -// if (d_disequalitiesAlreadySplit.find(diseq) == d_disequalitiesAlreadySplit.end()) { -// d_disequalitiesToSplit.push_back(diseq); +// Debug("bv-inequality-internal")<<"InequalityGraph::splitDisequality " << +// diseq <<"\n"; Assert (diseq.getKind() == kind::NOT && +// diseq[0].getKind() == kind::EQUAL); if +// (d_disequalitiesAlreadySplit.find(diseq) == +// d_disequalitiesAlreadySplit.end()) { +// d_disequalitiesToSplit.push_back(diseq); // } // } @@ -398,7 +400,7 @@ void InequalityGraph::backtrack() { Debug("bv-inequality-internal") << "InequalityGraph::backtrack()\n"; int size = d_undoStack.size(); for (int i = size - 1; i >= (int)d_undoStackIndex.get(); --i) { - Assert (!d_undoStack.empty()); + Assert(!d_undoStack.empty()); TermId id = d_undoStack.back().first; InequalityEdge edge = d_undoStack.back().second; d_undoStack.pop_back(); @@ -409,8 +411,8 @@ void InequalityGraph::backtrack() { for (Edges::const_iterator it = edges.begin(); it!= edges.end(); ++it) { Debug("bv-inequality-internal") << getTermNode(it->next) <<" " << it->strict << "\n"; } - Assert (!edges.empty()); - Assert (edges.back() == edge); + Assert(!edges.empty()); + Assert(edges.back() == edge); edges.pop_back(); } } @@ -444,7 +446,7 @@ void InequalityGraph::checkDisequalities(std::vector<Node>& lemmas) { } bool InequalityGraph::isLessThan(TNode a, TNode b) { - Assert (isRegistered(a) && isRegistered(b)); + Assert(isRegistered(a) && isRegistered(b)); Unimplemented(); } @@ -457,8 +459,8 @@ bool InequalityGraph::hasValueInModel(TNode node) const { } BitVector InequalityGraph::getValueInModel(TNode node) const { - TermId id = getTermId(node); - Assert (hasModelValue(id)); + TermId id = getTermId(node); + Assert(hasModelValue(id)); return getValue(id); } diff --git a/src/theory/bv/bv_inequality_graph.h b/src/theory/bv/bv_inequality_graph.h index 07facf4af..9e8078a72 100644 --- a/src/theory/bv/bv_inequality_graph.h +++ b/src/theory/bv/bv_inequality_graph.h @@ -95,9 +95,9 @@ class InequalityGraph : public context::ContextNotifyObj{ : d_model(model) {} bool operator() (TermId left, TermId right) const { - Assert (d_model->find(left) != d_model->end() && - d_model->find(right) != d_model->end()); - + Assert(d_model->find(left) != d_model->end() + && d_model->find(right) != d_model->end()); + return (*(d_model->find(left))).second.value < (*(d_model->find(right))).second.value; } }; @@ -148,11 +148,22 @@ class InequalityGraph : public context::ContextNotifyObj{ ReasonId registerReason(TNode reason); TNode getReasonNode(ReasonId id) const; - - - Edges& getEdges(TermId id) { Assert (id < d_ineqEdges.size()); return d_ineqEdges[id]; } - InequalityNode& getInequalityNode(TermId id) { Assert (id < d_ineqNodes.size()); return d_ineqNodes[id]; } - const InequalityNode& getInequalityNode(TermId id) const { Assert (id < d_ineqNodes.size()); return d_ineqNodes[id]; } + + Edges& getEdges(TermId id) + { + Assert(id < d_ineqEdges.size()); + return d_ineqEdges[id]; + } + InequalityNode& getInequalityNode(TermId id) + { + Assert(id < d_ineqNodes.size()); + return d_ineqNodes[id]; + } + const InequalityNode& getInequalityNode(TermId id) const + { + Assert(id < d_ineqNodes.size()); + return d_ineqNodes[id]; + } unsigned getBitwidth(TermId id) const { return getInequalityNode(id).getBitwidth(); } bool isConst(TermId id) const { return getInequalityNode(id).isConstant(); } diff --git a/src/theory/bv/bv_quick_check.cpp b/src/theory/bv/bv_quick_check.cpp index 0183dd6e7..dbdeccfe5 100644 --- a/src/theory/bv/bv_quick_check.cpp +++ b/src/theory/bv/bv_quick_check.cpp @@ -55,7 +55,7 @@ prop::SatValue BVQuickCheck::checkSat(std::vector<Node>& assumptions, unsigned l for (unsigned i = 0; i < assumptions.size(); ++i) { TNode a = assumptions[i]; - Assert (a.getType().isBoolean()); + Assert(a.getType().isBoolean()); d_bitblaster->bbAtom(a); bool ok = d_bitblaster->assertToSat(a, false); if (!ok) { @@ -91,7 +91,7 @@ prop::SatValue BVQuickCheck::checkSat(unsigned long budget) { } bool BVQuickCheck::addAssertion(TNode assertion) { - Assert (assertion.getType().isBoolean()); + Assert(assertion.getType().isBoolean()); d_bitblaster->bbAtom(assertion); // assert to sat solver and run bcp to detect easy conflicts bool ok = d_bitblaster->assertToSat(assertion, true); @@ -162,9 +162,7 @@ QuickXPlain::~QuickXPlain() {} unsigned QuickXPlain::selectUnsatCore(unsigned low, unsigned high, std::vector<TNode>& conflict) { - - Assert(!d_solver->getConflict().isNull() && - d_solver->inConflict()); + Assert(!d_solver->getConflict().isNull() && d_solver->inConflict()); Node query_confl = d_solver->getConflict(); // conflict wasn't actually minimized @@ -190,24 +188,23 @@ unsigned QuickXPlain::selectUnsatCore(unsigned low, unsigned high, if (write == low) { return low; } - Assert (write != 0); + Assert(write != 0); unsigned new_high = write - 1; for (TNodeSet::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { conflict[write++] = *it; } - Assert (write -1 == high); - Assert (new_high <= high); - + Assert(write - 1 == high); + Assert(new_high <= high); + return new_high; } void QuickXPlain::minimizeConflictInternal(unsigned low, unsigned high, std::vector<TNode>& conflict, std::vector<TNode>& new_conflict) { + Assert(low <= high && high < conflict.size()); - Assert (low <= high && high < conflict.size()); - if (low == high) { new_conflict.push_back(conflict[low]); return; @@ -323,7 +320,7 @@ Node QuickXPlain::minimizeConflict(TNode confl) { ++d_numCalled; ++(d_statistics.d_numConflictsMinimized); TimerStat::CodeTimer xplainTimer(d_statistics.d_xplainTime); - Assert (confl.getNumChildren() > 2); + Assert(confl.getNumChildren() > 2); std::vector<TNode> conflict; for (unsigned i = 0; i < confl.getNumChildren(); ++i) { conflict.push_back(confl[i]); diff --git a/src/theory/bv/bv_subtheory_algebraic.cpp b/src/theory/bv/bv_subtheory_algebraic.cpp index 1f4aef42d..6f8804042 100644 --- a/src/theory/bv/bv_subtheory_algebraic.cpp +++ b/src/theory/bv/bv_subtheory_algebraic.cpp @@ -83,7 +83,7 @@ SubstitutionEx::SubstitutionEx(theory::SubstitutionMap* modelMap) bool SubstitutionEx::addSubstitution(TNode from, TNode to, TNode reason) { Debug("bv-substitution") << "SubstitutionEx::addSubstitution: "<< from <<" => "<< to << "\n" << " reason "<<reason << "\n"; - Assert (from != to); + Assert(from != to); if (d_substitutions.find(from) != d_substitutions.end()) { return false; } @@ -160,12 +160,12 @@ Node SubstitutionEx::internalApply(TNode node) { if (current.getMetaKind() == kind::metakind::PARAMETERIZED) { TNode op = current.getOperator(); - Assert (hasCache(op)); + Assert(hasCache(op)); nb << getCache(op); reasons.push_back(getReason(op)); } for (unsigned i = 0; i < current.getNumChildren(); ++i) { - Assert (hasCache(current[i])); + Assert(hasCache(current[i])); nb << getCache(current[i]); reasons.push_back(getReason(current[i])); } @@ -217,13 +217,13 @@ bool SubstitutionEx::hasCache(TNode node) const { } Node SubstitutionEx::getCache(TNode node) const { - Assert (hasCache(node)); + Assert(hasCache(node)); return d_cache.find(node)->second.to; } void SubstitutionEx::storeCache(TNode from, TNode to, Node reason) { // Debug("bv-substitution") << "SubstitutionEx::storeCache(" << from <<", " << to <<", "<< reason<<")\n"; - Assert (!hasCache(from)); + Assert(!hasCache(from)); d_cache[from] = SubstitutionElement(to, reason); } @@ -284,7 +284,7 @@ bool AlgebraicSolver::check(Theory::Effort e) storeExplanation(assertion); uint64_t assertion_size = d_quickSolver->computeAtomWeight(assertion, seen_assertions); - Assert (original_bb_cost <= original_bb_cost + assertion_size); + Assert(original_bb_cost <= original_bb_cost + assertion_size); original_bb_cost+= assertion_size; } @@ -294,7 +294,7 @@ bool AlgebraicSolver::check(Theory::Effort e) Debug("bv-subtheory-algebraic") << "Assertions " << worklist.size() <<" : \n"; - Assert (d_explanations.size() == worklist.size()); + Assert(d_explanations.size() == worklist.size()); d_modelMap.reset(new SubstitutionMap(d_context)); SubstitutionEx subst(d_modelMap.get()); @@ -424,8 +424,8 @@ bool AlgebraicSolver::quickCheck(std::vector<Node>& facts) { return true; } - Assert (res == SAT_VALUE_FALSE); - Assert (d_quickSolver->inConflict()); + Assert(res == SAT_VALUE_FALSE); + Assert(d_quickSolver->inConflict()); d_isComplete.set(true); Debug("bv-subtheory-algebraic") << " Unsat.\n"; ++(d_numSolved); @@ -437,15 +437,15 @@ bool AlgebraicSolver::quickCheck(std::vector<Node>& facts) { // singleton conflict if (conflict.getKind() != kind::AND) { - Assert (d_ids.find(conflict) != d_ids.end()); + Assert(d_ids.find(conflict) != d_ids.end()); unsigned id = d_ids[conflict]; - Assert (id < d_explanations.size()); + Assert(id < d_explanations.size()); Node theory_confl = d_explanations[id]; d_bv->setConflict(theory_confl); return false; } - Assert (conflict.getKind() == kind::AND); + Assert(conflict.getKind() == kind::AND); if (options::bitvectorQuickXplain()) { d_quickSolver->popToZero(); Debug("bv-quick-xplain") << "AlgebraicSolver::quickCheck original conflict size " << conflict.getNumChildren() << "\n"; @@ -457,9 +457,9 @@ bool AlgebraicSolver::quickCheck(std::vector<Node>& facts) { for (unsigned i = 0; i < conflict.getNumChildren(); ++i) { TNode c = conflict[i]; - Assert (d_ids.find(c) != d_ids.end()); + Assert(d_ids.find(c) != d_ids.end()); unsigned c_id = d_ids[c]; - Assert (c_id < d_explanations.size()); + Assert(c_id < d_explanations.size()); TNode c_expl = d_explanations[c_id]; theory_confl.push_back(c_expl); } @@ -514,7 +514,7 @@ bool AlgebraicSolver::solve(TNode fact, TNode reason, SubstitutionEx& subst) { if (right[i] != var) right_children.push_back(right[i]); } - Assert (right_children.size()); + Assert(right_children.size()); Node new_right = utils::mkNaryNode(kind::BITVECTOR_XOR, right_children); std::vector<Node> left_children; for (unsigned i = 1; i < left.getNumChildren(); ++i) { @@ -656,17 +656,17 @@ void AlgebraicSolver::processAssertions(std::vector<WorklistElement>& worklist, worklist[i] = WorklistElement(utils::mkTrue(), worklist[i].id); changed = true; } - Assert (d_explanations.size() == worklist.size()); + Assert(d_explanations.size() == worklist.size()); } } void AlgebraicSolver::storeExplanation(unsigned id, TNode explanation) { - Assert (checkExplanation(explanation)); + Assert(checkExplanation(explanation)); d_explanations[id] = explanation; } void AlgebraicSolver::storeExplanation(TNode explanation) { - Assert (checkExplanation(explanation)); + Assert(checkExplanation(explanation)); d_explanations.push_back(explanation); } @@ -713,7 +713,7 @@ EqualityStatus AlgebraicSolver::getEqualityStatus(TNode a, TNode b) { bool AlgebraicSolver::collectModelInfo(TheoryModel* model, bool fullModel) { Debug("bitvector-model") << "AlgebraicSolver::collectModelInfo\n"; - AlwaysAssert (!d_quickSolver->inConflict()); + AlwaysAssert(!d_quickSolver->inConflict()); set<Node> termSet; d_bv->computeRelevantTerms(termSet); @@ -746,13 +746,13 @@ bool AlgebraicSolver::collectModelInfo(TheoryModel* model, bool fullModel) for (NodeSet::const_iterator it = leaf_vars.begin(); it != leaf_vars.end(); ++it) { TNode var = *it; Node value = d_quickSolver->getVarValue(var, true); - Assert (!value.isNull() || !fullModel); + Assert(!value.isNull() || !fullModel); // may be a shared term that did not appear in the current assertions // AJR: need to check whether already in map for cases where collectModelInfo is called multiple times in the same context if (!value.isNull() && !d_modelMap->hasSubstitution(var)) { Debug("bitvector-model") << " " << var << " => " << value << "\n"; - Assert (value.getKind() == kind::CONST_BITVECTOR); + Assert(value.getKind() == kind::CONST_BITVECTOR); d_modelMap->addSubstitution(var, value); } } @@ -763,7 +763,7 @@ bool AlgebraicSolver::collectModelInfo(TheoryModel* model, bool fullModel) TNode subst = Rewriter::rewrite(d_modelMap->apply(current)); Debug("bitvector-model") << "AlgebraicSolver: " << variables[i] << " => " << subst << "\n"; // Doesn't have to be constant as it may be irrelevant - Assert (subst.getKind() == kind::CONST_BITVECTOR); + Assert(subst.getKind() == kind::CONST_BITVECTOR); if (!model->assertEquality(variables[i], subst, true)) { return false; @@ -860,16 +860,16 @@ void ExtractSkolemizer::skolemize(std::vector<WorklistElement>& facts) { std::vector<Node> skolems; for (unsigned i = 0; i < cuts.size(); ++i) { current = cuts[i]; - Assert (current > 0); + Assert(current > 0); int size = current - previous; - Assert (size > 0); + Assert(size > 0); Node sk = utils::mkVar(size); skolems.push_back(sk); previous = current; } if (current < bw -1) { int size = bw - current; - Assert (size > 0); + Assert(size > 0); Node sk = utils::mkVar(size); skolems.push_back(sk); } @@ -880,7 +880,7 @@ void ExtractSkolemizer::skolemize(std::vector<WorklistElement>& facts) { } Node skolem_concat = skolems.size() == 1 ? (Node)skolems[0] : (Node) skolem_nb; - Assert (utils::getSize(skolem_concat) == utils::getSize(var)); + Assert(utils::getSize(skolem_concat) == utils::getSize(var)); storeSkolem(var, skolem_concat); for (unsigned i = 0; i < el.extracts.size(); ++i) { @@ -888,8 +888,8 @@ void ExtractSkolemizer::skolemize(std::vector<WorklistElement>& facts) { unsigned l = el.extracts[i].low; Node extract = utils::mkExtract(var, h, l); Node skolem_extract = Rewriter::rewrite(utils::mkExtract(skolem_concat, h, l)); - Assert (skolem_extract.getMetaKind() == kind::metakind::VARIABLE || - skolem_extract.getKind() == kind::BITVECTOR_CONCAT); + Assert(skolem_extract.getMetaKind() == kind::metakind::VARIABLE + || skolem_extract.getKind() == kind::BITVECTOR_CONCAT); storeSkolem(extract, skolem_extract); } } @@ -900,9 +900,9 @@ void ExtractSkolemizer::skolemize(std::vector<WorklistElement>& facts) { } Node ExtractSkolemizer::mkSkolem(Node node) { - Assert (node.getKind() == kind::BITVECTOR_EXTRACT && - node[0].getMetaKind() == kind::metakind::VARIABLE); - Assert (!d_skolemSubst.hasSubstitution(node)); + Assert(node.getKind() == kind::BITVECTOR_EXTRACT + && node[0].getMetaKind() == kind::metakind::VARIABLE); + Assert(!d_skolemSubst.hasSubstitution(node)); return utils::mkVar(utils::getSize(node)); } @@ -933,7 +933,7 @@ void ExtractSkolemizer::ExtractList::addExtract(Extract& e) { } void ExtractSkolemizer::storeExtract(TNode var, unsigned high, unsigned low) { - Assert (var.getMetaKind() == kind::metakind::VARIABLE); + Assert(var.getMetaKind() == kind::metakind::VARIABLE); if (d_varToExtract.find(var) == d_varToExtract.end()) { d_varToExtract[var] = ExtractList(utils::getSize(var)); } @@ -982,7 +982,7 @@ Node mergeExplanations(const std::vector<Node>& expls) { TNodeSet literals; for (unsigned i = 0; i < expls.size(); ++i) { TNode expl = expls[i]; - Assert (expl.getType().isBoolean()); + Assert(expl.getType().isBoolean()); if (expl.getKind() == kind::AND) { for (unsigned i = 0; i < expl.getNumChildren(); ++i) { TNode child = expl[i]; diff --git a/src/theory/bv/bv_subtheory_algebraic.h b/src/theory/bv/bv_subtheory_algebraic.h index 7f38b1563..de75ad859 100644 --- a/src/theory/bv/bv_subtheory_algebraic.h +++ b/src/theory/bv/bv_subtheory_algebraic.h @@ -228,7 +228,7 @@ public: bool check(Theory::Effort e) override; void explain(TNode literal, std::vector<TNode>& assumptions) override { - Unreachable("AlgebraicSolver does not propagate.\n"); + Unreachable() << "AlgebraicSolver does not propagate.\n"; } EqualityStatus getEqualityStatus(TNode a, TNode b) override; bool collectModelInfo(TheoryModel* m, bool fullModel) override; diff --git a/src/theory/bv/bv_subtheory_core.cpp b/src/theory/bv/bv_subtheory_core.cpp index f809c38c0..bf9bfa480 100644 --- a/src/theory/bv/bv_subtheory_core.cpp +++ b/src/theory/bv/bv_subtheory_core.cpp @@ -86,7 +86,7 @@ void CoreSolver::setMasterEqualityEngine(eq::EqualityEngine* eq) { } void CoreSolver::enableSlicer() { - AlwaysAssert (!d_preregisterCalled); + AlwaysAssert(!d_preregisterCalled); d_useSlicer = true; d_statistics.d_slicerEnabled.setData(true); } @@ -97,7 +97,7 @@ void CoreSolver::preRegister(TNode node) { d_equalityEngine.addTriggerEquality(node); if (d_useSlicer) { d_slicer->processEquality(node); - AlwaysAssert(!d_checkCalled); + AlwaysAssert(!d_checkCalled); } } else { d_equalityEngine.addTerm(node); @@ -137,8 +137,8 @@ bool CoreSolver::decomposeFact(TNode fact) { Node new_a = getBaseDecomposition(a); Node new_b = getBaseDecomposition(b); - Assert (utils::getSize(new_a) == utils::getSize(new_b) && - utils::getSize(new_a) == utils::getSize(a)); + Assert(utils::getSize(new_a) == utils::getSize(new_b) + && utils::getSize(new_a) == utils::getSize(a)); NodeManager* nm = NodeManager::currentNM(); Node a_eq_new_a = nm->mkNode(kind::EQUAL, a, new_a); @@ -157,8 +157,7 @@ bool CoreSolver::decomposeFact(TNode fact) { // a_i == b_i if (new_a.getKind() == kind::BITVECTOR_CONCAT && new_b.getKind() == kind::BITVECTOR_CONCAT) { - - Assert (new_a.getNumChildren() == new_b.getNumChildren()); + Assert(new_a.getNumChildren() == new_b.getNumChildren()); for (unsigned i = 0; i < new_a.getNumChildren(); ++i) { Node eq_i = nm->mkNode(kind::EQUAL, new_a[i], new_b[i]); ok = assertFactToEqualityEngine(eq_i, fact); @@ -174,8 +173,8 @@ bool CoreSolver::check(Theory::Effort e) { d_bv->spendResource(options::theoryCheckStep()); - d_checkCalled = true; - Assert (!d_bv->inConflict()); + d_checkCalled = true; + Assert(!d_bv->inConflict()); ++(d_statistics.d_numCallstoCheck); bool ok = true; std::vector<Node> core_eqs; @@ -413,7 +412,7 @@ void CoreSolver::conflict(TNode a, TNode b) { } void CoreSolver::eqNotifyNewClass(TNode t) { - Assert( d_bv->getExtTheory()!=NULL ); + Assert(d_bv->getExtTheory() != NULL); d_bv->getExtTheory()->registerTerm( t ); } @@ -460,7 +459,7 @@ bool CoreSolver::collectModelInfo(TheoryModel* m, bool fullModel) Node CoreSolver::getModelValue(TNode var) { Debug("bitvector-model") << "CoreSolver::getModelValue (" << var <<")"; - Assert (isComplete()); + Assert(isComplete()); TNode repr = d_equalityEngine.getRepresentative(var); Node result = Node(); if (repr.getKind() == kind::CONST_BITVECTOR) { diff --git a/src/theory/bv/bv_subtheory_inequality.cpp b/src/theory/bv/bv_subtheory_inequality.cpp index b527eada4..332f96aa2 100644 --- a/src/theory/bv/bv_subtheory_inequality.cpp +++ b/src/theory/bv/bv_subtheory_inequality.cpp @@ -182,22 +182,20 @@ bool InequalitySolver::isInequalityOnly(TNode node) { } void InequalitySolver::explain(TNode literal, std::vector<TNode>& assumptions) { - Assert (d_explanations.find(literal) != d_explanations.end()); + Assert(d_explanations.find(literal) != d_explanations.end()); TNode explanation = d_explanations[literal]; assumptions.push_back(explanation); Debug("bv-inequality-explain") << "InequalitySolver::explain " << literal << " with " << explanation <<"\n"; } -void InequalitySolver::propagate(Theory::Effort e) { - Assert (false); -} +void InequalitySolver::propagate(Theory::Effort e) { Assert(false); } bool InequalitySolver::collectModelInfo(TheoryModel* m, bool fullModel) { Debug("bitvector-model") << "InequalitySolver::collectModelInfo \n"; std::vector<Node> model; d_inequalityGraph.getAllValuesInModel(model); for (unsigned i = 0; i < model.size(); ++i) { - Assert (model[i].getKind() == kind::EQUAL); + Assert(model[i].getKind() == kind::EQUAL); if (!m->assertEquality(model[i][0], model[i][1], true)) { return false; @@ -207,12 +205,12 @@ bool InequalitySolver::collectModelInfo(TheoryModel* m, bool fullModel) } Node InequalitySolver::getModelValue(TNode var) { - Assert (isInequalityOnly(var)); + Assert(isInequalityOnly(var)); Debug("bitvector-model") << "InequalitySolver::getModelValue (" << var <<")"; - Assert (isComplete()); + Assert(isComplete()); Node result = Node(); if (!d_inequalityGraph.hasValueInModel(var)) { - Assert (d_bv->isSharedTerm(var)); + Assert(d_bv->isSharedTerm(var)); } else { BitVector val = d_inequalityGraph.getValueInModel(var); result = utils::mkConst(val); diff --git a/src/theory/bv/slicer.cpp b/src/theory/bv/slicer.cpp index e633792d8..0ffd58d5a 100644 --- a/src/theory/bv/slicer.cpp +++ b/src/theory/bv/slicer.cpp @@ -58,7 +58,7 @@ Base::Base(uint32_t size) : d_size(size), d_repr(size/32 + (size % 32 == 0? 0 : 1), 0) { - Assert (d_size > 0); + Assert(d_size > 0); } void Base::sliceAt(Index index) @@ -73,7 +73,7 @@ void Base::sliceAt(Index index) } void Base::sliceWith(const Base& other) { - Assert (d_size == other.d_size); + Assert(d_size == other.d_size); for (unsigned i = 0; i < d_repr.size(); ++i) { d_repr[i] = d_repr[i] | other.d_repr[i]; } @@ -86,7 +86,7 @@ bool Base::isCutPoint (Index index) const return true; Index vector_index = index / 32; - Assert (vector_index < d_size); + Assert(vector_index < d_size); Index int_index = index % 32; uint32_t bit_mask = 1u << int_index; @@ -94,9 +94,9 @@ bool Base::isCutPoint (Index index) const } void Base::diffCutPoints(const Base& other, Base& res) const { - Assert (d_size == other.d_size && res.d_size == d_size); + Assert(d_size == other.d_size && res.d_size == d_size); for (unsigned i = 0; i < d_repr.size(); ++i) { - Assert (res.d_repr[i] == 0); + Assert(res.d_repr[i] == 0); res.d_repr[i] = d_repr[i] ^ other.d_repr[i]; } } @@ -144,7 +144,7 @@ std::string ExtractTerm::debugPrint() const { */ std::pair<TermId, Index> NormalForm::getTerm(Index index, const UnionFind& uf) const { - Assert (index < base.getBitwidth()); + Assert(index < base.getBitwidth()); Index count = 0; for (unsigned i = 0; i < decomp.size(); ++i) { Index size = uf.getBitwidth(decomp[i]); @@ -207,17 +207,17 @@ TermId UnionFind::addTerm(Index bitwidth) { void UnionFind::unionTerms(const ExtractTerm& t1, const ExtractTerm& t2) { Debug("bv-slicer") << "UnionFind::unionTerms " << t1.debugPrint() << " and \n" << " " << t2.debugPrint() << endl; - Assert (t1.getBitwidth() == t2.getBitwidth()); - + Assert(t1.getBitwidth() == t2.getBitwidth()); + NormalForm nf1(t1.getBitwidth()); NormalForm nf2(t2.getBitwidth()); getNormalForm(t1, nf1); getNormalForm(t2, nf2); - Assert (nf1.decomp.size() == nf2.decomp.size()); - Assert (nf1.base == nf2.base); - + Assert(nf1.decomp.size() == nf2.decomp.size()); + Assert(nf1.base == nf2.base); + for (unsigned i = 0; i < nf1.decomp.size(); ++i) { merge (nf1.decomp[i], nf2.decomp[i]); } @@ -239,7 +239,7 @@ void UnionFind::merge(TermId t1, TermId t2) { if (t1 == t2) return; - Assert (! hasChildren(t1) && ! hasChildren(t2)); + Assert(!hasChildren(t1) && !hasChildren(t2)); setRepr(t1, t2); d_representatives.erase(t1); d_statistics.d_numRepresentatives += -1; @@ -271,7 +271,7 @@ void UnionFind::split(TermId id, Index i) { // nothing to do return; } - Assert (i < getBitwidth(id)); + Assert(i < getBitwidth(id)); if (!hasChildren(id)) { // first time we split this term TermId bottom_id = addTerm(i); @@ -303,13 +303,12 @@ void UnionFind::getNormalForm(const ExtractTerm& term, NormalForm& nf) { void UnionFind::getDecomposition(const ExtractTerm& term, Decomposition& decomp) { // making sure the term is aligned - TermId id = find(term.id); + TermId id = find(term.id); - Assert (term.high < getBitwidth(id)); + Assert(term.high < getBitwidth(id)); // because we split the node, this must be the whole extract if (!hasChildren(id)) { - Assert (term.high == getBitwidth(id) - 1 && - term.low == 0); + Assert(term.high == getBitwidth(id) - 1 && term.low == 0); decomp.push_back(id); return; } @@ -380,9 +379,9 @@ void UnionFind::handleCommonSlice(const Decomposition& decomp1, const Decomposit if (start2 - start1 < common_size) { Index overlap = start1 + common_size - start2; - Assert (overlap > 0); + Assert(overlap > 0); Index diff = common_size - overlap; - Assert (diff >= 0); + Assert(diff >= 0); Index granularity = gcd(diff, overlap); // split the common part for (unsigned i = 0; i < common_size; i+= granularity) { @@ -401,7 +400,7 @@ void UnionFind::alignSlicings(const ExtractTerm& term1, const ExtractTerm& term2 getNormalForm(term1, nf1); getNormalForm(term2, nf2); - Assert (nf1.base.getBitwidth() == nf2.base.getBitwidth()); + Assert(nf1.base.getBitwidth() == nf2.base.getBitwidth()); // first check if the two have any common slices std::vector<TermId> intersection; @@ -480,8 +479,8 @@ ExtractTerm Slicer::registerTerm(TNode node) { void Slicer::processEquality(TNode eq) { Debug("bv-slicer") << "Slicer::processEquality: " << eq << endl; - - Assert (eq.getKind() == kind::EQUAL); + + Assert(eq.getKind() == kind::EQUAL); TNode a = eq[0]; TNode b = eq[1]; ExtractTerm a_ex= registerTerm(a); @@ -508,7 +507,7 @@ void Slicer::getBaseDecomposition(TNode node, std::vector<Node>& decomp) { low = utils::getExtractLow(node); top = node[0]; } - AlwaysAssert (d_nodeToId.find(top) != d_nodeToId.end()); + AlwaysAssert(d_nodeToId.find(top) != d_nodeToId.end()); TermId id = d_nodeToId[top]; NormalForm nf(high-low+1); d_unionFind.getNormalForm(ExtractTerm(id, high, low), nf); diff --git a/src/theory/bv/slicer.h b/src/theory/bv/slicer.h index 3ddbcaf36..88ac0debb 100644 --- a/src/theory/bv/slicer.h +++ b/src/theory/bv/slicer.h @@ -91,7 +91,7 @@ struct ExtractTerm { high(h), low(l) { - Assert (h >= l && id != UndefinedId); + Assert(h >= l && id != UndefinedId); } Index getBitwidth() const { return high - low + 1; } std::string debugPrint() const; @@ -138,15 +138,15 @@ class UnionFind { bool hasChildren() const { return d_ch1 != UndefinedId && d_ch0 != UndefinedId; } TermId getChild(Index i) const { - Assert (i < 2); + Assert(i < 2); return i == 0? d_ch0 : d_ch1; } void setRepr(TermId id) { - Assert (! hasChildren()); + Assert(!hasChildren()); d_repr = id; } void setChildren(TermId ch1, TermId ch0) { - Assert (d_repr == UndefinedId && !hasChildren()); + Assert(d_repr == UndefinedId && !hasChildren()); d_ch1 = ch1; d_ch0 = ch0; } @@ -162,27 +162,28 @@ class UnionFind { void handleCommonSlice(const Decomposition& d1, const Decomposition& d2, TermId common); /// getter methods for the internal nodes TermId getRepr(TermId id) const { - Assert (id < d_nodes.size()); + Assert(id < d_nodes.size()); return d_nodes[id].getRepr(); } TermId getChild(TermId id, Index i) const { - Assert (id < d_nodes.size()); + Assert(id < d_nodes.size()); return d_nodes[id].getChild(i); } Index getCutPoint(TermId id) const { return getBitwidth(getChild(id, 0)); } bool hasChildren(TermId id) const { - Assert (id < d_nodes.size()); + Assert(id < d_nodes.size()); return d_nodes[id].hasChildren(); } /// setter methods for the internal nodes void setRepr(TermId id, TermId new_repr) { - Assert (id < d_nodes.size()); + Assert(id < d_nodes.size()); d_nodes[id].setRepr(new_repr); } void setChildren(TermId id, TermId ch1, TermId ch0) { - Assert (id < d_nodes.size() && getBitwidth(id) == getBitwidth(ch1) + getBitwidth(ch0)); + Assert(id < d_nodes.size() + && getBitwidth(id) == getBitwidth(ch1) + getBitwidth(ch0)); d_nodes[id].setChildren(ch1, ch0); } @@ -218,7 +219,7 @@ public: void alignSlicings(const ExtractTerm& term1, const ExtractTerm& term2); void ensureSlicing(const ExtractTerm& term); Index getBitwidth(TermId id) const { - Assert (id < d_nodes.size()); + Assert(id < d_nodes.size()); return d_nodes[id].getBitwidth(); } std::string debugPrint(TermId id); diff --git a/src/theory/bv/theory_bv.cpp b/src/theory/bv/theory_bv.cpp index b7e52205f..23ffabcd1 100644 --- a/src/theory/bv/theory_bv.cpp +++ b/src/theory/bv/theory_bv.cpp @@ -336,7 +336,7 @@ void TheoryBV::check(Effort e) std::vector<TNode> assertions; while (!done()) { TNode fact = get().assertion; - Assert (fact.getKind() == kind::BITVECTOR_EAGER_ATOM); + Assert(fact.getKind() == kind::BITVECTOR_EAGER_ATOM); assertions.push_back(fact); d_eagerSolver->assertFormula(fact[0]); } @@ -379,13 +379,13 @@ void TheoryBV::check(Effort e) bool ok = true; bool complete = false; for (unsigned i = 0; i < d_subtheories.size(); ++i) { - Assert (!inConflict()); + Assert(!inConflict()); ok = d_subtheories[i]->check(e); complete = d_subtheories[i]->isComplete(); if (!ok) { // if we are in a conflict no need to check with other theories - Assert (inConflict()); + Assert(inConflict()); sendConflict(); return; } @@ -511,7 +511,7 @@ bool TheoryBV::doExtfReductions( std::vector< Node >& terms ) { if( getExtTheory()->doReductions( 0, terms, nredr ) ){ return true; } - Assert( nredr.empty() ); + Assert(nredr.empty()); return false; } @@ -873,7 +873,7 @@ bool TheoryBV::storePropagation(TNode literal, SubTheory subtheory) void TheoryBV::explain(TNode literal, std::vector<TNode>& assumptions) { - Assert (wasPropagatedBySubtheory(literal)); + Assert(wasPropagatedBySubtheory(literal)); SubTheory sub = getPropagatingSubtheory(literal); d_subtheoryMap[sub]->explain(literal, assumptions); } @@ -912,7 +912,7 @@ EqualityStatus TheoryBV::getEqualityStatus(TNode a, TNode b) { if (options::bitblastMode() == theory::bv::BITBLAST_MODE_EAGER) return EQUALITY_UNKNOWN; - Assert (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY); + Assert(options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY); for (unsigned i = 0; i < d_subtheories.size(); ++i) { EqualityStatus status = d_subtheories[i]->getEqualityStatus(a, b); if (status != EQUALITY_UNKNOWN) { @@ -924,7 +924,7 @@ EqualityStatus TheoryBV::getEqualityStatus(TNode a, TNode b) void TheoryBV::enableCoreTheorySlicer() { - Assert (!d_calledPreregister); + Assert(!d_calledPreregister); d_isCoreTheory = true; if (d_subtheoryMap.find(SUB_CORE) != d_subtheoryMap.end()) { CoreSolver* core = (CoreSolver*)d_subtheoryMap[SUB_CORE]; @@ -979,7 +979,7 @@ bool TheoryBV::applyAbstraction(const std::vector<Node>& assertions, std::vector options::bitblastMode() == theory::bv::BITBLAST_MODE_EAGER && options::bitvectorAig()) { // disable AIG mode - AlwaysAssert (!d_eagerSolver->isInitialized()); + AlwaysAssert(!d_eagerSolver->isInitialized()); d_eagerSolver->turnOffAig(); d_eagerSolver->initialize(); } diff --git a/src/theory/bv/theory_bv_rewrite_rules.h b/src/theory/bv/theory_bv_rewrite_rules.h index eefda524e..44ac14464 100644 --- a/src/theory/bv/theory_bv_rewrite_rules.h +++ b/src/theory/bv/theory_bv_rewrite_rules.h @@ -389,6 +389,7 @@ class RewriteRule { /** Actually apply the rewrite rule */ static inline Node apply(TNode node) { Unreachable(); + SuppressWrongNoReturnWarning; } public: @@ -408,8 +409,10 @@ public: } - static inline bool applies(TNode node) { + static inline bool applies(TNode node) + { Unreachable(); + SuppressWrongNoReturnWarning; } template<bool checkApplies> diff --git a/src/theory/bv/theory_bv_rewrite_rules_normalization.h b/src/theory/bv/theory_bv_rewrite_rules_normalization.h index cada3d30c..153f785ca 100644 --- a/src/theory/bv/theory_bv_rewrite_rules_normalization.h +++ b/src/theory/bv/theory_bv_rewrite_rules_normalization.h @@ -312,7 +312,7 @@ static inline void updateCoefMap(TNode current, unsigned size, break; } case kind::BITVECTOR_SUB: - // turn into a + (-1)*b + // turn into a + (-1)*b Assert(current.getNumChildren() == 2); addToCoefMap(factorToCoefficient, current[0], BitVector(size, (unsigned)1)); addToCoefMap(factorToCoefficient, current[1], -BitVector(size, (unsigned)1)); diff --git a/src/theory/bv/theory_bv_rewrite_rules_simplification.h b/src/theory/bv/theory_bv_rewrite_rules_simplification.h index 0e42886b5..c3e1b316c 100644 --- a/src/theory/bv/theory_bv_rewrite_rules_simplification.h +++ b/src/theory/bv/theory_bv_rewrite_rules_simplification.h @@ -308,7 +308,7 @@ Node RewriteRule<ShlByConst>::apply(TNode node) { // make sure we do not lose information casting Assert(amount < Integer(1).multiplyByPow2(32)); - + uint32_t uint32_amount = amount.toUnsignedInt(); Node left = utils::mkExtract(a, size - 1 - uint32_amount, 0); @@ -350,7 +350,7 @@ Node RewriteRule<LshrByConst>::apply(TNode node) { // make sure we do not lose information casting Assert(amount < Integer(1).multiplyByPow2(32)); - + uint32_t uint32_amount = amount.toUnsignedInt(); Node right = utils::mkExtract(a, size - 1, uint32_amount); Node left = utils::mkZero(uint32_amount); @@ -481,7 +481,7 @@ Node RewriteRule<AndOne>::apply(TNode node) { if (node[0] == utils::mkOnes(size)) { return node[1]; } else { - Assert (node[1] == utils::mkOnes(size)); + Assert(node[1] == utils::mkOnes(size)); return node[0]; } } @@ -1640,7 +1640,7 @@ Node RewriteRule<MergeSignExtend>::apply(TNode node) { Node res = nb; return res; } - Assert (node[0].getKind() == kind::BITVECTOR_SIGN_EXTEND); + Assert(node[0].getKind() == kind::BITVECTOR_SIGN_EXTEND); unsigned amount2 = node[0].getOperator().getConst<BitVectorSignExtend>().signExtendAmount; return utils::mkSignExtend(node[0][0], amount1 + amount2); diff --git a/src/theory/bv/theory_bv_type_rules.h b/src/theory/bv/theory_bv_type_rules.h index e56f752af..9d5c6f396 100644 --- a/src/theory/bv/theory_bv_type_rules.h +++ b/src/theory/bv/theory_bv_type_rules.h @@ -342,7 +342,8 @@ class IntToBitVectorOpTypeRule nodeManager->mkBitVectorType(bvSize)); } - InternalError("bv-conversion typerule invoked for non-bv-conversion kind"); + InternalError() + << "bv-conversion typerule invoked for non-bv-conversion kind"; } }; /* class IntToBitVectorOpTypeRule */ @@ -372,7 +373,8 @@ class BitVectorConversionTypeRule return nodeManager->mkBitVectorType(bvSize); } - InternalError("bv-conversion typerule invoked for non-bv-conversion kind"); + InternalError() + << "bv-conversion typerule invoked for non-bv-conversion kind"; } }; /* class BitVectorConversionTypeRule */ diff --git a/src/theory/bv/theory_bv_utils.cpp b/src/theory/bv/theory_bv_utils.cpp index f1cb197ab..c0df9f35c 100644 --- a/src/theory/bv/theory_bv_utils.cpp +++ b/src/theory/bv/theory_bv_utils.cpp @@ -287,9 +287,8 @@ Node mkVar(unsigned size) Node mkSortedNode(Kind kind, TNode child1, TNode child2) { - Assert(kind == kind::BITVECTOR_AND - || kind == kind::BITVECTOR_OR - || kind == kind::BITVECTOR_XOR); + Assert(kind == kind::BITVECTOR_AND || kind == kind::BITVECTOR_OR + || kind == kind::BITVECTOR_XOR); if (child1 < child2) { diff --git a/src/theory/bv/theory_bv_utils.h b/src/theory/bv/theory_bv_utils.h index 975796719..23eaab3f8 100644 --- a/src/theory/bv/theory_bv_utils.h +++ b/src/theory/bv/theory_bv_utils.h @@ -118,15 +118,10 @@ Node mkSortedNode(Kind kind, std::vector<Node>& children); template<bool ref_count> Node mkNaryNode(Kind k, const std::vector<NodeTemplate<ref_count>>& nodes) { - Assert (k == kind::AND - || k == kind::OR - || k == kind::XOR - || k == kind::BITVECTOR_AND - || k == kind::BITVECTOR_OR - || k == kind::BITVECTOR_XOR - || k == kind::BITVECTOR_PLUS - || k == kind::BITVECTOR_SUB - || k == kind::BITVECTOR_MULT); + Assert(k == kind::AND || k == kind::OR || k == kind::XOR + || k == kind::BITVECTOR_AND || k == kind::BITVECTOR_OR + || k == kind::BITVECTOR_XOR || k == kind::BITVECTOR_PLUS + || k == kind::BITVECTOR_SUB || k == kind::BITVECTOR_MULT); if (nodes.size() == 1) { return nodes[0]; } return NodeManager::currentNM()->mkNode(k, nodes); diff --git a/src/theory/datatypes/datatypes_sygus.cpp b/src/theory/datatypes/datatypes_sygus.cpp index b04686492..4cc9e4640 100644 --- a/src/theory/datatypes/datatypes_sygus.cpp +++ b/src/theory/datatypes/datatypes_sygus.cpp @@ -75,7 +75,7 @@ void SygusSymBreakNew::assertTester( int tindex, TNode n, Node exp, std::vector< }else{ //this must be a proper selector IntMap::const_iterator itt = d_testers.find( n[0] ); - Assert( itt!=d_testers.end() ); + Assert(itt != d_testers.end()); int ptindex = (*itt).second; TypeNode ptn = n[0].getType(); const Datatype& pdt = ((DatatypeType)ptn.toType()).getDatatype(); @@ -109,7 +109,7 @@ void SygusSymBreakNew::assertFact( Node n, bool polarity, std::vector< Node >& l if( options::sygusFair()==SYGUS_FAIR_DT_SIZE ){ std::map<Node, std::unique_ptr<SygusSizeDecisionStrategy>>::iterator its = d_szinfo.find(m); - Assert( its!=d_szinfo.end() ); + Assert(its != d_szinfo.end()); Node mt = its->second->getOrMkMeasureValue(lemmas); //it relates the measure term to arithmetic Node blem = n.eqNode( NodeManager::currentNM()->mkNode( kind::LEQ, mt, n[1] ) ); @@ -233,13 +233,13 @@ void SygusSymBreakNew::assertTesterInternal( int tindex, TNode n, Node exp, std: << std::endl; // get the search size for this - Assert( d_term_to_anchor.find( n )!=d_term_to_anchor.end() ); + Assert(d_term_to_anchor.find(n) != d_term_to_anchor.end()); Node a = d_term_to_anchor[n]; - Assert( d_anchor_to_measure_term.find( a )!=d_anchor_to_measure_term.end() ); + Assert(d_anchor_to_measure_term.find(a) != d_anchor_to_measure_term.end()); Node m = d_anchor_to_measure_term[a]; std::map<Node, std::unique_ptr<SygusSizeDecisionStrategy>>::iterator itsz = d_szinfo.find(m); - Assert( itsz!=d_szinfo.end() ); + Assert(itsz != d_szinfo.end()); unsigned ssz = itsz->second->d_curr_search_size; if( options::sygusFair()==SYGUS_FAIR_DIRECT ){ @@ -248,7 +248,7 @@ void SygusSymBreakNew::assertTesterInternal( int tindex, TNode n, Node exp, std: // consider lower bounds for size of types unsigned lb_add = nti.getMinConsTermSize(tindex); unsigned lb_rem = n == a ? 0 : nti.getMinTermSize(); - Assert( lb_add>=lb_rem ); + Assert(lb_add >= lb_rem); d_currTermSize[a].set( d_currTermSize[a].get() + ( lb_add - lb_rem ) ); } if( (unsigned)d_currTermSize[a].get()>ssz ){ @@ -264,18 +264,19 @@ void SygusSymBreakNew::assertTesterInternal( int tindex, TNode n, Node exp, std: Node xa = d_term_to_anchor[x]; if( xa==a ){ IntMap::const_iterator ittv = d_testers.find( x ); - Assert( ittv != d_testers.end() ); + Assert(ittv != d_testers.end()); int tindex = (*ittv).second; const Datatype& dti = ((DatatypeType)x.getType().toType()).getDatatype(); if( dti[tindex].getNumArgs()>0 ){ NodeMap::const_iterator itt = d_testers_exp.find( x ); - Assert( itt != d_testers_exp.end() ); + Assert(itt != d_testers_exp.end()); conflict.push_back( (*itt).second ); } } } - Assert( conflict.size()==(unsigned)d_currTermSize[a].get() ); - Assert( itsz->second->d_search_size_exp.find( ssz )!=itsz->second->d_search_size_exp.end() ); + Assert(conflict.size() == (unsigned)d_currTermSize[a].get()); + Assert(itsz->second->d_search_size_exp.find(ssz) + != itsz->second->d_search_size_exp.end()); conflict.push_back( itsz->second->d_search_size_exp[ssz] ); Node conf = NodeManager::currentNM()->mkNode( kind::AND, conflict ); Trace("sygus-sb-fair") << "Conflict is : " << conf << std::endl; @@ -285,7 +286,7 @@ void SygusSymBreakNew::assertTesterInternal( int tindex, TNode n, Node exp, std: } // now, add all applicable symmetry breaking lemmas for this term - Assert( d_term_to_depth.find( n )!=d_term_to_depth.end() ); + Assert(d_term_to_depth.find(n) != d_term_to_depth.end()); unsigned d = d_term_to_depth[n]; Trace("sygus-sb-fair-debug") << "Tester " << exp << " is for depth " << d << " term in search size " << ssz << std::endl; //Assert( d<=ssz ); @@ -367,10 +368,10 @@ void SygusSymBreakNew::assertTesterInternal( int tindex, TNode n, Node exp, std: for( unsigned j=0; j<dt[tindex].getNumArgs(); j++ ){ Node sel = NodeManager::currentNM()->mkNode( APPLY_SELECTOR_TOTAL, Node::fromExpr( dt[tindex].getSelectorInternal( ntn.toType(), j ) ), n ); Trace("sygus-sb-debug2") << " activate child sel : " << sel << std::endl; - Assert( d_active_terms.find( sel )==d_active_terms.end() ); + Assert(d_active_terms.find(sel) == d_active_terms.end()); IntMap::const_iterator itt = d_testers.find( sel ); if( itt != d_testers.end() ){ - Assert( d_testers_exp.find( sel ) != d_testers_exp.end() ); + Assert(d_testers_exp.find(sel) != d_testers_exp.end()); assertTesterInternal( (*itt).second, sel, d_testers_exp[sel], lemmas ); } } @@ -401,14 +402,14 @@ Node SygusSymBreakNew::getRelevancyCondition( Node n ) { excl = true; } } - Assert( !disj.empty() ); + Assert(!disj.empty()); if( excl ){ cond = disj.size() == 1 ? disj[0] : NodeManager::currentNM()->mkNode( kind::AND, disj); } }else{ int sindex = Datatype::cindexOf( selExpr ); - Assert( sindex!=-1 ); + Assert(sindex != -1); cond = utils::mkTester(n[0], sindex, dt).negate(); } Node c1 = getRelevancyCondition( n[0] ); @@ -946,9 +947,9 @@ void SygusSymBreakNew::registerSearchTerm( TypeNode tn, unsigned d, Node n, bool //register this term std::unordered_map<Node, Node, NodeHashFunction>::iterator ita = d_term_to_anchor.find(n); - Assert( ita != d_term_to_anchor.end() ); + Assert(ita != d_term_to_anchor.end()); Node a = ita->second; - Assert( !a.isNull() ); + Assert(!a.isNull()); if( std::find( d_cache[a].d_search_terms[tn][d].begin(), d_cache[a].d_search_terms[tn][d].end(), n )==d_cache[a].d_search_terms[tn][d].end() ){ Trace("sygus-sb-debug") << " register search term : " << n << " at depth " << d << ", type=" << tn << ", tl=" << topLevel << std::endl; d_cache[a].d_search_terms[tn][d].push_back( n ); @@ -1068,7 +1069,8 @@ Node SygusSymBreakNew::registerSearchValue(Node a, if( !bvr_equiv.isNull() ){ if( bvr_equiv!=bvr ){ Trace("sygus-sb-debug") << "......adding search val for " << bvr << " returned " << bvr_equiv << std::endl; - Assert( d_cache[a].d_search_val[tn].find( bvr_equiv )!=d_cache[a].d_search_val[tn].end() ); + Assert(d_cache[a].d_search_val[tn].find(bvr_equiv) + != d_cache[a].d_search_val[tn].end()); Trace("sygus-sb-debug") << "......search value was " << d_cache[a].d_search_val[tn][bvr_equiv] << std::endl; if( Trace.isOn("sygus-sb-exc") ){ Node prev = d_tds->sygusToBuiltin( d_cache[a].d_search_val[tn][bvr_equiv], tn ); @@ -1110,7 +1112,8 @@ Node SygusSymBreakNew::registerSearchValue(Node a, if( !bad_val_bvr.isNull() ){ Node bad_val = nv; Node bad_val_o = d_cache[a].d_search_val[tn][bad_val_bvr]; - Assert( d_cache[a].d_search_val_sz[tn].find( bad_val_bvr )!=d_cache[a].d_search_val_sz[tn].end() ); + Assert(d_cache[a].d_search_val_sz[tn].find(bad_val_bvr) + != d_cache[a].d_search_val_sz[tn].end()); unsigned prev_sz = d_cache[a].d_search_val_sz[tn][bad_val_bvr]; bool doFlip = (prev_sz > sz); if (doFlip) @@ -1137,8 +1140,8 @@ Node SygusSymBreakNew::registerSearchValue(Node a, Trace("sygus-sb-exc") << " (by examples)"; } Trace("sygus-sb-exc") << std::endl; - } - Assert( d_tds->getSygusTermSize( bad_val )==sz ); + } + Assert(d_tds->getSygusTermSize(bad_val) == sz); // generalize the explanation for why the analog of bad_val // is equivalent to bvr @@ -1192,7 +1195,7 @@ void SygusSymBreakNew::registerSymBreakLemma( TypeNode tn, Node lem, unsigned sz Trace("sygus-sb-debug") << " anchor : " << a << std::endl; Trace("sygus-sb-debug") << " type : " << tn << std::endl; Trace("sygus-sb-debug") << " size : " << sz << std::endl; - Assert( !a.isNull() ); + Assert(!a.isNull()); d_cache[a].d_sb_lemmas[tn][sz].push_back( lem ); TNode x = getFreeVar( tn ); unsigned csz = getSearchSizeForAnchor( a ); @@ -1219,14 +1222,14 @@ void SygusSymBreakNew::registerSymBreakLemma( TypeNode tn, Node lem, unsigned sz } } void SygusSymBreakNew::addSymBreakLemmasFor( TypeNode tn, Node t, unsigned d, std::vector< Node >& lemmas ) { - Assert( d_term_to_anchor.find( t )!=d_term_to_anchor.end() ); + Assert(d_term_to_anchor.find(t) != d_term_to_anchor.end()); Node a = d_term_to_anchor[t]; addSymBreakLemmasFor( tn, t, d, a, lemmas ); } void SygusSymBreakNew::addSymBreakLemmasFor( TypeNode tn, Node t, unsigned d, Node a, std::vector< Node >& lemmas ) { - Assert( t.getType()==tn ); - Assert( !a.isNull() ); + Assert(t.getType() == tn); + Assert(!a.isNull()); Trace("sygus-sb-debug2") << "add sym break lemmas for " << t << " " << d << " " << a << std::endl; std::map< TypeNode, std::map< unsigned, std::vector< Node > > >::iterator its = d_cache[a].d_sb_lemmas.find( tn ); @@ -1398,28 +1401,26 @@ void SygusSymBreakNew::registerMeasureTerm( Node m ) { void SygusSymBreakNew::notifySearchSize( Node m, unsigned s, Node exp, std::vector< Node >& lemmas ) { std::map<Node, std::unique_ptr<SygusSizeDecisionStrategy>>::iterator its = d_szinfo.find(m); - Assert( its!=d_szinfo.end() ); + Assert(its != d_szinfo.end()); if( its->second->d_search_size.find( s )==its->second->d_search_size.end() ){ its->second->d_search_size[s] = true; its->second->d_search_size_exp[s] = exp; - Assert( s==0 || its->second->d_search_size.find( s-1 )!=its->second->d_search_size.end() ); + Assert(s == 0 + || its->second->d_search_size.find(s - 1) + != its->second->d_search_size.end()); Trace("sygus-fair") << "SygusSymBreakNew:: now considering term measure : " << s << " for " << m << std::endl; - Assert( s>=its->second->d_curr_search_size ); + Assert(s >= its->second->d_curr_search_size); while( s>its->second->d_curr_search_size ){ incrementCurrentSearchSize( m, lemmas ); } Trace("sygus-fair") << "...finish increment for term measure : " << s << std::endl; /* //re-add all testers (some may now be relevant) TODO - for( IntMap::const_iterator it = d_testers.begin(); it != d_testers.end(); ++it ){ - Node n = (*it).first; - NodeMap::const_iterator itx = d_testers_exp.find( n ); - if( itx!=d_testers_exp.end() ){ - int tindex = (*it).second; - Node exp = (*itx).second; - assertTester( tindex, n, exp, lemmas ); - }else{ - Assert( false ); + for( IntMap::const_iterator it = d_testers.begin(); it != d_testers.end(); + ++it ){ Node n = (*it).first; NodeMap::const_iterator itx = + d_testers_exp.find( n ); if( itx!=d_testers_exp.end() ){ int tindex = + (*it).second; Node exp = (*itx).second; assertTester( tindex, n, exp, lemmas + ); }else{ Assert( false ); } } */ @@ -1430,14 +1431,14 @@ unsigned SygusSymBreakNew::getSearchSizeFor( Node n ) { Trace("sygus-sb-debug2") << "get search size for term : " << n << std::endl; std::unordered_map<Node, Node, NodeHashFunction>::iterator ita = d_term_to_anchor.find(n); - Assert( ita != d_term_to_anchor.end() ); + Assert(ita != d_term_to_anchor.end()); return getSearchSizeForAnchor( ita->second ); } unsigned SygusSymBreakNew::getSearchSizeForAnchor( Node a ) { Trace("sygus-sb-debug2") << "get search size for anchor : " << a << std::endl; std::map< Node, Node >::iterator it = d_anchor_to_measure_term.find( a ); - Assert( it!=d_anchor_to_measure_term.end() ); + Assert(it != d_anchor_to_measure_term.end()); return getSearchSizeForMeasureTerm(it->second); } @@ -1446,14 +1447,14 @@ unsigned SygusSymBreakNew::getSearchSizeForMeasureTerm(Node m) Trace("sygus-sb-debug2") << "get search size for measure : " << m << std::endl; std::map<Node, std::unique_ptr<SygusSizeDecisionStrategy>>::iterator its = d_szinfo.find(m); - Assert( its!=d_szinfo.end() ); + Assert(its != d_szinfo.end()); return its->second->d_curr_search_size; } void SygusSymBreakNew::incrementCurrentSearchSize( Node m, std::vector< Node >& lemmas ) { std::map<Node, std::unique_ptr<SygusSizeDecisionStrategy>>::iterator itsz = d_szinfo.find(m); - Assert( itsz!=d_szinfo.end() ); + Assert(itsz != d_szinfo.end()); itsz->second->d_curr_search_size++; Trace("sygus-fair") << " register search size " << itsz->second->d_curr_search_size << " for " << m << std::endl; NodeManager* nm = NodeManager::currentNM(); @@ -1461,7 +1462,7 @@ void SygusSymBreakNew::incrementCurrentSearchSize( Node m, std::vector< Node >& Node a = itc->first; Trace("sygus-fair-debug") << " look at anchor " << a << "..." << std::endl; // check whether a is bounded by m - Assert( d_anchor_to_measure_term.find( a )!=d_anchor_to_measure_term.end() ); + Assert(d_anchor_to_measure_term.find(a) != d_anchor_to_measure_term.end()); if( d_anchor_to_measure_term[a]==m ){ for( std::map< TypeNode, std::map< unsigned, std::vector< Node > > >::iterator its = itc->second.d_sb_lemmas.begin(); its != itc->second.d_sb_lemmas.end(); ++its ){ @@ -1583,7 +1584,7 @@ void SygusSymBreakNew::check( std::vector< Node >& lemmas ) { Trace("sygus-sb") << " Mv[" << prog << "] = " << progv << ", size = " << prog_szv << std::endl; if( prog_szv.getConst<Rational>().getNumerator().toUnsignedInt() > getSearchSizeForAnchor( prog ) ){ - AlwaysAssert( false ); + AlwaysAssert(false); Node szlem = NodeManager::currentNM()->mkNode( kind::OR, prog.eqNode( progv ).negate(), prog_sz.eqNode( progv_sz ) ); Trace("sygus-sb-warn") << "SygusSymBreak : WARNING : adding size correction : " << szlem << std::endl; @@ -1695,7 +1696,7 @@ bool SygusSymBreakNew::checkValue(Node n, Trace("sygus-sb") << " SygusSymBreakNew::check: ...WARNING: considered " "missing split for " << n << "." << std::endl; - Assert( !split.isNull() ); + Assert(!split.isNull()); lemmas.push_back( split ); return false; } @@ -1717,11 +1718,11 @@ Node SygusSymBreakNew::getCurrentTemplate( Node n, std::map< TypeNode, int >& va if( d_active_terms.find( n )!=d_active_terms.end() ){ TypeNode tn = n.getType(); IntMap::const_iterator it = d_testers.find( n ); - Assert( it != d_testers.end() ); + Assert(it != d_testers.end()); const Datatype& dt = ((DatatypeType)tn.toType()).getDatatype(); int tindex = (*it).second; - Assert( tindex>=0 ); - Assert( tindex<(int)dt.getNumConstructors() ); + Assert(tindex >= 0); + Assert(tindex < (int)dt.getNumConstructors()); std::vector< Node > children; children.push_back( Node::fromExpr( dt[tindex].getConstructor() ) ); for( unsigned i=0; i<dt[tindex].getNumArgs(); i++ ){ diff --git a/src/theory/datatypes/theory_datatypes.cpp b/src/theory/datatypes/theory_datatypes.cpp index 3d178681e..8a34d8056 100644 --- a/src/theory/datatypes/theory_datatypes.cpp +++ b/src/theory/datatypes/theory_datatypes.cpp @@ -17,7 +17,7 @@ #include <map> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "expr/datatype.h" #include "expr/kind.h" #include "options/datatypes_options.h" @@ -138,11 +138,11 @@ void TheoryDatatypes::check(Effort e) { if (done() && e<EFFORT_FULL) { return; } - Assert( d_pending.empty() && d_pending_merge.empty() ); + Assert(d_pending.empty() && d_pending_merge.empty()); d_addedLemma = false; if( e == EFFORT_LAST_CALL ){ - Assert( d_sygus_sym_break ); + Assert(d_sygus_sym_break); std::vector< Node > lemmas; d_sygus_sym_break->check( lemmas ); doSendLemmas( lemmas ); @@ -161,10 +161,13 @@ void TheoryDatatypes::check(Effort e) { TNode atom CVC4_UNUSED = fact.getKind() == kind::NOT ? fact[0] : fact; // extra debug check to make sure that the rewriter did its job correctly - Assert( atom.getKind() != kind::EQUAL || - ( atom[0].getKind() != kind::TUPLE_UPDATE && atom[1].getKind() != kind::TUPLE_UPDATE && - atom[0].getKind() != kind::RECORD_UPDATE && atom[1].getKind() != kind::RECORD_UPDATE), - "tuple/record escaped into datatypes decision procedure; should have been rewritten away" ); + Assert(atom.getKind() != kind::EQUAL + || (atom[0].getKind() != kind::TUPLE_UPDATE + && atom[1].getKind() != kind::TUPLE_UPDATE + && atom[0].getKind() != kind::RECORD_UPDATE + && atom[1].getKind() != kind::RECORD_UPDATE)) + << "tuple/record escaped into datatypes decision procedure; should " + "have been rewritten away"; //assert the fact assertFact( fact, fact ); @@ -173,7 +176,7 @@ void TheoryDatatypes::check(Effort e) { if( e == EFFORT_FULL && !d_conflict && !d_addedLemma && !d_valuation.needCheck() ) { //check for cycles - Assert( d_pending.empty() && d_pending_merge.empty() ); + Assert(d_pending.empty() && d_pending_merge.empty()); do { d_addedFact = false; Trace("datatypes-proc") << "Check cycles..." << std::endl; @@ -301,7 +304,7 @@ void TheoryDatatypes::check(Effort e) { Trace("datatypes-infer") << "DtInfer : 1-cons (full) : " << t << std::endl; d_infer.push_back( t ); }else{ - Assert( consIndex!=-1 || dt.isSygus() ); + Assert(consIndex != -1 || dt.isSygus()); if( options::dtBinarySplit() && consIndex!=-1 ){ Node test = utils::mkTester(n, consIndex, dt); Trace("dt-split") << "*************Split for possible constructor " << dt[consIndex] << " for " << n << endl; @@ -436,7 +439,7 @@ void TheoryDatatypes::doPendingMerges(){ //do all pending merges int i=0; while( i<(int)d_pending_merge.size() ){ - Assert( d_pending_merge[i].getKind()==EQUAL ); + Assert(d_pending_merge[i].getKind() == EQUAL); merge( d_pending_merge[i][0], d_pending_merge[i][1] ); i++; } @@ -469,7 +472,7 @@ bool TheoryDatatypes::doSendLemmas( std::vector< Node >& lemmas ){ } void TheoryDatatypes::assertFact( Node fact, Node exp ){ - Assert( d_pending_merge.empty() ); + Assert(d_pending_merge.empty()); Trace("datatypes-debug") << "TheoryDatatypes::assertFact : " << fact << std::endl; bool polarity = fact.getKind() != kind::NOT; TNode atom = polarity ? fact : fact[0]; @@ -769,7 +772,7 @@ void TheoryDatatypes::explain(TNode literal, std::vector<TNode>& assumptions){ explain( atom[i], assumptions ); } } else { - Assert( atom.getKind()!=kind::AND ); + Assert(atom.getKind() != kind::AND); explainPredicate( atom, polarity, assumptions ); } } @@ -975,7 +978,7 @@ int TheoryDatatypes::getLabelIndex( EqcInfo* eqc, Node n ){ return -1; }else{ int tindex = utils::isTester(lbl); - Assert( tindex!=-1 ); + Assert(tindex != -1); return tindex; } } @@ -1078,7 +1081,7 @@ void TheoryDatatypes::addTester( }else{ //otherwise, scan list of labels NodeUIntMap::iterator lbl_i = d_labels.find(n); - Assert( lbl_i != d_labels.end() ); + Assert(lbl_i != d_labels.end()); size_t n_lbl = (*lbl_i).second; std::map< int, bool > neg_testers; for (size_t i = 0; i < n_lbl; i++) @@ -1121,7 +1124,7 @@ void TheoryDatatypes::addTester( for (unsigned i = 0, ncons = dt.getNumConstructors(); i < ncons; i++) { if( i!=ttindex && neg_testers.find( i )==neg_testers.end() ){ - Assert( n.getKind()!=APPLY_CONSTRUCTOR ); + Assert(n.getKind() != APPLY_CONSTRUCTOR); Node infer = utils::mkTester(n, i, dt).negate(); Trace("datatypes-infer") << "DtInfer : neg label : " << infer << " by " << t << std::endl; d_infer.push_back( infer ); @@ -1150,7 +1153,7 @@ void TheoryDatatypes::addTester( { Node ti = d_labels_data[n][i]; nb << ti; - Assert( ti.getKind()==NOT ); + Assert(ti.getKind() == NOT); Node t_arg2 = d_labels_args[n][i]; if( std::find( eq_terms.begin(), eq_terms.end(), t_arg2 )==eq_terms.end() ){ eq_terms.push_back( t_arg2 ); @@ -1190,7 +1193,7 @@ void TheoryDatatypes::addSelector( Node s, EqcInfo* eqc, Node n, bool assertFact Trace("dt-collapse-sel") << "Add selector : " << s << " to eqc(" << n << ")" << std::endl; //check to see if it is redundant NodeUIntMap::iterator sel_i = d_selector_apps.find(n); - Assert( sel_i != d_selector_apps.end() ); + Assert(sel_i != d_selector_apps.end()); if( sel_i != d_selector_apps.end() ){ size_t n_sel = (*sel_i).second; for (size_t j = 0; j < n_sel; j++) @@ -1221,7 +1224,7 @@ void TheoryDatatypes::addSelector( Node s, EqcInfo* eqc, Node n, bool assertFact void TheoryDatatypes::addConstructor( Node c, EqcInfo* eqc, Node n ){ Trace("datatypes-debug") << "Add constructor : " << c << " to eqc(" << n << ")" << std::endl; - Assert( eqc->d_constructor.get().isNull() ); + Assert(eqc->d_constructor.get().isNull()); //check labels NodeUIntMap::iterator lbl_i = d_labels.find(n); if( lbl_i != d_labels.end() ){ @@ -1297,7 +1300,7 @@ Node TheoryDatatypes::removeUninterpretedConstants( Node n, std::map< Node, Node } void TheoryDatatypes::collapseSelector( Node s, Node c ) { - Assert( c.getKind()==APPLY_CONSTRUCTOR ); + Assert(c.getKind() == APPLY_CONSTRUCTOR); Trace("dt-collapse-sel") << "collapse selector : " << s << " " << c << std::endl; Node r; bool wrong = false; @@ -1384,10 +1387,10 @@ void TheoryDatatypes::addCarePairs(TNodeTrie* t1, for (unsigned k = 0; k < f1.getNumChildren(); ++ k) { TNode x = f1[k]; TNode y = f2[k]; - Assert( d_equalityEngine.hasTerm(x) ); - Assert( d_equalityEngine.hasTerm(y) ); - Assert( !areDisequal( x, y ) ); - Assert( !areCareDisequal( x, y ) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); + Assert(!areDisequal(x, y)); + Assert(!areCareDisequal(x, y)); if( !d_equalityEngine.areEqual( x, y ) ){ Trace("dt-cg") << "Arg #" << k << " is " << x << " " << y << std::endl; if( d_equalityEngine.isTriggerTerm(x, THEORY_DATATYPES) && d_equalityEngine.isTriggerTerm(y, THEORY_DATATYPES) ){ @@ -1548,7 +1551,7 @@ bool TheoryDatatypes::collectModelInfo(TheoryModel* m) Type tt = eqc.getType().toType(); const Datatype& dt = ((DatatypeType)tt).getDatatype(); if( !d_equalityEngine.hasTerm( eqc ) ){ - Assert( false ); + Assert(false); }else{ Trace("dt-cmi") << "NOTICE : Datatypes: no constructor in equivalence class " << eqc << std::endl; Trace("dt-cmi") << " Type : " << eqc.getType() << std::endl; @@ -1629,7 +1632,7 @@ Node TheoryDatatypes::getCodatatypesValue( Node n, std::map< Node, Node >& eqc_c if( !nc.isNull() ){ vmap[n] = depth; Trace("dt-cmi-cdt-debug") << " map " << n << " -> " << depth << std::endl; - Assert( nc.getKind()==APPLY_CONSTRUCTOR ); + Assert(nc.getKind() == APPLY_CONSTRUCTOR); std::vector< Node > children; children.push_back( nc.getOperator() ); for( unsigned i=0; i<nc.getNumChildren(); i++ ){ @@ -1832,11 +1835,11 @@ void TheoryDatatypes::checkCycles() { expl.clear(); Node prev = cn; cn = searchForCycle( cn, cn, visited, proc, expl ); - Assert( prev==cn ); + Assert(prev == cn); } if( !cn.isNull() ) { - Assert( expl.size()>0 ); + Assert(expl.size() > 0); d_conflictNode = mkAnd( expl ); Trace("dt-conflict") << "CONFLICT: Cycle conflict : " << d_conflictNode << std::endl; d_out->conflict( d_conflictNode ); @@ -1880,7 +1883,7 @@ void TheoryDatatypes::checkCycles() { cn[part_out[i][j]] = part_out[i][j]; dni.clear(); separateBisimilar( part, tpart_out, exp, cn, dni, 0, true ); - Assert( tpart_out.size()==1 && tpart_out[0].size()==2 ); + Assert(tpart_out.size() == 1 && tpart_out[0].size() == 2); part.pop_back(); //merge based on explanation Trace("dt-cdt") << " exp is : "; @@ -1912,7 +1915,7 @@ void TheoryDatatypes::separateBisimilar( std::vector< Node >& part, std::vector< Trace("dt-cdt-debug") << " " << part[i] << ", current = " << cn[part[i]] << std::endl; } } - Assert( part.size()>1 ); + Assert(part.size() > 1); std::map< Node, std::vector< Node > > new_part; std::map< Node, std::vector< Node > > new_part_c; std::map< int, std::vector< Node > > new_part_rec; @@ -2124,8 +2127,8 @@ bool TheoryDatatypes::areDisequal( TNode a, TNode b ){ } bool TheoryDatatypes::areCareDisequal( TNode x, TNode y ) { - Assert( d_equalityEngine.hasTerm( x ) ); - Assert( d_equalityEngine.hasTerm( y ) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); if( d_equalityEngine.isTriggerTerm(x, THEORY_DATATYPES) && d_equalityEngine.isTriggerTerm(y, THEORY_DATATYPES) ){ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_DATATYPES); TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_DATATYPES); @@ -2289,9 +2292,9 @@ std::pair<bool, Node> TheoryDatatypes::entailmentCheck(TNode lit, const Entailme explainEquality( n, ei->d_constructor.get(), true, exp_c ); }else{ Node lbl = getLabel( n ); - Assert( !lbl.isNull() ); + Assert(!lbl.isNull()); exp_c.push_back( lbl ); - Assert( areEqual( n, lbl[0] ) ); + Assert(areEqual(n, lbl[0])); explainEquality( n, lbl[0], true, exp_c ); } Node exp = mkAnd( exp_c ); diff --git a/src/theory/datatypes/theory_datatypes_type_rules.h b/src/theory/datatypes/theory_datatypes_type_rules.h index c8c16f368..c28673321 100644 --- a/src/theory/datatypes/theory_datatypes_type_rules.h +++ b/src/theory/datatypes/theory_datatypes_type_rules.h @@ -124,8 +124,8 @@ struct DatatypeConstructorTypeRule { struct DatatypeSelectorTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::APPLY_SELECTOR || - n.getKind() == kind::APPLY_SELECTOR_TOTAL); + Assert(n.getKind() == kind::APPLY_SELECTOR + || n.getKind() == kind::APPLY_SELECTOR_TOTAL); TypeNode selType = n.getOperator().getType(check); Type t = selType[0].toType(); Assert(t.isDatatype()); diff --git a/src/theory/datatypes/type_enumerator.cpp b/src/theory/datatypes/type_enumerator.cpp index 023ade00d..de97227e0 100644 --- a/src/theory/datatypes/type_enumerator.cpp +++ b/src/theory/datatypes/type_enumerator.cpp @@ -114,8 +114,8 @@ Node DatatypesEnumerator::getTermEnum( TypeNode tn, unsigned i ){ //we first check if the last argument (which is forced to make sum of iterated arguments equal to d_size_limit) is defined Node lc; if( ctor.getNumArgs()>0 ){ - Assert( index<d_sel_types.size() ); - Assert( ctor.getNumArgs()-1<d_sel_types[index].size() ); + Assert(index < d_sel_types.size()); + Assert(ctor.getNumArgs() - 1 < d_sel_types[index].size()); lc = getTermEnum( d_sel_types[index][ctor.getNumArgs()-1], d_size_limit - d_sel_sum[index] ); if( lc.isNull() ){ Debug("dt-enum-debug") << "Current infeasible." << std::endl; @@ -134,13 +134,13 @@ Node DatatypesEnumerator::getTermEnum( TypeNode tn, unsigned i ){ } Debug("dt-enum-debug") << "Get arguments..." << std::endl; if( ctor.getNumArgs()>0 ){ - Assert( index<d_sel_types.size() ); - Assert( index<d_sel_index.size() ); - Assert( d_sel_types[index].size()==ctor.getNumArgs() ); - Assert( d_sel_index[index].size()==ctor.getNumArgs()-1 ); + Assert(index < d_sel_types.size()); + Assert(index < d_sel_index.size()); + Assert(d_sel_types[index].size() == ctor.getNumArgs()); + Assert(d_sel_index[index].size() == ctor.getNumArgs() - 1); for( int i=0; i<(int)(ctor.getNumArgs()-1); i++ ){ Node c = getTermEnum( d_sel_types[index][i], d_sel_index[index][i] ); - Assert( !c.isNull() ); + Assert(!c.isNull()); b << c; } b << lc; @@ -186,7 +186,7 @@ Node DatatypesEnumerator::getTermEnum( TypeNode tn, unsigned i ){ Debug("dt-enum-debug") << "make ground term..." << std::endl; Node t = d_type.mkGroundTerm(); Debug("dt-enum-debug") << "done : " << t << std::endl; - Assert( t.getKind()==kind::APPLY_CONSTRUCTOR ); + Assert(t.getKind() == kind::APPLY_CONSTRUCTOR); // start with the constructor for which a ground term is constructed d_zeroCtor = datatypes::utils::indexOf(t.getOperator()); d_has_debruijn = 0; @@ -219,6 +219,6 @@ Node DatatypesEnumerator::getTermEnum( TypeNode tn, unsigned i ){ d_size_limit = 0; //set up initial conditions (should always succeed) ++*this; //increment( d_ctor ); - AlwaysAssert( !isFinished() ); + AlwaysAssert(!isFinished()); } diff --git a/src/theory/example/theory_uf_tim.cpp b/src/theory/example/theory_uf_tim.cpp index 54d2e3209..68346d59d 100644 --- a/src/theory/example/theory_uf_tim.cpp +++ b/src/theory/example/theory_uf_tim.cpp @@ -82,26 +82,26 @@ void TheoryUFTim::registerTerm(TNode n) { * * The above assumes that the code is working correctly. */ - Assert(ecN->getFirst() == NULL, - "Equivalence class data exists for the node being registered. " + Assert(ecN->getFirst() == NULL) + << "Equivalence class data exists for the node being registered. " "Expected getFirst() == NULL. " "This data is either already in use or was not properly maintained " - "during backtracking"); + "during backtracking"; /*Assert(ecN->getLast() == NULL, "Equivalence class data exists for the node being registered. " "Expected getLast() == NULL. " "This data is either already in use or was not properly maintained " "during backtracking.");*/ - Assert(ecN->isClassRep(), - "Equivalence class data exists for the node being registered. " + Assert(ecN->isClassRep()) + << "Equivalence class data exists for the node being registered. " "Expected isClassRep() to be true. " "This data is either already in use or was not properly maintained " - "during backtracking"); - Assert(ecN->getWatchListSize() == 0, - "Equivalence class data exists for the node being registered. " + "during backtracking"; + Assert(ecN->getWatchListSize() == 0) + << "Equivalence class data exists for the node being registered. " "Expected getWatchListSize() == 0. " "This data is either already in use or was not properly maintained " - "during backtracking"); + "during backtracking"; } else { //The attribute does not exist, so it is created and set ecN = new (true) ECData(getContext(), n); @@ -290,14 +290,13 @@ void TheoryUFTim::check(Effort level) { merge(); break; case NOT: - Assert(assertion[0].getKind() == EQUAL, - "predicates not supported in this UF implementation"); + Assert(assertion[0].getKind() == EQUAL) + << "predicates not supported in this UF implementation"; d_disequality.push_back(assertion[0]); break; case APPLY_UF: - Unhandled("predicates not supported in this UF implementation"); - default: - Unhandled(assertion.getKind()); + Unhandled() << "predicates not supported in this UF implementation"; + default: Unhandled() << assertion.getKind(); } Debug("uf") << "TheoryUFTim::check(): done = " << (done() ? "true" : "false") << std::endl; diff --git a/src/theory/ext_theory.cpp b/src/theory/ext_theory.cpp index 5a37889a2..9d2a7ac4c 100644 --- a/src/theory/ext_theory.cpp +++ b/src/theory/ext_theory.cpp @@ -18,7 +18,7 @@ #include "theory/ext_theory.h" -#include "base/cvc4_assert.h" +#include "base/check.h" #include "smt/smt_statistics_registry.h" #include "theory/quantifiers_engine.h" #include "theory/substitutions.h" diff --git a/src/theory/fp/fp_converter.cpp b/src/theory/fp/fp_converter.cpp index fbdce8cd5..bcdebc12e 100644 --- a/src/theory/fp/fp_converter.cpp +++ b/src/theory/fp/fp_converter.cpp @@ -883,7 +883,7 @@ Node FpConverter::convert(TNode node) case roundTowardPositive: r.insert(current, traits::RTP()); break; case roundTowardNegative: r.insert(current, traits::RTN()); break; case roundTowardZero: r.insert(current, traits::RTZ()); break; - default: Unreachable("Unknown rounding mode"); break; + default: Unreachable() << "Unknown rounding mode"; break; } } else @@ -896,7 +896,7 @@ Node FpConverter::convert(TNode node) } else { - Unreachable("Unknown kind of type RoundingMode"); + Unreachable() << "Unknown kind of type RoundingMode"; } } // Returns a rounding-mode type so don't alter the return value @@ -930,7 +930,7 @@ Node FpConverter::convert(TNode node) case kind::VARIABLE: case kind::BOUND_VARIABLE: case kind::SKOLEM: - Unreachable("Kind should have been handled as a leaf."); + Unreachable() << "Kind should have been handled as a leaf."; break; /******** Operations ********/ @@ -959,7 +959,7 @@ Node FpConverter::convert(TNode node) (*arg1).second)); break; default: - Unreachable("Unknown unary floating-point function"); + Unreachable() << "Unknown unary floating-point function"; break; } } @@ -1002,7 +1002,8 @@ Node FpConverter::convert(TNode node) (*arg1).second)); break; default: - Unreachable("Unknown unary rounded floating-point function"); + Unreachable() + << "Unknown unary rounded floating-point function"; break; } } @@ -1077,7 +1078,8 @@ Node FpConverter::convert(TNode node) break; default: - Unreachable("Unknown binary floating-point partial function"); + Unreachable() + << "Unknown binary floating-point partial function"; break; } } @@ -1125,9 +1127,9 @@ Node FpConverter::convert(TNode node) case kind::FLOATINGPOINT_SUB: // Should have been removed by the rewriter - Unreachable( - "Floating-point subtraction should be removed by the " - "rewriter."); + Unreachable() + << "Floating-point subtraction should be removed by the " + "rewriter."; break; case kind::FLOATINGPOINT_MULT: @@ -1152,13 +1154,14 @@ Node FpConverter::convert(TNode node) (*arg1).second, (*arg2).second)); */ - Unimplemented( - "Remainder with rounding mode not yet supported by " - "SMT-LIB"); + Unimplemented() + << "Remainder with rounding mode not yet supported by " + "SMT-LIB"; break; default: - Unreachable("Unknown binary rounded floating-point function"); + Unreachable() + << "Unknown binary rounded floating-point function"; break; } } @@ -1284,8 +1287,8 @@ Node FpConverter::convert(TNode node) break; default: - Unreachable( - "Unknown converstion from bit-vector to floating-point"); + Unreachable() << "Unknown converstion from bit-vector to " + "floating-point"; break; } } @@ -1300,10 +1303,12 @@ Node FpConverter::convert(TNode node) break; case kind::FLOATINGPOINT_TO_FP_GENERIC: - Unreachable("Generic to_fp not removed"); + Unreachable() << "Generic to_fp not removed"; break; - default: Unreachable("Unknown kind of type FloatingPoint"); break; + default: + Unreachable() << "Unknown kind of type FloatingPoint"; + break; } } } @@ -1414,7 +1419,7 @@ Node FpConverter::convert(TNode node) break; default: - Unreachable("Unknown binary floating-point relation"); + Unreachable() << "Unknown binary floating-point relation"; break; } } @@ -1482,7 +1487,7 @@ Node FpConverter::convert(TNode node) break; default: - Unreachable("Unknown unary floating-point relation"); + Unreachable() << "Unknown unary floating-point relation"; break; } } @@ -1491,7 +1496,7 @@ Node FpConverter::convert(TNode node) case kind::FLOATINGPOINT_EQ: case kind::FLOATINGPOINT_GEQ: case kind::FLOATINGPOINT_GT: - Unreachable("Kind should have been removed by rewriter."); + Unreachable() << "Kind should have been removed by rewriter."; break; // Components will be registered as they are owned by @@ -1602,15 +1607,15 @@ Node FpConverter::convert(TNode node) break; case kind::FLOATINGPOINT_TO_UBV: - Unreachable( - "Partially defined fp.to_ubv should have been removed by " - "expandDefinition"); + Unreachable() + << "Partially defined fp.to_ubv should have been removed by " + "expandDefinition"; break; case kind::FLOATINGPOINT_TO_SBV: - Unreachable( - "Partially defined fp.to_sbv should have been removed by " - "expandDefinition"); + Unreachable() + << "Partially defined fp.to_sbv should have been removed by " + "expandDefinition"; break; // Again, no action is needed @@ -1653,9 +1658,9 @@ Node FpConverter::convert(TNode node) break; case kind::FLOATINGPOINT_TO_REAL: - Unreachable( - "Partially defined fp.to_real should have been removed by " - "expandDefinition"); + Unreachable() + << "Partially defined fp.to_real should have been removed by " + "expandDefinition"; break; default: CVC4_FPCONV_PASSTHROUGH; break; @@ -1669,7 +1674,7 @@ Node FpConverter::convert(TNode node) return result; #else - Unimplemented("Conversion is dependent on SymFPU"); + Unimplemented() << "Conversion is dependent on SymFPU"; #endif } @@ -1688,7 +1693,7 @@ Node FpConverter::getValue(Valuation &val, TNode var) if (i == r.end()) { - Unreachable("Asking for the value of an unregistered expression"); + Unreachable() << "Asking for the value of an unregistered expression"; } else { @@ -1702,7 +1707,7 @@ Node FpConverter::getValue(Valuation &val, TNode var) if (i == f.end()) { - Unreachable("Asking for the value of an unregistered expression"); + Unreachable() << "Asking for the value of an unregistered expression"; } else { @@ -1712,15 +1717,15 @@ Node FpConverter::getValue(Valuation &val, TNode var) } else { - Unreachable( - "Asking for the value of a type that is not managed by the " - "floating-point theory"); + Unreachable() + << "Asking for the value of a type that is not managed by the " + "floating-point theory"; } - Unreachable("Unable to find value"); + Unreachable() << "Unable to find value"; #else - Unimplemented("Conversion is dependent on SymFPU"); + Unimplemented() << "Conversion is dependent on SymFPU"; #endif } diff --git a/src/theory/fp/fp_converter.h b/src/theory/fp/fp_converter.h index 753030408..8ff5293e2 100644 --- a/src/theory/fp/fp_converter.h +++ b/src/theory/fp/fp_converter.h @@ -21,7 +21,7 @@ #ifndef CVC4__THEORY__FP__FP_CONVERTER_H #define CVC4__THEORY__FP__FP_CONVERTER_H -#include "base/cvc4_assert.h" +#include "base/check.h" #include "context/cdhashmap.h" #include "context/cdlist.h" #include "expr/node.h" diff --git a/src/theory/fp/theory_fp.cpp b/src/theory/fp/theory_fp.cpp index 2c93553fe..fa143a1d0 100644 --- a/src/theory/fp/theory_fp.cpp +++ b/src/theory/fp/theory_fp.cpp @@ -72,7 +72,7 @@ Node removeToFPGeneric(TNode node) { return nm->mkNode(op, node[0], node[1]); } - Unreachable("to_fp generic not rewritten"); + Unreachable() << "to_fp generic not rewritten"; } } // namespace removeToFPGeneric @@ -736,7 +736,7 @@ bool TheoryFp::refineAbstraction(TheoryModel *m, TNode abstract, TNode concrete) } else { - Unreachable("Unknown abstraction"); + Unreachable() << "Unknown abstraction"; } return false; @@ -863,7 +863,7 @@ void TheoryFp::registerTerm(TNode node) { } else { - Unreachable("Only isNaN, isInf and isZero have aliases"); + Unreachable() << "Only isNaN, isInf and isZero have aliases"; } handleLemma(nm->mkNode(kind::EQUAL, node, equalityAlias)); @@ -965,12 +965,12 @@ void TheoryFp::check(Effort level) { TNode predicate = negated ? fact[0] : fact; if (predicate.getKind() == kind::EQUAL) { - Assert(!(predicate[0].getType().isFloatingPoint() || - predicate[0].getType().isRoundingMode()) || - isRegistered(predicate[0])); - Assert(!(predicate[1].getType().isFloatingPoint() || - predicate[1].getType().isRoundingMode()) || - isRegistered(predicate[1])); + Assert(!(predicate[0].getType().isFloatingPoint() + || predicate[0].getType().isRoundingMode()) + || isRegistered(predicate[0])); + Assert(!(predicate[1].getType().isFloatingPoint() + || predicate[1].getType().isRoundingMode()) + || isRegistered(predicate[1])); registerTerm(predicate); // Needed for float equalities if (negated) { diff --git a/src/theory/fp/theory_fp_rewriter.cpp b/src/theory/fp/theory_fp_rewriter.cpp index 68ea01eb8..7f5ce4afb 100644 --- a/src/theory/fp/theory_fp_rewriter.cpp +++ b/src/theory/fp/theory_fp_rewriter.cpp @@ -32,7 +32,7 @@ #include <algorithm> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "theory/fp/fp_converter.h" #include "theory/fp/theory_fp_rewriter.h" @@ -54,7 +54,8 @@ namespace rewrite { } RewriteResponse notFP (TNode node, bool) { - Unreachable("non floating-point kind (%d) in floating point rewrite?",node.getKind()); + Unreachable() << "non floating-point kind (" << node.getKind() + << ") in floating point rewrite?"; } RewriteResponse identity (TNode node, bool) { @@ -62,7 +63,8 @@ namespace rewrite { } RewriteResponse type (TNode node, bool) { - Unreachable("sort kind (%d) found in expression?",node.getKind()); + Unreachable() << "sort kind (" << node.getKind() + << ") found in expression?"; } RewriteResponse removeDoubleNegation (TNode node, bool) { @@ -98,12 +100,9 @@ namespace rewrite { Assert(isPreRewrite); // Should be run first Kind k = node.getKind(); - Assert(k == kind::FLOATINGPOINT_EQ || - k == kind::FLOATINGPOINT_GEQ || - k == kind::FLOATINGPOINT_LEQ || - k == kind::FLOATINGPOINT_GT || - k == kind::FLOATINGPOINT_LT); - + Assert(k == kind::FLOATINGPOINT_EQ || k == kind::FLOATINGPOINT_GEQ + || k == kind::FLOATINGPOINT_LEQ || k == kind::FLOATINGPOINT_GT + || k == kind::FLOATINGPOINT_LT); size_t children = node.getNumChildren(); if (children > 2) { @@ -153,27 +152,30 @@ namespace rewrite { return RewriteResponse(REWRITE_DONE,NodeManager::currentNM()->mkNode(kind::FLOATINGPOINT_LT,node[1],node[0])); } - RewriteResponse removed (TNode node, bool) { - Unreachable("kind (%s) should have been removed?",kindToString(node.getKind()).c_str()); + RewriteResponse removed(TNode node, bool) + { + Unreachable() << "kind (" << node.getKind() + << ") should have been removed?"; } RewriteResponse variable (TNode node, bool) { // We should only get floating point and rounding mode variables to rewrite. TypeNode tn = node.getType(true); Assert(tn.isFloatingPoint() || tn.isRoundingMode()); - + // Not that we do anything with them... return RewriteResponse(REWRITE_DONE, node); } RewriteResponse equal (TNode node, bool isPreRewrite) { Assert(node.getKind() == kind::EQUAL); - + // We should only get equalities of floating point or rounding mode types. TypeNode tn = node[0].getType(true); Assert(tn.isFloatingPoint() || tn.isRoundingMode()); - Assert(tn == node[1].getType(true)); // Should be ensured by the typing rules + Assert(tn + == node[1].getType(true)); // Should be ensured by the typing rules if (node[0] == node[1]) { return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(true)); @@ -191,8 +193,9 @@ namespace rewrite { RewriteResponse compactMinMax (TNode node, bool isPreRewrite) { #ifdef CVC4_ASSERTIONS Kind k = node.getKind(); - Assert((k == kind::FLOATINGPOINT_MIN) || (k == kind::FLOATINGPOINT_MAX) || - (k == kind::FLOATINGPOINT_MIN_TOTAL) || (k == kind::FLOATINGPOINT_MAX_TOTAL)); + Assert((k == kind::FLOATINGPOINT_MIN) || (k == kind::FLOATINGPOINT_MAX) + || (k == kind::FLOATINGPOINT_MIN_TOTAL) + || (k == kind::FLOATINGPOINT_MAX_TOTAL)); #endif if (node[0] == node[1]) { return RewriteResponse(REWRITE_AGAIN, node[0]); @@ -204,7 +207,7 @@ namespace rewrite { RewriteResponse reorderFPEquality (TNode node, bool isPreRewrite) { Assert(node.getKind() == kind::FLOATINGPOINT_EQ); - Assert(!isPreRewrite); // Likely redundant in pre-rewrite + Assert(!isPreRewrite); // Likely redundant in pre-rewrite if (node[0] > node[1]) { Node normal = NodeManager::currentNM()->mkNode(kind::FLOATINGPOINT_EQ,node[1],node[0]); @@ -217,7 +220,7 @@ namespace rewrite { RewriteResponse reorderBinaryOperation (TNode node, bool isPreRewrite) { Kind k = node.getKind(); Assert((k == kind::FLOATINGPOINT_PLUS) || (k == kind::FLOATINGPOINT_MULT)); - Assert(!isPreRewrite); // Likely redundant in pre-rewrite + Assert(!isPreRewrite); // Likely redundant in pre-rewrite if (node[1] > node[2]) { Node normal = NodeManager::currentNM()->mkNode(k,node[0],node[2],node[1]); @@ -229,7 +232,7 @@ namespace rewrite { RewriteResponse reorderFMA (TNode node, bool isPreRewrite) { Assert(node.getKind() == kind::FLOATINGPOINT_FMA); - Assert(!isPreRewrite); // Likely redundant in pre-rewrite + Assert(!isPreRewrite); // Likely redundant in pre-rewrite if (node[1] > node[2]) { Node normal = NodeManager::currentNM()->mkNode(kind::FLOATINGPOINT_FMA,node[0],node[2],node[1],node[3]); @@ -240,11 +243,11 @@ namespace rewrite { } RewriteResponse removeSignOperations (TNode node, bool isPreRewrite) { - Assert(node.getKind() == kind::FLOATINGPOINT_ISN || - node.getKind() == kind::FLOATINGPOINT_ISSN || - node.getKind() == kind::FLOATINGPOINT_ISZ || - node.getKind() == kind::FLOATINGPOINT_ISINF || - node.getKind() == kind::FLOATINGPOINT_ISNAN); + Assert(node.getKind() == kind::FLOATINGPOINT_ISN + || node.getKind() == kind::FLOATINGPOINT_ISSN + || node.getKind() == kind::FLOATINGPOINT_ISZ + || node.getKind() == kind::FLOATINGPOINT_ISINF + || node.getKind() == kind::FLOATINGPOINT_ISNAN); Assert(node.getNumChildren() == 1); Kind childKind(node[0].getKind()); @@ -325,7 +328,7 @@ namespace constantFold { RewriteResponse fpLiteral (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_FP); - + BitVector bv(node[0].getConst<BitVector>()); bv = bv.concat(node[1].getConst<BitVector>()); bv = bv.concat(node[2].getConst<BitVector>()); @@ -362,9 +365,9 @@ namespace constantFold { RoundingMode rm(node[0].getConst<RoundingMode>()); FloatingPoint arg1(node[1].getConst<FloatingPoint>()); FloatingPoint arg2(node[2].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1.plus(rm, arg2))); } @@ -375,9 +378,9 @@ namespace constantFold { RoundingMode rm(node[0].getConst<RoundingMode>()); FloatingPoint arg1(node[1].getConst<FloatingPoint>()); FloatingPoint arg2(node[2].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1.mult(rm, arg2))); } @@ -389,10 +392,10 @@ namespace constantFold { FloatingPoint arg1(node[1].getConst<FloatingPoint>()); FloatingPoint arg2(node[2].getConst<FloatingPoint>()); FloatingPoint arg3(node[3].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); Assert(arg1.t == arg3.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1.fma(rm, arg2, arg3))); } @@ -403,9 +406,9 @@ namespace constantFold { RoundingMode rm(node[0].getConst<RoundingMode>()); FloatingPoint arg1(node[1].getConst<FloatingPoint>()); FloatingPoint arg2(node[2].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1.div(rm, arg2))); } @@ -435,9 +438,9 @@ namespace constantFold { FloatingPoint arg1(node[0].getConst<FloatingPoint>()); FloatingPoint arg2(node[1].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1.rem(arg2))); } @@ -447,7 +450,7 @@ namespace constantFold { FloatingPoint arg1(node[0].getConst<FloatingPoint>()); FloatingPoint arg2(node[1].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); FloatingPoint::PartialFloatingPoint res(arg1.min(arg2)); @@ -467,7 +470,7 @@ namespace constantFold { FloatingPoint arg1(node[0].getConst<FloatingPoint>()); FloatingPoint arg2(node[1].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); FloatingPoint::PartialFloatingPoint res(arg1.max(arg2)); @@ -544,16 +547,16 @@ namespace constantFold { RewriteResponse equal (TNode node, bool isPreRewrite) { Assert(node.getKind() == kind::EQUAL); - + // We should only get equalities of floating point or rounding mode types. TypeNode tn = node[0].getType(true); if (tn.isFloatingPoint()) { FloatingPoint arg1(node[0].getConst<FloatingPoint>()); FloatingPoint arg2(node[1].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1 == arg2)); } else if (tn.isRoundingMode()) { @@ -563,7 +566,7 @@ namespace constantFold { return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1 == arg2)); } - Unreachable("Equality of unknown type"); + Unreachable() << "Equality of unknown type"; } @@ -573,9 +576,9 @@ namespace constantFold { FloatingPoint arg1(node[0].getConst<FloatingPoint>()); FloatingPoint arg2(node[1].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1 <= arg2)); } @@ -586,9 +589,9 @@ namespace constantFold { FloatingPoint arg1(node[0].getConst<FloatingPoint>()); FloatingPoint arg2(node[1].getConst<FloatingPoint>()); - + Assert(arg1.t == arg2.t); - + return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(arg1 < arg2)); } @@ -670,7 +673,7 @@ namespace constantFold { RewriteResponse convertFromRealLiteral (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_TO_FP_REAL); - + TNode op = node.getOperator(); const FloatingPointToFPReal ¶m = op.getConst<FloatingPointToFPReal>(); @@ -686,7 +689,7 @@ namespace constantFold { RewriteResponse convertFromSBV (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_TO_FP_SIGNED_BITVECTOR); - + TNode op = node.getOperator(); const FloatingPointToFPSignedBitVector ¶m = op.getConst<FloatingPointToFPSignedBitVector>(); @@ -702,7 +705,7 @@ namespace constantFold { RewriteResponse convertFromUBV (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_TO_FP_UNSIGNED_BITVECTOR); - + TNode op = node.getOperator(); const FloatingPointToFPUnsignedBitVector ¶m = op.getConst<FloatingPointToFPUnsignedBitVector>(); @@ -718,7 +721,7 @@ namespace constantFold { RewriteResponse convertToUBV (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_TO_UBV); - + TNode op = node.getOperator(); const FloatingPointToUBV ¶m = op.getConst<FloatingPointToUBV>(); @@ -738,7 +741,7 @@ namespace constantFold { RewriteResponse convertToSBV (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_TO_SBV); - + TNode op = node.getOperator(); const FloatingPointToSBV ¶m = op.getConst<FloatingPointToSBV>(); @@ -758,7 +761,7 @@ namespace constantFold { RewriteResponse convertToReal (TNode node, bool) { Assert(node.getKind() == kind::FLOATINGPOINT_TO_REAL); - + FloatingPoint arg(node[0].getConst<FloatingPoint>()); FloatingPoint::PartialRational res(arg.convertToRational()); @@ -887,7 +890,7 @@ namespace constantFold { result = arg0.getLiteral().sign; break; #endif - default: Unreachable("Unknown kind used in componentFlag"); break; + default: Unreachable() << "Unknown kind used in componentFlag"; break; } BitVector res(1U, (result) ? 1U : 0U); @@ -962,7 +965,7 @@ namespace constantFold { break; default: - Unreachable("Unknown rounding mode in roundingModeBitBlast"); + Unreachable() << "Unknown rounding mode in roundingModeBitBlast"; break; } #else diff --git a/src/theory/fp/type_enumerator.h b/src/theory/fp/type_enumerator.h index 4494fd40f..bb109f823 100644 --- a/src/theory/fp/type_enumerator.h +++ b/src/theory/fp/type_enumerator.h @@ -114,9 +114,7 @@ class RoundingModeEnumerator case roundNearestTiesToAway: d_enumerationComplete = true; break; - default: - Unreachable("Unknown rounding mode?"); - break; + default: Unreachable() << "Unknown rounding mode?"; break; } return *this; } diff --git a/src/theory/logic_info.cpp b/src/theory/logic_info.cpp index 34ea5f9b1..9fd28e8dc 100644 --- a/src/theory/logic_info.cpp +++ b/src/theory/logic_info.cpp @@ -22,10 +22,9 @@ #include <sstream> #include <string> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "expr/kind.h" - using namespace std; using namespace CVC4::theory; @@ -334,8 +333,9 @@ std::string LogicInfo::getLogicString() const { ++seen; } if(seen != d_sharingTheories) { - Unhandled("can't extract a logic string from LogicInfo; at least one " - "active theory is unknown to LogicInfo::getLogicString() !"); + Unhandled() + << "can't extract a logic string from LogicInfo; at least one " + "active theory is unknown to LogicInfo::getLogicString() !"; } if(seen == 0) { diff --git a/src/theory/output_channel.h b/src/theory/output_channel.h index 347177b93..bcbbfa274 100644 --- a/src/theory/output_channel.h +++ b/src/theory/output_channel.h @@ -21,7 +21,6 @@ #include <memory> -#include "base/cvc4_assert.h" #include "proof/proof_manager.h" #include "smt/logic_exception.h" #include "theory/interrupted.h" diff --git a/src/theory/quantifiers/alpha_equivalence.cpp b/src/theory/quantifiers/alpha_equivalence.cpp index 9d516de61..9e6e4842f 100644 --- a/src/theory/quantifiers/alpha_equivalence.cpp +++ b/src/theory/quantifiers/alpha_equivalence.cpp @@ -85,7 +85,7 @@ Node AlphaEquivalenceTypeNode::registerNode(Node q, while (index < typs.size()) { TypeNode curr = typs[index]; - Assert( typ_count.find( curr )!=typ_count.end() ); + Assert(typ_count.find(curr) != typ_count.end()); Trace("aeq-debug") << "[" << curr << " " << typ_count[curr] << "] "; aetn = &(aetn->d_children[curr][typ_count[curr]]); index = index + 1; @@ -96,7 +96,7 @@ Node AlphaEquivalenceTypeNode::registerNode(Node q, Node AlphaEquivalenceDb::addTerm(Node q) { - Assert( q.getKind()==FORALL ); + Assert(q.getKind() == FORALL); Trace("aeq") << "Alpha equivalence : register " << q << std::endl; //construct canonical quantified formula Node t = d_tc->getCanonicalTerm(q[1], true); diff --git a/src/theory/quantifiers/anti_skolem.cpp b/src/theory/quantifiers/anti_skolem.cpp index d972f2a1c..cdb15b349 100644 --- a/src/theory/quantifiers/anti_skolem.cpp +++ b/src/theory/quantifiers/anti_skolem.cpp @@ -37,7 +37,7 @@ struct sortTypeOrder { void QuantAntiSkolem::SkQuantTypeCache::add( std::vector< TypeNode >& typs, Node q, unsigned index ) { if( index==typs.size() ){ - Assert( std::find( d_quants.begin(), d_quants.end(), q )==d_quants.end() ); + Assert(std::find(d_quants.begin(), d_quants.end(), q) == d_quants.end()); d_quants.push_back( q ); }else{ d_children[typs[index]].add( typs, q, index+1 ); @@ -134,12 +134,12 @@ void QuantAntiSkolem::check(Theory::Effort e, QEffort quant_e) for( unsigned j=0; j<d_ask_types[q].size(); ){ TypeNode curr = d_ask_types[q][j]; for( unsigned k=0; k<indices[curr].size(); k++ ){ - Assert( d_ask_types[q][j]==curr ); + Assert(d_ask_types[q][j] == curr); d_ask_types_index[q].push_back( indices[curr][k] ); j++; } } - Assert( d_ask_types_index[q].size()==d_ask_types[q].size() ); + Assert(d_ask_types_index[q].size() == d_ask_types[q].size()); }else{ d_quant_sip.erase( q ); } @@ -158,7 +158,7 @@ void QuantAntiSkolem::check(Theory::Effort e, QEffort quant_e) } bool QuantAntiSkolem::sendAntiSkolemizeLemma( std::vector< Node >& quants, bool pconnected ) { - Assert( !quants.empty() ); + Assert(!quants.empty()); std::sort( quants.begin(), quants.end() ); if( d_sqc->add( d_quantEngine->getUserContext(), quants ) ){ //partition into connected components @@ -190,7 +190,7 @@ bool QuantAntiSkolem::sendAntiSkolemizeLemma( std::vector< Node >& quants, bool eqcs.push_back( func_to_eqc[f] ); } } - Assert( !eqcs.empty() ); + Assert(!eqcs.empty()); //merge equivalence classes int id = eqcs[0]; eqc_to_quant[id].push_back( q ); @@ -214,7 +214,7 @@ bool QuantAntiSkolem::sendAntiSkolemizeLemma( std::vector< Node >& quants, bool if( eqc_to_quant.size()>1 ){ bool addedLemma = false; for( std::map< int, std::vector< Node > >::iterator it = eqc_to_quant.begin(); it != eqc_to_quant.end(); ++it ){ - Assert( it->second.size()<quants.size() ); + Assert(it->second.size() < quants.size()); bool ret = sendAntiSkolemizeLemma( it->second, false ); addedLemma = addedLemma || ret; } @@ -245,7 +245,7 @@ bool QuantAntiSkolem::sendAntiSkolemizeLemma( std::vector< Node >& quants, bool std::vector< Node > subs_lhs; std::vector< Node > subs_rhs; //get outer variable substitution - Assert( d_ask_types_index[q].size()==d_ask_types[q].size() ); + Assert(d_ask_types_index[q].size() == d_ask_types[q].size()); std::vector<Node> sivars; d_quant_sip[q].getSingleInvocationVariables(sivars); for (unsigned j = 0, size = d_ask_types_index[q].size(); j < size; j++) diff --git a/src/theory/quantifiers/cegqi/ceg_instantiator.cpp b/src/theory/quantifiers/cegqi/ceg_instantiator.cpp index c52666dad..bed382e28 100644 --- a/src/theory/quantifiers/cegqi/ceg_instantiator.cpp +++ b/src/theory/quantifiers/cegqi/ceg_instantiator.cpp @@ -479,7 +479,7 @@ void CegInstantiator::activateInstantiationVariable(Node v, unsigned index) if( tn.isReal() ){ vinst = new ArithInstantiator(tn, d_parent->getVtsTermCache()); }else if( tn.isSort() ){ - Assert( options::quantEpr() ); + Assert(options::quantEpr()); vinst = new EprInstantiator(tn); }else if( tn.isDatatype() ){ vinst = new DtInstantiator(tn); @@ -622,7 +622,7 @@ bool CegInstantiator::constructInstantiation(SolvedForm& sf, unsigned i) //get the instantiator object Assert(d_instantiator.find(pv) != d_instantiator.end()); Instantiator* vinst = d_instantiator[pv]; - Assert( vinst!=NULL ); + Assert(vinst != NULL); d_active_instantiators[pv] = vinst; vinst->reset(this, sf, pv, d_effort); // if d_effort is full, we must choose at least one model value @@ -656,7 +656,7 @@ bool CegInstantiator::constructInstantiation(SolvedForm& sf, unsigned i) && d_qe->getLogicInfo().isLinear()) { Trace("cbqi-warn") << "Had to resort to model value." << std::endl; - Assert( false ); + Assert(false); } #endif Node mv = getModelValue( pv ); @@ -940,7 +940,7 @@ void CegInstantiator::pushStackVariable( Node v ) { } void CegInstantiator::popStackVariable() { - Assert( !d_stack_vars.empty() ); + Assert(!d_stack_vars.empty()); d_stack_vars.pop_back(); } @@ -961,11 +961,11 @@ bool CegInstantiator::constructInstantiationInc(Node pv, << ") "; Node mod_pv = pv_prop.getModifiedTerm( pv ); Trace("cbqi-inst-debug") << mod_pv << " -> " << n << std::endl; - Assert( n.getType().isSubtypeOf( pv.getType() ) ); + Assert(n.getType().isSubtypeOf(pv.getType())); } //must ensure variables have been computed for n computeProgVars( n ); - Assert( d_inelig.find( n )==d_inelig.end() ); + Assert(d_inelig.find(n) == d_inelig.end()); //substitute into previous substitutions, when applicable std::vector< Node > a_var; @@ -986,7 +986,7 @@ bool CegInstantiator::constructInstantiationInc(Node pv, Trace("cbqi-inst-debug2") << "Applying substitutions to previous substitution terms..." << std::endl; for( unsigned j=0; j<sf.d_subs.size(); j++ ){ Trace("cbqi-inst-debug2") << " Apply for " << sf.d_subs[j] << std::endl; - Assert( d_prog_var.find( sf.d_subs[j] )!=d_prog_var.end() ); + Assert(d_prog_var.find(sf.d_subs[j]) != d_prog_var.end()); if( d_prog_var[sf.d_subs[j]].find( pv )!=d_prog_var[sf.d_subs[j]].end() ){ prev_subs[j] = sf.d_subs[j]; TNode tv = pv; @@ -1016,14 +1016,17 @@ bool CegInstantiator::constructInstantiationInc(Node pv, // if previously was basic, becomes non-basic if( prev_basic && !sf.d_props[j].isBasic() ){ - Assert( std::find( sf.d_non_basic.begin(), sf.d_non_basic.end(), sf.d_vars[j] )==sf.d_non_basic.end() ); + Assert(std::find(sf.d_non_basic.begin(), + sf.d_non_basic.end(), + sf.d_vars[j]) + == sf.d_non_basic.end()); new_non_basic.push_back( sf.d_vars[j] ); sf.d_non_basic.push_back( sf.d_vars[j] ); } } if( sf.d_subs[j]!=prev_subs[j] ){ computeProgVars( sf.d_subs[j] ); - Assert( d_inelig.find( sf.d_subs[j] )==d_inelig.end() ); + Assert(d_inelig.find(sf.d_subs[j]) == d_inelig.end()); } Trace("cbqi-inst-debug2") << "Subs " << j << " " << sf.d_subs[j] << std::endl; }else{ @@ -1088,7 +1091,7 @@ bool CegInstantiator::doAddInstantiation( std::vector< Node >& vars, std::vector for (unsigned i = 0, size = d_input_vars.size(); i < size; ++i) { std::map<Node, Node>::iterator it = subs_map.find(d_input_vars[i]); - Assert( it!=subs_map.end() ); + Assert(it != subs_map.end()); Node n = it->second; Trace("cbqi-inst-debug") << " " << d_input_vars[i] << " -> " << n << std::endl; @@ -1144,7 +1147,7 @@ bool CegInstantiator::isEligibleForInstantiation(Node n) const } bool CegInstantiator::canApplyBasicSubstitution( Node n, std::vector< Node >& non_basic ){ - Assert( d_prog_var.find( n )!=d_prog_var.end() ); + Assert(d_prog_var.find(n) != d_prog_var.end()); if( !non_basic.empty() ){ for (std::unordered_set<Node, NodeHashFunction>::iterator it = d_prog_var[n].begin(); @@ -1163,13 +1166,13 @@ bool CegInstantiator::canApplyBasicSubstitution( Node n, std::vector< Node >& no Node CegInstantiator::applySubstitution( TypeNode tn, Node n, std::vector< Node >& vars, std::vector< Node >& subs, std::vector< TermProperties >& prop, std::vector< Node >& non_basic, TermProperties& pv_prop, bool try_coeff ) { computeProgVars( n ); - Assert( n==Rewriter::rewrite( n ) ); + Assert(n == Rewriter::rewrite(n)); bool is_basic = canApplyBasicSubstitution( n, non_basic ); if( Trace.isOn("cegqi-si-apply-subs-debug") ){ Trace("cegqi-si-apply-subs-debug") << "is_basic = " << is_basic << " " << tn << std::endl; for( unsigned i=0; i<subs.size(); i++ ){ Trace("cegqi-si-apply-subs-debug") << " " << vars[i] << " -> " << subs[i] << " types : " << vars[i].getType() << " -> " << subs[i].getType() << std::endl; - Assert( subs[i].getType().isSubtypeOf( vars[i].getType() ) ); + Assert(subs[i].getType().isSubtypeOf(vars[i].getType())); } } Node nret; @@ -1182,8 +1185,8 @@ Node CegInstantiator::applySubstitution( TypeNode tn, Node n, std::vector< Node std::vector< Node > nsubs; for( unsigned i=0; i<vars.size(); i++ ){ if( !prop[i].d_coeff.isNull() ){ - Assert( vars[i].getType().isInteger() ); - Assert( prop[i].d_coeff.isConst() ); + Assert(vars[i].getType().isInteger()); + Assert(prop[i].d_coeff.isConst()); Node nn = NodeManager::currentNM()->mkNode( MULT, subs[i], NodeManager::currentNM()->mkConst( Rational(1)/prop[i].d_coeff.getConst<Rational>() ) ); nn = NodeManager::currentNM()->mkNode( kind::TO_INTEGER, nn ); nn = Rewriter::rewrite( nn ); @@ -1238,7 +1241,7 @@ Node CegInstantiator::applySubstitution( TypeNode tn, Node n, std::vector< Node if( !it->second.isNull() ){ c_coeff = NodeManager::currentNM()->mkNode( MULT, c_coeff, it->second ); } - Assert( !c_coeff.isNull() ); + Assert(!c_coeff.isNull()); Node c; if( msum_term[it->first].isNull() ){ c = c_coeff; @@ -1285,7 +1288,7 @@ Node CegInstantiator::applySubstitutionToLiteral( Node lit, std::vector< Node >& bool pol = lit.getKind()!=NOT; //arithmetic inequalities and disequalities if( atom.getKind()==GEQ || ( atom.getKind()==EQUAL && !pol && atom[0].getType().isReal() ) ){ - Assert( atom.getKind()!=GEQ || atom[1].isConst() ); + Assert(atom.getKind() != GEQ || atom[1].isConst()); Node atom_lhs; Node atom_rhs; if( atom.getKind()==GEQ ){ @@ -1512,7 +1515,7 @@ void CegInstantiator::processAssertions() { addToAuxVarSubstitution( subs_lhs, subs_rhs, r, it->second ); }else{ Trace("cbqi-proc") << "....no substitution found for auxiliary variable " << r << "!!! type is " << r.getType() << std::endl; - Assert( false ); + Assert(false); } } diff --git a/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp b/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp index 7f9c21a65..0ec87f239 100644 --- a/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp +++ b/src/theory/quantifiers/cegqi/inst_strategy_cegqi.cpp @@ -121,7 +121,7 @@ bool InstStrategyCegqi::registerCbqiLemma(Node q) //add totality lemma std::map< TypeNode, std::vector< Node > >::iterator itc = qepr->d_consts.find( tn ); if( itc!=qepr->d_consts.end() ){ - Assert( !itc->second.empty() ); + Assert(!itc->second.empty()); Node ic = d_quantEngine->getTermUtil()->getInstantiationConstant( q, i ); std::vector< Node > disj; for( unsigned j=0; j<itc->second.size(); j++ ){ @@ -131,10 +131,10 @@ bool InstStrategyCegqi::registerCbqiLemma(Node q) Trace("cbqi-lemma") << "EPR totality lemma : " << tlem << std::endl; d_quantEngine->getOutputChannel().lemma( tlem ); }else{ - Assert( false ); + Assert(false); } }else{ - Assert( !options::cbqiAll() ); + Assert(!options::cbqiAll()); } } } @@ -152,7 +152,7 @@ bool InstStrategyCegqi::registerCbqiLemma(Node q) if( std::find( d_parent_quant[q].begin(), d_parent_quant[q].end(), qi )==d_parent_quant[q].end() ){ d_parent_quant[q].push_back( qi ); d_children_quant[qi].push_back( q ); - Assert( hasAddedCbqiLemma( qi ) ); + Assert(hasAddedCbqiLemma(qi)); Node qicel = getCounterexampleLiteral(qi); dep.push_back( qi ); dep.push_back( qicel ); @@ -221,7 +221,7 @@ void InstStrategyCegqi::reset_round(Theory::Effort effort) Node q = d_quantEngine->getModel()->getAssertedQuantifier( i ); //it is not active if it corresponds to a rewrite rule: we will process in rewrite engine if( doCbqi( q ) ){ - Assert( hasAddedCbqiLemma( q ) ); + Assert(hasAddedCbqiLemma(q)); if( d_quantEngine->getModel()->isQuantifierActive( q ) ){ d_active_quant[q] = true; Debug("cbqi-debug") << "Check quantified formula " << q << "..." << std::endl; @@ -242,8 +242,8 @@ void InstStrategyCegqi::reset_round(Theory::Effort effort) //process from waitlist while( d_nested_qe_waitlist_proc[q]<d_nested_qe_waitlist_size[q] ){ int index = d_nested_qe_waitlist_proc[q]; - Assert( index>=0 ); - Assert( index<(int)d_nested_qe_waitlist[q].size() ); + Assert(index >= 0); + Assert(index < (int)d_nested_qe_waitlist[q].size()); Node nq = d_nested_qe_waitlist[q][index]; Node nqeqn = doNestedQENode( d_nested_qe_info[nq].d_q, q, nq, d_nested_qe_info[nq].d_inst_terms, d_nested_qe_info[nq].d_doVts ); Node dqelem = nq.eqNode( nqeqn ); @@ -279,10 +279,10 @@ void InstStrategyCegqi::reset_round(Theory::Effort effort) } Trace("cbqi-debug") << "Found " << ninner.size() << " non-innermost." << std::endl; for( unsigned i=0; i<ninner.size(); i++ ){ - Assert( d_active_quant.find( ninner[i] )!=d_active_quant.end() ); + Assert(d_active_quant.find(ninner[i]) != d_active_quant.end()); d_active_quant.erase( ninner[i] ); } - Assert( !d_active_quant.empty() ); + Assert(!d_active_quant.empty()); Trace("cbqi-debug") << "...done removing." << std::endl; } } @@ -293,7 +293,7 @@ void InstStrategyCegqi::check(Theory::Effort e, QEffort quant_e) { if (quant_e == QEFFORT_STANDARD) { - Assert( !d_quantEngine->inConflict() ); + Assert(!d_quantEngine->inConflict()); double clSet = 0; if( Trace.isOn("cbqi-engine") ){ clSet = double(clock())/double(CLOCKS_PER_SEC); @@ -314,7 +314,7 @@ void InstStrategyCegqi::check(Theory::Effort e, QEffort quant_e) } }else{ Trace("cbqi-warn") << "CBQI : Cannot process already eliminated quantified formula " << q << std::endl; - Assert( false ); + Assert(false); } } if( d_quantEngine->inConflict() || d_quantEngine->getNumLemmasWaiting()>lastWaiting ){ @@ -490,9 +490,10 @@ Node InstStrategyCegqi::doNestedQENode( Trace("cbqi-nqe") << " " << ceq << std::endl; Trace("cbqi-nqe") << " " << d_nested_qe[ceq] << std::endl; //should not contain quantifiers - Assert( !QuantifiersRewriter::containsQuantifiers( d_nested_qe[ceq] ) ); + Assert(!QuantifiersRewriter::containsQuantifiers(d_nested_qe[ceq])); } - Assert( d_quantEngine->getTermUtil()->d_inst_constants[q].size()==inst_terms.size() ); + Assert(d_quantEngine->getTermUtil()->d_inst_constants[q].size() + == inst_terms.size()); //replace inst constants with instantiation Node ret = d_nested_qe[ceq].substitute( d_quantEngine->getTermUtil()->d_inst_constants[q].begin(), d_quantEngine->getTermUtil()->d_inst_constants[q].end(), @@ -544,7 +545,7 @@ Node InstStrategyCegqi::doNestedQERec(Node q, d_nested_qe_info[nr].d_inst_terms.insert( d_nested_qe_info[nr].d_inst_terms.end(), inst_terms.begin(), inst_terms.end() ); d_nested_qe_info[nr].d_doVts = doVts; //TODO: ensure this holds by restricting prenex when cbqiNestedQe is true. - Assert( !options::cbqiInnermost() ); + Assert(!options::cbqiInnermost()); } } } @@ -665,7 +666,7 @@ Node InstStrategyCegqi::getCounterexampleLiteral(Node q) } bool InstStrategyCegqi::doAddInstantiation( std::vector< Node >& subs ) { - Assert( !d_curr_quant.isNull() ); + Assert(!d_curr_quant.isNull()); //if doing partial quantifier elimination, record the instantiation and set the incomplete flag instead of sending instantiation lemma if( d_quantEngine->getQuantAttributes()->isQuantElimPartial( d_curr_quant ) ){ d_cbqi_set_quant_inactive = true; diff --git a/src/theory/quantifiers/conjecture_generator.cpp b/src/theory/quantifiers/conjecture_generator.cpp index 400db4a8e..bdab6810c 100644 --- a/src/theory/quantifiers/conjecture_generator.cpp +++ b/src/theory/quantifiers/conjecture_generator.cpp @@ -42,7 +42,7 @@ struct sortConjectureScore { void OpArgIndex::addTerm( std::vector< TNode >& terms, TNode n, unsigned index ){ if( index==n.getNumChildren() ){ - Assert( n.hasOperator() ); + Assert(n.hasOperator()); if( std::find( d_ops.begin(), d_ops.end(), n.getOperator() )==d_ops.end() ){ d_ops.push_back( n.getOperator() ); d_op_terms.push_back( n ); @@ -188,12 +188,12 @@ void ConjectureGenerator::setUniversalRelevant( TNode n ) { bool ConjectureGenerator::isUniversalLessThan( TNode rt1, TNode rt2 ) { //prefer the one that is (normal, smaller) lexographically - Assert( d_pattern_is_relevant.find( rt1 )!=d_pattern_is_relevant.end() ); - Assert( d_pattern_is_relevant.find( rt2 )!=d_pattern_is_relevant.end() ); - Assert( d_pattern_is_normal.find( rt1 )!=d_pattern_is_normal.end() ); - Assert( d_pattern_is_normal.find( rt2 )!=d_pattern_is_normal.end() ); - Assert( d_pattern_fun_sum.find( rt1 )!=d_pattern_fun_sum.end() ); - Assert( d_pattern_fun_sum.find( rt2 )!=d_pattern_fun_sum.end() ); + Assert(d_pattern_is_relevant.find(rt1) != d_pattern_is_relevant.end()); + Assert(d_pattern_is_relevant.find(rt2) != d_pattern_is_relevant.end()); + Assert(d_pattern_is_normal.find(rt1) != d_pattern_is_normal.end()); + Assert(d_pattern_is_normal.find(rt2) != d_pattern_is_normal.end()); + Assert(d_pattern_fun_sum.find(rt1) != d_pattern_fun_sum.end()); + Assert(d_pattern_fun_sum.find(rt2) != d_pattern_fun_sum.end()); if( d_pattern_is_relevant[rt1] && !d_pattern_is_relevant[rt2] ){ Trace("thm-ee-debug") << "UEE : LT due to relevant." << std::endl; @@ -271,7 +271,7 @@ TNode ConjectureGenerator::getUniversalRepresentative( TNode n, bool add ) { if( d_urelevant_terms.find( eq_terms[i] )!=d_urelevant_terms.end() ){ assertEq = true; }else{ - Assert( eq_terms[i].getType()==tn ); + Assert(eq_terms[i].getType() == tn); registerPattern( eq_terms[i], tn ); if( isUniversalLessThan( eq_terms[i], t ) || ( options::conjectureUeeIntro() && d_pattern_fun_sum[t]>=d_pattern_fun_sum[eq_terms[i]] ) ){ setUniversalRelevant( eq_terms[i] ); @@ -409,8 +409,8 @@ void ConjectureGenerator::check(Theory::Effort e, QEffort quant_e) } ++eqcs_i; } - Assert( !d_bool_eqc[0].isNull() ); - Assert( !d_bool_eqc[1].isNull() ); + Assert(!d_bool_eqc[0].isNull()); + Assert(!d_bool_eqc[1].isNull()); d_urelevant_terms.clear(); Trace("sg-proc") << "...done get eq classes" << std::endl; @@ -675,7 +675,10 @@ void ConjectureGenerator::check(Theory::Effort e, QEffort quant_e) //add information about pattern Trace("sg-gen-tg-debug") << "Collect pattern information..." << std::endl; - Assert( std::find( d_rel_patterns[tnn].begin(), d_rel_patterns[tnn].end(), nn )==d_rel_patterns[tnn].end() ); + Assert(std::find(d_rel_patterns[tnn].begin(), + d_rel_patterns[tnn].end(), + nn) + == d_rel_patterns[tnn].end()); d_rel_patterns[tnn].push_back( nn ); //build information concerning the variables in this pattern unsigned sum = 0; @@ -695,7 +698,7 @@ void ConjectureGenerator::check(Theory::Effort e, QEffort quant_e) d_rel_pattern_var_sum[nn] = sum; //register the pattern registerPattern( nn, tnn ); - Assert( d_pattern_is_normal[nn] ); + Assert(d_pattern_is_normal[nn]); Trace("sg-gen-tg-debug") << "...done collect pattern information" << std::endl; //record information about types @@ -739,7 +742,7 @@ void ConjectureGenerator::check(Theory::Effort e, QEffort quant_e) Trace("sg-rel-term-debug") << " "; } Trace("sg-rel-term-debug") << it->first << ":x" << it2->first << " -> " << it2->second; - Assert( tindex+it2->first<gsubs_terms.size() ); + Assert(tindex + it2->first < gsubs_terms.size()); gsubs_terms[tindex+it2->first] = it2->second; } } @@ -787,7 +790,7 @@ void ConjectureGenerator::check(Theory::Effort e, QEffort quant_e) if( considerTermCanon( rhs, false ) ){ Trace("sg-rel-prop") << "Relevant RHS : " << rhs << std::endl; //register pattern - Assert( rhs.getType()==rt_types[i] ); + Assert(rhs.getType() == rt_types[i]); registerPattern( rhs, rt_types[i] ); if( rdepth<depth ){ //consider against all LHS at depth @@ -969,7 +972,7 @@ unsigned ConjectureGenerator::collectFunctions( TNode opat, TNode pat, std::map< } return sum; }else{ - Assert( pat.getNumChildren()==0 ); + Assert(pat.getNumChildren() == 0); funcs[pat]++; //for variables if( pat.getKind()==BOUND_VARIABLE ){ @@ -1009,8 +1012,8 @@ void ConjectureGenerator::registerPattern( Node pat, TypeNode tpat ) { d_patterns[TypeNode::null()].push_back( pat ); d_patterns[tpat].push_back( pat ); - Assert( d_pattern_fun_id.find( pat )==d_pattern_fun_id.end() ); - Assert( d_pattern_var_id.find( pat )==d_pattern_var_id.end() ); + Assert(d_pattern_fun_id.find(pat) == d_pattern_fun_id.end()); + Assert(d_pattern_var_id.find(pat) == d_pattern_var_id.end()); //collect functions std::map< TypeNode, unsigned > mnvn; @@ -1034,11 +1037,11 @@ bool ConjectureGenerator::isGeneralization( TNode patg, TNode pat, std::map< TNo return true; } }else{ - Assert( patg.hasOperator() ); + Assert(patg.hasOperator()); if( !pat.hasOperator() || patg.getOperator()!=pat.getOperator() ){ return false; }else{ - Assert( patg.getNumChildren()==pat.getNumChildren() ); + Assert(patg.getNumChildren() == pat.getNumChildren()); for( unsigned i=0; i<patg.getNumChildren(); i++ ){ if( !isGeneralization( patg[i], pat[i], subs ) ){ return false; @@ -1151,8 +1154,8 @@ void ConjectureGenerator::getEnumerateUfTerm( Node n, unsigned num, std::vector< children.push_back( n.getOperator() ); for( unsigned i=0; i<(vec.size()-1); i++ ){ Node nn = te->getEnumerateTerm(types[i], vec[i]); - Assert( !nn.isNull() ); - Assert( nn.getType()==n[i].getType() ); + Assert(!nn.isNull()); + Assert(nn.getType() == n[i].getType()); children.push_back( nn ); } children.push_back( lc ); @@ -1233,7 +1236,7 @@ void ConjectureGenerator::processCandidateConjecture( TNode lhs, TNode rhs, unsi } int ConjectureGenerator::considerCandidateConjecture( TNode lhs, TNode rhs ) { - Assert( lhs.getType()==rhs.getType() ); + Assert(lhs.getType() == rhs.getType()); Trace("sg-cconj-debug") << "Consider candidate conjecture : " << lhs << " == " << rhs << "?" << std::endl; if( lhs==rhs ){ @@ -1288,7 +1291,7 @@ int ConjectureGenerator::considerCandidateConjecture( TNode lhs, TNode rhs ) { Trace("sg-cconj") << "Consider possible candidate conjecture : " << lhs << " == " << rhs << "?" << std::endl; //find witness for counterexample, if possible if( options::conjectureFilterModel() ){ - Assert( d_rel_pattern_var_sum.find( lhs )!=d_rel_pattern_var_sum.end() ); + Assert(d_rel_pattern_var_sum.find(lhs) != d_rel_pattern_var_sum.end()); Trace("sg-cconj-debug") << "Notify substitutions over " << d_rel_pattern_var_sum[lhs] << " variables." << std::endl; std::map< TNode, TNode > subs; d_subs_confirmCount = 0; @@ -1329,7 +1332,7 @@ bool ConjectureGenerator::notifySubstitution( TNode glhs, std::map< TNode, TNode if( Trace.isOn("sg-cconj-debug") ){ Trace("sg-cconj-debug") << "Ground eqc for LHS : " << glhs << ", based on substituion: " << std::endl; for( std::map< TNode, TNode >::iterator it = subs.begin(); it != subs.end(); ++it ){ - Assert( getRepresentative( it->second )==it->second ); + Assert(getRepresentative(it->second) == it->second); Trace("sg-cconj-debug") << " " << it->first << " -> " << it->second << std::endl; } } @@ -1398,7 +1401,7 @@ bool ConjectureGenerator::notifySubstitution( TNode glhs, std::map< TNode, TNode void TermGenerator::reset( TermGenEnv * s, TypeNode tn ) { - Assert( d_children.empty() ); + Assert(d_children.empty()); d_typ = tn; d_status = 0; d_status_num = 0; @@ -1496,14 +1499,14 @@ bool TermGenerator::getNextTerm( TermGenEnv * s, unsigned depth ) { return s->considerCurrentTermCanon( d_id ) ? true : getNextTerm( s, depth ); //return true; }else{ - Assert( d_status_child_num<(int)s->d_func_args[f].size() ); + Assert(d_status_child_num < (int)s->d_func_args[f].size()); if( d_status_child_num==(int)d_children.size() ){ d_children.push_back( s->d_tg_id ); - Assert( s->d_tg_alloc.find( s->d_tg_id )==s->d_tg_alloc.end() ); + Assert(s->d_tg_alloc.find(s->d_tg_id) == s->d_tg_alloc.end()); s->d_tg_alloc[d_children[d_status_child_num]].reset( s, s->d_func_args[f][d_status_child_num] ); return getNextTerm( s, depth ); }else{ - Assert( d_status_child_num+1==(int)d_children.size() ); + Assert(d_status_child_num + 1 == (int)d_children.size()); if( s->d_tg_alloc[d_children[d_status_child_num]].getNextTerm( s, depth-1 ) ){ d_status_child_num++; return getNextTerm( s, depth ); @@ -1520,7 +1523,7 @@ bool TermGenerator::getNextTerm( TermGenEnv * s, unsigned depth ) { }else if( d_status==1 || d_status==3 ){ if( d_status==1 ){ s->removeVar( d_typ ); - Assert( d_status_num==(int)s->d_var_id[d_typ] ); + Assert(d_status_num == (int)s->d_var_id[d_typ]); //check if there is only one feasible equivalence class. if so, don't make pattern any more specific. //unsigned i = s->d_ccand_eqc[0].size()-1; //if( s->d_ccand_eqc[0][i].size()==1 && s->d_ccand_eqc[1][i].empty() ){ @@ -1533,7 +1536,7 @@ bool TermGenerator::getNextTerm( TermGenEnv * s, unsigned depth ) { d_status_num = -1; return getNextTerm( s, depth ); }else{ - Assert( d_children.empty() ); + Assert(d_children.empty()); return false; } } @@ -1598,7 +1601,7 @@ bool TermGenerator::getNextMatch( TermGenEnv * s, TNode eqc, std::map< TypeNode, return false; } } - Assert( subs[d_typ].find( d_status_num )==subs[d_typ].end() ); + Assert(subs[d_typ].find(d_status_num) == subs[d_typ].end()); subs[d_typ][d_status_num] = eqc; return true; }else{ @@ -1612,9 +1615,9 @@ bool TermGenerator::getNextMatch( TermGenEnv * s, TNode eqc, std::map< TypeNode, }else if( d_status==2 ){ if( d_match_status==0 ){ d_match_status++; - Assert( d_status_num<(int)s->getNumTgVars( d_typ ) ); + Assert(d_status_num < (int)s->getNumTgVars(d_typ)); std::map< unsigned, TNode >::iterator it = subs[d_typ].find( d_status_num ); - Assert( it!=subs[d_typ].end() ); + Assert(it != subs[d_typ].end()); return it->second==eqc; }else{ return false; @@ -1630,7 +1633,7 @@ bool TermGenerator::getNextMatch( TermGenEnv * s, TNode eqc, std::map< TypeNode, if( d_match_status_child_num==0 ){ //initial binding TNode f = s->getTgFunc( d_typ, d_status_num ); - Assert( !eqc.isNull() ); + Assert(!eqc.isNull()); TNodeTrie* tat = s->getTermDatabase()->getTermArgTrie(eqc, f); if( tat ){ d_match_children.push_back( tat->d_data.begin() ); @@ -1646,7 +1649,7 @@ bool TermGenerator::getNextMatch( TermGenEnv * s, TNode eqc, std::map< TypeNode, } } d_match_status++; - Assert( d_match_status_child_num+1==(int)d_match_children.size() ); + Assert(d_match_status_child_num + 1 == (int)d_match_children.size()); if( d_match_children[d_match_status_child_num]==d_match_children_end[d_match_status_child_num] ){ //no more arguments to bind d_match_children.pop_back(); @@ -1667,9 +1670,10 @@ bool TermGenerator::getNextMatch( TermGenEnv * s, TNode eqc, std::map< TypeNode, } } }else{ - Assert( d_match_status==1 ); - Assert( d_match_status_child_num+1==(int)d_match_children.size() ); - Assert( d_match_children[d_match_status_child_num]!=d_match_children_end[d_match_status_child_num] ); + Assert(d_match_status == 1); + Assert(d_match_status_child_num + 1 == (int)d_match_children.size()); + Assert(d_match_children[d_match_status_child_num] + != d_match_children_end[d_match_status_child_num]); d_match_status--; if( s->d_tg_alloc[d_children[d_match_status_child_num]].getNextMatch( s, d_match_children[d_match_status_child_num]->first, subs, rev_subs ) ){ d_match_status_child_num++; @@ -1681,7 +1685,7 @@ bool TermGenerator::getNextMatch( TermGenEnv * s, TNode eqc, std::map< TypeNode, } } } - Assert( false ); + Assert(false); return false; } @@ -1708,7 +1712,7 @@ unsigned TermGenerator::calculateGeneralizationDepth( TermGenEnv * s, std::map< } return sum; }else{ - Assert( d_status==2 || d_status==1 ); + Assert(d_status == 2 || d_status == 1); std::map< TypeNode, std::vector< int > >::iterator it = fvs.find( d_typ ); if( it!=fvs.end() ){ if( std::find( it->second.begin(), it->second.end(), d_status_num )!=it->second.end() ){ @@ -1731,7 +1735,7 @@ unsigned TermGenerator::getGeneralizationDepth( TermGenEnv * s ) { Node TermGenerator::getTerm( TermGenEnv * s ) { if( d_status==1 || d_status==2 ){ - Assert( !d_typ.isNull() ); + Assert(!d_typ.isNull()); return s->getFreeVar( d_typ, d_status_num ); }else if( d_status==5 ){ Node f = s->getTgFunc( d_typ, d_status_num ); @@ -1752,7 +1756,7 @@ Node TermGenerator::getTerm( TermGenEnv * s ) { return NodeManager::currentNM()->mkNode( s->d_func_kind[f], children ); } }else{ - Assert( false ); + Assert(false); } return Node::null(); } @@ -1833,7 +1837,7 @@ void TermGenEnv::collectSignatureInformation() { } void TermGenEnv::reset( unsigned depth, bool genRelevant, TypeNode tn ) { - Assert( d_tg_alloc.empty() ); + Assert(d_tg_alloc.empty()); d_tg_alloc.clear(); if( genRelevant ){ @@ -1852,7 +1856,8 @@ void TermGenEnv::reset( unsigned depth, bool genRelevant, TypeNode tn ) { bool TermGenEnv::getNextTerm() { if( d_tg_alloc[0].getNextTerm( this, d_tg_gdepth_limit ) ){ - Assert( (int)d_tg_alloc[0].getGeneralizationDepth( this )<=d_tg_gdepth_limit ); + Assert((int)d_tg_alloc[0].getGeneralizationDepth(this) + <= d_tg_gdepth_limit); if( (int)d_tg_alloc[0].getGeneralizationDepth( this )!=d_tg_gdepth_limit ){ return getNextTerm(); }else{ @@ -1919,7 +1924,7 @@ Node TermGenEnv::getFreeVar( TypeNode tn, unsigned i ) { } bool TermGenEnv::considerCurrentTerm() { - Assert( !d_tg_alloc.empty() ); + Assert(!d_tg_alloc.empty()); //if generalization depth is too large, don't consider it unsigned i = d_tg_alloc.size(); @@ -1954,10 +1959,10 @@ bool TermGenEnv::considerCurrentTerm() { Trace("sg-gen-tg-debug") << "Filter based on relevant ground EQC"; Trace("sg-gen-tg-debug") << ", #eqc to try = " << d_ccand_eqc[0][i-1].size() << "/" << d_ccand_eqc[1][i-1].size() << std::endl; - Assert( d_ccand_eqc[0].size()>=2 ); - Assert( d_ccand_eqc[0].size()==d_ccand_eqc[1].size() ); - Assert( d_ccand_eqc[0].size()==d_tg_id+1 ); - Assert( d_tg_id==d_tg_alloc.size() ); + Assert(d_ccand_eqc[0].size() >= 2); + Assert(d_ccand_eqc[0].size() == d_ccand_eqc[1].size()); + Assert(d_ccand_eqc[0].size() == d_tg_id + 1); + Assert(d_tg_id == d_tg_alloc.size()); for( unsigned r=0; r<2; r++ ){ d_ccand_eqc[r][i].clear(); } @@ -2018,13 +2023,13 @@ void TermGenEnv::changeContext( bool add ) { d_ccand_eqc[r].pop_back(); } d_tg_id--; - Assert( d_tg_alloc.find( d_tg_id )!=d_tg_alloc.end() ); + Assert(d_tg_alloc.find(d_tg_id) != d_tg_alloc.end()); d_tg_alloc.erase( d_tg_id ); } } bool TermGenEnv::considerCurrentTermCanon( unsigned tg_id ){ - Assert( tg_id<d_tg_alloc.size() ); + Assert(tg_id < d_tg_alloc.size()); if( options::conjectureFilterCanonical() ){ //check based on a canonicity of the term (if there is one) Trace("sg-gen-tg-debug") << "Consider term canon "; @@ -2081,7 +2086,7 @@ void SubstitutionIndex::addSubstitution( TNode eqc, std::vector< TNode >& vars, if( i==vars.size() ){ d_var = eqc; }else{ - Assert( d_var.isNull() || d_var==vars[i] ); + Assert(d_var.isNull() || d_var == vars[i]); d_var = vars[i]; d_children[terms[i]].addSubstitution( eqc, vars, terms, i+1 ); } @@ -2089,10 +2094,10 @@ void SubstitutionIndex::addSubstitution( TNode eqc, std::vector< TNode >& vars, bool SubstitutionIndex::notifySubstitutions( ConjectureGenerator * s, std::map< TNode, TNode >& subs, TNode rhs, unsigned numVars, unsigned i ) { if( i==numVars ){ - Assert( d_children.empty() ); + Assert(d_children.empty()); return s->notifySubstitution( d_var, subs, rhs ); }else{ - Assert( i==0 || !d_children.empty() ); + Assert(i == 0 || !d_children.empty()); for( std::map< TNode, SubstitutionIndex >::iterator it = d_children.begin(); it != d_children.end(); ++it ){ Trace("sg-cconj-debug2") << "Try " << d_var << " -> " << it->first << " (" << i << "/" << numVars << ")" << std::endl; subs[d_var] = it->first; @@ -2130,9 +2135,9 @@ void TheoremIndex::addTheoremNode( TNode curr, std::vector< TNode >& lhs_v, std: lhs_arg.push_back( 0 ); d_children[curr.getOperator()].addTheorem( lhs_v, lhs_arg, rhs ); }else{ - Assert( curr.getKind()==kind::BOUND_VARIABLE ); + Assert(curr.getKind() == kind::BOUND_VARIABLE); TypeNode tn = curr.getType(); - Assert( d_var[tn].isNull() || d_var[tn]==curr ); + Assert(d_var[tn].isNull() || d_var[tn] == curr); d_var[tn] = curr; d_children[curr].addTheorem( lhs_v, lhs_arg, rhs ); } @@ -2180,7 +2185,7 @@ void TheoremIndex::getEquivalentTermsNode( Node curr, std::vector< TNode >& n_v, std::map< TypeNode, TNode >::iterator itt = d_var.find( tn ); if( itt!=d_var.end() ){ Trace("thm-db-debug") << "Check for substitution with " << itt->second << "..." << std::endl; - Assert( curr.getType()==itt->second.getType() ); + Assert(curr.getType() == itt->second.getType()); //add to substitution if possible bool success = false; std::map< TNode, TNode >::iterator it = smap.find( itt->second ); diff --git a/src/theory/quantifiers/ematching/candidate_generator.cpp b/src/theory/quantifiers/ematching/candidate_generator.cpp index 3be1d4a4b..3a075ec8a 100644 --- a/src/theory/quantifiers/ematching/candidate_generator.cpp +++ b/src/theory/quantifiers/ematching/candidate_generator.cpp @@ -40,7 +40,7 @@ CandidateGeneratorQE::CandidateGeneratorQE(QuantifiersEngine* qe, Node pat) d_mode(cand_term_none) { d_op = qe->getTermDatabase()->getMatchOperator( pat ); - Assert( !d_op.isNull() ); + Assert(!d_op.isNull()); } void CandidateGeneratorQE::resetInstantiationRound(){ @@ -130,8 +130,7 @@ Node CandidateGeneratorQE::getNextCandidate(){ CandidateGeneratorQELitDeq::CandidateGeneratorQELitDeq( QuantifiersEngine* qe, Node mpat ) : CandidateGenerator( qe ), d_match_pattern( mpat ){ - - Assert( d_match_pattern.getKind()==EQUAL ); + Assert(d_match_pattern.getKind() == EQUAL); d_match_pattern_type = d_match_pattern[0].getType(); } @@ -161,7 +160,7 @@ Node CandidateGeneratorQELitDeq::getNextCandidate(){ CandidateGeneratorQEAll::CandidateGeneratorQEAll( QuantifiersEngine* qe, Node mpat ) : CandidateGenerator( qe ), d_match_pattern( mpat ){ d_match_pattern_type = mpat.getType(); - Assert( mpat.getKind()==INST_CONSTANT ); + Assert(mpat.getKind() == INST_CONSTANT); d_f = quantifiers::TermUtil::getInstConstAttr( mpat ); d_index = mpat.getAttribute(InstVarNumAttribute()); d_firstTime = false; diff --git a/src/theory/quantifiers/ematching/inst_match_generator.cpp b/src/theory/quantifiers/ematching/inst_match_generator.cpp index 9e76a6a31..e639dc446 100644 --- a/src/theory/quantifiers/ematching/inst_match_generator.cpp +++ b/src/theory/quantifiers/ematching/inst_match_generator.cpp @@ -43,7 +43,7 @@ InstMatchGenerator::InstMatchGenerator( Node pat ){ d_cg = NULL; d_needsReset = true; d_active_add = true; - Assert( quantifiers::TermUtil::hasInstConstAttr(pat) ); + Assert(quantifiers::TermUtil::hasInstConstAttr(pat)); d_pattern = pat; d_match_pattern = pat; d_match_pattern_type = pat.getType(); @@ -258,7 +258,7 @@ int InstMatchGenerator::getMatch( { Trace("matching") << "Matching " << t << " against pattern " << d_match_pattern << " (" << m << ")" << ", " << d_children.size() << ", pattern is " << d_pattern << std::endl; - Assert( !d_match_pattern.isNull() ); + Assert(!d_match_pattern.isNull()); if (d_cg == nullptr) { Trace("matching-fail") << "Internal error for match generator." << std::endl; @@ -270,10 +270,12 @@ int InstMatchGenerator::getMatch( //InstMatch prev( &m ); std::vector< int > prev; //if t is null - Assert( !t.isNull() ); - Assert( !quantifiers::TermUtil::hasInstConstAttr(t) ); - Assert( d_match_pattern.getKind()==INST_CONSTANT || t.getKind()==d_match_pattern.getKind() ); - Assert( !Trigger::isAtomicTrigger( d_match_pattern ) || t.getOperator()==d_match_pattern.getOperator() ); + Assert(!t.isNull()); + Assert(!quantifiers::TermUtil::hasInstConstAttr(t)); + Assert(d_match_pattern.getKind() == INST_CONSTANT + || t.getKind() == d_match_pattern.getKind()); + Assert(!Trigger::isAtomicTrigger(d_match_pattern) + || t.getOperator() == d_match_pattern.getOperator()); //first, check if ground arguments are not equal, or a match is in conflict Trace("matching-debug2") << "Setting immediate matches..." << std::endl; for (unsigned i = 0, size = d_match_pattern.getNumChildren(); i < size; i++) @@ -338,7 +340,7 @@ int InstMatchGenerator::getMatch( if( t.getType().isBoolean() ){ t_match = NodeManager::currentNM()->mkConst( !q->areEqual( qe->getTermUtil()->d_true, t ) ); }else{ - Assert( t.getType().isReal() ); + Assert(t.getType().isReal()); t_match = NodeManager::currentNM()->mkNode(PLUS, t, qe->getTermUtil()->d_one); } }else if( pat.getKind()==GEQ ){ @@ -467,7 +469,7 @@ int InstMatchGenerator::getNextMatch(Node f, //if t not null, try to fit it into match m if( !t.isNull() ){ if( d_curr_exclude_match.find( t )==d_curr_exclude_match.end() ){ - Assert( t.getType().isComparableTo( d_match_pattern_type ) ); + Assert(t.getType().isComparableTo(d_match_pattern_type)); Trace("matching-summary") << "Try " << d_match_pattern << " : " << t << std::endl; success = getMatch(f, t, m, qe, tparent); if( d_independent_gen && success<0 ){ @@ -533,11 +535,11 @@ InstMatchGenerator* InstMatchGenerator::mkInstMatchGenerator( Node q, Node pat, } InstMatchGenerator* InstMatchGenerator::mkInstMatchGeneratorMulti( Node q, std::vector< Node >& pats, QuantifiersEngine* qe ) { - Assert( pats.size()>1 ); + Assert(pats.size() > 1); InstMatchGeneratorMultiLinear * imgm = new InstMatchGeneratorMultiLinear( q, pats, qe ); std::vector< InstMatchGenerator* > gens; imgm->initialize(q, qe, gens); - Assert( gens.size()==pats.size() ); + Assert(gens.size() == pats.size()); std::vector< Node > patsn; std::map< Node, InstMatchGenerator * > pat_map_init; for( unsigned i=0; i<gens.size(); i++ ){ @@ -704,7 +706,7 @@ InstMatchGeneratorMultiLinear::InstMatchGeneratorMultiLinear( Node q, std::vecto for( unsigned i=0; i<pats_ordered.size(); i++ ){ Trace("multi-trigger-linear") << "...make for " << pats_ordered[i] << std::endl; InstMatchGenerator* cimg = getInstMatchGenerator(q, pats_ordered[i]); - Assert( cimg!=NULL ); + Assert(cimg != NULL); d_children.push_back( cimg ); if( i==0 ){ //TODO : improve cimg->setIndependent(); @@ -722,7 +724,7 @@ int InstMatchGeneratorMultiLinear::resetChildren( QuantifiersEngine* qe ){ } bool InstMatchGeneratorMultiLinear::reset( Node eqc, QuantifiersEngine* qe ) { - Assert( eqc.isNull() ); + Assert(eqc.isNull()); if( options::multiTriggerLinear() ){ return true; }else{ @@ -744,7 +746,7 @@ int InstMatchGeneratorMultiLinear::getNextMatch(Node q, } } Trace("multi-trigger-linear-debug") << "InstMatchGeneratorMultiLinear::getNextMatch : continue match " << std::endl; - Assert( d_next!=NULL ); + Assert(d_next != NULL); int ret_val = continueNextMatch(q, m, qe, tparent); if( ret_val>0 ){ Trace("multi-trigger-linear") << "Successful multi-trigger instantiation." << std::endl; @@ -924,7 +926,7 @@ void InstMatchGeneratorMulti::processNewInstantiations(QuantifiersEngine* qe, int endChildIndex, bool modEq) { - Assert( !qe->inConflict() ); + Assert(!qe->inConflict()); if( childIndex==endChildIndex ){ // m is an instantiation if (sendInstantiation(tparent, m)) @@ -1036,9 +1038,9 @@ InstMatchGeneratorSimple::InstMatchGeneratorSimple(Node q, if( d_match_pattern.getKind()==EQUAL ){ d_eqc = d_match_pattern[1]; d_match_pattern = d_match_pattern[0]; - Assert( !quantifiers::TermUtil::hasInstConstAttr( d_eqc ) ); + Assert(!quantifiers::TermUtil::hasInstConstAttr(d_eqc)); } - Assert( Trigger::isSimpleTrigger( d_match_pattern ) ); + Assert(Trigger::isSimpleTrigger(d_match_pattern)); for( unsigned i=0; i<d_match_pattern.getNumChildren(); i++ ){ if( d_match_pattern[i].getKind()==INST_CONSTANT ){ if( !options::cbqi() || quantifiers::TermUtil::getInstConstAttr(d_match_pattern[i])==q ){ @@ -1105,7 +1107,7 @@ void InstMatchGeneratorSimple::addInstantiations(InstMatch& m, Debug("simple-trigger-debug") << "Add inst " << argIndex << " " << d_match_pattern << std::endl; if (argIndex == d_match_pattern.getNumChildren()) { - Assert( !tat->d_data.empty() ); + Assert(!tat->d_data.empty()); TNode t = tat->getData(); Debug("simple-trigger") << "Actual term is " << t << std::endl; //convert to actual used terms @@ -1135,7 +1137,8 @@ void InstMatchGeneratorSimple::addInstantiations(InstMatch& m, Node t = tt.first; Node prev = m.get( v ); //using representatives, just check if equal - Assert( t.getType().isComparableTo( d_match_pattern_arg_types[argIndex] ) ); + Assert( + t.getType().isComparableTo(d_match_pattern_arg_types[argIndex])); if( prev.isNull() || prev==t ){ m.setValue( v, t); addInstantiations(m, qe, addedLemmas, argIndex + 1, &(tt.second)); diff --git a/src/theory/quantifiers/ematching/inst_strategy_e_matching.cpp b/src/theory/quantifiers/ematching/inst_strategy_e_matching.cpp index 876e4e369..3420f282d 100644 --- a/src/theory/quantifiers/ematching/inst_strategy_e_matching.cpp +++ b/src/theory/quantifiers/ematching/inst_strategy_e_matching.cpp @@ -125,7 +125,7 @@ int InstStrategyUserPatterns::process( Node f, Theory::Effort effort, int e ){ } void InstStrategyUserPatterns::addUserPattern( Node q, Node pat ){ - Assert( pat.getKind()==INST_PATTERN ); + Assert(pat.getKind() == INST_PATTERN); //add to generators bool usable = true; std::vector< Node > nodes; @@ -308,7 +308,7 @@ void InstStrategyAutoGenTriggers::generateTriggers( Node f ){ if( Trace.isOn("auto-gen-trigger-debug") ){ Trace("auto-gen-trigger-debug") << "Collected pat terms for " << bd << ", no-patterns : " << d_user_no_gen[f].size() << std::endl; for( unsigned i=0; i<patTermsF.size(); i++ ){ - Assert( tinfo.find( patTermsF[i] )!=tinfo.end() ); + Assert(tinfo.find(patTermsF[i]) != tinfo.end()); Trace("auto-gen-trigger-debug") << " " << patTermsF[i] << std::endl; Trace("auto-gen-trigger-debug2") << " info = [" << tinfo[patTermsF[i]].d_reqPol << ", " << tinfo[patTermsF[i]].d_reqPolEq << ", " << tinfo[patTermsF[i]].d_fv.size() << "]" << std::endl; } @@ -320,7 +320,7 @@ void InstStrategyAutoGenTriggers::generateTriggers( Node f ){ std::map< Node, bool > rmPatTermsF; int last_weight = -1; for( unsigned i=0; i<patTermsF.size(); i++ ){ - Assert( patTermsF[i].getKind()!=NOT ); + Assert(patTermsF[i].getKind() != NOT); bool newVar = false; for( unsigned j=0; j<tinfo[ patTermsF[i] ].d_fv.size(); j++ ){ if( vcMap.find( tinfo[ patTermsF[i] ].d_fv[j] )==vcMap.end() ){ @@ -362,17 +362,17 @@ void InstStrategyAutoGenTriggers::generateTriggers( Node f ){ Trace("auto-gen-trigger-debug") << "...processing pattern " << pat << std::endl; Node mpat = pat; //process the pattern: if it has a required polarity, consider it - Assert( tinfo.find( pat )!=tinfo.end() ); + Assert(tinfo.find(pat) != tinfo.end()); int rpol = tinfo[pat].d_reqPol; Node rpoleq = tinfo[pat].d_reqPolEq; unsigned num_fv = tinfo[pat].d_fv.size(); Trace("auto-gen-trigger-debug") << "...required polarity for " << pat << " is " << rpol << ", eq=" << rpoleq << std::endl; if( rpol!=0 ){ - Assert( rpol==1 || rpol==-1 ); + Assert(rpol == 1 || rpol == -1); if( Trigger::isRelationalTrigger( pat ) ){ pat = rpol==-1 ? pat.negate() : pat; }else{ - Assert( Trigger::isAtomicTrigger( pat ) ); + Assert(Trigger::isAtomicTrigger(pat)); if( pat.getType().isBoolean() && rpoleq.isNull() ){ if( options::literalMatchMode()==LITERAL_MATCH_USE ){ pat = NodeManager::currentNM()->mkNode( EQUAL, pat, NodeManager::currentNM()->mkConst( rpol==-1 ) ).negate(); @@ -380,7 +380,7 @@ void InstStrategyAutoGenTriggers::generateTriggers( Node f ){ pat = NodeManager::currentNM()->mkNode( EQUAL, pat, NodeManager::currentNM()->mkConst( rpol==1 ) ); } }else{ - Assert( !rpoleq.isNull() ); + Assert(!rpoleq.isNull()); if( rpol==-1 ){ if( options::literalMatchMode()!=LITERAL_MATCH_NONE ){ //all equivalence classes except rpoleq @@ -436,8 +436,8 @@ void InstStrategyAutoGenTriggers::generateTriggers( Node f ){ sortQuantifiersForSymbol sqfs; sqfs.d_quant_rel = d_quant_rel; for( unsigned i=0; i<patTerms.size(); i++ ){ - Assert( d_pat_to_mpat.find( patTerms[i] )!=d_pat_to_mpat.end() ); - Assert( d_pat_to_mpat[patTerms[i]].hasOperator() ); + Assert(d_pat_to_mpat.find(patTerms[i]) != d_pat_to_mpat.end()); + Assert(d_pat_to_mpat[patTerms[i]].hasOperator()); sqfs.d_op_map[ patTerms[i] ] = d_pat_to_mpat[patTerms[i]].getOperator(); } //sort based on # occurrences (this will cause Trigger to select rarer symbols) @@ -591,7 +591,7 @@ bool InstStrategyAutoGenTriggers::hasUserPatterns( Node q ) { } void InstStrategyAutoGenTriggers::addUserNoPattern( Node q, Node pat ) { - Assert( pat.getKind()==INST_NO_PATTERN && pat.getNumChildren()==1 ); + Assert(pat.getKind() == INST_NO_PATTERN && pat.getNumChildren() == 1); if( std::find( d_user_no_gen[q].begin(), d_user_no_gen[q].end(), pat[0] )==d_user_no_gen[q].end() ){ Trace("user-pat") << "Add user no-pattern: " << pat[0] << " for " << q << std::endl; d_user_no_gen[q].push_back( pat[0] ); diff --git a/src/theory/quantifiers/ematching/instantiation_engine.cpp b/src/theory/quantifiers/ematching/instantiation_engine.cpp index 2fe28fc61..23b1ff6c9 100644 --- a/src/theory/quantifiers/ematching/instantiation_engine.cpp +++ b/src/theory/quantifiers/ematching/instantiation_engine.cpp @@ -145,7 +145,7 @@ void InstantiationEngine::check(Theory::Effort e, QEffort quant_e) unsigned lastWaiting = d_quantEngine->getNumLemmasWaiting(); doInstantiationRound( e ); if( d_quantEngine->inConflict() ){ - Assert( d_quantEngine->getNumLemmasWaiting()>lastWaiting ); + Assert(d_quantEngine->getNumLemmasWaiting() > lastWaiting); Trace("inst-engine") << "Conflict, added lemmas = " << (d_quantEngine->getNumLemmasWaiting()-lastWaiting) << std::endl; }else if( d_quantEngine->hasAddedLemma() ){ Trace("inst-engine") << "Added lemmas = " << (d_quantEngine->getNumLemmasWaiting()-lastWaiting) << std::endl; diff --git a/src/theory/quantifiers/ematching/trigger.cpp b/src/theory/quantifiers/ematching/trigger.cpp index 201aad3a0..f539bccf5 100644 --- a/src/theory/quantifiers/ematching/trigger.cpp +++ b/src/theory/quantifiers/ematching/trigger.cpp @@ -144,7 +144,7 @@ bool Trigger::mkTriggerTerms( Node q, std::vector< Node >& nodes, unsigned n_var bool foundVar = false; for( unsigned j=0; j<varContains[ temp[i] ].size(); j++ ){ Node v = varContains[ temp[i] ][j]; - Assert( quantifiers::TermUtil::getInstConstAttr(v)==q ); + Assert(quantifiers::TermUtil::getInstConstAttr(v) == q); if( vars.find( v )==vars.end() ){ varCount++; vars[ v ] = true; @@ -282,7 +282,7 @@ bool Trigger::isUsable( Node n, Node q ){ } Node Trigger::getIsUsableEq( Node q, Node n ) { - Assert( isRelationalTrigger( n ) ); + Assert(isRelationalTrigger(n)); for( unsigned i=0; i<2; i++) { if( isUsableEqTerms( q, n[i], n[1-i] ) ){ if( i==1 && n.getKind()==EQUAL && !quantifiers::TermUtil::hasInstConstAttr(n[0]) ){ @@ -451,8 +451,8 @@ void Trigger::collectPatTerms2( Node q, Node n, std::map< Node, std::vector< Nod } } if( !nu.isNull() ){ - Assert( nu==n ); - Assert( nu.getKind()!=NOT ); + Assert(nu == n); + Assert(nu.getKind() != NOT); Trace("auto-gen-trigger-debug2") << "...found usable trigger : " << nu << std::endl; Node reqEq; if( nu.getKind()==EQUAL ){ @@ -463,8 +463,9 @@ void Trigger::collectPatTerms2( Node q, Node n, std::map< Node, std::vector< Nod nu = nu[0]; } } - Assert( reqEq.isNull() || !quantifiers::TermUtil::hasInstConstAttr( reqEq ) ); - Assert( isUsableTrigger( nu, q ) ); + Assert(reqEq.isNull() + || !quantifiers::TermUtil::hasInstConstAttr(reqEq)); + Assert(isUsableTrigger(nu, q)); //tinfo.find( nu )==tinfo.end() Trace("auto-gen-trigger-debug2") << "...add usable trigger : " << nu << std::endl; tinfo[ nu ].init( q, nu, hasEPol ? ( epol ? 1 : -1 ) : 0, reqEq ); @@ -484,7 +485,7 @@ void Trigger::collectPatTerms2( Node q, Node n, std::map< Node, std::vector< Nod bool rm_nu = false; for( unsigned i=0; i<added2.size(); i++ ){ Trace("auto-gen-trigger-debug2") << "..." << nu << " added child " << i << " : " << added2[i] << std::endl; - Assert( added2[i]!=nu ); + Assert(added2[i] != nu); // if child was not already removed if( tinfo.find( added2[i] )!=tinfo.end() ){ if( tstrt==quantifiers::TRIGGER_SEL_MAX || ( tstrt==quantifiers::TRIGGER_SEL_MIN_SINGLE_MAX && !nu_single ) ){ @@ -839,7 +840,7 @@ Node Trigger::getInversion( Node n, Node x ) { if( n.getKind()==PLUS ){ x = NodeManager::currentNM()->mkNode( MINUS, x, n[i] ); }else if( n.getKind()==MULT ){ - Assert( n[i].isConst() ); + Assert(n[i].isConst()); if( x.getType().isInteger() ){ Node coeff = NodeManager::currentNM()->mkConst( n[i].getConst<Rational>().abs() ); if( !n[i].getConst<Rational>().abs().isOne() ){ diff --git a/src/theory/quantifiers/equality_infer.cpp b/src/theory/quantifiers/equality_infer.cpp index ef80af5f5..66745c94a 100644 --- a/src/theory/quantifiers/equality_infer.cpp +++ b/src/theory/quantifiers/equality_infer.cpp @@ -97,7 +97,7 @@ Node EqualityInference::getMaster( Node t, EqcInfo * eqc, bool& updated, Node ne return t; } }else{ - Assert( d_eqci.find( eqc->d_master.get() )!=d_eqci.end() ); + Assert(d_eqci.find(eqc->d_master.get()) != d_eqci.end()); EqcInfo * eqc_m = d_eqci[eqc->d_master.get()]; Node m = getMaster( eqc->d_master.get(), eqc_m, updated, new_m ); eqc->d_master = m; @@ -141,7 +141,7 @@ void EqualityInference::eqNotifyNewClass(TNode t) { }else{ eqci = itec->second; } - Assert( !eqci->d_valid.get() ); + Assert(!eqci->d_valid.get()); if( !eqci->d_solved.get() ){ //somewhat strange: t may not be in rewritten form Node r = Rewriter::rewrite( t ); @@ -160,16 +160,16 @@ void EqualityInference::eqNotifyNewClass(TNode t) { BoolMap::const_iterator itv = d_elim_vars.find( n ); if( itv!=d_elim_vars.end() ){ changed = true; - Assert( d_eqci.find( n )!=d_eqci.end() ); - Assert( n!=t ); - Assert( d_eqci[n]->d_solved.get() ); + Assert(d_eqci.find(n) != d_eqci.end()); + Assert(n != t); + Assert(d_eqci[n]->d_solved.get()); Trace("eq-infer-debug2") << "......its solved form is " << d_eqci[n]->d_rep.get() << std::endl; if( d_trackExplain ){ //track the explanation: justified by explanation for each substitution addToExplanationEqc( exp, n ); } n = d_eqci[n]->d_rep; - Assert( !n.isNull() ); + Assert(!n.isNull()); } if( it->second.isNull() ){ children.push_back( n ); @@ -177,7 +177,7 @@ void EqualityInference::eqNotifyNewClass(TNode t) { children.push_back( NodeManager::currentNM()->mkNode( MULT, it->second, n ) ); } }else{ - Assert( !it->second.isNull() ); + Assert(!it->second.isNull()); children.push_back( it->second ); } } @@ -275,8 +275,8 @@ void EqualityInference::setEqcRep( Node t, Node r, std::vector< Node >& exp_to_a } void EqualityInference::eqNotifyMerge(TNode t1, TNode t2) { - Assert( !t1.isNull() ); - Assert( !t2.isNull() ); + Assert(!t1.isNull()); + Assert(!t2.isNull()); std::map< Node, EqcInfo * >::iterator itv1 = d_eqci.find( t1 ); if( itv1!=d_eqci.end() ){ std::map< Node, EqcInfo * >::iterator itv2 = d_eqci.find( t2 ); @@ -324,7 +324,7 @@ void EqualityInference::eqNotifyMerge(TNode t1, TNode t2) { { Node v_value = veq[1]; Trace("eq-infer") << "...solved " << v_solve << " == " << v_value << std::endl; - Assert( d_elim_vars.find( v_solve )==d_elim_vars.end() ); + Assert(d_elim_vars.find(v_solve) == d_elim_vars.end()); d_elim_vars[v_solve] = true; //store value in eqc info EqcInfo * eqci_solved; diff --git a/src/theory/quantifiers/equality_query.cpp b/src/theory/quantifiers/equality_query.cpp index bb0306c06..f7fd13d4d 100644 --- a/src/theory/quantifiers/equality_query.cpp +++ b/src/theory/quantifiers/equality_query.cpp @@ -105,7 +105,7 @@ Node EqualityQueryQuantifiersEngine::getInternalRepresentative(Node a, if( r.getType().isSort() ){ Trace("internal-rep-warn") << "No representative for UF constant." << std::endl; //should never happen : UF constants should never escape model - Assert( false ); + Assert(false); } } } @@ -165,7 +165,7 @@ Node EqualityQueryQuantifiersEngine::getInternalRepresentative(Node a, d_rep_score[ r_best ] = d_reset_count; } Trace("internal-rep-select") << "...Choose " << r_best << " with score " << r_best_score << std::endl; - Assert( r_best.getType().isSubtypeOf( v_tn ) ); + Assert(r_best.getType().isSubtypeOf(v_tn)); v_int_rep[r] = r_best; if( r_best!=a ){ Trace("internal-rep-debug") << "rep( " << a << " ) = " << r << ", " << std::endl; @@ -193,7 +193,7 @@ void EqualityQueryQuantifiersEngine::getEquivalenceClass( Node a, std::vector< N eqc.push_back( a ); } //a should be in its equivalence class - Assert( std::find( eqc.begin(), eqc.end(), a )!=eqc.end() ); + Assert(std::find(eqc.begin(), eqc.end(), a) != eqc.end()); } TNode EqualityQueryQuantifiersEngine::getCongruentTerm( Node f, std::vector< TNode >& args ) { @@ -243,7 +243,7 @@ int EqualityQueryQuantifiersEngine::getRepScore(Node n, //score prefers earliest use of this term as a representative return d_rep_score.find( n )==d_rep_score.end() ? -1 : d_rep_score[n]; }else{ - Assert( options::quantRepMode()==quantifiers::QUANT_REP_MODE_DEPTH ); + Assert(options::quantRepMode() == quantifiers::QUANT_REP_MODE_DEPTH); return quantifiers::TermUtil::getTermDepth( n ); } } diff --git a/src/theory/quantifiers/first_order_model.cpp b/src/theory/quantifiers/first_order_model.cpp index 4b8b65697..bfef42b65 100644 --- a/src/theory/quantifiers/first_order_model.cpp +++ b/src/theory/quantifiers/first_order_model.cpp @@ -46,7 +46,7 @@ void FirstOrderModel::assertQuantifier( Node n ){ if( n.getKind()==FORALL ){ d_forall_asserts.push_back( n ); }else if( n.getKind()==NOT ){ - Assert( n[0].getKind()==FORALL ); + Assert(n[0].getKind() == FORALL); } } @@ -58,7 +58,7 @@ Node FirstOrderModel::getAssertedQuantifier( unsigned i, bool ordered ) { if( !ordered ){ return d_forall_asserts[i]; }else{ - Assert( d_forall_rlv_assert.size()==d_forall_asserts.size() ); + Assert(d_forall_rlv_assert.size() == d_forall_asserts.size()); return d_forall_rlv_assert[i]; } } @@ -186,7 +186,7 @@ void FirstOrderModel::reset_round() { } } Trace("fm-relevant-debug") << "Sizes : " << d_forall_rlv_assert.size() << " " << d_forall_asserts.size() << std::endl; - Assert( d_forall_rlv_assert.size()==d_forall_asserts.size() ); + Assert(d_forall_rlv_assert.size() == d_forall_asserts.size()); }else{ for( unsigned i=0; i<d_forall_asserts.size(); i++ ){ d_forall_rlv_assert.push_back( d_forall_asserts[i] ); @@ -225,7 +225,7 @@ bool FirstOrderModel::isQuantifierActive(TNode q) const bool FirstOrderModel::isQuantifierAsserted(TNode q) const { - Assert( d_forall_rlv_assert.size()==d_forall_asserts.size() ); + Assert(d_forall_rlv_assert.size() == d_forall_asserts.size()); return std::find( d_forall_rlv_assert.begin(), d_forall_rlv_assert.end(), q )!=d_forall_rlv_assert.end(); } @@ -395,7 +395,7 @@ Node FirstOrderModelFmc::getFunctionValue(Node op, const char* argPrefix ) { for( int i=(d_models[op]->d_cond.size()-1); i>=0; i--) { Node v = d_models[op]->d_value[i]; Trace("fmc-model-func") << "Value is : " << v << std::endl; - Assert( v.isConst() ); + Assert(v.isConst()); /* if( !hasTerm( v ) ){ //can happen when the model basis term does not exist in ground assignment @@ -431,7 +431,7 @@ Node FirstOrderModelFmc::getFunctionValue(Node op, const char* argPrefix ) { children.push_back( NodeManager::currentNM()->mkNode( EQUAL, vars[j], c ) ); } } - Assert( !children.empty() ); + Assert(!children.empty()); Node cc = children.size()==1 ? children[0] : NodeManager::currentNM()->mkNode( AND, children ); Trace("fmc-model-func") << "condition : " << cc << ", value : " << v << std::endl; diff --git a/src/theory/quantifiers/fmf/bounded_integers.cpp b/src/theory/quantifiers/fmf/bounded_integers.cpp index 87f0b1ffe..c6800b092 100644 --- a/src/theory/quantifiers/fmf/bounded_integers.cpp +++ b/src/theory/quantifiers/fmf/bounded_integers.cpp @@ -167,7 +167,7 @@ void BoundedIntegers::process( Node q, Node n, bool pol, conj = TermUtil::simpleNegate( conj ); } Trace("bound-int-debug") << "Process possible finite disequality conjunction : " << conj << std::endl; - Assert( conj.getKind()==AND ); + Assert(conj.getKind() == AND); Node v; std::vector< Node > v_cases; bool success = true; @@ -199,7 +199,7 @@ void BoundedIntegers::process( Node q, Node n, bool pol, bound_lit_type_map[v] = BOUND_FIXED_SET; bound_lit_map[3][v] = n; bound_lit_pol_map[3][v] = pol; - Assert( v_cases.size()==1 ); + Assert(v_cases.size() == 1); bound_fixed_set[v].clear(); bound_fixed_set[v].push_back( v_cases[0] ); } @@ -266,7 +266,7 @@ void BoundedIntegers::process( Node q, Node n, bool pol, } } }else{ - Assert( n.getKind()!=LEQ && n.getKind()!=LT && n.getKind()!=GT ); + Assert(n.getKind() != LEQ && n.getKind() != LT && n.getKind() != GT); } } @@ -335,7 +335,8 @@ void BoundedIntegers::checkOwnership(Node f) setBoundVar = true; for( unsigned b=0; b<2; b++ ){ //set the bounds - Assert( bound_int_range_term[b].find( v )!=bound_int_range_term[b].end() ); + Assert(bound_int_range_term[b].find(v) + != bound_int_range_term[b].end()); d_bounds[b][f][v] = bound_int_range_term[b][v]; } Node r = nm->mkNode(MINUS, d_bounds[1][f][v], d_bounds[0][f][v]); @@ -396,7 +397,7 @@ void BoundedIntegers::checkOwnership(Node f) } else { - Assert( it->second!=BOUND_INT_RANGE ); + Assert(it->second != BOUND_INT_RANGE); } } } @@ -424,7 +425,7 @@ void BoundedIntegers::checkOwnership(Node f) for( unsigned i=0; i<f[0].getNumChildren(); i++) { Node v = f[0][i]; if( std::find( d_set[f].begin(), d_set[f].end(), v )!=d_set[f].end() ){ - Assert( d_bound_type[f].find( v )!=d_bound_type[f].end() ); + Assert(d_bound_type[f].find(v) != d_bound_type[f].end()); if( d_bound_type[f][v]==BOUND_INT_RANGE ){ Trace("bound-int") << " " << d_bounds[0][f][v] << " <= " << v << " <= " << d_bounds[1][f][v] << " (range is " << d_range[f][v] << ")" << std::endl; }else if( d_bound_type[f][v]==BOUND_SET_MEMBER ){ @@ -446,7 +447,7 @@ void BoundedIntegers::checkOwnership(Node f) Trace("bound-int") << " " << v << " has small finite type." << std::endl; }else{ Trace("bound-int") << " " << v << " has unknown bound." << std::endl; - Assert( false ); + Assert(false); } }else{ Trace("bound-int") << " " << "*** " << v << " is unbounded." << std::endl; @@ -470,7 +471,7 @@ void BoundedIntegers::checkOwnership(Node f) std::map< Node, Node >::iterator itr = d_range[f].find( v ); if( itr != d_range[f].end() ){ Node r = itr->second; - Assert( !r.isNull() ); + Assert(!r.isNull()); bool isProxy = false; if (expr::hasBoundVar(r)) { @@ -695,16 +696,16 @@ Node BoundedIntegers::getSetRangeValue( Node q, Node v, RepSetIterator * rsi ) { bool BoundedIntegers::getRsiSubsitution( Node q, Node v, std::vector< Node >& vars, std::vector< Node >& subs, RepSetIterator * rsi ) { Trace("bound-int-rsi") << "Get bound value in model of variable " << v << std::endl; - Assert( d_set_nums[q].find( v )!=d_set_nums[q].end() ); + Assert(d_set_nums[q].find(v) != d_set_nums[q].end()); int vindex = d_set_nums[q][v]; - Assert( d_set_nums[q][v]==vindex ); + Assert(d_set_nums[q][v] == vindex); Trace("bound-int-rsi-debug") << " index order is " << vindex << std::endl; //must take substitution for all variables that are iterating at higher level for( int i=0; i<vindex; i++) { - Assert( d_set_nums[q][d_set[q][i]]==i ); + Assert(d_set_nums[q][d_set[q][i]] == i); Trace("bound-int-rsi") << "Look up the value for " << d_set[q][i] << " " << i << std::endl; int v = rsi->getVariableOrder( i ); - Assert( q[0][v]==d_set[q][i] ); + Assert(q[0][v] == d_set[q][i]); Node t = rsi->getCurrentTerm(v, true); Trace("bound-int-rsi") << "term : " << t << std::endl; vars.push_back( d_set[q][i] ); @@ -772,7 +773,7 @@ bool BoundedIntegers::getBoundElements( RepSetIterator * rsi, bool initial, Node Node tl = l; Node tu = u; getBounds( q, v, rsi, tl, tu ); - Assert( !tl.isNull() && !tu.isNull() ); + Assert(!tl.isNull() && !tu.isNull()); if( ra==d_quantEngine->getTermUtil()->d_true ){ long rr = range.getConst<Rational>().getNumerator().getLong()+1; Trace("bound-int-rsi") << "Actual bound range is " << rr << std::endl; @@ -797,11 +798,11 @@ bool BoundedIntegers::getBoundElements( RepSetIterator * rsi, bool initial, Node if( srv.getKind()!=EMPTYSET ){ //collect the elements while( srv.getKind()==UNION ){ - Assert( srv[1].getKind()==kind::SINGLETON ); + Assert(srv[1].getKind() == kind::SINGLETON); elements.push_back( srv[1][0] ); srv = srv[0]; } - Assert( srv.getKind()==kind::SINGLETON ); + Assert(srv.getKind() == kind::SINGLETON); elements.push_back( srv[0] ); //check if we need to do matching, for literals like ( tuple( v ) in S ) Node t = d_setm_range_lit[q][v][0]; diff --git a/src/theory/quantifiers/fmf/full_model_check.cpp b/src/theory/quantifiers/fmf/full_model_check.cpp index 2306a0565..f6edd3195 100644 --- a/src/theory/quantifiers/fmf/full_model_check.cpp +++ b/src/theory/quantifiers/fmf/full_model_check.cpp @@ -443,7 +443,7 @@ bool FullModelChecker::processBuildModel(TheoryModel* m){ } if( !isStar && !ri.isConst() ){ Trace("fmc-warn") << "Warning : model for " << op << " has non-constant argument in model " << ri << " (from " << c[i] << ")" << std::endl; - Assert( false ); + Assert(false); } entry_children.push_back(ri); } @@ -453,7 +453,7 @@ bool FullModelChecker::processBuildModel(TheoryModel* m){ << "Representative of " << v << " is " << nv << std::endl; if( !nv.isConst() ){ Trace("fmc-warn") << "Warning : model for " << op << " has non-constant value in model " << nv << std::endl; - Assert( false ); + Assert(false); } Node en = (useSimpleModels() && hasNonStar) ? n : NodeManager::currentNM()->mkNode( APPLY_UF, entry_children ); if( std::find(conds.begin(), conds.end(), n )==conds.end() ){ @@ -501,13 +501,14 @@ bool FullModelChecker::processBuildModel(TheoryModel* m){ inst.push_back( r ); } Node ev = fm->d_models[op]->evaluate( fm, inst ); - Trace("fmc-model-debug") << ".....Checking eval( " << fm->d_uf_terms[op][i] << " ) = " << ev << std::endl; - AlwaysAssert( fm->areEqual( ev, fm->d_uf_terms[op][i] ) ); + Trace("fmc-model-debug") << ".....Checking eval( " << + fm->d_uf_terms[op][i] << " ) = " << ev << std::endl; AlwaysAssert( + fm->areEqual( ev, fm->d_uf_terms[op][i] ) ); } */ } - Assert( d_addedLemmas==0 ); - + Assert(d_addedLemmas == 0); + //make function values for( std::map<Node, Def * >::iterator it = fm->d_models.begin(); it != fm->d_models.end(); ++it ){ Node f_def = getFunctionValue( fm, it->first, "$x" ); @@ -582,7 +583,7 @@ void FullModelChecker::debugPrint(const char * tr, Node n, bool dispStar) { int FullModelChecker::doExhaustiveInstantiation( FirstOrderModel * fm, Node f, int effort ) { Trace("fmc") << "Full model check " << f << ", effort = " << effort << "..." << std::endl; - Assert( !d_qe->inConflict() ); + Assert(!d_qe->inConflict()); if( optUseModel() ){ FirstOrderModelFmc * fmfmc = fm->asFirstOrderModelFmc(); if (effort==0) { @@ -606,7 +607,7 @@ int FullModelChecker::doExhaustiveInstantiation( FirstOrderModel * fm, Node f, i //model check the quantifier doCheck(fmfmc, f, d_quant_models[f], f[1]); Trace("fmc") << "Definition for quantifier " << f << " is : " << std::endl; - Assert( !d_quant_models[f].d_cond.empty() ); + Assert(!d_quant_models[f].d_cond.empty()); d_quant_models[f].debugPrint("fmc", Node::null(), this); Trace("fmc") << std::endl; @@ -1159,7 +1160,7 @@ void FullModelChecker::doInterpretedCompose( FirstOrderModelFmc * fm, Node f, De int FullModelChecker::isCompat( FirstOrderModelFmc * fm, std::vector< Node > & cond, Node c ) { Trace("fmc-debug3") << "isCompat " << c << std::endl; - Assert(cond.size()==c.getNumChildren()+1); + Assert(cond.size() == c.getNumChildren() + 1); for (unsigned i=1; i<cond.size(); i++) { if (cond[i] != c[i - 1] && !fm->isStar(cond[i]) && !fm->isStar(c[i - 1])) { @@ -1171,7 +1172,7 @@ int FullModelChecker::isCompat( FirstOrderModelFmc * fm, std::vector< Node > & c bool FullModelChecker::doMeet( FirstOrderModelFmc * fm, std::vector< Node > & cond, Node c ) { Trace("fmc-debug3") << "doMeet " << c << std::endl; - Assert(cond.size()==c.getNumChildren()+1); + Assert(cond.size() == c.getNumChildren() + 1); for (unsigned i=1; i<cond.size(); i++) { if( cond[i]!=c[i-1] ) { if (fm->isStar(cond[i])) @@ -1203,7 +1204,7 @@ void FullModelChecker::mkCondDefaultVec( FirstOrderModelFmc * fm, Node f, std::v cond.push_back(d_quant_cond[f]); for (unsigned i=0; i<f[0].getNumChildren(); i++) { Node ts = fm->getStar(f[0][i].getType()); - Assert( ts.getType()==f[0][i].getType() ); + Assert(ts.getType() == f[0][i].getType()); cond.push_back(ts); } } diff --git a/src/theory/quantifiers/fmf/model_engine.cpp b/src/theory/quantifiers/fmf/model_engine.cpp index 3ab52a63b..cdaaa239a 100644 --- a/src/theory/quantifiers/fmf/model_engine.cpp +++ b/src/theory/quantifiers/fmf/model_engine.cpp @@ -77,7 +77,7 @@ void ModelEngine::check(Theory::Effort e, QEffort quant_e) doCheck = quant_e == QEFFORT_MODEL; } if( doCheck ){ - Assert( !d_quantEngine->inConflict() ); + Assert(!d_quantEngine->inConflict()); int addedLemmas = 0; FirstOrderModel* fm = d_quantEngine->getModel(); @@ -240,7 +240,7 @@ int ModelEngine::checkModel(){ if( d_addedLemmas>0 ){ break; }else{ - Assert( !d_quantEngine->inConflict() ); + Assert(!d_quantEngine->inConflict()); } } diff --git a/src/theory/quantifiers/fun_def_process.cpp b/src/theory/quantifiers/fun_def_process.cpp index 185a349c0..aa3efca19 100644 --- a/src/theory/quantifiers/fun_def_process.cpp +++ b/src/theory/quantifiers/fun_def_process.cpp @@ -36,7 +36,7 @@ void FunDefFmf::simplify( std::vector< Node >& assertions ) { for( unsigned i=0; i<assertions.size(); i++ ){ Node n = QuantAttributes::getFunDefHead( assertions[i] ); if( !n.isNull() ){ - Assert( n.getKind()==APPLY_UF ); + Assert(n.getKind() == APPLY_UF); Node f = n.getOperator(); //check if already defined, if so, throw error @@ -127,7 +127,7 @@ void FunDefFmf::simplify( std::vector< Node >& assertions ) { Node FunDefFmf::simplifyFormula( Node n, bool pol, bool hasPol, std::vector< Node >& constraints, Node hd, bool is_fun_def, std::map< int, std::map< Node, Node > >& visited, std::map< int, std::map< Node, Node > >& visited_cons ) { - Assert( constraints.empty() ); + Assert(constraints.empty()); int index = ( is_fun_def ? 1 : 0 ) + 2*( hasPol ? ( pol ? 1 : -1 ) : 0 ); std::map< Node, Node >::iterator itv = visited[index].find( n ); if( itv!=visited[index].end() ){ @@ -240,7 +240,7 @@ Node FunDefFmf::simplifyFormula( Node n, bool pol, bool hasPol, std::vector< Nod cons = constraints[0]; } visited_cons[index][n] = cons; - Assert( constraints.size()==1 && constraints[0]==cons ); + Assert(constraints.size() == 1 && constraints[0] == cons); } visited[index][n] = ret; return ret; diff --git a/src/theory/quantifiers/inst_match.cpp b/src/theory/quantifiers/inst_match.cpp index 069d5b888..bd947d70b 100644 --- a/src/theory/quantifiers/inst_match.cpp +++ b/src/theory/quantifiers/inst_match.cpp @@ -107,7 +107,7 @@ void InstMatch::setValue( int i, TNode n ) { } bool InstMatch::set(EqualityQuery* q, int i, TNode n) { - Assert( i>=0 ); + Assert(i >= 0); if( !d_vals[i].isNull() ){ if (q->areEqual(d_vals[i], n)) { diff --git a/src/theory/quantifiers/inst_propagator.cpp b/src/theory/quantifiers/inst_propagator.cpp index a3c114d90..6566319fa 100644 --- a/src/theory/quantifiers/inst_propagator.cpp +++ b/src/theory/quantifiers/inst_propagator.cpp @@ -121,8 +121,8 @@ Node EqualityQueryInstProp::getRepresentativeExp( Node a, std::vector< Node >& e if( !ar.isNull() ){ if( engine_has_a || getEngine()->hasTerm( ar ) ){ Trace("qip-eq") << "getRepresentativeExp " << a << " returns " << ar << std::endl; - Assert( getEngine()->hasTerm( ar ) ); - Assert( getEngine()->getRepresentative( ar )==ar ); + Assert(getEngine()->hasTerm(ar)); + Assert(getEngine()->getRepresentative(ar) == ar); return ar; } }else{ @@ -187,15 +187,15 @@ TNode EqualityQueryInstProp::getCongruentTermExp( Node f, std::vector< TNode >& } Node EqualityQueryInstProp::getUfRepresentative( Node a, std::vector< Node >& exp ) { - Assert( exp.empty() ); + Assert(exp.empty()); std::map< Node, Node >::iterator it = d_uf.find( a ); if( it!=d_uf.end() ){ if( it->second==a ){ - Assert( d_uf_exp[ a ].empty() ); + Assert(d_uf_exp[a].empty()); return it->second; }else{ Node m = getUfRepresentative( it->second, exp ); - Assert( !m.isNull() ); + Assert(!m.isNull()); if( m!=it->second ){ //update union find d_uf[ a ] = m; @@ -224,7 +224,7 @@ int EqualityQueryInstProp::setEqual( Node& a, Node& b, bool pol, std::vector< No std::vector< Node > exp_a; Node ar = getUfRepresentative( a, exp_a ); if( ar.isNull() ){ - Assert( exp_a.empty() ); + Assert(exp_a.empty()); ar = a; } if( ar==b ){ @@ -241,7 +241,7 @@ int EqualityQueryInstProp::setEqual( Node& a, Node& b, bool pol, std::vector< No std::vector< Node > exp_b; Node br = getUfRepresentative( b, exp_b ); if( br.isNull() ){ - Assert( exp_b.empty() ); + Assert(exp_b.empty()); br = b; if( !getEngine()->hasTerm( br ) ){ if( ar!=a || getEngine()->hasTerm( ar ) ){ @@ -278,8 +278,8 @@ int EqualityQueryInstProp::setEqual( Node& a, Node& b, bool pol, std::vector< No br = temp_r; } - Assert( !getEngine()->hasTerm( ar ) || getEngine()->hasTerm( br ) ); - Assert( ar!=br ); + Assert(!getEngine()->hasTerm(ar) || getEngine()->hasTerm(br)); + Assert(ar != br); std::vector< Node > exp_d; if( areDisequalExp( ar, br, exp_d ) ){ @@ -294,8 +294,8 @@ int EqualityQueryInstProp::setEqual( Node& a, Node& b, bool pol, std::vector< No }else{ if( pol ){ //update the union find - Assert( d_uf_exp[ar].empty() ); - Assert( d_uf_exp[br].empty() ); + Assert(d_uf_exp[ar].empty()); + Assert(d_uf_exp[br].empty()); //registerUfTerm( ar ); d_uf[ar] = br; @@ -326,8 +326,8 @@ int EqualityQueryInstProp::setEqual( Node& a, Node& b, bool pol, std::vector< No return status; }else{ Trace("qip-eq") << "EqualityQueryInstProp::setEqual : disequal " << ar << " <> " << br << std::endl; - Assert( d_diseq_list[ar].find( br )==d_diseq_list[ar].end() ); - Assert( d_diseq_list[br].find( ar )==d_diseq_list[br].end() ); + Assert(d_diseq_list[ar].find(br) == d_diseq_list[ar].end()); + Assert(d_diseq_list[br].find(ar) == d_diseq_list[br].end()); merge_exp( d_diseq_list[ar][br], reason ); merge_exp( d_diseq_list[br][ar], reason ); @@ -372,7 +372,7 @@ bool EqualityQueryInstProp::isPropagateLiteral( Node n ) { Node atom = n.getKind()==NOT ? n[0] : n; return !atom[0].getType().isBoolean(); }else{ - Assert( ak!=NOT ); + Assert(ak != NOT); return ak!=AND && ak!=OR && ak!=ITE; } } @@ -410,7 +410,7 @@ Node EqualityQueryInstProp::evaluateTermExp( Node n, std::vector< Node >& exp, s Node ret; //check if it should be propagated in this context if( hasPol && isPropagateLiteral( n ) ){ - Assert( n.getType().isBoolean() ); + Assert(n.getType().isBoolean()); //must be Boolean ret = evaluateTermExp( n, exp, visited, false, pol, watch_list_out, props ); if( isPropagateLiteral( ret ) ){ @@ -432,7 +432,7 @@ Node EqualityQueryInstProp::evaluateTermExp( Node n, std::vector< Node >& exp, s bool childChanged = false; int abort_i = -1; //get the child entailed polarity - Assert( n.getKind()!=IMPLIES ); + Assert(n.getKind() != IMPLIES); bool newHasPol, newPol; QuantPhaseReq::getEntailPolarity( n, 0, hasPol, pol, newHasPol, newPol ); std::vector< Node > watch; @@ -511,19 +511,19 @@ Node EqualityQueryInstProp::evaluateTermExp( Node n, std::vector< Node >& exp, s Trace("qip-eval") << "arg " << i << " : " << args[i] << std::endl; t_args.push_back( args[i] ); } - Assert( args.size()==n.getNumChildren() ); + Assert(args.size() == n.getNumChildren()); //args contains terms known by the equality engine TNode nn = getCongruentTerm( f, t_args ); Trace("qip-eval") << " got congruent term " << nn << " for " << n << std::endl; if( !nn.isNull() ){ //successfully constructed representative in EE - Assert( exp_n.empty() ); + Assert(exp_n.empty()); ret = getRepresentativeExp( nn, exp_n ); Trace("qip-eval") << "return rep, exp size = " << exp_n.size() << std::endl; merge_exp( exp, exp_n ); ret_set = true; - Assert( !ret.isNull() ); - Assert( ret!=n ); + Assert(!ret.isNull()); + Assert(ret != n); // we have that n == ret, check if the union find should be updated TODO? }else{ watch.push_back( ret ); @@ -542,7 +542,7 @@ Node EqualityQueryInstProp::evaluateTermExp( Node n, std::vector< Node >& exp, s ret_set = true; } }else{ - Assert( args.size()==n.getNumChildren() ); + Assert(args.size() == n.getNumChildren()); } if( !ret_set ){ if( n.getMetaKind() == kind::metakind::PARAMETERIZED ){ @@ -576,7 +576,7 @@ Node EqualityQueryInstProp::evaluateTermExp( Node n, std::vector< Node >& exp, s void EqualityQueryInstProp::merge_exp( std::vector< Node >& v, std::vector< Node >& v_to_merge, int up_to_size ) { //TODO : optimize if( v.empty() ){ - Assert( up_to_size==-1 || up_to_size==(int)v_to_merge.size() ); + Assert(up_to_size == -1 || up_to_size == (int)v_to_merge.size()); v.insert( v.end(), v_to_merge.begin(), v_to_merge.end() ); }else{ //std::vector< Node >::iterator v_end = v.end(); @@ -595,7 +595,7 @@ void InstPropagator::InstInfo::init( Node q, Node lem, std::vector< Node >& term //information about the instance d_q = q; d_lem = lem; - Assert( d_terms.empty() ); + Assert(d_terms.empty()); d_terms.insert( d_terms.end(), terms.begin(), terms.end() ); //the current lemma d_curr = body; @@ -641,7 +641,7 @@ bool InstPropagator::notifyInstantiation(QuantifiersModule::QEffort quant_e, unsigned id = allocateInstantiation( q, lem, terms, body ); //initialize the information if( cacheConclusion( id, body ) ){ - Assert( d_update_list.empty() ); + Assert(d_update_list.empty()); d_update_list.push_back( id ); bool firstTime = true; //update infos in the update list until empty @@ -660,7 +660,7 @@ bool InstPropagator::notifyInstantiation(QuantifiersModule::QEffort quant_e, Trace("qip-prop") << "...finished notify instantiation." << std::endl; return !d_conflict; }else{ - Assert( false ); + Assert(false); return false; } } @@ -676,7 +676,7 @@ void InstPropagator::filterInstantiations() { it->second.d_q, it->second.d_lem, it->second.d_terms)) { Trace("qip-warn") << "WARNING : did not remove instantiation id " << it->first << std::endl; - Assert( false ); + Assert(false); }else{ Trace("qip-prop-debug") << it->first << " "; } @@ -700,8 +700,8 @@ unsigned InstPropagator::allocateInstantiation( Node q, Node lem, std::vector< N } bool InstPropagator::update( unsigned id, InstInfo& ii, bool firstTime ) { - Assert( !d_conflict ); - Assert( ii.d_active ); + Assert(!d_conflict); + Assert(ii.d_active); Trace("qip-prop-debug") << "Update info [" << id << "]..." << std::endl; //update the evaluation of the current lemma std::map< Node, std::vector< Node > > watch_list_out; @@ -733,14 +733,14 @@ bool InstPropagator::update( unsigned id, InstInfo& ii, bool firstTime ) { } //determine the status of eval if( eval==d_qy.d_false ){ - Assert( props.empty() ); + Assert(props.empty()); //we have inferred a conflict conflict( ii.d_curr_exp ); return false; }else{ for( unsigned i=0; i<props.size(); i++ ){ Trace("qip-prop-debug2") << "Process propagation " << props[i] << std::endl; - Assert( d_qy.isPropagateLiteral( props[i] ) ); + Assert(d_qy.isPropagateLiteral(props[i])); //if we haven't propagated this literal yet if( cacheConclusion( id, props[i], 1 ) ){ //watch list for propagated literal: may not yet be purely EE representatives @@ -778,7 +778,7 @@ bool InstPropagator::update( unsigned id, InstInfo& ii, bool firstTime ) { }else{ Trace("qip-prop-debug") << "...did not update." << std::endl; } - Assert( !d_conflict ); + Assert(!d_conflict); return true; } @@ -802,8 +802,8 @@ void InstPropagator::propagate( Node a, Node b, bool pol, std::vector< Node >& e if( status==EqualityQueryInstProp::STATUS_MERGED_KNOWN ){ Trace("qip-rlv-propagate") << "Relevant propagation : " << a << " == " << b << std::endl; - Assert( d_qy.getEngine()->hasTerm( a ) ); - Assert( d_qy.getEngine()->hasTerm( b ) ); + Assert(d_qy.getEngine()->hasTerm(a)); + Assert(d_qy.getEngine()->hasTerm(b)); Trace("qip-prop-debug") << "...equality between known terms." << std::endl; addRelevantInstances( exp, "qip-propagate" ); //d_has_relevant_inst = true; @@ -837,7 +837,7 @@ void InstPropagator::conflict( std::vector< Node >& exp ) { } bool InstPropagator::cacheConclusion( unsigned id, Node body, int prop_index ) { - Assert( prop_index==0 || prop_index==1 ); + Assert(prop_index == 0 || prop_index == 1); //check if the conclusion is non-redundant if( d_conc_to_id[prop_index].find( body )==d_conc_to_id[prop_index].end() ){ d_conc_to_id[prop_index][body] = id; @@ -849,7 +849,7 @@ bool InstPropagator::cacheConclusion( unsigned id, Node body, int prop_index ) { void InstPropagator::addRelevantInstances( std::vector< Node >& exp, const char * c ) { for( unsigned i=0; i<exp.size(); i++ ){ - Assert( d_conc_to_id[0].find( exp[i] )!=d_conc_to_id[0].end() ); + Assert(d_conc_to_id[0].find(exp[i]) != d_conc_to_id[0].end()); Trace(c) << " relevant instance id : " << d_conc_to_id[0][ exp[i] ] << std::endl; d_relevant_inst[ d_conc_to_id[0][ exp[i] ] ] = true; } @@ -857,7 +857,7 @@ void InstPropagator::addRelevantInstances( std::vector< Node >& exp, const char void InstPropagator::debugPrintExplanation( std::vector< Node >& exp, const char * c ) { for( unsigned i=0; i<exp.size(); i++ ){ - Assert( d_conc_to_id[0].find( exp[i] )!=d_conc_to_id[0].end() ); + Assert(d_conc_to_id[0].find(exp[i]) != d_conc_to_id[0].end()); Trace(c) << d_conc_to_id[0][ exp[i] ] << " "; } } diff --git a/src/theory/quantifiers/local_theory_ext.cpp b/src/theory/quantifiers/local_theory_ext.cpp index 520088328..a3de5ced9 100644 --- a/src/theory/quantifiers/local_theory_ext.cpp +++ b/src/theory/quantifiers/local_theory_ext.cpp @@ -164,11 +164,11 @@ void LtePartialInst::getInstantiations( std::vector< Node >& lemmas ) { reset(); for( unsigned i=0; i<d_lte_asserts.size(); i++ ){ Node q = d_lte_asserts[i]; - Assert( d_do_inst.find( q )!=d_do_inst.end() && d_do_inst[q] ); + Assert(d_do_inst.find(q) != d_do_inst.end() && d_do_inst[q]); if( d_inst.find( q )==d_inst.end() ){ Trace("lte-partial-inst") << "LTE : Get partial instantiations for " << q << "..." << std::endl; d_inst[q] = true; - Assert( !d_vars[q].empty() ); + Assert(!d_vars[q].empty()); //make bound list Node bvl; std::vector< Node > bvs; @@ -189,7 +189,7 @@ void LtePartialInst::getInstantiations( std::vector< Node >& lemmas ) { } getPartialInstantiations( conj, q, bvl, d_vars[q], terms, types, NULL, 0, 0, 0 ); - Assert( !conj.empty() ); + Assert(!conj.empty()); lemmas.push_back( NodeManager::currentNM()->mkNode( OR, q.negate(), conj.size()==1 ? conj[0] : NodeManager::currentNM()->mkNode( AND, conj ) ) ); d_wasInvoked = true; } @@ -226,16 +226,16 @@ void LtePartialInst::getPartialInstantiations(std::vector<Node>& conj, conj.push_back( nq ); } }else{ - Assert( pindex<q[2][0].getNumChildren() ); + Assert(pindex < q[2][0].getNumChildren()); Node pat = q[2][0][pindex]; - Assert( pat.getNumChildren()==0 || paindex<=pat.getNumChildren() ); + Assert(pat.getNumChildren() == 0 || paindex <= pat.getNumChildren()); if( pat.getKind()==APPLY_UF ){ - Assert( paindex<=pat.getNumChildren() ); + Assert(paindex <= pat.getNumChildren()); if( paindex==pat.getNumChildren() ){ getPartialInstantiations( conj, q, bvl, vars, terms, types, NULL, pindex+1, 0, iindex ); }else{ if( !curr ){ - Assert( paindex==0 ); + Assert(paindex == 0); //start traversing term index for the operator curr = d_quantEngine->getTermDatabase()->getTermArgTrie( pat.getOperator() ); } diff --git a/src/theory/quantifiers/quant_conflict_find.cpp b/src/theory/quantifiers/quant_conflict_find.cpp index 4b055f71c..de46eee74 100644 --- a/src/theory/quantifiers/quant_conflict_find.cpp +++ b/src/theory/quantifiers/quant_conflict_find.cpp @@ -148,7 +148,7 @@ void QuantInfo::getPropagateVars( QuantConflictFind * p, std::vector< TNode >& v bool rec = true; bool newPol = pol; if( d_var_num.find( n )!=d_var_num.end() ){ - Assert( std::find( vars.begin(), vars.end(), n )==vars.end() ); + Assert(std::find(vars.begin(), vars.end(), n) == vars.end()); vars.push_back( n ); TNode f = p->getTermDatabase()->getMatchOperator( n ); if( !f.isNull() ){ @@ -157,7 +157,7 @@ void QuantInfo::getPropagateVars( QuantConflictFind * p, std::vector< TNode >& v } } }else if( MatchGen::isHandledBoolConnective( n ) ){ - Assert( n.getKind()!=IMPLIES ); + Assert(n.getKind() != IMPLIES); QuantPhaseReq::getEntailPolarity( n, 0, true, pol, rec, newPol ); } Trace("qcf-opt-debug") << "getPropagateVars " << n << ", pol = " << pol << ", rec = " << rec << std::endl; @@ -298,7 +298,7 @@ TNode QuantInfo::getCurrentValue( TNode n ) { if( d_match[v].isNull() ){ return n; }else{ - Assert( getVarNum( d_match[v] )!=v ); + Assert(getVarNum(d_match[v]) != v); return getCurrentValue( d_match[v] ); } } @@ -312,7 +312,7 @@ TNode QuantInfo::getCurrentExpValue( TNode n ) { if( d_match[v].isNull() ){ return n; }else{ - Assert( getVarNum( d_match[v] )!=v ); + Assert(getVarNum(d_match[v]) != v); if( d_match_term[v].isNull() ){ return getCurrentValue( d_match[v] ); }else{ @@ -356,9 +356,9 @@ int QuantInfo::addConstraint( QuantConflictFind * p, int v, TNode n, int vn, boo //for handling equalities between variables, and disequalities involving variables Debug("qcf-match-debug") << "- " << (doRemove ? "un" : "" ) << "constrain : " << v << " -> " << n << " (cv=" << getCurrentValue( n ) << ")"; Debug("qcf-match-debug") << ", (vn=" << vn << "), polarity = " << polarity << std::endl; - Assert( doRemove || n==getCurrentValue( n ) ); - Assert( doRemove || v==getCurrentRepVar( v ) ); - Assert( doRemove || vn==getCurrentRepVar( getVarNum( n ) ) ); + Assert(doRemove || n == getCurrentValue(n)); + Assert(doRemove || v == getCurrentRepVar(v)); + Assert(doRemove || vn == getCurrentRepVar(getVarNum(n))); if( polarity ){ if( vn!=v ){ if( doRemove ){ @@ -398,7 +398,7 @@ int QuantInfo::addConstraint( QuantConflictFind * p, int v, TNode n, int vn, boo bool alreadySet = false; if( !d_match[vn].isNull() ){ alreadySet = true; - Assert( !isVar( d_match[vn] ) ); + Assert(!isVar(d_match[vn])); } //copy or check disequalities @@ -461,7 +461,7 @@ int QuantInfo::addConstraint( QuantConflictFind * p, int v, TNode n, int vn, boo return -1; }else{ if( doRemove ){ - Assert( d_curr_var_deq[v].find( n )!=d_curr_var_deq[v].end() ); + Assert(d_curr_var_deq[v].find(n) != d_curr_var_deq[v].end()); d_curr_var_deq[v].erase( n ); return 1; }else{ @@ -831,7 +831,7 @@ bool QuantInfo::completeMatch( QuantConflictFind * p, std::vector< int >& assign Trace("qcf-check-unassign") << "Failed match with mg at " << d_una_index << std::endl; } }else{ - Assert( doFail || d_una_index==(int)d_una_eqc_count.size()-1 ); + Assert(doFail || d_una_index == (int)d_una_eqc_count.size() - 1); if( d_una_eqc_count[d_una_index]<(int)p->d_eqcs[d_unassigned_tn[d_una_index]].size() ){ int currIndex = d_una_eqc_count[d_una_index]; d_una_eqc_count[d_una_index]++; @@ -975,7 +975,7 @@ MatchGen::MatchGen( QuantInfo * qi, Node n, bool isVar ) std::vector< Node > qni_apps; d_qni_size = 0; if( isVar ){ - Assert( qi->d_var_num.find( n )!=qi->d_var_num.end() ); + Assert(qi->d_var_num.find(n) != qi->d_var_num.end()); if( n.getKind()==ITE ){ d_type = typ_invalid; }else{ @@ -1026,10 +1026,10 @@ MatchGen::MatchGen( QuantInfo * qi, Node n, bool isVar ) d_type = typ_invalid; //literals if( isHandledUfTerm( d_n ) ){ - Assert( qi->isVar( d_n ) ); + Assert(qi->isVar(d_n)); d_type = typ_pred; }else if( d_n.getKind()==BOUND_VARIABLE ){ - Assert( d_n.getType().isBoolean() ); + Assert(d_n.getType().isBoolean()); d_type = typ_bool_var; }else if( d_n.getKind()==EQUAL || options::qcfTConstraint() ){ for (unsigned i = 0; i < d_n.getNumChildren(); i++) @@ -1140,7 +1140,7 @@ void MatchGen::determineVariableOrder( QuantInfo * qi, std::vector< int >& bvars Trace("qcf-qregister-vo") << vu_count[min_score_index] << " " << vb_count[min_score_index] << " " << has_nested[min_score_index] << std::endl; Trace("qcf-qregister-debug") << "...assign child " << min_score_index << std::endl; Trace("qcf-qregister-debug") << "...score : " << min_score << std::endl; - Assert( min_score_index!=-1 ); + Assert(min_score_index != -1); //add to children order d_children_order.push_back( min_score_index ); assigned[min_score_index] = true; @@ -1291,7 +1291,7 @@ void MatchGen::reset( QuantConflictFind * p, bool tgt, QuantInfo * qi ) { d_qn.push_back( NULL ); } }else if( d_type==typ_var ){ - Assert( isHandledUfTerm( d_n ) ); + Assert(isHandledUfTerm(d_n)); TNode f = getMatchOperator( p, d_n ); Debug("qcf-match-debug") << " reset: Var will match operators of " << f << std::endl; TNodeTrie* qni = p->getTermDatabase()->getTermArgTrie(Node::null(), f); @@ -1520,7 +1520,7 @@ bool MatchGen::getNextMatch( QuantConflictFind * p, QuantInfo * qi ) { //clean up the matches you set for( std::map< int, int >::iterator it = d_qni_bound.begin(); it != d_qni_bound.end(); ++it ){ Debug("qcf-match") << " Clean up bound var " << it->second << std::endl; - Assert( it->second<qi->getNumVars() ); + Assert(it->second < qi->getNumVars()); qi->unsetMatch( p, it->second ); qi->d_match_term[ it->second ] = TNode::null(); } @@ -1650,8 +1650,8 @@ bool MatchGen::doMatching( QuantConflictFind * p, QuantInfo * qi ) { d_qn.clear(); return true; }else{ - Assert( d_type==typ_var ); - Assert( d_qni_size>0 ); + Assert(d_type == typ_var); + Assert(d_qni_size > 0); bool invalidMatch; do { invalidMatch = false; @@ -1694,10 +1694,10 @@ bool MatchGen::doMatching( QuantConflictFind * p, QuantInfo * qi ) { } }else{ Debug("qcf-match-debug") << " Match " << index << " is ground term" << std::endl; - Assert( d_qni_gterm.find( index )!=d_qni_gterm.end() ); - Assert( d_qni_gterm_rep.find( index )!=d_qni_gterm_rep.end() ); + Assert(d_qni_gterm.find(index) != d_qni_gterm.end()); + Assert(d_qni_gterm_rep.find(index) != d_qni_gterm_rep.end()); val = d_qni_gterm_rep[index]; - Assert( !val.isNull() ); + Assert(!val.isNull()); } if( !val.isNull() ){ //constrained by val @@ -1715,7 +1715,7 @@ bool MatchGen::doMatching( QuantConflictFind * p, QuantInfo * qi ) { } } }else{ - Assert( d_qn.size()==d_qni.size() ); + Assert(d_qn.size() == d_qni.size()); int index = d_qni.size()-1; //increment if binding this variable bool success = false; @@ -1751,7 +1751,7 @@ bool MatchGen::doMatching( QuantConflictFind * p, QuantInfo * qi ) { if( d_qni.size()==d_qni_size ){ //Assert( !d_qni[d_qni.size()-1]->second.d_data.empty() ); //Debug("qcf-match-debug") << " We matched " << d_qni[d_qni.size()-1]->second.d_children.begin()->first << std::endl; - Assert( !d_qni[d_qni.size()-1]->second.d_data.empty() ); + Assert(!d_qni[d_qni.size() - 1]->second.d_data.empty()); TNode t = d_qni[d_qni.size()-1]->second.d_data.begin()->first; Debug("qcf-match-debug") << " " << d_n << " matched " << t << std::endl; qi->d_match_term[d_qni_var_num[0]] = t; @@ -1760,8 +1760,8 @@ bool MatchGen::doMatching( QuantConflictFind * p, QuantInfo * qi ) { Debug("qcf-match-debug") << " position " << it->first << " bounded " << it->second << " / " << qi->d_q[0].getNumChildren() << std::endl; //if( it->second<(int)qi->d_q[0].getNumChildren() ){ //if it is an actual variable, we are interested in knowing the actual term if( it->first>0 ){ - Assert( !qi->d_match[ it->second ].isNull() ); - Assert( p->areEqual( t[it->first-1], qi->d_match[ it->second ] ) ); + Assert(!qi->d_match[it->second].isNull()); + Assert(p->areEqual(t[it->first - 1], qi->d_match[it->second])); qi->d_match_term[it->second] = t[it->first-1]; } //} diff --git a/src/theory/quantifiers/quantifiers_attributes.cpp b/src/theory/quantifiers/quantifiers_attributes.cpp index f5ebb33b1..0e6eb1581 100644 --- a/src/theory/quantifiers/quantifiers_attributes.cpp +++ b/src/theory/quantifiers/quantifiers_attributes.cpp @@ -64,24 +64,24 @@ void QuantAttributes::setUserAttribute( const std::string& attr, Node n, std::ve QuantNameAttribute qna; n.setAttribute(qna, true); } else if (attr == "sygus-synth-grammar") { - Assert( node_values.size()==1 ); + Assert(node_values.size() == 1); Trace("quant-attr-debug") << "Set sygus synth grammar " << n << " to " << node_values[0] << std::endl; SygusSynthGrammarAttribute ssg; n.setAttribute(ssg, node_values[0]); }else if( attr=="sygus-synth-fun-var-list" ){ - Assert( node_values.size()==1 ); + Assert(node_values.size() == 1); Trace("quant-attr-debug") << "Set sygus synth fun var list to " << n << " to " << node_values[0] << std::endl; SygusSynthFunVarListAttribute ssfvla; n.setAttribute( ssfvla, node_values[0] ); }else if( attr=="quant-inst-max-level" ){ - Assert( node_values.size()==1 ); + Assert(node_values.size() == 1); uint64_t lvl = node_values[0].getConst<Rational>().getNumerator().getLong(); Trace("quant-attr-debug") << "Set instantiation level " << n << " to " << lvl << std::endl; QuantInstLevelAttribute qila; n.setAttribute( qila, lvl ); }else if( attr=="rr-priority" ){ - Assert( node_values.size()==1 ); + Assert(node_values.size() == 1); uint64_t lvl = node_values[0].getConst<Rational>().getNumerator().getLong(); Trace("quant-attr-debug") << "Set rewrite rule priority " << n << " to " << lvl << std::endl; RrPriorityAttribute rrpa; @@ -296,7 +296,7 @@ void QuantAttributes::computeQuantAttributes( Node q, QAttributes& qa ){ } if( avar.getKind()==REWRITE_RULE ){ Trace("quant-attr") << "Attribute : rewrite rule : " << q << std::endl; - Assert( i==0 ); + Assert(i == 0); qa.d_rr = avar; } } diff --git a/src/theory/quantifiers/quantifiers_rewriter.cpp b/src/theory/quantifiers/quantifiers_rewriter.cpp index 33da46675..0039ec845 100644 --- a/src/theory/quantifiers/quantifiers_rewriter.cpp +++ b/src/theory/quantifiers/quantifiers_rewriter.cpp @@ -92,7 +92,7 @@ void QuantifiersRewriter::computeArgVec(const std::vector<Node>& args, std::vector<Node>& activeArgs, Node n) { - Assert( activeArgs.empty() ); + Assert(activeArgs.empty()); std::map< Node, bool > activeMap; std::map< Node, bool > visited; computeArgs( args, activeMap, n, visited ); @@ -110,7 +110,7 @@ void QuantifiersRewriter::computeArgVec2(const std::vector<Node>& args, Node n, Node ipl) { - Assert( activeArgs.empty() ); + Assert(activeArgs.empty()); std::map< Node, bool > activeMap; std::map< Node, bool > visited; computeArgs( args, activeMap, n, visited ); @@ -286,7 +286,7 @@ Node QuantifiersRewriter::computeElimSymbols( Node body ) { } if( !success ){ // tautology - Assert( k==OR || k==AND ); + Assert(k == OR || k == AND); return NodeManager::currentNM()->mkConst( k==OR ); } childrenChanged = childrenChanged || c!=body[i]; @@ -405,7 +405,7 @@ int getEntailedCond( Node n, std::map< Node, bool >& currCond ){ }else if( j==start ){ res1 = res; }else{ - Assert( res!=0 ); + Assert(res != 0); if( n.getKind()==ITE ){ return res1==res ? res : 0; }else if( n.getKind()==EQUAL ){ @@ -456,7 +456,7 @@ void setEntailedCond( Node n, bool pol, std::map< Node, bool >& currCond, std::v if( n.getKind()==APPLY_TESTER ){ const Datatype& dt = Datatype::datatypeOf(n.getOperator().toExpr()); unsigned index = Datatype::indexOf(n.getOperator().toExpr()); - Assert( dt.getNumConstructors()>1 ); + Assert(dt.getNumConstructors() > 1); if( pol ){ for( unsigned i=0; i<dt.getNumConstructors(); i++ ){ if( i!=index ){ @@ -491,7 +491,7 @@ Node QuantifiersRewriter::computeProcessTerms( Node body, std::vector< Node >& n std::map< Node, Node > icache; if( qa.isFunDef() ){ Node h = QuantAttributes::getFunDefHead( q ); - Assert( !h.isNull() ); + Assert(!h.isNull()); // if it is a function definition, rewrite the body independently Node fbody = QuantAttributes::getFunDefBody( q ); Trace("quantifiers-rewrite-debug") << "Decompose " << h << " / " << fbody << " as function definition for " << q << "." << std::endl; @@ -572,8 +572,8 @@ Node QuantifiersRewriter::computeProcessTerms2( Node body, bool hasPol, bool pol nCurrCond = nCurrCond + 1; } setEntailedCond( children[0], i==1, currCond, new_cond, conflict ); - //should not conflict (entailment check failed) - Assert( !conflict ); + // should not conflict (entailment check failed) + Assert(!conflict); } if( body.getKind()==OR || body.getKind()==AND ){ bool use_pol = body.getKind()==AND; @@ -763,7 +763,7 @@ Node QuantifiersRewriter::computeCondSplit(Node body, std::map< Node, std::map< int, Node > > ncons; std::vector< Node > conj; computeDtTesterIteSplit( body, pcons, ncons, conj ); - Assert( !conj.empty() ); + Assert(!conj.empty()); if( conj.size()>1 ){ Trace("quantifiers-rewrite-ite") << "*** Split ITE (datatype tester) " << body << " into : " << std::endl; for( unsigned i=0; i<conj.size(); i++ ){ @@ -1507,7 +1507,7 @@ Node QuantifiersRewriter::computePrenex( Node body, std::vector< Node >& args, s NodeManager::currentNM()->mkNode( kind::OR, body[0], body[1].notNode() ) ); return computePrenex( nn, args, nargs, pol, prenexAgg ); }else if( body.getType().isBoolean() ){ - Assert( body.getKind()!=EXISTS ); + Assert(body.getKind() != EXISTS); bool childrenChanged = false; std::vector< Node > newChildren; for( unsigned i=0; i<body.getNumChildren(); i++ ){ @@ -1629,8 +1629,8 @@ Node QuantifiersRewriter::computePrenexAgg( Node n, bool topLevel, std::map< uns } ret = nnn; }else{ - Assert( args.empty() ); - Assert( nargs.empty() ); + Assert(args.empty()); + Assert(nargs.empty()); } } visited[tindex][n] = ret; @@ -1640,7 +1640,7 @@ Node QuantifiersRewriter::computePrenexAgg( Node n, bool topLevel, std::map< uns } Node QuantifiersRewriter::computeSplit( std::vector< Node >& args, Node body, QAttributes& qa ) { - Assert( body.getKind()==OR ); + Assert(body.getKind() == OR); size_t var_found_count = 0; size_t eqc_count = 0; size_t eqc_active = 0; @@ -1732,7 +1732,7 @@ Node QuantifiersRewriter::computeSplit( std::vector< Node >& args, Node body, QA Node fa = NodeManager::currentNM()->mkNode( FORALL, bvl, body ); lits.push_back(fa); } - Assert( !lits.empty() ); + Assert(!lits.empty()); Node nf = lits.size()==1 ? lits[0] : NodeManager::currentNM()->mkNode(OR,lits); Trace("clause-split-debug") << "Made node : " << nf << std::endl; return nf; @@ -1828,7 +1828,7 @@ Node QuantifiersRewriter::computeMiniscoping( std::vector< Node >& args, Node bo } } }else if( body.getKind()==NOT ){ - Assert( isLiteral( body[0] ) ); + Assert(isLiteral(body[0])); } //remove variables that don't occur std::vector< Node > activeArgs; @@ -1902,8 +1902,8 @@ Node QuantifiersRewriter::computeAggressiveMiniscoping( std::vector< Node >& arg qvl2.push_back( args[i] ); } } - Assert( !qvl1.empty() ); - Assert( !qvl2.empty() || !qvsh.empty() ); + Assert(!qvl1.empty()); + Assert(!qvl2.empty() || !qvsh.empty()); //check for literals that only contain shared variables std::vector<Node> qlitsh; std::vector<Node> qlit2; @@ -2023,7 +2023,7 @@ Node QuantifiersRewriter::computeOperation( Node f, int computeOption, QAttribut }else{ std::vector< Node > nargs; n = computePrenex( n, args, nargs, true, false ); - Assert( nargs.empty() ); + Assert(nargs.empty()); } }else if( computeOption==COMPUTE_VAR_ELIMINATION ){ n = computeVarElimination( n, args, qa ); @@ -2091,9 +2091,7 @@ Node QuantifiersRewriter::rewriteRewriteRule( Node r ) { break; } break; - default: - Unreachable("RewriteRules can be of only three kinds"); - break; + default: Unreachable() << "RewriteRules can be of only three kinds"; break; } // Add the other guards TNode g = r[1]; diff --git a/src/theory/quantifiers/query_generator.cpp b/src/theory/quantifiers/query_generator.cpp index 742b3000b..99e7b5a8c 100644 --- a/src/theory/quantifiers/query_generator.cpp +++ b/src/theory/quantifiers/query_generator.cpp @@ -177,7 +177,7 @@ void QueryGenerator::checkQuery(Node qy, unsigned spIndex) ss << " " << d_vars[i] << " -> " << pt[i] << std::endl; } ss << "but CVC4 answered unsat!" << std::endl; - AlwaysAssert(false, ss.str().c_str()); + AlwaysAssert(false) << ss.str(); } if (options::sygusQueryGenDumpFiles() == SYGUS_QUERY_DUMP_UNSOLVED) { diff --git a/src/theory/quantifiers/relevant_domain.cpp b/src/theory/quantifiers/relevant_domain.cpp index 071bd7933..fbd1f05a6 100644 --- a/src/theory/quantifiers/relevant_domain.cpp +++ b/src/theory/quantifiers/relevant_domain.cpp @@ -27,8 +27,8 @@ using namespace CVC4::theory; using namespace CVC4::theory::quantifiers; void RelevantDomain::RDomain::merge( RDomain * r ) { - Assert( !d_parent ); - Assert( !r->d_parent ); + Assert(!d_parent); + Assert(!r->d_parent); d_parent = r; for( unsigned i=0; i<d_terms.size(); i++ ){ r->addTerm( d_terms[i] ); @@ -79,7 +79,7 @@ RelevantDomain::~RelevantDomain() { for( std::map< Node, std::map< int, RDomain * > >::iterator itr = d_rel_doms.begin(); itr != d_rel_doms.end(); ++itr ){ for( std::map< int, RDomain * >::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2 ){ RDomain * current = (*itr2).second; - Assert( current != NULL ); + Assert(current != NULL); delete current; } } @@ -183,7 +183,8 @@ void RelevantDomain::computeRelevantDomain( Node q, Node n, bool hasPol, bool po //compute the information for what this literal does computeRelevantDomainLit( q, hasPol, pol, n ); if( d_rel_dom_lit[hasPol][pol][n].d_merge ){ - Assert( d_rel_dom_lit[hasPol][pol][n].d_rd[0]!=NULL && d_rel_dom_lit[hasPol][pol][n].d_rd[1]!=NULL ); + Assert(d_rel_dom_lit[hasPol][pol][n].d_rd[0] != NULL + && d_rel_dom_lit[hasPol][pol][n].d_rd[1] != NULL); RDomain * rd1 = d_rel_dom_lit[hasPol][pol][n].d_rd[0]->getParent(); RDomain * rd2 = d_rel_dom_lit[hasPol][pol][n].d_rd[1]->getParent(); if( rd1!=rd2 ){ diff --git a/src/theory/quantifiers/rewrite_engine.cpp b/src/theory/quantifiers/rewrite_engine.cpp index 07ff9ee46..9903456c9 100644 --- a/src/theory/quantifiers/rewrite_engine.cpp +++ b/src/theory/quantifiers/rewrite_engine.cpp @@ -68,7 +68,7 @@ void RewriteEngine::check(Theory::Effort e, QEffort quant_e) { if (quant_e == QEFFORT_STANDARD) { - Assert( !d_quantEngine->inConflict() ); + Assert(!d_quantEngine->inConflict()); Trace("rewrite-engine") << "---Rewrite Engine Round, effort = " << e << "---" << std::endl; //if( e==Theory::EFFORT_LAST_CALL ){ // if( !d_quantEngine->getModel()->isModelSet() ){ diff --git a/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp b/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp index 47a1f6142..c34b7d4e3 100644 --- a/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp +++ b/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp @@ -53,7 +53,7 @@ CegSingleInv::~CegSingleInv() void CegSingleInv::initialize(Node q) { // can only register one quantified formula with this - Assert( d_quant.isNull() ); + Assert(d_quant.isNull()); d_quant = q; d_simp_quant = q; Trace("cegqi-si") << "CegSingleInv::initialize : " << q << std::endl; @@ -466,7 +466,7 @@ Node CegSingleInv::getSolution(unsigned sol_index, int& reconstructed, bool rconsSygus) { - Assert( d_sol!=NULL ); + Assert(d_sol != NULL); const Datatype& dt = ((DatatypeType)(stn).toType()).getDatatype(); Node varList = Node::fromExpr( dt.getSygusVarList() ); Node prog = d_quant[0][sol_index]; @@ -486,7 +486,7 @@ Node CegSingleInv::getSolution(unsigned sol_index, Trace("csi-sol") << "Get solution for " << prog << ", with skolems : "; sol_index = d_prog_to_sol_index[prog]; d_sol->d_varList.clear(); - Assert( d_single_inv_arg_sk.size()==varList.getNumChildren() ); + Assert(d_single_inv_arg_sk.size() == varList.getNumChildren()); for( unsigned i=0; i<d_single_inv_arg_sk.size(); i++ ){ Trace("csi-sol") << d_single_inv_arg_sk[i] << " "; vars.push_back( d_single_inv_arg_sk[i] ); @@ -501,7 +501,7 @@ Node CegSingleInv::getSolution(unsigned sol_index, { indices.push_back(i); } - Assert( !indices.empty() ); + Assert(!indices.empty()); //sort indices based on heuristic : currently, do all constant returns first (leads to simpler conditions) // TODO : to minimize solution size, put the largest term last sortSiInstanceIndices ssii; @@ -520,7 +520,7 @@ Node CegSingleInv::getSolution(unsigned sol_index, cond = TermUtil::simpleNegate(cond); s = nm->mkNode(ITE, cond, d_inst[uindex][sol_index], s); } - Assert( vars.size()==d_sol->d_varList.size() ); + Assert(vars.size() == d_sol->d_varList.size()); s = s.substitute( vars.begin(), vars.end(), d_sol->d_varList.begin(), d_sol->d_varList.end() ); } d_orig_solution = s; diff --git a/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp b/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp index d349e8ad4..811210628 100644 --- a/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp +++ b/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp @@ -119,7 +119,7 @@ Node CegSingleInvSol::reconstructSolution(Node sol, if( status==0 ){ Node ret = getReconstructedSolution( d_root_id ); Trace("csi-rcons") << "Sygus solution is : " << ret << std::endl; - Assert( !ret.isNull() ); + Assert(!ret.isNull()); reconstructed = 1; return ret; } @@ -224,11 +224,11 @@ int CegSingleInvSol::collectReconstructNodes(Node t, TypeNode stn, int& status) int id = allocate( t, stn ); d_rcons_to_status[stn][t] = -1; TypeNode tn = t.getType(); - Assert( stn.isDatatype() ); + Assert(stn.isDatatype()); const Datatype& dt = stn.getDatatype(); TermDbSygus* tds = d_qe->getTermDatabaseSygus(); SygusTypeInfo& sti = tds->getTypeInfo(stn); - Assert( dt.isSygus() ); + Assert(dt.isSygus()); Trace("csi-rcons-debug") << "Check reconstruct " << t << ", sygus type " << dt.getName() << ", kind " << t.getKind() << ", id : " << id << std::endl; int carg = -1; int karg = -1; @@ -291,7 +291,7 @@ int CegSingleInvSol::collectReconstructNodes(Node t, TypeNode stn, int& status) //try identity functions for (unsigned ii : d_id_funcs[stn]) { - Assert( dt[ii].getNumArgs()==1 ); + Assert(dt[ii].getNumArgs() == 1); //try to directly reconstruct from single argument std::vector< Node > tchildren; tchildren.push_back( min_t ); @@ -402,7 +402,7 @@ int CegSingleInvSol::collectReconstructNodes(Node t, TypeNode stn, int& status) //if one succeeds if( status==0 ){ Node rsol = getReconstructedSolution( equiv_ids[i] ); - Assert( !rsol.isNull() ); + Assert(!rsol.isNull()); //set all members of the equivalence class that this is the reconstructed solution setReconstructed( id, rsol ); break; @@ -433,7 +433,7 @@ bool CegSingleInvSol::collectReconstructNodes(int pid, std::vector<int>& ids, int& status) { - Assert( dtc.getNumArgs()==ts.size() ); + Assert(dtc.getNumArgs() == ts.size()); for( unsigned i=0; i<ts.size(); i++ ){ TypeNode cstn = d_qe->getTermDatabaseSygus()->getArgType( dtc, i ); int cstatus; diff --git a/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp b/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp index 0dc49fa96..8f935de27 100644 --- a/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp +++ b/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp @@ -177,7 +177,7 @@ Node CegGrammarConstructor::process(Node q, std::map<Node, Node>::const_iterator itta = templates_arg.find(sf); Assert(itta != templates_arg.end()); TNode templ_arg = itta->second; - Assert( !templ_arg.isNull() ); + Assert(!templ_arg.isNull()); // if there is a template for this argument, make a sygus type on top of it if( options::sygusTemplEmbedGrammar() ){ Trace("cegqi-debug") << "Template for " << sf << " is : " << templ @@ -737,7 +737,7 @@ void CegGrammarConstructor::mkSygusDefaultGrammar( weights[i].push_back(-1); // length TypeNode intType = nm->integerType(); - Assert(std::find(types.begin(),types.end(),intType)!=types.end()); + Assert(std::find(types.begin(), types.end(), intType) != types.end()); unsigned i_intType = std::distance( types.begin(), std::find(types.begin(), @@ -1086,12 +1086,12 @@ TypeNode CegGrammarConstructor::mkSygusDefaultType( datatypes, unres); Trace("sygus-grammar-def") << "...made " << datatypes.size() << " datatypes, now make mutual datatype types..." << std::endl; - Assert( !datatypes.empty() ); + Assert(!datatypes.empty()); std::vector<DatatypeType> types = NodeManager::currentNM()->toExprManager()->mkMutualDatatypeTypes( datatypes, unres, ExprManager::DATATYPE_FLAG_PLACEHOLDER); Trace("sygus-grammar-def") << "...finished" << std::endl; - Assert( types.size()==datatypes.size() ); + Assert(types.size() == datatypes.size()); return TypeNode::fromType( types[0] ); } @@ -1114,7 +1114,7 @@ TypeNode CegGrammarConstructor::mkSygusTemplateTypeRec( Node templ, Node templ_a // TODO : can short circuit to this case when !TermUtil::containsTerm( templ, templ_arg ) op = templ; }else{ - Assert( templ.hasOperator() ); + Assert(templ.hasOperator()); op = templ.getOperator(); // make constructor taking arguments types from children for( unsigned i=0; i<templ.getNumChildren(); i++ ){ @@ -1132,7 +1132,7 @@ TypeNode CegGrammarConstructor::mkSygusTemplateTypeRec( Node templ, Node templ_a std::vector<DatatypeType> types = NodeManager::currentNM()->toExprManager()->mkMutualDatatypeTypes( datatypes, unres, ExprManager::DATATYPE_FLAG_PLACEHOLDER); - Assert( types.size()==1 ); + Assert(types.size() == 1); return TypeNode::fromType( types[0] ); } } diff --git a/src/theory/quantifiers/sygus/sygus_pbe.cpp b/src/theory/quantifiers/sygus/sygus_pbe.cpp index 64bf0972c..474fdb5d8 100644 --- a/src/theory/quantifiers/sygus/sygus_pbe.cpp +++ b/src/theory/quantifiers/sygus/sygus_pbe.cpp @@ -440,7 +440,7 @@ bool SygusPbe::constructCandidates(const std::vector<Node>& enums, std::vector<Node>& candidate_values, std::vector<Node>& lems) { - Assert( enums.size()==enum_values.size() ); + Assert(enums.size() == enum_values.size()); if( !enums.empty() ){ unsigned min_term_size = 0; Trace("sygus-pbe-enum") << "Register new enumerated values : " << std::endl; diff --git a/src/theory/quantifiers/sygus/sygus_unif_io.cpp b/src/theory/quantifiers/sygus/sygus_unif_io.cpp index ff58dbe38..72091c0cf 100644 --- a/src/theory/quantifiers/sygus/sygus_unif_io.cpp +++ b/src/theory/quantifiers/sygus/sygus_unif_io.cpp @@ -1453,12 +1453,11 @@ Node SygusUnifIo::constructSol( if (!rec_c.isNull()) { Assert(ecache_child.d_enum_val_to_index.find(rec_c) - != ecache_child.d_enum_val_to_index.end()); + != ecache_child.d_enum_val_to_index.end()); split_cond_res_index = ecache_child.d_enum_val_to_index[rec_c]; set_split_cond_res_index = true; split_cond_enum = ce; - Assert(split_cond_res_index - < ecache_child.d_enum_vals_res.size()); + Assert(split_cond_res_index < ecache_child.d_enum_vals_res.size()); } } else diff --git a/src/theory/quantifiers/sygus/term_database_sygus.cpp b/src/theory/quantifiers/sygus/term_database_sygus.cpp index ff9fede0b..7fb54f14e 100644 --- a/src/theory/quantifiers/sygus/term_database_sygus.cpp +++ b/src/theory/quantifiers/sygus/term_database_sygus.cpp @@ -14,7 +14,7 @@ #include "theory/quantifiers/sygus/term_database_sygus.h" -#include "base/cvc4_check.h" +#include "base/check.h" #include "options/base_options.h" #include "options/datatypes_options.h" #include "options/quantifiers_options.h" @@ -80,7 +80,7 @@ TNode TermDbSygus::getFreeVar( TypeNode tn, int i, bool useSygusType ) { }else{ ss << "fv_" << tn << "_" << i; } - Assert( !vtn.isNull() ); + Assert(!vtn.isNull()); Node v = NodeManager::currentNM()->mkSkolem( ss.str(), vtn, "for sygus normal form testing" ); d_fv_stype[v] = tn; d_fv_num[v] = i; @@ -155,7 +155,7 @@ Node TermDbSygus::getProxyVariable(TypeNode tn, Node c) } TypeNode TermDbSygus::getSygusTypeForVar( Node v ) { - Assert( d_fv_stype.find( v )!=d_fv_stype.end() ); + Assert(d_fv_stype.find(v) != d_fv_stype.end()); return d_fv_stype[v]; } @@ -165,8 +165,8 @@ Node TermDbSygus::mkGeneric(const Datatype& dt, std::map<int, Node>& pre) { Assert(c < dt.getNumConstructors()); - Assert( dt.isSygus() ); - Assert( !dt[c].getSygusOp().isNull() ); + Assert(dt.isSygus()); + Assert(!dt[c].getSygusOp().isNull()); std::vector< Node > children; Trace("sygus-db-debug") << "mkGeneric " << dt.getName() << " " << c << "..." << std::endl; @@ -182,7 +182,7 @@ Node TermDbSygus::mkGeneric(const Datatype& dt, } Trace("sygus-db-debug") << " child " << i << " : " << a << " : " << a.getType() << std::endl; - Assert( !a.isNull() ); + Assert(!a.isNull()); children.push_back( a ); } return datatypes::utils::mkSygusTerm(dt, c, children); @@ -495,7 +495,7 @@ void TermDbSygus::registerEnumerator(Node e, } else { - Unreachable("Unknown enumerator mode in registerEnumerator"); + Unreachable() << "Unknown enumerator mode in registerEnumerator"; } } Trace("sygus-db") << "isActiveGen for " << e << ", role = " << erole @@ -1039,7 +1039,7 @@ Node TermDbSygus::getEagerUnfold( Node n, std::map< Node, Node >& visited ) { std::vector< Node > vars; std::vector< Node > subs; Node var_list = Node::fromExpr( dt.getSygusVarList() ); - Assert( var_list.getNumChildren()+1==n.getNumChildren() ); + Assert(var_list.getNumChildren() + 1 == n.getNumChildren()); for( unsigned j=0; j<var_list.getNumChildren(); j++ ){ vars.push_back( var_list[j] ); } @@ -1049,7 +1049,7 @@ Node TermDbSygus::getEagerUnfold( Node n, std::map< Node, Node >& visited ) { Assert(subs[j - 1].getType().isComparableTo( var_list[j - 1].getType())); } - Assert( vars.size()==subs.size() ); + Assert(vars.size() == subs.size()); bTerm = bTerm.substitute( vars.begin(), vars.end(), subs.begin(), subs.end() ); Trace("cegqi-eager") << "Built-in term after subs : " << bTerm << std::endl; Trace("cegqi-eager-debug") << "Types : " << bTerm.getType() << " " << n.getType() << std::endl; diff --git a/src/theory/quantifiers/sygus/type_info.cpp b/src/theory/quantifiers/sygus/type_info.cpp index 818a53711..8f280c587 100644 --- a/src/theory/quantifiers/sygus/type_info.cpp +++ b/src/theory/quantifiers/sygus/type_info.cpp @@ -14,7 +14,7 @@ #include "theory/quantifiers/sygus/type_info.h" -#include "base/cvc4_check.h" +#include "base/check.h" #include "theory/datatypes/theory_datatypes_utils.h" #include "theory/quantifiers/sygus/term_database_sygus.h" @@ -123,7 +123,7 @@ void SygusTypeInfo::initialize(TermDbSygus* tds, TypeNode tn) TypeNode ct = TypeNode::fromType(dt[i].getArgType(j)); TypeNode cbt = tds->sygusToBuiltinType(ct); TypeNode lat = TypeNode::fromType(sop[0][j].getType()); - CVC4_CHECK(cbt.isSubtypeOf(lat)) + AlwaysAssert(cbt.isSubtypeOf(lat)) << "In sygus datatype " << dt.getName() << ", argument to a lambda constructor is not " << lat << std::endl; } @@ -152,7 +152,7 @@ void SygusTypeInfo::initialize(TermDbSygus* tds, TypeNode tn) // e.g. bitvector-and is a constructor of an integer grammar. Node g = tds->mkGeneric(dt, i); TypeNode gtn = g.getType(); - CVC4_CHECK(gtn.isSubtypeOf(btn)) + AlwaysAssert(gtn.isSubtypeOf(btn)) << "Sygus datatype " << dt.getName() << " encodes terms that are not of type " << btn << std::endl; Trace("sygus-db") << "...done register Operator #" << i << std::endl; diff --git a/src/theory/quantifiers/sygus_sampler.cpp b/src/theory/quantifiers/sygus_sampler.cpp index 10d7ef6ab..834ca1975 100644 --- a/src/theory/quantifiers/sygus_sampler.cpp +++ b/src/theory/quantifiers/sygus_sampler.cpp @@ -813,8 +813,8 @@ void SygusSampler::checkEquivalent(Node bv, Node bvr) if (options::sygusRewVerifyAbort()) { - AlwaysAssert(false, - "--sygus-rr-verify detected unsoundness in the rewriter!"); + AlwaysAssert(false) + << "--sygus-rr-verify detected unsoundness in the rewriter!"; } } } diff --git a/src/theory/quantifiers/term_database.cpp b/src/theory/quantifiers/term_database.cpp index 9da9c95b6..79279eb41 100644 --- a/src/theory/quantifiers/term_database.cpp +++ b/src/theory/quantifiers/term_database.cpp @@ -46,7 +46,8 @@ TermDb::~TermDb(){ } void TermDb::registerQuantifier( Node q ) { - Assert( q[0].getNumChildren()==d_quantEngine->getTermUtil()->getNumInstantiationConstants( q ) ); + Assert(q[0].getNumChildren() + == d_quantEngine->getTermUtil()->getNumInstantiationConstants(q)); for( unsigned i=0; i<q[0].getNumChildren(); i++ ){ Node ic = d_quantEngine->getTermUtil()->getInstantiationConstant( q, i ); setTermInactive( ic ); @@ -257,7 +258,7 @@ void TermDb::computeArgReps( TNode n ) { } void TermDb::computeUfEqcTerms( TNode f ) { - Assert( f==getOperatorRepresentative( f ) ); + Assert(f == getOperatorRepresentative(f)); if (d_func_map_eqc_trie.find(f) != d_func_map_eqc_trie.end()) { return; @@ -291,7 +292,7 @@ void TermDb::computeUfTerms( TNode f ) { // already computed return; } - Assert( f==getOperatorRepresentative( f ) ); + Assert(f == getOperatorRepresentative(f)); d_op_nonred_count[f] = 0; // get the matchable operators in the equivalence class of f std::vector<TNode> ops; @@ -501,8 +502,9 @@ bool TermDb::inRelevantDomain( TNode f, unsigned i, TNode r ) { f = getOperatorRepresentative( f ); } computeUfTerms( f ); - Assert( !d_quantEngine->getActiveEqualityEngine()->hasTerm( r ) || - d_quantEngine->getActiveEqualityEngine()->getRepresentative( r )==r ); + Assert(!d_quantEngine->getActiveEqualityEngine()->hasTerm(r) + || d_quantEngine->getActiveEqualityEngine()->getRepresentative(r) + == r); std::map< Node, std::map< unsigned, std::vector< Node > > >::iterator it = d_func_map_rel_dom.find( f ); if( it != d_func_map_rel_dom.end() ){ std::map< unsigned, std::vector< Node > >::iterator it2 = it->second.find( i ); @@ -712,7 +714,7 @@ Node TermDb::evaluateTerm2(TNode n, TNode TermDb::getEntailedTerm2( TNode n, std::map< TNode, TNode >& subs, bool subsRep, bool hasSubs, EqualityQuery * qy ) { - Assert( !qy->extendsEngine() ); + Assert(!qy->extendsEngine()); Trace("term-db-entail") << "get entailed term : " << n << std::endl; if( qy->getEngine()->hasTerm( n ) ){ Trace("term-db-entail") << "...exists in ee, return rep " << std::endl; @@ -723,8 +725,8 @@ TNode TermDb::getEntailedTerm2( TNode n, std::map< TNode, TNode >& subs, bool su if( it!=subs.end() ){ Trace("term-db-entail") << "...substitution is : " << it->second << std::endl; if( subsRep ){ - Assert( qy->getEngine()->hasTerm( it->second ) ); - Assert( qy->getEngine()->getRepresentative( it->second )==it->second ); + Assert(qy->getEngine()->hasTerm(it->second)); + Assert(qy->getEngine()->getRepresentative(it->second) == it->second); return it->second; }else{ return getEntailedTerm2( it->second, subs, subsRep, hasSubs, qy ); @@ -805,9 +807,9 @@ TNode TermDb::getEntailedTerm( TNode n, EqualityQuery * qy ) { } bool TermDb::isEntailed2( TNode n, std::map< TNode, TNode >& subs, bool subsRep, bool hasSubs, bool pol, EqualityQuery * qy ) { - Assert( !qy->extendsEngine() ); + Assert(!qy->extendsEngine()); Trace("term-db-entail") << "Check entailed : " << n << ", pol = " << pol << std::endl; - Assert( n.getType().isBoolean() ); + Assert(n.getType().isBoolean()); if( n.getKind()==EQUAL && !n[0].getType().isBoolean() ){ TNode n1 = getEntailedTerm2( n[0], subs, subsRep, hasSubs, qy ); if( !n1.isNull() ){ @@ -816,8 +818,8 @@ bool TermDb::isEntailed2( TNode n, std::map< TNode, TNode >& subs, bool subsRep, if( n1==n2 ){ return pol; }else{ - Assert( qy->getEngine()->hasTerm( n1 ) ); - Assert( qy->getEngine()->hasTerm( n2 ) ); + Assert(qy->getEngine()->hasTerm(n1)); + Assert(qy->getEngine()->hasTerm(n2)); if( pol ){ return qy->getEngine()->areEqual( n1, n2 ); }else{ @@ -854,7 +856,7 @@ bool TermDb::isEntailed2( TNode n, std::map< TNode, TNode >& subs, bool subsRep, }else if( n.getKind()==APPLY_UF ){ TNode n1 = getEntailedTerm2( n, subs, subsRep, hasSubs, qy ); if( !n1.isNull() ){ - Assert( qy->hasTerm( n1 ) ); + Assert(qy->hasTerm(n1)); if( n1==d_true ){ return pol; }else if( n1==d_false ){ @@ -871,7 +873,7 @@ bool TermDb::isEntailed2( TNode n, std::map< TNode, TNode >& subs, bool subsRep, bool TermDb::isEntailed( TNode n, bool pol, EqualityQuery * qy ) { if( qy==NULL ){ - Assert( d_consistent_ee ); + Assert(d_consistent_ee); qy = d_quantEngine->getEqualityQuery(); } std::map< TNode, TNode > subs; @@ -880,7 +882,7 @@ bool TermDb::isEntailed( TNode n, bool pol, EqualityQuery * qy ) { bool TermDb::isEntailed( TNode n, std::map< TNode, TNode >& subs, bool subsRep, bool pol, EqualityQuery * qy ) { if( qy==NULL ){ - Assert( d_consistent_ee ); + Assert(d_consistent_ee); qy = d_quantEngine->getEqualityQuery(); } return isEntailed2( n, subs, subsRep, true, pol, qy ); @@ -908,7 +910,7 @@ bool TermDb::hasTermCurrent( Node n, bool useMode ) { }else if( options::termDbMode()==TERM_DB_RELEVANT ){ return d_has_map.find( n )!=d_has_map.end(); }else{ - Assert( false ); + Assert(false); return false; } } diff --git a/src/theory/quantifiers/term_util.cpp b/src/theory/quantifiers/term_util.cpp index c9c738eb3..7f94130f3 100644 --- a/src/theory/quantifiers/term_util.cpp +++ b/src/theory/quantifiers/term_util.cpp @@ -217,7 +217,7 @@ Node TermUtil::substituteBoundVariables(Node n, std::vector<Node>& terms) { registerQuantifier(q); - Assert( d_vars[q].size()==terms.size() ); + Assert(d_vars[q].size() == terms.size()); return n.substitute( d_vars[q].begin(), d_vars[q].end(), terms.begin(), terms.end() ); } @@ -306,7 +306,7 @@ void TermUtil::computeInstConstContainsForQuant(Node q, Node TermUtil::ensureType( Node n, TypeNode tn ) { TypeNode ntn = n.getType(); - Assert( ntn.isComparableTo( tn ) ); + Assert(ntn.isComparableTo(tn)); if( ntn.isSubtypeOf( tn ) ){ return n; }else{ diff --git a/src/theory/quantifiers/theory_quantifiers.cpp b/src/theory/quantifiers/theory_quantifiers.cpp index f24a4bb2b..1682b4d0c 100644 --- a/src/theory/quantifiers/theory_quantifiers.cpp +++ b/src/theory/quantifiers/theory_quantifiers.cpp @@ -16,8 +16,7 @@ #include "theory/quantifiers/theory_quantifiers.h" - -#include "base/cvc4_assert.h" +#include "base/check.h" #include "expr/kind.h" #include "options/quantifiers_options.h" #include "theory/quantifiers/ematching/instantiation_engine.h" @@ -147,15 +146,11 @@ void TheoryQuantifiers::check(Effort e) { //do nothing break; case kind::INST_CLOSURE: - default: - Unhandled(assertion[0].getKind()); - break; + default: Unhandled() << assertion[0].getKind(); break; } } break; - default: - Unhandled(assertion.getKind()); - break; + default: Unhandled() << assertion.getKind(); break; } } // call the quantifiers engine to check diff --git a/src/theory/quantifiers/theory_quantifiers_type_rules.h b/src/theory/quantifiers/theory_quantifiers_type_rules.h index ad1c4c69b..62d75cf18 100644 --- a/src/theory/quantifiers/theory_quantifiers_type_rules.h +++ b/src/theory/quantifiers/theory_quantifiers_type_rules.h @@ -29,7 +29,7 @@ struct QuantifierForallTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { Debug("typecheck-q") << "type check for fa " << n << std::endl; - Assert(n.getKind() == kind::FORALL && n.getNumChildren()>0 ); + Assert(n.getKind() == kind::FORALL && n.getNumChildren() > 0); if( check ){ if( n[ 0 ].getType(check)!=nodeManager->boundVarListType() ){ throw TypeCheckingExceptionPrivate(n, "first argument of universal quantifier is not bound var list"); @@ -49,7 +49,7 @@ struct QuantifierExistsTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { Debug("typecheck-q") << "type check for ex " << n << std::endl; - Assert(n.getKind() == kind::EXISTS && n.getNumChildren()>0 ); + Assert(n.getKind() == kind::EXISTS && n.getNumChildren() > 0); if( check ){ if( n[ 0 ].getType(check)!=nodeManager->boundVarListType() ){ throw TypeCheckingExceptionPrivate(n, "first argument of existential quantifier is not bound var list"); @@ -68,7 +68,7 @@ struct QuantifierExistsTypeRule { struct QuantifierBoundVarListTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::BOUND_VAR_LIST ); + Assert(n.getKind() == kind::BOUND_VAR_LIST); if( check ){ for( int i=0; i<(int)n.getNumChildren(); i++ ){ if( n[i].getKind()!=kind::BOUND_VARIABLE ){ @@ -83,7 +83,7 @@ struct QuantifierBoundVarListTypeRule { struct QuantifierInstPatternTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::INST_PATTERN ); + Assert(n.getKind() == kind::INST_PATTERN); if( check ){ TypeNode tn = n[0].getType(check); // this check catches the common mistake writing :pattern (f x) instead of :pattern ((f x)) @@ -98,7 +98,7 @@ struct QuantifierInstPatternTypeRule { struct QuantifierInstNoPatternTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::INST_NO_PATTERN ); + Assert(n.getKind() == kind::INST_NO_PATTERN); return nodeManager->instPatternType(); } };/* struct QuantifierInstNoPatternTypeRule */ @@ -106,7 +106,7 @@ struct QuantifierInstNoPatternTypeRule { struct QuantifierInstAttributeTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::INST_ATTRIBUTE ); + Assert(n.getKind() == kind::INST_ATTRIBUTE); return nodeManager->instPatternType(); } };/* struct QuantifierInstAttributeTypeRule */ @@ -114,7 +114,7 @@ struct QuantifierInstAttributeTypeRule { struct QuantifierInstPatternListTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::INST_PATTERN_LIST ); + Assert(n.getKind() == kind::INST_PATTERN_LIST); if( check ){ for( int i=0; i<(int)n.getNumChildren(); i++ ){ if( n[i].getKind()!=kind::INST_PATTERN && n[i].getKind()!=kind::INST_NO_PATTERN && n[i].getKind()!=kind::INST_ATTRIBUTE ){ @@ -129,7 +129,7 @@ struct QuantifierInstPatternListTypeRule { struct QuantifierInstClosureTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::INST_CLOSURE ); + Assert(n.getKind() == kind::INST_CLOSURE); if( check ){ TypeNode tn = n[0].getType(check); if( tn.isBoolean() ){ @@ -157,7 +157,7 @@ public: bool check) { Debug("typecheck-r") << "type check for rr " << n << std::endl; - Assert(n.getKind() == kind::REWRITE_RULE && n.getNumChildren()==3 ); + Assert(n.getKind() == kind::REWRITE_RULE && n.getNumChildren() == 3); if( check ){ if( n[ 0 ].getType(check)!=nodeManager->boundVarListType() ){ throw TypeCheckingExceptionPrivate(n[0], @@ -182,7 +182,7 @@ public: inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::RR_REWRITE ); + Assert(n.getKind() == kind::RR_REWRITE); if( check ){ if( n[0].getType(check)!=n[1].getType(check) ){ throw TypeCheckingExceptionPrivate(n, @@ -204,8 +204,8 @@ public: inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::RR_REDUCTION || - n.getKind() == kind::RR_DEDUCTION ); + Assert(n.getKind() == kind::RR_REDUCTION + || n.getKind() == kind::RR_DEDUCTION); if( check ){ if( n[ 0 ].getType(check)!=nodeManager->booleanType() ){ throw TypeCheckingExceptionPrivate(n, "head of reduction rule is not boolean"); diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp index e399af71d..686843189 100644 --- a/src/theory/quantifiers_engine.cpp +++ b/src/theory/quantifiers_engine.cpp @@ -250,7 +250,7 @@ QuantifiersEngine::QuantifiersEngine(context::Context* c, Trace("quant-engine-debug") << "Initialize model, mbqi : " << options::mbqiMode() << std::endl; if( options::quantEpr() ){ - Assert( !options::incrementalSolving() ); + Assert(!options::incrementalSolving()); d_qepr.reset(new quantifiers::QuantEPR); } //---- end utilities @@ -660,7 +660,7 @@ void QuantifiersEngine::check( Theory::Effort e ){ return; }else{ //should only fail reset if added a lemma - Assert( false ); + Assert(false); } } } @@ -742,7 +742,7 @@ void QuantifiersEngine::check( Theory::Effort e ){ if( d_hasAddedLemma ){ break; }else{ - Assert( !d_conflict ); + Assert(!d_conflict); if (quant_e == QuantifiersModule::QEFFORT_CONFLICT) { if( e==Theory::EFFORT_FULL ){ @@ -812,7 +812,7 @@ void QuantifiersEngine::check( Theory::Effort e ){ setIncomplete = true; break; }else{ - Assert( qmd!=NULL ); + Assert(qmd != NULL); Trace("quant-engine-debug2") << "Complete for " << q << " due to " << qmd->identify().c_str() << std::endl; } } @@ -899,7 +899,7 @@ void QuantifiersEngine::registerQuantifierInternal(Node f) Trace("quant") << " : " << f << std::endl; unsigned prev_lemma_waiting = d_lemmas_waiting.size(); ++(d_statistics.d_num_quant); - Assert( f.getKind()==FORALL ); + Assert(f.getKind() == FORALL); // register with utilities for (unsigned i = 0; i < d_util.size(); i++) { diff --git a/src/theory/rep_set.cpp b/src/theory/rep_set.cpp index 0530e7889..ea462e55c 100644 --- a/src/theory/rep_set.cpp +++ b/src/theory/rep_set.cpp @@ -96,7 +96,7 @@ void RepSet::add( TypeNode tn, Node n ){ } } Trace("rsi-debug") << "Add rep #" << d_type_reps[tn].size() << " for " << tn << " : " << n << std::endl; - Assert( n.getType().isSubtypeOf( tn ) ); + Assert(n.getType().isSubtypeOf(tn)); d_tmap[ n ] = (int)d_type_reps[tn].size(); d_type_reps[tn].push_back( n ); } @@ -204,7 +204,7 @@ unsigned RepSetIterator::domainSize(unsigned i) bool RepSetIterator::setQuantifier(Node q) { Trace("rsi") << "Make rsi for quantified formula " << q << std::endl; - Assert( d_types.empty() ); + Assert(d_types.empty()); //store indicies for (size_t i = 0; i < q[0].getNumChildren(); i++) { @@ -217,7 +217,7 @@ bool RepSetIterator::setQuantifier(Node q) bool RepSetIterator::setFunctionDomain(Node op) { Trace("rsi") << "Make rsi for function " << op << std::endl; - Assert( d_types.empty() ); + Assert(d_types.empty()); TypeNode tn = op.getType(); for( size_t i=0; i<tn.getNumChildren()-1; i++ ){ d_types.push_back( tn[i] ); @@ -273,7 +273,7 @@ bool RepSetIterator::initialize() type_reps->begin(), type_reps->end()); } }else{ - Assert( d_incomplete ); + Assert(d_incomplete); return false; } } @@ -344,7 +344,7 @@ int RepSetIterator::resetIndex(unsigned i, bool initial) int RepSetIterator::incrementAtIndex(int i) { - Assert( !isFinished() ); + Assert(!isFinished()); #ifdef DISABLE_EVAL_SKIP_MULTIPLE i = (int)d_index.size()-1; #endif diff --git a/src/theory/rewriter.cpp b/src/theory/rewriter.cpp index 045ac3f39..866883681 100644 --- a/src/theory/rewriter.cpp +++ b/src/theory/rewriter.cpp @@ -222,15 +222,18 @@ Node Rewriter::rewriteTo(theory::TheoryId theoryId, Node node) { } else if (response.status == REWRITE_DONE) { #ifdef CVC4_ASSERTIONS RewriteResponse r2 = Rewriter::callPostRewrite(newTheoryId, response.node); - Assert(r2.node == response.node); + Assert(r2.node == response.node); #endif rewriteStackTop.node = response.node; break; } // Check for trivial rewrite loops of size 1 or 2 Assert(response.node != rewriteStackTop.node); - Assert(Rewriter::callPostRewrite((TheoryId) rewriteStackTop.theoryId, response.node).node != rewriteStackTop.node); - rewriteStackTop.node = response.node; + Assert(Rewriter::callPostRewrite((TheoryId)rewriteStackTop.theoryId, + response.node) + .node + != rewriteStackTop.node); + rewriteStackTop.node = response.node; } // We're done with the post rewrite, so we add to the cache Rewriter::setPostRewriteCache((TheoryId) rewriteStackTop.originalTheoryId, rewriteStackTop.original, rewriteStackTop.node); @@ -243,7 +246,8 @@ Node Rewriter::rewriteTo(theory::TheoryId theoryId, Node node) { // If this is the last node, just return if (rewriteStack.size() == 1) { - Assert(!isEquality || rewriteStackTop.node.getKind() == kind::EQUAL || rewriteStackTop.node.isConst()); + Assert(!isEquality || rewriteStackTop.node.getKind() == kind::EQUAL + || rewriteStackTop.node.isConst()); return rewriteStackTop.node; } diff --git a/src/theory/sep/theory_sep.cpp b/src/theory/sep/theory_sep.cpp index b787cd94f..1392f8fab 100644 --- a/src/theory/sep/theory_sep.cpp +++ b/src/theory/sep/theory_sep.cpp @@ -222,8 +222,8 @@ void TheorySep::postProcessModel( TheoryModel* m ){ Node m_heap; for( std::map< TypeNode, Node >::iterator it = d_base_label.begin(); it != d_base_label.end(); ++it ){ //should only be constructing for one heap type - Assert( m_heap.isNull() ); - Assert( d_loc_to_data_type.find( it->first )!=d_loc_to_data_type.end() ); + Assert(m_heap.isNull()); + Assert(d_loc_to_data_type.find(it->first) != d_loc_to_data_type.end()); Trace("sep-model") << "Model for heap, type = " << it->first << " with data type " << d_loc_to_data_type[it->first] << " : " << std::endl; TypeNode data_type = d_loc_to_data_type[it->first]; computeLabelModel( it->second ); @@ -231,10 +231,11 @@ void TheorySep::postProcessModel( TheoryModel* m ){ Trace("sep-model") << " [empty]" << std::endl; }else{ for( unsigned j=0; j<d_label_model[it->second].d_heap_locs_model.size(); j++ ){ - Assert( d_label_model[it->second].d_heap_locs_model[j].getKind()==kind::SINGLETON ); + Assert(d_label_model[it->second].d_heap_locs_model[j].getKind() + == kind::SINGLETON); std::vector< Node > pto_children; Node l = d_label_model[it->second].d_heap_locs_model[j][0]; - Assert( l.isConst() ); + Assert(l.isConst()); pto_children.push_back( l ); Trace("sep-model") << " " << l << " -> "; if( d_pto_model[l].isNull() ){ @@ -260,7 +261,7 @@ void TheorySep::postProcessModel( TheoryModel* m ){ }else{ Trace("sep-model") << d_pto_model[l]; Node vpto = d_valuation.getModel()->getRepresentative( d_pto_model[l] ); - Assert( vpto.isConst() ); + Assert(vpto.isConst()); pto_children.push_back( vpto ); } Trace("sep-model") << std::endl; @@ -378,7 +379,7 @@ void TheorySep::check(Effort e) { std::vector< Node > labels; getLabelChildren( s_atom, s_lbl, children, labels ); Node empSet = NodeManager::currentNM()->mkConst(EmptySet(s_lbl.getType().toType())); - Assert( children.size()>1 ); + Assert(children.size() > 1); if( s_atom.getKind()==kind::SEP_STAR ){ //reduction for heap : union, pairwise disjoint Node ulem = NodeManager::currentNM()->mkNode( kind::UNION, labels[0], labels[1] ); @@ -446,7 +447,7 @@ void TheorySep::check(Effort e) { }else{ //labeled emp should be rewritten - Assert( false ); + Assert(false); } d_red_conc[s_lbl][s_atom] = conc; } @@ -464,7 +465,7 @@ void TheorySep::check(Effort e) { Node lit = ds->getLiteral(0); d_neg_guard[s_lbl][s_atom] = lit; Trace("sep-lemma-debug") << "Neg guard : " << s_lbl << " " << s_atom << " " << lit << std::endl; - AlwaysAssert( !lit.isNull() ); + AlwaysAssert(!lit.isNull()); d_neg_guards.push_back( lit ); d_guard_to_assertion[lit] = s_atom; //Node lem = NodeManager::currentNM()->mkNode( kind::EQUAL, lit, conc ); @@ -493,7 +494,7 @@ void TheorySep::check(Effort e) { Trace("sep-assert") << "Done asserting " << atom << " to EE." << std::endl; }else if( s_atom.getKind()==kind::SEP_PTO ){ Node pto_lbl = NodeManager::currentNM()->mkNode( kind::SINGLETON, s_atom[0] ); - Assert( s_lbl==pto_lbl ); + Assert(s_lbl == pto_lbl); Trace("sep-assert") << "Asserting " << s_atom << std::endl; d_equalityEngine.assertPredicate(s_atom, polarity, fact); //associate the equivalence class of the lhs with this pto @@ -551,7 +552,7 @@ void TheorySep::check(Effort e) { Node fact = (*i); bool polarity = fact.getKind() != kind::NOT; TNode atom = polarity ? fact : fact[0]; - Assert( atom.getKind()==kind::SEP_LABEL ); + Assert(atom.getKind() == kind::SEP_LABEL); TNode s_atom = atom[0]; TNode s_lbl = atom[1]; lbl_to_assertions[s_lbl].push_back( fact ); @@ -647,9 +648,9 @@ void TheorySep::check(Effort e) { TNode s_atom = atom[0]; bool use_polarity = s_atom.getKind()==kind::SEP_WAND ? !polarity : polarity; if( !use_polarity ){ - Assert( assert_active.find( fact )!=assert_active.end() ); + Assert(assert_active.find(fact) != assert_active.end()); if( assert_active[fact] ){ - Assert( atom.getKind()==kind::SEP_LABEL ); + Assert(atom.getKind() == kind::SEP_LABEL); TNode s_lbl = atom[1]; std::map<Node, std::map<int, Node> >& lms = d_label_map[s_atom]; if (lms.find(s_lbl) != lms.end()) @@ -672,9 +673,9 @@ void TheorySep::check(Effort e) { bool use_polarity = s_atom.getKind()==kind::SEP_WAND ? !polarity : polarity; Trace("sep-process-debug") << " check atom : " << s_atom << " use polarity " << use_polarity << std::endl; if( !use_polarity ){ - Assert( assert_active.find( fact )!=assert_active.end() ); + Assert(assert_active.find(fact) != assert_active.end()); if( assert_active[fact] ){ - Assert( atom.getKind()==kind::SEP_LABEL ); + Assert(atom.getKind() == kind::SEP_LABEL); TNode s_lbl = atom[1]; Trace("sep-process") << "--> Active negated atom : " << s_atom << ", lbl = " << s_lbl << std::endl; //add refinement lemma @@ -701,7 +702,7 @@ void TheorySep::check(Effort e) { } // Now, assert model-instantiated implication based on the negation - Assert( d_label_model.find( s_lbl )!=d_label_model.end() ); + Assert(d_label_model.find(s_lbl) != d_label_model.end()); std::vector< Node > conc; bool inst_success = true; //new refinement @@ -746,7 +747,8 @@ void TheorySep::check(Effort e) { else { Trace("sep-process-debug") << " no children." << std::endl; - Assert( s_atom.getKind()==kind::SEP_PTO || s_atom.getKind()==kind::SEP_EMP ); + Assert(s_atom.getKind() == kind::SEP_PTO + || s_atom.getKind() == kind::SEP_EMP); } }else{ Trace("sep-process-debug") << "--> inactive negated assertion " << s_atom << std::endl; @@ -764,7 +766,8 @@ void TheorySep::check(Effort e) { computeLabelModel( it->second ); Trace("sep-process-debug") << "Check heap data for " << it->first << " -> " << data_type << std::endl; for( unsigned j=0; j<d_label_model[it->second].d_heap_locs_model.size(); j++ ){ - Assert( d_label_model[it->second].d_heap_locs_model[j].getKind()==kind::SINGLETON ); + Assert(d_label_model[it->second].d_heap_locs_model[j].getKind() + == kind::SINGLETON); Node l = d_label_model[it->second].d_heap_locs_model[j][0]; Trace("sep-process-debug") << " location : " << l << std::endl; if( d_pto_model[l].isNull() ){ @@ -856,12 +859,12 @@ TheorySep::HeapAssertInfo * TheorySep::getOrMakeEqcInfo( Node n, bool doMake ) { //for now, assume all constraints are for the same heap type (ensured by logic exceptions thrown in computeReferenceType2) TypeNode TheorySep::getReferenceType( Node n ) { - Assert( !d_type_ref.isNull() ); + Assert(!d_type_ref.isNull()); return d_type_ref; } TypeNode TheorySep::getDataType( Node n ) { - Assert( !d_type_data.isNull() ); + Assert(!d_type_data.isNull()); return d_type_data; } @@ -976,7 +979,7 @@ int TheorySep::processAssertion( Node n, std::map< int, std::map< Node, int > >& if( n.getKind()==kind::SEP_WAND ){ //TODO }else{ - Assert( n.getKind()==kind::SEP_STAR && hasPol && pol ); + Assert(n.getKind() == kind::SEP_STAR && hasPol && pol); references_strict[index][n] = true; } } @@ -988,7 +991,7 @@ int TheorySep::processAssertion( Node n, std::map< int, std::map< Node, int > >& if( !underSpatial && ( !references[index][n].empty() || card>0 ) ){ TypeNode tn = getReferenceType( n ); - Assert( !tn.isNull() ); + Assert(!tn.isNull()); // add references to overall type unsigned bt = d_bound_kind[tn]; bool add = true; @@ -1034,7 +1037,7 @@ void TheorySep::registerRefDataTypes( TypeNode tn1, TypeNode tn2, Node atom ){ std::stringstream ss; ss << "ERROR: specifying heap constraints for two different types : " << tn1 << " -> " << tn2 << " and " << te1 << " -> " << d_loc_to_data_type[te1] << std::endl; throw LogicException(ss.str()); - Assert( false ); + Assert(false); } if( tn2.isNull() ){ Trace("sep-type") << "Sep: assume location type " << tn1 << " (from " << atom << ")" << std::endl; @@ -1058,7 +1061,7 @@ void TheorySep::registerRefDataTypes( TypeNode tn1, TypeNode tn2, Node atom ){ std::stringstream ss; ss << "ERROR: location type " << tn1 << " is already associated with data type " << itt->second << ", offending atom is " << atom << " with data type " << tn2 << std::endl; throw LogicException(ss.str()); - Assert( false ); + Assert(false); } } } @@ -1221,7 +1224,7 @@ Node TheorySep::getNilRef( TypeNode tn ) { } void TheorySep::setNilRef( TypeNode tn, Node n ) { - Assert( n.getType()==tn ); + Assert(n.getType() == tn); d_nil_ref[tn] = n; } @@ -1233,7 +1236,7 @@ Node TheorySep::mkUnion( TypeNode tn, std::vector< Node >& locs ) { }else{ for( unsigned i=0; i<locs.size(); i++ ){ Node s = locs[i]; - Assert( !s.isNull() ); + Assert(!s.isNull()); s = NodeManager::currentNM()->mkNode( kind::SINGLETON, s ); if( u.isNull() ){ u = s; @@ -1263,7 +1266,7 @@ Node TheorySep::getLabel( Node atom, int child, Node lbl ) { } Node TheorySep::applyLabel( Node n, Node lbl, std::map< Node, Node >& visited ) { - Assert( n.getKind()!=kind::SEP_LABEL ); + Assert(n.getKind() != kind::SEP_LABEL); if( n.getKind()==kind::SEP_STAR || n.getKind()==kind::SEP_WAND || n.getKind()==kind::SEP_PTO || n.getKind()==kind::SEP_EMP ){ return NodeManager::currentNM()->mkNode( kind::SEP_LABEL, n, lbl ); }else if( !n.getType().isBoolean() || n.getNumChildren()==0 ){ @@ -1306,28 +1309,28 @@ Node TheorySep::instantiateLabel( Node n, Node o_lbl, Node lbl, Node lbl_v, std: Trace("sep-inst") << n << "[" << lbl << "] :: " << lbl_v << std::endl; } } - Assert( n.getKind()!=kind::SEP_LABEL ); + Assert(n.getKind() != kind::SEP_LABEL); if( n.getKind()==kind::SEP_STAR || n.getKind()==kind::SEP_WAND ){ if( lbl==o_lbl ){ std::vector< Node > children; children.resize( n.getNumChildren() ); - Assert( d_label_map[n].find( lbl )!=d_label_map[n].end() ); + Assert(d_label_map[n].find(lbl) != d_label_map[n].end()); std::map< int, Node > mvals; for( std::map< int, Node >::iterator itl = d_label_map[n][lbl].begin(); itl != d_label_map[n][lbl].end(); ++itl ){ Node sub_lbl = itl->second; int sub_index = itl->first; - Assert( sub_index>=0 && sub_index<(int)children.size() ); + Assert(sub_index >= 0 && sub_index < (int)children.size()); Trace("sep-inst-debug") << "Sublabel " << sub_index << " is " << sub_lbl << std::endl; Node lbl_mval; if( n.getKind()==kind::SEP_WAND && sub_index==1 ){ - Assert( d_label_map[n][lbl].find( 0 )!=d_label_map[n][lbl].end() ); + Assert(d_label_map[n][lbl].find(0) != d_label_map[n][lbl].end()); Node sub_lbl_0 = d_label_map[n][lbl][0]; computeLabelModel( sub_lbl_0 ); - Assert( d_label_model.find( sub_lbl_0 )!=d_label_model.end() ); + Assert(d_label_model.find(sub_lbl_0) != d_label_model.end()); lbl_mval = NodeManager::currentNM()->mkNode( kind::UNION, lbl, d_label_model[sub_lbl_0].getValue( rtn ) ); }else{ computeLabelModel( sub_lbl ); - Assert( d_label_model.find( sub_lbl )!=d_label_model.end() ); + Assert(d_label_model.find(sub_lbl) != d_label_model.end()); lbl_mval = d_label_model[sub_lbl].getValue( rtn ); } Trace("sep-inst-debug") << "Sublabel value is " << lbl_mval << std::endl; @@ -1360,8 +1363,8 @@ Node TheorySep::instantiateLabel( Node n, Node o_lbl, Node lbl, Node lbl_v, std: } } bchildren.push_back( vsu.eqNode( lbl ) ); - - Assert( bchildren.size()>1 ); + + Assert(bchildren.size() > 1); conj.push_back( NodeManager::currentNM()->mkNode( kind::AND, bchildren ) ); if( options::sepChildRefine() ){ @@ -1403,7 +1406,7 @@ Node TheorySep::instantiateLabel( Node n, Node o_lbl, Node lbl, Node lbl_v, std: } }else if( n.getKind()==kind::SEP_PTO ){ //check if this pto reference is in the base label, if not, then it does not need to be added as an assumption - Assert( d_label_model.find( o_lbl )!=d_label_model.end() ); + Assert(d_label_model.find(o_lbl) != d_label_model.end()); Node vr = d_valuation.getModel()->getRepresentative( n[0] ); Node svr = NodeManager::currentNM()->mkNode( kind::SINGLETON, vr ); bool inBaseHeap = std::find( d_label_model[o_lbl].d_heap_locs_model.begin(), d_label_model[o_lbl].d_heap_locs_model.end(), svr )!=d_label_model[o_lbl].d_heap_locs_model.end(); @@ -1481,17 +1484,17 @@ void TheorySep::setInactiveAssertionRec( Node fact, std::map< Node, std::vector< void TheorySep::getLabelChildren( Node s_atom, Node lbl, std::vector< Node >& children, std::vector< Node >& labels ) { for( unsigned i=0; i<s_atom.getNumChildren(); i++ ){ Node lblc = getLabel( s_atom, i, lbl ); - Assert( !lblc.isNull() ); + Assert(!lblc.isNull()); std::map< Node, Node > visited; Node lc = applyLabel( s_atom[i], lblc, visited ); - Assert( !lc.isNull() ); + Assert(!lc.isNull()); if( i==1 && s_atom.getKind()==kind::SEP_WAND ){ lc = lc.negate(); } children.push_back( lc ); labels.push_back( lblc ); } - Assert( children.size()>1 ); + Assert(children.size() > 1); } void TheorySep::computeLabelModel( Node lbl ) { @@ -1504,7 +1507,7 @@ void TheorySep::computeLabelModel( Node lbl ) { Trace("sep-process") << "Model value (from valuation) for " << lbl << " : " << v_val << std::endl; if( v_val.getKind()!=kind::EMPTYSET ){ while( v_val.getKind()==kind::UNION ){ - Assert( v_val[1].getKind()==kind::SINGLETON ); + Assert(v_val[1].getKind() == kind::SINGLETON); d_label_model[lbl].d_heap_locs_model.push_back( v_val[1] ); v_val = v_val[0]; } @@ -1512,12 +1515,12 @@ void TheorySep::computeLabelModel( Node lbl ) { d_label_model[lbl].d_heap_locs_model.push_back( v_val ); }else{ throw Exception("Could not establish value of heap in model."); - Assert( false ); + Assert(false); } } for( unsigned j=0; j<d_label_model[lbl].d_heap_locs_model.size(); j++ ){ Node u = d_label_model[lbl].d_heap_locs_model[j]; - Assert( u.getKind()==kind::SINGLETON ); + Assert(u.getKind() == kind::SINGLETON); u = u[0]; Node tt; std::map< Node, Node >::iterator itm = d_tmodel.find( u ); @@ -1528,8 +1531,8 @@ void TheorySep::computeLabelModel( Node lbl ) { //TypeNode tn = u.getType().getRefConstituentType(); TypeNode tn = u.getType(); Trace("sep-process") << "WARNING: could not find symbolic term in model for " << u << ", cref type " << tn << std::endl; - Assert( d_type_references_all.find( tn )!=d_type_references_all.end() ); - Assert( !d_type_references_all[tn].empty() ); + Assert(d_type_references_all.find(tn) != d_type_references_all.end()); + Assert(!d_type_references_all[tn].empty()); tt = d_type_references_all[tn][0]; }else{ tt = itm->second; @@ -1604,7 +1607,7 @@ void TheorySep::validatePto( HeapAssertInfo * ei, Node ei_n ) { if (fact.getKind() == kind::NOT) { TNode atom = fact[0]; - Assert( atom.getKind()==kind::SEP_LABEL ); + Assert(atom.getKind() == kind::SEP_LABEL); TNode s_atom = atom[0]; if( s_atom.getKind()==kind::SEP_PTO ){ if( areEqual( atom[1], ei_n ) ){ @@ -1627,9 +1630,10 @@ void TheorySep::addPto( HeapAssertInfo * ei, Node ei_n, Node p, bool polarity ) }else{ Node pb = ei->d_pto.get(); Trace("sep-pto") << "Process positive/negated pto " << " " << pb << " " << p << std::endl; - Assert( pb.getKind()==kind::SEP_LABEL && pb[0].getKind()==kind::SEP_PTO ); - Assert( p.getKind()==kind::SEP_LABEL && p[0].getKind()==kind::SEP_PTO ); - Assert( areEqual( pb[1], p[1] ) ); + Assert(pb.getKind() == kind::SEP_LABEL + && pb[0].getKind() == kind::SEP_PTO); + Assert(p.getKind() == kind::SEP_LABEL && p[0].getKind() == kind::SEP_PTO); + Assert(areEqual(pb[1], p[1])); std::vector< Node > exp; if( pb[1]!=p[1] ){ //if( pb[1].getKind()==kind::SINGLETON && p[1].getKind()==kind::SINGLETON ){ @@ -1664,12 +1668,12 @@ void TheorySep::addPto( HeapAssertInfo * ei, Node ei_n, Node p, bool polarity ) void TheorySep::mergePto( Node p1, Node p2 ) { Trace("sep-lemma-debug") << "Merge pto " << p1 << " " << p2 << std::endl; - Assert( p1.getKind()==kind::SEP_LABEL && p1[0].getKind()==kind::SEP_PTO ); - Assert( p2.getKind()==kind::SEP_LABEL && p2[0].getKind()==kind::SEP_PTO ); + Assert(p1.getKind() == kind::SEP_LABEL && p1[0].getKind() == kind::SEP_PTO); + Assert(p2.getKind() == kind::SEP_LABEL && p2[0].getKind() == kind::SEP_PTO); if( !areEqual( p1[0][1], p2[0][1] ) ){ std::vector< Node > exp; if( p1[1]!=p2[1] ){ - Assert( areEqual( p1[1], p2[1] ) ); + Assert(areEqual(p1[1], p2[1])); exp.push_back( p1[1].eqNode( p2[1] ) ); } exp.push_back( p1 ); @@ -1771,7 +1775,7 @@ void TheorySep::debugPrintHeap( HeapInfo& heap, const char * c ) { } Node TheorySep::HeapInfo::getValue( TypeNode tn ) { - Assert( d_heap_locs.size()==d_heap_locs_model.size() ); + Assert(d_heap_locs.size() == d_heap_locs_model.size()); if( d_heap_locs.empty() ){ return NodeManager::currentNM()->mkConst(EmptySet(tn.toType())); }else if( d_heap_locs.size()==1 ){ diff --git a/src/theory/sep/theory_sep_rewriter.cpp b/src/theory/sep/theory_sep_rewriter.cpp index 92e7db7aa..09429cb13 100644 --- a/src/theory/sep/theory_sep_rewriter.cpp +++ b/src/theory/sep/theory_sep_rewriter.cpp @@ -25,7 +25,7 @@ namespace theory { namespace sep { void TheorySepRewriter::getStarChildren( Node n, std::vector< Node >& s_children, std::vector< Node >& ns_children ){ - Assert( n.getKind()==kind::SEP_STAR ); + Assert(n.getKind() == kind::SEP_STAR); Node tr = NodeManager::currentNM()->mkConst( true ); for( unsigned i=0; i<n.getNumChildren(); i++ ){ if( n[i].getKind()==kind::SEP_EMP ){ @@ -131,7 +131,7 @@ RewriteResponse TheorySepRewriter::postRewrite(TNode node) { } ns_children.push_back( schild ); } - Assert( !ns_children.empty() ); + Assert(!ns_children.empty()); if( ns_children.size()==1 ){ retNode = ns_children[0]; }else{ diff --git a/src/theory/sets/cardinality_extension.cpp b/src/theory/sets/cardinality_extension.cpp index 37dfedd15..48f5b7b35 100644 --- a/src/theory/sets/cardinality_extension.cpp +++ b/src/theory/sets/cardinality_extension.cpp @@ -870,8 +870,8 @@ void CardinalityExtension::mkModelValueElementsFor( Node v = val.getModelValue(it->second); Trace("sets-model") << "Cardinality of " << eqc << " is " << v << std::endl; - Assert(v.getConst<Rational>() <= LONG_MAX, - "Exceeded LONG_MAX in sets model"); + Assert(v.getConst<Rational>() <= LONG_MAX) + << "Exceeded LONG_MAX in sets model"; unsigned vu = v.getConst<Rational>().getNumerator().toUnsignedInt(); Assert(els.size() <= vu); NodeManager* nm = NodeManager::currentNM(); diff --git a/src/theory/sets/rels_utils.h b/src/theory/sets/rels_utils.h index 1bbbb359b..6354b59e9 100644 --- a/src/theory/sets/rels_utils.h +++ b/src/theory/sets/rels_utils.h @@ -72,7 +72,7 @@ public: } static Node reverseTuple( Node tuple ) { - Assert( tuple.getType().isTuple() ); + Assert(tuple.getType().isTuple()); std::vector<Node> elements; std::vector<TypeNode> tuple_types = tuple.getType().getTupleTypes(); std::reverse( tuple_types.begin(), tuple_types.end() ); diff --git a/src/theory/sets/theory_sets_private.cpp b/src/theory/sets/theory_sets_private.cpp index 3b52da338..94fef85f5 100644 --- a/src/theory/sets/theory_sets_private.cpp +++ b/src/theory/sets/theory_sets_private.cpp @@ -127,12 +127,14 @@ void TheorySetsPrivate::eqNotifyPostMerge(TNode t1, TNode t2){ n_members = (*mem_i1).second; } for( int i=0; i<(*mem_i2).second; i++ ){ - Assert( i<(int)d_members_data[t2].size() && d_members_data[t2][i].getKind()==kind::MEMBER ); + Assert(i < (int)d_members_data[t2].size() + && d_members_data[t2][i].getKind() == kind::MEMBER); Node m2 = d_members_data[t2][i]; //check if redundant bool add = true; for( int j=0; j<n_members; j++ ){ - Assert( j<(int)d_members_data[t1].size() && d_members_data[t1][j].getKind()==kind::MEMBER ); + Assert(j < (int)d_members_data[t1].size() + && d_members_data[t1][j].getKind() == kind::MEMBER); if (d_state.areEqual(m2[0], d_members_data[t1][j][0])) { add = false; @@ -141,7 +143,7 @@ void TheorySetsPrivate::eqNotifyPostMerge(TNode t1, TNode t2){ } if( add ){ if( !s1.isNull() && s2.isNull() ){ - Assert( m2[1].getType().isComparableTo( s1.getType() ) ); + Assert(m2[1].getType().isComparableTo(s1.getType())); Assert(d_state.areEqual(m2[1], s1)); Node exp = NodeManager::currentNM()->mkNode( kind::AND, m2[1].eqNode( s1 ), m2 ); if( s1.getKind()==kind::SINGLETON ){ @@ -213,7 +215,8 @@ bool TheorySetsPrivate::areCareDisequal(Node a, Node b) } bool TheorySetsPrivate::isMember( Node x, Node s ) { - Assert( d_equalityEngine.hasTerm( s ) && d_equalityEngine.getRepresentative( s )==s ); + Assert(d_equalityEngine.hasTerm(s) + && d_equalityEngine.getRepresentative(s) == s); NodeIntMap::iterator mem_i = d_members.find( s ); if( mem_i != d_members.end() ) { for( int i=0; i<(*mem_i).second; i++ ){ @@ -331,10 +334,10 @@ void TheorySetsPrivate::fullEffortCheck(){ } TypeNode tnn = n.getType(); if( isSet ){ - Assert( tnn.isSet() ); + Assert(tnn.isSet()); TypeNode tnnel = tnn.getSetElementType(); tnc = TypeNode::mostCommonTypeNode( tnc, tnnel ); - Assert( !tnc.isNull() ); + Assert(!tnc.isNull()); //update the common type term if( tnc==tnnel ){ tnct = n; @@ -367,7 +370,7 @@ void TheorySetsPrivate::fullEffortCheck(){ ++eqc_i; } if( isSet ){ - Assert( tnct.getType().getSetElementType()==tnc ); + Assert(tnct.getType().getSetElementType() == tnc); d_most_common_type[eqc] = tnc; d_most_common_type_term[eqc] = tnct; } @@ -513,7 +516,7 @@ void TheorySetsPrivate::checkDownwardsClosure() { Node mem = it2.second; Node eq_set = nv; - Assert( d_equalityEngine.areEqual( mem[1], eq_set ) ); + Assert(d_equalityEngine.areEqual(mem[1], eq_set)); if( mem[1]!=eq_set ){ Trace("sets-debug") << "Downwards closure based on " << mem << ", eq_set = " << eq_set << std::endl; if( !options::setsProxyLemmas() ){ @@ -621,7 +624,7 @@ void TheorySetsPrivate::checkUpwardsClosure() } } }else{ - Assert( k==kind::SETMINUS ); + Assert(k == kind::SETMINUS); std::map<Node, Node>::const_iterator itm = r2mem.find(xr); if (itm == r2mem.end()) { @@ -847,8 +850,8 @@ void TheorySetsPrivate::addCarePairs(TNodeTrie* t1, for (unsigned k = 0; k < f1.getNumChildren(); ++ k) { TNode x = f1[k]; TNode y = f2[k]; - Assert( d_equalityEngine.hasTerm(x) ); - Assert( d_equalityEngine.hasTerm(y) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); Assert(!d_state.areDisequal(x, y)); Assert(!areCareDisequal(x, y)); if( !d_equalityEngine.areEqual( x, y ) ){ @@ -860,7 +863,7 @@ void TheorySetsPrivate::addCarePairs(TNodeTrie* t1, }else if( isCareArg( f1, k ) && isCareArg( f2, k ) ){ //splitting on sets (necessary for handling set of sets properly) if( x.getType().isSet() ){ - Assert( y.getType().isSet() ); + Assert(y.getType().isSet()); if (!d_state.areDisequal(x, y)) { Trace("sets-cg-lemma") << "Should split on : " << x << "==" << y << std::endl; diff --git a/src/theory/sets/theory_sets_rels.cpp b/src/theory/sets/theory_sets_rels.cpp index 65cff2418..5c24cb088 100644 --- a/src/theory/sets/theory_sets_rels.cpp +++ b/src/theory/sets/theory_sets_rels.cpp @@ -522,7 +522,7 @@ void TheorySetsRels::check(Theory::Effort level) std::map< Node, std::map< Node, Node > >::iterator tc_exp_it = d_tcr_tcGraph_exps.find( tc_rel ); TC_GRAPH_IT tc_graph_it = (tc_it->second).find( mem_rep_fst ); - Assert( tc_exp_it != d_tcr_tcGraph_exps.end() ); + Assert(tc_exp_it != d_tcr_tcGraph_exps.end()); std::map< Node, Node >::iterator exp_map_it = (tc_exp_it->second).find( mem_rep_tup ); if( exp_map_it == (tc_exp_it->second).end() ) { @@ -679,7 +679,7 @@ void TheorySetsRels::check(Theory::Effort level) std::vector< Node > reasons; std::unordered_set<Node, NodeHashFunction> seen; Node tuple = RelsUtils::constructPair( tc_rel, getRepresentative( tc_graph_it->first ), getRepresentative( *snd_elements_it) ); - Assert( rel_tc_graph_exps.find( tuple ) != rel_tc_graph_exps.end() ); + Assert(rel_tc_graph_exps.find(tuple) != rel_tc_graph_exps.end()); Node exp = rel_tc_graph_exps.find( tuple )->second; reasons.push_back( exp ); @@ -918,7 +918,8 @@ void TheorySetsRels::check(Theory::Effort level) Trace("rels-debug") << "[Theory::Rels] ****** Finalizing transitive closure inferences!" << std::endl; TC_IT tc_graph_it = d_tcr_tcGraph.begin(); while( tc_graph_it != d_tcr_tcGraph.end() ) { - Assert ( d_tcr_tcGraph_exps.find(tc_graph_it->first) != d_tcr_tcGraph_exps.end() ); + Assert(d_tcr_tcGraph_exps.find(tc_graph_it->first) + != d_tcr_tcGraph_exps.end()); doTCInference( tc_graph_it->second, d_tcr_tcGraph_exps.find(tc_graph_it->first)->second, tc_graph_it->first ); ++tc_graph_it; } @@ -992,7 +993,7 @@ void TheorySetsRels::check(Theory::Effort level) std::vector<Node> members = d_rReps_memberReps_cache[rel0_rep]; std::vector<Node> exps = d_rReps_memberReps_exp_cache[rel0_rep]; - Assert( members.size() == exps.size() ); + Assert(members.size() == exps.size()); for(unsigned int i = 0; i < members.size(); i++) { Node reason = exps[i]; diff --git a/src/theory/sets/theory_sets_rewriter.cpp b/src/theory/sets/theory_sets_rewriter.cpp index 5d654e7d5..aa6f4de3f 100644 --- a/src/theory/sets/theory_sets_rewriter.cpp +++ b/src/theory/sets/theory_sets_rewriter.cpp @@ -35,8 +35,9 @@ bool checkConstantMembership(TNode elementTerm, TNode setTerm) return elementTerm == setTerm[0]; } - Assert(setTerm.getKind() == kind::UNION && setTerm[1].getKind() == kind::SINGLETON, - "kind was %d, term: %s", setTerm.getKind(), setTerm.toString().c_str()); + Assert(setTerm.getKind() == kind::UNION + && setTerm[1].getKind() == kind::SINGLETON) + << "kind was " << setTerm.getKind() << ", term: " << setTerm; return elementTerm == setTerm[1][0] || @@ -81,7 +82,8 @@ RewriteResponse TheorySetsRewriter::postRewrite(TNode node) { }//kind::MEMBER case kind::SUBSET: { - Assert(false, "TheorySets::postRrewrite(): Subset is handled in preRewrite."); + Assert(false) + << "TheorySets::postRrewrite(): Subset is handled in preRewrite."; // but in off-chance we do end up here, let us do our best diff --git a/src/theory/sets/theory_sets_type_rules.h b/src/theory/sets/theory_sets_type_rules.h index 7e6038423..27aa58452 100644 --- a/src/theory/sets/theory_sets_type_rules.h +++ b/src/theory/sets/theory_sets_type_rules.h @@ -48,9 +48,8 @@ public: struct SetsBinaryOperatorTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::UNION || - n.getKind() == kind::INTERSECTION || - n.getKind() == kind::SETMINUS); + Assert(n.getKind() == kind::UNION || n.getKind() == kind::INTERSECTION + || n.getKind() == kind::SETMINUS); TypeNode setType = n[0].getType(check); if( check ) { if(!setType.isSet()) { @@ -73,9 +72,8 @@ struct SetsBinaryOperatorTypeRule { } inline static bool computeIsConst(NodeManager* nodeManager, TNode n) { - Assert(n.getKind() == kind::UNION || - n.getKind() == kind::INTERSECTION || - n.getKind() == kind::SETMINUS); + Assert(n.getKind() == kind::UNION || n.getKind() == kind::INTERSECTION + || n.getKind() == kind::SETMINUS); if(n.getKind() == kind::UNION) { return NormalForm::checkNormalConstant(n); } else { @@ -223,7 +221,7 @@ struct InsertTypeRule { { Assert(n.getKind() == kind::INSERT); size_t numChildren = n.getNumChildren(); - Assert( numChildren >= 2 ); + Assert(numChildren >= 2); TypeNode setType = n[numChildren-1].getType(check); if( check ) { if(!setType.isSet()) { @@ -249,8 +247,7 @@ struct InsertTypeRule { struct RelBinaryOperatorTypeRule { inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert(n.getKind() == kind::PRODUCT || - n.getKind() == kind::JOIN); + Assert(n.getKind() == kind::PRODUCT || n.getKind() == kind::JOIN); TypeNode firstRelType = n[0].getType(check); TypeNode secondRelType = n[1].getType(check); @@ -286,8 +283,7 @@ struct RelBinaryOperatorTypeRule { } inline static bool computeIsConst(NodeManager* nodeManager, TNode n) { - Assert(n.getKind() == kind::JOIN || - n.getKind() == kind::PRODUCT); + Assert(n.getKind() == kind::JOIN || n.getKind() == kind::PRODUCT); return false; } };/* struct RelBinaryOperatorTypeRule */ @@ -331,8 +327,8 @@ struct RelTransClosureTypeRule { } inline static bool computeIsConst(NodeManager* nodeManager, TNode n) { - Assert(n.getKind() == kind::TCLOSURE); - return false; + Assert(n.getKind() == kind::TCLOSURE); + return false; } };/* struct RelTransClosureTypeRule */ diff --git a/src/theory/sort_inference.cpp b/src/theory/sort_inference.cpp index 6c141cf2a..d1ecef831 100644 --- a/src/theory/sort_inference.cpp +++ b/src/theory/sort_inference.cpp @@ -654,13 +654,13 @@ Node SortInference::simplifyNode( } if( processChild ){ if( n.getKind()==kind::APPLY_UF ){ - Assert( d_op_arg_types.find( op )!=d_op_arg_types.end() ); + Assert(d_op_arg_types.find(op) != d_op_arg_types.end()); tnnc = getOrCreateTypeForId( d_op_arg_types[op][i], n[i].getType() ); - Assert( !tnnc.isNull() ); + Assert(!tnnc.isNull()); }else if( n.getKind()==kind::EQUAL && i==0 ){ - Assert( d_equality_types.find( n )!=d_equality_types.end() ); + Assert(d_equality_types.find(n) != d_equality_types.end()); tnnc = getOrCreateTypeForId( d_equality_types[n], n[0].getType() ); - Assert( !tnnc.isNull() ); + Assert(!tnnc.isNull()); } Node nc = simplifyNode(n[i], var_bound, @@ -688,7 +688,7 @@ Node SortInference::simplifyNode( if( !tn1.isSubtypeOf( tn2 ) && !tn2.isSubtypeOf( tn1 ) ){ Trace("sort-inference-warn") << "Sort inference created bad equality: " << children[0] << " = " << children[1] << std::endl; Trace("sort-inference-warn") << " Types : " << children[0].getType() << " " << children[1].getType() << std::endl; - Assert( false ); + Assert(false); } ret = NodeManager::currentNM()->mkNode( kind::EQUAL, children ); }else if( n.getKind()==kind::APPLY_UF ){ @@ -727,7 +727,7 @@ Node SortInference::simplifyNode( if (!tn.isSubtypeOf(tna)) { Trace("sort-inference-warn") << "Sort inference created bad child: " << n << " " << n[i] << " " << tn << " " << tna << std::endl; - Assert( false ); + Assert(false); } } ret = NodeManager::currentNM()->mkNode( kind::APPLY_UF, children ); @@ -844,7 +844,7 @@ void SortInference::getSortConstraints( Node n, UnionFind& uf ) { } bool SortInference::isMonotonic( TypeNode tn ) { - Assert( tn.isSort() ); + Assert(tn.isSort()); return d_non_monotonic_sorts_orig.find( tn )==d_non_monotonic_sorts_orig.end(); } diff --git a/src/theory/strings/regexp_operation.cpp b/src/theory/strings/regexp_operation.cpp index b20e2f3ad..aaf1c864f 100644 --- a/src/theory/strings/regexp_operation.cpp +++ b/src/theory/strings/regexp_operation.cpp @@ -281,7 +281,7 @@ int RegExpOpr::delta( Node r, Node &exp ) { // 0-unknown, 1-yes, 2-no int RegExpOpr::derivativeS( Node r, CVC4::String c, Node &retNode ) { - Assert( c.size() < 2 ); + Assert(c.size() < 2); Trace("regexp-derive") << "RegExp-derive starts with /" << mkString( r ) << "/, c=" << c << std::endl; int ret = 1; @@ -522,7 +522,7 @@ int RegExpOpr::derivativeS( Node r, CVC4::String c, Node &retNode ) { } Node RegExpOpr::derivativeSingle( Node r, CVC4::String c ) { - Assert( c.size() < 2 ); + Assert(c.size() < 2); Trace("regexp-derive") << "RegExp-derive starts with /" << mkString( r ) << "/, c=" << c << std::endl; Node retNode = d_emptyRegexp; PairNodeStr dv = std::make_pair( r, c ); @@ -1249,8 +1249,8 @@ bool RegExpOpr::isPairNodesInSet(std::set< PairNodes > &s, Node n1, Node n2) { bool RegExpOpr::containC2(unsigned cnt, Node n) { if(n.getKind() == kind::REGEXP_RV) { - Assert(n[0].getConst<Rational>() <= Rational(String::maxSize()), - "Exceeded UINT32_MAX in RegExpOpr::containC2"); + Assert(n[0].getConst<Rational>() <= Rational(String::maxSize())) + << "Exceeded UINT32_MAX in RegExpOpr::containC2"; unsigned y = n[0].getConst<Rational>().getNumerator().toUnsignedInt(); return cnt == y; } else if(n.getKind() == kind::REGEXP_CONCAT) { @@ -1291,8 +1291,8 @@ void RegExpOpr::convert2(unsigned cnt, Node n, Node &r1, Node &r2) { r1 = d_emptySingleton; r2 = d_emptySingleton; } else if(n.getKind() == kind::REGEXP_RV) { - Assert(n[0].getConst<Rational>() <= Rational(String::maxSize()), - "Exceeded UINT32_MAX in RegExpOpr::convert2"); + Assert(n[0].getConst<Rational>() <= Rational(String::maxSize())) + << "Exceeded UINT32_MAX in RegExpOpr::convert2"; unsigned y = n[0].getConst<Rational>().getNumerator().toUnsignedInt(); r1 = d_emptySingleton; if(cnt == y) { @@ -1503,7 +1503,7 @@ Node RegExpOpr::intersectInternal( Node r1, Node r2, std::map< PairNodes, Node > } Node RegExpOpr::removeIntersection(Node r) { - Assert( checkConstRegExp(r) ); + Assert(checkConstRegExp(r)); std::map < Node, Node >::const_iterator itr = d_rm_inter_cache.find(r); if(itr != d_rm_inter_cache.end()) { return itr->second; diff --git a/src/theory/strings/regexp_solver.cpp b/src/theory/strings/regexp_solver.cpp index 11471c09f..b13b64f98 100644 --- a/src/theory/strings/regexp_solver.cpp +++ b/src/theory/strings/regexp_solver.cpp @@ -574,9 +574,9 @@ bool RegExpSolver::deriveRegExp(Node x, { if (x.isConst()) { - Assert(false, - "Impossible: RegExpSolver::deriveRegExp: const string in const " - "regular expression."); + Assert(false) + << "Impossible: RegExpSolver::deriveRegExp: const string in const " + "regular expression."; return false; } else diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index b0681b1ff..750710769 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -73,7 +73,7 @@ Node TheoryStrings::TermIndex::add(TNode n, } return d_data; }else{ - Assert( index<n.getNumChildren() ); + Assert(index < n.getNumChildren()); TNode nir = s.getRepresentative(n[index]); //if it is empty, and doing CONCAT, ignore if( nir==er && n.getKind()==kind::STRING_CONCAT ){ @@ -164,8 +164,8 @@ TheoryStrings::~TheoryStrings() { } bool TheoryStrings::areCareDisequal( TNode x, TNode y ) { - Assert( d_equalityEngine.hasTerm(x) ); - Assert( d_equalityEngine.hasTerm(y) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); if( d_equalityEngine.isTriggerTerm(x, THEORY_STRINGS) && d_equalityEngine.isTriggerTerm(y, THEORY_STRINGS) ){ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_STRINGS); TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_STRINGS); @@ -585,8 +585,8 @@ bool TheoryStrings::collectModelInfo(TheoryModel* m) } else { - Assert(len_value.getConst<Rational>() <= Rational(String::maxSize()), - "Exceeded UINT32_MAX in string model"); + Assert(len_value.getConst<Rational>() <= Rational(String::maxSize())) + << "Exceeded UINT32_MAX in string model"; unsigned lvalue = len_value.getConst<Rational>().getNumerator().toUnsignedInt(); std::map<unsigned, Node>::iterator itvu = values_used.find(lvalue); @@ -668,8 +668,8 @@ bool TheoryStrings::collectModelInfo(TheoryModel* m) Trace("strings-model") << std::endl; //use type enumerator - Assert(lts_values[i].getConst<Rational>() <= Rational(String::maxSize()), - "Exceeded UINT32_MAX in string model"); + Assert(lts_values[i].getConst<Rational>() <= Rational(String::maxSize())) + << "Exceeded UINT32_MAX in string model"; StringEnumeratorLength sel(lts_values[i].getConst<Rational>().getNumerator().toUnsignedInt()); for (const Node& eqc : pure_eq) { @@ -677,7 +677,7 @@ bool TheoryStrings::collectModelInfo(TheoryModel* m) std::map<Node, Node>::iterator itp = pure_eq_assign.find(eqc); if (itp == pure_eq_assign.end()) { - Assert( !sel.isFinished() ); + Assert(!sel.isFinished()); c = *sel; while (m->hasTerm(c)) { @@ -765,11 +765,11 @@ bool TheoryStrings::collectModelInfo(TheoryModel* m) for (const Node& n : nf.d_nf) { Node r = d_state.getRepresentative(n); - Assert( r.isConst() || processed.find( r )!=processed.end() ); + Assert(r.isConst() || processed.find(r) != processed.end()); nc.push_back(r.isConst() ? r : processed[r]); } Node cc = utils::mkNConcat(nc); - Assert( cc.getKind()==kind::CONST_STRING ); + Assert(cc.getKind() == kind::CONST_STRING); Trace("strings-model") << "*** Determined constant " << cc << " for " << nodes[i] << std::endl; processed[nodes[i]] = cc; if (!m->assertEquality(nodes[i], cc, true)) @@ -1164,10 +1164,10 @@ void TheoryStrings::addCarePairs(TNodeTrie* t1, for (unsigned k = 0; k < f1.getNumChildren(); ++ k) { TNode x = f1[k]; TNode y = f2[k]; - Assert( d_equalityEngine.hasTerm(x) ); - Assert( d_equalityEngine.hasTerm(y) ); - Assert( !d_equalityEngine.areDisequal( x, y, false ) ); - Assert( !areCareDisequal( x, y ) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); + Assert(!d_equalityEngine.areDisequal(x, y, false)); + Assert(!areCareDisequal(x, y)); if( !d_equalityEngine.areEqual( x, y ) ){ if( d_equalityEngine.isTriggerTerm(x, THEORY_STRINGS) && d_equalityEngine.isTriggerTerm(y, THEORY_STRINGS) ){ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_STRINGS); @@ -1259,7 +1259,7 @@ void TheoryStrings::computeCareGraph(){ void TheoryStrings::assertPendingFact(Node atom, bool polarity, Node exp) { Trace("strings-pending") << "Assert pending fact : " << atom << " " << polarity << " from " << exp << std::endl; - Assert(atom.getKind() != kind::OR, "Infer error: a split."); + Assert(atom.getKind() != kind::OR) << "Infer error: a split."; if( atom.getKind()==kind::EQUAL ){ Trace("strings-pending-debug") << " Register term" << std::endl; for( unsigned j=0; j<2; j++ ) { @@ -1369,7 +1369,7 @@ void TheoryStrings::checkInit() { } //explain equal components if( count[0]<nc.getNumChildren() ){ - Assert( count[1]<n.getNumChildren() ); + Assert(count[1] < n.getNumChildren()); if( nc[count[0]]!=n[count[1]] ){ exp.push_back( nc[count[0]].eqNode( n[count[1]] ) ); } @@ -1409,12 +1409,12 @@ void TheoryStrings::checkInit() { } else { - Assert( !foundNEmpty ); + Assert(!foundNEmpty); ns = n[i]; foundNEmpty = true; } } - AlwaysAssert( foundNEmpty ); + AlwaysAssert(foundNEmpty); //infer the equality d_im.sendInference(exp, n.eqNode(ns), "I_Norm_S"); } @@ -1492,7 +1492,7 @@ void TheoryStrings::checkConstantEquivalenceClasses( TermIndex* ti, std::vector< if (!d_state.areEqual(n[count], vecc[countc])) { Node nrr = d_state.getRepresentative(n[count]); - Assert( !d_eqc_to_const_exp[nrr].isNull() ); + Assert(!d_eqc_to_const_exp[nrr].isNull()); d_im.addToExplanation(n[count], d_eqc_to_const_base[nrr], exp); exp.push_back( d_eqc_to_const_exp[nrr] ); } @@ -1505,7 +1505,7 @@ void TheoryStrings::checkConstantEquivalenceClasses( TermIndex* ti, std::vector< } } //exp contains an explanation of n==c - Assert( countc==vecc.size() ); + Assert(countc == vecc.size()); if (d_state.hasTerm(c)) { d_im.sendInference(exp, n.eqNode(c), "I_CONST_MERGE"); @@ -1722,7 +1722,7 @@ void TheoryStrings::checkExtfEval( int effort ) { } //if not reduced if( !to_reduce.isNull() ){ - Assert( effort<3 ); + Assert(effort < 3); if( effort==1 ){ Trace("strings-extf") << " cannot rewrite extf : " << to_reduce << std::endl; } @@ -2445,7 +2445,7 @@ Node TheoryStrings::checkCycles( Node eqc, std::vector< Node >& curr, std::vecto } Trace("strings-error") << "Looping term should be congruent : " << n << " " << eqc << " " << ncy << std::endl; //should find a non-empty component, otherwise would have been singular congruent (I_Norm_S) - Assert( false ); + Assert(false); }else{ return ncy; } @@ -2661,7 +2661,7 @@ void TheoryStrings::normalizeEquivalenceClass( Node eqc ) { } //construct the normal form - Assert( !normal_forms.empty() ); + Assert(!normal_forms.empty()); unsigned nf_index = 0; std::map<Node, unsigned>::iterator it = term_to_nf_index.find(eqc); // we prefer taking the normal form whose base is the equivalence @@ -2901,9 +2901,9 @@ void TheoryStrings::getNormalForms(Node eqc, Trace("strings-solve") << "Normal form for " << n << " cannot be contained in constant " << c << std::endl; //conflict, explanation is n = base ^ base = c ^ relevant porition of ( n = N[n] ) std::vector< Node > exp; - Assert( d_eqc_to_const_base.find( eqc )!=d_eqc_to_const_base.end() ); + Assert(d_eqc_to_const_base.find(eqc) != d_eqc_to_const_base.end()); d_im.addToExplanation(n, d_eqc_to_const_base[eqc], exp); - Assert( d_eqc_to_const_exp.find( eqc )!=d_eqc_to_const_exp.end() ); + Assert(d_eqc_to_const_exp.find(eqc) != d_eqc_to_const_exp.end()); if( !d_eqc_to_const_exp[eqc].isNull() ){ exp.push_back( d_eqc_to_const_exp[eqc] ); } @@ -3219,8 +3219,10 @@ void TheoryStrings::processSimpleNEq(NormalForm& nfi, NormalForm& nfnc = nfiv[index].isConst() ? nfj : nfi; std::vector<Node>& nfncv = nfnc.d_nf; Node other_str = nfncv[index]; - Assert( other_str.getKind()!=kind::CONST_STRING, "Other string is not constant." ); - Assert( other_str.getKind()!=kind::STRING_CONCAT, "Other string is not CONCAT." ); + Assert(other_str.getKind() != kind::CONST_STRING) + << "Other string is not constant."; + Assert(other_str.getKind() != kind::STRING_CONCAT) + << "Other string is not CONCAT."; if( !d_equalityEngine.areDisequal( other_str, d_emptyString, true ) ){ Node eq = other_str.eqNode( d_emptyString ); eq = Rewriter::rewrite(eq); @@ -3263,7 +3265,7 @@ void TheoryStrings::processSimpleNEq(NormalForm& nfi, Node const_str = TheoryStringsRewriter::collectConstantStringAt( nfcv, index_c_k, false); - Assert( !const_str.isNull() ); + Assert(!const_str.isNull()); CVC4::String stra = const_str.getConst<String>(); CVC4::String strb = next_const_str.getConst<String>(); //since non-empty, we start with charecter #1 @@ -3428,7 +3430,7 @@ void TheoryStrings::processSimpleNEq(NormalForm& nfi, } if( info_valid ){ pinfer.push_back( info ); - Assert( !success ); + Assert(!success); } } } @@ -3703,13 +3705,14 @@ void TheoryStrings::processDeq( Node ni, Node nj ) { if( ret!=0 ) { return; }else{ - Assert( index<nfi.size() && index<nfj.size() ); + Assert(index < nfi.size() && index < nfj.size()); Node i = nfi[index]; Node j = nfj[index]; Trace("strings-solve-debug") << "...Processing(DEQ) " << i << " " << j << std::endl; if (!d_state.areEqual(i, j)) { - Assert( i.getKind()!=kind::CONST_STRING || j.getKind()!=kind::CONST_STRING ); + Assert(i.getKind() != kind::CONST_STRING + || j.getKind() != kind::CONST_STRING); std::vector< Node > lexp; Node li = d_state.getLength(i, lexp); Node lj = d_state.getLength(j, lexp); @@ -3835,7 +3838,7 @@ void TheoryStrings::processDeq( Node ni, Node nj ) { index++; } } - Assert( false ); + Assert(false); } } @@ -3965,8 +3968,8 @@ void TheoryStrings::addNormalFormPair( Node n1, Node n2 ){ d_nf_pairs_data[n1][index] = n2; }else{ d_nf_pairs_data[n1].push_back( n2 ); - } - Assert( isNormalFormPair( n1, n2 ) ); + } + Assert(isNormalFormPair(n1, n2)); } else { Trace("strings-nf-debug") << "Already a normal form pair " << n1 << " " << n2 << std::endl; } @@ -3981,9 +3984,9 @@ bool TheoryStrings::isNormalFormPair2( Node n1, Node n2 ) { //Trace("strings-debug") << "is normal form pair. " << n1 << " " << n2 << std::endl; NodeIntMap::const_iterator it = d_nf_pairs.find( n1 ); if( it!=d_nf_pairs.end() ){ - Assert( d_nf_pairs_data.find( n1 )!=d_nf_pairs_data.end() ); + Assert(d_nf_pairs_data.find(n1) != d_nf_pairs_data.end()); for( int i=0; i<(*it).second; i++ ){ - Assert( i<(int)d_nf_pairs_data[n1].size() ); + Assert(i < (int)d_nf_pairs_data[n1].size()); if( d_nf_pairs_data[n1][i]==n2 ){ return true; } @@ -4489,7 +4492,7 @@ void TheoryStrings::separateByLength(std::vector< Node >& n, std::map< unsigned, std::vector< Node > > eqc_to_strings; for( unsigned i=0; i<n.size(); i++ ) { Node eqc = n[i]; - Assert( d_equalityEngine.getRepresentative(eqc)==eqc ); + Assert(d_equalityEngine.getRepresentative(eqc) == eqc); EqcInfo* ei = d_state.getOrMakeEqcInfo(eqc, false); Node lt = ei ? ei->d_lengthTerm : Node::null(); if( !lt.isNull() ){ @@ -4593,7 +4596,7 @@ Node TheoryStrings::ppRewrite(TNode atom) { } return ret; }else{ - Assert( new_nodes.empty() ); + Assert(new_nodes.empty()); } } return atom; @@ -4658,7 +4661,7 @@ bool TheoryStrings::hasStrategyEffort(Effort e) const void TheoryStrings::addStrategyStep(InferStep s, int effort, bool addBreak) { // must run check init first - Assert((s == CHECK_INIT)==d_infer_steps.empty()); + Assert((s == CHECK_INIT) == d_infer_steps.empty()); // must use check cycles when using flat forms Assert(s != CHECK_FLAT_FORMS || std::find(d_infer_steps.begin(), d_infer_steps.end(), CHECK_CYCLES) diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp index adf74f0cc..1e5b2a65a 100644 --- a/src/theory/strings/theory_strings_rewriter.cpp +++ b/src/theory/strings/theory_strings_rewriter.cpp @@ -52,8 +52,8 @@ Node TheoryStringsRewriter::simpleRegexpConsume( std::vector< Node >& mchildren, do_next = false; Node xc = mchildren[mchildren.size()-1]; Node rc = children[children.size()-1]; - Assert( rc.getKind()!=kind::REGEXP_CONCAT ); - Assert( xc.getKind()!=kind::STRING_CONCAT ); + Assert(rc.getKind() != kind::REGEXP_CONCAT); + Assert(xc.getKind() != kind::STRING_CONCAT); if( rc.getKind() == kind::STRING_TO_REGEXP ){ if( xc==rc[0] ){ children.pop_back(); @@ -132,7 +132,7 @@ Node TheoryStringsRewriter::simpleRegexpConsume( std::vector< Node >& mchildren, }else{ if( children_s.empty() ){ //if we were able to fully consume, store the result - Assert( mchildren_s.size()<=1 ); + Assert(mchildren_s.size() <= 1); if( mchildren_s.empty() ){ mchildren_s.push_back( emp_s ); } @@ -149,7 +149,7 @@ Node TheoryStringsRewriter::simpleRegexpConsume( std::vector< Node >& mchildren, if( result_valid ){ if( result.isNull() ){ //all disjuncts cannot be satisfied, return false - Assert( rc.getKind()==kind::REGEXP_UNION ); + Assert(rc.getKind() == kind::REGEXP_UNION); return NodeManager::currentNM()->mkConst( false ); }else{ //all branches led to the same result @@ -820,7 +820,7 @@ Node TheoryStringsRewriter::rewriteConcat(Node node) Node TheoryStringsRewriter::rewriteConcatRegExp(TNode node) { - Assert( node.getKind() == kind::REGEXP_CONCAT ); + Assert(node.getKind() == kind::REGEXP_CONCAT); NodeManager* nm = NodeManager::currentNM(); Trace("strings-rewrite-debug") << "Strings::rewriteConcatRegExp flatten " << node << std::endl; @@ -1105,11 +1105,11 @@ Node TheoryStringsRewriter::rewriteLoopRegExp(TNode node) TNode n1 = node[1]; NodeManager* nm = NodeManager::currentNM(); CVC4::Rational rMaxInt(String::maxSize()); - AlwaysAssert(n1.isConst(), "re.loop contains non-constant integer (1)."); - AlwaysAssert(n1.getConst<Rational>().sgn() >= 0, - "Negative integer in string REGEXP_LOOP (1)"); - Assert(n1.getConst<Rational>() <= rMaxInt, - "Exceeded UINT32_MAX in string REGEXP_LOOP (1)"); + AlwaysAssert(n1.isConst()) << "re.loop contains non-constant integer (1)."; + AlwaysAssert(n1.getConst<Rational>().sgn() >= 0) + << "Negative integer in string REGEXP_LOOP (1)"; + Assert(n1.getConst<Rational>() <= rMaxInt) + << "Exceeded UINT32_MAX in string REGEXP_LOOP (1)"; uint32_t l = n1.getConst<Rational>().getNumerator().toUnsignedInt(); std::vector<Node> vec_nodes; for (unsigned i = 0; i < l; i++) @@ -1123,11 +1123,11 @@ Node TheoryStringsRewriter::rewriteLoopRegExp(TNode node) vec_nodes.size() == 0 ? nm->mkNode(STRING_TO_REGEXP, nm->mkConst(String(""))) : vec_nodes.size() == 1 ? r : nm->mkNode(REGEXP_CONCAT, vec_nodes); - AlwaysAssert(n2.isConst(), "re.loop contains non-constant integer (2)."); - AlwaysAssert(n2.getConst<Rational>().sgn() >= 0, - "Negative integer in string REGEXP_LOOP (2)"); - Assert(n2.getConst<Rational>() <= rMaxInt, - "Exceeded UINT32_MAX in string REGEXP_LOOP (2)"); + AlwaysAssert(n2.isConst()) << "re.loop contains non-constant integer (2)."; + AlwaysAssert(n2.getConst<Rational>().sgn() >= 0) + << "Negative integer in string REGEXP_LOOP (2)"; + Assert(n2.getConst<Rational>() <= rMaxInt) + << "Exceeded UINT32_MAX in string REGEXP_LOOP (2)"; uint32_t u = n2.getConst<Rational>().getNumerator().toUnsignedInt(); if (u <= l) { @@ -1184,7 +1184,7 @@ bool TheoryStringsRewriter::isConstRegExp( TNode t ) { } bool TheoryStringsRewriter::testConstStringInRegExp( CVC4::String &s, unsigned int index_start, TNode r ) { - Assert( index_start <= s.size() ); + Assert(index_start <= s.size()); Trace("regexp-debug") << "Checking " << s << " in " << r << ", starting at " << index_start << std::endl; Assert(!r.isVar()); Kind k = r.getKind(); @@ -1194,7 +1194,7 @@ bool TheoryStringsRewriter::testConstStringInRegExp( CVC4::String &s, unsigned i if(r[0].getKind() == kind::CONST_STRING) { return ( s2 == r[0].getConst<String>() ); } else { - Assert( false, "RegExp contains variables" ); + Assert(false) << "RegExp contains variables"; return false; } } @@ -1295,7 +1295,8 @@ bool TheoryStringsRewriter::testConstStringInRegExp( CVC4::String &s, unsigned i } else if(l==0 && r[1]==r[2]) { return false; } else { - Assert(r.getNumChildren() == 3, "String rewriter error: LOOP has 2 children"); + Assert(r.getNumChildren() == 3) + << "String rewriter error: LOOP has 2 children"; if(l==0) { //R{0,u} uint32_t u = r[2].getConst<Rational>().getNumerator().toUnsignedInt(); @@ -1316,7 +1317,8 @@ bool TheoryStringsRewriter::testConstStringInRegExp( CVC4::String &s, unsigned i return false; } else { //R{l,l} - Assert(r[1]==r[2], "String rewriter error: LOOP nums are not equal"); + Assert(r[1] == r[2]) + << "String rewriter error: LOOP nums are not equal"; if(l>s.size() - index_start) { if(testConstStringInRegExp(s, s.size(), r[0])) { l = s.size() - index_start; @@ -3352,7 +3354,7 @@ Node TheoryStringsRewriter::rewriteStringCode(Node n) } Node TheoryStringsRewriter::splitConstant( Node a, Node b, int& index, bool isRev ) { - Assert( a.isConst() && b.isConst() ); + Assert(a.isConst() && b.isConst()); index = a.getConst<String>().size() <= b.getConst<String>().size() ? 1 : 0; unsigned len_short = index==1 ? a.getConst<String>().size() : b.getConst<String>().size(); bool cmp = isRev ? a.getConst<String>().rstrncmp(b.getConst<String>(), len_short): a.getConst<String>().strncmp(b.getConst<String>(), len_short); @@ -3371,10 +3373,10 @@ Node TheoryStringsRewriter::splitConstant( Node a, Node b, int& index, bool isRe } bool TheoryStringsRewriter::canConstantContainConcat( Node c, Node n, int& firstc, int& lastc ) { - Assert( c.isConst() ); + Assert(c.isConst()); CVC4::String t = c.getConst<String>(); const std::vector<unsigned>& tvec = t.getVec(); - Assert( n.getKind()==kind::STRING_CONCAT ); + Assert(n.getKind() == kind::STRING_CONCAT); //must find constant components in order size_t pos = 0; firstc = -1; @@ -3410,7 +3412,7 @@ bool TheoryStringsRewriter::canConstantContainConcat( Node c, Node n, int& first } bool TheoryStringsRewriter::canConstantContainList( Node c, std::vector< Node >& l, int& firstc, int& lastc ) { - Assert( c.isConst() ); + Assert(c.isConst()); CVC4::String t = c.getConst<String>(); //must find constant components in order size_t pos = 0; @@ -3457,7 +3459,7 @@ Node TheoryStringsRewriter::collectConstantStringAt( std::vector< Node >& vec, u std::reverse( c.begin(), c.end() ); } Node cc = Rewriter::rewrite(utils::mkConcat(STRING_CONCAT, c)); - Assert( cc.isConst() ); + Assert(cc.isConst()); return cc; }else{ return Node::null(); @@ -5135,8 +5137,8 @@ Node TheoryStringsRewriter::decomposeSubstrChain(Node s, std::vector<Node>& ss, std::vector<Node>& ls) { - Assert( ss.empty() ); - Assert( ls.empty() ); + Assert(ss.empty()); + Assert(ls.empty()); while (s.getKind() == STRING_SUBSTR) { ss.push_back(s[1]); diff --git a/src/theory/strings/type_enumerator.h b/src/theory/strings/type_enumerator.h index 5ca0b624d..4218d4ce5 100644 --- a/src/theory/strings/type_enumerator.h +++ b/src/theory/strings/type_enumerator.h @@ -44,8 +44,8 @@ class StringEnumerator : public TypeEnumeratorBase<StringEnumerator> { StringEnumerator(TypeNode type, TypeEnumeratorProperties* tep = nullptr) : TypeEnumeratorBase<StringEnumerator>(type) { - Assert(type.getKind() == kind::TYPE_CONSTANT && - type.getConst<TypeConstant>() == STRING_TYPE); + Assert(type.getKind() == kind::TYPE_CONSTANT + && type.getConst<TypeConstant>() == STRING_TYPE); d_cardinality = TheoryStringsRewriter::getAlphabetCardinality(); mkCurr(); } diff --git a/src/theory/substitutions.cpp b/src/theory/substitutions.cpp index 9007386c4..333f09d2d 100644 --- a/src/theory/substitutions.cpp +++ b/src/theory/substitutions.cpp @@ -180,7 +180,7 @@ void SubstitutionMap::addSubstitution(TNode x, TNode t, bool invalidateCache) // this causes a later assert-fail (the rhs != current one, above) anyway // putting it here is easier to diagnose - Assert(x != t, "cannot substitute a term for itself"); + Assert(x != t) << "cannot substitute a term for itself"; d_substitutions[x] = t; diff --git a/src/theory/theory.cpp b/src/theory/theory.cpp index a4b9d1ddf..719239806 100644 --- a/src/theory/theory.cpp +++ b/src/theory/theory.cpp @@ -21,7 +21,7 @@ #include <iostream> #include <string> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "expr/node_algorithm.h" #include "smt/smt_statistics_registry.h" #include "theory/ext_theory.h" diff --git a/src/theory/theory.h b/src/theory/theory.h index f6f1de69c..b133b878e 100644 --- a/src/theory/theory.h +++ b/src/theory/theory.h @@ -517,8 +517,9 @@ public: * (which was previously propagated by this theory). */ virtual Node explain(TNode n) { - Unimplemented("Theory %s propagated a node but doesn't implement the " - "Theory::explain() interface!", identify().c_str()); + Unimplemented() << "Theory " << identify() + << " propagated a node but doesn't implement the " + "Theory::explain() interface!"; } /** @@ -615,8 +616,8 @@ public: * via the syntax (! n :attr) */ virtual void setUserAttribute(const std::string& attr, Node n, std::vector<Node> node_values, std::string str_value) { - Unimplemented("Theory %s doesn't support Theory::setUserAttribute interface", - identify().c_str()); + Unimplemented() << "Theory " << identify() + << " doesn't support Theory::setUserAttribute interface"; } /** A set of theories */ @@ -645,7 +646,7 @@ public: /** Returns the index size of a set of theories */ static inline size_t setIndex(TheoryId id, Set set) { - Assert (setContains(id, set)); + Assert(setContains(id, set)); size_t count = 0; while (setPop(set) != id) { ++ count; @@ -858,7 +859,7 @@ std::ostream& operator<<(std::ostream& os, theory::Theory::Effort level); inline theory::Assertion Theory::get() { - Assert( !done(), "Theory::get() called with assertion queue empty!" ); + Assert(!done()) << "Theory::get() called with assertion queue empty!"; // Get the assertion Assertion fact = d_facts[d_factsHead]; diff --git a/src/theory/theory_engine.cpp b/src/theory/theory_engine.cpp index 2782badcb..0adb592f2 100644 --- a/src/theory/theory_engine.cpp +++ b/src/theory/theory_engine.cpp @@ -998,11 +998,13 @@ void TheoryEngine::postsolve() { #ifdef CVC4_FOR_EACH_THEORY_STATEMENT #undef CVC4_FOR_EACH_THEORY_STATEMENT #endif -#define CVC4_FOR_EACH_THEORY_STATEMENT(THEORY) \ - if (theory::TheoryTraits<THEORY>::hasPostsolve) { \ - theoryOf(THEORY)->postsolve(); \ - Assert(! d_inConflict || wasInConflict, "conflict raised during postsolve()"); \ - } +#define CVC4_FOR_EACH_THEORY_STATEMENT(THEORY) \ + if (theory::TheoryTraits<THEORY>::hasPostsolve) \ + { \ + theoryOf(THEORY)->postsolve(); \ + Assert(!d_inConflict || wasInConflict) \ + << "conflict raised during postsolve()"; \ + } // Postsolve for each theory using the statement above CVC4_FOR_EACH_THEORY; @@ -1317,7 +1319,8 @@ void TheoryEngine::assertToTheory(TNode assertion, TNode originalAssertion, theo // If sending to the shared terms database, it's also simple if (toTheoryId == THEORY_BUILTIN) { - Assert(atom.getKind() == kind::EQUAL, "atom should be an EQUALity, not `%s'", atom.toString().c_str()); + Assert(atom.getKind() == kind::EQUAL) + << "atom should be an EQUALity, not `" << atom << "'"; if (markPropagation(assertion, originalAssertion, toTheoryId, fromTheoryId)) { d_sharedTerms.assertEquality(atom, polarity, assertion); } @@ -1561,7 +1564,7 @@ void TheoryEngine::getInstantiatedQuantifiedFormulas( std::vector< Node >& qs ) if( d_quantEngine ){ d_quantEngine->getInstantiatedQuantifiedFormulas( qs ); }else{ - Assert( false ); + Assert(false); } } @@ -1569,7 +1572,7 @@ void TheoryEngine::getInstantiations( Node q, std::vector< Node >& insts ) { if( d_quantEngine ){ d_quantEngine->getInstantiations( q, insts ); }else{ - Assert( false ); + Assert(false); } } @@ -1577,7 +1580,7 @@ void TheoryEngine::getInstantiationTermVectors( Node q, std::vector< std::vector if( d_quantEngine ){ d_quantEngine->getInstantiationTermVectors( q, tvecs ); }else{ - Assert( false ); + Assert(false); } } @@ -1585,7 +1588,7 @@ void TheoryEngine::getInstantiations( std::map< Node, std::vector< Node > >& ins if( d_quantEngine ){ d_quantEngine->getInstantiations( insts ); }else{ - Assert( false ); + Assert(false); } } @@ -1593,7 +1596,7 @@ void TheoryEngine::getInstantiationTermVectors( std::map< Node, std::vector< std if( d_quantEngine ){ d_quantEngine->getInstantiationTermVectors( insts ); }else{ - Assert( false ); + Assert(false); } } @@ -1601,7 +1604,7 @@ Node TheoryEngine::getInstantiatedConjunction( Node q ) { if( d_quantEngine ){ return d_quantEngine->getInstantiatedConjunction( q ); }else{ - Assert( false ); + Assert(false); return Node::null(); } } @@ -1792,8 +1795,9 @@ void TheoryEngine::ensureLemmaAtoms(const std::vector<TNode>& atoms, theory::The } continue; }else if( eqNormalized.getKind() != kind::EQUAL){ - Assert( eqNormalized.getKind()==kind::BOOLEAN_TERM_VARIABLE || - ( eqNormalized.getKind()==kind::NOT && eqNormalized[0].getKind()==kind::BOOLEAN_TERM_VARIABLE ) ); + Assert(eqNormalized.getKind() == kind::BOOLEAN_TERM_VARIABLE + || (eqNormalized.getKind() == kind::NOT + && eqNormalized[0].getKind() == kind::BOOLEAN_TERM_VARIABLE)); // this happens for Boolean term equalities V = true that are rewritten to V, we should skip // TODO : revisit this continue; @@ -2125,7 +2129,8 @@ void TheoryEngine::getExplanation(std::vector<NodeTheoryPair>& explanationVector } Debug("theory::explain") << "TheoryEngine::explain(): got explanation " << explanation << " got from " << toExplain.theory << endl; - Assert( explanation != toExplain.node, "wasn't sent to you, so why are you explaining it trivially"); + Assert(explanation != toExplain.node) + << "wasn't sent to you, so why are you explaining it trivially"; // Mark the explanation NodeTheoryPair newExplain(explanation, toExplain.theory, toExplain.timestamp); explanationVector.push_back(newExplain); @@ -2217,14 +2222,17 @@ void TheoryEngine::checkTheoryAssertionsWithModel(bool hardFailure) { ++it) { Node assertion = (*it).assertion; Node val = getModel()->getValue(assertion); - if(val != d_true) { - stringstream ss; - ss << theoryId << " has an asserted fact that the model doesn't satisfy." << endl - << "The fact: " << assertion << endl - << "Model value: " << val << endl; - if(hardFailure) { - InternalError(ss.str()); - } + if (val != d_true) + { + if (hardFailure) + { + InternalError() + << theoryId + << " has an asserted fact that the model doesn't satisfy." + << endl + << "The fact: " << assertion << endl + << "Model value: " << val << endl; + } } } } diff --git a/src/theory/theory_engine.h b/src/theory/theory_engine.h index e88d3323a..bf3e394f1 100644 --- a/src/theory/theory_engine.h +++ b/src/theory/theory_engine.h @@ -26,7 +26,7 @@ #include <vector> #include <utility> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "context/cdhashset.h" #include "expr/node.h" #include "options/options.h" diff --git a/src/theory/theory_model.cpp b/src/theory/theory_model.cpp index 0d82d3f02..da66a2ef2 100644 --- a/src/theory/theory_model.cpp +++ b/src/theory/theory_model.cpp @@ -369,12 +369,11 @@ void TheoryModel::addSubstitution( TNode x, TNode t, bool invalidateCache ){ Node oldX = d_substitutions.getSubstitution(x); // check that either the old substitution is the same, or it now maps to the new substitution if(oldX != t && d_substitutions.apply(oldX) != d_substitutions.apply(t)) { - stringstream ss; - ss << "Two incompatible substitutions added to TheoryModel:\n" - << "the term: " << x << "\n" - << "old mapping: " << d_substitutions.apply(oldX) << "\n" - << "new mapping: " << d_substitutions.apply(t); - InternalError(ss.str()); + InternalError() + << "Two incompatible substitutions added to TheoryModel:\n" + << "the term: " << x << "\n" + << "old mapping: " << d_substitutions.apply(oldX) << "\n" + << "new mapping: " << d_substitutions.apply(t); } #endif /* CVC4_ASSERTIONS */ } @@ -600,7 +599,7 @@ bool TheoryModel::areFunctionValuesEnabled() const } void TheoryModel::assignFunctionDefinition( Node f, Node f_def ) { - Assert( d_uf_models.find( f )==d_uf_models.end() ); + Assert(d_uf_models.find(f) == d_uf_models.end()); Trace("model-builder") << " Assigning function (" << f << ") to (" << f_def << ")" << endl; if( options::ufHo() ){ @@ -608,7 +607,7 @@ void TheoryModel::assignFunctionDefinition( Node f, Node f_def ) { f_def = Rewriter::rewrite( f_def ); Trace("model-builder-debug") << "Model value (post-rewrite) : " << f_def << std::endl; - Assert( f_def.isConst() ); + Assert(f_def.isConst()); } // d_uf_models only stores models for variables @@ -646,7 +645,7 @@ std::vector< Node > TheoryModel::getFunctionsToAssign() { // collect functions for( std::map< Node, std::vector< Node > >::iterator it = d_uf_terms.begin(); it != d_uf_terms.end(); ++it ){ Node n = it->first; - Assert( !n.isNull() ); + Assert(!n.isNull()); if( !hasAssignedFunctionDefinition( n ) ){ Trace("model-builder-fun-debug") << "Look at function : " << n << std::endl; if( options::ufHo() ){ diff --git a/src/theory/theory_model_builder.cpp b/src/theory/theory_model_builder.cpp index 7a2a9ae16..b1171f152 100644 --- a/src/theory/theory_model_builder.cpp +++ b/src/theory/theory_model_builder.cpp @@ -881,8 +881,8 @@ void TheoryEngineModelBuilder::debugCheckModel(TheoryModel* tm) << "getValue(n): " << tm->getValue(n) << endl << "rep: " << rep << endl; - Assert(tm->getValue(*eqc_i) == rep, - "run with -d check-model::rep-checking for details"); + Assert(tm->getValue(*eqc_i) == rep) + << "run with -d check-model::rep-checking for details"; } } } @@ -950,8 +950,7 @@ Node TheoryEngineModelBuilder::normalize(TheoryModel* m, TNode r, bool evalOnly) { retNode = Rewriter::rewrite(retNode); Assert(retNode.getKind() == kind::APPLY_UF - || !retNode.getType().isFirstClass() - || retNode.isConst()); + || !retNode.getType().isFirstClass() || retNode.isConst()); } } d_normalizedCache[r] = retNode; diff --git a/src/theory/theory_test_utils.h b/src/theory/theory_test_utils.h index ecda12dee..dbb42f2bc 100644 --- a/src/theory/theory_test_utils.h +++ b/src/theory/theory_test_utils.h @@ -24,7 +24,6 @@ #include <utility> #include <vector> -#include "base/cvc4_assert.h" #include "expr/node.h" #include "theory/interrupted.h" #include "theory/output_channel.h" diff --git a/src/theory/theory_traits_template.h b/src/theory/theory_traits_template.h index 564864f19..9bd67dba6 100644 --- a/src/theory/theory_traits_template.h +++ b/src/theory/theory_traits_template.h @@ -42,8 +42,7 @@ struct TheoryConstructor { ${theory_constructors} - default: - Unhandled(id); +default: Unhandled() << id; } } };/* struct CVC4::theory::TheoryConstructor */ diff --git a/src/theory/type_enumerator.h b/src/theory/type_enumerator.h index a92cfd2af..81c0c38c8 100644 --- a/src/theory/type_enumerator.h +++ b/src/theory/type_enumerator.h @@ -19,8 +19,8 @@ #ifndef CVC4__THEORY__TYPE_ENUMERATOR_H #define CVC4__THEORY__TYPE_ENUMERATOR_H +#include "base/check.h" #include "base/exception.h" -#include "base/cvc4_assert.h" #include "expr/node.h" #include "expr/type_node.h" @@ -129,7 +129,7 @@ class TypeEnumerator { if(d_te->isFinished()) { try { **d_te; - Assert(false, "expected an NoMoreValuesException to be thrown"); + Assert(false) << "expected an NoMoreValuesException to be thrown"; } catch(NoMoreValuesException&) { // ignore the exception, we're just asserting that it would be thrown // @@ -142,7 +142,7 @@ class TypeEnumerator { try { **d_te; } catch(NoMoreValuesException&) { - Assert(false, "didn't expect a NoMoreValuesException to be thrown"); + Assert(false) << "didn't expect a NoMoreValuesException to be thrown"; } } #endif /* CVC4_ASSERTIONS && !(APPLE || clang) */ @@ -157,7 +157,7 @@ class TypeEnumerator { try { Node n = **d_te; Assert(n.isConst()); - Assert(! isFinished()); + Assert(!isFinished()); return n; } catch(NoMoreValuesException&) { Assert(isFinished()); diff --git a/src/theory/type_enumerator_template.cpp b/src/theory/type_enumerator_template.cpp index 8ccf27302..26d83334d 100644 --- a/src/theory/type_enumerator_template.cpp +++ b/src/theory/type_enumerator_template.cpp @@ -16,7 +16,7 @@ #include <sstream> -#include "base/cvc4_assert.h" +#include "base/check.h" #include "expr/kind.h" #include "theory/type_enumerator.h" @@ -32,26 +32,18 @@ namespace theory { TypeEnumeratorInterface* TypeEnumerator::mkTypeEnumerator( TypeNode type, TypeEnumeratorProperties* tep) { - switch(type.getKind()) { - case kind::TYPE_CONSTANT: - switch(type.getConst<TypeConstant>()) { -${mk_type_enumerator_type_constant_cases} - default: + switch (type.getKind()) + { + case kind::TYPE_CONSTANT: + switch (type.getConst<TypeConstant>()) { - stringstream ss; - ss << "No type enumerator for type `" << type << "'"; - Unhandled(ss.str()); + ${mk_type_enumerator_type_constant_cases} + default: Unhandled() << "No type enumerator for type `" << type << "'"; } - } - Unreachable(); -${mk_type_enumerator_cases} -#line 49 "${template}" - default: - { - stringstream ss; - ss << "No type enumerator for type `" << type << "'"; - Unhandled(ss.str()); - } + Unreachable(); + ${mk_type_enumerator_cases} +#line 44 "${template}" + default: Unhandled() << "No type enumerator for type `" << type << "'"; } Unreachable(); } diff --git a/src/theory/uf/cardinality_extension.cpp b/src/theory/uf/cardinality_extension.cpp index 87696ef5f..bb1e434f2 100644 --- a/src/theory/uf/cardinality_extension.cpp +++ b/src/theory/uf/cardinality_extension.cpp @@ -65,8 +65,8 @@ void Region::addRep( Node n ) { } void Region::takeNode( Region* r, Node n ){ - Assert( !hasRep( n ) ); - Assert( r->hasRep( n ) ); + Assert(!hasRep(n)); + Assert(r->hasRep(n)); //add representative setRep( n, true ); //take disequalities from r @@ -130,7 +130,7 @@ void Region::combine( Region* r ){ /** setEqual */ void Region::setEqual( Node a, Node b ){ - Assert( hasRep( a ) && hasRep( b ) ); + Assert(hasRep(a) && hasRep(b)); //move disequalities of b over to a for( int t=0; t<2; t++ ){ DiseqList* del = d_nodes[b]->get(t); @@ -181,7 +181,7 @@ void Region::setDisequal( Node n1, Node n2, int type, bool valid ){ } void Region::setRep( Node n, bool valid ) { - Assert( hasRep( n )!=valid ); + Assert(hasRep(n) != valid); if( valid && d_nodes.find( n )==d_nodes.end() ){ d_nodes[n] = new RegionNodeInfo( d_cf->d_thss->getSatContext() ); } @@ -189,7 +189,7 @@ void Region::setRep( Node n, bool valid ) { d_reps_size = d_reps_size + ( valid ? 1 : -1 ); //removing a member of the test clique from this region if( d_testClique.find( n ) != d_testClique.end() && d_testClique[n] ){ - Assert( !valid ); + Assert(!valid); d_testClique[n] = false; d_testCliqueSize = d_testCliqueSize - 1; //remove all splits involving n @@ -326,7 +326,7 @@ bool Region::check( Theory::Effort level, int cardinality, } } } - Assert( maxNode!=Node::null() ); + Assert(maxNode != Node::null()); newClique.push_back( maxNode ); } //check splits internal to new members @@ -540,7 +540,7 @@ void SortModel::newEqClass( Node n ){ if( d_regions_index<d_regions.size() ){ d_regions[ d_regions_index ]->debugPrint("uf-ss-debug",true); d_regions[ d_regions_index ]->setValid(true); - Assert(d_regions[d_regions_index]->getNumReps()==0); + Assert(d_regions[d_regions_index]->getNumReps() == 0); }else{ d_regions.push_back( new Region( this, d_thss->getSatContext() ) ); } @@ -564,8 +564,8 @@ void SortModel::merge( Node a, Node b ){ Debug("uf-ss") << "CardinalityExtension: Merging " << a << " = " << b << "..." << std::endl; if( a!=b ){ - Assert( d_regions_map.find( a )!=d_regions_map.end() ); - Assert( d_regions_map.find( b )!=d_regions_map.end() ); + Assert(d_regions_map.find(a) != d_regions_map.end()); + Assert(d_regions_map.find(b) != d_regions_map.end()); int ai = d_regions_map[a]; int bi = d_regions_map[b]; Debug("uf-ss") << " regions: " << ai << " " << bi << std::endl; @@ -636,8 +636,8 @@ void SortModel::assertDisequal( Node a, Node b, Node reason ){ } d_disequalities_index = d_disequalities_index + 1; //now, add disequalities to regions - Assert( d_regions_map.find( a )!=d_regions_map.end() ); - Assert( d_regions_map.find( b )!=d_regions_map.end() ); + Assert(d_regions_map.find(a) != d_regions_map.end()); + Assert(d_regions_map.find(b) != d_regions_map.end()); Debug("uf-ss") << " regions: " << ai << " " << bi << std::endl; if( ai==bi ){ //internal disequality @@ -671,7 +671,7 @@ bool SortModel::areDisequal( Node a, Node b ) { /** check */ void SortModel::check( Theory::Effort level, OutputChannel* out ){ - Assert( options::ufssMode()==UF_SS_FULL ); + Assert(options::ufssMode() == UF_SS_FULL); if( level>=Theory::EFFORT_STANDARD && d_hasCard && !d_conflict ){ Debug("uf-ss") << "CardinalityExtension: Check " << level << " " << d_type << std::endl; @@ -809,7 +809,7 @@ void SortModel::getDisequalitiesToRegions(int ri, DiseqList* del = it->second->get(0); for( DiseqList::iterator it2 = del->begin(); it2 != del->end(); ++it2 ){ if( (*it2).second ){ - Assert( isValid( d_regions_map[ (*it2).first ] ) ); + Assert(isValid(d_regions_map[(*it2).first])); //Notice() << "Found disequality with " << (*it2).first << ", region = " << d_regions_map[ (*it2).first ] << std::endl; regions_diseq[ d_regions_map[ (*it2).first ] ]++; } @@ -836,7 +836,7 @@ void SortModel::assertCardinality( OutputChannel* out, int c, bool val ){ << "Assert cardinality " << d_type << " " << c << " " << val << " level = " << d_thss->getTheory()->getValuation().getAssertionLevel() << std::endl; - Assert( c>0 ); + Assert(c > 0); Node cl = getCardinalityLiteral( c ); if( val ){ bool doCheckRegions = !d_hasCard; @@ -883,7 +883,7 @@ void SortModel::assertCardinality( OutputChannel* out, int c, bool val ){ void SortModel::checkRegion( int ri, bool checkCombine ){ if( isValid(ri) && d_hasCard ){ - Assert( d_cardinality>0 ); + Assert(d_cardinality > 0); if( checkCombine && d_regions[ri]->getMustCombine( d_cardinality ) ){ ////alternatively, check if we can reduce the number of external disequalities by moving single nodes //for( std::map< Node, bool >::iterator it = d_regions[i]->d_reps.begin(); it != d_regions[i]->d_reps.end(); ++it ){ @@ -931,9 +931,9 @@ int SortModel::forceCombineRegion( int ri, bool useDensity ){ Debug("uf-ss-check-region") << it->first << " : " << it->second << std::endl; } for( std::map< int, int >::iterator it = regions_diseq.begin(); it != regions_diseq.end(); ++it ){ - Assert( it->first!=ri ); - Assert( isValid( it->first ) ); - Assert( d_regions[ it->first ]->getNumReps()>0 ); + Assert(it->first != ri); + Assert(isValid(it->first)); + Assert(d_regions[it->first]->getNumReps() > 0); double tempScore = double(it->second)/double(d_regions[it->first]->getNumReps() ); if( tempScore>maxScore ){ maxRegion = it->first; @@ -959,7 +959,7 @@ int SortModel::combineRegions( int ai, int bi ){ } #endif Debug("uf-ss-region") << "uf-ss: Combine Region #" << bi << " with Region #" << ai << std::endl; - Assert( isValid( ai ) && isValid( bi ) ); + Assert(isValid(ai) && isValid(bi)); Region* region_bi = d_regions[bi]; for(Region::iterator it = region_bi->begin(); it != region_bi->end(); ++it){ Region::RegionNodeInfo* rni = it->second; @@ -975,8 +975,8 @@ int SortModel::combineRegions( int ai, int bi ){ void SortModel::moveNode( Node n, int ri ){ Debug("uf-ss-region") << "uf-ss: Move node " << n << " to Region #" << ri << std::endl; - Assert( isValid( d_regions_map[ n ] ) ); - Assert( isValid( ri ) ); + Assert(isValid(d_regions_map[n])); + Assert(isValid(ri)); //move node to region ri d_regions[ri]->takeNode( d_regions[ d_regions_map[n] ], n ); d_regions_map[n] = ri; @@ -993,11 +993,11 @@ int SortModel::addSplit( Region* r, OutputChannel* out ){ break; } } - Assert( s!=Node::null() ); + Assert(s != Node::null()); } if (!s.isNull() ){ //add lemma to output channel - Assert( s.getKind()==EQUAL ); + Assert(s.getKind() == EQUAL); Node ss = Rewriter::rewrite( s ); if( ss.getKind()!=EQUAL ){ Node b_t = NodeManager::currentNM()->mkConst( true ); @@ -1042,8 +1042,8 @@ int SortModel::addSplit( Region* r, OutputChannel* out ){ void SortModel::addCliqueLemma( std::vector< Node >& clique, OutputChannel* out ){ - Assert( d_hasCard ); - Assert( d_cardinality>0 ); + Assert(d_hasCard); + Assert(d_cardinality > 0); while( clique.size()>size_t(d_cardinality+1) ){ clique.pop_back(); } @@ -1454,8 +1454,8 @@ void CardinalityExtension::assertNode(Node n, bool isDecision) if( options::ufssMode()==UF_SS_FULL ){ if( lit.getKind()==CARDINALITY_CONSTRAINT ){ TypeNode tn = lit[0].getType(); - Assert( tn.isSort() ); - Assert( d_rep_model[tn] ); + Assert(tn.isSort()); + Assert(d_rep_model[tn]); int nCard = lit[1].getConst<Rational>().getNumerator().getSignedInt(); Node ct = d_rep_model[tn]->getCardinalityTerm(); Trace("uf-ss-debug") << "...check cardinality terms : " << lit[0] << " " << ct << std::endl; @@ -1627,7 +1627,7 @@ void CardinalityExtension::check(Theory::Effort level) } }else{ // unhandled uf ss mode - Assert( false ); + Assert(false); } Trace("uf-ss-solver") << "Done CardinalityExtension: check " << level << std::endl; @@ -1776,7 +1776,7 @@ void CardinalityExtension::initializeCombinedCardinality() /** check */ void CardinalityExtension::checkCombinedCardinality() { - Assert( options::ufssMode()==UF_SS_FULL ); + Assert(options::ufssMode() == UF_SS_FULL); if( options::ufssFairness() ){ Trace("uf-ss-com-card-debug") << "Check combined cardinality, get maximum negative cardinalities..." << std::endl; int totalCombinedCard = 0; diff --git a/src/theory/uf/cardinality_extension.h b/src/theory/uf/cardinality_extension.h index 3e3d90be5..37d442968 100644 --- a/src/theory/uf/cardinality_extension.h +++ b/src/theory/uf/cardinality_extension.h @@ -76,7 +76,7 @@ class CardinalityExtension ~DiseqList(){} void setDisequal( Node n, bool valid ){ - Assert( (!isSet(n)) || getDisequalityValue(n) != valid ); + Assert((!isSet(n)) || getDisequalityValue(n) != valid); d_disequalities[ n ] = valid; d_size = d_size + ( valid ? 1 : -1 ); } diff --git a/src/theory/uf/equality_engine.cpp b/src/theory/uf/equality_engine.cpp index 32d32b479..8e0c96ae3 100644 --- a/src/theory/uf/equality_engine.cpp +++ b/src/theory/uf/equality_engine.cpp @@ -375,7 +375,7 @@ bool EqualityEngine::hasTerm(TNode t) const { } EqualityNodeId EqualityEngine::getNodeId(TNode node) const { - Assert(hasTerm(node), node.toString().c_str()); + Assert(hasTerm(node)) << node; return (*d_nodeIds.find(node)).second; } @@ -417,7 +417,7 @@ void EqualityEngine::assertEqualityInternal(TNode t1, TNode t2, TNode reason, un void EqualityEngine::assertPredicate(TNode t, bool polarity, TNode reason, unsigned pid) { Debug("equality") << d_name << "::eq::addPredicate(" << t << "," << (polarity ? "true" : "false") << ")" << std::endl; - Assert(t.getKind() != kind::EQUAL, "Use assertEquality instead"); + Assert(t.getKind() != kind::EQUAL) << "Use assertEquality instead"; assertEqualityInternal(t, polarity ? d_true : d_false, reason, pid); propagate(); } @@ -556,8 +556,9 @@ bool EqualityEngine::merge(EqualityNode& class1, EqualityNode& class2, std::vect // Check for constant merges bool class1isConstant = d_isConstant[class1Id]; bool class2isConstant = d_isConstant[class2Id]; - Assert(class1isConstant || !class2isConstant, "Should always merge into constants"); - Assert(!class1isConstant || !class2isConstant, "Don't merge constants"); + Assert(class1isConstant || !class2isConstant) + << "Should always merge into constants"; + Assert(!class1isConstant || !class2isConstant) << "Don't merge constants"; // Trigger set of class 1 TriggerTermSetRef class1triggerRef = d_nodeIndividualTrigger[class1Id]; @@ -884,7 +885,8 @@ void EqualityEngine::backtrack() { if (d_deducedDisequalities.size() > d_deducedDisequalitiesSize) { for(int i = d_deducedDisequalities.size() - 1, i_end = (int)d_deducedDisequalitiesSize; i >= i_end; -- i) { EqualityPair pair = d_deducedDisequalities[i]; - Assert(d_disequalityReasonsMap.find(pair) != d_disequalityReasonsMap.end()); + Assert(d_disequalityReasonsMap.find(pair) + != d_disequalityReasonsMap.end()); // Remove from the map d_disequalityReasonsMap.erase(pair); std::swap(pair.first, pair.second); @@ -934,7 +936,8 @@ void EqualityEngine::explainEquality(TNode t1, TNode t2, bool polarity, << ", proof = " << (eqp ? "ON" : "OFF") << std::endl; // The terms must be there already - Assert(hasTerm(t1) && hasTerm(t2));; + Assert(hasTerm(t1) && hasTerm(t2)); + ; // Get the ids EqualityNodeId t1Id = getNodeId(t1); @@ -952,7 +955,8 @@ void EqualityEngine::explainEquality(TNode t1, TNode t2, bool polarity, // Get the reason for this disequality EqualityPair pair(t1Id, t2Id); - Assert(d_disequalityReasonsMap.find(pair) != d_disequalityReasonsMap.end(), "Don't ask for stuff I didn't notify you about"); + Assert(d_disequalityReasonsMap.find(pair) != d_disequalityReasonsMap.end()) + << "Don't ask for stuff I didn't notify you about"; DisequalityReasonRef reasonRef = d_disequalityReasonsMap.find(pair)->second; for (unsigned i = reasonRef.mergesStart; i < reasonRef.mergesEnd; ++ i) { @@ -1219,7 +1223,8 @@ void EqualityEngine::getExplanation( eqpc->d_node = NodeManager::currentNM()->mkNode(kind::PARTIAL_SELECT_1, d_nodes[f1.b]); // The first child is a PARTIAL_SELECT_0. // Give it a child so that we know what kind of (read) it is, when we dump to LFSC. - Assert(eqpc->d_children[0]->d_node.getKind() == kind::PARTIAL_SELECT_0); + Assert(eqpc->d_children[0]->d_node.getKind() + == kind::PARTIAL_SELECT_0); Assert(eqpc->d_children[0]->d_children.size() == 0); eqpc->d_children[0]->d_node = NodeManager::currentNM()->mkNode(kind::PARTIAL_SELECT_0, @@ -1241,7 +1246,7 @@ void EqualityEngine::getExplanation( Debug("equality") << d_name << "::eq::getExplanation(): due to reflexivity, going deeper" << std::endl; EqualityNodeId eqId = currentNode == d_trueId ? edgeNode : currentNode; const FunctionApplication& eq = d_applications[eqId].original; - Assert(eq.isEquality(), "Must be an equality"); + Assert(eq.isEquality()) << "Must be an equality"; // Explain why a = b constant Debug("equality") << push; @@ -1416,8 +1421,10 @@ void EqualityEngine::addTriggerEquality(TNode eq) { } void EqualityEngine::addTriggerPredicate(TNode predicate) { - Assert(predicate.getKind() != kind::NOT && predicate.getKind() != kind::EQUAL); - Assert(d_congruenceKinds.tst(predicate.getKind()), "No point in adding non-congruence predicates"); + Assert(predicate.getKind() != kind::NOT + && predicate.getKind() != kind::EQUAL); + Assert(d_congruenceKinds.tst(predicate.getKind())) + << "No point in adding non-congruence predicates"; if (d_done) { return; @@ -1811,7 +1818,8 @@ size_t EqualityEngine::getSize(TNode t) { void EqualityEngine::addPathReconstructionTrigger(unsigned trigger, const PathReconstructionNotify* notify) { // Currently we can only inform one callback per trigger - Assert(d_pathReconstructionTriggers.find(trigger) == d_pathReconstructionTriggers.end()); + Assert(d_pathReconstructionTriggers.find(trigger) + == d_pathReconstructionTriggers.end()); d_pathReconstructionTriggers[trigger] = notify; } @@ -1993,7 +2001,7 @@ bool EqualityEngine::hasPropagatedDisequality(EqualityNodeId lhsId, EqualityNode bool propagated = d_propagatedDisequalities.find(eq) != d_propagatedDisequalities.end(); #ifdef CVC4_ASSERTIONS bool stored = d_disequalityReasonsMap.find(eq) != d_disequalityReasonsMap.end(); - Assert(propagated == stored, "These two should be in sync"); + Assert(propagated == stored) << "These two should be in sync"; #endif Debug("equality::disequality") << d_name << "::eq::hasPropagatedDisequality(" << d_nodes[lhsId] << ", " << d_nodes[rhsId] << ") => " << (propagated ? "true" : "false") << std::endl; return propagated; @@ -2005,11 +2013,13 @@ bool EqualityEngine::hasPropagatedDisequality(TheoryId tag, EqualityNodeId lhsId PropagatedDisequalitiesMap::const_iterator it = d_propagatedDisequalities.find(eq); if (it == d_propagatedDisequalities.end()) { - Assert(d_disequalityReasonsMap.find(eq) == d_disequalityReasonsMap.end(), "Why do we have a proof if not propagated"); + Assert(d_disequalityReasonsMap.find(eq) == d_disequalityReasonsMap.end()) + << "Why do we have a proof if not propagated"; Debug("equality::disequality") << d_name << "::eq::hasPropagatedDisequality(" << tag << ", " << d_nodes[lhsId] << ", " << d_nodes[rhsId] << ") => false" << std::endl; return false; } - Assert(d_disequalityReasonsMap.find(eq) != d_disequalityReasonsMap.end(), "We propagated but there is no proof"); + Assert(d_disequalityReasonsMap.find(eq) != d_disequalityReasonsMap.end()) + << "We propagated but there is no proof"; bool result = Theory::setContains(tag, (*it).second); Debug("equality::disequality") << d_name << "::eq::hasPropagatedDisequality(" << tag << ", " << d_nodes[lhsId] << ", " << d_nodes[rhsId] << ") => " << (result ? "true" : "false") << std::endl; return result; @@ -2017,9 +2027,9 @@ bool EqualityEngine::hasPropagatedDisequality(TheoryId tag, EqualityNodeId lhsId void EqualityEngine::storePropagatedDisequality(TheoryId tag, EqualityNodeId lhsId, EqualityNodeId rhsId) { - - Assert(!hasPropagatedDisequality(tag, lhsId, rhsId), "Check before you store it"); - Assert(lhsId != rhsId, "Wow, wtf!"); + Assert(!hasPropagatedDisequality(tag, lhsId, rhsId)) + << "Check before you store it"; + Assert(lhsId != rhsId) << "Wow, wtf!"; Debug("equality::disequality") << d_name << "::eq::storePropagatedDisequality(" << tag << ", " << d_nodes[lhsId] << ", " << d_nodes[rhsId] << ")" << std::endl; @@ -2040,12 +2050,15 @@ void EqualityEngine::storePropagatedDisequality(TheoryId tag, EqualityNodeId lhs // Store the proof if provided if (d_deducedDisequalityReasons.size() > d_deducedDisequalityReasonsSize) { Debug("equality::disequality") << d_name << "::eq::storePropagatedDisequality(" << tag << ", " << d_nodes[lhsId] << ", " << d_nodes[rhsId] << "): storing proof" << std::endl; - Assert(d_disequalityReasonsMap.find(pair1) == d_disequalityReasonsMap.end(), "There can't be a proof if you're adding a new one"); + Assert(d_disequalityReasonsMap.find(pair1) == d_disequalityReasonsMap.end()) + << "There can't be a proof if you're adding a new one"; DisequalityReasonRef ref(d_deducedDisequalityReasonsSize, d_deducedDisequalityReasons.size()); #ifdef CVC4_ASSERTIONS // Check that the reasons are valid for (unsigned i = ref.mergesStart; i < ref.mergesEnd; ++ i) { - Assert(getEqualityNode(d_deducedDisequalityReasons[i].first).getFind() == getEqualityNode(d_deducedDisequalityReasons[i].second).getFind()); + Assert( + getEqualityNode(d_deducedDisequalityReasons[i].first).getFind() + == getEqualityNode(d_deducedDisequalityReasons[i].second).getFind()); } #endif if (Debug.isOn("equality::disequality")) { @@ -2065,7 +2078,8 @@ void EqualityEngine::storePropagatedDisequality(TheoryId tag, EqualityNodeId lhs d_disequalityReasonsMap[pair1] = ref; d_disequalityReasonsMap[pair2] = ref; } else { - Assert(d_disequalityReasonsMap.find(pair1) != d_disequalityReasonsMap.end(), "You must provide a proof initially"); + Assert(d_disequalityReasonsMap.find(pair1) != d_disequalityReasonsMap.end()) + << "You must provide a proof initially"; } } @@ -2073,7 +2087,11 @@ void EqualityEngine::getDisequalities(bool allowConstants, EqualityNodeId classI // Must be empty on input Assert(out.size() == 0); // The class we are looking for, shouldn't have any of the tags we are looking for already set - Assert(d_nodeIndividualTrigger[classId] == null_set_id || Theory::setIntersection(getTriggerTermSet(d_nodeIndividualTrigger[classId]).tags, inputTags) == 0); + Assert(d_nodeIndividualTrigger[classId] == null_set_id + || Theory::setIntersection( + getTriggerTermSet(d_nodeIndividualTrigger[classId]).tags, + inputTags) + == 0); if (inputTags == 0) { return; @@ -2259,7 +2277,7 @@ EqClassIterator::EqClassIterator(Node eqc, const eq::EqualityEngine* ee) Assert(d_ee->consistent()); d_current = d_start = d_ee->getNodeId(eqc); Assert(d_start == d_ee->getEqualityNode(d_start).getFind()); - Assert (!d_ee->d_isInternal[d_start]); + Assert(!d_ee->d_isInternal[d_start]); } Node EqClassIterator::operator*() const { diff --git a/src/theory/uf/equality_engine_types.h b/src/theory/uf/equality_engine_types.h index 3813bb697..402b21a02 100644 --- a/src/theory/uf/equality_engine_types.h +++ b/src/theory/uf/equality_engine_types.h @@ -261,7 +261,7 @@ public: */ template<typename memory_class> void removeTopFromUseList(memory_class& memory) { - Assert ((int) d_useList == (int)memory.size() - 1); + Assert((int)d_useList == (int)memory.size() - 1); d_useList = memory.back().getNext(); memory.pop_back(); } diff --git a/src/theory/uf/symmetry_breaker.cpp b/src/theory/uf/symmetry_breaker.cpp index 9c1d4c2f1..56d0c59cc 100644 --- a/src/theory/uf/symmetry_breaker.cpp +++ b/src/theory/uf/symmetry_breaker.cpp @@ -86,8 +86,7 @@ bool SymmetryBreaker::Template::matchRecursive(TNode t, TNode n) { Debug("ufsymm:match") << "UFSYMM we have constants, failing match" << endl; return false; } - Assert(t.isVar() && - n.isVar()); + Assert(t.isVar() && n.isVar()); t = find(t); n = find(n); Debug("ufsymm:match") << "UFSYMM variable match " << t << " , " << n << endl; @@ -720,7 +719,8 @@ void SymmetryBreaker::selectTerms(const Permutation& p) { Debug("ufsymm:eq") << "UFSYMM -- yep" << endl; } } - Assert(j != teq.end(), "failed to find a difference between p and teq ?!"); + Assert(j != teq.end()) + << "failed to find a difference between p and teq ?!"; } } } else { diff --git a/src/theory/uf/theory_uf.cpp b/src/theory/uf/theory_uf.cpp index 76e6e08bc..95e3f702b 100644 --- a/src/theory/uf/theory_uf.cpp +++ b/src/theory/uf/theory_uf.cpp @@ -188,7 +188,7 @@ void TheoryUF::check(Effort level) { }/* TheoryUF::check() */ Node TheoryUF::getOperatorForApplyTerm( TNode node ) { - Assert( node.getKind()==kind::APPLY_UF || node.getKind()==kind::HO_APPLY ); + Assert(node.getKind() == kind::APPLY_UF || node.getKind() == kind::HO_APPLY); if( node.getKind()==kind::APPLY_UF ){ return node.getOperator(); }else{ @@ -197,7 +197,7 @@ Node TheoryUF::getOperatorForApplyTerm( TNode node ) { } unsigned TheoryUF::getArgumentStartIndexForApplyTerm( TNode node ) { - Assert( node.getKind()==kind::APPLY_UF || node.getKind()==kind::HO_APPLY ); + Assert(node.getKind() == kind::APPLY_UF || node.getKind() == kind::HO_APPLY); return node.getKind()==kind::APPLY_UF ? 0 : 1; } @@ -230,7 +230,7 @@ void TheoryUF::preRegisterTerm(TNode node) { // we always use APPLY_UF if not higher-order, HO_APPLY if higher-order //Assert( node.getKind()!=kind::APPLY_UF || !options::ufHo() ); - Assert( node.getKind()!=kind::HO_APPLY || options::ufHo() ); + Assert(node.getKind() != kind::HO_APPLY || options::ufHo()); switch (node.getKind()) { case kind::EQUAL: @@ -507,8 +507,8 @@ void TheoryUF::addSharedTerm(TNode t) { } bool TheoryUF::areCareDisequal(TNode x, TNode y){ - Assert( d_equalityEngine.hasTerm(x) ); - Assert( d_equalityEngine.hasTerm(y) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); if( d_equalityEngine.isTriggerTerm(x, THEORY_UF) && d_equalityEngine.isTriggerTerm(y, THEORY_UF) ){ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_UF); TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y, THEORY_UF); @@ -536,10 +536,10 @@ void TheoryUF::addCarePairs(TNodeTrie* t1, for (unsigned k = arg_start_index; k < f1.getNumChildren(); ++ k) { TNode x = f1[k]; TNode y = f2[k]; - Assert( d_equalityEngine.hasTerm(x) ); - Assert( d_equalityEngine.hasTerm(y) ); - Assert( !d_equalityEngine.areDisequal( x, y, false ) ); - Assert( !areCareDisequal( x, y ) ); + Assert(d_equalityEngine.hasTerm(x)); + Assert(d_equalityEngine.hasTerm(y)); + Assert(!d_equalityEngine.areDisequal(x, y, false)); + Assert(!areCareDisequal(x, y)); if( !d_equalityEngine.areEqual( x, y ) ){ if( d_equalityEngine.isTriggerTerm(x, THEORY_UF) && d_equalityEngine.isTriggerTerm(y, THEORY_UF) ){ TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x, THEORY_UF); diff --git a/src/theory/uf/theory_uf_model.cpp b/src/theory/uf/theory_uf_model.cpp index f279aebaf..ffe3730c4 100644 --- a/src/theory/uf/theory_uf_model.cpp +++ b/src/theory/uf/theory_uf_model.cpp @@ -91,7 +91,9 @@ Node UfModelTreeNode::getFunctionValue(std::vector<Node>& args, int index, Node stk.push(val); val = val[2]; } while(val.getKind() == ITE); - AlwaysAssert(val == defaultValue, "default values don't match when constructing function definition!"); + AlwaysAssert(val == defaultValue) + << "default values don't match when constructing function " + "definition!"; while(!stk.empty()) { val = stk.top(); stk.pop(); diff --git a/src/theory/uf/theory_uf_rewriter.h b/src/theory/uf/theory_uf_rewriter.h index bad4189d6..7f4c1c164 100644 --- a/src/theory/uf/theory_uf_rewriter.h +++ b/src/theory/uf/theory_uf_rewriter.h @@ -160,7 +160,7 @@ public: public: //conversion between HO_APPLY AND APPLY_UF // converts an APPLY_UF to a curried HO_APPLY e.g. (f a b) becomes (@ (@ f a) b) static Node getHoApplyForApplyUf(TNode n) { - Assert( n.getKind()==kind::APPLY_UF ); + Assert(n.getKind() == kind::APPLY_UF); Node curr = n.getOperator(); for( unsigned i=0; i<n.getNumChildren(); i++ ){ curr = NodeManager::currentNM()->mkNode( kind::HO_APPLY, curr, n[i] ); @@ -169,7 +169,7 @@ public: //conversion between HO_APPLY AND APPLY_UF } // converts a curried HO_APPLY into an APPLY_UF e.g. (@ (@ f a) b) becomes (f a b) static Node getApplyUfForHoApply(TNode n) { - Assert( n.getType().getNumChildren()==2 ); + Assert(n.getType().getNumChildren() == 2); std::vector< TNode > children; TNode curr = decomposeHoApply( n, children, true ); // if operator is standard diff --git a/src/theory/uf/theory_uf_type_rules.h b/src/theory/uf/theory_uf_type_rules.h index cb373b535..f782cd618 100644 --- a/src/theory/uf/theory_uf_type_rules.h +++ b/src/theory/uf/theory_uf_type_rules.h @@ -145,13 +145,13 @@ class HoApplyTypeRule { // the typing rule for HO_APPLY terms inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { - Assert( n.getKind()==kind::HO_APPLY ); + Assert(n.getKind() == kind::HO_APPLY); TypeNode fType = n[0].getType(check); if (!fType.isFunction()) { throw TypeCheckingExceptionPrivate( n, "first argument does not have function type"); } - Assert( fType.getNumChildren()>=2 ); + Assert(fType.getNumChildren() >= 2); if (check) { TypeNode aType = n[1].getType(check); if( !aType.isSubtypeOf( fType[0] ) ){ |