#include <theory_arith.h>
Inheritance diagram for CVCL::TheoryArith:
Author: Clark Barrett
Created: Sat Feb 8 14:44:32 2003
Definition at line 84 of file theory_arith.h.
|
|
Definition at line 1667 of file theory_arith.cpp. References CVCL::ExprMap< Data >::begin(), d_inequalitiesLeftDB, d_inequalitiesRightDB, d_rules, and CVCL::ExprMap< Data >::end(). |
|
Check the term t for integrality.
Definition at line 75 of file theory_arith.cpp. References CVCL::Expr::getType(), CVCL::IS_INTEGER, isIntegerDerive(), CVCL::isReal(), and CVCL::Theory::typePred(). Referenced by isInteger(), normalizeProjectIneqs(), processFiniteInterval(), processSimpleIntEq(), and projectInequalities(). |
|
A helper method for isIntegerThm(). Check if IS_INTEGER(e) is easily derivable from the given 'thm' Definition at line 83 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Theory::getCommonRules(), CVCL::Theorem::getExpr(), CVCL::Expr::isAnd(), and CVCL::Theorem::isNull(). Referenced by isIntegerThm(), and rewrite(). |
|
Check the term t for integrality (return bool).
Definition at line 193 of file theory_arith.h. References isIntegerThm(), and CVCL::Theorem::isNull(). Referenced by assignVariables(), computeType(), doSolve(), pickIntEqMonomial(), processFiniteInterval(), processFiniteIntervals(), processRealEq(), and solve(). |
|
Extract the free constant from an inequality.
Definition at line 100 of file theory_arith.cpp. References CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::isIneq(), CVCL::PLUS, CVCL::RATIONAL_EXPR, and CVCL::Expr::toString(). Referenced by isStale(). |
|
Update the free constant subsumption database with new inequality.
Definition at line 118 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Expr::begin(), d_freeConstDB, CVCL::CDMap< Key, Data, HashFcn >::end(), CVCL::Expr::end(), CVCL::CDMap< Key, Data, HashFcn >::find(), CVCL::CDOmap< Key, Data, HashFcn >::get(), CVCL::TheoryArith::FreeConst::getConst(), CVCL::Expr::getRational(), CVCL::int2string(), CVCL::isLE(), CVCL::isLT(), CVCL::isPlus(), CVCL::isRational(), CVCL::leExpr(), CVCL::plusExpr(), rat(), CVCL::TheoryArith::FreeConst::strict(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by projectInequalities(). |
|
Check if the kids of e are fully simplified and canonized (for debugging).
Definition at line 187 of file theory_arith.cpp. References CVCL::Expr::arity(), canon(), CVCL::debugger, std::endl(), CVCL::Debug::getOS(), IF_DEBUG(), and CVCL::Theory::isLeaf(). Referenced by canon(), and canonSimplify(). |
|
Canonize the expression e, assuming all children are canonical.
Definition at line 219 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::ArithProofRules::canonDivide(), CVCL::ArithProofRules::canonMult(), CVCL::ArithProofRules::canonPlus(), CVCL::ArithProofRules::canonPowConst(), d_rules, CVCL::DIVIDE, CVCL::Expr::getKind(), CVCL::Theorem::getLHS(), CVCL::Theorem::getRHS(), CVCL::Expr::isRational(), kidsCanonical(), CVCL::MINUS, CVCL::ArithProofRules::minusToPlus(), CVCL::MULT, CVCL::PLUS, CVCL::POW, CVCL::Theory::reflexivityRule(), CVCL::Theory::substitutivityRule(), CVCL::Expr::toString(), CVCL::TRACE, CVCL::Theory::transitivityRule(), CVCL::UMINUS, and CVCL::ArithProofRules::uMinusToMult(). Referenced by canon(), canonRec(), canonSimplify(), isolateVariable(), kidsCanonical(), processFiniteInterval(), rewrite(), and substAndCanonize(). |
|
Canonize the expression e recursively.
Definition at line 367 of file theory_arith.cpp. References canon(), CVCL::Theorem::getLHS(), CVCL::Theorem::getRHS(), CVCL::Theory::isLeaf(), CVCL::Theory::reflexivityRule(), and CVCL::Theory::substitutivityRule(). Referenced by rewriteToDiff(). |
|
Composition of canon(const Expr&) by transitivity: take e0 = e1, canonize e1 to e2, return e0 = e2.
Definition at line 212 of file theory_arith.h. References canon(), CVCL::Theorem::getRHS(), and CVCL::Theory::transitivityRule(). |
|
Canonize and reduce e w.r.t. union-find database; assume all children are canonical.
Definition at line 391 of file theory_arith.cpp. References canon(), CVCL::Theory::find(), CVCL::Theorem::getRHS(), CVCL::Expr::hasFind(), kidsCanonical(), CVCL::Theory::simplifyExpr(), CVCL::Expr::toString(), CVCL::TRACE, and CVCL::Theory::transitivityRule(). Referenced by canonPred(), canonPredEquiv(), and canonSimplify(). |
|
Composition of canonSimplify(const Expr&) by transitivity: take e0 = e1, canonize and simplify e1 to e2, return e0 = e2.
Definition at line 221 of file theory_arith.h. References canonSimplify(), CVCL::Theorem::getRHS(), and CVCL::Theory::transitivityRule(). |
|
Canonize predicate (x = y, x < y, etc.). accepts a theorem, canonizes it, applies iffMP and substituvity to derive the canonized thm Definition at line 420 of file theory_arith.cpp. References CVCL::Expr::arity(), canonSimplify(), CVCL::Theorem::getExpr(), CVCL::Expr::getOp(), CVCL::Theory::iffMP(), CVCL::Theory::substitutivityRule(), and CVCL::Theorem::toString(). Referenced by addToBuffer(), doSolve(), isolateVariable(), normalizeProjectIneqs(), processFiniteInterval(), processRealEq(), processSimpleIntEq(), and projectInequalities(). |
|
Canonize predicate like canonPred except that the input theorem is an equivalent transformation. Definition at line 434 of file theory_arith.cpp. References CVCL::Expr::arity(), canonSimplify(), CVCL::Expr::getOp(), CVCL::Theorem::getRHS(), CVCL::Theory::substitutivityRule(), CVCL::Theorem::toString(), and CVCL::Theory::transitivityRule(). Referenced by normalize(), and rewrite(). |
|
Solve an equation and return an equivalent Theorem in the solved form. Psuedo-code for doSolve. (Input is an equation) (output is a Theorem)
Definition at line 462 of file theory_arith.cpp. References canonPred(), CVCL::ArithProofRules::constPredicate(), CVCL::Debug::counter(), d_rules, CVCL::debugger, CVCL::Theorem::getExpr(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), IF_DEBUG(), CVCL::Theory::iffMP(), isInteger(), CVCL::Expr::isRational(), CVCL::Theorem::isRewrite(), normalize(), processIntEq(), processRealEq(), CVCL::ArithProofRules::rightMinusLeft(), CVCL::Theory::setIncomplete(), CVCL::Theory::symmetryRule(), CVCL::Theorem::toString(), and CVCL::TRACE. Referenced by solve(). |
|
takes in a conjunction equivalence Thm and canonizes it. accepts an equivalence theorem whose RHS is a conjunction, canonizes it, applies iffMP and substituvity to derive the canonized thm Definition at line 449 of file theory_arith.cpp. |
|
picks the monomial with the smallest abs(coeff) from the input pick a monomial for the input equation. This function is used only if the equation is an integer equation. Choose the monomial with the smallest absolute value of coefficient. Definition at line 519 of file theory_arith.cpp. References CVCL::abs(), CVCL::Expr::arity(), CVCL::Expr::begin(), CVCL::Expr::end(), isInteger(), CVCL::isMult(), CVCL::isPlus(), CVCL::isRational(), and CVCL::Expr::toString(). Referenced by processSimpleIntEq(). |
|
processes equalities with 1 or more vars of type REAL input is e1=e2<==>0=e' Theorem and some of the vars in e' are of type REAL. isolate one of them and send back to framework. output is "e1=e2 <==> var = e''" Theorem. Definition at line 551 of file theory_arith.cpp. References CVCL::Expr::arity(), canonPred(), d_rules, CVCL::EQ, CVCL::Theory::getBaseType(), CVCL::Theorem::getLHS(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), CVCL::Theory::iffMP(), isInteger(), CVCL::Theory::isLeaf(), CVCL::Theory::isLeafIn(), CVCL::isMult(), CVCL::isPlus(), CVCL::isRational(), CVCL::isReal(), CVCL::ArithProofRules::multEqn(), CVCL::ArithProofRules::plusPredicate(), rat(), CVCL::Expr::toString(), CVCL::Theorem::toString(), and CVCL::TRACE. Referenced by doSolve(). |
|
processes equalities whose vars are all of type INT input is e1=e2<==>0=e' Theorem and all of the vars in e' are of type INT. isolate one of them and send back to framework. output is "e1=e2 <==> var = e''" Theorem and some associated equations in solved form. Definition at line 773 of file theory_arith.cpp. References CVCL::CommonProofRules::andElim(), CVCL::Expr::arity(), CVCL::Theory::getCommonRules(), CVCL::Theorem::getExpr(), CVCL::Expr::isAnd(), CVCL::Expr::isFalse(), CVCL::Theorem::isRewrite(), processSimpleIntEq(), solvedForm(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by doSolve(). |
|
|
Process inequalities in the buffer.
Definition at line 936 of file theory_arith.cpp. References d_buffer, d_bufferIdx, CVCL::Theorem::getExpr(), CVCL::Theory::inconsistent(), isolateVariable(), CVCL::isPlus(), isStale(), CVCL::Expr::isTrue(), projectInequalities(), CVCL::Theory::setInconsistent(), CVCL::CDList< T >::size(), and CVCL::Expr::toString(). Referenced by assertFact(), and checkSat(). |
|
Take an inequality and isolate a variable.
Definition at line 1006 of file theory_arith.cpp. References canon(), canonPred(), computeNormalFactor(), CVCL::ArithProofRules::constPredicate(), d_rules, CVCL::Theorem::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), CVCL::Theory::iffMP(), CVCL::isLE(), CVCL::isLT(), CVCL::isMult(), CVCL::isPlus(), CVCL::Expr::isRational(), CVCL::isRational(), CVCL::ArithProofRules::multIneqn(), pickMonomial(), CVCL::ArithProofRules::plusPredicate(), rat(), CVCL::Theorem::toString(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by processBuffer(). |
|
Update the statistics counters for the variable with a coeff. c.
Definition at line 961 of file theory_arith.cpp. References CVCL::CDMap< Key, Data, HashFcn >::count(), d_countLeft, d_countRight, CVCL::Rational::toString(), and CVCL::TRACE. Referenced by addToBuffer(), and updateStats(). |
|
Update the statistics counters for the monomial.
Definition at line 974 of file theory_arith.cpp. References CVCL::Expr::getRational(), separateMonomial(), and updateStats(). |
|
Add an inequality to the input buffer. See also d_buffer.
Definition at line 982 of file theory_arith.cpp. References CVCL::Expr::begin(), canonPred(), d_buffer, d_rules, CVCL::Expr::end(), CVCL::Theorem::getExpr(), CVCL::Expr::getRational(), CVCL::Theory::iffMP(), CVCL::isPlus(), CVCL::Expr::isRational(), CVCL::CDList< T >::push_back(), CVCL::ArithProofRules::rightMinusLeft(), CVCL::TRACE, and updateStats(). Referenced by assertFact(), and projectInequalities(). |
|
Given a canonized term, compute a factor to make all coefficients integer and relatively prime.
Definition at line 1076 of file theory_arith.cpp. References CVCL::abs(), CVCL::Expr::arity(), CVCL::gcd(), CVCL::Rational::getDenominator(), CVCL::Expr::getKind(), CVCL::Rational::getNumerator(), CVCL::Expr::getRational(), CVCL::isMult(), CVCL::isPlus(), CVCL::lcm(), CVCL::MULT, rat(), and CVCL::RATIONAL_EXPR. Referenced by isolateVariable(), and normalize(). |
|
Normalize an equation (make all coefficients rel. prime integers). accepts a rewrite theorem over eqn|ineqn and normalizes it and returns a theorem to that effect. assumes e is non-trivial i.e. e is not '0=const' or 'const=0' or '0 <= const' etc. Definition at line 2102 of file theory_arith.cpp. References canonPredEquiv(), computeNormalFactor(), d_rules, CVCL::EQ, CVCL::GE, CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::GT, CVCL::Expr::isEq(), CVCL::isIneq(), CVCL::isRational(), CVCL::Expr::isRational(), CVCL::LE, CVCL::LT, CVCL::ArithProofRules::multEqn(), CVCL::ArithProofRules::multIneqn(), CVCL::Theory::reflexivityRule(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by doSolve(), normalize(), and rewrite(). |
|
Normalize an equation (make all coefficients rel. prime integers). accepts a rewrite theorem over eqn|ineqn and normalizes it and returns a theorem to that effect. Definition at line 2163 of file theory_arith.cpp. References CVCL::Theorem::getRHS(), normalize(), and CVCL::Theory::transitivityRule(). |
|
Definition at line 1424 of file theory_arith.cpp. References CVCL::TheoryArith::VarOrderGraph::addEdge(), CVCL::Expr::begin(), CVCL::CDMap< Key, Data, HashFcn >::count(), d_countLeft, d_countRight, d_graph, CVCL::Expr::end(), CVCL::TheoryCore::getFlags(), CVCL::int2string(), CVCL::isPlus(), lessThanVar(), CVCL::TheoryArith::VarOrderGraph::selectLargest(), separateMonomial(), CVCL::Theory::theoryCore(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by isolateVariable(). |
|
Separate monomial e = c*p1*...*pn into c and 1*p1*...*pn.
Definition at line 1176 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Expr::getKids(), CVCL::isMult(), CVCL::isPlus(), CVCL::isRational(), CVCL::Expr::isRational(), CVCL::multExpr(), rat(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by findRationalBound(), CVCL::ArithTheoremProducer::grayShadowConst(), CVCL::ArithTheoremProducer::intVarEqnConst(), lessThanVar(), normalizeProjectIneqs(), pickMonomial(), processSimpleIntEq(), projectInequalities(), and updateStats(). |
|
Definition at line 1118 of file theory_arith.cpp. References CVCL::isRational(), separateMonomial(), and CVCL::Expr::toString(). Referenced by pickMonomial(). |
|
Check if the term expression is "stale". "Stale" means it contains non-simplified subexpressions. For terms, it checks the expression's find pointer; for formulas it checks the children recursively (no caching!). So, apply it with caution, and only to simple atomic formulas (like inequality). Definition at line 1134 of file theory_arith.cpp. References CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Theory::find(), CVCL::Theorem::getRHS(), and CVCL::Expr::isTerm(). Referenced by isStale(), processBuffer(), and projectInequalities(). |
|
Check if the inequality is "stale" or subsumed.
Definition at line 1146 of file theory_arith.cpp. References freeConstIneq(), CVCL::TheoryArith::FreeConst::getConst(), CVCL::TheoryArith::Ineq::getConst(), CVCL::Theorem::getExpr(), CVCL::TheoryArith::Ineq::ineq(), CVCL::isLT(), isStale(), CVCL::TheoryArith::FreeConst::strict(), CVCL::TRACE, and CVCL::TheoryArith::Ineq::varOnRHS(). |
|
Definition at line 1202 of file theory_arith.cpp. References addToBuffer(), canonPred(), CVCL::Debug::counter(), d_inequalitiesLeftDB, d_inequalitiesRightDB, d_rules, CVCL::debugger, CVCL::ExprMap< Data >::end(), CVCL::Theory::enqueueFact(), CVCL::ExprMap< Data >::find(), CVCL::TheoryCore::getCM(), CVCL::ContextManager::getCurrentContext(), CVCL::Theorem::getExpr(), IF_DEBUG(), CVCL::Theory::iffMP(), CVCL::TheoryArith::Ineq::ineq(), CVCL::Expr::isEq(), CVCL::Expr::isFalse(), CVCL::isInt(), isIntegerThm(), CVCL::isLE(), CVCL::isLT(), CVCL::isMult(), CVCL::Theorem::isNull(), isStale(), CVCL::Expr::isTrue(), CVCL::ArithProofRules::lessThanToLE(), normalizeProjectIneqs(), CVCL::CDList< T >::push_back(), separateMonomial(), CVCL::Theory::setIncomplete(), CVCL::Theory::setInconsistent(), setupRec(), CVCL::CDList< T >::size(), CVCL::Theory::theoryCore(), CVCL::Theorem::toString(), CVCL::TRACE, and updateSubsumptionDB(). Referenced by processBuffer(). |
|
Definition at line 2031 of file theory_arith.cpp. References CVCL::Theory::assignValue(), CVCL::ceil(), d_graph, findBounds(), CVCL::Theory::findExpr(), CVCL::Theory::inconsistent(), CVCL::Rational::isInteger(), isInteger(), CVCL::Expr::isRational(), rat(), CVCL::TheoryArith::VarOrderGraph::selectSmallest(), and CVCL::TRACE. Referenced by computeModelBasic(). |
|
Definition at line 1962 of file theory_arith.cpp. References CVCL::Theory::findExpr(), CVCL::Expr::getRational(), CVCL::isRational(), separateMonomial(), and CVCL::Expr::toString(). Referenced by findBounds(). |
|
Definition at line 1980 of file theory_arith.cpp. References CVCL::ExprMap< Data >::count(), d_inequalitiesLeftDB, d_inequalitiesRightDB, findRationalBound(), CVCL::isLT(), CVCL::CDList< T >::size(), CVCL::ExprMap< Data >::size(), CVCL::Rational::toString(), and CVCL::TRACE. Referenced by assignVariables(). |
|
Definition at line 1303 of file theory_arith.cpp. References CVCL::Theory::addSplitter(), CVCL::Expr::arity(), b, canonPred(), CVCL::ArithProofRules::constPredicate(), CVCL::Debug::counter(), d_rules, CVCL::DARK_SHADOW, CVCL::ArithProofRules::darkGrayShadow2ab(), CVCL::ArithProofRules::darkGrayShadow2ba(), CVCL::debugger, CVCL::Theory::enqueueFact(), CVCL::Theorem::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::GRAY_SHADOW, IF_DEBUG(), CVCL::Theory::iffMP(), CVCL::Expr::isAnd(), CVCL::isInt(), isIntegerThm(), CVCL::isLE(), CVCL::isLT(), CVCL::isMult(), CVCL::Theorem::isNull(), CVCL::Expr::isOr(), CVCL::isPlus(), CVCL::Expr::isRational(), CVCL::ArithProofRules::multIneqn(), processFiniteInterval(), rat(), CVCL::ArithProofRules::realShadow(), CVCL::ArithProofRules::realShadowEq(), CVCL::ArithProofRules::rightMinusLeft(), separateMonomial(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by projectInequalities(). |
|
Take a system of equations and turn it into a solved form.
Referenced by processIntEq(). |
|
Substitute all vars in term 't' according to the substitution 'subst' and canonize the result. ASSUMPTION: 't' is a fully canonized arithmetic term, and every element of subst is a fully canonized equation of the form x=e, indexed by the LHS variable. Definition at line 864 of file theory_arith.cpp. References CVCL::Expr::arity(), canon(), CVCL::ExprMap< Data >::empty(), CVCL::ExprMap< Data >::end(), CVCL::ExprMap< Data >::find(), CVCL::Theorem::getRHS(), CVCL::Theory::isLeaf(), CVCL::Theory::reflexivityRule(), CVCL::Theory::substitutivityRule(), and CVCL::TRACE. Referenced by substAndCanonize(). |
|
Substitute all vars in the RHS of the equation 'eq' of the form (x = t) according to the substitution 'subst', and canonize the result. ASSUMPTION: 't' is a fully canonized equation of the form x = t, and so is every element of subst, indexed by the LHS variable. Definition at line 915 of file theory_arith.cpp. References CVCL::ExprMap< Data >::empty(), CVCL::Theorem::getExpr(), CVCL::Theorem::getRHS(), CVCL::Theory::iffMP(), CVCL::Theorem::isRewrite(), substAndCanonize(), CVCL::Theory::substitutivityRule(), and CVCL::Expr::toString(). |
|
Traverse 'e' and push all the i-leaves into 'vars' vector.
|
|
Check if alpha <= ax & bx <= beta is a finite interval for integer var 'x', and assert the corresponding constraint.
Definition at line 1691 of file theory_arith.cpp. References b, canon(), canonPred(), d_rules, CVCL::Theory::enqueueFact(), CVCL::ArithProofRules::finiteInterval(), CVCL::Theorem::getExpr(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), CVCL::Theory::iffMP(), isInteger(), isIntegerThm(), CVCL::isLE(), CVCL::isMult(), CVCL::isPlus(), CVCL::Expr::isRational(), CVCL::isRational(), CVCL::ArithProofRules::multIneqn(), rat(), CVCL::Theory::substitutivityRule(), CVCL::Theory::symmetryRule(), and CVCL::Expr::toString(). Referenced by normalizeProjectIneqs(), and processFiniteIntervals(). |
|
For an integer var 'x', find and process all constraints A <= ax <= A+c.
Definition at line 1749 of file theory_arith.cpp. References d_inequalitiesLeftDB, d_inequalitiesRightDB, CVCL::ExprMap< Data >::end(), CVCL::ExprMap< Data >::find(), isInteger(), processFiniteInterval(), and CVCL::CDList< T >::size(). |
|
Recursive setup for isolated inequalities (and other new expressions). This function recursively decends expression tree without caching until it hits a node that is already setup. Be careful on what expressions you are calling it. Definition at line 1775 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Expr::hasFind(), CVCL::Theory::reflexivityRule(), CVCL::Expr::setFind(), and setup(). Referenced by projectInequalities(). |
|
Return whether e is syntactically identical to a rational constant.
Definition at line 2681 of file theory_arith.cpp. References CVCL::Expr::getRational(), CVCL::isDivide(), CVCL::Expr::isRational(), and CVCL::isUMinus(). Referenced by print(), printMinus(), and printPlus(). |
|
Print a rational in SMT-LIB format.
Definition at line 2709 of file theory_arith.cpp. References d_convertToDiff, d_intConstUsed, d_langUsed, d_realUsed, CVCL::Rational::getDenominator(), CVCL::Rational::getNumerator(), CVCL::Expr::isEq(), CVCL::isIneq(), CVCL::Rational::isInteger(), CVCL::isMinus(), CVCL::Expr::isNull(), CVCL::isPlus(), CVCL::LINEAR, CVCL::NONLINEAR, CVCL::NOT_USED, printMinus(), printPlus(), CVCL::push(), CVCL::space(), CVCL::TERMS_ONLY, and CVCL::Rational::toString(). Referenced by print(). |
|
Return whether e is syntactically identical to unary minus of a var.
Definition at line 2763 of file theory_arith.cpp. References CVCL::Expr::getRational(), CVCL::Theory::isLeaf(), CVCL::isMult(), CVCL::isRational(), CVCL::Expr::isRational(), and CVCL::isUMinus(). Referenced by printPlus(). |
|
Print a PLUS expression in SMT-LIB format.
Definition at line 2794 of file theory_arith.cpp. References CVCL::Expr::arity(), d_langUsed, CVCL::DIFF_ONLY, CVCL::Expr::isEq(), CVCL::isIneq(), CVCL::Theory::isLeaf(), CVCL::Expr::isNull(), isSyntacticRational(), isSyntacticUMinusVar(), CVCL::LINEAR, CVCL::NOT_USED, CVCL::push(), CVCL::space(), and CVCL::TERMS_ONLY. Referenced by print(), and printRational(). |
|
Print a MINUS expression in SMT-LIB format.
Definition at line 2841 of file theory_arith.cpp. References d_langUsed, CVCL::DIFF_ONLY, CVCL::Expr::isEq(), CVCL::isIneq(), CVCL::Theory::isLeaf(), CVCL::Expr::isNull(), isSyntacticRational(), CVCL::LINEAR, CVCL::NOT_USED, CVCL::push(), CVCL::space(), and CVCL::TERMS_ONLY. Referenced by print(), and printRational(). |
|
Print left hand side of an arithmetic atom, converting to DIFF logic if possible.
Definition at line 2863 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::CONSTDEF, d_convertToDiff, d_zeroVar, CVCL::DARK_SHADOW, CVCL::DIVIDE, CVCL::Expr::getKind(), CVCL::GRAY_SHADOW, CVCL::IS_INTEGER, CVCL::MINUS, CVCL::MULT, CVCL::PLUS, CVCL::POW, CVCL::push(), CVCL::RATIONAL_EXPR, CVCL::space(), CVCL::SUBRANGE, and CVCL::UMINUS. Referenced by print(). |
|
Whether any ite's appear in the arithmetic part of the term e.
Definition at line 2966 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::DIVIDE, CVCL::Expr::getKind(), CVCL::INTDIV, CVCL::ITE, CVCL::MINUS, CVCL::MOD, CVCL::MULT, CVCL::PLUS, CVCL::POW, CVCL::RATIONAL_EXPR, and CVCL::UMINUS. Referenced by isAtomicArithFormula(). |
|
Return whether Reals are used.
Definition at line 326 of file theory_arith.h. References d_realUsed. |
|
Return whether Ints are used.
Definition at line 328 of file theory_arith.h. References d_intConstUsed, d_intUsed, and d_realUsed. |
|
Return which subset of arithmetic is used.
Definition at line 330 of file theory_arith.h. References d_langUsed. |
|
Theory is used if any component is used.
Reimplemented from CVCL::Theory. Definition at line 332 of file theory_arith.h. References d_intConstUsed, d_intUsed, d_langUsed, d_realUsed, and CVCL::NOT_USED. |
|
Rewrite an atom to look like x - y op c if possible--for smtlib translation.
Definition at line 2895 of file theory_arith.cpp. References canonRec(), d_convertToDiff, d_zeroVar, CVCL::EQ, CVCL::Theory::falseExpr(), CVCL::GE, CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), CVCL::GT, CVCL::Expr::isRational(), CVCL::isRational(), CVCL::LE, CVCL::LT, CVCL::MULT, CVCL::PLUS, rat(), CVCL::RATIONAL_EXPR, and CVCL::Theory::trueExpr(). Referenced by CVCL::Translator::preprocessRec(). |
|
Whether any ite's appear in the arithmetic part of the formula e.
Definition at line 2994 of file theory_arith.cpp. References CVCL::EQ, CVCL::GE, CVCL::Expr::getKind(), CVCL::GT, isAtomicArithTerm(), CVCL::LE, and CVCL::LT. Referenced by CVCL::Translator::preprocessRec(), and print(). |
|
Definition at line 50 of file arith_theorem_producer.cpp. References CVCL::Theory::theoryCore(). Referenced by TheoryArith(). |
|
Keep track of all finitely bounded integer variables in shared terms. When a new shared term t is reported, all of its variables x1...xn are added to the set d_sharedVars. For each newly added variable x, check all of its opposing inequalities, find out all the finite bounds and assert the corresponding GRAY_SHADOW constraints. When projecting integer inequalities, the database d_sharedVars is consulted, and if the variable is in it, check the shadows for being a finite interval, and produce the additional GRAY_SHADOW constraints. Reimplemented from CVCL::Theory. Definition at line 1804 of file theory_arith.cpp. References d_sharedTerms. |
|
Assert a new fact to the decision procedure. Each fact that makes it into the core framework is assigned to exactly one theory: the theory associated with that fact. assertFact is called to inform the theory that a new fact has been assigned to the theory. Implements CVCL::Theory. Definition at line 1821 of file theory_arith.cpp. References CVCL::Theory::addSplitter(), addToBuffer(), CVCL::Expr::arity(), CVCL::Debug::counter(), d_buffer, d_bufferIdx, d_bufferThres, d_diseq, d_inModelCreation, d_rules, CVCL::debugger, CVCL::Theory::enqueueFact(), CVCL::ArithProofRules::expandDarkShadow(), CVCL::ArithProofRules::expandGrayShadow(), CVCL::ArithProofRules::expandGrayShadow0(), CVCL::Theorem::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::GRAY_SHADOW, CVCL::ArithProofRules::grayShadowConst(), IF_DEBUG(), CVCL::int2string(), CVCL::Expr::isAnd(), CVCL::isDarkShadow(), CVCL::Expr::isEq(), CVCL::Expr::isFalse(), CVCL::isGrayShadow(), CVCL::isIntPred(), CVCL::isLE(), CVCL::isLT(), CVCL::isMult(), CVCL::Expr::isNot(), CVCL::Expr::isOr(), CVCL::Expr::isRational(), processBuffer(), CVCL::CDList< T >::push_back(), CVCL::Theory::setInconsistent(), CVCL::CDList< T >::size(), CVCL::ArithProofRules::splitGrayShadow(), CVCL::Expr::toString(), and CVCL::TRACE. |
|
Process disequalities from the arrangement for model generation.
Reimplemented from CVCL::Theory. Definition at line 1931 of file theory_arith.cpp. References CVCL::Theory::addSplitter(), CVCL::CDMap< Key, Data, HashFcn >::begin(), d_inModelCreation, d_sharedTerms, CVCL::CDMap< Key, Data, HashFcn >::end(), CVCL::Expr::eqExpr(), CVCL::Theory::findExpr(), CVCL::Theory::getBaseType(), CVCL::Expr::getType(), CVCL::isReal(), CVCL::Type::toString(), CVCL::Expr::toString(), and CVCL::TRACE. |
|
Assign concrete values to basic-type variables in v.
Reimplemented from CVCL::Theory. Definition at line 2065 of file theory_arith.cpp. References assignVariables(), d_inModelCreation, CVCL::Theory::findExpr(), and CVCL::TRACE. |
|
Compute the value of a compound variable from the more primitive ones. The more primitive variables for e are already assigned concrete values, and are available through getModelValue(). The new value for e must be assigned using assignValue() method.
Reimplemented from CVCL::Theory. |
|
Check for satisfiability in the theory.
Implements CVCL::Theory. Definition at line 1909 of file theory_arith.cpp. References d_buffer, d_bufferIdx, d_diseq, d_diseqIdx, d_inModelCreation, d_rules, CVCL::ArithProofRules::diseqToIneq(), CVCL::Theory::enqueueFact(), CVCL::Theory::inconsistent(), processBuffer(), CVCL::CDList< T >::size(), and CVCL::TRACE. |
|
Theory-specific rewrite rules. By default, rewrite just returns a reflexive theorem stating that the input expression is equivalent to itself. However, rewrite is allowed to return any theorem which describes how the input expression is equivalent to some new expression. rewrite should be used to perform simplifications, normalization, and any other preprocessing on theory-specific expressions that needs to be done. Reimplemented from CVCL::Theory. Definition at line 2168 of file theory_arith.cpp. References canon(), canonPredEquiv(), CVCL::ArithProofRules::constPredicate(), d_rules, CVCL::DARK_SHADOW, CVCL::EQ, CVCL::ArithProofRules::flipInequality(), CVCL::GE, CVCL::Theory::getCommonRules(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), CVCL::GRAY_SHADOW, CVCL::GT, CVCL::CommonProofRules::iffTrue(), CVCL::IS_INTEGER, CVCL::Expr::isAbsLiteral(), CVCL::Expr::isAtomic(), CVCL::Expr::isEq(), CVCL::isGE(), CVCL::isGT(), CVCL::isIneq(), isIntegerDerive(), CVCL::Theory::isLeaf(), CVCL::Theorem::isNull(), CVCL::Expr::isRational(), CVCL::Expr::isTerm(), CVCL::LE, CVCL::LT, CVCL::ArithProofRules::negatedInequality(), normalize(), CVCL::NOT, CVCL::Theory::reflexivityRule(), CVCL::ArithProofRules::rightMinusLeft(), CVCL::Expr::setRewriteNormal(), CVCL::TRACE, CVCL::Theory::transitivityRule(), and CVCL::Theory::typePred(). Referenced by update(). |
|
Set up the term e for call-backs when e or its children change. setup is called once for each expression associated with the theory. It is typically used to setup theory-specific data for an expression and to add call-back information for use with update.
Reimplemented from CVCL::Theory. Definition at line 2296 of file theory_arith.cpp. References CVCL::Expr::addToNotify(), CVCL::Expr::arity(), CVCL::Expr::getKind(), CVCL::int2string(), CVCL::IS_INTEGER, CVCL::isDarkShadow(), CVCL::Expr::isEq(), CVCL::isGrayShadow(), CVCL::isLE(), CVCL::isLT(), CVCL::Expr::isNot(), CVCL::isRational(), CVCL::Expr::isTerm(), CVCL::Expr::toString(), and CVCL::TRACE. Referenced by setupRec(). |
|
Notify a theory of a new equality. update is a call-back used by the notify mechanism of the core theory. It works as follows. When an equation t1 = t2 makes it into the core framework, the two find equivalence classes for t1 and t2 are merged. The result is that t2 is the new equivalence class representative and t1 is no longer an equivalence class representative. When this happens, the notify list of t1 is traversed. Notify list entries consist of a theory and an expression d. For each entry (i,d), i->update(e, d) is called, where e is the theorem corresponding to the equality t1=t2. To add the entry (i,d) to a term t1's notify list, a call must be made to t1.addNotify(i,d). This is typically done in setup.
Reimplemented from CVCL::Theory. Definition at line 2318 of file theory_arith.cpp. References CVCL::Debug::counter(), CVCL::debugger, CVCL::Theory::enqueueEquality(), CVCL::Theory::enqueueFact(), CVCL::Theory::find(), CVCL::Theory::getCommonRules(), CVCL::Theorem::getLHS(), CVCL::Theorem::getRHS(), CVCL::Expr::hasFind(), IF_DEBUG(), CVCL::Theory::iffMP(), CVCL::Theory::inconsistent(), CVCL::isIneq(), rewrite(), CVCL::Theory::substitutivityRule(), CVCL::Theory::symmetryRule(), CVCL::TRACE, CVCL::Theory::transitivityRule(), CVCL::Theory::trueExpr(), and CVCL::Theory::updateHelper(). |
|
An optional solver. The solve method can be used to implement a Shostak-style solver. Since solvers do not in general combine, the following technique is used. One theory is designated as the primary solver (in our case, it is the theory of arithmetic). For each equation that enters the core framework, the primary solver is called to ensure that the equation is in solved form with respect to the primary theory. After the primary solver, the solver for the theory associated with the equation is called. This solver can do whatever it likes, as long as the result is still in solved form with respect to the primary solver. This is a slight generalization of what is described in my (Clark)'s PhD thesis. Reimplemented from CVCL::Theory. Definition at line 2367 of file theory_arith.cpp. References doSolve(), CVCL::Theorem::getExpr(), CVCL::Expr::isEq(), isInteger(), CVCL::Theory::isLeaf(), CVCL::Theory::isLeafIn(), and CVCL::Theory::symmetryRule(). |
|
Check that e is a valid Type expr.
Reimplemented from CVCL::Theory. Definition at line 2440 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Theory::getEM(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::INT, CVCL::isIntegerConst(), CVCL::REAL, CVCL::SUBRANGE, and CVCL::Expr::toString(). |
|
Compute and store the type of e.
Reimplemented from CVCL::Theory. Definition at line 2464 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Theory::boolType(), d_intType, d_realType, CVCL::DARK_SHADOW, CVCL::DIVIDE, CVCL::GE, CVCL::Theory::getBaseType(), CVCL::Theory::getEM(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::Expr::getType(), CVCL::GRAY_SHADOW, CVCL::GT, CVCL::IS_INTEGER, CVCL::isInt(), isInteger(), CVCL::Rational::isInteger(), CVCL::Expr::isRational(), CVCL::LE, CVCL::LT, CVCL::MINUS, CVCL::MULT, CVCL::PLUS, CVCL::POW, CVCL::RATIONAL_EXPR, CVCL::Expr::setType(), CVCL::Expr::toString(), CVCL::Type::toString(), and CVCL::UMINUS. |
|
Compute the base type of the top-level operator of an arbitrary type.
Reimplemented from CVCL::Theory. Definition at line 2544 of file theory_arith.cpp. References CVCL::Type::getExpr(), CVCL::Expr::getKind(), IF_DEBUG(), CVCL::INT, CVCL::REAL, realType(), CVCL::SUBRANGE, and CVCL::Type::toString(). |
|
Add variables from 'e' to 'v' for constructing a concrete model. If e is already of primitive type, do NOT add it to v. Reimplemented from CVCL::Theory. Definition at line 2394 of file theory_arith.cpp. References CVCL::Expr::begin(), CVCL::DIVIDE, CVCL::Expr::end(), CVCL::Theory::findExpr(), CVCL::Expr::getKind(), CVCL::MULT, CVCL::PLUS, CVCL::POW, CVCL::RATIONAL_EXPR, CVCL::Expr::toString(), and CVCL::TRACE. |
|
Theory specific computation of the subtyping predicate for type t applied to the expression e. By default returns true. Each theory needs to compute subtype predicates for the types associated with it. So, for example, the theory of records will take a record type [# f1: T1, f2: T2 #] and an expression e and will return the subtyping predicate for e, namely: computeTypePred(T1, e.f1) AND computeTypePred(T2, e.f2) Reimplemented from CVCL::Theory. Definition at line 2422 of file theory_arith.cpp. References CVCL::andExpr(), CVCL::Expr::getEM(), CVCL::Type::getExpr(), CVCL::Expr::getKind(), CVCL::INT, CVCL::IS_INTEGER, CVCL::leExpr(), CVCL::SUBRANGE, and CVCL::ExprManager::trueExpr(). |
|
Compute and cache the TCC of e.
The default implementation is to compute TCCs recursively for all children, and return their conjunction. Reimplemented from CVCL::Theory. Definition at line 2553 of file theory_arith.cpp. References CVCL::Expr::andExpr(), CVCL::Theory::computeTCC(), CVCL::DIVIDE, and rat(). |
|
Theory-specific pretty-printing. By default, print the top node in AST, and resume pretty-printing the children. The same call e.print(os) can be used in DP-specific printers to use AST printing for the given node. In fact, it is strongly recommended to add e.print(os) as the default for all the cases/kinds that are not handled by the particular pretty-printer. Reimplemented from CVCL::Theory. Definition at line 3009 of file theory_arith.cpp. References CVCL::Expr::arity(), d_intUsed, d_langUsed, d_realUsed, CVCL::DARK_SHADOW, CVCL::DIFF_ONLY, CVCL::DIVIDE, CVCL::GE, CVCL::TheoryCore::getFlags(), CVCL::Expr::getKind(), CVCL::ExprStream::getParent(), CVCL::Expr::getRational(), CVCL::GRAY_SHADOW, CVCL::GT, CVCL::INT, CVCL::IS_INTEGER, isAtomicArithFormula(), CVCL::Expr::isEq(), CVCL::isIneq(), CVCL::isInt(), CVCL::Expr::isNull(), CVCL::isRational(), isSyntacticRational(), CVCL::ExprStream::lang(), CVCL::LE, CVCL::LINEAR, CVCL::LISP_LANG, CVCL::LT, CVCL::MINUS, CVCL::MULT, CVCL::NEGINF, CVCL::NONLINEAR, CVCL::NOT_USED, CVCL::PLUS, CVCL::POSINF, CVCL::POW, CVCL::PRESENTATION_LANG, CVCL::Expr::print(), CVCL::Expr::printAST(), printLhs(), printMinus(), printPlus(), printRational(), CVCL::push(), CVCL::RATIONAL_EXPR, CVCL::REAL, CVCL::SMTLIB_LANG, CVCL::space(), CVCL::SUBRANGE, CVCL::TERMS_ONLY, CVCL::Theory::theoryCore(), and CVCL::UMINUS. |
|
Theory-specific parsing implemented by the DP.
Reimplemented from CVCL::Theory. Definition at line 2569 of file theory_arith.cpp. References CVCL::Expr::arity(), CVCL::Expr::begin(), CVCL::DIVIDE, CVCL::divideExpr(), CVCL::Expr::end(), CVCL::GE, CVCL::geExpr(), CVCL::Expr::getEM(), CVCL::Theory::getEM(), CVCL::ExprManager::getKind(), CVCL::Expr::getKind(), CVCL::Expr::getString(), CVCL::GT, CVCL::gtExpr(), CVCL::ID, CVCL::INT, CVCL::INTDIV, CVCL::IS_INTEGER, CVCL::LE, CVCL::leExpr(), CVCL::LT, CVCL::ltExpr(), CVCL::MINUS, CVCL::minusExpr(), CVCL::MOD, CVCL::MULT, CVCL::multExpr(), CVCL::NEGINF, CVCL::ExprManager::newLeafExpr(), CVCL::NULL_KIND, CVCL::Theory::parseExpr(), CVCL::PLUS, CVCL::plusExpr(), CVCL::POSINF, CVCL::POW, CVCL::powExpr(), CVCL::RAW_LIST, CVCL::REAL, CVCL::SUBRANGE, CVCL::Expr::toString(), CVCL::TRACE, CVCL::UMINUS, and CVCL::uminusExpr(). |
|
Definition at line 364 of file theory_arith.h. References d_realType. Referenced by computeBaseType(), CVCL::Translator::preprocessRec(), CVCL::VCL::realType(), and CVCL::ArithTheoremProducer::realType(). |
|
Definition at line 365 of file theory_arith.h. References d_intType. Referenced by CVCL::VCL::intType(), and CVCL::ArithTheoremProducer::intType(). |
|
Definition at line 366 of file theory_arith.h. References CVCL::SUBRANGE. Referenced by CVCL::VCL::subrangeType(). |
|
Definition at line 368 of file theory_arith.h. References CVCL::Theory::getEM(), and CVCL::ExprManager::newRatExpr(). Referenced by assignVariables(), computeNormalFactor(), computeTCC(), grayShadow(), isolateVariable(), normalizeProjectIneqs(), processFiniteInterval(), processRealEq(), processSimpleIntEq(), rewriteToDiff(), separateMonomial(), and updateSubsumptionDB(). |
|
Construct the dark shadow expression representing lhs <= rhs.
Definition at line 371 of file theory_arith.h. References CVCL::DARK_SHADOW. Referenced by CVCL::ArithTheoremProducer::darkShadow(). |
|
Construct the gray shadow expression representing c1 <= v - e <= c2. Alternatively, v = e + i for some i s.t. c1 <= i <= c2 Definition at line 377 of file theory_arith.h. References CVCL::GRAY_SHADOW, and rat(). Referenced by CVCL::ArithTheoremProducer::grayShadow(). |
|
Printing.
|
|
Printing.
|
|
Definition at line 85 of file theory_arith.h. Referenced by computeType(), realType(), and TheoryArith(). |
|
Definition at line 86 of file theory_arith.h. Referenced by computeType(), intType(), and TheoryArith(). |
|
Definition at line 87 of file theory_arith.h. Referenced by assertFact(), checkSat(), and TheoryArith(). |
|
Definition at line 88 of file theory_arith.h. Referenced by checkSat(). |
|
Definition at line 89 of file theory_arith.h. Referenced by addToBuffer(), assertFact(), canon(), checkSat(), doSolve(), isolateVariable(), normalize(), normalizeProjectIneqs(), processFiniteInterval(), processRealEq(), processSimpleIntEq(), projectInequalities(), rewrite(), TheoryArith(), and ~TheoryArith(). |
|
Definition at line 90 of file theory_arith.h. Referenced by assertFact(), checkSat(), computeModelBasic(), and refineCounterExample(). |
|
Definition at line 91 of file theory_arith.h. Referenced by intUsed(), print(), printRational(), realUsed(), and theoryUsed(). |
|
Definition at line 92 of file theory_arith.h. Referenced by intUsed(), print(), and theoryUsed(). |
|
Definition at line 93 of file theory_arith.h. Referenced by intUsed(), printRational(), and theoryUsed(). |
|
Definition at line 94 of file theory_arith.h. Referenced by getLangUsed(), print(), printMinus(), printPlus(), printRational(), and theoryUsed(). |
|
Definition at line 95 of file theory_arith.h. Referenced by printLhs(), printRational(), rewriteToDiff(), and TheoryArith(). |
|
Definition at line 96 of file theory_arith.h. Referenced by printLhs(), rewriteToDiff(), and TheoryArith(). |
|
Database of inequalities with a variable isolated on the right.
Definition at line 137 of file theory_arith.h. Referenced by findBounds(), processFiniteIntervals(), projectInequalities(), and ~TheoryArith(). |
|
Database of inequalities with a variable isolated on the left.
Definition at line 139 of file theory_arith.h. Referenced by findBounds(), processFiniteIntervals(), projectInequalities(), and ~TheoryArith(). |
|
Mapping of inequalities to the largest/smallest free constant. The Expr is the original inequality with the free constant removed and inequality converted to non-strict (for indexing purposes). I.e. ax<c+t becomes ax<=t. This inequality is mapped to a pair<c,strict>, the smallest (largest for c+t<ax) constant among inequalities with the same 'a', 'x', and 't', and a boolean flag indicating whether the strongest inequality is strict. Definition at line 148 of file theory_arith.h. Referenced by updateSubsumptionDB(). |
|
Buffer of input inequalities.
Definition at line 150 of file theory_arith.h. Referenced by addToBuffer(), assertFact(), checkSat(), processBuffer(), and TheoryArith(). |
|
Buffer index of the next unprocessed inequality.
Definition at line 151 of file theory_arith.h. Referenced by assertFact(), checkSat(), processBuffer(), and TheoryArith(). |
|
Threshold when the buffer must be processed.
Definition at line 152 of file theory_arith.h. Referenced by assertFact(). |
|
Mapping of a variable to the number of inequalities where the variable would be isolated on the right.
Definition at line 156 of file theory_arith.h. Referenced by pickMonomial(), and updateStats(). |
|
Mapping of a variable to the number of inequalities where the variable would be isolated on the left.
Definition at line 159 of file theory_arith.h. Referenced by pickMonomial(), and updateStats(). |
|
Set of shared terms (for counterexample generation).
Definition at line 161 of file theory_arith.h. Referenced by addSharedTerm(), and refineCounterExample(). |
|
Set of shared integer variables (i-leaves).
Definition at line 163 of file theory_arith.h. |
|
Definition at line 183 of file theory_arith.h. Referenced by assignVariables(), and pickMonomial(). |