namespace cvc5 {
+ModelCoreBuilder::ModelCoreBuilder(Env& env) : EnvObj(env) {}
+
bool ModelCoreBuilder::setModelCore(const std::vector<Node>& assertions,
theory::TheoryModel* m,
options::ModelCoresMode mode)
std::vector<Node> coreVars;
std::vector<Node> impliedVars;
bool minimized = false;
+ theory::SubstitutionMinimize sm(d_env);
if (mode == options::ModelCoresMode::NON_IMPLIED)
{
- minimized = theory::SubstitutionMinimize::findWithImplied(
- formula, vars, subs, coreVars, impliedVars);
+ minimized = sm.findWithImplied(formula, vars, subs, coreVars, impliedVars);
}
else if (mode == options::ModelCoresMode::SIMPLE)
{
- minimized = theory::SubstitutionMinimize::find(
- formula, truen, vars, subs, coreVars);
+ minimized = sm.find(formula, truen, vars, subs, coreVars);
}
else
{
#include "expr/node.h"
#include "options/smt_options.h"
+#include "smt/env_obj.h"
#include "theory/theory_model.h"
namespace cvc5 {
/**
* A utility for building model cores.
*/
-class ModelCoreBuilder
+class ModelCoreBuilder : protected EnvObj
{
public:
+ ModelCoreBuilder(Env& env);
/** set model core
*
* This function updates model m so that it has information regarding its
* If m is not a model for assertions, this method returns false and m is
* left unchanged.
*/
- static bool setModelCore(const std::vector<Node>& assertions,
- theory::TheoryModel* m,
- options::ModelCoresMode mode);
+ bool setModelCore(const std::vector<Node>& assertions,
+ theory::TheoryModel* m,
+ options::ModelCoresMode mode);
}; /* class TheoryModelCoreBuilder */
} // namespace cvc5
// impact whether we are in "sat" mode
std::vector<Node> asserts = getAssertionsInternal();
d_pp->expandDefinitions(asserts);
- ModelCoreBuilder::setModelCore(asserts, tm, opts.smt.modelCoresMode);
+ ModelCoreBuilder mcb(*d_env.get());
+ mcb.setModelCore(asserts, tm, opts.smt.modelCoresMode);
}
return tm->isModelCoreSymbol(n);
}
{
Node szl = nm->mkNode(DT_SIZE, n);
Node szr = nm->mkNode(DT_SIZE, utils::getInstCons(n, dt, tindex));
- szr = Rewriter::rewrite(szr);
+ szr = rewrite(szr);
sbp_conj.push_back(szl.eqNode(szr));
}
if (isVarAgnostic)
if( options::dtBinarySplit() && consIndex!=-1 ){
Node test = utils::mkTester(n, consIndex, dt);
Trace("dt-split") << "*************Split for possible constructor " << dt[consIndex] << " for " << n << endl;
- test = Rewriter::rewrite( test );
+ test = rewrite(test);
NodeBuilder nb(kind::OR);
nb << test << test.notNode();
Node lemma = nb;
}
else
{
- rrs = Rewriter::rewrite(r);
+ rrs = rewrite(r);
}
if (s != rrs)
{
//add constructor to equivalence class
Node k = getTermSkolemFor( n );
Node n_ic = utils::getInstCons(k, dt, index);
- n_ic = Rewriter::rewrite( n_ic );
+ n_ic = rewrite(n_ic);
// it may be a new term, so we collect terms and add it to the equality engine
collectTerms( n_ic );
d_equalityEngine->addTerm(n_ic);
{
if (Trace.isOn("quantifiers-sk-debug"))
{
- Node slem = Rewriter::rewrite(lem.getNode());
+ Node slem = rewrite(lem.getNode());
Trace("quantifiers-sk-debug")
<< "Skolemize lemma : " << slem << std::endl;
}
}
else
{
- inst = Rewriter::rewrite(inst);
+ inst = rewrite(inst);
if (inst == (polarity ? d_true : d_false))
{
inst_success = false;
void TheorySep::sendLemma( std::vector< Node >& ant, Node conc, InferenceId id, bool infer ) {
Trace("sep-lemma-debug") << "Do rewrite on inference : " << conc << std::endl;
- conc = Rewriter::rewrite( conc );
+ conc = rewrite(conc);
Trace("sep-lemma-debug") << "Got : " << conc << std::endl;
if( conc!=d_true ){
if( infer && conc!=d_false ){
namespace cvc5 {
namespace theory {
-SubstitutionMinimize::SubstitutionMinimize() {}
+SubstitutionMinimize::SubstitutionMinimize(Env& env) : EnvObj(env) {}
bool SubstitutionMinimize::find(Node t,
Node target,
// try the current substitution
Node tcs = tc.substitute(
reqVars.begin(), reqVars.end(), reqSubs.begin(), reqSubs.end());
- Node tcsr = Rewriter::rewrite(tcs);
+ Node tcsr = rewrite(tcs);
std::vector<Node> tcsrConj;
getConjuncts(tcsr, tcsrConj);
for (const Node& tcc : tcsrConj)
nb << it->second;
}
ret = nb.constructNode();
- ret = Rewriter::rewrite(ret);
+ ret = rewrite(ret);
}
value[cur] = ret;
}
// i to visit, and update curr below.
if (scurr != curr)
{
- curr = Rewriter::rewrite(scurr);
+ curr = rewrite(scurr);
visit.push_back(cur[i]);
}
}
#include <vector>
#include "expr/node.h"
+#include "smt/env_obj.h"
namespace cvc5 {
namespace theory {
* This class is used for finding a minimal substitution under which an
* evaluation holds.
*/
-class SubstitutionMinimize
+class SubstitutionMinimize : protected EnvObj
{
public:
- SubstitutionMinimize();
+ SubstitutionMinimize(Env& env);
~SubstitutionMinimize() {}
/** find
*
* If t { vars -> subs } does not rewrite to target, this method returns
* false.
*/
- static bool find(Node t,
- Node target,
- const std::vector<Node>& vars,
- const std::vector<Node>& subs,
- std::vector<Node>& reqVars);
+ bool find(Node t,
+ Node target,
+ const std::vector<Node>& vars,
+ const std::vector<Node>& subs,
+ std::vector<Node>& reqVars);
/** find with implied
*
* This method should be called on a formula t.
* to appear in reqVars, whereas those later in the vars are more likely to
* appear in impliedVars.
*/
- static bool findWithImplied(Node t,
- const std::vector<Node>& vars,
- const std::vector<Node>& subs,
- std::vector<Node>& reqVars,
- std::vector<Node>& impliedVars);
+ bool findWithImplied(Node t,
+ const std::vector<Node>& vars,
+ const std::vector<Node>& subs,
+ std::vector<Node>& reqVars,
+ std::vector<Node>& impliedVars);
private:
/** Common helper function for the above functions. */
- static bool findInternal(Node t,
- Node target,
- const std::vector<Node>& vars,
- const std::vector<Node>& subs,
- std::vector<Node>& reqVars);
+ bool findInternal(Node t,
+ Node target,
+ const std::vector<Node>& vars,
+ const std::vector<Node>& subs,
+ std::vector<Node>& reqVars);
/** is singular arg
*
* Returns true if
* <k>( ... t_{arg-1}, n, t_{arg+1}...) = c
* always holds for some constant c.
*/
- static bool isSingularArg(Node n, Kind k, unsigned arg);
+ bool isSingularArg(Node n, Kind k, unsigned arg);
};
} // namespace theory