This simplifies a few places in the code which unecessarily traverse terms during preregistration (which already traverses terms).
{
// register terms with extended theory, to find extended terms that can be
// eliminated by context-depedendent simplification.
- d_extTheory.registerTermRec(n);
+ d_extTheory.registerTerm(n);
}
void NonlinearExtension::sendLemmas(const std::vector<NlLemma>& out)
}
}
-void ExtTheory::registerTermRec(Node n)
-{
- std::unordered_set<TNode, TNodeHashFunction> visited;
- std::vector<TNode> visit;
- TNode cur;
- visit.push_back(n);
- do
- {
- cur = visit.back();
- visit.pop_back();
- if (visited.find(cur) == visited.end())
- {
- visited.insert(cur);
- registerTerm(cur);
- for (const Node& cc : cur)
- {
- visit.push_back(cc);
- }
- }
- } while (!visit.empty());
-}
-
// mark reduced
void ExtTheory::markReduced(Node n, bool satDep)
{
* that is, if addFunctionKind( n.getKind() ) was called.
*/
void registerTerm(Node n);
- /** register all subterms of n with this class */
- void registerTermRec(Node n);
/** set n as reduced/inactive
*
* If satDep = false, then n remains inactive in the duration of this
ExtfSolver::~ExtfSolver() {}
-void ExtfSolver::addSharedTerm(TNode n) { d_extt.registerTermRec(n); }
-
bool ExtfSolver::doReduction(int effort, Node n)
{
Assert(d_extfInfoTmp.find(n) != d_extfInfoTmp.end());
ExtTheory& et,
SequencesStatistics& statistics);
~ExtfSolver();
-
- /**
- * Called when a shared term is added to theory of strings, this registers
- * n with the extended theory utility for context-depdendent simplification.
- */
- void addSharedTerm(TNode n);
/** check extended functions evaluation
*
* This applies "context-dependent simplification" for all active extended
return false;
}
-void TheoryStrings::notifySharedTerm(TNode t)
-{
- Debug("strings") << "TheoryStrings::notifySharedTerm(): " << t << " "
- << t.getType().isBoolean() << endl;
- if (options::stringExp())
- {
- d_esolver.addSharedTerm(t);
- }
- Debug("strings") << "TheoryStrings::notifySharedTerm() finished" << std::endl;
-}
-
bool TheoryStrings::propagateLit(TNode literal)
{
Debug("strings-propagate")
Trace("strings-preregister")
<< "TheoryStrings::preRegisterTerm: " << n << std::endl;
d_termReg.preRegisterTerm(n);
+ // Register the term with the extended theory. Notice we do not recurse on
+ // this term here since preRegisterTerm is already called recursively on all
+ // subterms in preregistered literals.
+ d_extTheory.registerTerm(n);
}
TrustNode TheoryStrings::expandDefinition(Node node)
return;
}
Trace("strings-pending-debug") << " Now collect terms" << std::endl;
- // Collect extended function terms in the atom. Notice that we must register
- // all extended functions occurring in assertions and shared terms. We
- // make a similar call to registerTermRec in TheoryStrings::addSharedTerm.
- d_extTheory.registerTermRec(atom);
Trace("strings-pending-debug") << " Finished collect terms" << std::endl;
}
void presolve() override;
/** shutdown */
void shutdown() override {}
- /** add shared term */
- void notifySharedTerm(TNode n) override;
/** preregister term */
void preRegisterTerm(TNode n) override;
/** Expand definition */