Pipeline Position
Accepted source flows through the same compiler path as ordinary XLOG programs:- parse source into the frontend AST;
- desugar queries and constraints;
- normalize safe meta builtins;
- normalize finite list builtins;
- apply eligible magic-set rewrites;
- validate deterministic negation safety;
- stratify dependencies;
- lower to RIR and continue through the optimizer and runtime.
Finite Terms
The frontend accepts richer terms only when they have a finite representation:| Surface | Accepted role |
|---|---|
| Named predicate columns | Schema and diagnostics metadata over ordinary relation columns. |
| Domain aliases | Source-level type names resolved before runtime layout. |
| Lists | Finite list literals and safe list builtins normalized to helper relations. |
| Compound terms | Finite functor/argument shapes that can be represented or rejected statically. |
| Predicate references | Static predicate references used by safe meta expansion. |
Safe Meta Subset
The meta layer is intentionally finite. Accepted meta predicates are normalized bymeta_normalize before list normalization and lowering. Unsupported dynamic
forms fail with compiler diagnostics instead of being interpreted by a CPU-side
meta engine.
This keeps accepted programs on the normal typed AST, RIR, statistics, optimizer,
and runtime path.
Magic Sets
#pragma magic_sets = auto|on|off controls bound recursive query rewriting for
the supported deterministic subset.
autorewrites only when the compiler proves the supported shape.onfails closed when the requested rewrite is unsafe or unsupported.offleaves the program on the ordinary recursive path.
Deterministic Negation
Deterministicnot atom is stratified closed-world negation. The compiler
validates source-order safety after normalization and before stratification, then
maps unsafe cycles and binding errors to deterministic negation diagnostics.
This is separate from probabilistic or epistemic semantics.
Probabilistic Aggregates
Finite probabilistic aggregate support is routed throughxlog-prob.
Exact paths enumerate finite aggregate outcomes into provenance/PIR structures;
Monte Carlo paths share aggregate operator semantics with deterministic
aggregate execution.
When an exact finite domain exceeds the accepted cap, the program must report a
typed probabilistic aggregate diagnostic with a remediation path such as Monte
Carlo or domain reduction.
Incremental Parsing And Explain
ParserSession and the incremental parser keep statement spans, parse-cache
statistics, and invalidation data for developer workflows. The CLI explain path
uses the same parser and compiler surfaces to report:
- parse and schema summaries;
- strata and deterministic negation safety;
- magic-set rewrite status;
- normalized and optimized plan shape;
- probabilistic aggregate and approximate-inference metadata where applicable.
Documentation Boundary
When documenting a language feature, state three things:- the source syntax accepted by the parser;
- the finite normalization or lowering path;
- the typed failure mode for unsupported shapes.