Markdown for LLMs
LDC-E1337 — Instance breaks the expansion contract
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-E1337 — Instance breaks the expansion contract
## What it means
An instance fills every slot its template declares: each binder is
bound to a binder parameter, each argument resolves to a value of the
declared shape, and no binder is bound twice. A missing argument, a
binder pointing at a non-binder, or a value that resolves nowhere —
any of these breaks the contract, and the compiler stops at the
offending line.
The repair is to complete the instance: add the missing line, point
the binder at a real binder, or spell a value the package declares. A
complete instance expands exactly as written.
## Example
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
entity Person;
entity Choice;
entity SpecialChoice : Choice;
entity Other;
const Selected: SpecialChoice = entity_ref("urn:choice:selected");
const Wrong: Other = entity_ref("urn:choice:wrong");
relation eligible(p: Person, choice: Choice) kind empirical;
relation applicable(p: Person, choice: Choice) kind institutional;
expansion fixed {
params { subject: binder; choice: value; ground: relation(subject, choice); result: relation(subject, choice); }
emit rule self/result defeasible {
for subject;
when ground(subject, choice);
then result(subject, choice);
scope from self; effective from self; labels from self; source from self;
}
}
expand fixed Result {
label en official "Fixed option";
bind subject = person: Person;
choice = entity_ref("urn:choice:raw");
ground = eligible;
result = applicable;
effective [@2026-01-01, @2027-01-01);
}
```
## Fix
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
entity Person;
entity Choice;
entity SpecialChoice : Choice;
entity Other;
const Selected: SpecialChoice = entity_ref("urn:choice:selected");
const Wrong: Other = entity_ref("urn:choice:wrong");
relation eligible(p: Person, choice: Choice) kind empirical;
relation applicable(p: Person, choice: Choice) kind institutional;
expansion fixed {
params { subject: binder; choice: value; ground: relation(subject, choice); result: relation(subject, choice); }
emit rule self/result defeasible {
for subject;
when ground(subject, choice);
then result(subject, choice);
scope from self; effective from self; labels from self; source from self;
}
}
expand fixed Result {
label en official "Fixed option";
bind subject = person: Person;
choice = Selected;
ground = eligible;
result = applicable;
effective [@2026-01-01, @2027-01-01);
}
```
## Engine message
The engine reports this in its own wording:
```text
example.law:25:5: error LDC-E1337: expand Result: "choice": value is unresolved or incompatible with value<T>
```
## Related
- [LDC-E1336](/diagnostics/LDC-E1336/) — an instance must resolve to exactly one definition.
- [LDC-E1339](/diagnostics/LDC-E1339/) — an instance must carry a label.