summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers/quantifiers_rewriter.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2018-09-05 17:03:17 -0500
committerGitHub <noreply@github.com>2018-09-05 17:03:17 -0500
commitc4bf28c076507312b99236b0d4be1cfc51de6c42 (patch)
treed9b3d95a29f568cba8363792e3efc252167270c3 /src/theory/quantifiers/quantifiers_rewriter.cpp
parent90b90bdfad8c5fbf0f3208e7282fee6dd58aafc0 (diff)
Eliminate select over store in quantifier bodies (#2433)
Diffstat (limited to 'src/theory/quantifiers/quantifiers_rewriter.cpp')
-rw-r--r--src/theory/quantifiers/quantifiers_rewriter.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/theory/quantifiers/quantifiers_rewriter.cpp b/src/theory/quantifiers/quantifiers_rewriter.cpp
index cff14e0c3..1f6660f2f 100644
--- a/src/theory/quantifiers/quantifiers_rewriter.cpp
+++ b/src/theory/quantifiers/quantifiers_rewriter.cpp
@@ -517,6 +517,7 @@ Node QuantifiersRewriter::computeProcessTerms( Node body, std::vector< Node >& n
Node QuantifiersRewriter::computeProcessTerms2( Node body, bool hasPol, bool pol, std::map< Node, bool >& currCond, int nCurrCond,
std::map< Node, Node >& cache, std::map< Node, Node >& icache,
std::vector< Node >& new_vars, std::vector< Node >& new_conds, bool elimExtArith ) {
+ NodeManager* nm = NodeManager::currentNM();
Trace("quantifiers-rewrite-term-debug2") << "computeProcessTerms " << body << " " << hasPol << " " << pol << std::endl;
Node ret;
std::map< Node, Node >::iterator iti = cache.find( body );
@@ -666,18 +667,6 @@ Node QuantifiersRewriter::computeProcessTerms2( Node body, bool hasPol, bool pol
}
}
}
- /* ITE lifting
- if( ret.getKind()==ITE ){
- TypeNode ite_t = ret[1].getType();
- if( !ite_t.isBoolean() ){
- ite_t = TypeNode::leastCommonTypeNode( ite_t, ret[2].getType() );
- Node ite_v = NodeManager::currentNM()->mkBoundVar(ite_t);
- new_vars.push_back( ite_v );
- Node cond = NodeManager::currentNM()->mkNode(kind::ITE, ret[0], ite_v.eqNode( ret[1] ), ite_v.eqNode( ret[2] ) );
- new_conds.push_back( cond.negate() );
- ret = ite_v;
- }
- */
}else if( elimExtArith ){
if( ret.getKind()==INTS_DIVISION_TOTAL || ret.getKind()==INTS_MODULUS_TOTAL ){
Node num = ret[0];
@@ -722,6 +711,25 @@ Node QuantifiersRewriter::computeProcessTerms2( Node body, bool hasPol, bool pol
}
}
}
+ else if (ret.getKind() == SELECT && ret[0].getKind() == STORE)
+ {
+ Node st = ret[0];
+ Node index = ret[1];
+ std::vector<Node> iconds;
+ std::vector<Node> elements;
+ while (st.getKind() == STORE)
+ {
+ iconds.push_back(index.eqNode(st[1]));
+ elements.push_back(st[2]);
+ st = st[0];
+ }
+ ret = nm->mkNode(SELECT, st, index);
+ // conditions
+ for (int i = (iconds.size() - 1); i >= 0; i--)
+ {
+ ret = nm->mkNode(ITE, iconds[i], elements[i], ret);
+ }
+ }
icache[prev] = ret;
return ret;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback