Now the old proofs are used for unsat cores only if proofNew is disabled. Later commits will generate unsat cores from the new proofs when requested. Eventually we will compare them and when we confirm the new unsat core generation is better we will delete the old one.
This also does some minor refactoring in some preprocessing. No behavior is changed.
}
Trace("assert-pipeline") << "Assertions: Replace " << d_nodes[i] << " with "
<< n << std::endl;
- if (options::unsatCores())
- {
- ProofManager::currentPM()->addDependence(n, d_nodes[i]);
- }
if (isProofEnabled())
{
d_pppg->notifyPreprocessed(d_nodes[i], n, pgen);
}
+ else if (options::unsatCores())
+ {
+ ProofManager::currentPM()->addDependence(n, d_nodes[i]);
+ }
d_nodes[i] = n;
}
void AssertionPipeline::replaceTrusted(size_t i, theory::TrustNode trn)
-{
+{
if (trn.isNull())
{
// null trust node denotes no change, nothing to do
d_pppg->notifyNewAssert(newConjr, lcp);
}
}
- if (options::unsatCores())
+ if (options::unsatCores() && !isProofEnabled())
{
ProofManager::currentPM()->addDependence(newConjr, d_nodes[i]);
}
PreprocessingPassResult ApplySubsts::applyInternal(
AssertionPipeline* assertionsToPreprocess)
{
- if (!options::unsatCores())
- {
- Chat() << "applying substitutions..." << std::endl;
- Trace("apply-substs") << "SmtEnginePrivate::processAssertions(): "
- << "applying substitutions" << std::endl;
- // TODO(#1255): Substitutions in incremental mode should be managed with a
- // proper data structure.
+ Chat() << "applying substitutions..." << std::endl;
+ Trace("apply-substs") << "SmtEnginePrivate::processAssertions(): "
+ << "applying substitutions" << std::endl;
+ // TODO(#1255): Substitutions in incremental mode should be managed with a
+ // proper data structure.
- theory::TrustSubstitutionMap& tlsm =
- d_preprocContext->getTopLevelSubstitutions();
- unsigned size = assertionsToPreprocess->size();
- for (unsigned i = 0; i < size; ++i)
+ theory::TrustSubstitutionMap& tlsm =
+ d_preprocContext->getTopLevelSubstitutions();
+ unsigned size = assertionsToPreprocess->size();
+ for (unsigned i = 0; i < size; ++i)
+ {
+ if (assertionsToPreprocess->isSubstsIndex(i))
{
- if (assertionsToPreprocess->isSubstsIndex(i))
- {
- continue;
- }
- Trace("apply-substs") << "applying to " << (*assertionsToPreprocess)[i]
- << std::endl;
- d_preprocContext->spendResource(
- ResourceManager::Resource::PreprocessStep);
- assertionsToPreprocess->replaceTrusted(
- i, tlsm.apply((*assertionsToPreprocess)[i]));
- Trace("apply-substs") << " got " << (*assertionsToPreprocess)[i]
- << std::endl;
+ continue;
}
+ Trace("apply-substs") << "applying to " << (*assertionsToPreprocess)[i]
+ << std::endl;
+ d_preprocContext->spendResource(ResourceManager::Resource::PreprocessStep);
+ assertionsToPreprocess->replaceTrusted(
+ i, tlsm.apply((*assertionsToPreprocess)[i]));
+ Trace("apply-substs") << " got " << (*assertionsToPreprocess)[i]
+ << std::endl;
}
return PreprocessingPassResult::NO_CONFLICT;
}
// process
assertions->replaceTrusted(i, trn);
// rewritten assertion has a dependence on the node (old pf architecture)
- if (options::unsatCores())
+ if (options::unsatCores() && !options::proofNew())
{
ProofManager::currentPM()->addDependence(trn.getNode(), assertion);
}
imap[newSkolems[j]] = assertions->size();
assertions->pushBackTrusted(newAsserts[j]);
// new assertions have a dependence on the node (old pf architecture)
- if (options::unsatCores())
+ if (options::unsatCores() && !options::proofNew())
{
ProofManager::currentPM()->addDependence(newAsserts[j].getProven(),
assertion);
bool ITESimp::doneSimpITE(AssertionPipeline* assertionsToPreprocess)
{
- // This pass does not support dependency tracking yet
- // (learns substitutions from all assertions so just
- // adding addDependence is not enough)
- if (options::unsatCores())
- {
- return true;
- }
+ Assert(!options::unsatCores());
bool result = true;
bool simpDidALotOfWork = d_iteUtilities.simpIteDidALotOfWorkHeuristic();
if (simpDidALotOfWork)
Assert(assertionsToPreprocess->getRealAssertionsEnd()
== assertionsToPreprocess->size());
Assert(!options::incrementalSolving());
+ Assert(!options::unsatCores());
context::Context fakeContext;
TheoryEngine* te = d_preprocContext->getTheoryEngine();
Node n = Rewriter::rewrite(geq.andNode(leq));
assertionsToPreprocess->push_back(n);
- if (options::unsatCores())
- {
- ProofManager::currentPM()->addDependence(n, Node::null());
- }
TrustSubstitutionMap tnullMap(&fakeContext, nullptr);
CVC4_UNUSED SubstitutionMap& nullMap = tnullMap.get();
Theory::PPAssertStatus status CVC4_UNUSED; // just for assertions
Debug("miplib") << " " << newAssertion << endl;
assertionsToPreprocess->push_back(newAssertion);
- if (options::unsatCores())
- {
- ProofManager::currentPM()->addDependence(newAssertion,
- Node::null());
- }
Debug("miplib") << " assertions to remove: " << endl;
for (vector<TNode>::const_iterator k = asserts[pos_var].begin(),
k_end = asserts[pos_var].end();
PreprocessingPassResult NonClausalSimp::applyInternal(
AssertionPipeline* assertionsToPreprocess)
{
- Assert(!options::unsatCores());
+ Assert(!options::unsatCores() || isProofEnabled())
+ << "Unsat cores with non-clausal simp only supported with new proofs";
d_preprocContext->spendResource(ResourceManager::Resource::PreprocessStep);
// If in conflict, just return false
Trace("non-clausal-simplify")
<< "conflict in non-clausal propagation" << std::endl;
- Assert(!options::unsatCores());
assertionsToPreprocess->clear();
assertionsToPreprocess->pushBackTrusted(conf);
- if (options::unsatCores())
- {
- ProofManager::currentPM()->addDependence(conf.getNode(), Node::null());
- }
propagator->setNeedsFinish(true);
return PreprocessingPassResult::CONFLICT;
}
// If the learned literal simplifies to false, we're in conflict
Trace("non-clausal-simplify")
<< "conflict with " << learned_literals[i].getNode() << std::endl;
- Assert(!options::unsatCores());
assertionsToPreprocess->clear();
Node n = NodeManager::currentNM()->mkConst<bool>(false);
assertionsToPreprocess->push_back(n, false, false, d_llpg.get());
- if (options::unsatCores())
- {
- ProofManager::currentPM()->addDependence(n, Node::null());
- }
propagator->setNeedsFinish(true);
return PreprocessingPassResult::CONFLICT;
}
// If in conflict, we return false
Trace("non-clausal-simplify")
<< "conflict while solving " << learnedLiteral << std::endl;
- Assert(!options::unsatCores());
assertionsToPreprocess->clear();
Node n = NodeManager::currentNM()->mkConst<bool>(false);
assertionsToPreprocess->push_back(n);
- if (options::unsatCores())
- {
- ProofManager::currentPM()->addDependence(n, Node::null());
- }
propagator->setNeedsFinish(true);
return PreprocessingPassResult::CONFLICT;
}
for( int i=0; i<(int)assertions.size(); i++ ){
Trace("macros-debug") << " process assertion " << assertions[i] << std::endl;
if( processAssertion( assertions[i] ) ){
- if (options::unsatCores()
+ if (options::unsatCores() && !options::proofNew()
&& std::find(macro_assertions.begin(),
macro_assertions.end(),
assertions[i])
// is an over-approximation. a more fine-grained unsat core
// computation would require caching dependencies for each subterm of
// the formula, which is expensive.
- if (options::unsatCores())
+ if (options::unsatCores() && !options::proofNew())
{
ProofManager::currentPM()->addDependence(curr, assertions[i]);
for (unsigned j = 0; j < macro_assertions.size(); j++)
d_pfManager.reset(
new SatProofManager(this, proxy->getCnfStream(), userContext, pnm));
}
-
- if (options::unsatCores() && !isProofEnabled())
+ else if (options::unsatCores())
{
ProofManager::currentPM()->initSatProof(this);
}
return ClauseIdUndef;
}
d_minisat->addClause(minisat_clause, removable, clause_id);
- Assert(!CVC4::options::unsatCores() || clause_id != ClauseIdError);
+ // FIXME: to be deleted when we kill old proof code for unsat cores
+ Assert(!options::unsatCores() || options::proofNew()
+ || clause_id != ClauseIdError);
return clause_id;
}
subsumption_lim(opt_subsumption_lim),
simp_garbage_frac(opt_simp_garbage_frac),
use_asymm(opt_use_asymm),
- use_rcheck(opt_use_rcheck),
+ // make sure this is not enabled if unsat cores or proofs are on
+ use_rcheck(opt_use_rcheck && !options::unsatCores() && !pnm),
use_elim(options::minisatUseElim() && !enableIncremental),
merges(0),
asymm_lits(0),
d_ppm.reset(
new PropPfManager(userContext, pnm, d_satSolver, d_pfCnfStream.get()));
}
- if (options::unsatCores())
+ else if (options::unsatCores())
{
ProofManager::currentPM()->initCnfProof(d_cnfStream, userContext);
}
{
d_propEngine->getProofCnfStream()->convertPropagation(tte);
}
- if (options::unsatCores())
+ else if (options::unsatCores())
{
ProofManager::getCnfProof()->pushCurrentAssertion(theoryExplanation);
}
- Debug("prop-explain") << "explainPropagation() => " << theoryExplanation << std::endl;
+ Debug("prop-explain") << "explainPropagation() => " << theoryExplanation
+ << std::endl;
explanation.push_back(l);
if (theoryExplanation.getKind() == kind::AND)
{
}
}
- // Give it to proof manager
- if (options::unsatCores())
+ // Give it to the old proof manager
+ if (options::unsatCores() && !isProofEnabled())
{
if (inInput)
{ // n is an input assertion
// Since this pass is not robust for the information tracking necessary for
// unsat cores, it's only applied if we are not doing unsat core computation
- if (!options::unsatCores())
- {
- d_passes["apply-substs"]->apply(&assertions);
- }
+ d_passes["apply-substs"]->apply(&assertions);
// Assertions MUST BE guaranteed to be rewritten by this point
d_passes["rewrite"]->apply(&assertions);
if (options::simplificationMode() != options::SimplificationMode::NONE)
{
- if (!options::unsatCores())
+ // Perform non-clausal simplification
+ PreprocessingPassResult res =
+ d_passes["non-clausal-simp"]->apply(&assertions);
+ if (res == PreprocessingPassResult::CONFLICT)
{
- // Perform non-clausal simplification
- PreprocessingPassResult res =
- d_passes["non-clausal-simp"]->apply(&assertions);
- if (res == PreprocessingPassResult::CONFLICT)
- {
- return false;
- }
+ return false;
}
// We piggy-back off of the BackEdgesMap in the CircuitPropagator to
}
if (options::repeatSimp()
- && options::simplificationMode() != options::SimplificationMode::NONE
- && !options::unsatCores())
+ && options::simplificationMode() != options::SimplificationMode::NONE)
{
PreprocessingPassResult res =
d_passes["non-clausal-simp"]->apply(&assertions);
{
throw OptionException("bitblast-aig not supported with unsat cores");
}
+
+ if (options::doITESimp())
+ {
+ throw OptionException("ITE simp not supported with unsat cores");
+ }
}
else
{
bool Instantiate::getUnsatCoreLemmas(std::vector<Node>& active_lemmas)
{
// only if unsat core available
- if (options::unsatCores())
+ if (options::unsatCores() && !isProofEnabled())
{
if (!ProofManager::currentPM()->unsatCoreAvailable())
{
: NodeManager::currentNM()->mkNode(kind::AND, asserts);
if( res!=vec_node[i] ){
res = Rewriter::rewrite( res );
- if (options::unsatCores())
+ if (options::unsatCores() && !options::proofNew())
{
ProofManager::currentPM()->addDependence(res, vec_node[i]);
}