#include "proof/proof_rule.h"
#include "smt/smt_statistics_registry.h"
#include "theory/arith/arith_rewriter.h"
+#include "theory/arith/equality_solver.h"
#include "theory/arith/infer_bounds.h"
#include "theory/arith/nl/nonlinear_extension.h"
#include "theory/arith/theory_arith_private.h"
d_im(*this, d_astate, pnm),
d_ppre(c, pnm),
d_bab(d_astate, d_im, d_ppre, pnm),
+ d_eqSolver(nullptr),
d_internal(new TheoryArithPrivate(*this, c, u, d_bab, pnm)),
d_nonlinearExtension(nullptr),
d_opElim(pnm, logicInfo),
// indicate we are using the theory state object and inference manager
d_theoryState = &d_astate;
d_inferManager = &d_im;
+
+ if (options::arithEqSolver())
+ {
+ d_eqSolver.reset(new EqualitySolver(d_astate, d_im));
+ }
}
TheoryArith::~TheoryArith(){
bool TheoryArith::needsEqualityEngine(EeSetupInfo& esi)
{
+ // if the equality solver is enabled, then it is responsible for setting
+ // up the equality engine
+ if (d_eqSolver != nullptr)
+ {
+ return d_eqSolver->needsEqualityEngine(esi);
+ }
+ // otherwise, the linear arithmetic solver is responsible for setting up
+ // the equality engine
return d_internal->needsEqualityEngine(esi);
}
void TheoryArith::finishInit()
d_nonlinearExtension.reset(
new nl::NonlinearExtension(*this, d_astate, d_equalityEngine, d_pnm));
}
- // finish initialize internally
+ if (d_eqSolver != nullptr)
+ {
+ d_eqSolver->finishInit();
+ }
+ // finish initialize in the old linear solver
d_internal->finishInit();
}
Trace("arith-check") << "TheoryArith::preNotifyFact: " << fact
<< ", isPrereg=" << isPrereg
<< ", isInternal=" << isInternal << std::endl;
- d_internal->preNotifyFact(atom, pol, fact);
// We do not assert to the equality engine of arithmetic in the standard way,
// hence we return "true" to indicate we are finished with this fact.
- return true;
+ bool ret = true;
+ if (d_eqSolver != nullptr)
+ {
+ // the equality solver may indicate ret = false, after which the assertion
+ // will be asserted to the equality engine in the default way.
+ ret = d_eqSolver->preNotifyFact(atom, pol, fact, isPrereg, isInternal);
+ }
+ // we also always also notify the internal solver
+ d_internal->preNotifyFact(atom, pol, fact);
+ return ret;
}
bool TheoryArith::needsCheckLastEffort() {
return false;
}
-TrustNode TheoryArith::explain(TNode n) { return d_internal->explain(n); }
+TrustNode TheoryArith::explain(TNode n)
+{
+ if (d_eqSolver != nullptr)
+ {
+ // if the equality solver has an explanation for it, use it
+ TrustNode texp = d_eqSolver->explain(n);
+ if (!texp.isNull())
+ {
+ return texp;
+ }
+ }
+ return d_internal->explain(n);
+}
void TheoryArith::propagate(Effort e) {
d_internal->propagate(e);