Skip to content

Commit

Permalink
Merge branch '1.4.x'
Browse files Browse the repository at this point in the history
Conflicts:
	test/regress/regress0/Makefile.am
  • Loading branch information
mdeters committed Nov 7, 2014
2 parents 56a523d + 61042cf commit 7b8902f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
39 changes: 36 additions & 3 deletions src/smt/model_postprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ Node ModelPostprocessor::rewriteAs(TNode n, TypeNode asType) {
// good to go, we have the right type
return n;
}
if(n.getKind() == kind::LAMBDA) {
Assert(asType.isFunction());
Node rhs = rewriteAs(n[1], asType[1]);
Node out = NodeManager::currentNM()->mkNode(kind::LAMBDA, n[0], rhs);
Debug("boolean-terms") << "rewrote " << n << " as " << out << std::endl;
Debug("boolean-terms") << "need type " << asType << endl;
Assert(out.getType() == asType);
return out;
}
if(!n.isConst()) {
// we don't handle non-const right now
return n;
Expand Down Expand Up @@ -236,8 +245,32 @@ void ModelPostprocessor::visit(TNode current, TNode parent) {
<< "- returning " << n << endl;
d_nodes[current] = n;
} else {
Debug("tuprec") << "returning self for kind " << current.getKind() << endl;
// rewrite to self
d_nodes[current] = Node::null();
// rewrite based on children
bool self = true;
for(size_t i = 0; i < current.getNumChildren(); ++i) {
Assert(d_nodes.find(current[i]) != d_nodes.end());
if(!d_nodes[current[i]].isNull()) {
self = false;
break;
}
}
if(self) {
Debug("tuprec") << "returning self for kind " << current.getKind() << endl;
// rewrite to self
d_nodes[current] = Node::null();
} else {
// rewrite based on children
NodeBuilder<> nb(current.getKind());
for(size_t i = 0; i < current.getNumChildren(); ++i) {
Assert(d_nodes.find(current[i]) != d_nodes.end());
TNode rw = d_nodes[current[i]];
if(rw.isNull()) {
rw = current[i];
}
nb << rw;
}
d_nodes[current] = nb;
Debug("tuprec") << "rewrote children for kind " << current.getKind() << " got " << d_nodes[current] << endl;
}
}
}/* ModelPostprocessor::visit() */
1 change: 1 addition & 0 deletions src/smt/smt_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3568,6 +3568,7 @@ Result SmtEngine::assertFormula(const Expr& ex, bool inUnsatCore) throw(TypeChec
Node SmtEngine::postprocess(TNode node, TypeNode expectedType) const {
ModelPostprocessor mpost;
NodeVisitor<ModelPostprocessor> visitor;
Debug("boolean-terms") << "postproc: visit " << node << endl;
Node value = visitor.run(mpost, node);
Debug("boolean-terms") << "postproc: got " << value << " expect type " << expectedType << endl;
Node realValue = mpost.rewriteAs(value, expectedType);
Expand Down
3 changes: 2 additions & 1 deletion test/regress/regress0/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ BUG_TESTS = \
bug578.smt2 \
bug585.cvc \
bug586.cvc \
bug590.smt2
bug590.smt2 \
bug595.cvc

TESTS = $(SMT_TESTS) $(SMT2_TESTS) $(CVC_TESTS) $(TPTP_TESTS) $(BUG_TESTS)

Expand Down
7 changes: 7 additions & 0 deletions test/regress/regress0/bug595.cvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
% EXPECT: sat

f : INT -> [# i:INT, b:INT #];
a : INT;
ASSERT f(a) /= (# i := 0, b := 0 #);

CHECKSAT;

0 comments on commit 7b8902f

Please sign in to comment.