CVCL::TheoryUF Class Reference
[Theories]

This theory handles uninterpreted functions. More...

#include <theory_uf.h>

Inheritance diagram for CVCL::TheoryUF:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

Private Types

Private Attributes

Classes


Detailed Description

This theory handles uninterpreted functions.

Author: Clark Barrett

Created: Sat Feb 8 14:51:19 2003

Definition at line 56 of file theory_uf.h.


Member Typedef Documentation

typedef struct CVCL::TheoryUF::TCMapPair CVCL::TheoryUF::TCMapPair [private]
 


Constructor & Destructor Documentation

TheoryUF::TheoryUF TheoryCore core  ) 
 

Definition at line 49 of file theory_uf.cpp.

References CVCL::ANY_TYPE, CVCL::ARROW, createProofRules(), d_anyType, d_rules, CVCL::Theory::getEM(), CVCL::LAMBDA, CVCL::ExprManager::newKind(), CVCL::OLD_ARROW, CVCL::Theory::registerTheory(), CVCL::TRANS_CLOSURE, CVCL::TYPEDECL, and CVCL::UFUNC.

TheoryUF::~TheoryUF  ) 
 

Definition at line 78 of file theory_uf.cpp.

References d_rules.


Member Function Documentation

UFProofRules * TheoryUF::createProofRules  ) 
 

Definition at line 49 of file uf_theorem_producer.cpp.

References CVCL::Theory::theoryCore().

Referenced by TheoryUF().

void CVCL::TheoryUF::addSharedTerm const Expr e  )  [inline, virtual]
 

Notify theory of a new shared term.

When a term e associated with theory i occurs as a child of an expression associated with theory j, the framework calls i->addSharedTerm(e) and j->addSharedTerm(e)

Reimplemented from CVCL::Theory.

Definition at line 88 of file theory_uf.h.

void TheoryUF::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 86 of file theory_uf.cpp.

References CVCL::TheoryUF::TCMapPair::appearsFirstMap, CVCL::TheoryUF::TCMapPair::appearsSecondMap, CVCL::APPLY, CVCL::Expr::arity(), CVCL::Expr::computeTransClosure(), d_rules, d_transClosureMap, CVCL::ExprMap< Data >::end(), CVCL::Theory::enqueueFact(), CVCL::ExprMap< Data >::find(), CVCL::TheoryCore::getCM(), CVCL::ContextManager::getCurrentContext(), CVCL::Theorem::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getName(), CVCL::Expr::getOpExpr(), CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), CVCL::Expr::isNull(), CVCL::Expr::isSymbol(), CVCL::NOT, CVCL::CDList< T >::push_back(), CVCL::UFProofRules::relToClosure(), CVCL::UFProofRules::relTrans(), CVCL::Theory::resolveID(), CVCL::CDList< T >::size(), CVCL::Theory::theoryCore(), CVCL::Expr::toString(), CVCL::TRANS_CLOSURE, and CVCL::UFUNC.

void TheoryUF::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 163 of file theory_uf.cpp.

References CVCL::UFProofRules::applyLambda(), CVCL::Debug::counter(), d_funApplications, d_funApplicationsIdx, d_rules, CVCL::debugger, CVCL::Theory::enqueueFact(), CVCL::Op::getExpr(), CVCL::Expr::getOp(), IF_DEBUG(), CVCL::Expr::isLambda(), and CVCL::CDList< T >::size().

Theorem TheoryUF::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 177 of file theory_uf.cpp.

References CVCL::UFProofRules::applyLambda(), CVCL::CONSTDEF, CVCL::Debug::counter(), d_rules, CVCL::debugger, CVCL::Expr::getKind(), CVCL::Expr::getOpExpr(), CVCL::Theorem::getRHS(), CVCL::Expr::getType(), IF_DEBUG(), CVCL::Expr::isApply(), CVCL::Type::isBool(), CVCL::LAMBDA, CVCL::LETDECL, CVCL::Theory::reflexivityRule(), CVCL::Theory::rewriteCC(), CVCL::UFProofRules::rewriteOpDef(), CVCL::Expr::setRewriteNormal(), CVCL::Theory::simplify(), and CVCL::Theory::transitivityRule().

void TheoryUF::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 207 of file theory_uf.cpp.

References CVCL::APPLY, d_funApplications, CVCL::Expr::getKind(), CVCL::CDList< T >::push_back(), CVCL::Theory::setupCC(), and CVCL::TRACE.

void TheoryUF::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 217 of file theory_uf.cpp.

References CVCL::Expr::computeTransClosure(), d_rules, CVCL::Theory::enqueueFact(), CVCL::Theory::find(), CVCL::Theory::findExpr(), CVCL::Theory::getCommonRules(), CVCL::Expr::getOpExpr(), CVCL::Expr::getOpKind(), CVCL::Theorem::getRHS(), CVCL::Expr::getSig(), CVCL::CommonProofRules::iffTrueElim(), CVCL::Expr::isApply(), CVCL::Theorem::isNull(), CVCL::Expr::isTrue(), CVCL::UFProofRules::relToClosure(), CVCL::Theory::symmetryRule(), CVCL::TRANS_CLOSURE, CVCL::Theory::transitivityRule(), and CVCL::Theory::updateCC().

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

Check that e is a valid Type expr.

Reimplemented from CVCL::Theory.

Definition at line 277 of file theory_uf.cpp.

References CVCL::ANY_TYPE, CVCL::Expr::arity(), CVCL::ARROW, CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Theory::getEM(), CVCL::Expr::getKind(), CVCL::Type::isBool(), CVCL::Type::isFunction(), CVCL::Expr::toString(), and CVCL::TYPEDECL.

void TheoryUF::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 314 of file theory_uf.cpp.

References CVCL::APPLY, CVCL::Type::arity(), CVCL::Expr::arity(), d_anyType, CVCL::Type::funType(), CVCL::Theory::getBaseType(), CVCL::Expr::getBody(), CVCL::Type::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getName(), CVCL::Expr::getOpExpr(), CVCL::Expr::getType(), CVCL::Expr::getVars(), CVCL::int2string(), CVCL::Expr::isApply(), CVCL::Type::isFunction(), CVCL::Expr::isNull(), CVCL::Expr::isSymbol(), CVCL::LAMBDA, CVCL::Theory::resolveID(), CVCL::Expr::setType(), CVCL::Type::toString(), CVCL::Expr::toString(), and CVCL::TRANS_CLOSURE.

Type TheoryUF::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 404 of file theory_uf.cpp.

References CVCL::ANY_TYPE, CVCL::Expr::arity(), CVCL::ARROW, CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Theory::getBaseType(), CVCL::Type::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getOp(), CVCL::Type::toString(), and CVCL::TYPEDECL.

void TheoryUF::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 425 of file theory_uf.cpp.

References CVCL::CDList< T >::begin(), d_funApplications, and CVCL::CDList< T >::end().

void TheoryUF::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.

Definition at line 443 of file theory_uf.cpp.

References CVCL::andExpr(), CVCL::Type::arity(), CVCL::Theory::assignValue(), CVCL::ExprHashMap< Data >::begin(), CVCL::CDList< T >::begin(), d_applicationsInModel, d_funApplications, CVCL::ExprHashMap< Data >::end(), CVCL::CDList< T >::end(), CVCL::Theory::getEM(), CVCL::Theorem::getLHS(), CVCL::Theory::getModelValue(), CVCL::Theorem::getRHS(), CVCL::Expr::getType(), CVCL::int2string(), CVCL::Type::isFunction(), CVCL::Expr::iteExpr(), lambdaExpr(), CVCL::ExprManager::newBoundVarExpr(), CVCL::CDList< T >::push_back(), CVCL::Theory::reflexivityRule(), CVCL::Expr::setType(), CVCL::ExprHashMap< Data >::size(), CVCL::Theory::substitutivityRule(), CVCL::Theory::symmetryRule(), CVCL::Type::toString(), CVCL::Expr::toString(), and CVCL::Theory::transitivityRule().

Expr TheoryUF::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 524 of file theory_uf.cpp.

References CVCL::andExpr(), CVCL::APPLY, CVCL::Type::arity(), CVCL::Theory::computeTCC(), CVCL::CONSTDEF, CVCL::Expr::getBody(), CVCL::Expr::getKind(), CVCL::Theorem::getRHS(), CVCL::Theory::getTCC(), CVCL::Expr::getType(), CVCL::Theory::getTypePred(), CVCL::Expr::getVars(), CVCL::Type::isBool(), CVCL::Type::isFunction(), CVCL::Expr::isLambda(), CVCL::LAMBDA, lambdaExpr(), CVCL::LETDECL, CVCL::Expr::mkOp(), CVCL::Theory::rewriteAnd(), CVCL::Expr::toString(), CVCL::Type::toString(), and CVCL::Theory::trueExpr().

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

Theory-specific parsing implemented by the DP.

Reimplemented from CVCL::Theory.

Definition at line 803 of file theory_uf.cpp.

References CVCL::Theory::addBoundVar(), CVCL::Expr::arity(), CVCL::ARROW, CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Expr::getEM(), CVCL::Theory::getEM(), CVCL::ExprManager::getKind(), CVCL::Expr::getKind(), CVCL::Expr::getOpKind(), CVCL::Expr::getString(), CVCL::ID, CVCL::Expr::isNull(), CVCL::LAMBDA, lambdaExpr(), CVCL::Expr::mkOp(), CVCL::OLD_ARROW, CVCL::Theory::parseExpr(), CVCL::RAW_LIST, CVCL::Theory::resolveID(), CVCL::Theory::theoryCore(), CVCL::Expr::toString(), CVCL::TRANS_CLOSURE, transClosureExpr(), CVCL::TUPLE_TYPE, and CVCL::TYPEDECL.

ExprStream & TheoryUF::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 591 of file theory_uf.cpp.

References CVCL::ANY_TYPE, CVCL::APPLY, CVCL::Expr::arity(), CVCL::ARROW, CVCL::Expr::begin(), CVCL::BOOLEAN, CVCL::Theory::d_theoryUsed, CVCL::Expr::end(), CVCL::Expr::getBody(), CVCL::Theory::getEM(), CVCL::Op::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getName(), CVCL::Expr::getOp(), CVCL::Expr::getOpExpr(), CVCL::Expr::getString(), CVCL::Expr::getVars(), CVCL::Expr::isLambda(), CVCL::Expr::isString(), CVCL::Expr::isSymbol(), CVCL::LAMBDA, CVCL::ExprStream::lang(), CVCL::LISP_LANG, CVCL::OLD_ARROW, CVCL::pop(), CVCL::popdag(), CVCL::PRESENTATION_LANG, CVCL::Expr::printAST(), CVCL::push(), CVCL::pushdag(), CVCL::SMTLIB_LANG, CVCL::space(), CVCL::TRANS_CLOSURE, CVCL::TYPEDECL, and CVCL::UFUNC.

Expr CVCL::TheoryUF::lambdaExpr const std::vector< Expr > &  vars,
const Expr body
 

Create a new LAMBDA-abstraction.

Referenced by computeModel(), computeTCC(), and parseExprOp().

Expr TheoryUF::transClosureExpr const std::string &  name,
const Expr e1,
const Expr e2
 

Create a transitive closure expression.

Definition at line 910 of file theory_uf.cpp.

References CVCL::Theory::getEM(), and CVCL::TRANS_CLOSURE.

Referenced by parseExprOp(), and CVCL::UFTheoremProducer::relToClosure().

Type CVCL::TheoryUF::anyType  )  [inline]
 

Definition at line 108 of file theory_uf.h.

References d_anyType.


Member Data Documentation

UFProofRules* CVCL::TheoryUF::d_rules [private]
 

Definition at line 57 of file theory_uf.h.

Referenced by assertFact(), checkSat(), rewrite(), TheoryUF(), update(), and ~TheoryUF().

const bool& CVCL::TheoryUF::d_applicationsInModel [private]
 

Flag to include function applications to the concrete model.

Definition at line 59 of file theory_uf.h.

Referenced by computeModel().

Type CVCL::TheoryUF::d_anyType [private]
 

Type that matches any type in a function argument.

Definition at line 62 of file theory_uf.h.

Referenced by anyType(), computeType(), and TheoryUF().

ExprMap<TCMapPair*> CVCL::TheoryUF::d_transClosureMap [private]
 

Definition at line 70 of file theory_uf.h.

Referenced by assertFact().

CDList<Expr> CVCL::TheoryUF::d_funApplications [private]
 

Backtracking list of function applications.

Used for building concrete models and beta-reducing lambda-expressions.

Definition at line 75 of file theory_uf.h.

Referenced by checkSat(), computeModel(), computeModelTerm(), and setup().

CDO<size_t> CVCL::TheoryUF::d_funApplicationsIdx [private]
 

Pointer to the last unprocessed element (for lambda expansions).

Definition at line 77 of file theory_uf.h.

Referenced by checkSat().


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