Markdown for LLMs
LDC-E4102 — A dependency cycle the strata cannot order
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-E4102 — A dependency cycle the strata cannot order
## What it means
Rules are evaluated stratum by stratum: a rule that reads a predicate
runs only after that predicate's producers have completed. A dependency
cycle through a non-monotone edge — a bare or status-tested read that
loops back to its own producer — has no stratum to run first, so the
program cannot be ordered at all. The compiler refuses the cycle at the
rule that closes it and names the predicates involved.
The fix breaks the loop: read the predicate through a monotone form the
ordering accepts, or restructure so the dependency runs one way only. A
cycle through monotone reads alone stays lawful and 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 A strict { for x: Text; when q(x); then p(x); }
rule B strict { for x: Text; when p(x); then q(x); }
```
## 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 A strict { for x: Text; when q(x); then p(x); }
rule B strict { for x: Text; when r(x); then q(x); }
```
## Engine message
The engine reports this in its own wording:
```text
example.law:8:6: error LDC-E4102: predicate dependency cycle through p → q with a [status] edge — the program is not stratifiable (§110/§191: cycles allow only monotone supported(P) edges §65/§103); cycle rules: A, B
```
## Related
- [Strict rules](/constructs/rule-strict/) — how a strict rule reads its body.
- [Negation and status](/constructs/negation-and-status/) — how negative and status-tested reads behave.