diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-11-20 15:19:40 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-20 15:19:40 -0600 |
commit | 6beb76055b81510ec38a8b50f5ed35d2f5010139 (patch) | |
tree | 87c8b09f26091794943bdaf58c502cc0c29f5a60 /src/theory | |
parent | 798524d033f69153d4bf6604e08c69a571771ae8 (diff) |
Support nested quantifier elimination for get-qe command (#5490)
Uses new nested-qe utility for eliminating nested quantification before doing quantifier elimination.
Fixes CVC4/cvc4-wishues#26
Fixes #5484.
Diffstat (limited to 'src/theory')
-rw-r--r-- | src/theory/quantifiers/cegqi/nested_qe.cpp | 15 | ||||
-rw-r--r-- | src/theory/quantifiers/quantifiers_rewriter.cpp | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/theory/quantifiers/cegqi/nested_qe.cpp b/src/theory/quantifiers/cegqi/nested_qe.cpp index 7f77a1daf..72e7ef66f 100644 --- a/src/theory/quantifiers/cegqi/nested_qe.cpp +++ b/src/theory/quantifiers/cegqi/nested_qe.cpp @@ -69,6 +69,14 @@ bool NestedQe::hasNestedQuantification(Node q) Node NestedQe::doNestedQe(Node q, bool keepTopLevel) { + NodeManager* nm = NodeManager::currentNM(); + Node qOrig = q; + bool inputExists = false; + if (q.getKind() == kind::EXISTS) + { + q = nm->mkNode(kind::FORALL, q[0], q[1].negate()); + inputExists = true; + } Assert(q.getKind() == kind::FORALL); std::unordered_set<Node, NodeHashFunction> nqs; if (!getNestedQuantification(q, nqs)) @@ -77,7 +85,7 @@ Node NestedQe::doNestedQe(Node q, bool keepTopLevel) << "...no nested quantification" << std::endl; if (keepTopLevel) { - return q; + return qOrig; } // just do ordinary quantifier elimination Node qqe = doQe(q); @@ -114,13 +122,12 @@ Node NestedQe::doNestedQe(Node q, bool keepTopLevel) // reconstruct the body std::vector<Node> qargs; qargs.push_back(q[0]); - qargs.push_back(qeBody); + qargs.push_back(inputExists ? qeBody.negate() : qeBody); if (q.getNumChildren() == 3) { qargs.push_back(q[2]); } - NodeManager* nm = NodeManager::currentNM(); - return nm->mkNode(kind::FORALL, qargs); + return nm->mkNode(inputExists ? kind::EXISTS : kind::FORALL, qargs); } Node NestedQe::doQe(Node q) diff --git a/src/theory/quantifiers/quantifiers_rewriter.cpp b/src/theory/quantifiers/quantifiers_rewriter.cpp index 034226474..6d7275fac 100644 --- a/src/theory/quantifiers/quantifiers_rewriter.cpp +++ b/src/theory/quantifiers/quantifiers_rewriter.cpp @@ -1865,8 +1865,9 @@ bool QuantifiersRewriter::doOperation(Node q, } else if (computeOption == COMPUTE_PROCESS_TERMS) { - return options::elimExtArithQuant() - || options::iteLiftQuant() != options::IteLiftQuantMode::NONE; + return is_std + && (options::elimExtArithQuant() + || options::iteLiftQuant() != options::IteLiftQuantMode::NONE); } else if (computeOption == COMPUTE_COND_SPLIT) { |