summaryrefslogtreecommitdiff
path: root/src/theory/arith/nl/nonlinear_extension.cpp
diff options
context:
space:
mode:
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>2020-09-03 16:27:56 +0200
committerGitHub <noreply@github.com>2020-09-03 16:27:56 +0200
commit58733b382a4a956c051d06e7318afa1deed612da (patch)
treee41944879de5e7f1a06b1994731c9957d65acd3d /src/theory/arith/nl/nonlinear_extension.cpp
parent337f8b791943e9b6b9a234f4f5422cf173342dd9 (diff)
Basic integration of arith::InferenceManager (#4999)
This PR adds a first basic integration of the arith::InferenceManager into the arithmetic theory and the nonlinear extension in particular. While the lemma collection mechanism (in the nonlinear extension) remains unchanged, the lemmas are ultimately not directly pushed to the output channel but instead added to the inference manager. Additionally, we no longer use the cache within the nonlinear extension but instead rely on the inference manager. This PR is based on #4960.
Diffstat (limited to 'src/theory/arith/nl/nonlinear_extension.cpp')
-rw-r--r--src/theory/arith/nl/nonlinear_extension.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/theory/arith/nl/nonlinear_extension.cpp b/src/theory/arith/nl/nonlinear_extension.cpp
index 09806cbbd..537dd604c 100644
--- a/src/theory/arith/nl/nonlinear_extension.cpp
+++ b/src/theory/arith/nl/nonlinear_extension.cpp
@@ -33,9 +33,8 @@ namespace nl {
NonlinearExtension::NonlinearExtension(TheoryArith& containing,
eq::EqualityEngine* ee)
- : d_lemmas(containing.getUserContext()),
- d_lemmasPp(containing.getUserContext()),
- d_containing(containing),
+ : d_containing(containing),
+ d_im(containing.getInferenceManager()),
d_ee(ee),
d_needsLastCall(false),
d_checkCounter(0),
@@ -75,22 +74,9 @@ void NonlinearExtension::sendLemmas(const std::vector<NlLemma>& out)
{
for (const NlLemma& nlem : out)
{
- Node lem = nlem.d_node;
- LemmaProperty p = nlem.d_property;
Trace("nl-ext-lemma") << "NonlinearExtension::Lemma : " << nlem.d_inference
- << " : " << lem << std::endl;
- d_containing.getOutputChannel().lemma(lem, p);
- // process the side effect
- processSideEffect(nlem);
- // add to cache based on preprocess
- if (isLemmaPropertyPreprocess(p))
- {
- d_lemmasPp.insert(lem);
- }
- else
- {
- d_lemmas.insert(lem);
- }
+ << " : " << nlem.d_node << std::endl;
+ d_im.addPendingArithLemma(nlem);
d_stats.d_inferences << nlem.d_inference;
}
}
@@ -121,10 +107,8 @@ unsigned NonlinearExtension::filterLemma(NlLemma lem, std::vector<NlLemma>& out)
Trace("nl-ext-lemma-debug")
<< "NonlinearExtension::Lemma pre-rewrite : " << lem.d_node << std::endl;
lem.d_node = Rewriter::rewrite(lem.d_node);
- // get the proper cache
- NodeSet& lcache =
- isLemmaPropertyPreprocess(lem.d_property) ? d_lemmasPp : d_lemmas;
- if (lcache.find(lem.d_node) != lcache.end())
+
+ if (d_im.hasCachedLemma(lem.d_node, lem.d_property))
{
Trace("nl-ext-lemma-debug")
<< "NonlinearExtension::Lemma duplicate : " << lem.d_node << std::endl;
@@ -620,9 +604,12 @@ void NonlinearExtension::check(Theory::Effort e)
else
{
// If we computed lemmas during collectModelInfo, send them now.
- if (!d_cmiLemmas.empty())
+ if (!d_cmiLemmas.empty() || d_im.hasPendingLemma())
{
sendLemmas(d_cmiLemmas);
+ d_im.doPendingFacts();
+ d_im.doPendingLemmas();
+ d_im.doPendingPhaseRequirements();
return;
}
// Otherwise, we will answer SAT. The values that we approximated are
@@ -799,7 +786,7 @@ bool NonlinearExtension::modelBasedRefinement(std::vector<NlLemma>& mlems)
d_containing.getOutputChannel().requirePhase(literal, true);
Trace("nl-ext-debug") << "Split on : " << literal << std::endl;
Node split = literal.orNode(literal.negate());
- NlLemma nsplit(split, Inference::SHARED_TERM_VALUE_SPLIT);
+ NlLemma nsplit(split, InferenceId::NL_SHARED_TERM_VALUE_SPLIT);
filterLemma(nsplit, stvLemmas);
}
if (!stvLemmas.empty())
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback