From babbe0e30d769b5f68cb3f36820fbb5e176de7c5 Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Thu, 6 Feb 2020 17:30:53 -0600 Subject: Generalize containsQuantifiers to hasClosure (#3722) --- src/theory/quantifiers/quantifiers_rewriter.cpp | 30 +++++-------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'src/theory/quantifiers/quantifiers_rewriter.cpp') diff --git a/src/theory/quantifiers/quantifiers_rewriter.cpp b/src/theory/quantifiers/quantifiers_rewriter.cpp index d5bee4916..74d8ac3a6 100644 --- a/src/theory/quantifiers/quantifiers_rewriter.cpp +++ b/src/theory/quantifiers/quantifiers_rewriter.cpp @@ -1546,7 +1546,8 @@ Node QuantifiersRewriter::computePrenexAgg( Node n, bool topLevel, std::map< uns if( itv!=visited[tindex].end() ){ return itv->second; } - if( containsQuantifiers( n ) ){ + if (expr::hasClosure(n)) + { Node ret = n; if (topLevel && options::prenexQuant() == options::PrenexQuantMode::DISJ_NORMAL @@ -2168,35 +2169,13 @@ Node QuantifiersRewriter::rewriteRewriteRule( Node r ) { return rn; } -struct ContainsQuantAttributeId {}; -typedef expr::Attribute ContainsQuantAttribute; - -// check if the given node contains a universal quantifier -bool QuantifiersRewriter::containsQuantifiers( Node n ){ - if( n.hasAttribute(ContainsQuantAttribute()) ){ - return n.getAttribute(ContainsQuantAttribute())==1; - }else if( n.getKind() == kind::FORALL ){ - return true; - }else{ - bool cq = false; - for( unsigned i = 0; i < n.getNumChildren(); ++i ){ - if( containsQuantifiers( n[i] ) ){ - cq = true; - break; - } - } - ContainsQuantAttribute cqa; - n.setAttribute(cqa, cq ? 1 : 0); - return cq; - } -} bool QuantifiersRewriter::isPrenexNormalForm( Node n ) { if( n.getKind()==FORALL ){ return n[1].getKind()!=FORALL && isPrenexNormalForm( n[1] ); }else if( n.getKind()==NOT ){ return n[0].getKind()!=NOT && isPrenexNormalForm( n[0] ); }else{ - return !containsQuantifiers( n ); + return !expr::hasClosure(n); } } @@ -2246,7 +2225,8 @@ Node QuantifiersRewriter::preSkolemizeQuantifiers( Node n, bool polarity, std::v }else{ //check if it contains a quantifier as a subterm //if so, we will write this node - if( containsQuantifiers( n ) ){ + if (expr::hasClosure(n)) + { if( ( n.getKind()==kind::ITE && n.getType().isBoolean() ) || ( n.getKind()==kind::EQUAL && n[0].getType().isBoolean() ) ){ if( options::preSkolemQuantAgg() ){ Node nn; -- cgit v1.2.3