Markdown for LLMs
LDC-E4104 — A priority cycle between rules
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-E4104 — A priority cycle between rules
## What it means
Priorities order defeasible rules: one rule preferred over another wins
their conflict. That order must itself be acyclic — a rule preferred over
its rival, which is in turn preferred over the first, leaves no rule on
top and no conflict resolved. The compiler refuses the cycle where the
closing edge lands.
The fix drops or reverses one edge of the loop so the order runs one way.
A single edge between two conflicting rules, and edges that never close
into a loop, stay silent.
## Example
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
relation p(x: Text) kind institutional;
relation q(x: Text) kind institutional;
relation r(x: Text) kind institutional;
rule D1 defeasible { for x: Text; when q(x); then p(x); }
rule D2 defeasible { for x: Text; when q(x); then not p(x); }
rule S1 strict { for x: Text; when q(x); then r(x); }
priority P1 { prefer D1 over D2; }
priority P2 { prefer D2 over D1; }
```
## Fix
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
relation p(x: Text) kind institutional;
relation q(x: Text) kind institutional;
relation r(x: Text) kind institutional;
rule D1 defeasible { for x: Text; when q(x); then p(x); }
rule D2 defeasible { for x: Text; when q(x); then not p(x); }
rule S1 strict { for x: Text; when q(x); then r(x); }
priority P1 { prefer D1 over D2; }
```
## Engine message
The engine reports this in its own wording:
```text
example.law:11:10: error LDC-E4104: static priority cycle between rules [D1, D2] — error in executable profile (§192/§106)
```
## Related
- [Priority](/constructs/priority/) — how conflicts between rules are settled.
- [Defeasible rules](/constructs/rule-defeasible-unless/) — how a rule yields to an exception.