From d74d59d27b255a6f245da1530a6b75168fade48b Mon Sep 17 00:00:00 2001 From: ajreynol Date: Fri, 30 May 2014 12:17:05 +0200 Subject: [PATCH] Fixes for --inst-max-level --- src/theory/quantifiers_engine.cpp | 22 ++++++++++++++-------- src/theory/quantifiers_engine.h | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp index 3714ca4d0..66d8f9326 100644 --- a/src/theory/quantifiers_engine.cpp +++ b/src/theory/quantifiers_engine.cpp @@ -351,7 +351,7 @@ bool QuantifiersEngine::addInstantiation( Node f, std::vector< Node >& vars, std } } } - setInstantiationLevelAttr( body, maxInstLevel+1 ); + setInstantiationLevelAttr( body, f[1], maxInstLevel+1, terms ); } Trace("inst-debug") << "*** Lemma is " << lem << std::endl; ++(d_statistics.d_instantiations); @@ -362,13 +362,19 @@ bool QuantifiersEngine::addInstantiation( Node f, std::vector< Node >& vars, std } } -void QuantifiersEngine::setInstantiationLevelAttr( Node n, uint64_t level ){ - if( !n.hasAttribute(InstLevelAttribute()) ){ - InstLevelAttribute ila; - n.setAttribute(ila,level); - } - for( int i=0; i<(int)n.getNumChildren(); i++ ){ - setInstantiationLevelAttr( n[i], level ); +void QuantifiersEngine::setInstantiationLevelAttr( Node n, Node qn, uint64_t level, std::vector< Node >& inst_terms ){ + //if not from the vector of terms we instantiatied + if( std::find( inst_terms.begin(), inst_terms.end(), n )==inst_terms.end() ){ + //if this is a new term, without an instantiation level + if( n!=qn && !n.hasAttribute(InstLevelAttribute()) ){ + InstLevelAttribute ila; + n.setAttribute(ila,level); + } + Assert( qn.getKind()!=BOUND_VARIABLE ); + Assert( n.getNumChildren()==qn.getNumChildren() ); + for( int i=0; i<(int)n.getNumChildren(); i++ ){ + setInstantiationLevelAttr( n[i], qn[i], level, inst_terms ); + } } } diff --git a/src/theory/quantifiers_engine.h b/src/theory/quantifiers_engine.h index fa3c66f4f..999a716ba 100644 --- a/src/theory/quantifiers_engine.h +++ b/src/theory/quantifiers_engine.h @@ -190,7 +190,7 @@ private: /** instantiate f with arguments terms */ bool addInstantiation( Node f, std::vector< Node >& vars, std::vector< Node >& terms ); /** set instantiation level attr */ - void setInstantiationLevelAttr( Node n, uint64_t level ); + void setInstantiationLevelAttr( Node n, Node qn, uint64_t level, std::vector< Node >& inst_terms ); public: /** get instantiation */ Node getInstantiation( Node f, std::vector< Node >& vars, std::vector< Node >& terms ); -- 2.30.2