Markdown for LLMs
LDC-E1318 — Priority over an out-of-scope rule
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-E1318 — Priority over an out-of-scope rule
## What it means
Rule names are scoped: a priority nested inside an interpretation
resolves its sides against the rules of that same reading, not
against the top-level rules that happen to share their names. The
scoping prevents a reading from accidentally binding a sibling
reading's rule — but it also means a nested priority over rules that
live outside the reading binds nothing at all. The compiler stops at
the priority: an edge into the void is refused, not silently kept.
The repair is to declare the rules the priority means inside the same
reading, or to move the priority to the level where its rules live.
A priority and its rules belong to one scope.
## Example
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
relation q(x: Text) kind institutional;
relation p(x: Text) kind institutional;
rule A1 defeasible {
for v0: Text;
when p(v0);
then q(v0);
}
rule A2 defeasible {
for v0: Text;
when p(v0);
then q(v0);
}
interpretation R1 {
status draft;
priority P1 {
prefer A1 over A2;
}
}
```
## Fix
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
relation q(x: Text) kind institutional;
relation p(x: Text) kind institutional;
rule A1 defeasible {
for v0: Text;
when p(v0);
then q(v0);
}
rule A2 defeasible {
for v0: Text;
when p(v0);
then q(v0);
}
interpretation R1 {
status draft;
rule A1 defeasible {
for v0: Text;
when p(v0);
then q(v0);
}
rule A2 defeasible {
for v0: Text;
when p(v0);
then q(v0);
}
priority P1 {
prefer A1 over A2;
}
}
```
## Engine message
The engine reports this in its own wording:
```text
example.law:19:14: error LDC-E1318: priority "P1": side "A1" and "A2" names no package rule (§116); the name is not declared as a rule or the rule dropped out of lowering. Priority over a nonexistent rule never applies
```
## Related
- [Priority](/constructs/priority/) — ordering the inferences that survive attack.
- [LDC-E4108](/diagnostics/LDC-E4108/) — a priority side that names no rule at all.