using namespace CVC4::theory;
TheoryModel::TheoryModel( context::Context* c, std::string name, bool enableFuncModels ) :
- d_substitutions(c), d_equalityEngine(c, name), d_enableFuncModels(enableFuncModels)
+ d_substitutions(c), d_equalityEngine(c, name), d_modelBuilt(c, false), d_enableFuncModels(enableFuncModels)
{
d_true = NodeManager::currentNM()->mkConst( true );
d_false = NodeManager::currentNM()->mkConst( false );
(a == d_false && (!polarity))) {
return;
}
- if( a.getKind()==EQUAL ){
+ if (a.getKind() == EQUAL) {
+ Trace("model-builder-assertions") << "(assert " << (polarity ? " " : "(not ") << a << (polarity ? ");" : "));") << endl;
d_equalityEngine.assertEquality( a, polarity, Node::null() );
- }else{
+ } else {
Trace("model-builder-assertions") << "(assert " << (polarity ? "" : "(not ") << a << (polarity ? ");" : "));") << endl;
d_equalityEngine.assertPredicate( a, polarity, Node::null() );
Assert(d_equalityEngine.consistent());
{
TheoryModel* tm = (TheoryModel*)m;
+ // buildModel with fullModel = true should only be called once in any context
+ Assert(!tm->d_modelBuilt);
+ tm->d_modelBuilt = fullModel;
+
// Reset model
tm->reset();
** See the file COPYING in the top-level source directory for licensing
** information.\endverbatim
**
- ** \brief The theory engine.
+ ** \brief The theory engine
**
** The theory engine.
**/
d_propEngine->checkTime();
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
#ifdef CVC4_FOR_EACH_THEORY_STATEMENT
#undef CVC4_FOR_EACH_THEORY_STATEMENT
}
// Must consult quantifiers theory for last call to ensure sat, or otherwise add a lemma
- if( effort == Theory::EFFORT_FULL &&
- ! d_inConflict &&
- ! d_lemmasAdded ) {
- if( d_logicInfo.isQuantified() ){
- //quantifiers engine must pass effort last call check
+ if( effort == Theory::EFFORT_FULL && ! d_inConflict && ! needCheck() ) {
+ if(d_logicInfo.isQuantified()) {
+ // quantifiers engine must pass effort last call check
d_quantEngine->check(Theory::EFFORT_LAST_CALL);
// if we have given up, then possibly flip decision
if(options::flipDecision()) {
- if(d_incomplete && !d_inConflict && !d_lemmasAdded) {
+ if(d_incomplete && !d_inConflict && !needCheck()) {
if( ((theory::quantifiers::TheoryQuantifiers*) d_theoryTable[THEORY_QUANTIFIERS])->flipDecision() ) {
d_incomplete = false;
}
}
}
- //if returning incomplete or SAT, we have ensured that the model in the quantifiers engine has been built
- }else if( options::produceModels() ){
- //must build model at this point
- d_curr_model_builder->buildModel( d_curr_model, true );
+ // if returning incomplete or SAT, we have ensured that the model in the quantifiers engine has been built
+ } else if(options::produceModels()) {
+ // must build model at this point
+ d_curr_model_builder->buildModel(d_curr_model, true);
}
}
// If fulleffort, check all theories
if(Dump.isOn("theory::fullcheck") && Theory::fullEffort(effort)) {
- if (!d_inConflict && !d_lemmasAdded) {
+ if (!d_inConflict && !needCheck()) {
dumpAssertions("theory::fullcheck");
}
}
void TheoryEngine::propagate(Theory::Effort effort) {
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
// Definition of the statement that is to be run by every theory
#ifdef CVC4_FOR_EACH_THEORY_STATEMENT
}
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
// Propagate for each theory using the statement above
CVC4_FOR_EACH_THEORY;
bool TheoryEngine::presolve() {
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
try {
// Definition of the statement that is to be run by every theory
void TheoryEngine::postsolve() {
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
try {
// Definition of the statement that is to be run by every theory
void TheoryEngine::notifyRestart() {
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
// Definition of the statement that is to be run by every theory
#ifdef CVC4_FOR_EACH_THEORY_STATEMENT
void TheoryEngine::ppStaticLearn(TNode in, NodeBuilder<>& learned) {
// Reset the interrupt flag
- d_interrupted = false;
+ d_interrupted = false;
// Definition of the statement that is to be run by every theory
#ifdef CVC4_FOR_EACH_THEORY_STATEMENT
void safePoint() throw(theory::Interrupted, AssertionException) {
if (d_engine->d_interrupted)
- throw theory::Interrupted();
+ throw theory::Interrupted();
}
void conflict(TNode conflictNode) throw(AssertionException) {
Node d_false;
/** Whether we were just interrupted (or not) */
- bool d_interrupted;
-
+ bool d_interrupted;
+
public:
/** Constructs a theory engine */
/** Destroys a theory engine */
~TheoryEngine();
- void interrupt() throw(ModalException);
-
+ void interrupt() throw(ModalException);
+
/**
* Adds a theory. Only one theory per TheoryId can be present, so if
* there is another theory it will be deleted.