#include <theory_uf.h>
Author: Clark Barrett
Created: Sat Feb 8 14:51:19 2003
Definition at line 47 of file theory_uf.h.
typedef struct CVC3::TheoryUF::TCMapPair CVC3::TheoryUF::TCMapPair [private] |
TheoryUF::TheoryUF | ( | TheoryCore * | core | ) |
Definition at line 42 of file theory_uf.cpp.
References CVC3::ARROW, createProofRules(), d_rules, CVC3::Theory::getEM(), CVC3::LAMBDA, CVC3::ExprManager::newKind(), CVC3::OLD_ARROW, CVC3::Theory::registerTheory(), CVC3::TRANS_CLOSURE, CVC3::TYPEDECL, and CVC3::UFUNC.
TheoryUF::~TheoryUF | ( | ) |
UFProofRules * TheoryUF::createProofRules | ( | ) |
Definition at line 41 of file uf_theorem_producer.cpp.
References CVC3::Theory::theoryCore().
Referenced by TheoryUF().
void CVC3::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 CVC3::Theory.
Definition at line 76 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 CVC3::Theory.
Definition at line 76 of file theory_uf.cpp.
References CVC3::TheoryUF::TheoryUF::TCMapPair::appearsFirstMap, CVC3::TheoryUF::TheoryUF::TCMapPair::appearsSecondMap, CVC3::APPLY, CVC3::Expr::arity(), CVC3::Expr::computeTransClosure(), d_rules, d_transClosureMap, DebugAssert, CVC3::ExprMap< Data >::end(), CVC3::Theory::enqueueFact(), CVC3::ExprMap< Data >::find(), CVC3::TheoryCore::getCM(), CVC3::ContextManager::getCurrentContext(), CVC3::Theorem::getExpr(), CVC3::Expr::getKind(), CVC3::Expr::getName(), CVC3::Expr::getOpExpr(), CVC3::Expr::getOpKind(), CVC3::Expr::isApply(), CVC3::NOT, CVC3::CDList< T >::push_back(), CVC3::UFProofRules::relToClosure(), CVC3::UFProofRules::relTrans(), CVC3::Theory::resolveID(), CVC3::CDList< T >::size(), CVC3::Theory::theoryCore(), CVC3::Expr::toString(), CVC3::TRANS_CLOSURE, and CVC3::UFUNC.
void TheoryUF::checkSat | ( | bool | fullEffort | ) | [virtual] |
Check for satisfiability in the theory.
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. |
Implements CVC3::Theory.
Definition at line 153 of file theory_uf.cpp.
References CVC3::UFProofRules::applyLambda(), d_funApplications, d_funApplicationsIdx, d_rules, CVC3::Theory::enqueueFact(), CVC3::Op::getExpr(), CVC3::Expr::getOp(), IF_DEBUG, CVC3::Expr::isLambda(), and CVC3::CDList< T >::size().
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 CVC3::Theory.
Definition at line 167 of file theory_uf.cpp.
References CVC3::UFProofRules::applyLambda(), d_rules, CVC3::Expr::getKind(), CVC3::Expr::getOpExpr(), CVC3::Theorem::getRHS(), CVC3::Expr::getType(), IF_DEBUG, CVC3::Expr::isApply(), CVC3::Type::isBool(), CVC3::LAMBDA, CVC3::Theory::reflexivityRule(), CVC3::Theory::rewriteCC(), CVC3::Expr::setRewriteNormal(), CVC3::Theory::simplify(), and CVC3::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.
Reimplemented from CVC3::Theory.
Definition at line 192 of file theory_uf.cpp.
References CVC3::APPLY, d_funApplications, CVC3::Expr::getKind(), CVC3::CDList< T >::push_back(), CVC3::Theory::setupCC(), and CVC3::TRACE.
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 CVC3::Theory.
Definition at line 209 of file theory_uf.cpp.
References CVC3::Expr::addToNotify(), CVC3::Expr::arity(), CVC3::Expr::computeTransClosure(), d_rules, CVC3::Theory::enqueueFact(), CVC3::Theory::find(), CVC3::Theory::findExpr(), CVC3::Theory::getCommonRules(), CVC3::Expr::getOpExpr(), CVC3::Expr::getOpKind(), CVC3::Expr::getRep(), CVC3::Theorem::getRHS(), CVC3::Expr::getSig(), CVC3::Expr::getType(), CVC3::CommonProofRules::iffTrueElim(), CVC3::Expr::isApply(), CVC3::Type::isBool(), CVC3::Theorem::isNull(), CVC3::Expr::isTrue(), CVC3::UFProofRules::relToClosure(), CVC3::Expr::setRep(), CVC3::Expr::setSig(), CVC3::Theory::symmetryRule(), CVC3::TRANS_CLOSURE, CVC3::Theory::transitivityRule(), and CVC3::Theory::updateHelper().
void TheoryUF::checkType | ( | const Expr & | e | ) | [virtual] |
Check that e is a valid Type expr.
Reimplemented from CVC3::Theory.
Definition at line 289 of file theory_uf.cpp.
References CVC3::Expr::arity(), CVC3::ARROW, CVC3::Expr::begin(), DebugAssert, CVC3::Expr::end(), CVC3::Theory::getEM(), CVC3::Expr::getKind(), CVC3::Type::isBool(), CVC3::Type::isFunction(), CVC3::Expr::toString(), and CVC3::TYPEDECL.
Cardinality TheoryUF::finiteTypeInfo | ( | Expr & | e, | |
Unsigned & | n, | |||
bool | enumerate, | |||
bool | computeSize | |||
) | [virtual] |
Compute information related to finiteness of types.
Used by the TypeComputer defined in TheoryCore (theories should not call this funtion directly -- they should use the methods in Type instead). Each theory should implement this if it contains any types that could be non-infinite.
1. Returns Cardinality of the type (finite, infinite, or unknown) 2. If cardinality = finite and enumerate is true, sets e to the nth element of the type if it can sets e to NULL if n is out of bounds or if unable to compute nth element 3. If cardinality = finite and computeSize is true, sets n to the size of the type if it can sets n to 0 otherwise
Reimplemented from CVC3::Theory.
Definition at line 320 of file theory_uf.cpp.
References CVC3::ARROW, CVC3::Expr::begin(), CVC3::CARD_FINITE, CVC3::CARD_INFINITE, CVC3::CARD_UNKNOWN, DebugAssert, CVC3::Expr::end(), CVC3::Theory::finiteTypeInfo(), CVC3::Expr::getKind(), and CVC3::Theory::theoryOf().
void TheoryUF::computeType | ( | const Expr & | e | ) | [virtual] |
Compute and store the type of e.
e | is the expression whose type is computed. |
Reimplemented from CVC3::Theory.
Definition at line 367 of file theory_uf.cpp.
References CVC3::APPLY, CVC3::Type::arity(), CVC3::Theory::computeType(), DebugAssert, CVC3::Type::funType(), CVC3::Expr::getBody(), CVC3::Expr::getKind(), CVC3::Expr::getName(), CVC3::Expr::getType(), CVC3::Expr::getVars(), CVC3::Type::isFunction(), CVC3::Expr::isSymbol(), CVC3::LAMBDA, CVC3::Theory::resolveID(), CVC3::Expr::setType(), CVC3::Theory::theoryOf(), CVC3::Type::toString(), CVC3::Expr::toString(), and CVC3::TRANS_CLOSURE.
Compute the base type of the top-level operator of an arbitrary type.
Reimplemented from CVC3::Theory.
Definition at line 421 of file theory_uf.cpp.
References CVC3::Expr::arity(), CVC3::ARROW, CVC3::Expr::begin(), DebugAssert, CVC3::Expr::end(), CVC3::Theory::getBaseType(), CVC3::Type::getExpr(), CVC3::Expr::getKind(), CVC3::Expr::getOp(), CVC3::Type::toString(), and CVC3::TYPEDECL.
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 CVC3::Theory.
Definition at line 441 of file theory_uf.cpp.
References CVC3::CDList< T >::begin(), d_funApplications, and CVC3::CDList< T >::end().
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.
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). |
Reimplemented from CVC3::Theory.
Definition at line 459 of file theory_uf.cpp.
References CVC3::andExpr(), CVC3::Theory::assignValue(), CVC3::ExprHashMap< Data >::begin(), CVC3::CDList< T >::begin(), d_applicationsInModel, d_funApplications, DebugAssert, CVC3::ExprHashMap< Data >::end(), CVC3::CDList< T >::end(), CVC3::Theory::getEM(), CVC3::Theorem::getLHS(), CVC3::Theory::getModelValue(), CVC3::Theorem::getRHS(), CVC3::Expr::getType(), CVC3::int2string(), CVC3::Expr::iteExpr(), lambdaExpr(), CVC3::ExprManager::newBoundVarExpr(), CVC3::Theory::reflexivityRule(), CVC3::Expr::setType(), CVC3::ExprHashMap< Data >::size(), CVC3::Theory::substitutivityRule(), CVC3::Theory::symmetryRule(), CVC3::Expr::toString(), and CVC3::Theory::transitivityRule().
Compute and cache the TCC of e.
e | is an expression (term or formula). This function computes the TCC of e which is true iff the expression is defined. |
The default implementation is to compute TCCs recursively for all children, and return their conjunction.
Reimplemented from CVC3::Theory.
Definition at line 541 of file theory_uf.cpp.
References CVC3::andExpr(), CVC3::APPLY, CVC3::Expr::arity(), CVC3::Theory::computeTCC(), DebugAssert, CVC3::Op::getExpr(), CVC3::Expr::getKids(), CVC3::Expr::getKind(), CVC3::Expr::getOp(), CVC3::Theorem::getRHS(), CVC3::Theory::getTCC(), CVC3::Theory::getTypePred(), CVC3::Expr::isApply(), CVC3::LAMBDA, lambdaExpr(), CVC3::LETDECL, CVC3::Expr::mkOp(), CVC3::Theory::rewriteAnd(), CVC3::Expr::toString(), and CVC3::Theory::trueExpr().
Theory-specific parsing implemented by the DP.
Reimplemented from CVC3::Theory.
Definition at line 906 of file theory_uf.cpp.
References CVC3::Theory::addBoundVar(), CVC3::Expr::arity(), CVC3::ARROW, CVC3::Expr::begin(), DebugAssert, CVC3::Expr::end(), CVC3::Expr::getEM(), CVC3::Theory::getEM(), CVC3::ExprManager::getKind(), CVC3::Expr::getKind(), CVC3::Expr::getString(), CVC3::ID, CVC3::Expr::isNull(), CVC3::LAMBDA, lambdaExpr(), CVC3::Expr::mkOp(), CVC3::OLD_ARROW, CVC3::Theory::parseExpr(), CVC3::RAW_LIST, CVC3::Theory::resolveID(), CVC3::Theory::theoryCore(), CVC3::Expr::toString(), CVC3::TRANS_CLOSURE, transClosureExpr(), CVC3::TUPLE_TYPE, and CVC3::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 CVC3::Theory.
Definition at line 608 of file theory_uf.cpp.
References CVC3::APPLY, CVC3::Expr::arity(), CVC3::ARROW, CVC3::Expr::begin(), CVC3::BOOLEAN, CVC3::Theory::d_theoryUsed, CVC3::ExprStream::dagFlag(), DebugAssert, CVC3::Expr::end(), CVC3::Translator::fixConstName(), CVC3::Expr::getBody(), CVC3::Theory::getEM(), CVC3::Op::getExpr(), CVC3::Expr::getKind(), CVC3::Expr::getName(), CVC3::Expr::getOp(), CVC3::Expr::getOpExpr(), CVC3::Expr::getOpKind(), CVC3::Expr::getString(), CVC3::TheoryCore::getTranslator(), CVC3::Expr::getVars(), CVC3::Expr::isApply(), CVC3::Expr::isLambda(), CVC3::Expr::isString(), CVC3::Expr::isSymbol(), CVC3::LAMBDA, CVC3::ExprStream::lang(), CVC3::LISP_LANG, CVC3::OLD_ARROW, CVC3::pop(), CVC3::popdag(), CVC3::PRESENTATION_LANG, CVC3::Expr::print(), CVC3::Expr::printAST(), CVC3::push(), CVC3::pushdag(), CVC3::SIMPLIFY_LANG, CVC3::SMTLIB_LANG, CVC3::space(), CVC3::Theory::theoryCore(), CVC3::to_lower(), CVC3::TPTP_LANG, CVC3::TRANS_CLOSURE, CVC3::TYPEDECL, and CVC3::UFUNC.
Create a new LAMBDA-abstraction.
Definition at line 1020 of file theory_uf.cpp.
References CVC3::Theory::getEM(), CVC3::LAMBDA, and CVC3::ExprManager::newClosureExpr().
Referenced by computeModel(), computeTCC(), and parseExprOp().
Create a transitive closure expression.
Definition at line 1025 of file theory_uf.cpp.
References CVC3::Theory::getEM(), and CVC3::TRANS_CLOSURE.
Referenced by parseExprOp(), and CVC3::UFTheoremProducer::relToClosure().
UFProofRules* CVC3::TheoryUF::d_rules [private] |
Definition at line 48 of file theory_uf.h.
Referenced by assertFact(), checkSat(), rewrite(), TheoryUF(), update(), and ~TheoryUF().
const bool& CVC3::TheoryUF::d_applicationsInModel [private] |
Flag to include function applications to the concrete model.
Definition at line 50 of file theory_uf.h.
Referenced by computeModel().
ExprMap<TCMapPair*> CVC3::TheoryUF::d_transClosureMap [private] |
CDList<Expr> CVC3::TheoryUF::d_funApplications [private] |
Backtracking list of function applications.
Used for building concrete models and beta-reducing lambda-expressions.
Definition at line 63 of file theory_uf.h.
Referenced by checkSat(), computeModel(), computeModelTerm(), and setup().
CDO<size_t> CVC3::TheoryUF::d_funApplicationsIdx [private] |
Pointer to the last unprocessed element (for lambda expansions).
Definition at line 65 of file theory_uf.h.
Referenced by checkSat().