datalog: built-in-only query goals (236/236)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s

This commit is contained in:
2026-05-08 14:19:25 +00:00
parent 21c541bd1b
commit 4a7cff2f6b
3 changed files with 20 additions and 6 deletions

View File

@@ -179,6 +179,20 @@
((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)
;; Built-in / arithmetic literals work as standalone query goals
;; (without needing a wrapper rule).
(dl-bt-test-set! "comparison-only goal true"
(dl-eval "" "?- <(1, 2).")
(list {}))
(dl-bt-test-set! "comparison-only goal false"
(dl-eval "" "?- <(2, 1).")
(list))
(dl-bt-test-set! "is goal binds"
(dl-eval "" "?- is(N, +(2, 3)).")
(list {:N 5}))
;; Bounded successor: a recursive rule with a comparison
;; guard terminates because the Herbrand base is effectively
;; bounded.