#include <theory_core.h>
Inheritance diagram for CVCL::TheoryCore:
Author: Clark Barrett
Created: Sat Feb 8 14:54:05 2003
Definition at line 54 of file theory_core.h.
|
Constructor.
|
|
Destructor.
|
|
Command line flag whether to dump debugging info on every new fact.
Referenced by TheoryCore::addFact(), TheoryCore::assertFactCore(), TheoryCore::assertFormula(), TheoryCore::checkSat(), TheoryCore::checkSATCore(), TheoryCore::collectModelValues(), TheoryCore::computeType(), TheoryCore::enqueueEquality(), TheoryCore::enqueueFact(), TheoryCore::processEquality(), TheoryCore::processFactQueue(), TheoryCore::registerAtom(), TheoryCore::rewriteCore(), TheoryCore::setupTerm(), TheoryCore::simplify(), TheoryCore::simplifyFullRec(), TheoryCore::simplifyOp(), and TheoryCore::solve(). |
|
|
|
|
|
|
|
|
|
Set the find pointer of an atomic formula and notify SearchEngine.
|
|
Derived rule for rewriting ITE.
|
|
Core rewrites for literals (NOT and EQ).
Referenced by TheoryCore::rewrite(), and TheoryCore::rewriteCore(). |
|
Rewrite n levels deep. WARNING: no caching here, be careful.
Referenced by TheoryCore::rewrite(), and TheoryCore::rewriteN(). |
|
An auxiliary function for assertEqualities(); return true if inconsistency is derived.
Referenced by TheoryCore::assertEqualities(), and TheoryCore::processEquality(). |
|
Private method to get a new theorem producer. This method is used ONLY by the TheoryCore constructor. The only reason to have this method is to separate the trusted part of the constructor into a separate .cpp file (Alternative is to make the entire constructer trusted, which is not very safe). |
|
Enqueue a fact to be sent to the SearchEngine.
Referenced by TheoryCore::assertFactCore(), and TheoryCore::assertFormula(). |
|
Fetch the concrete assignment to the variable during model generation.
Reimplemented from CVCL::Theory. Referenced by TheoryCore::collectModelValues(), and CVCL::Theory::getModelValue(). |
|
Create a new equiv. check Expr (private, only TheoryCore can do that).
|
|
An auxiliary recursive function to process COND expressions into ITE.
Referenced by TheoryCore::parseExprOp(), and TheoryCore::processCond(). |
|
Request a unit of resource. It will be subtracted from the resource limit.
Referenced by TheoryCore::enqueueFact(). |
|
Register a SatAPI for TheoryCore.
Definition at line 279 of file theory_core.h. References d_coreSatAPI. Referenced by CVCL::SearchImplBase::SearchImplBase(), and CVCL::SearchSat::SearchSat(). |
|
Check if the expr is Equiv. Check Expr.
|
|
Access LHS of the equiv. check expr.
|
|
Access RHS of the equiv. check expr.
|
|
|
Definition at line 297 of file theory_core.h. References d_tm. Referenced by CVCL::SearchEngine::createRules(), CVCL::SearchImplBase::getAssumptionsUsed(), CVCL::SearchImplBase::getProof(), and CVCL::SearchSat::SearchSat(). |
|
|
Definition at line 299 of file theory_core.h. References d_statistics. Referenced by CVCL::SearchImplBase::addToCNFCache(), CVCL::SearchImplBase::findInCNFCache(), and CVCL::SearchEngineFast::split(). |
|
Definition at line 300 of file theory_core.h. References d_exprTrans. Referenced by CVCL::SearchSat::check(), CVCL::SearchSimple::checkValidInternal(), CVCL::SearchEngineFast::checkValidInternal(), and CVCL::SearchImplBase::newUserAssumption(). |
|
Definition at line 301 of file theory_core.h. References d_rules. Referenced by CVCL::ExprTransform::ExprTransform(). |
|
Get list of terms.
Definition at line 304 of file theory_core.h. References d_terms. Referenced by CVCL::TheoryQuant::goodSynMatch(), CVCL::TheoryQuant::naiveCheckSat(), CVCL::TheoryQuant::semCheckSat(), and CVCL::TheoryQuant::synCheckSat(). |
|
Variables of uninterpreted types may be sent here, and they should be ignored. Reimplemented from CVCL::Theory. Definition at line 309 of file theory_core.h. |
|
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. |
|
Check for satisfiability in the theory.
Implements CVCL::Theory. |
|
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. Referenced by TheoryCore::rewrite(), and TheoryCore::rewriteN(). |
|
Set up the term e for call-backs when e or its children change. setup is called once for each expression associated with the theory. It is typically used to setup theory-specific data for an expression and to add call-back information for use with update.
Reimplemented from CVCL::Theory. |
|
Notify a theory of a new equality. update is a call-back used by the notify mechanism of the core theory. It works as follows. When an equation t1 = t2 makes it into the core framework, the two find equivalence classes for t1 and t2 are merged. The result is that t2 is the new equivalence class representative and t1 is no longer an equivalence class representative. When this happens, the notify list of t1 is traversed. Notify list entries consist of a theory and an expression d. For each entry (i,d), i->update(e, d) is called, where e is the theorem corresponding to the equality t1=t2. To add the entry (i,d) to a term t1's notify list, a call must be made to t1.addNotify(i,d). This is typically done in setup.
Reimplemented from CVCL::Theory. |
|
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. Referenced by TheoryCore::assertFactCore(). |
|
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 from CVCL::Theory. Referenced by TheoryCore::simplifyOp(). |
|
Check that e is a valid Type expr.
Reimplemented from CVCL::Theory. |
|
Compute and store the type of e.
Reimplemented from CVCL::Theory. |
|
Compute the base type of the top-level operator of an arbitrary type.
Reimplemented from CVCL::Theory. |
|
Compute and cache the TCC of e.
The default implementation is to compute TCCs recursively for all children, and return their conjunction. Reimplemented from CVCL::Theory. |
|
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. |
|
Theory-specific parsing implemented by the DP.
Reimplemented from CVCL::Theory. |
|
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. |
|
Calls for other theories to add facts to refine a coutnerexample.
Reimplemented from CVCL::Theory. Referenced by CVCL::SearchEngine::getConcreteModel(). |
|
Assign concrete values to basic-type variables in v.
Reimplemented from CVCL::Theory. |
|
Set the resource limit (0==unlimited).
|
|
Check if the current context is inconsistent.
Reimplemented from CVCL::Theory. Definition at line 335 of file theory_core.h. References d_inconsistent. Referenced by CVCL::SearchEngineFast::bcp(), TheoryCore::buildModel(), CVCL::SearchSimple::checkValidRec(), TheoryCore::enqueueFact(), CVCL::Theory::inconsistent(), TheoryCore::refineCounterExample(), and CVCL::SearchEngineFast::split(). |
|
Get the proof of inconsistency for the current context.
Definition at line 338 of file theory_core.h. References d_incThm. Referenced by CVCL::SearchEngineFast::bcp(), TheoryCore::buildModel(), CVCL::SearchSimple::checkValidRec(), CVCL::SearchEngine::getConcreteModel(), and TheoryCore::refineCounterExample(). |
|
Add a new assertion to the core from the user or a SAT solver. Do NOT use it in a decision procedure; use enqueueFact().
Referenced by CVCL::SearchSat::assertLit(), TheoryCore::assignValue(), CVCL::SearchSimple::checkValidInternal(), CVCL::SearchEngineFast::commitFacts(), CVCL::SearchSat::newUserAssumption(), CVCL::SearchImplBase::newUserAssumption(), CVCL::Circuit::propagate(), CVCL::DecisionEngine::pushDecision(), CVCL::SearchSimple::restartInternal(), CVCL::SearchEngineFast::restartInternal(), and CVCL::SearchEngineFast::split(). |
|
Top-level simplifier.
Reimplemented from CVCL::Theory. Referenced by TheoryCore::assertFactCore(), CVCL::ExprTransform::preprocess(), TheoryCore::processUpdates(), TheoryCore::registerAtom(), CVCL::Theory::simplify(), CVCL::SearchImplBase::simplify(), and CVCL::SearchEngineFast::split(). |
|
To be called by SearchEngine when it believes the context is satisfiable.
Referenced by CVCL::SearchSimple::checkValidRec(), and CVCL::SearchEngineFast::split(). |
|
Register an atomic formula of interest. If e or its negation is later deduced, we will add the implied literal to d_impliedLiterals Referenced by CVCL::SearchSat::addLemma(), CVCL::SearchSat::check(), CVCL::SearchSat::registerAtom(), and CVCL::SearchImplBase::registerAtom(). |
|
Return the next implied literal (NULL Theorem if none).
Referenced by CVCL::SearchSat::getImplication(), and CVCL::SearchImplBase::getImpliedLiteral(). |
|
Return total number of implied literals.
Definition at line 366 of file theory_core.h. References d_impliedLiterals, and CVCL::CDList< T >::size(). |
|
Return an implied literal by index.
Referenced by CVCL::SearchSat::getImpliedLiteral(). |
|
Check if the current decision branch is marked as incomplete.
Definition at line 372 of file theory_core.h. References d_incomplete, and CVCL::CDMap< Key, Data, HashFcn >::size(). |
|
Check if the branch is incomplete, and return the reasons (strings).
|
|
Called by search engine.
Referenced by CVCL::SearchImplBase::replaceITE(). |
|
Parse the generic expression. This method should be used in parseExprOp() for recursive calls to subexpressions, and is the method called by the command processor. Reimplemented from CVCL::Theory. Referenced by TheoryCore::parseExpr(), CVCL::Theory::parseExpr(), TheoryCore::parseExprOp(), parseExprTop(), and TheoryCore::processCond(). |
|
Top-level call to parseExpr, clears the bound variable stack. Use it in VCL instead of parseExpr(). Definition at line 387 of file theory_core.h. References d_boundVarStack, and parseExpr(). |
|
Assign t a concrete value val. Used in model generation.
Reimplemented from CVCL::Theory. Referenced by CVCL::Theory::assignValue(), TheoryCore::buildModel(), TheoryCore::collectModelValues(), and TheoryCore::computeModelBasic(). |
|
Record a derived assignment to a variable (LHS).
Reimplemented from CVCL::Theory. |
|
Adds expression to var database.
Referenced by CVCL::TheoryArray::renameExpr(). |
|
Split compound vars into basic type variables. The results are saved in d_basicModelVars and d_simplifiedModelVars. Also, add new basic vars as shared terms whenever their type belongs to a different theory than the term itself. Referenced by CVCL::SearchEngine::getConcreteModel(). |
|
Calls theory specific computeModel, results are placed in map.
Referenced by CVCL::SearchEngine::getConcreteModel(). |
|
Recursively build a compound-type variable assignment for e.
Referenced by TheoryCore::buildModel(), and TheoryCore::collectModelValues(). |
|
Return BOOLEAN type.
Reimplemented from CVCL::Theory. Referenced by CVCL::Theory::typePred(). |
|
Compute and cache the subtyping predicates for the expression. Note: e caches the conjunction of all predicates for its subexpressions. So, when doing a look-up, it is sufficient to assert just the predicate for the top-level e, without traversing e recursively. Reimplemented from CVCL::Theory. Referenced by TheoryCore::subtypePredicate(), and CVCL::Theory::subtypePredicate(). |
|
Enqueue a new fact.
Reimplemented from CVCL::Theory. Referenced by CVCL::SearchImplBase::addCNFFact(), TheoryCore::addFact(), CVCL::SearchEngineFast::addNonLiteralFact(), TheoryCore::assertFactCore(), TheoryCore::assertFormula(), CVCL::SearchEngineFast::commitFacts(), and CVCL::Theory::enqueueFact(). |
|
Make the context inconsistent; The formula proved by e must FALSE.
Reimplemented from CVCL::Theory. Referenced by TheoryCore::assertFactCore(), TheoryCore::assertFormula(), TheoryCore::checkSat(), TheoryCore::enqueueFact(), TheoryCore::processEquality(), CVCL::Theory::setInconsistent(), CVCL::SearchEngineFast::setInconsistent(), and TheoryCore::setupTerm(). |
|
Setup additional terms within a theory-specific setup().
Referenced by TheoryCore::assertFormula(), CVCL::TheoryArray::setup(), CVCL::TheoryBitvector::setupExpr(), TheoryCore::setupSubFormulas(), TheoryCore::setupTerm(), and CVCL::TheoryBitvector::update(). |
|
Enqueue a new equality.
Reimplemented from CVCL::Theory. Referenced by TheoryCore::assertEqualities(), and CVCL::Theory::enqueueEquality(). |
|
Assert a system of equations (1 or more). e is either a single equation, or a conjunction of equations Reimplemented from CVCL::Theory. Referenced by CVCL::Theory::assertEqualities(), and TheoryCore::assertFactCore(). |
|
Mark the branch as incomplete.
Reimplemented from CVCL::Theory. Referenced by TheoryCore::enqueueFact(). |
|
A helper function for addFact().
Referenced by TheoryCore::addFact(), TheoryCore::checkSATCore(), and TheoryCore::setupSubFormulas(). |
|
Process a notify list triggered as a result of new theorem e.
Referenced by TheoryCore::assertEqualities(), and TheoryCore::assertFormula(). |
|
The recursive simplifier (to be used only in DP-specific simplifyOp()).
Reimplemented from CVCL::Theory. Referenced by TheoryCore::rewrite(), TheoryCore::simplify(), TheoryCore::simplifyFullRec(), TheoryCore::simplifyInPlaceRec(), TheoryCore::simplifyOp(), and CVCL::Theory::simplifyRec(). |
|
The full recursive simplifier.
Referenced by TheoryCore::simplify(). |
|
The recursive simplifier with the in-place rewriting optimization.
Referenced by TheoryCore::simplify(), and TheoryCore::simplifyInPlaceRec(). |
|
Transitive composition of other rewrites with the above.
Referenced by TheoryCore::rewrite(), TheoryCore::rewriteCore(), TheoryCore::simplifyFullRec(), and TheoryCore::simplifyInPlaceRec(). |
|
Helper for registerAtom.
Referenced by TheoryCore::registerAtom(), and TheoryCore::setupSubFormulas(). |
|
Process updates recorded by calls to update().
Referenced by TheoryCore::assertEqualities(), and TheoryCore::assertFactCore(). |
|
The assumptions for e must be in H or phi. "Core" added to avoid conflict with theory interface function name.
Referenced by TheoryCore::assertFactCore(), and TheoryCore::processFactQueue(). |
|
Process a newly derived formula.
Referenced by TheoryCore::assertEqualities(), and TheoryCore::assertFactCore(). |
|
Returns phi |= e = rewriteCore(e). "Core" added to avoid conflict with theory interface function name.
|
|
|
|
Referenced by CVCL::VCL::deriveClosure(). |
|
Definition at line 55 of file theory_core.h. |
|
So we get notified every time there's a pop.
Definition at line 165 of file theory_core.h. |
|
Context manager.
Definition at line 58 of file theory_core.h. Referenced by TheoryCore::enqueueEquality(), TheoryCore::enqueueFact(), and getCM(). |
|
Theorem manager.
Definition at line 61 of file theory_core.h. Referenced by getTM(). |
|
Core proof rules.
Definition at line 64 of file theory_core.h. Referenced by getCoreRules(), TheoryCore::implIntro3(), TheoryCore::queryTCC(), TheoryCore::rewrite(), TheoryCore::rewriteIte(), TheoryCore::setupTerm(), TheoryCore::simplifyOp(), TheoryCore::subtypePredicate(), TheoryCore::typePred(), and TheoryCore::~TheoryCore(). |
|
Reference to command line flags.
Definition at line 67 of file theory_core.h. Referenced by getFlags(). |
|
Reference to statistics.
Definition at line 70 of file theory_core.h. Referenced by getStatistics(). |
|
PrettyPrinter (we own it).
Definition at line 73 of file theory_core.h. Referenced by TheoryCore::~TheoryCore(). |
|
Type Computer.
Definition at line 76 of file theory_core.h. Referenced by TheoryCore::~TheoryCore(). |
|
Expr Transformer.
Definition at line 79 of file theory_core.h. Referenced by getExprTrans(), TheoryCore::simplifyOp(), and TheoryCore::~TheoryCore(). |
|
Assertion queue.
Definition at line 82 of file theory_core.h. Referenced by TheoryCore::addFact(), TheoryCore::checkSATCore(), TheoryCore::enqueueFact(), and TheoryCore::processFactQueue(). |
|
Queue of facts to be sent to the SearchEngine.
Definition at line 84 of file theory_core.h. Referenced by TheoryCore::addFact(), TheoryCore::checkSATCore(), TheoryCore::processFactQueue(), and TheoryCore::setInconsistent(). |
|
Equality queue. Contains Theorems in the form of e1==e2, where e2 is i-leaf simplified in the current context.
Definition at line 93 of file theory_core.h. Referenced by TheoryCore::assertEqualities(), and TheoryCore::enqueueEquality(). |
|
Inconsistent flag.
Definition at line 96 of file theory_core.h. Referenced by TheoryCore::addFact(), TheoryCore::checkSATCore(), inconsistent(), TheoryCore::processFactQueue(), and TheoryCore::setInconsistent(). |
|
The set of reasons for incompleteness (empty when we are complete).
Definition at line 98 of file theory_core.h. Referenced by incomplete(), TheoryCore::incomplete(), and TheoryCore::setIncomplete(). |
|
List of known disequalities (to be processed at every checkSat() call).
Definition at line 100 of file theory_core.h. Referenced by TheoryCore::assertFormula(), and TheoryCore::checkSat(). |
|
Proof of inconsistent.
Definition at line 103 of file theory_core.h. Referenced by inconsistentThm(), and TheoryCore::setInconsistent(). |
|
List of all active terms in the system (for quantifier instantiation).
Definition at line 105 of file theory_core.h. Referenced by getTerms(), and TheoryCore::setupTerm(). |
|
List of variables that were created up to this point.
Definition at line 107 of file theory_core.h. Referenced by TheoryCore::addToVarDB(), TheoryCore::buildModel(), and TheoryCore::collectBasicVars(). |
|
Database of declared identifiers.
Definition at line 109 of file theory_core.h. |
|
Bound variable stack: a vector of pairs <name, var>.
Definition at line 111 of file theory_core.h. Referenced by TheoryCore::parseExpr(), and parseExprTop(). |
|
List of all terms that are shared between theories (alien subterms). Maps each shared term to its own theory. Definition at line 115 of file theory_core.h. Referenced by TheoryCore::collectBasicVars(), and TheoryCore::setupTerm(). |
|
Definition at line 117 of file theory_core.h. Referenced by TheoryCore::setupTerm(). |
|
Array of registered theories.
Definition at line 120 of file theory_core.h. Referenced by TheoryCore::buildModel(), TheoryCore::checkSATCore(), CVCL::Theory::getNumTheories(), TheoryCore::processFactQueue(), TheoryCore::refineCounterExample(), and TheoryCore::setInconsistent(). |
|
Array mapping kinds to theories.
Definition at line 123 of file theory_core.h. Referenced by CVCL::Theory::hasTheory(), and CVCL::Theory::theoryOf(). |
|
The theory which has the solver (if any).
Definition at line 126 of file theory_core.h. Referenced by TheoryCore::solve(). |
|
Mapping of compound type variables to simpler types (model generation).
Definition at line 129 of file theory_core.h. Referenced by TheoryCore::collectBasicVars(), and TheoryCore::collectModelValues(). |
|
Mapping of intermediate variables to their valies.
Definition at line 131 of file theory_core.h. Referenced by TheoryCore::assignValue(), TheoryCore::buildModel(), TheoryCore::collectBasicVars(), and TheoryCore::collectModelValues(). |
|
List of basic variables (temporary storage for model generation).
Definition at line 133 of file theory_core.h. Referenced by TheoryCore::buildModel(), and TheoryCore::collectBasicVars(). |
|
Mapping of basic variables to simplified expressions (temp. storage). There may be some vars which simplify to something else; we save those separately, and keep only those which simplify to themselves. Once the latter vars are assigned, we'll re-simplify the former variables and use the results as concrete values. Definition at line 140 of file theory_core.h. Referenced by TheoryCore::buildModel(), TheoryCore::collectBasicVars(), and TheoryCore::collectModelValues(). |
|
Command line flag whether to simplify in place.
Definition at line 143 of file theory_core.h. Referenced by TheoryCore::simplify(), and TheoryCore::simplifyFullRec(). |
|
Which recursive simplifier to use.
Referenced by TheoryCore::simplify(), and TheoryCore::simplifyRec(). |
|
Command line flag whether to convert to CNF.
Definition at line 148 of file theory_core.h. |
|
Resource limit (0==unlimited, 1==no more resources, >=2 - available). Currently, it is the number of enqueued facts. Once the resource is exhausted, the remaining facts will be dropped, and an incomplete flag is set. Definition at line 155 of file theory_core.h. Referenced by TheoryCore::getResource(), and TheoryCore::setResourceLimit(). |
|
Definition at line 173 of file theory_core.h. |
|
Memory Manager index for equiv. check Expr.
Definition at line 178 of file theory_core.h. |
|
List of implied literals, based on registered atomic formulas of interest.
Definition at line 181 of file theory_core.h. Referenced by TheoryCore::getImpliedLiteral(), TheoryCore::getImpliedLiteralByIndex(), numImpliedLiterals(), TheoryCore::processUpdates(), and TheoryCore::registerAtom(). |
|
Next index in d_impliedLiterals that has not yet been fetched.
Definition at line 184 of file theory_core.h. Referenced by TheoryCore::getImpliedLiteral(). |
|
List of theorems from calls to update().
Definition at line 189 of file theory_core.h. Referenced by TheoryCore::addFact(), TheoryCore::processUpdates(), and TheoryCore::update(). |
|
List of data accompanying above theorems from calls to update().
Definition at line 192 of file theory_core.h. Referenced by TheoryCore::addFact(), TheoryCore::processUpdates(), and TheoryCore::update(). |
|
Definition at line 225 of file theory_core.h. Referenced by CVCL::Theory::addSplitter(), TheoryCore::assignValue(), TheoryCore::processFactQueue(), and registerCoreSatAPI(). |
|
Definition at line 241 of file theory_core.h. |