This PR eliminates almost all usages of the Warning macro, replacing it mostly by calling EnvObj::warning.
Node newAssertion = var.eqNode(rewrite(sum));
if (top_level_substs.hasSubstitution(newAssertion[0]))
{
- // Warning() << "RE-SUBSTITUTION " << newAssertion[0] << endl;
- // Warning() << "REPLACE " << newAssertion[1] << endl;
- // Warning() << "ORIG " <<
- // top_level_substs.getSubstitution(newAssertion[0]) << endl;
Assert(top_level_substs.getSubstitution(newAssertion[0])
== newAssertion[1]);
}
TypeNode locType, dataType;
if (!d_preprocContext->getTheoryEngine()->getSepHeapTypes(locType, dataType))
{
- Warning() << "SepSkolemEmp::applyInternal: failed to get separation logic "
+ warning() << "SepSkolemEmp::applyInternal: failed to get separation logic "
"heap types during preprocessing"
<< std::endl;
return PreprocessingPassResult::NO_CONFLICT;
return cvc5::null_os;
}
+std::ostream& Env::warning() const
+{
+ return verbose(0);
+}
+
Node Env::evaluate(TNode n,
const std::vector<Node>& args,
const std::vector<Node>& vals,
*/
std::ostream& verbose(int64_t level) const;
+ /** Convenience wrapper for verbose(0). */
+ std::ostream& warning() const;
+
/* Rewrite helpers--------------------------------------------------------- */
/**
* Evaluate node n under the substitution args -> vals. For details, see
SolverEngineStatistics& stats)
: EnvObj(env),
d_absValues(abs),
- d_propagator(true, true),
+ d_propagator(env, true, true),
d_assertionsProcessed(env.getUserContext(), false),
d_exDefs(env),
d_processor(env, stats),
// as definitions.
if (!options().smt.produceAssertions)
{
- Warning()
+ warning()
<< "Assertions not available for dumping (use --produce-assertions)."
<< std::endl;
return;
ProofGenerator* pppg,
rewriter::RewriteDb* rdb,
bool updateScopedAssumptions)
- : d_env(env),
+ : EnvObj(env),
d_pnm(env.getProofNodeManager()),
d_pppg(pppg),
d_wfpm(env),
// substitution.
if (pfn == nullptr)
{
- Warning() << "resort to TRUST_SUBS" << std::endl
+ warning() << "resort to TRUST_SUBS" << std::endl
<< eq << std::endl
<< eqq << std::endl
<< "from " << children << " applied to " << t << std::endl;
ProofGenerator* pppg,
rewriter::RewriteDb* rdb,
bool updateScopedAssumptions)
- : d_cb(env, pppg, rdb, updateScopedAssumptions),
+ : EnvObj(env),
+ d_cb(env, pppg, rdb, updateScopedAssumptions),
// the update merges subproofs
d_updater(
- env.getProofNodeManager(), d_cb, env.getOptions().proof.proofPpMerge),
+ env.getProofNodeManager(), d_cb, options().proof.proofPpMerge),
d_finalCb(env.getProofNodeManager()),
d_finalizer(env.getProofNodeManager(), d_finalCb)
{
#include <unordered_set>
#include "proof/proof_node_updater.h"
+#include "smt/env_obj.h"
#include "smt/proof_final_callback.h"
#include "smt/witness_form.h"
#include "theory/inference_id.h"
namespace cvc5 {
-class Env;
-
namespace rewriter {
class RewriteDb;
}
* A callback class used by SolverEngine for post-processing proof nodes by
* connecting proofs of preprocessing, and expanding macro PfRule applications.
*/
-class ProofPostprocessCallback : public ProofNodeUpdaterCallback
+class ProofPostprocessCallback : public ProofNodeUpdaterCallback, protected EnvObj
{
public:
ProofPostprocessCallback(Env& env,
private:
/** Common constants */
Node d_true;
- /** Reference to the env */
- Env& d_env;
/** Pointer to the proof node manager */
ProofNodeManager* d_pnm;
/** The preprocessing proof generator */
* (1) Connect proofs of preprocessing,
* (2) Expand macro PfRule applications.
*/
-class ProofPostproccess
+class ProofPostproccess : protected EnvObj
{
public:
/**
{
if (opts.theory.relevanceFilterWasSetByUser)
{
- Warning() << "SolverEngine: turning on relevance filtering to support "
+ Trace("smt") << "SolverEngine: turning on relevance filtering to support "
"--nl-ext-rlv="
<< opts.arith.nlRlvMode << std::endl;
}
}
catch (Exception& e)
{
- Warning() << "cvc5 threw an exception during cleanup." << endl << e << endl;
+ d_env->warning() << "cvc5 threw an exception during cleanup." << std::endl << e << std::endl;
}
}
{
if (value != "2" && value != "2.6")
{
- Warning() << "SMT-LIB version " << value
+ d_env->warning() << "SMT-LIB version " << value
<< " unsupported, defaulting to language (and semantics of) "
"SMT-LIB 2.6\n";
}
}
else if (r.asSatisfiabilityResult().isUnknown())
{
- Warning()
+ d_env->warning()
<< "SolverEngine::reduceUnsatCore(): could not reduce unsat core "
"due to "
"unknown result.";
<< std::endl;
if (r.asSatisfiabilityResult().isUnknown())
{
- Warning() << "SolverEngine::checkUnsatCore(): could not check core result "
+ d_env->warning() << "SolverEngine::checkUnsatCore(): could not check core result "
"unknown."
<< std::endl;
}
const LogicInfo& logic = getLogicInfo();
if (!logic.isPure(THEORY_ARITH) && strict)
{
- Warning() << "Unexpected logic for quantifier elimination " << logic
+ d_env->warning() << "Unexpected logic for quantifier elimination " << logic
<< endl;
}
return d_quantElimSolver->getQuantifierElimination(
Assert(sum == shouldBe);
}
}
-bool LinearEqualityModule::debugEntireLinEqIsConsistent(const string& s){
- bool result = true;
- for(ArithVar var = 0, end = d_tableau.getNumColumns(); var != end; ++var){
- // for(VarIter i = d_variables.begin(), end = d_variables.end(); i != end; ++i){
- //ArithVar var = d_arithvarNodeMap.asArithVar(*i);
- if(!d_variables.assignmentIsConsistent(var)){
- d_variables.printModel(var);
- Warning() << s << ":" << "Assignment is not consistent for " << var ;
- if(d_tableau.isBasic(var)){
- Warning() << " (basic)";
- }
- Warning() << endl;
- result = false;
- }
- }
- return result;
-}
DeltaRational LinearEqualityModule::computeRowBound(RowIndex ridx, bool rowUb, ArithVar skip) const {
DeltaRational sum(0,0);
/** Debugging information for a pivot. */
void debugPivot(ArithVar x_i, ArithVar x_j);
- /** Checks the tableau + partial model for consistency. */
- bool debugEntireLinEqIsConsistent(const std::string& s);
-
-
ArithVar minBy(const ArithVarVec& vec, VarPreferenceFunction pf) const;
/**
#include "theory/arith/nl/cad_solver.h"
#include "expr/skolem_manager.h"
+#include "smt/env.h"
#include "theory/arith/inference_manager.h"
#include "theory/arith/nl/cad/cdcac.h"
#include "theory/arith/nl/nl_model.h"
CadSolver::CadSolver(Env& env, InferenceManager& im, NlModel& model)
:
+ EnvObj(env),
#ifdef CVC5_POLY_IMP
d_CAC(env),
#endif
d_CAC.computeVariableOrdering();
d_CAC.retrieveInitialAssignment(d_model, d_ranVariable);
#else
- Warning() << "Tried to use CadSolver but libpoly is not available. Compile "
+ warning() << "Tried to use CadSolver but libpoly is not available. Compile "
"with --poly."
<< std::endl;
#endif
d_im.addPendingLemma(lem, InferenceId::ARITH_NL_CAD_CONFLICT, proof);
}
#else
- Warning() << "Tried to use CadSolver but libpoly is not available. Compile "
+ warning() << "Tried to use CadSolver but libpoly is not available. Compile "
"with --poly."
<< std::endl;
#endif
}
}
#else
- Warning() << "Tried to use CadSolver but libpoly is not available. Compile "
+ warning() << "Tried to use CadSolver but libpoly is not available. Compile "
"with --poly."
<< std::endl;
#endif
assertions.clear();
return true;
#else
- Warning() << "Tried to use CadSolver but libpoly is not available. Compile "
+ warning() << "Tried to use CadSolver but libpoly is not available. Compile "
"with --poly."
<< std::endl;
return false;
#include "context/context.h"
#include "expr/node.h"
-#include "smt/env.h"
+#include "smt/env_obj.h"
#include "theory/arith/nl/cad/cdcac.h"
#include "theory/arith/nl/cad/proof_checker.h"
* A solver for nonlinear arithmetic that implements the CAD-based method
* described in https://arxiv.org/pdf/2003.05633.pdf.
*/
-class CadSolver
+class CadSolver: protected EnvObj
{
public:
CadSolver(Env& env, InferenceManager& im, NlModel& model);
return res;
}
default:
- Warning() << "Unhandled node " << n << " with kind " << n.getKind()
+ Assert(false) << "Unhandled node " << n << " with kind " << n.getKind()
<< std::endl;
}
return poly::UPolynomial();
void debugPrintIsBasic(ArithVar v) const {
if(isBasic(v)){
- Warning() << v << " is basic." << std::endl;
+ Debug("model") << v << " is basic." << std::endl;
}else{
- Warning() << v << " is non-basic." << std::endl;
+ Debug("model") << v << " is non-basic." << std::endl;
}
}
Trace("arith-check") << p.first << " -> " << p.second << std::endl;
if (p.first.getType().isInteger() && !p.second.getType().isInteger())
{
- Warning() << "TheoryArithPrivate generated a bad model value for "
+ warning() << "TheoryArithPrivate generated a bad model value for "
"integer variable "
- << p.first << " : " << p.second;
+ << p.first << " : " << p.second << std::endl;
// must branch and bound
TrustNode lem =
d_bab.branchIntegerVariable(p.first, p.second.getConst<Rational>());
//ArithVar var = d_partialModel.asArithVar(*i);
if(!d_partialModel.assignmentIsConsistent(var)){
d_partialModel.printModel(var);
- Warning() << s << ":" << "Assignment is not consistent for " << var << d_partialModel.asNode(var);
+ warning() << s << ":" << "Assignment is not consistent for " << var << d_partialModel.asNode(var);
if(d_tableau.isBasic(var)){
- Warning() << " (basic)";
+ warning() << " (basic)";
}
- Warning() << endl;
+ warning() << std::endl;
result = false;
}else if(d_partialModel.isInteger(var) && !d_partialModel.integralAssignment(var)){
d_partialModel.printModel(var);
- Warning() << s << ":" << "Assignment is not integer for integer variable " << var << d_partialModel.asNode(var);
+ warning() << s << ":" << "Assignment is not integer for integer variable " << var << d_partialModel.asNode(var);
if(d_tableau.isBasic(var)){
- Warning() << " (basic)";
+ warning() << " (basic)";
}
- Warning() << endl;
+ warning() << std::endl;
result = false;
}
}
if(!d_errorSet.inError(var)){
d_partialModel.printModel(var);
- Warning() << "Unenqueued var is not consistent for " << var << d_partialModel.asNode(var);
+ warning() << "Unenqueued var is not consistent for " << var << d_partialModel.asNode(var);
if(d_tableau.isBasic(var)){
- Warning() << " (basic)";
+ warning() << " (basic)";
}
- Warning() << endl;
+ warning() << std::endl;
result = false;
} else if(Debug.isOn("arith::consistency::initial")){
d_partialModel.printModel(var);
- Warning() << "Initial var is not consistent for " << var << d_partialModel.asNode(var);
+ warning() << "Initial var is not consistent for " << var << d_partialModel.asNode(var);
if(d_tableau.isBasic(var)){
- Warning() << " (basic)";
+ warning() << " (basic)";
}
- Warning() << endl;
+ warning() << std::endl;
}
}
}
<< endl;
if(bestImplied->negationHasProof()){
- Warning() << "the negation of " << bestImplied << " : " << endl
- << "has proof " << bestImplied->getNegation() << endl
+ warning() << "the negation of " << bestImplied << " : " << std::endl
+ << "has proof " << bestImplied->getNegation() << std::endl
<< bestImplied->getNegation()->externalExplainByAssertions()
- << endl;
+ << std::endl;
}
if(!assertedToTheTheory && canBePropagated && !hasProof ){
namespace theory {
namespace booleans {
-CircuitPropagator::CircuitPropagator(bool enableForward, bool enableBackward)
- : d_context(),
+CircuitPropagator::CircuitPropagator(Env& env, bool enableForward, bool enableBackward)
+ : EnvObj(env),
+ d_context(),
d_propagationQueue(),
d_propagationQueueClearer(&d_context, d_propagationQueue),
d_conflict(&d_context, TrustNode()),
{
if (proof == nullptr)
{
- Warning() << "CircuitPropagator: Proof is missing for " << n << std::endl;
+ warning() << "CircuitPropagator: Proof is missing for " << n << std::endl;
Assert(false);
}
else
Node expected = value ? Node(n) : n.negate();
if (proof->getResult() != expected)
{
- Warning() << "CircuitPropagator: Incorrect proof: " << expected
+ warning() << "CircuitPropagator: Incorrect proof: " << expected
<< " vs. " << proof->getResult() << std::endl
<< *proof << std::endl;
}
}
else
{
- Warning() << "CircuitPropagator: Proof is missing for " << lit
+ warning() << "CircuitPropagator: Proof is missing for " << lit
<< std::endl;
TrustNode tlit = TrustNode::mkTrustLemma(lit, nullptr);
d_learnedLiterals.push_back(tlit);
#include "expr/node.h"
#include "proof/lazy_proof_chain.h"
#include "proof/trust_node.h"
+#include "smt/env_obj.h"
namespace cvc5 {
* the same fact is not output twice, so that the same edge in the
* circuit isn't propagated twice, etc.
*/
-class CircuitPropagator
+class CircuitPropagator : protected EnvObj
{
public:
/**
/**
* Construct a new CircuitPropagator.
*/
- CircuitPropagator(bool enableForward = true, bool enableBackward = true);
+ CircuitPropagator(Env& env, bool enableForward = true, bool enableBackward = true);
/** Get Node assignment in circuit. Assert-fails if Node is unassigned. */
bool getAssignment(TNode n) const
Result::Sat res = r.asSatisfiabilityResult().isSat();
if (res != Result::UNSAT)
{
- Warning() << "Warning : the single invocation solver determined the SyGuS "
+ warning() << "Warning : the single invocation solver determined the SyGuS "
"conjecture"
<< (res == Result::SAT ? " is" : " may be") << " infeasible"
<< std::endl;
SygusReconstruct::SygusReconstruct(Env& env,
TermDbSygus* tds,
SygusStatistics& s)
- : d_env(env), d_tds(tds), d_stats(s)
+ : EnvObj(env), d_tds(tds), d_stats(s)
{
}
// we ran out of elements, return null
reconstructed = -1;
- Warning() << CommandFailure(
+ warning() << CommandFailure(
"Cannot get synth function: reconstruction to syntax failed.");
return Node::null();
}
#include <vector>
#include "expr/match_trie.h"
+#include "smt/env_obj.h"
#include "theory/quantifiers/sygus/rcons_obligation.h"
#include "theory/quantifiers/sygus/rcons_type_info.h"
* push(Stack, k'')
* }
*/
-class SygusReconstruct : public expr::NotifyMatch
+class SygusReconstruct : public expr::NotifyMatch, protected EnvObj
{
public:
/**
void printPool(
const std::unordered_map<TypeNode, std::vector<Node>>& pool) const;
- /** Reference to the env */
- Env& d_env;
/** pointer to the sygus term database */
TermDbSygus* d_tds;
/** reference to the statistics of parent */
if (!value)
{
Trace("sygus-engine-debug") << "Conjecture is infeasible." << std::endl;
- Warning() << "Warning : the SyGuS conjecture may be infeasible"
+ warning() << "Warning : the SyGuS conjecture may be infeasible"
<< std::endl;
return false;
}
bool constantsAreTriggers,
bool anyTermTriggers)
: ContextNotifyObj(c),
+ EnvObj(env),
d_masterEqualityEngine(0),
- d_env(env),
d_context(c),
d_done(c, false),
d_notify(&s_notifyNone),
bool constantsAreTriggers,
bool anyTermTriggers)
: ContextNotifyObj(c),
+ EnvObj(env),
d_masterEqualityEngine(nullptr),
d_proofEqualityEngine(nullptr),
- d_env(env),
d_context(c),
d_done(c, false),
d_notify(&s_notifyNone),
|| (d_done && isConstant(t1Id) && isConstant(t2Id));
if (!canExplain) {
- Warning() << "Can't explain equality:" << std::endl;
- Warning() << d_nodes[t1Id] << " with find " << d_nodes[getEqualityNode(t1Id).getFind()] << std::endl;
- Warning() << d_nodes[t2Id] << " with find " << d_nodes[getEqualityNode(t2Id).getFind()] << std::endl;
+ warning() << "Can't explain equality:" << std::endl;
+ warning() << d_nodes[t1Id] << " with find " << d_nodes[getEqualityNode(t1Id).getFind()] << std::endl;
+ warning() << d_nodes[t2Id] << " with find " << d_nodes[getEqualityNode(t2Id).getFind()] << std::endl;
}
Assert(canExplain);
#endif
#include "context/cdo.h"
#include "expr/kind_map.h"
#include "expr/node.h"
+#include "smt/env_obj.h"
#include "theory/theory_id.h"
#include "theory/uf/equality_engine_iterator.h"
#include "theory/uf/equality_engine_notify.h"
* Class for keeping an incremental congruence closure over a set of terms. It provides
* notifications via an EqualityEngineNotify object.
*/
-class EqualityEngine : public context::ContextNotifyObj {
+class EqualityEngine : public context::ContextNotifyObj, protected EnvObj {
friend class EqClassesIterator;
friend class EqClassIterator;
};/* struct EqualityEngine::statistics */
private:
- /** The environment we are using */
- Env& d_env;
-
/** The context we are using */
context::Context* d_context;