datalog: diagonal query (repeated var) regression test (223/223)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s

This commit is contained in:
2026-05-08 10:33:45 +00:00
parent a648247ae4
commit 370df5b8e5
3 changed files with 16 additions and 6 deletions

View File

@@ -273,6 +273,16 @@
(dl-saturated? db))
false)
;; Repeated variable (diagonal): p(X, X) only matches tuples
;; whose two args are equal. The unifier handles this via the
;; subst chain — first occurrence binds X, second occurrence
;; checks against the binding.
(dl-et-test-set! "diagonal query"
(dl-query
(dl-program "p(1, 1). p(2, 3). p(4, 4). p(5, 5).")
(list (quote p) (quote X) (quote X)))
(list {:X 1} {:X 4} {:X 5}))
;; A relation can be both EDB-seeded and rule-derived;
;; saturate combines facts + derivations.
(dl-et-test-set! "mixed EDB + IDB same relation"