CVCL::TheoryArith Class Reference
[Theories]

This theory handles basic linear arithmetic. More...

#include <theory_arith.h>

Inheritance diagram for CVCL::TheoryArith:

Inheritance graph
[legend]
Collaboration diagram for CVCL::TheoryArith:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Private Member Functions

Private Attributes

Friends

Classes


Detailed Description

This theory handles basic linear arithmetic.

Author: Clark Barrett

Created: Sat Feb 8 14:44:32 2003

Definition at line 84 of file theory_arith.h.


Constructor & Destructor Documentation

TheoryArith::TheoryArith VCL vcl,
TheoryCore core
 

Definition at line 1583 of file theory_arith.cpp.

References createProofRules(), d_buffer, d_bufferIdx, d_convertToDiff, d_diseq, d_intType, d_realType, d_rules, d_zeroVar, CVCL::DARK_SHADOW, CVCL::DIVIDE, CVCL::GE, CVCL::Theory::getEM(), CVCL::GRAY_SHADOW, CVCL::GT, IF_DEBUG(), CVCL::INT, CVCL::INTDIV, CVCL::IS_INTEGER, CVCL::LE, CVCL::LT, CVCL::MINUS, CVCL::MOD, CVCL::MULT, CVCL::NEGINF, CVCL::ExprManager::newKind(), CVCL::PLUS, CVCL::POSINF, CVCL::POW, CVCL::RATIONAL_EXPR, CVCL::REAL, CVCL::Theory::registerTheory(), CVCL::SUBRANGE, CVCL::UMINUS, and CVCL::VCL::varExpr().

TheoryArith::~TheoryArith  ) 
 

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().


Member Function Documentation

Theorem TheoryArith::isIntegerThm const Expr e  )  [private]
 

Check the term t for integrality.

Returns:
a theorem of IS_INTEGER(t) or Null.

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().

Theorem TheoryArith::isIntegerDerive const Expr isIntE,
const Theorem thm
[private]
 

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().

bool CVCL::TheoryArith::isInteger const Expr e  )  [inline, private]
 

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().

const Rational & TheoryArith::freeConstIneq const Expr ineq,
bool  varOnRHS
[private]
 

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().

const TheoryArith::FreeConst & TheoryArith::updateSubsumptionDB const Expr ineq,
bool  varOnRHS,
bool &  subsumed
[private]
 

Update the free constant subsumption database with new inequality.

Returns:
a reference to the max/min constant.
Also, sets 'subsumed' argument to true if the inequality is subsumed by an existing 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().

bool TheoryArith::kidsCanonical const Expr e  )  [private]
 

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().

Theorem TheoryArith::canon const Expr e  )  [private]
 

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().

Theorem TheoryArith::canonRec const Expr e  )  [private]
 

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().

Theorem CVCL::TheoryArith::canon const Theorem thm  )  [inline, private]
 

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().

Theorem TheoryArith::canonSimplify const Expr e  )  [private]
 

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().

Theorem CVCL::TheoryArith::canonSimplify const Theorem thm  )  [inline, private]
 

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().

Theorem TheoryArith::canonPred const Theorem thm  )  [private]
 

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().

Theorem TheoryArith::canonPredEquiv const Theorem thm  )  [private]
 

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().

Theorem TheoryArith::doSolve const Theorem thm  )  [private]
 

Solve an equation and return an equivalent Theorem in the solved form.

Psuedo-code for doSolve. (Input is an equation) (output is a Theorem)

  1. translate e to the form e' = 0
  2. if (e'.isRational()) then {if e' != 0 return false else true}
  3. a for loop checks if all the variables are integers.
    • if not isolate a suitable real variable and call processRealEq().
    • if all variables are integers then isolate suitable variable and call processIntEq().

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().

Theorem TheoryArith::canonConjunctionEquiv const Theorem thm  )  [private]
 

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.

Expr TheoryArith::pickIntEqMonomial const Expr right  )  [private]
 

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().

Theorem TheoryArith::processRealEq const Theorem eqn  )  [private]
 

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().

Theorem TheoryArith::processIntEq const Theorem eqn  )  [private]
 

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().

Theorem TheoryArith::processSimpleIntEq const Theorem eqn  )  [private]
 

One step of INT equality processing (aux. method for processIntEq()).

Parameters:
eqn is a single equation 0 = e
Returns:
an equivalent Theorem (x = t AND 0 = e'), or just x = t

Definition at line 638 of file theory_arith.cpp.

References CVCL::CommonProofRules::andIntro(), CVCL::Expr::arity(), CVCL::Expr::begin(), canonPred(), d_rules, CVCL::Expr::end(), CVCL::EQ, CVCL::ArithProofRules::eqElimIntRule(), CVCL::Theory::getCommonRules(), CVCL::Theorem::getExpr(), CVCL::Theorem::getLHS(), CVCL::Expr::getRational(), CVCL::Theorem::getRHS(), CVCL::Theory::iffMP(), CVCL::ArithProofRules::intVarEqnConst(), CVCL::Expr::isAnd(), isIntegerThm(), CVCL::isMult(), CVCL::Theorem::isNull(), CVCL::isPlus(), CVCL::Expr::isRational(), CVCL::Theorem::isRewrite(), CVCL::ArithProofRules::multEqn(), pickIntEqMonomial(), CVCL::ArithProofRules::plusPredicate(), rat(), separateMonomial(), CVCL::CommonProofRules::skolemize(), CVCL::Theory::symmetryRule(), CVCL::Expr::toString(), and CVCL::TRACE.

Referenced by processIntEq().

void TheoryArith::processBuffer  )  [private]
 

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().

Theorem TheoryArith::isolateVariable const Theorem inputThm,
bool &  e1
[private]
 

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().

void TheoryArith::updateStats const Rational c,
const Expr var
[private]
 

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().

void TheoryArith::updateStats const Expr monomial  )  [private]
 

Update the statistics counters for the monomial.

Definition at line 974 of file theory_arith.cpp.

References CVCL::Expr::getRational(), separateMonomial(), and updateStats().

void TheoryArith::addToBuffer const Theorem thm  )  [private]
 

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().

Expr TheoryArith::computeNormalFactor const Expr rhs  )  [private]
 

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().

Theorem TheoryArith::normalize const Expr e  )  [private]
 

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().

Theorem TheoryArith::normalize const Theorem thm  )  [private]
 

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().

Expr TheoryArith::pickMonomial const Expr right  )  [private]
 

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().

void TheoryArith::separateMonomial const Expr e,
Expr c,
Expr var
 

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().

bool TheoryArith::lessThanVar const Expr isolatedVar,
const Expr var2
[private]
 

Definition at line 1118 of file theory_arith.cpp.

References CVCL::isRational(), separateMonomial(), and CVCL::Expr::toString().

Referenced by pickMonomial().

bool TheoryArith::isStale const Expr e  )  [private]
 

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().

bool TheoryArith::isStale const Ineq ineq  )  [private]
 

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().

void TheoryArith::projectInequalities const Theorem theInequality,
bool  isolatedVarOnRHS
[private]
 

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().

void TheoryArith::assignVariables std::vector< Expr > &  v  )  [private]
 

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().

void TheoryArith::findRationalBound const Expr varSide,
const Expr ratSide,
const Expr var,
Rational r
[private]
 

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().

bool TheoryArith::findBounds const Expr e,
Rational lub,
Rational glb
[private]
 

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().

Theorem TheoryArith::normalizeProjectIneqs const Theorem ineqThm1,
const Theorem ineqThm2
[private]
 

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().

Theorem CVCL::TheoryArith::solvedForm const std::vector< Theorem > &  solvedEqs  )  [private]
 

Take a system of equations and turn it into a solved form.

Referenced by processIntEq().

Theorem TheoryArith::substAndCanonize const Expr t,
ExprMap< Theorem > &  subst
[private]
 

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().

Theorem TheoryArith::substAndCanonize const Theorem eq,
ExprMap< Theorem > &  subst
[private]
 

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().

void CVCL::TheoryArith::collectVars const Expr e,
std::vector< Expr > &  vars,
std::set< Expr > &  cache
[private]
 

Traverse 'e' and push all the i-leaves into 'vars' vector.

void TheoryArith::processFiniteInterval const Theorem alphaLEax,
const Theorem bxLEbeta
[private]
 

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().

void TheoryArith::processFiniteIntervals const Expr x  )  [private]
 

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().

void TheoryArith::setupRec const Expr e  )  [private]
 

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().

bool TheoryArith::isSyntacticRational const Expr e,
Rational r
[private]
 

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().

void TheoryArith::printRational ExprStream os,
const Expr parent,
const Expr e,
const Rational r,
bool  checkLhs = true
[private]
 

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().

bool TheoryArith::isSyntacticUMinusVar const Expr e,
Expr var
[private]
 

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().

void TheoryArith::printPlus ExprStream os,
const Expr parent,
const Expr e
[private]
 

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().

void TheoryArith::printMinus ExprStream os,
const Expr parent,
const Expr e
[private]
 

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().

void TheoryArith::printLhs ExprStream os,
const Expr e
[private]
 

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().

bool TheoryArith::isAtomicArithTerm const Expr e  )  [private]
 

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().

bool CVCL::TheoryArith::realUsed  )  [inline]
 

Return whether Reals are used.

Definition at line 326 of file theory_arith.h.

References d_realUsed.

bool CVCL::TheoryArith::intUsed  )  [inline]
 

Return whether Ints are used.

Definition at line 328 of file theory_arith.h.

References d_intConstUsed, d_intUsed, and d_realUsed.

ArithLang CVCL::TheoryArith::getLangUsed  )  [inline]
 

Return which subset of arithmetic is used.

Definition at line 330 of file theory_arith.h.

References d_langUsed.

bool CVCL::TheoryArith::theoryUsed  )  [inline, virtual]
 

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.

Expr TheoryArith::rewriteToDiff const Expr e  ) 
 

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().

bool TheoryArith::isAtomicArithFormula const Expr e  ) 
 

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().

ArithProofRules * TheoryArith::createProofRules  ) 
 

Definition at line 50 of file arith_theorem_producer.cpp.

References CVCL::Theory::theoryCore().

Referenced by TheoryArith().

void TheoryArith::addSharedTerm const Expr e  )  [virtual]
 

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.

void TheoryArith::assertFact const Theorem e  )  [virtual]
 

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.

void TheoryArith::refineCounterExample  )  [virtual]
 

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.

void TheoryArith::computeModelBasic const std::vector< Expr > &  v  )  [virtual]
 

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.

void CVCL::TheoryArith::computeModel const Expr e,
std::vector< Expr > &  vars
[virtual]
 

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.

Parameters:
e is the compound type expression to assign a value;
vars are the variables actually assigned. Normally, 'e' is the only element of vars. However, e.g. in the case of uninterpreted functions, assigning 'f' means assigning all relevant applications of 'f' to constant values (f(0), f(5), etc.). Such applications might not be known before the model is constructed (they may be of the form f(x), f(y+z), etc., where x,y,z are still unassigned).
Populating 'vars' is an opportunity for a DP to change the set of top-level "variables" to assign, if needed. In particular, it may drop 'e' from the model entirely, if it is already a concrete value by itself.

Reimplemented from CVCL::Theory.

void TheoryArith::checkSat bool  fullEffort  )  [virtual]
 

Check for satisfiability in the theory.

Parameters:
fullEffort when it is false, checkSat can do as much or as little work as it likes, though simple inferences and checks for consistency should be done to increase efficiency. If fullEffort is true, checkSat must check whether the set of facts given by assertFact together with the arrangement of shared terms (provided by addSharedTerm) induced by the global find database equivalence relation are satisfiable. If satisfiable, checkSat does nothing.
If satisfiability can be acheived by merging some of the shared terms, a new fact must be enqueued using enqueueFact (this fact need not be a literal). If there is no way to make things satisfiable, setInconsistent must be called.

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.

Theorem TheoryArith::rewrite const Expr e  )  [virtual]
 

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().

void TheoryArith::setup const Expr e  )  [virtual]
 

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.

See also:
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().

void TheoryArith::update const Theorem e,
const Expr d
[virtual]
 

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.

See also:
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().

Theorem TheoryArith::solve const Theorem thm  )  [virtual]
 

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().

void TheoryArith::checkType const Expr e  )  [virtual]
 

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().

void TheoryArith::computeType const Expr e  )  [virtual]
 

Compute and store the type of e.

Parameters:
e is the expression whose type is computed.
This function computes the type of the top-level operator of e, and recurses into children using getType(), if necessary.

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.

Type TheoryArith::computeBaseType const Type t  )  [virtual]
 

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().

void TheoryArith::computeModelTerm const Expr e,
std::vector< Expr > &  v
[virtual]
 

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.

Expr TheoryArith::computeTypePred const Type t,
const Expr e
[virtual]
 

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().

Expr TheoryArith::computeTCC const Expr e  )  [virtual]
 

Compute and cache the TCC of e.

Parameters:
e is an expression (term or formula). This function computes the TCC of e which is true iff the expression is defined.
This function computes the TCC or predicate of the top-level operator of e, and recurses into children using getTCC(), if necessary.

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().

ExprStream & TheoryArith::print ExprStream os,
const Expr e
[virtual]
 

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.

Expr TheoryArith::parseExprOp const Expr e  )  [virtual]
 

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().

Type CVCL::TheoryArith::realType  )  [inline]
 

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().

Type CVCL::TheoryArith::intType  )  [inline]
 

Definition at line 365 of file theory_arith.h.

References d_intType.

Referenced by CVCL::VCL::intType(), and CVCL::ArithTheoremProducer::intType().

Type CVCL::TheoryArith::subrangeType const Expr l,
const Expr r
[inline]
 

Definition at line 366 of file theory_arith.h.

References CVCL::SUBRANGE.

Referenced by CVCL::VCL::subrangeType().

Expr CVCL::TheoryArith::rat Rational  r  )  [inline]
 

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().

Expr CVCL::TheoryArith::darkShadow const Expr lhs,
const Expr rhs
[inline]
 

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().

Expr CVCL::TheoryArith::grayShadow const Expr v,
const Expr e,
const Rational c1,
const Rational c2
[inline]
 

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().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const FreeConst fc
[friend]
 

Printing.

std::ostream& operator<< std::ostream &  os,
const Ineq ineq
[friend]
 

Printing.


Member Data Documentation

Type CVCL::TheoryArith::d_realType [private]
 

Definition at line 85 of file theory_arith.h.

Referenced by computeType(), realType(), and TheoryArith().

Type CVCL::TheoryArith::d_intType [private]
 

Definition at line 86 of file theory_arith.h.

Referenced by computeType(), intType(), and TheoryArith().

CDList<Theorem> CVCL::TheoryArith::d_diseq [private]
 

Definition at line 87 of file theory_arith.h.

Referenced by assertFact(), checkSat(), and TheoryArith().

CDO<size_t> CVCL::TheoryArith::d_diseqIdx [private]
 

Definition at line 88 of file theory_arith.h.

Referenced by checkSat().

ArithProofRules* CVCL::TheoryArith::d_rules [private]
 

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().

CDO<bool> CVCL::TheoryArith::d_inModelCreation [private]
 

Definition at line 90 of file theory_arith.h.

Referenced by assertFact(), checkSat(), computeModelBasic(), and refineCounterExample().

bool CVCL::TheoryArith::d_realUsed [private]
 

Definition at line 91 of file theory_arith.h.

Referenced by intUsed(), print(), printRational(), realUsed(), and theoryUsed().

bool CVCL::TheoryArith::d_intUsed [private]
 

Definition at line 92 of file theory_arith.h.

Referenced by intUsed(), print(), and theoryUsed().

bool CVCL::TheoryArith::d_intConstUsed [private]
 

Definition at line 93 of file theory_arith.h.

Referenced by intUsed(), printRational(), and theoryUsed().

ArithLang CVCL::TheoryArith::d_langUsed [private]
 

Definition at line 94 of file theory_arith.h.

Referenced by getLangUsed(), print(), printMinus(), printPlus(), printRational(), and theoryUsed().

std::string CVCL::TheoryArith::d_convertToDiff [private]
 

Definition at line 95 of file theory_arith.h.

Referenced by printLhs(), printRational(), rewriteToDiff(), and TheoryArith().

Expr CVCL::TheoryArith::d_zeroVar [private]
 

Definition at line 96 of file theory_arith.h.

Referenced by printLhs(), rewriteToDiff(), and TheoryArith().

ExprMap<CDList<Ineq> *> CVCL::TheoryArith::d_inequalitiesRightDB [private]
 

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().

ExprMap<CDList<Ineq> *> CVCL::TheoryArith::d_inequalitiesLeftDB [private]
 

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().

CDMap<Expr, FreeConst> CVCL::TheoryArith::d_freeConstDB [private]
 

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().

CDList<Theorem> CVCL::TheoryArith::d_buffer [private]
 

Buffer of input inequalities.

Definition at line 150 of file theory_arith.h.

Referenced by addToBuffer(), assertFact(), checkSat(), processBuffer(), and TheoryArith().

CDO<size_t> CVCL::TheoryArith::d_bufferIdx [private]
 

Buffer index of the next unprocessed inequality.

Definition at line 151 of file theory_arith.h.

Referenced by assertFact(), checkSat(), processBuffer(), and TheoryArith().

const int* CVCL::TheoryArith::d_bufferThres [private]
 

Threshold when the buffer must be processed.

Definition at line 152 of file theory_arith.h.

Referenced by assertFact().

CDMap<Expr, int> CVCL::TheoryArith::d_countRight [private]
 

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().

CDMap<Expr, int> CVCL::TheoryArith::d_countLeft [private]
 

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().

CDMap<Expr, bool> CVCL::TheoryArith::d_sharedTerms [private]
 

Set of shared terms (for counterexample generation).

Definition at line 161 of file theory_arith.h.

Referenced by addSharedTerm(), and refineCounterExample().

CDMap<Expr, bool> CVCL::TheoryArith::d_sharedVars [private]
 

Set of shared integer variables (i-leaves).

Definition at line 163 of file theory_arith.h.

VarOrderGraph CVCL::TheoryArith::d_graph [private]
 

Definition at line 183 of file theory_arith.h.

Referenced by assignVariables(), and pickMonomial().


The documentation for this class was generated from the following files:
Generated on Thu Apr 13 16:57:44 2006 for CVC Lite by  doxygen 1.4.4