From c6855bb13420c020690cf63c8b770186f278081c Mon Sep 17 00:00:00 2001 From: ajreynol Date: Tue, 28 Apr 2015 15:50:17 +0200 Subject: [PATCH] Fix smt2 printing of fun-def. Simplification of mbqi interface. --- src/printer/smt2/smt2_printer.cpp | 10 ++++++++-- src/theory/quantifiers/ce_guided_instantiation.cpp | 3 --- src/theory/quantifiers/ce_guided_instantiation.h | 1 - src/theory/quantifiers/full_model_check.cpp | 11 ++--------- src/theory/quantifiers/full_model_check.h | 3 --- src/theory/quantifiers/fun_def_process.cpp | 1 + src/theory/quantifiers/model_builder.h | 2 -- src/theory/quantifiers_engine.cpp | 10 +++------- 8 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp index a98a106a1..7648a1587 100644 --- a/src/printer/smt2/smt2_printer.cpp +++ b/src/printer/smt2/smt2_printer.cpp @@ -32,6 +32,7 @@ #include "theory/theory_model.h" #include "theory/arrays/theory_arrays_rewriter.h" +#include "theory/quantifiers/term_database.h" using namespace std; @@ -589,9 +590,14 @@ void Smt2Printer::toStream(std::ostream& out, TNode n, case kind::INST_PATTERN: break; case kind::INST_PATTERN_LIST: - // TODO user patterns for(unsigned i=0; imkConst(false); } -bool FullModelChecker::optBuildAtFullModel() { - //need to build after full model has taken effect if we are constructing interval models - // this is because we need to have a constant in all integer equivalence classes - return options::mbqiMode()==quantifiers::MBQI_FMC_INTERVAL; -} - void FullModelChecker::processBuildModel(TheoryModel* m, bool fullModel){ FirstOrderModelFmc * fm = ((FirstOrderModelFmc*)m)->asFirstOrderModelFmc(); - if( fullModel==optBuildAtFullModel() ){ + if( !fullModel ){ Trace("fmc") << "---Full Model Check reset() " << std::endl; fm->initialize(); d_quant_models.clear(); @@ -514,8 +508,7 @@ void FullModelChecker::processBuildModel(TheoryModel* m, bool fullModel){ } */ } - } - if( fullModel ){ + }else{ //make function values for( std::map::iterator it = fm->d_models.begin(); it != fm->d_models.end(); ++it ){ m->d_uf_models[ it->first ] = getFunctionValue( fm, it->first, "$x" ); diff --git a/src/theory/quantifiers/full_model_check.h b/src/theory/quantifiers/full_model_check.h index 9a7b05090..29913d98d 100644 --- a/src/theory/quantifiers/full_model_check.h +++ b/src/theory/quantifiers/full_model_check.h @@ -135,9 +135,6 @@ public: FullModelChecker( context::Context* c, QuantifiersEngine* qe ); ~FullModelChecker() throw() {} - bool optBuildAtFullModel(); - - void debugPrintCond(const char * tr, Node n, bool dispStar = false); void debugPrint(const char * tr, Node n, bool dispStar = false); diff --git a/src/theory/quantifiers/fun_def_process.cpp b/src/theory/quantifiers/fun_def_process.cpp index 22dac2225..a46aca3c8 100644 --- a/src/theory/quantifiers/fun_def_process.cpp +++ b/src/theory/quantifiers/fun_def_process.cpp @@ -46,6 +46,7 @@ void FunDefFmf::simplify( std::vector< Node >& assertions, bool doRewrite ) { } Node bd = TermDb::getFunDefBody( assertions[i] ); + Trace("fmf-fun-def-debug") << "Process function " << n << ", body = " << bd << std::endl; Assert( !bd.isNull() ); bd = NodeManager::currentNM()->mkNode( n.getType().isBoolean() ? IFF : EQUAL, n, bd ); diff --git a/src/theory/quantifiers/model_builder.h b/src/theory/quantifiers/model_builder.h index a3d239d18..d9ed3f092 100644 --- a/src/theory/quantifiers/model_builder.h +++ b/src/theory/quantifiers/model_builder.h @@ -42,8 +42,6 @@ public: virtual bool doExhaustiveInstantiation( FirstOrderModel * fm, Node f, int effort ) { return false; } //whether to construct model virtual bool optUseModel(); - //whether to construct model at fullModel = true - virtual bool optBuildAtFullModel() { return false; } /** number of lemmas generated while building model */ //is the exhaustive instantiation incomplete? bool d_incomplete_check; diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp index 3fa3b2a1b..f6645c493 100644 --- a/src/theory/quantifiers_engine.cpp +++ b/src/theory/quantifiers_engine.cpp @@ -267,7 +267,6 @@ void QuantifiersEngine::check( Theory::Effort e ){ } bool needsCheck = !d_lemmas_waiting.empty(); bool needsModel = false; - bool needsFullModel = false; std::vector< QuantifiersModule* > qm; if( d_model->checkNeeded() ){ needsCheck = needsCheck || e>=Theory::EFFORT_LAST_CALL; //always need to check at or above last call @@ -277,9 +276,6 @@ void QuantifiersEngine::check( Theory::Effort e ){ needsCheck = true; if( d_modules[i]->needsModel( e ) ){ needsModel = true; - if( d_modules[i]->needsFullModel( e ) ){ - needsFullModel = true; - } } } } @@ -347,9 +343,9 @@ void QuantifiersEngine::check( Theory::Effort e ){ //build the model if any module requested it if( quant_e==QEFFORT_MODEL && needsModel ){ Assert( d_builder!=NULL ); - Trace("quant-engine-debug") << "Build model, fullModel = " << ( needsFullModel || d_builder->optBuildAtFullModel() ) << "..." << std::endl; + Trace("quant-engine-debug") << "Build model..." << std::endl; d_builder->d_addedLemmas = 0; - d_builder->buildModel( d_model, needsFullModel || d_builder->optBuildAtFullModel() ); + d_builder->buildModel( d_model, false ); //we are done if model building was unsuccessful if( d_builder->d_addedLemmas>0 ){ success = false; @@ -368,7 +364,7 @@ void QuantifiersEngine::check( Theory::Effort e ){ if( d_hasAddedLemma ){ break; //otherwise, complete the model generation if necessary - }else if( quant_e==QEFFORT_MODEL && needsModel && options::produceModels() && !needsFullModel && !d_builder->optBuildAtFullModel() ){ + }else if( quant_e==QEFFORT_MODEL && needsModel && options::produceModels() ){ Trace("quant-engine-debug") << "Build completed model..." << std::endl; d_builder->buildModel( d_model, true ); } -- 2.30.2