datalog: magic preserves arithmetic test (221/221)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s

This commit is contained in:
2026-05-08 10:29:14 +00:00
parent 549cb5ea84
commit 5a3db1a458
3 changed files with 18 additions and 6 deletions

View File

@@ -1,8 +1,8 @@
{
"lang": "datalog",
"total_passed": 220,
"total_passed": 221,
"total_failed": 0,
"total": 220,
"total": 221,
"suites": [
{"name":"tokenize","passed":26,"failed":0,"total":26},
{"name":"parse","passed":18,"failed":0,"total":18},
@@ -13,8 +13,8 @@
{"name":"negation","passed":10,"failed":0,"total":10},
{"name":"aggregates","passed":19,"failed":0,"total":19},
{"name":"api","passed":20,"failed":0,"total":20},
{"name":"magic","passed":22,"failed":0,"total":22},
{"name":"magic","passed":23,"failed":0,"total":23},
{"name":"demo","passed":21,"failed":0,"total":21}
],
"generated": "2026-05-08T10:27:32+00:00"
"generated": "2026-05-08T10:29:04+00:00"
}

View File

@@ -1,6 +1,6 @@
# datalog scoreboard
**220 / 220 passing** (0 failure(s)).
**221 / 221 passing** (0 failure(s)).
| Suite | Passed | Total | Status |
|-------|--------|-------|--------|
@@ -13,5 +13,5 @@
| negation | 10 | 10 | ok |
| aggregates | 19 | 19 | ok |
| api | 20 | 20 | ok |
| magic | 22 | 22 | ok |
| magic | 23 | 23 | ok |
| demo | 21 | 21 | ok |

View File

@@ -256,6 +256,18 @@
(and (= semi-count 78) (= magic-count 12))))))
true)
;; Magic + arithmetic: rules with `is` clauses pass through
;; the rewriter unchanged (built-ins aren't propagated).
(dl-mt-test! "magic preserves arithmetic"
(let
((source "n(1). n(2). n(3).
doubled(X, Y) :- n(X), is(Y, *(X, 2))."))
(let
((semi (dl-eval source "?- doubled(2, Y)."))
(magic (dl-eval-magic source "?- doubled(2, Y).")))
(= (len semi) (len magic))))
true)
(dl-mt-test! "magic skips irrelevant clusters"
(let
;; Two disjoint chains. Query is rooted in cluster 1.