Debug("bitvector-bb") << " with bits " << toString(bits);
}
- bb->storeVariable(node);
+ bb->storeVariable(node);
}
void DefaultConstBB (TNode node, Bits& bits, Bitblaster* bb) {
}
return true;
}
-
+/**
+ * Returns the value a is currently assigned to in the SAT solver
+ * or null if the value is completely unassigned.
+ *
+ * @param a
+ *
+ * @return
+ */
Node Bitblaster::getVarValue(TNode a) {
- Assert (d_termCache.find(a) != d_termCache.end());
+ if (d_termCache.find(a) == d_termCache.end()) {
+ return Node();
+ }
Bits bits = d_termCache[a];
Integer value(0);
for (int i = bits.size() -1; i >= 0; --i) {
TNode var = *it;
if (Theory::theoryOf(var) == theory::THEORY_BV || isSharedTerm(var)) {
Node const_value = getVarValue(var);
+ if(const_value == Node()) {
+ // if the value is unassigned just set it to zero
+ const_value = utils::mkConst(BitVector(utils::getSize(var), 0u));
+ }
Debug("bitvector-model") << "Bitblaster::collectModelInfo (assert (= "
<< var << " "
<< const_value << "))\n";
}
Node BitblastSolver::getModelValue(TNode node) {
- return d_bitblaster->getVarValue(node);
+ Node val = d_bitblaster->getVarValue(node);
+ Assert (val != Node() || d_bv->isSharedTerm(node));
+ return val;
}
if (repr.getKind() == kind::CONST_BITVECTOR) {
return repr;
}
- Assert (d_modelValues.find(repr) != d_modelValues.end());
+ if (d_modelValues.find(repr) == d_modelValues.end()) {
+ // it may be a shared term that never gets asserted
+ Assert(d_bv->isSharedTerm(var));
+ return Node();
+ }
return d_modelValues[repr];
}
Node InequalitySolver::getModelValue(TNode var) {
Assert (isComplete());
- Assert (d_inequalityGraph.hasValueInModel(var));
+ if (!d_inequalityGraph.hasValueInModel(var)) {
+ Assert (d_bv->isSharedTerm(var));
+ return Node();
+ }
BitVector val = d_inequalityGraph.getValueInModel(var);
return utils::mkConst(val);
}