LDC-E1317 — Free variable in a comprehension
For LLMs5 sections
What it means
Section titled “What it means”A comprehension introduces exactly one variable of its own; every other name inside the generator must arrive bound — by a rule binder, by a local binding, or as a declared package symbol. A name with no binder anywhere is free, and silent substitution would build a query that never fires, so the compiler stops at the name.
The repair is to bind the name: add it to the rule binders, or spell the intended bound variable. A generator where every name resolves lowers exactly as written.
Example
Section titled “Example”language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
entity Tenant;relation team(t: Tenant) kind empirical;relation scored(t: Tenant, g: Integer) kind empirical;relation total(t: Tenant, n: Integer) kind derived;rule Total strict { for t: Tenant; when team(t); then total(t, sum(collect all g: Integer where scored(m, g)));}language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
entity Tenant;relation team(t: Tenant) kind empirical;relation scored(t: Tenant, g: Integer) kind empirical;relation total(t: Tenant, n: Integer) kind derived;rule Total strict { for t: Tenant; when team(t); then total(t, sum(collect all g: Integer where scored(t, g)));}Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.