docs← Back to article

Markdown for LLMs

LDC-E1322 — Free variable in a definition body

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# LDC-E1322 — Free variable in a definition body

## What it means

A definition body may use exactly two kinds of names: its own
parameters, and symbols the package declares. A definition introduces
no binder of its own, so an auxiliary name has nowhere to be
introduced — a term that needs one belongs in a rule with a binder.
A body name that is neither a parameter nor a declared symbol is free,
and the compiler stops at it instead of substituting a constant that
would never derive.

The repair is to spell a parameter, or to declare the missing symbol.
A body where every name resolves lowers exactly as written.

## Example

```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";

entity Tenant;
relation tall(t: Tenant) kind institutional;
definition Adult(x: Tenant) exact {
    when tall(y);
}
```

## Fix

```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";

entity Tenant;
relation tall(t: Tenant) kind institutional;
definition Adult(x: Tenant) exact {
    when tall(x);
}
```

## Engine message

The engine reports this in its own wording:

```text
example.law:8:15: error LDC-E1322: name "y" in a §151 `definition` body is neither its parameter nor a declared package symbol — it is a free variable (§188 unresolved name). A definition has NO binder (§529 grammar), so there is nowhere to introduce an auxiliary name: a term needing an intermediate link is expressed with a `for` rule. Silent constant substitution would yield a predicate that never derives
```

## Related

- [Definitions](/constructs/definition/) — parameters and what a definition body may use.
- [Strict rules](/constructs/rule-strict/) — rules and the binders definitions lack.