From: Clark Barrett Date: Fri, 27 Apr 2012 19:26:01 +0000 (+0000) Subject: Fixed warning in decision_engine.h, minor tweak to caregraph function in X-Git-Tag: cvc5-1.0.0~8216 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0168ec9f128246d1a6a0a34f7ee59aec109b7782;p=cvc5.git Fixed warning in decision_engine.h, minor tweak to caregraph function in arrays, fixed bug with equalities between constants in shared terms database --- diff --git a/src/decision/decision_engine.h b/src/decision/decision_engine.h index 1e6e8a64d..3ec6aaf2a 100644 --- a/src/decision/decision_engine.h +++ b/src/decision/decision_engine.h @@ -46,9 +46,9 @@ class DecisionEngine { CnfStream* d_cnfStream; DPLLSatSolverInterface* d_satSolver; + context::Context* d_satContext; SatValue d_result; - context::Context* d_satContext; public: // Necessary functions diff --git a/src/theory/arrays/theory_arrays.cpp b/src/theory/arrays/theory_arrays.cpp index c02f90bf0..a62ebed06 100644 --- a/src/theory/arrays/theory_arrays.cpp +++ b/src/theory/arrays/theory_arrays.cpp @@ -637,19 +637,21 @@ void TheoryArrays::computeCareGraph() EqualityStatus eqStatusDomain = d_valuation.getEqualityStatus(x_shared, y_shared); switch (eqStatusDomain) { - case EQUALITY_FALSE_AND_PROPAGATED: - case EQUALITY_FALSE: - continue; - break; case EQUALITY_TRUE_AND_PROPAGATED: - case EQUALITY_TRUE: // Should have been propagated to us Assert(false); + break; + case EQUALITY_FALSE_AND_PROPAGATED: + // TODO: eventually this should be an Assert(false), but for now, disequalities are not propagated continue; break; + case EQUALITY_FALSE: + case EQUALITY_TRUE: + // Missed propagation - need to add the pair so that theory engine can force propagation + Debug("arrays::sharing") << "TheoryArrays::computeCareGraph(): missed propagation" << std::endl; + break; case EQUALITY_FALSE_IN_MODEL: - Debug("arrays::sharing") << "TheoryArrays::computeCareGraph(): false in model, skipping" << std::endl; - continue; + Debug("arrays::sharing") << "TheoryArrays::computeCareGraph(): false in model" << std::endl; break; default: break; diff --git a/src/theory/shared_terms_database.cpp b/src/theory/shared_terms_database.cpp index 24cbc165c..577e1b957 100644 --- a/src/theory/shared_terms_database.cpp +++ b/src/theory/shared_terms_database.cpp @@ -204,11 +204,9 @@ void SharedTermsDatabase::mergeSharedTerms(TNode a, TNode b) // Normalize the equality Node equality = left.eqNode(right); Node normalized = Rewriter::rewriteEquality(currentTheory, equality); - if (normalized.getKind() != kind::CONST_BOOLEAN) { + if (normalized.getKind() != kind::CONST_BOOLEAN || !normalized.getConst()) { // Notify client d_sharedNotify.notify(normalized, equality, currentTheory); - } else { - Assert(equality.getConst()); } } @@ -253,6 +251,7 @@ void SharedTermsDatabase::processSharedLiteral(TNode literal, TNode reason) if (negated) { Assert(!d_equalityEngine.areDisequal(atom[0], atom[1])); d_equalityEngine.addDisequality(atom[0], atom[1], reason); + // !!! need to send this out } else { Assert(!d_equalityEngine.areEqual(atom[0], atom[1])); diff --git a/src/theory/theory_engine.cpp b/src/theory/theory_engine.cpp index 1bb830aa8..46a9f5855 100644 --- a/src/theory/theory_engine.cpp +++ b/src/theory/theory_engine.cpp @@ -936,3 +936,20 @@ void TheoryEngine::conflict(TNode conflict, TheoryId theoryId) { lemma(conflict, true, false); } } + + +//Conflict from shared terms database +void TheoryEngine::sharedConflict(TNode conflict) { + // Mark that we are in conflict + d_inConflict = true; + + if(Dump.isOn("t-conflicts")) { + Dump("t-conflicts") << CommentCommand("theory conflict: expect unsat") + << CheckSatCommand(conflict.toExpr()); + } + + Node fullConflict = explain(ExplainTask(d_sharedTerms.explain(conflict), SHARED_DATABASE_EXPLANATION)); + Assert(properConflict(fullConflict)); + Debug("theory") << "TheoryEngine::sharedConflict(" << conflict << "): " << fullConflict << std::endl; + lemma(fullConflict, true, false); +} diff --git a/src/theory/theory_engine.h b/src/theory/theory_engine.h index dd642a865..faa6bbd26 100644 --- a/src/theory/theory_engine.h +++ b/src/theory/theory_engine.h @@ -278,6 +278,11 @@ class TheoryEngine { */ void conflict(TNode conflict, theory::TheoryId theoryId); + /** + * Called by shared terms database to notify of a conflict. + */ + void sharedConflict(TNode conflict); + /** * Debugging flag to ensure that shutdown() is called before the * destructor. @@ -353,7 +358,13 @@ class TheoryEngine { void propagateSharedLiteral(TNode literal, TNode original, theory::TheoryId theory) { - d_propagatedSharedLiterals.push_back(SharedLiteral(literal, original, theory)); + if (literal.getKind() == kind::CONST_BOOLEAN) { + Assert(!literal.getConst()); + sharedConflict(original); + } + else { + d_propagatedSharedLiterals.push_back(SharedLiteral(literal, original, theory)); + } } /**