return getProofType() == TrichotomyAP;
}
+void Constraint::printProofTree(std::ostream& out, size_t depth) const
+{
+#if IS_PROOFS_BUILD
+ const ConstraintRule& rule = getConstraintRule();
+ out << std::string(2 * depth, ' ') << "* " << getVariable() << " [";
+ if (hasLiteral())
+ {
+ out << getLiteral();
+ }
+ else
+ {
+ out << "NOLIT";
+ };
+ out << "]" << ' ' << getType() << ' ' << getValue() << " (" << getProofType()
+ << ")";
+ if (getProofType() == FarkasAP)
+ {
+ out << " [";
+ bool first = true;
+ for (const auto& coeff : *rule.d_farkasCoefficients)
+ {
+ if (not first)
+ {
+ out << ", ";
+ }
+ first = false;
+ out << coeff;
+ }
+ out << "]";
+ }
+ out << endl;
+
+ for (AntecedentId i = rule.d_antecedentEnd; i != AntecedentIdSentinel; --i) {
+ ConstraintCP antecdent = d_database->getAntecedent(i);
+ if (antecdent == NullConstraint) {
+ break;
+ }
+ antecdent->printProofTree(out, depth + 1);
+ }
+#else /* IS_PROOFS_BUILD */
+ out << "Cannot print proof. This is not a proof build." << endl;
+#endif /* IS_PROOFS_BUILD */
+}
+
bool Constraint::sanityChecking(Node n) const {
Comparison cmp = Comparison::parseNormalForm(n);
Kind k = cmp.comparisonKind();
}
Node Constraint::externalExplainConflict() const{
- Debug("pf::arith") << this << std::endl;
+ Debug("pf::arith::explain") << this << std::endl;
Assert(inConflict());
NodeBuilder<> nb(kind::AND);
externalExplainByAssertions(nb);
Assert(!isAssumption() || assertedToTheTheory());
Assert(!isInternalAssumption());
- if (Debug.isOn("pf::arith"))
+ if (Debug.isOn("pf::arith::explain"))
{
- Debug("pf::arith") << "Explaining: " << this << " with rule ";
- getConstraintRule().print(Debug("pf::arith"));
- Debug("pf::arith") << std::endl;
+ Debug("pf::arith::explain") << "Explaining: " << this << " with rule ";
+ getConstraintRule().print(Debug("pf::arith::explain"));
+ Debug("pf::arith::explain") << std::endl;
}
if(assertedBefore(order)){
ConstraintCP antecedent = d_database->d_antecedents[p];
while(antecedent != NullConstraint){
- Debug("pf::arith") << "Explain " << antecedent << std::endl;
+ Debug("pf::arith::explain") << "Explain " << antecedent << std::endl;
antecedent->externalExplain(nb, order);
--p;
antecedent = d_database->d_antecedents[p];
// 0 <= n[0] - toIntSkolem < 1
Node one = mkRationalNode(1);
Node lem = mkAxiomForTotalIntDivision(n[0], one, toIntSkolem);
- d_containing.d_out->lemma(lem);
+ outputLemma(lem);
}else{
toIntSkolem = (*it).second;
}
nm->mkNode(kind::LT, num, nm->mkNode(kind::MULT, den, nm->mkNode(kind::PLUS, intVar, nm->mkConst(Rational(-1))))))));
}
if( !lem.isNull() ){
- d_containing.d_out->lemma(lem);
+ outputLemma(lem);
}
}else{
intVar = (*it).second;
if( it==d_div_skolem.end() ){
var = nm->mkSkolem("nonlinearDiv", nm->realType(), "the result of a non-linear div term");
d_div_skolem[rw] = var;
- d_containing.d_out->lemma(nm->mkNode(kind::IMPLIES, den.eqNode(nm->mkConst(Rational(0))).negate(), nm->mkNode(kind::MULT, den, var).eqNode(num)));
+ outputLemma(nm->mkNode(kind::IMPLIES, den.eqNode(nm->mkConst(Rational(0))).negate(), nm->mkNode(kind::MULT, den, var).eqNode(num)));
}else{
var = (*it).second;
}
ConstraintP floorConstraint = constraint->getFloor();
if(!floorConstraint->isTrue()){
bool inConflict = floorConstraint->negationHasProof();
+ if (Debug.isOn("arith::intbound")) {
+ Debug("arith::intbound") << "literal, before: " << constraint->getLiteral() << std::endl;
+ Debug("arith::intbound") << "constraint, after: " << floorConstraint << std::endl;
+ }
floorConstraint->impliedByIntHole(constraint, inConflict);
floorConstraint->tryToPropagate();
if(inConflict){
ConstraintP ceilingConstraint = constraint->getCeiling();
if(!ceilingConstraint->isTrue()){
bool inConflict = ceilingConstraint->negationHasProof();
+ if (Debug.isOn("arith::intbound")) {
+ Debug("arith::intbound") << "literal, before: " << constraint->getLiteral() << std::endl;
+ Debug("arith::intbound") << "constraint, after: " << ceilingConstraint << std::endl;
+ }
ceilingConstraint->impliedByIntHole(constraint, inConflict);
ceilingConstraint->tryToPropagate();
if(inConflict){
<< conflict[conflict.getNumChildren() - i - 1];
}
+ if (Debug.isOn("arith::pf::tree")) {
+ confConstraint->printProofTree(Debug("arith::pf::tree"));
+ confConstraint->getNegation()->printProofTree(Debug("arith::pf::tree"));
+ }
+
Assert(conflict.getNumChildren() == pf.d_farkasCoefficients->size());
d_containing.d_proofRecorder->saveFarkasCoefficients(
conflictInFarkasCoefficientOrder, pf.d_farkasCoefficients);
Debug("arith::conflict") << "(normalized to) " << conflict << endl;
}
- (d_containing.d_out)->conflict(conflict);
+ outputConflict(conflict);
}
}
if(!d_blackBoxConflict.get().isNull()){
Debug("arith::conflict") << "(normalized to) " << bb << endl;
}
- (d_containing.d_out)->conflict(bb);
+ outputConflict(bb);
}
}
void TheoryArithPrivate::outputLemma(TNode lem) {
- Debug("arith::lemma") << "Arith Lemma: " << lem << std::endl;
+ Debug("arith::channel") << "Arith lemma: " << lem << std::endl;
(d_containing.d_out)->lemma(lem);
}
+void TheoryArithPrivate::outputConflict(TNode lit) {
+ Debug("arith::channel") << "Arith conflict: " << lit << std::endl;
+ (d_containing.d_out)->conflict(lit);
+}
+
+void TheoryArithPrivate::outputPropagate(TNode lit) {
+ Debug("arith::channel") << "Arith propagation: " << lit << std::endl;
+ (d_containing.d_out)->propagate(lit);
+}
+
+void TheoryArithPrivate::outputRestart() {
+ Debug("arith::channel") << "Arith restart!" << std::endl;
+ (d_containing.d_out)->demandRestart();
+}
+
// void TheoryArithPrivate::branchVector(const std::vector<ArithVar>& lemmas){
// //output the lemmas
// for(vector<ArithVar>::const_iterator i = lemmas.begin(); i != lemmas.end();
// * coeffs[i+1] is for explain[i]
d_linEq.propagateRow(explain, ridx, rowUp, implied, coeffs);
if(d_tableau.getRowLength(ridx) <= options::arithPropAsLemmaLength()){
+ if (Debug.isOn("arith::prop::pf")) {
+ for (const auto & constraint : explain) {
+ Assert(constraint->hasProof());
+ constraint->printProofTree(Debug("arith::prop::pf"));
+ }
+ }
Node implication = implied->externalImplication(explain);
Node clause = flattenImplication(implication);
PROOF(if (d_containing.d_proofRecorder