PolyVector requiredCoefficientsLazardModified(
const poly::Polynomial& p,
const poly::Assignment& assignment,
- VariableMapper& vm)
+ VariableMapper& vm,
+ Rewriter* rewriter)
{
PolyVector res;
auto lc = poly::leading_coefficient(p);
Kind::EQUAL, nl::as_cvc_polynomial(coeff, vm), zero));
}
// if phi is false (i.e. p can not vanish)
- Node rewritten = Rewriter::callExtendedRewrite(
- NodeManager::currentNM()->mkAnd(conditions));
+ Node rewritten =
+ rewriter->extendedRewrite(NodeManager::currentNM()->mkAnd(conditions));
if (rewritten.isConst())
{
Assert(rewritten.getKind() == Kind::CONST_BOOLEAN);
Trace("cdcac::projection")
<< "LMod: "
<< requiredCoefficientsLazardModified(
- p, d_assignment, d_constraints.varMapper())
+ p, d_assignment, d_constraints.varMapper(), d_env.getRewriter())
<< std::endl;
Trace("cdcac::projection")
<< "Original: " << requiredCoefficientsOriginal(p, d_assignment)
return requiredCoefficientsLazard(p, d_assignment);
case options::NlCadProjectionMode::LAZARDMOD:
return requiredCoefficientsLazardModified(
- p, d_assignment, d_constraints.varMapper());
+ p, d_assignment, d_constraints.varMapper(), d_env.getRewriter());
default:
Assert(false);
return requiredCoefficientsOriginal(p, d_assignment);
std::unordered_set<Node> argsSet;
std::unordered_set<Node> nargsSet;
Node q;
- QuantifiersRewriter qrew(options());
+ QuantifiersRewriter qrew(d_env.getRewriter(), options());
Node nn = qrew.computePrenex(q, n, argsSet, nargsSet, true, true);
Assert(n != nn || argsSet.empty());
Assert(n != nn || nargsSet.empty());
return out;
}
-QuantifiersRewriter::QuantifiersRewriter(const Options& opts) : d_opts(opts) {}
+QuantifiersRewriter::QuantifiersRewriter(Rewriter* r, const Options& opts)
+ : d_rewriter(r), d_opts(opts)
+{
+}
bool QuantifiersRewriter::isLiteral( Node n ){
switch( n.getKind() ){
return ret;
}
-Node QuantifiersRewriter::computeExtendedRewrite(Node q, const QAttributes& qa)
+Node QuantifiersRewriter::computeExtendedRewrite(TNode q,
+ const QAttributes& qa) const
{
// do not apply to recursive functions
if (qa.isFunDef())
}
Node body = q[1];
// apply extended rewriter
- Node bodyr = Rewriter::callExtendedRewrite(body);
+ Node bodyr = d_rewriter->extendedRewrite(body);
if (body != bodyr)
{
std::vector<Node> children;
class Options;
namespace theory {
+
+class Rewriter;
+
namespace quantifiers {
struct QAttributes;
class QuantifiersRewriter : public TheoryRewriter
{
public:
- QuantifiersRewriter(const Options& opts);
+ QuantifiersRewriter(Rewriter* r, const Options& opts);
/** Pre-rewrite n */
RewriteResponse preRewrite(TNode in) override;
/** Post-rewrite n */
* This returns the result of applying the extended rewriter on the body
* of quantified formula q with attributes qa.
*/
- static Node computeExtendedRewrite(Node q, const QAttributes& qa);
+ Node computeExtendedRewrite(TNode q, const QAttributes& qa) const;
//------------------------------------- end extended rewrite
/**
* Return true if we should do operation computeOption on quantified formula
Node computeOperation(Node q,
RewriteStep computeOption,
QAttributes& qa) const;
+ /** Pointer to rewriter, used for computeExtendedRewrite above */
+ Rewriter* d_rewriter;
/** Reference to the options */
const Options& d_opts;
}; /* class QuantifiersRewriter */
std::vector<Node> varsTmp;
std::vector<Node> subsTmp;
- QuantifiersRewriter qrew(options());
+ QuantifiersRewriter qrew(d_env.getRewriter(), options());
qrew.getVarElim(body, args, varsTmp, subsTmp);
// if we eliminated a variable, update body and reprocess
if (!varsTmp.empty())
OutputChannel& out,
Valuation valuation)
: Theory(THEORY_QUANTIFIERS, env, out, valuation),
- d_rewriter(env.getOptions()),
+ d_rewriter(env.getRewriter(), options()),
d_qstate(env, valuation, logicInfo()),
d_qreg(env),
d_treg(env, d_qstate, d_qreg),
return getInstance()->rewriteTo(theoryOf(node), node);
}
-Node Rewriter::callExtendedRewrite(TNode node, bool aggr)
-{
- return getInstance()->extendedRewrite(node, aggr);
-}
-
Node Rewriter::extendedRewrite(TNode node, bool aggr)
{
quantifiers::ExtendedRewriter er(*this, aggr);
* use on the node.
*/
static Node rewrite(TNode node);
- /**
- * !!! Temporary until static access to rewriter is eliminated.
- */
- static Node callExtendedRewrite(TNode node, bool aggr = true);
/**
* Rewrites the equality node using theoryOf() to determine which rewriter to
TEST_F(TestTheoryWhiteArithCAD, lazard_simp)
{
+ Rewriter* rewriter = d_slvEngine->getRewriter();
Node a = d_nodeManager->mkVar(*d_realType);
Node c = d_nodeManager->mkVar(*d_realType);
Node orig = d_nodeManager->mkAnd(std::vector<Node>{
d_nodeManager->mkConst(CONST_RATIONAL, d_zero))});
{
- Node rewritten = Rewriter::rewrite(orig);
+ Node rewritten = rewriter->rewrite(orig);
EXPECT_NE(rewritten, d_nodeManager->mkConst(false));
}
{
- Node rewritten = Rewriter::callExtendedRewrite(orig);
+ Node rewritten = rewriter->extendedRewrite(orig);
EXPECT_EQ(rewritten, d_nodeManager->mkConst(false));
}
}