From e9fb730333b2719cddaa0a9209aa7953d7f30b0b Mon Sep 17 00:00:00 2001 From: ajreynol Date: Fri, 29 Aug 2014 16:06:50 +0200 Subject: [PATCH] Set instantiation level on skolemized bodies of quantifiers. Rename inst-level attribute to quant-inst-max-level --- src/parser/smt2/Smt2.g | 4 ++-- src/theory/quantifiers/quantifiers_attributes.cpp | 2 +- src/theory/quantifiers/term_database.cpp | 4 ++++ src/theory/quantifiers_engine.cpp | 7 +++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g index 2adad092e..9f4b19c47 100644 --- a/src/parser/smt2/Smt2.g +++ b/src/parser/smt2/Smt2.g @@ -1182,7 +1182,7 @@ attribute[CVC4::Expr& expr,CVC4::Expr& retExpr, std::string& attr] Expr n = MK_CONST( AntlrInput::tokenToInteger($INTEGER_LITERAL) ); std::vector values; values.push_back( n ); - std::string attr_name("inst-level"); + std::string attr_name("quant-inst-max-level"); Command* c = new SetUserAttributeCommand( attr_name, expr, values ); c->setMuted(true); PARSER_STATE->preemptCommand(c); @@ -1722,7 +1722,7 @@ INCLUDE_TOK : 'include'; ATTRIBUTE_PATTERN_TOK : ':pattern'; ATTRIBUTE_NO_PATTERN_TOK : ':no-pattern'; ATTRIBUTE_NAMED_TOK : ':named'; -ATTRIBUTE_INST_LEVEL : ':inst-level'; +ATTRIBUTE_INST_LEVEL : ':quant-inst-max-level'; ATTRIBUTE_RR_PRIORITY : ':rr-priority'; // operators (NOTE: theory symbols go here) diff --git a/src/theory/quantifiers/quantifiers_attributes.cpp b/src/theory/quantifiers/quantifiers_attributes.cpp index b41987923..8d479c29e 100644 --- a/src/theory/quantifiers/quantifiers_attributes.cpp +++ b/src/theory/quantifiers/quantifiers_attributes.cpp @@ -34,7 +34,7 @@ void QuantifiersAttributes::setUserAttribute( const std::string& attr, Node n, s Trace("quant-attr") << "Set conjecture " << n << std::endl; ConjectureAttribute ca; n.setAttribute( ca, true ); - }else if( attr=="inst-level" ){ + }else if( attr=="quant-inst-max-level" ){ Assert( node_values.size()==1 ); uint64_t lvl = node_values[0].getConst().getNumerator().getLong(); Trace("quant-attr") << "Set instantiation level " << n << " to " << lvl << std::endl; diff --git a/src/theory/quantifiers/term_database.cpp b/src/theory/quantifiers/term_database.cpp index 5cc79b9b6..cf68c198e 100644 --- a/src/theory/quantifiers/term_database.cpp +++ b/src/theory/quantifiers/term_database.cpp @@ -685,6 +685,10 @@ Node TermDb::mkSkolemizedBody( Node f, Node n, std::vector< TypeNode >& argTypes ret = NodeManager::currentNM()->mkNode( OR, nret, n_str_ind ); } Trace("quantifiers-sk") << "mkSkolem body for " << f << " returns : " << ret << std::endl; + //if it has an instantiation level, set the skolemized body to that level + if( f.hasAttribute(InstLevelAttribute()) ){ + theory::QuantifiersEngine::setInstantiationLevelAttr( ret, f.getAttribute(InstLevelAttribute()) ); + } return ret; } diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp index d6bd8e574..a00592e8b 100644 --- a/src/theory/quantifiers_engine.cpp +++ b/src/theory/quantifiers_engine.cpp @@ -446,8 +446,11 @@ void QuantifiersEngine::setInstantiationLevelAttr( Node n, Node qn, uint64_t lev } void QuantifiersEngine::setInstantiationLevelAttr( Node n, uint64_t level ){ - InstLevelAttribute ila; - n.setAttribute(ila,level); + if( !n.hasAttribute(InstLevelAttribute()) ){ + InstLevelAttribute ila; + n.setAttribute(ila,level); + Trace("inst-level-debug") << "Set instantiation level " << n << " to " << level << std::endl; + } for( int i=0; i<(int)n.getNumChildren(); i++ ){ setInstantiationLevelAttr( n[i], level ); } -- 2.30.2