Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix subsumption #2407

Merged
merged 4 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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