LDC-E2122 — A comparison across two different enumerations
For LLMs5 sections
What it means
Section titled “What it means”Members of an enumeration compare only within their own enumeration: the comparison goes by the member identity, and members of different enumerations are incomparable rather than unequal. At execution such a comparison would poison the whole document instead of answering false, so the compiler refuses the guard statically at the comparison.
The fix compares within one enumeration — a member against a value of the same enumeration — or relates the two values through a relation instead of comparing them directly. Ordering comparisons over enumerations are refused the same way, since ordering is undefined over them entirely.
Example
Section titled “Example”language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
entity P;enum RiskLevel { Low, High }enum Stage { First, Last }relation level_of(p: P, l: RiskLevel) kind empirical;relation stage_of(p: P, s: Stage) kind empirical;relation ok(p: P) kind institutional;rule R strict { for p: P; for l: RiskLevel; for s: Stage; when level_of(p, l) and stage_of(p, s) and (l == First); then ok(p); }language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
entity P;enum RiskLevel { Low, High }enum Stage { First, Last }relation level_of(p: P, l: RiskLevel) kind empirical;relation stage_of(p: P, s: Stage) kind empirical;relation ok(p: P) kind institutional;rule R strict { for p: P; for l: RiskLevel; for s: Stage; when level_of(p, l) and stage_of(p, s) and (l == Low); then ok(p); }Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.