datalog: dl-eval ≡ dl-eval-magic equivalence test (215/215)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s

This commit is contained in:
2026-05-08 10:19:58 +00:00
parent 9695d31dab
commit 7a64be22d8
3 changed files with 20 additions and 6 deletions

View File

@@ -1,8 +1,8 @@
{
"lang": "datalog",
"total_passed": 214,
"total_passed": 215,
"total_failed": 0,
"total": 214,
"total": 215,
"suites": [
{"name":"tokenize","passed":26,"failed":0,"total":26},
{"name":"parse","passed":18,"failed":0,"total":18},
@@ -12,9 +12,9 @@
{"name":"semi_naive","passed":8,"failed":0,"total":8},
{"name":"negation","passed":10,"failed":0,"total":10},
{"name":"aggregates","passed":18,"failed":0,"total":18},
{"name":"api","passed":19,"failed":0,"total":19},
{"name":"api","passed":20,"failed":0,"total":20},
{"name":"magic","passed":22,"failed":0,"total":22},
{"name":"demo","passed":18,"failed":0,"total":18}
],
"generated": "2026-05-08T10:17:32+00:00"
"generated": "2026-05-08T10:19:48+00:00"
}

View File

@@ -1,6 +1,6 @@
# datalog scoreboard
**214 / 214 passing** (0 failure(s)).
**215 / 215 passing** (0 failure(s)).
| Suite | Passed | Total | Status |
|-------|--------|-------|--------|
@@ -12,6 +12,6 @@
| semi_naive | 8 | 8 | ok |
| negation | 10 | 10 | ok |
| aggregates | 18 | 18 | ok |
| api | 19 | 19 | ok |
| api | 20 | 20 | ok |
| magic | 22 | 22 | ok |
| demo | 18 | 18 | ok |

View File

@@ -261,6 +261,20 @@
"?- ancestor(a, X).")
(list {:X (quote b)} {:X (quote c)}))
;; Equivalence: dl-eval and dl-eval-magic produce the same
;; answers for any well-formed query (magic-sets is a perf
;; alternative, not a semantic change).
(dl-api-test! "dl-eval ≡ dl-eval-magic on ancestor"
(let
((source "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
((semi (dl-eval source "?- ancestor(a, X)."))
(magic (dl-eval-magic source "?- ancestor(a, X).")))
(= (len semi) (len magic))))
true)
;; Comprehensive integration: recursion + stratified negation
;; + aggregation + comparison composed in a single program.
;; (Uses _Anything as a regular var instead of `_` so the