Abstract Theory Interface
[Theories]

Collaboration diagram for Abstract Theory Interface:

Abstract Theory Interface. More...

Functions


Detailed Description

Abstract Theory Interface.

These are the theory-specific methods which provide the decision procedure functionality for a new theory. At the very least, a theory must implement the checkSat method. The other methods can be used to make the implementation more convenient. For more information on this API, see Clark Barrett's PhD dissertation and HOWTO Write a Decision Procedure in CVC Lite.


Function Documentation

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

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryQuant, and CVCL::TheoryUF.

Definition at line 133 of file theory.h.

Referenced by TheoryCore::collectBasicVars(), and TheoryCore::setupTerm().

virtual void CVCL::Theory::assertFact const Theorem e  )  [pure virtual, inherited]
 

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.

Implemented in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryQuant, CVCL::TheoryRecords, CVCL::TheorySimulate, and CVCL::TheoryUF.

Referenced by TheoryCore::assertFormula().

virtual void CVCL::Theory::checkSat bool  fullEffort  )  [pure virtual, inherited]
 

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.

Implemented in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryDatatypeLazy, CVCL::TheoryQuant, CVCL::TheoryRecords, CVCL::TheorySimulate, and CVCL::TheoryUF.

virtual Theorem CVCL::Theory::rewrite const Expr e  )  [inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryRecords, CVCL::TheorySimulate, and CVCL::TheoryUF.

Definition at line 165 of file theory.h.

References CVCL::Theory::reflexivityRule().

Referenced by TheoryCore::rewriteCore().

virtual void CVCL::Theory::setup const Expr e  )  [inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryDatatypeLazy, CVCL::TheoryQuant, CVCL::TheoryRecords, and CVCL::TheoryUF.

Definition at line 173 of file theory.h.

Referenced by TheoryCore::setupTerm().

virtual void CVCL::Theory::update const Theorem e,
const Expr d
[inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryDatatypeLazy, CVCL::TheoryQuant, CVCL::TheoryRecords, and CVCL::TheoryUF.

Definition at line 190 of file theory.h.

Referenced by TheoryCore::processNotify().

virtual Theorem CVCL::Theory::solve const Theorem e  )  [inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, and CVCL::TheoryDatatype.

Definition at line 205 of file theory.h.

Referenced by TheoryCore::solve().

Theorem Theory::simplifyOp const Expr e  )  [virtual, inherited]
 

Recursive simplification step.

INVARIANT: the result is a Theorem(e=e'), where e' is a fully simplified version of e. To simplify subexpressions recursively, call simplify() function.

This theory-specific method is called when the simplifier descends top-down into the expression. Normally, every kid is simplified recursively, and the results are combined into the new parent with the same operator (Op). This functionality is provided with the default implementation.

However, in some expressions some kids may not matter in the result, and can be skipped. For instance, if the first kid in a long AND simplifies to FALSE, then the entire expression simplifies to FALSE, and the remaining kids do not need to be simplified.

This call is a chance for a DP to provide these types of optimizations during the top-down phase of simplification.

Reimplemented in CVCL::TheoryBitvector, and CVCL::TheoryCore.

Definition at line 60 of file theory.cpp.

References CVCL::Expr::arity(), CVCL::Theory::d_commonRules, CVCL::Theorem::getLHS(), CVCL::Theorem::getRHS(), CVCL::Theory::reflexivityRule(), CVCL::Theory::simplifyRec(), and CVCL::CommonProofRules::substitutivityRule().

Referenced by TheoryCore::simplifyFullRec().

virtual void CVCL::Theory::checkType const Expr e  )  [inline, virtual, inherited]
 

Check that e is a valid Type expr.

Reimplemented in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryRecords, and CVCL::TheoryUF.

Definition at line 235 of file theory.h.

References CVCL::Expr::toString().

Referenced by CVCL::TypeComputerCore::checkType().

virtual void CVCL::Theory::computeType const Expr e  )  [inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryQuant, CVCL::TheoryRecords, CVCL::TheorySimulate, and CVCL::TheoryUF.

Definition at line 245 of file theory.h.

Referenced by CVCL::TypeComputerCore::computeType().

virtual Type CVCL::Theory::computeBaseType const Type tp  )  [inline, virtual, inherited]
 

Compute the base type of the top-level operator of an arbitrary type.

Reimplemented in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryCore, CVCL::TheoryRecords, and CVCL::TheoryUF.

Definition at line 247 of file theory.h.

Referenced by CVCL::Theory::getBaseType().

virtual Expr CVCL::Theory::computeTypePred const Type t,
const Expr e
[inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryBitvector, CVCL::TheoryCore, and CVCL::TheoryRecords.

Definition at line 257 of file theory.h.

References CVCL::Expr::getEM(), and CVCL::ExprManager::trueExpr().

Referenced by TheoryCore::computeTypePred(), and CVCL::Theory::getTypePred().

Expr Theory::computeTCC const Expr e  )  [virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryQuant, CVCL::TheoryRecords, CVCL::TheorySimulate, and CVCL::TheoryUF.

Definition at line 80 of file theory.cpp.

References CVCL::andExpr(), CVCL::Expr::begin(), CVCL::Theory::d_commonRules, CVCL::Expr::end(), CVCL::Theorem::getRHS(), CVCL::Theory::getTCC(), CVCL::CommonProofRules::rewriteAnd(), and CVCL::Theory::trueExpr().

Referenced by CVCL::TheoryUF::computeTCC(), CVCL::TheoryRecords::computeTCC(), CVCL::TheoryDatatype::computeTCC(), TheoryCore::computeTCC(), CVCL::TheoryBitvector::computeTCC(), CVCL::TheoryArray::computeTCC(), CVCL::TheoryArith::computeTCC(), and CVCL::Theory::getTCC().

virtual Expr CVCL::Theory::parseExprOp const Expr e  )  [inline, virtual, inherited]
 

Theory-specific parsing implemented by the DP.

Reimplemented in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryQuant, CVCL::TheoryRecords, and CVCL::TheoryUF.

Definition at line 274 of file theory.h.

Referenced by TheoryCore::parseExpr().

virtual ExprStream& CVCL::Theory::print ExprStream os,
const Expr e
[inline, virtual, inherited]
 

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryCore, CVCL::TheoryDatatype, CVCL::TheoryQuant, CVCL::TheoryRecords, CVCL::TheorySimulate, and CVCL::TheoryUF.

Definition at line 284 of file theory.h.

References CVCL::Expr::printAST().

Referenced by CVCL::PrettyPrinterCore::print().

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

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryDatatype, CVCL::TheoryRecords, and CVCL::TheoryUF.

virtual void CVCL::Theory::refineCounterExample  )  [inline, virtual, inherited]
 

Process disequalities from the arrangement for model generation.

Reimplemented in CVCL::TheoryArith, and CVCL::TheoryCore.

Definition at line 292 of file theory.h.

virtual void CVCL::Theory::computeModelBasic const std::vector< Expr > &  v  )  [inline, virtual, inherited]
 

Assign concrete values to basic-type variables in v.

Reimplemented in CVCL::TheoryArith, and CVCL::TheoryCore.

Definition at line 294 of file theory.h.

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

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 in CVCL::TheoryArith, CVCL::TheoryArray, CVCL::TheoryBitvector, CVCL::TheoryRecords, and CVCL::TheoryUF.

Definition at line 316 of file theory.h.

References CVCL::Theory::assignValue(), and CVCL::Theory::find().

Referenced by TheoryCore::collectModelValues().

virtual void CVCL::Theory::assertTypePred const Expr e,
const Theorem pred
[inline, virtual, inherited]
 

Receives all the type predicates for the types of the given theory.

Type predicates may be expensive to enqueue eagerly, and DPs may choose to postpone them, or transform them to something more efficient. By default, the asserted type predicate is immediately enqueued as a new fact.

Note: Used only by bitvector theory.

Parameters:
e is the expression for which the type predicate is computed
pred is the predicate theorem P(e)

Reimplemented in CVCL::TheoryBitvector.

Definition at line 332 of file theory.h.

References CVCL::Theory::enqueueFact().

Referenced by TheoryCore::setupTerm().

virtual Theorem CVCL::Theory::rewriteAtomic const Expr e  )  [inline, virtual, inherited]
 

Theory-specific rewrites for atomic formulas.

The intended use is to convert complex atomic formulas into an equivalent Boolean combination of simpler formulas. Such conversion may be harmful for algebraic rewrites, and is not always desirable to have in rewrite() method.

Note: Used only by bitvector theory and rewriteLiteral in core.

However, if rewrite() alone cannot solve the problem, and the SAT solver needs to be envoked, these additional rewrites may ease the job for the SAT solver.

Reimplemented in CVCL::TheoryBitvector.

Definition at line 347 of file theory.h.

References CVCL::Theory::reflexivityRule().

Referenced by TheoryCore::rewriteLiteral().

virtual void CVCL::Theory::notifyInconsistent const Theorem thm  )  [inline, virtual, inherited]
 

Notification of conflict.

Decision procedures implement this method when they want to be notified about a conflict.

Note: Used only by quantifier theory

Parameters:
thm is the theorem of FALSE given to setInconsistent()

Reimplemented in CVCL::TheoryQuant.

Definition at line 358 of file theory.h.


Generated on Thu Apr 13 16:57:40 2006 for CVC Lite by  doxygen 1.4.4