From 6edae99ca2d1af88ebe82256132d0d058913a13c Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Wed, 5 Jun 2013 11:23:56 -0500 Subject: [PATCH] Fix bug in --fmf-fmc for producing models of functions not appearing in quantified formulas. --- src/theory/model.cpp | 2 ++ src/theory/quantifiers/first_order_model.cpp | 4 +++- src/theory/quantifiers/full_model_check.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/theory/model.cpp b/src/theory/model.cpp index 544ee6c85..08be41171 100644 --- a/src/theory/model.cpp +++ b/src/theory/model.cpp @@ -431,6 +431,7 @@ void TheoryEngineModelBuilder::checkTerms(TNode n, TheoryModel* tm, NodeSet& cac void TheoryEngineModelBuilder::buildModel(Model* m, bool fullModel) { + Trace("model-builder") << "TheoryEngineModelBuilder: buildModel, fullModel = " << fullModel << std::endl; TheoryModel* tm = (TheoryModel*)m; // buildModel with fullModel = true should only be called once in any context @@ -719,6 +720,7 @@ void TheoryEngineModelBuilder::buildModel(Model* m, bool fullModel) } if (!fullModel) { + Trace("model-builder") << "Make sure ECs have reps..." << std::endl; // Make sure every EC has a rep for (itMap = assertedReps.begin(); itMap != assertedReps.end(); ++itMap ) { tm->d_reps[itMap->first] = itMap->second; diff --git a/src/theory/quantifiers/first_order_model.cpp b/src/theory/quantifiers/first_order_model.cpp index 4b101de49..b775ea1b0 100644 --- a/src/theory/quantifiers/first_order_model.cpp +++ b/src/theory/quantifiers/first_order_model.cpp @@ -602,12 +602,14 @@ Node FirstOrderModelFmc::getModelBasisTerm(TypeNode tn) { } Node FirstOrderModelFmc::getFunctionValue(Node op, const char* argPrefix ) { + Trace("fmc-model") << "Get function value for " << op << std::endl; TypeNode type = op.getType(); std::vector< Node > vars; for( size_t i=0; imkBoundVar( ss.str(), type[i] ) ); + Node b = NodeManager::currentNM()->mkBoundVar( ss.str(), type[i] ); + vars.push_back( b ); } Node boundVarList = NodeManager::currentNM()->mkNode(kind::BOUND_VAR_LIST, vars); Node curr; diff --git a/src/theory/quantifiers/full_model_check.cpp b/src/theory/quantifiers/full_model_check.cpp index b16115749..2033797d5 100755 --- a/src/theory/quantifiers/full_model_check.cpp +++ b/src/theory/quantifiers/full_model_check.cpp @@ -201,7 +201,7 @@ void FullModelChecker::processBuildModel(TheoryModel* m, bool fullModel){ FirstOrderModelFmc * fm = ((FirstOrderModelFmc*)m)->asFirstOrderModelFmc(); if( fullModel ){ //make function values - for( std::map< Node, std::vector< Node > >::iterator it = m->d_uf_terms.begin(); it != m->d_uf_terms.end(); ++it ){ + 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" ); } TheoryEngineModelBuilder::processBuildModel( m, fullModel ); -- 2.30.2