/******************** Model generation ********************/
const TheorySetsPrivate::Elements& TheorySetsPrivate::getElements
-(TNode setterm, SettermElementsMap& settermElementsMap) {
+(TNode setterm, SettermElementsMap& settermElementsMap) const {
SettermElementsMap::const_iterator it = settermElementsMap.find(setterm);
bool alreadyCalculated = (it != settermElementsMap.end());
if( !alreadyCalculated ) {
}
-void printSet(std::ostream& out, const std::set<TNode>& elements) {
- out << "{ ";
- std::copy(elements.begin(),
- elements.end(),
- std::ostream_iterator<TNode>(out, ", ")
- );
- out << " }";
-}
-
void TheorySetsPrivate::checkModel(const SettermElementsMap& settermElementsMap, TNode S) const {
Assert(S.getType().isSet());
Elements emptySetOfElements;
- const Elements& saved =
+ const Elements& saved =
d_equalityEngine.getRepresentative(S).getKind() == kind::EMPTYSET ?
emptySetOfElements :
settermElementsMap.find(d_equalityEngine.getRepresentative(S))->second;
- Debug("sets-model") << "[sets-model] saved : ";
- printSet(Debug("sets-model"), saved);
- Debug("sets-model") << std::endl;
+ Debug("sets-model") << "[sets-model] saved : { ";
+ BOOST_FOREACH(TNode element, saved) { Debug("sets-model") << element << ", "; }
+ Debug("sets-model") << " }" << std::endl;
if(S.getNumChildren() == 2) {
Unhandled();
}
- Debug("sets-model") << "[sets-model] cur : ";
- printSet(Debug("sets-model"), cur);
- Debug("sets-model") << std::endl;
+ Debug("sets-model") << "[sets-model] cur : { ";
+ BOOST_FOREACH(TNode element, cur) { Debug("sets-model") << element << ", "; }
+ Debug("sets-model") << " }" << std::endl;
if(saved != cur) {
Debug("sets-model") << "[sets-model] *** ERRROR *** cur != saved "
bool TheorySetsPrivate::NotifyClass::eqNotifyTriggerEquality(TNode equality, bool value)
{
- Debug("sets-eq") << "[sets-eq] eqNotifyTriggerEquality: equality = " << equality
+ Debug("sets-eq") << "[sets-eq] eqNotifyTriggerEquality: equality = " << equality
<< " value = " << value << std::endl;
if (value) {
return d_theory.propagate(equality);
bool TheorySetsPrivate::NotifyClass::eqNotifyTriggerTermEquality(TheoryId tag, TNode t1, TNode t2, bool value)
{
- Debug("sets-eq") << "[sets-eq] eqNotifyTriggerTermEquality: tag = " << tag
+ Debug("sets-eq") << "[sets-eq] eqNotifyTriggerTermEquality: tag = " << tag
<< " t1 = " << t1 << " t2 = " << t2 << " value = " << value << std::endl;
if(value) {
d_theory.d_termInfoManager->mergeTerms(t1, t2);
/** model generation and helper function */
typedef std::set<TNode> Elements;
typedef std::hash_map<TNode, Elements, TNodeHashFunction> SettermElementsMap;
- const Elements& getElements(TNode setterm, SettermElementsMap& settermElementsMap);
+ const Elements& getElements(TNode setterm, SettermElementsMap& settermElementsMap) const;
Node elementsToShape(Elements elements, TypeNode setType) const;
void checkModel(const SettermElementsMap& settermElementsMap, TNode S) const;
};/* class TheorySetsPrivate */
}
Node TheoryModel::getValue(TNode n) const {
- Debug("model-getvalue") << "[model-getvalue] getValue( " << n << " ) "
- << std::endl;
-
//apply substitutions
Node nn = d_substitutions.apply(n);
- Debug("model-getvalue") << "[model-getvalue] getValue( " << n << " ) post-sub:"
- << nn << std::endl;
-
//get value in model
nn = getModelValue(nn);
- Debug("model-getvalue") << "[model-getvalue] getValue( " << n << " ) getmodelvalue: "
- << nn << std::endl;
-
if(options::condenseFunctionValues() || nn.getKind() != kind::LAMBDA) {
//normalize
nn = Rewriter::rewrite(nn);
}
-
Debug("model-getvalue") << "[model-getvalue] getValue( " << n << " ): returning"
<< nn << std::endl;
return nn;
/** add substitution */
void TheoryModel::addSubstitution( TNode x, TNode t, bool invalidateCache ){
- Debug("model-builder") << "TheoryModel::addSubstitution("<< x << ", " << t
- << ", invalidateCache = " << invalidateCache << ")\n";
if( !d_substitutions.hasSubstitution( x ) ){
d_substitutions.addSubstitution( x, t, invalidateCache );
} else {