summaryrefslogtreecommitdiff
path: root/src/theory
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-11-20 15:19:40 -0600
committerGitHub <noreply@github.com>2020-11-20 15:19:40 -0600
commit6beb76055b81510ec38a8b50f5ed35d2f5010139 (patch)
tree87c8b09f26091794943bdaf58c502cc0c29f5a60 /src/theory
parent798524d033f69153d4bf6604e08c69a571771ae8 (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.cpp15
-rw-r--r--src/theory/quantifiers/quantifiers_rewriter.cpp5
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)
{
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback