diff options
author | Alex Ozdemir <aozdemir@hmc.edu> | 2020-07-27 10:20:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 10:20:07 -0700 |
commit | d5141e4086898bb66809c76d4614503e3a2efd6e (patch) | |
tree | cb611ef5c355a10f291b130a06a608a453c991c9 /src/theory/arith | |
parent | ffed1a0c2da3c28ce910f1a19462ffa771c5b252 (diff) |
Consider negation's proof before triggering arith pfs. (#4776)
The current arith proof machinery can prove conflicts which are
explained by assumptions and tightened assumptions.
Previously we verified that the conflict constraint was explained in
terms of assumptions and tightened assumptions, before trying to
save/produce a proof.
We did not verify that the negated constraint was an assumption or
tightened assumption.
This caused us to attempt to prove conflicts around constraints whose
negations where proven by general means (in the case of #4714, by the
equality engine), which the proof machinery was not prepared to handle.
This PR also checks that the negate constraint is an assumption or
tightened assumption, before saving the proof.
Thanks, Gereon, for doing the initial investigation into this!
fixes 4714
Co-authored-by: Gereon Kremer <nafur42@gmail.com>
Diffstat (limited to 'src/theory/arith')
-rw-r--r-- | src/theory/arith/constraint.cpp | 25 | ||||
-rw-r--r-- | src/theory/arith/constraint.h | 5 | ||||
-rw-r--r-- | src/theory/arith/theory_arith_private.cpp | 3 |
3 files changed, 20 insertions, 13 deletions
diff --git a/src/theory/arith/constraint.cpp b/src/theory/arith/constraint.cpp index abfaca954..6a04e70d1 100644 --- a/src/theory/arith/constraint.cpp +++ b/src/theory/arith/constraint.cpp @@ -506,18 +506,8 @@ bool Constraint::hasSimpleFarkasProof() const for (ConstraintCP a = d_database->getAntecedent(i); a != NullConstraint; a = d_database->getAntecedent(--i)) { - // ... that antecdent must be an assumption ... - if (a->isAssumption()) - { - continue; - } - - // ... OR a tightened assumption ... - if (a->hasIntTightenProof() - && a->getConstraintRule().d_antecedentEnd != AntecedentIdSentinel - && d_database->getAntecedent(a->getConstraintRule().d_antecedentEnd) - ->isAssumption()) - + // ... that antecdent must be an assumption OR a tightened assumption ... + if (a->isPossiblyTightenedAssumption()) { continue; } @@ -536,6 +526,17 @@ bool Constraint::hasSimpleFarkasProof() const return true; } +bool Constraint::isPossiblyTightenedAssumption() const +{ + // ... that antecdent must be an assumption ... + + if (isAssumption()) return true; + if (!hasIntTightenProof()) return false; + if (getConstraintRule().d_antecedentEnd == AntecedentIdSentinel) return false; + return d_database->getAntecedent(getConstraintRule().d_antecedentEnd) + ->isAssumption(); +} + bool Constraint::hasIntTightenProof() const { return getProofType() == IntTightenAP; } diff --git a/src/theory/arith/constraint.h b/src/theory/arith/constraint.h index 873b33ced..b32616a04 100644 --- a/src/theory/arith/constraint.h +++ b/src/theory/arith/constraint.h @@ -514,6 +514,11 @@ class Constraint { * */ bool hasSimpleFarkasProof() const; + /** + * Returns whether this constraint is an assumption or a tightened + * assumption. + */ + bool isPossiblyTightenedAssumption() const; /** Returns true if the node has a int bound tightening proof. */ bool hasIntTightenProof() const; diff --git a/src/theory/arith/theory_arith_private.cpp b/src/theory/arith/theory_arith_private.cpp index 39a3a6558..cdf3c16c7 100644 --- a/src/theory/arith/theory_arith_private.cpp +++ b/src/theory/arith/theory_arith_private.cpp @@ -1933,7 +1933,8 @@ void TheoryArithPrivate::outputConflicts(){ } Assert(conflict.getNumChildren() == pf.d_farkasCoefficients->size()); - if (confConstraint->hasSimpleFarkasProof()) + if (confConstraint->hasSimpleFarkasProof() + && confConstraint->getNegation()->isPossiblyTightenedAssumption()) { d_containing.d_proofRecorder->saveFarkasCoefficients( conflictInFarkasCoefficientOrder, pf.d_farkasCoefficients); |