From a2b3e450d23d565d2e0e38f1f9d22d813b4f6059 Mon Sep 17 00:00:00 2001 From: Roland Kaminski Date: Mon, 18 May 2026 10:38:27 +0200 Subject: [PATCH] fix occurs check for projection --- lib/cxx-api/tests/solve.cc | 11 +++++++++++ lib/input/src/rewrite/dependency.cc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/cxx-api/tests/solve.cc b/lib/cxx-api/tests/solve.cc index a4bc0db87..a9ea2c2f8 100644 --- a/lib/cxx-api/tests/solve.cc +++ b/lib/cxx-api/tests/solve.cc @@ -202,4 +202,15 @@ TEST_CASE("solve consequence", "[cxx][solve][consequence]") { } } +TEST_CASE("solve bug project", "[cxx][solve][project]") { + auto lib = Library{}; + auto ctl = Control{lib}; + ctl.parse_string("c. { a(f(t)) }. d :- b. e(X) :- a(X). b :- c, e(f(X)). :- not b."); + ctl.ground(); + auto models = std::vector>{}; + auto mcb = MCB{models}; + REQUIRE(ctl.solve({}, mcb).satisfiable()); + REQUIRE(models == std::vector>{{"a(f(t))", "b", "c", "d", "e(f(t))"}}); +} + } // namespace Clingo::Test diff --git a/lib/input/src/rewrite/dependency.cc b/lib/input/src/rewrite/dependency.cc index f8df40093..10ab14273 100644 --- a/lib/input/src/rewrite/dependency.cc +++ b/lib/input/src/rewrite/dependency.cc @@ -226,7 +226,7 @@ class Unifier { if (auto const *term = std::get_if(&arg); term != nullptr) { return occurs_check_(name, *term); } - return false; + return true; }); }