d_literal(Node::null()),
d_negation(NullConstraint),
d_canBePropagated(false),
- d_assertionOrder(AssertionOrderSentinel),
+ _d_assertionOrder(AssertionOrderSentinel),
+ d_witness(TNode::null()),
d_proof(ProofIdSentinel),
d_split(false),
d_variablePosition()
d_database->pushCanBePropagatedWatch(this);
}
-void ConstraintValue::setAssertedToTheTheory() {
+void ConstraintValue::setAssertedToTheTheory(TNode witness) {
Assert(hasLiteral());
Assert(!assertedToTheTheory());
Assert(!d_negation->assertedToTheTheory());
- d_database->pushAssertionOrderWatch(this);
+ d_database->pushAssertionOrderWatch(this, witness);
}
bool ConstraintValue::isSelfExplaining() const {
Assert(!isSelfExplaining() || assertedToTheTheory());
if(assertedBefore(order)){
- nb << getLiteral();
+ nb << getWitness();
}else if(hasEqualityEngineProof()){
d_database->eeExplain(this, nb);
}else{
Assert(hasProof());
Assert(!isSelfExplaining() || assertedBefore(order));
if(assertedBefore(order)){
- return getLiteral();
+ return getWitness();
}else if(hasEqualityEngineProof()){
return d_database->eeExplain(this);
}else{
* Sat Context Dependent.
* This is initially AssertionOrderSentinel.
*/
- AssertionOrder d_assertionOrder;
+ AssertionOrder _d_assertionOrder;
+ /**
+ * This is guarenteed to be on the fact queue.
+ * For example if x + y = x + 1 is on the fact queue, then use this
+ */
+ TNode d_witness;
/**
* This points at the proof for the constraint in the current context.
inline void operator()(Constraint* p){
Constraint constraint = *p;
Assert(constraint->assertedToTheTheory());
- constraint->d_assertionOrder = AssertionOrderSentinel;
+ constraint->_d_assertionOrder = AssertionOrderSentinel;
+ constraint->d_witness = TNode::null();
Assert(!constraint->assertedToTheTheory());
}
};
}
bool assertedToTheTheory() const {
- return d_assertionOrder < AssertionOrderSentinel;
+ Assert((_d_assertionOrder < AssertionOrderSentinel) != d_witness.isNull());
+ return _d_assertionOrder < AssertionOrderSentinel;
+ }
+ TNode getWitness() const {
+ Assert(assertedToTheTheory());
+ return d_witness;
}
bool assertedBefore(AssertionOrder time) const {
- return d_assertionOrder < time;
+ return _d_assertionOrder < time;
}
- void setAssertedToTheTheory();
+ void setAssertedToTheTheory(TNode witness);
bool hasLiteral() const {
Node explainForPropagation() const {
Assert(hasProof());
Assert(!isSelfExplaining());
- return explainBefore(d_assertionOrder);
+ return explainBefore(_d_assertionOrder);
}
private:
d_watches->d_canBePropagatedWatches.push_back(c);
}
- void pushAssertionOrderWatch(Constraint c){
+ void pushAssertionOrderWatch(Constraint c, TNode witness){
Assert(!c->assertedToTheTheory());
- c->d_assertionOrder = d_watches->d_assertionOrderWatches.size();
+ c->_d_assertionOrder = d_watches->d_assertionOrderWatches.size();
+ c->d_witness = witness;
d_watches->d_assertionOrderWatches.push_back(c);
}
return NullConstraint;
}else{
Debug("arith::constraint") << "arith constraint " << constraint << std::endl;
- constraint->setAssertedToTheTheory();
+ constraint->setAssertedToTheTheory(assertion);
if(!constraint->hasProof()){
Debug("arith::constraint") << "marking as constraint as self explaining " << endl;
d_out->propagate(literal);
}else{
- Node literal = c->getLiteral();
- Debug("arith::prop") << "already asserted to the theory " << literal << endl;
+ Debug("arith::prop") << "already asserted to the theory " << c->getLiteral() << endl;
}
}