datalog: Phase 6 adornments + SIPS analysis (194/194)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
New lib/datalog/magic.sx — first piece of magic-sets:
dl-adorn-arg arg bound → "b" or "f"
dl-adorn-args args bound → adornment string
dl-adorn-goal goal → adornment under empty bound set
dl-adorn-lit lit bound → adornment of any literal
dl-vars-bound-by-lit lit bound → free vars this lit will bind
dl-init-head-bound head adn → bound set seeded from head adornment
dl-rule-sips rule head-adn → ({:lit :adornment} ...) per body lit
SIPS walks left-to-right tracking the bound set; recognises `is` and
aggregate result-vars as new binders, lets comparisons and negation
pass through with computed adornments.
Inspection-only — saturator doesn't yet consume these. Lays
groundwork for a future magic-sets transformation.
10 new tests cover pure adornment, SIPS over a chain rule,
head-fully-bound rules, comparisons, and `is`. Total 194/194.
This commit is contained in:
@@ -151,12 +151,17 @@ Naive bottom-up derives **all** consequences before answering. Magic sets
|
||||
rewrite the program so the fixpoint only derives tuples relevant to the
|
||||
goal — a major perf win for "what's reachable from node X" queries on
|
||||
large graphs.
|
||||
- [ ] Adornments: annotate rule predicates with bound (`b`) / free (`f`)
|
||||
patterns based on how they're called.
|
||||
- [x] Adornments: `dl-adorn-goal goal` and `dl-adorn-lit lit bound` in
|
||||
`lib/datalog/magic.sx`. Per-arg `b`/`f` based on whether the arg
|
||||
is a constant or a variable already in the bound set.
|
||||
- [ ] Magic transformation: for each adorned predicate, generate a
|
||||
`magic_<pred>` relation and rewrite rule bodies to filter through it.
|
||||
- [ ] Sideways information passing strategy (SIPS): left-to-right by
|
||||
default; pluggable.
|
||||
- [x] Sideways information passing strategy (SIPS): left-to-right
|
||||
`dl-rule-sips rule head-adornment` walks body literals tracking
|
||||
the bound set, returning `({:lit :adornment} ...)`. Recognises
|
||||
`is`/aggregate result-vars as new binders; comparisons and
|
||||
negation pass through with computed adornments. (Pluggable
|
||||
strategies are future work.)
|
||||
- [x] `dl-set-strategy! db strategy` hook + `dl-get-strategy db`. Default
|
||||
`:semi-naive`. `:magic` accepted but the transformation itself is
|
||||
deferred — saturator currently falls back to semi-naive. Tests
|
||||
@@ -284,6 +289,16 @@ large graphs.
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-08 — Phase 6 adornments + SIPS in
|
||||
`lib/datalog/magic.sx`. Inspection helpers — `dl-adorn-goal` and
|
||||
`dl-adorn-lit` compute per-arg `b`/`f` patterns under a bound
|
||||
set; `dl-rule-sips rule head-adornment` walks body literals
|
||||
left-to-right propagating the bound set, recognising `is` and
|
||||
aggregate result-vars as new binders. Lays groundwork for a
|
||||
later magic-sets transformation. 10 new tests cover pure
|
||||
adornment, SIPS over a chain rule, head-fully-bound rules,
|
||||
comparisons, and `is`. Saturator does not yet consume these.
|
||||
|
||||
- 2026-05-08 — Comprehensive integration test in api suite: a
|
||||
single program exercising recursion (`reach` transitive closure)
|
||||
+ stratified negation (`safe X Y :- reach X Y, not banned Y`) +
|
||||
|
||||
Reference in New Issue
Block a user