// get the presubstitution
Trace("nl-ext-cm-debug") << " apply pre-substitution..." << std::endl;
std::vector<Node> passertions = assertions;
-
- // preprocess the assertions with the trancendental solver
- if (!d_trSlv.preprocessAssertionsCheckModel(passertions))
+ if (options::nlExt())
{
- return false;
+ // preprocess the assertions with the trancendental solver
+ if (!d_trSlv.preprocessAssertionsCheckModel(passertions))
+ {
+ return false;
+ }
}
Trace("nl-ext-cm") << "-----" << std::endl;
unsigned tdegree = d_trSlv.getTaylorDegree();
- bool ret =
- d_model.checkModel(passertions, false_asserts, tdegree, lemmas, gs);
+ bool ret = d_model.checkModel(passertions, tdegree, lemmas, gs);
return ret;
}
std::vector<NlLemma>& lems,
std::vector<NlLemma>& wlems)
{
- // initialize the non-linear solver
- d_nlSlv.initLastCall(assertions, false_asserts, xts);
- // initialize the trancendental function solver
std::vector<NlLemma> lemmas;
- d_trSlv.initLastCall(assertions, false_asserts, xts, lemmas);
-
- // process lemmas that may have been generated by the transcendental solver
- filterLemmas(lemmas, lems);
+ if (options::nlExt())
+ {
+ // initialize the non-linear solver
+ d_nlSlv.initLastCall(assertions, false_asserts, xts);
+ // initialize the trancendental function solver
+ d_trSlv.initLastCall(assertions, false_asserts, xts, lemmas);
+ // process lemmas that may have been generated by the transcendental solver
+ filterLemmas(lemmas, lems);
+ }
if (!lems.empty())
{
Trace("nl-ext") << " ...finished with " << lems.size()
}
//----------------------------------- possibly split on zero
- if (options::nlExtSplitZero())
+ if (options::nlExt() && options::nlExtSplitZero())
{
Trace("nl-ext") << "Get zero split lemmas..." << std::endl;
lemmas = d_nlSlv.checkSplitZero();
}
//-----------------------------------initial lemmas for transcendental
- //functions
- lemmas = d_trSlv.checkTranscendentalInitialRefine();
- filterLemmas(lemmas, lems);
- if (!lems.empty())
- {
- Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
- << std::endl;
- return lems.size();
- }
-
- //-----------------------------------lemmas based on sign (comparison to zero)
- lemmas = d_nlSlv.checkMonomialSign();
- filterLemmas(lemmas, lems);
- if (!lems.empty())
- {
- Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
- << std::endl;
- return lems.size();
- }
-
- //-----------------------------------monotonicity of transdental functions
- lemmas = d_trSlv.checkTranscendentalMonotonic();
- filterLemmas(lemmas, lems);
- if (!lems.empty())
- {
- Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
- << std::endl;
- return lems.size();
- }
-
- //-----------------------------------lemmas based on magnitude of non-zero
- //monomials
- for (unsigned c = 0; c < 3; c++)
+ if (options::nlExt())
{
- // c is effort level
- lemmas = d_nlSlv.checkMonomialMagnitude(c);
- unsigned nlem = lemmas.size();
+ // functions
+ lemmas = d_trSlv.checkTranscendentalInitialRefine();
filterLemmas(lemmas, lems);
if (!lems.empty())
{
- Trace("nl-ext") << " ...finished with " << lems.size()
- << " new lemmas (out of possible " << nlem << ")."
+ Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
<< std::endl;
return lems.size();
}
}
- //-----------------------------------inferred bounds lemmas
- // e.g. x >= t => y*x >= y*t
- std::vector<NlLemma> nt_lemmas;
- lemmas =
- d_nlSlv.checkMonomialInferBounds(nt_lemmas, assertions, false_asserts);
- // Trace("nl-ext") << "Bound lemmas : " << lemmas.size() << ", " <<
- // nt_lemmas.size() << std::endl; prioritize lemmas that do not
- // introduce new monomials
- filterLemmas(lemmas, lems);
-
- if (options::nlExtTangentPlanes() && options::nlExtTangentPlanesInterleave())
+ // main calls to nlExt
+ if (options::nlExt())
{
- lemmas = d_nlSlv.checkTangentPlanes();
+ //---------------------------------lemmas based on sign (comparison to zero)
+ lemmas = d_nlSlv.checkMonomialSign();
filterLemmas(lemmas, lems);
- }
-
- if (!lems.empty())
- {
- Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
- << std::endl;
- return lems.size();
- }
-
- // from inferred bound inferences : now do ones that introduce new terms
- filterLemmas(nt_lemmas, lems);
- if (!lems.empty())
- {
- Trace("nl-ext") << " ...finished with " << lems.size()
- << " new (monomial-introducing) lemmas." << std::endl;
- return lems.size();
- }
+ if (!lems.empty())
+ {
+ Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
+ << std::endl;
+ return lems.size();
+ }
- //------------------------------------factoring lemmas
- // x*y + x*z >= t => exists k. k = y + z ^ x*k >= t
- if (options::nlExtFactor())
- {
- lemmas = d_nlSlv.checkFactoring(assertions, false_asserts);
+ //-----------------------------------monotonicity of transdental functions
+ lemmas = d_trSlv.checkTranscendentalMonotonic();
filterLemmas(lemmas, lems);
if (!lems.empty())
{
<< std::endl;
return lems.size();
}
- }
- //------------------------------------resolution bound inferences
- // e.g. ( y>=0 ^ s <= x*z ^ x*y <= t ) => y*s <= z*t
- if (options::nlExtResBound())
- {
- lemmas = d_nlSlv.checkMonomialInferResBounds();
+ //------------------------lemmas based on magnitude of non-zero monomials
+ for (unsigned c = 0; c < 3; c++)
+ {
+ // c is effort level
+ lemmas = d_nlSlv.checkMonomialMagnitude(c);
+ unsigned nlem = lemmas.size();
+ filterLemmas(lemmas, lems);
+ if (!lems.empty())
+ {
+ Trace("nl-ext") << " ...finished with " << lems.size()
+ << " new lemmas (out of possible " << nlem << ")."
+ << std::endl;
+ return lems.size();
+ }
+ }
+
+ //-----------------------------------inferred bounds lemmas
+ // e.g. x >= t => y*x >= y*t
+ std::vector<NlLemma> nt_lemmas;
+ lemmas =
+ d_nlSlv.checkMonomialInferBounds(nt_lemmas, assertions, false_asserts);
+ // Trace("nl-ext") << "Bound lemmas : " << lemmas.size() << ", " <<
+ // nt_lemmas.size() << std::endl; prioritize lemmas that do not
+ // introduce new monomials
filterLemmas(lemmas, lems);
+
+ if (options::nlExtTangentPlanes()
+ && options::nlExtTangentPlanesInterleave())
+ {
+ lemmas = d_nlSlv.checkTangentPlanes();
+ filterLemmas(lemmas, lems);
+ }
+
if (!lems.empty())
{
Trace("nl-ext") << " ...finished with " << lems.size() << " new lemmas."
<< std::endl;
return lems.size();
}
- }
- //------------------------------------tangent planes
- if (options::nlExtTangentPlanes() && !options::nlExtTangentPlanesInterleave())
- {
- lemmas = d_nlSlv.checkTangentPlanes();
- filterLemmas(lemmas, wlems);
- }
- if (options::nlExtTfTangentPlanes())
- {
- lemmas = d_trSlv.checkTranscendentalTangentPlanes();
- filterLemmas(lemmas, wlems);
+ // from inferred bound inferences : now do ones that introduce new terms
+ filterLemmas(nt_lemmas, lems);
+ if (!lems.empty())
+ {
+ Trace("nl-ext") << " ...finished with " << lems.size()
+ << " new (monomial-introducing) lemmas." << std::endl;
+ return lems.size();
+ }
+
+ //------------------------------------factoring lemmas
+ // x*y + x*z >= t => exists k. k = y + z ^ x*k >= t
+ if (options::nlExtFactor())
+ {
+ lemmas = d_nlSlv.checkFactoring(assertions, false_asserts);
+ filterLemmas(lemmas, lems);
+ if (!lems.empty())
+ {
+ Trace("nl-ext") << " ...finished with " << lems.size()
+ << " new lemmas." << std::endl;
+ return lems.size();
+ }
+ }
+
+ //------------------------------------resolution bound inferences
+ // e.g. ( y>=0 ^ s <= x*z ^ x*y <= t ) => y*s <= z*t
+ if (options::nlExtResBound())
+ {
+ lemmas = d_nlSlv.checkMonomialInferResBounds();
+ filterLemmas(lemmas, lems);
+ if (!lems.empty())
+ {
+ Trace("nl-ext") << " ...finished with " << lems.size()
+ << " new lemmas." << std::endl;
+ return lems.size();
+ }
+ }
+
+ //------------------------------------tangent planes
+ if (options::nlExtTangentPlanes()
+ && !options::nlExtTangentPlanesInterleave())
+ {
+ lemmas = d_nlSlv.checkTangentPlanes();
+ filterLemmas(lemmas, wlems);
+ }
+ if (options::nlExtTfTangentPlanes())
+ {
+ lemmas = d_trSlv.checkTranscendentalTangentPlanes();
+ filterLemmas(lemmas, wlems);
+ }
}
+
Trace("nl-ext") << " ...finished with " << wlems.size() << " waiting lemmas."
<< std::endl;
}
// we are incomplete
- if (options::nlExtIncPrecision() && d_model.usedApproximate())
+ if (options::nlExt() && options::nlExtIncPrecision()
+ && d_model.usedApproximate())
{
d_trSlv.incrementTaylorDegree();
needsRecheck = true;
d_statistics(),
d_opElim(logicInfo)
{
- if( options::nlExt() ){
+ // only need to create if non-linear logic
+ if (logicInfo.isTheoryEnabled(THEORY_ARITH) && !logicInfo.isLinear())
+ {
d_nonlinearExtension = new nl::NonlinearExtension(
containing, d_congruenceManager.getEqualityEngine());
}
throw LogicException("A non-linear fact was asserted to arithmetic in a linear logic.");
}
- if( !options::nlExt() ){
+ if (d_nonlinearExtension == nullptr)
+ {
d_nlIncomplete = true;
}
markSetup(vlNode);
}else{
- if( !options::nlExt() ){
+ if (d_nonlinearExtension == nullptr)
+ {
if( vlNode.getKind()==kind::EXPONENTIAL || vlNode.getKind()==kind::SINE ||
vlNode.getKind()==kind::COSINE || vlNode.getKind()==kind::TANGENT ){
d_nlIncomplete = true;
void TheoryArithPrivate::preRegisterTerm(TNode n) {
Debug("arith::preregister") <<"begin arith::preRegisterTerm("<< n <<")"<< endl;
-
- if( options::nlExt() ){
+
+ if (d_nonlinearExtension != nullptr)
+ {
d_containing.getExtTheory()->registerTermRec( n );
}
}
if(effortLevel == Theory::EFFORT_LAST_CALL){
- if( options::nlExt() ){
+ if (d_nonlinearExtension != nullptr)
+ {
d_nonlinearExtension->check(effortLevel);
}
return;
}//if !emmittedConflictOrSplit && fullEffort(effortLevel) && !hasIntegerModel()
if(!emmittedConflictOrSplit && effortLevel>=Theory::EFFORT_FULL){
- if( options::nlExt() ){
+ if (d_nonlinearExtension != nullptr)
+ {
d_nonlinearExtension->check( effortLevel );
}
}
}
bool TheoryArithPrivate::needsCheckLastEffort() {
- if( options::nlExt() ){
+ if (d_nonlinearExtension != nullptr)
+ {
return d_nonlinearExtension->needsCheckLastEffort();
}else{
return false;
}
bool TheoryArithPrivate::getCurrentSubstitution( int effort, std::vector< Node >& vars, std::vector< Node >& subs, std::map< Node, std::vector< Node > >& exp ) {
- if( options::nlExt() ){
+ if (d_nonlinearExtension != nullptr)
+ {
return d_nonlinearExtension->getCurrentSubstitution( effort, vars, subs, exp );
}else{
return false;
bool TheoryArithPrivate::isExtfReduced(int effort, Node n, Node on,
std::vector<Node>& exp) {
- if (options::nlExt()) {
+ if (d_nonlinearExtension != nullptr)
+ {
std::pair<bool, Node> reduced =
d_nonlinearExtension->isExtfReduced(effort, n, on, exp);
if (!reduced.second.isNull()) {
Node qNode = mkRationalNode(qmodel);
Debug("arith::collectModelInfo") << "m->assertEquality(" << term << ", " << qmodel << ", true)" << endl;
- if (options::nlExt())
+ if (d_nonlinearExtension != nullptr)
{
// Let non-linear extension inspect the values before they are sent
// to the theory model.
}
}
}
- if (options::nlExt())
+ if (d_nonlinearExtension != nullptr)
{
// Non-linear may repair values to satisfy non-linear constraints (see
// documentation for NonlinearExtension::interceptModel).
outputLemma(lem);
}
- if (options::nlExt())
+ if (d_nonlinearExtension != nullptr)
{
d_nonlinearExtension->presolve();
}