#include <theory_records.h>
Inheritance diagram for CVCL::TheoryRecords:
Author: Daniel Wichs
Created: 7/22/03
Definition at line 59 of file theory_records.h.
|
Constructor.
Definition at line 103 of file theory_records.cpp. References createProofRules(), d_rules, CVCL::Theory::getEM(), CVCL::ExprManager::newKind(), CVCL::RECORD, CVCL::RECORD_SELECT, CVCL::RECORD_TYPE, CVCL::RECORD_UPDATE, CVCL::Theory::registerTheory(), CVCL::TUPLE, CVCL::TUPLE_SELECT, CVCL::TUPLE_TYPE, and CVCL::TUPLE_UPDATE. |
|
Destructor Definition at line 132 of file theory_records.cpp. References d_rules. |
|
Auxiliary rewrites: Processing of AND and OR of equations. Returns e=e'. When a record/tuple (dis)equality is expanded into the (dis)equalities of fields, we have to perform rewrites on the resulting record terms before the simplifier kicks in. Otherwise, if we have r1.f = r2.f, but r1=r2 was asserted before, for some complex record expressions r1 and r2, then the simplifier will substitute r2 for r1, and we get r2.f=r2.f at the end, which is not a useful fact to have. However, r1.f and/or r2.f may rewrite to something interesting, and the equality may yield new important facts. Definition at line 52 of file theory_records.cpp. References CVCL::AND, CVCL::Expr::arity(), CVCL::EQ, CVCL::Expr::getFind(), CVCL::Expr::getKind(), CVCL::Theorem::getLHS(), CVCL::Theorem::getRHS(), CVCL::Expr::hasFind(), CVCL::IFF, CVCL::NOT, CVCL::OR, CVCL::Theory::reflexivityRule(), rewrite(), CVCL::Theory::substitutivityRule(), and CVCL::Theory::transitivityRule(). Referenced by assertFact(), and rewriteAux(). |
|
Takes Thm(e), returns Thm(e'), where e rewrites to e' by rewriteAux.
Definition at line 98 of file theory_records.cpp. References CVCL::Theorem::getExpr(), CVCL::Theory::iffMP(), and rewriteAux(). |
|
creates a reference to the proof rules
Definition at line 40 of file records_theorem_producer.cpp. References CVCL::Theory::theoryCore(). Referenced by TheoryRecords(). |
|
assert a fact to the theory of records
Implements CVCL::Theory. Definition at line 136 of file theory_records.cpp. References d_rules, CVCL::Theory::enqueueFact(), CVCL::EQ, CVCL::RecordsProofRules::expandEq(), CVCL::Theory::getBaseType(), CVCL::Type::getExpr(), CVCL::Theorem::getExpr(), CVCL::Expr::getKind(), CVCL::Expr::getOpKind(), CVCL::IFF, CVCL::NOT, CVCL::RECORD_TYPE, rewriteAux(), CVCL::Expr::toString(), CVCL::Theorem::toString(), CVCL::TRACE, and CVCL::TUPLE_TYPE. |
|
empty implementation to fit theory interface
Implements CVCL::Theory. Definition at line 77 of file theory_records.h. |
|
rewrites an expression e to one of several allowed forms
Reimplemented from CVCL::Theory. Definition at line 168 of file theory_records.cpp. References CVCL::Expr::arity(), d_rules, CVCL::Expr::getOpKind(), CVCL::Theorem::getRHS(), CVCL::RECORD, CVCL::RECORD_SELECT, CVCL::RECORD_UPDATE, CVCL::Theory::reflexivityRule(), CVCL::Theory::rewriteCC(), CVCL::RecordsProofRules::rewriteLitSelect(), CVCL::RecordsProofRules::rewriteLitUpdate(), CVCL::RecordsProofRules::rewriteUpdateSelect(), CVCL::Expr::toString(), CVCL::TRACE, CVCL::Theory::transitivityRule(), CVCL::TUPLE, CVCL::TUPLE_SELECT, and CVCL::TUPLE_UPDATE. Referenced by computeModelTerm(), rewriteAux(), setup(), and update(). |
|
check record or tuple type
Reimplemented from CVCL::Theory. Definition at line 351 of file theory_records.cpp. References CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Theory::getEM(), CVCL::Expr::getOpKind(), CVCL::Type::isFunction(), CVCL::RECORD_TYPE, and CVCL::TUPLE_TYPE. |
|
computes the type of a record or a tuple
Reimplemented from CVCL::Theory. Definition at line 381 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Theory::getBaseType(), CVCL::Theory::getEM(), CVCL::Type::getExpr(), getField(), getFieldIndex(), getFields(), getIndex(), CVCL::Expr::getOpKind(), CVCL::Expr::getType(), CVCL::RECORD, CVCL::RECORD_SELECT, CVCL::RECORD_TYPE, CVCL::RECORD_UPDATE, recordType(), CVCL::Expr::setType(), CVCL::Expr::toString(), CVCL::TUPLE, CVCL::TUPLE_SELECT, CVCL::TUPLE_TYPE, and CVCL::TUPLE_UPDATE. |
|
Compute the base type of the top-level operator of an arbitrary type.
Reimplemented from CVCL::Theory. Definition at line 477 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Theory::getBaseType(), CVCL::Type::getExpr(), CVCL::Expr::getOp(), CVCL::Expr::getOpKind(), CVCL::RECORD_TYPE, CVCL::Type::toString(), and CVCL::TUPLE_TYPE. |
|
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 319 of file theory_records.cpp. References CVCL::andExpr(), CVCL::Expr::arity(), CVCL::Type::getExpr(), getFields(), CVCL::Expr::getOpKind(), CVCL::Theory::getTypePred(), CVCL::RECORD_TYPE, recordSelect(), CVCL::TRACE, CVCL::TUPLE_TYPE, and tupleSelect(). |
|
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 268 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Type::getExpr(), getFields(), CVCL::Expr::getOpKind(), CVCL::Theorem::getRHS(), CVCL::Expr::getType(), CVCL::RECORD_TYPE, recordSelect(), rewrite(), CVCL::TUPLE_TYPE, and tupleSelect(). |
|
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.
Reimplemented from CVCL::Theory. Definition at line 288 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Theory::assignValue(), d_rules, CVCL::RecordsProofRules::expandRecord(), CVCL::RecordsProofRules::expandTuple(), CVCL::Theory::getBaseType(), CVCL::Type::getExpr(), CVCL::Theorem::getLHS(), CVCL::Theory::getModelValue(), CVCL::Expr::getOpKind(), CVCL::Theorem::getRHS(), CVCL::RECORD_TYPE, CVCL::Theory::substitutivityRule(), CVCL::Expr::toString(), CVCL::Theory::transitivityRule(), and CVCL::TUPLE_TYPE. |
|
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. Definition at line 235 of file theory_records.cpp. References CVCL::Expr::andExpr(), CVCL::Theory::computeTCC(), getField(), getFieldIndex(), getIndex(), CVCL::Theorem::getRHS(), CVCL::Theory::getTypePred(), CVCL::RECORD, CVCL::RECORD_SELECT, CVCL::RECORD_UPDATE, CVCL::Theory::rewriteAnd(), CVCL::TRACE, CVCL::TUPLE, CVCL::TUPLE_SELECT, and CVCL::TUPLE_UPDATE. |
|
Theory-specific parsing implemented by the DP.
Reimplemented from CVCL::Theory. Definition at line 872 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Expr::begin(), CVCL::Expr::end(), CVCL::Expr::getEM(), CVCL::Type::getExpr(), CVCL::ExprManager::getKind(), CVCL::Expr::getKind(), CVCL::Expr::getRational(), CVCL::Expr::getString(), CVCL::ID, CVCL::Rational::isInteger(), CVCL::Expr::isRational(), CVCL::Theory::parseExpr(), CVCL::RAW_LIST, CVCL::RECORD, CVCL::RECORD_SELECT, CVCL::RECORD_TYPE, CVCL::RECORD_UPDATE, recordExpr(), recordSelect(), recordType(), recordUpdate(), CVCL::Expr::toString(), CVCL::TRACE, CVCL::TUPLE, CVCL::TUPLE_SELECT, CVCL::TUPLE_TYPE, CVCL::TUPLE_UPDATE, tupleExpr(), tupleSelect(), tupleType(), and tupleUpdate(). |
|
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. Definition at line 501 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Expr::begin(), d_rules, CVCL::Expr::end(), CVCL::Theory::enqueueFact(), CVCL::RecordsProofRules::expandRecord(), CVCL::RecordsProofRules::expandTuple(), CVCL::Theory::find(), CVCL::Theory::getBaseType(), CVCL::Expr::getOpKind(), CVCL::Theorem::getRHS(), CVCL::Expr::hasFind(), CVCL::int2string(), CVCL::Theorem::isNull(), isRecordType(), CVCL::Expr::isTerm(), isTupleType(), CVCL::RECORD, rewrite(), CVCL::Expr::setFind(), CVCL::Theory::setupCC(), CVCL::Theory::substitutivityRule(), CVCL::Theory::symmetryRule(), CVCL::TRACE, CVCL::Theory::transitivityRule(), and CVCL::TUPLE. |
|
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. Definition at line 554 of file theory_records.cpp. References CVCL::Theory::enqueueEquality(), CVCL::Theory::find(), CVCL::Expr::getOpKind(), CVCL::Theorem::getRHS(), CVCL::Expr::hasFind(), CVCL::Theory::inconsistent(), CVCL::RECORD, rewrite(), CVCL::Theory::transitivityRule(), CVCL::TUPLE, CVCL::Theory::updateCC(), and CVCL::Theory::updateHelper(). |
|
pretty printing
Reimplemented from CVCL::Theory. Definition at line 577 of file theory_records.cpp. References CVCL::Expr::arity(), CVCL::Theory::d_theoryUsed, getField(), getFields(), getIndex(), CVCL::Expr::getOpKind(), isRecord(), isRecordAccess(), isRecordType(), isTupleAccess(), CVCL::ExprStream::lang(), CVCL::LISP_LANG, CVCL::pop(), CVCL::PRESENTATION_LANG, CVCL::Expr::printAST(), CVCL::push(), CVCL::RECORD, CVCL::RECORD_SELECT, CVCL::RECORD_TYPE, CVCL::RECORD_UPDATE, CVCL::SMTLIB_LANG, CVCL::space(), CVCL::TUPLE, CVCL::TUPLE_SELECT, CVCL::TUPLE_TYPE, and CVCL::TUPLE_UPDATE. |
|
Test whether expr is a record literal.
Definition at line 97 of file theory_records.h. References CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), and CVCL::RECORD. Referenced by print(). |
|
Test whether expr is a record type.
Definition at line 101 of file theory_records.h. References CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), and CVCL::RECORD_TYPE. Referenced by isRecordType(), CVCL::RecordsTheoremProducer::isRecordType(), print(), and setup(). |
|
Test whether expr is a record type.
Definition at line 105 of file theory_records.h. References CVCL::Type::getExpr(), and isRecordType(). |
|
Test whether expr is a record select/update subclass.
Definition at line 109 of file theory_records.h. References CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), CVCL::RECORD_SELECT, and CVCL::RECORD_UPDATE. Referenced by CVCL::RecordsTheoremProducer::isRecordAccess(), and print(). |
|
Create a record literal.
Definition at line 953 of file theory_records.cpp. References CVCL::Expr::begin(), and CVCL::Theory::getEM(). Referenced by parseExprOp(), and CVCL::RecordsTheoremProducer::recordExpr(). |
|
Create a record literal.
Definition at line 962 of file theory_records.cpp. References CVCL::RECORD. |
|
Create a record type.
Definition at line 969 of file theory_records.cpp. Referenced by computeType(), parseExprOp(), recordType(), and CVCL::RecordsTheoremProducer::recordType(). |
|
Create a record type (field types are given as a vector of Expr).
Definition at line 980 of file theory_records.cpp. References CVCL::Theory::getEM(), and recordType(). |
|
Create a record type (fields and types are given as a vector of Expr).
Definition at line 989 of file theory_records.cpp. References CVCL::RECORD_TYPE. |
|
Create a record field select expression.
Definition at line 996 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::RECORD_SELECT. Referenced by computeModelTerm(), computeTypePred(), parseExprOp(), and CVCL::RecordsTheoremProducer::recordSelect(). |
|
Create a record field update expression.
Definition at line 1002 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::RECORD_UPDATE. Referenced by parseExprOp(), and CVCL::RecordsTheoremProducer::recordUpdate(). |
|
Get the list of fields from a record literal.
Definition at line 1009 of file theory_records.cpp. References CVCL::AST_LANG, CVCL::Expr::getKids(), CVCL::Expr::getOpExpr(), CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), CVCL::RECORD, CVCL::RECORD_TYPE, and CVCL::Expr::toString(). Referenced by computeModelTerm(), computeType(), computeTypePred(), CVCL::RecordsTheoremProducer::getFields(), and print(). |
|
Get the i-th field name from the record literal or type.
Definition at line 1019 of file theory_records.cpp. References CVCL::Expr::getOpExpr(), CVCL::Expr::getOpKind(), CVCL::Expr::getString(), CVCL::Expr::isApply(), CVCL::RECORD, CVCL::RECORD_TYPE, and CVCL::Expr::toString(). Referenced by computeTCC(), computeType(), CVCL::RecordsTheoremProducer::getField(), and print(). |
|
Get the field index in the record literal or type. The field must be present in the record; otherwise it's an error. Referenced by computeTCC(), computeType(), and CVCL::RecordsTheoremProducer::getFieldIndex(). |
|
Get the field name from the record select and update expressions.
Definition at line 1041 of file theory_records.cpp. References CVCL::Expr::getName(), CVCL::Expr::getOpExpr(), CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), CVCL::RECORD_SELECT, and CVCL::RECORD_UPDATE. |
|
Create a tuple literal.
Definition at line 1050 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::TUPLE. Referenced by parseExprOp(), and CVCL::RecordsTheoremProducer::tupleExpr(). |
|
Create a tuple type.
Definition at line 1056 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::TUPLE_TYPE. Referenced by parseExprOp(), CVCL::VCL::tupleType(), and CVCL::RecordsTheoremProducer::tupleType(). |
|
Create a tuple type (types of components are given as Exprs).
Definition at line 1066 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::TUPLE_TYPE. |
|
Create a tuple index selector expression.
Definition at line 1072 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::TUPLE_SELECT. Referenced by computeModelTerm(), computeTypePred(), parseExprOp(), CVCL::RecordsTheoremProducer::tupleSelect(), and CVCL::VCL::tupleSelectExpr(). |
|
Create a tuple index update expression.
Definition at line 1078 of file theory_records.cpp. References CVCL::Theory::getEM(), and CVCL::TUPLE_UPDATE. Referenced by parseExprOp(), CVCL::RecordsTheoremProducer::tupleUpdate(), and CVCL::VCL::tupleUpdateExpr(). |
|
Get the index from the tuple select and update expressions.
Definition at line 1084 of file theory_records.cpp. References CVCL::Rational::getInt(), CVCL::Expr::getOpExpr(), CVCL::Expr::getOpKind(), CVCL::Expr::getRational(), CVCL::Expr::isApply(), CVCL::TUPLE_SELECT, and CVCL::TUPLE_UPDATE. Referenced by computeTCC(), computeType(), CVCL::RecordsTheoremProducer::getIndex(), and print(). |
|
Test whether expr is a tuple select/update subclass.
Definition at line 153 of file theory_records.h. References CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), CVCL::TUPLE_SELECT, and CVCL::TUPLE_UPDATE. Referenced by CVCL::RecordsTheoremProducer::isTupleAccess(), and print(). |
|
Test if expr is a tuple literal.
Definition at line 157 of file theory_records.h. References CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), and CVCL::TUPLE. |
|
Test if expr represents a tuple type.
Definition at line 159 of file theory_records.h. References CVCL::Expr::getOpKind(), CVCL::Expr::isApply(), and CVCL::TUPLE_TYPE. Referenced by isTupleType(), and setup(). |
|
Test if 'tp' is a tuple type.
Definition at line 162 of file theory_records.h. References CVCL::Type::getExpr(), and isTupleType(). |
|
Definition at line 60 of file theory_records.h. Referenced by assertFact(), computeModel(), rewrite(), setup(), TheoryRecords(), and ~TheoryRecords(). |