datalog: magic existence check (bb-adornment) regression test (228/228)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s

This commit is contained in:
2026-05-08 12:35:33 +00:00
parent 5f4defe99e
commit 8e508bc90f
3 changed files with 23 additions and 6 deletions

View File

@@ -211,6 +211,23 @@
(= (len semi) (len magic))))
true)
;; All-bound query (existence check) generates an "bb"
;; adornment chain. Verifies the rewriter walks multiple
;; (rel, adn) pairs through the worklist.
(dl-mt-test! "magic existence check via bb"
(let
((db (dl-program
"parent(a, b). parent(b, c). parent(c, d).
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).")))
(let
((found (dl-magic-query
db (list (quote ancestor) (quote a) (quote c))))
(missing (dl-magic-query
db (list (quote ancestor) (quote a) (quote z)))))
(and (= (len found) 1) (= (len missing) 0))))
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