datalog: cousin (multi-adornment same-relation) magic test (240/240)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s

This commit is contained in:
2026-05-08 23:00:22 +00:00
parent 62a5a29d5b
commit a4ef271459
3 changed files with 24 additions and 6 deletions

View File

@@ -268,6 +268,24 @@
(= (len semi) 1))))
true)
;; Same relation called with different adornment patterns
;; in different rules. The worklist must enqueue and process
;; each (rel, adornment) pair.
(dl-mt-test! "magic with multi-adornment same relation"
(let
((db (dl-program
"parent(p1, alice). parent(p2, bob).
parent(g, p1). parent(g, p2).
sibling(P1, P2) :- parent(G, P1), parent(G, P2),
!=(P1, P2).
cousin(X, Y) :- parent(P1, X), parent(P2, Y),
sibling(P1, P2).")))
(let
((semi (dl-query db (list (quote cousin) (quote alice) (quote Y))))
(magic (dl-magic-query db (list (quote cousin) (quote alice) (quote Y)))))
(= (len semi) (len magic))))
true)
;; Magic over a rule whose body contains an aggregate.
;; The rewriter passes aggregate body lits through unchanged
;; (no propagation generated for them), so semi-naive's count