datalog: bounded-successor regression test (224/224)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s

This commit is contained in:
2026-05-08 10:36:13 +00:00
parent 370df5b8e5
commit ec7e4dd5c4
3 changed files with 17 additions and 6 deletions

View File

@@ -179,6 +179,17 @@
((db (dl-program "n(0). n(1). n(2). n(3). n(4). n(5). n(6). n(7). n(8). n(9).\n big(X) :- n(X), >=(X, 5).")))
(do (dl-saturate! db) (len (dl-relation db "big"))))
5)
;; Bounded successor: a recursive rule with a comparison
;; guard terminates because the Herbrand base is effectively
;; bounded.
(dl-bt-test-set! "bounded successor"
(dl-query
(dl-program
"nat(0).
nat(Y) :- nat(X), is(Y, +(X, 1)), <(Y, 5).")
(list (quote nat) (quote X)))
(list {:X 0} {:X 1} {:X 2} {:X 3} {:X 4}))
(dl-bt-test!
"unsafe — comparison without binder"
(dl-bt-throws? (fn () (dl-program "p(X) :- <(X, 5).")))