diff --git a/src/vlog/common/concepts.cpp b/src/vlog/common/concepts.cpp index 2458e022..08eb41f1 100644 --- a/src/vlog/common/concepts.cpp +++ b/src/vlog/common/concepts.cpp @@ -1325,7 +1325,13 @@ void Program::addRule(std::vector heads, std::vector body, rewriteRule(heads, body); } else { Rule rule(allrules.size(), heads, body, isEGD); - addRule(rule); + if (heads.size() > 1 && rule.isExistential()) { + // Work-around for bug in existential multihead rules, github issue #98 and issue #64. + // Easiest fix is to just rewrite these rules. + rewriteRule(heads, body); + } else { + addRule(rule); + } } } diff --git a/src/vlog/forward/seminaiver.cpp b/src/vlog/forward/seminaiver.cpp index ad8f5a05..b691a40c 100644 --- a/src/vlog/forward/seminaiver.cpp +++ b/src/vlog/forward/seminaiver.cpp @@ -1831,14 +1831,16 @@ void SemiNaiver::printCountAllIDBs(std::string prefix) { for (PredId_t i = 0; i < program->getNPredicates(); ++i) { if (predicatesTables[i] != NULL) { if (program->isPredicateIDB(i)) { - size_t count = predicatesTables[i]->getNAllRows(); - if (count == 0) { - emptyRel++; - } std::string predname = program->getPredicateName(i); - LOG(DEBUGL) << prefix << "Cardinality of " << - predname << ": " << count; - c += count; + if (predname.rfind("__Generated", 0) != 0) { + // Only count original predicates. + size_t count = predicatesTables[i]->getNAllRows(); + LOG(DEBUGL) << prefix << "Cardinality of " << predname << ": " << count; + if (count == 0) { + emptyRel++; + } + c += count; + } } } }