Skip to content

Commit 8518295

Browse files
authored
Merge pull request #635 from potassco/fix/occurs-check-project
fix occurs check for projection
2 parents 8a91b9c + a2b3e45 commit 8518295

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎lib/cxx-api/tests/solve.cc‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,15 @@ TEST_CASE("solve consequence", "[cxx][solve][consequence]") {
202202
}
203203
}
204204

205+
TEST_CASE("solve bug project", "[cxx][solve][project]") {
206+
auto lib = Library{};
207+
auto ctl = Control{lib};
208+
ctl.parse_string("c. { a(f(t)) }. d :- b. e(X) :- a(X). b :- c, e(f(X)). :- not b.");
209+
ctl.ground();
210+
auto models = std::vector<std::vector<std::string>>{};
211+
auto mcb = MCB{models};
212+
REQUIRE(ctl.solve({}, mcb).satisfiable());
213+
REQUIRE(models == std::vector<std::vector<std::string>>{{"a(f(t))", "b", "c", "d", "e(f(t))"}});
214+
}
215+
205216
} // namespace Clingo::Test

‎lib/input/src/rewrite/dependency.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class Unifier {
226226
if (auto const *term = std::get_if<Term>(&arg); term != nullptr) {
227227
return occurs_check_(name, *term);
228228
}
229-
return false;
229+
return true;
230230
});
231231
}
232232

0 commit comments

Comments
 (0)