namespace theory {
namespace builtin {
-Node blastDistinct(TNode in) {
- Debug("theory-rewrite") << "blastDistinct: " << in << std::endl;
+Node TheoryBuiltin::blastDistinct(TNode in) {
+ Debug("theory-rewrite") << "TheoryBuiltin::blastDistinct: " << in << std::endl;
Assert(in.getKind() == kind::DISTINCT);
if(in.getNumChildren() == 2) {
// if this is the case exactly 1 != pair will be generated so the
return out;
}
-RewriteResponse TheoryBuiltin::postRewrite(TNode in, bool topLevel) {
- if(topLevel) {
- if(in.getKind() == kind::DISTINCT) {
- return RewritingComplete(blastDistinct(in));
- }
- }
+RewriteResponse TheoryBuiltin::preRewrite(TNode in, bool topLevel) {
+ switch(in.getKind()) {
+ case kind::DISTINCT:
+ return RewritingComplete(blastDistinct(in));
- // EQUAL is a special case that should never end up here
- Assert(in.getKind() != kind::EQUAL);
+ case kind::EQUAL:
+ // EQUAL is a special case that should never end up here
+ Unreachable("TheoryBuiltin can't rewrite EQUAL !");
- return RewritingComplete(in);
+ default:
+ return RewritingComplete(in);
+ }
}
}/* CVC4::theory::builtin namespace */
namespace builtin {
class TheoryBuiltin : public Theory {
+ /** rewrite a DISTINCT expr */
+ static Node blastDistinct(TNode in);
+
public:
TheoryBuiltin(context::Context* c, OutputChannel& out) : Theory(c, out) { }
~TheoryBuiltin() { }
void propagate(Effort e) { Unreachable(); }
void explain(TNode n, Effort e) { Unreachable(); }
void shutdown() { }
- RewriteResponse postRewrite(TNode n, bool topLevel);
+ RewriteResponse preRewrite(TNode n, bool topLevel);
std::string identify() const { return std::string("TheoryBuiltin"); }
};/* class TheoryBuiltin */