datalog: indirect aggregate cycle rejected (230/230)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 57s

This commit is contained in:
2026-05-08 14:08:02 +00:00
parent 9edccb8f33
commit f12edc8fd9
3 changed files with 24 additions and 6 deletions

View File

@@ -1,8 +1,8 @@
{
"lang": "datalog",
"total_passed": 229,
"total_passed": 230,
"total_failed": 0,
"total": 229,
"total": 230,
"suites": [
{"name":"tokenize","passed":26,"failed":0,"total":26},
{"name":"parse","passed":18,"failed":0,"total":18},
@@ -11,10 +11,10 @@
{"name":"builtins","passed":20,"failed":0,"total":20},
{"name":"semi_naive","passed":8,"failed":0,"total":8},
{"name":"negation","passed":10,"failed":0,"total":10},
{"name":"aggregates","passed":19,"failed":0,"total":19},
{"name":"aggregates","passed":20,"failed":0,"total":20},
{"name":"api","passed":20,"failed":0,"total":20},
{"name":"magic","passed":28,"failed":0,"total":28},
{"name":"demo","passed":21,"failed":0,"total":21}
],
"generated": "2026-05-08T12:38:51+00:00"
"generated": "2026-05-08T14:07:50+00:00"
}

View File

@@ -1,6 +1,6 @@
# datalog scoreboard
**229 / 229 passing** (0 failure(s)).
**230 / 230 passing** (0 failure(s)).
| Suite | Passed | Total | Status |
|-------|--------|-------|--------|
@@ -11,7 +11,7 @@
| builtins | 20 | 20 | ok |
| semi_naive | 8 | 8 | ok |
| negation | 10 | 10 | ok |
| aggregates | 19 | 19 | ok |
| aggregates | 20 | 20 | ok |
| api | 20 | 20 | ok |
| magic | 28 | 28 | ok |
| demo | 21 | 21 | ok |

View File

@@ -244,6 +244,24 @@
{:U (quote carol) :N 0}))
;; Stratification: recursion through aggregation is rejected.
;; Indirect recursion through aggregation also rejected.
;; q -> r (via positive lit), r -> q (via aggregate body).
;; The aggregate edge counts as negation for stratification.
(dl-at-test! "indirect agg cycle rejected"
(dl-at-throws?
(fn ()
(let ((db (dl-make-db)))
(do
(dl-add-rule! db
{:head (list (quote q) (quote N))
:body (list (list (quote r) (quote N)))})
(dl-add-rule! db
{:head (list (quote r) (quote N))
:body (list (list (quote count) (quote N) (quote X)
(list (quote q) (quote X))))})
(dl-saturate! db)))))
true)
(dl-at-test! "agg recursion rejected"
(dl-at-throws?
(fn ()