datalog: magic-sets building blocks (199/199)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s

Adds the primitives a future magic-sets rewriter will compose:

  dl-magic-rel-name rel adornment    → "magic_<rel>^<adornment>"
  dl-magic-lit rel adn bound-args    → magic literal as SX list
  dl-bound-args lit adornment        → bound-position arg values

Rewriter algorithm (worklist over (rel, adornment) pairs,
generating seed, propagation, and adorned-rule outputs) is still
TODO — these helpers are inspection-only for now.

4 new magic tests cover naming, lit construction, and bound-args
extraction (mixed/free).
This commit is contained in:
2026-05-08 09:53:38 +00:00
parent 71b73bd87e
commit 2a01d8ac91
5 changed files with 80 additions and 7 deletions

View File

@@ -156,6 +156,8 @@ large graphs.
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.
*Building blocks present in `magic.sx`: `dl-magic-rel-name`,
`dl-magic-lit`, `dl-bound-args`. Full rewriter still TODO.*
- [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
@@ -289,6 +291,12 @@ large graphs.
_Newest first._
- 2026-05-08 — Phase 6 building blocks for the magic-sets
transformation: `dl-magic-rel-name`, `dl-magic-lit`,
`dl-bound-args`. The rewriter that generates magic seed and
propagation rules is still future work; with these primitives
in place it's a straightforward worklist algorithm. 4 new tests.
- 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