Boolean Logic
TRUE and FALSE values are combined using the operators AND, OR, NOT, and IMPLIES.
Example: XOR Function
§ xor
GIVEN x IS A BOOLEAN, y IS A BOOLEAN
GIVETH A BOOLEAN
DECIDE xor x y IS
x AND NOT y
OR NOT x AND yInert Elements: Grammatical Scaffolding
Legal documents often contain phrases that provide context or readability but don't affect the logical outcome. L4 supports inert elements—bare string literals in boolean context that serve as grammatical scaffolding.
How Inert Elements Work
When a string literal (in double quotes) appears as a direct operand of AND or OR, it becomes an inert element with context-aware evaluation:
In AND context: Evaluates to
TRUE(the identity for AND)In OR context: Evaluates to
FALSE(the identity for OR)
This follows the mathematical principle of monoid identities: the value that, when combined with any other value using the operation, returns that other value unchanged.
Example: Contract Validity
The string "notwithstanding any provision to the contrary" evaluates to TRUE in this AND chain, so the result depends only on the actual boolean parameters.
Example: Legal Conditions with OR
Here:
"whether in sickness or in health"is in AND context → evaluates toTRUE"or any other qualifying circumstance"is in OR context → evaluates toFALSE
The inert strings don't change the logical outcome but make the rule more readable and closer to natural legal language.
Asyndetic Conjunction (...)
...)L4 supports asyndetic conjunction—continuing an AND chain without repeating the conjunction keyword. The ellipsis (...) is the syntax for this feature; asyndetic conjunction is the semantics (what it means).
An asyndeton is a rhetorical device where conjunctions are deliberately omitted, as in "I came, I saw, I conquered" (instead of "I came and I saw and I conquered").
This is equivalent to:
Real-World Example: Singapore Penal Code Section 415
The inert elements feature enables direct encoding of complex legal structures like criminal statutes:
The strings like "by deceiving any person" and "the person so deceived to" preserve the original statutory language while the boolean parameters (deceives, fraudulent, etc.) carry the actual logical content.
When to Use Inert Elements
Use inert elements when you want to:
Preserve original legal language - Keep statutory or contractual phrases visible in the formalization
Improve readability - Add context that helps readers understand the rule's purpose
Document intent - Leave markers indicating where certain conditions belong, even if not yet fully specified
Create isomorphic representations - Make L4 code that closely mirrors the structure of the source legal document
Asyndetic Disjunction (..)
..)For symmetry, L4 also supports asyndetic disjunction—implicit OR using the two-dot ellipsis (..):
This is equivalent to:
...
Three-dot ellipsis
Asyndetic conjunction (implicit AND)
..
Two-dot ellipsis
Asyndetic disjunction (implicit OR)
Important Notes
Inert elements only work in boolean context (direct operands of AND/OR)
A bare string in non-boolean context (e.g., in an EQUALS comparison) remains a string
Use
...(three dots) for AND continuation,..(two dots) for OR continuation
Last updated
