Skip to content

Commit

Permalink
Fix subsumption (#2407)
Browse files Browse the repository at this point in the history
* fix subsumptive rules
  • Loading branch information
julienhenry authored Mar 27, 2023
1 parent dbd2f88 commit 314106d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/ast2ram/seminaive/UnitTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,11 @@ Own<ram::Statement> UnitTranslator::translateSubsumptiveRecursiveClauses(
continue;
}

const auto& sccAtoms = getSccAtoms(clause, scc);
for (std::size_t version = 0; version < sccAtoms.size(); version++) {
// find dominated tuples in the newR by tuples in newR and store them in rejectR
appendStmt(code, context->translateRecursiveClause(*clause, scc, version, SubsumeRejectNewNew));

// find dominated tuples in the newR by tuples in R and store them in rejectR
appendStmt(
code, context->translateRecursiveClause(*clause, scc, version, SubsumeRejectNewCurrent));
}
const std::size_t version = 0;
// find dominated tuples in the newR by tuples in newR and store them in rejectR
appendStmt(code, context->translateRecursiveClause(*clause, scc, version, SubsumeRejectNewNew));
// find dominated tuples in the newR by tuples in R and store them in rejectR
appendStmt(code, context->translateRecursiveClause(*clause, scc, version, SubsumeRejectNewCurrent));
}

// compute new delta set, i.e., deltaR = newR \ rejectR
Expand All @@ -334,8 +330,9 @@ Own<ram::Statement> UnitTranslator::translateSubsumptiveRecursiveClauses(
const auto& sccAtoms = getSccAtoms(clause, scc);
std::size_t sz = sccAtoms.size();
for (std::size_t version = 0; version < sz; version++) {
appendStmt(code, context->translateRecursiveClause(*clause, scc, version,
(sz > 1) ? SubsumeDeleteCurrentCurrent : SubsumeDeleteCurrentDelta));
appendStmt(
code, context->translateRecursiveClause(*clause, scc, version,
(version >= 1) ? SubsumeDeleteCurrentCurrent : SubsumeDeleteCurrentDelta));
}
appendStmt(code, generateEraseTuples(rel, mainRelation, deleteRelation));
appendStmt(code, mk<ram::Clear>(deleteRelation));
Expand Down
2 changes: 2 additions & 0 deletions src/ast2ram/utility/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ std::string getAtomName(const ast::Clause& clause, const ast::Atom* atom,
return getDeltaRelationName(atom->getQualifiedName());
}
}

return getConcreteRelationName(atom->getQualifiedName());
}

if (!isRecursive) {
Expand Down

0 comments on commit 314106d

Please sign in to comment.