Markdown for LLMs
Exercise 11. A document counts as lost
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# Exercise 11. A document counts as lost
An exercise for the [definitions, classifications, constraints, and
fictions](/tutorials/definitions/) page. On the page a fiction recognises
a letter as received on the fact of sending. The archive rules know one
more: a document unreturned thirty days past its term counts as lost, and
from that moment the loss norms, not the overdue ones, apply to
the reader.
**Setup.** Write this as a fiction. An issue from 1 to 31 March with
a non-return recorded 15 May yields `TRUE_ONLY` on the question "is the
document lost"; a non-return recorded 10 April yields no answer.
**Hint.** `days_between` counts between two dates. A fiction's strength
is mandatory, and the compiler will remind you of it.
Below is the solution. Try it yourself first.
## Solution
```law
language "law.core" version "0.2";
package tutorial.archive version "0.9.1";
namespace "urn:law:tutorial:archive";
entity Person;
relation document_lent(p: Person, issued: Date, due: Date) kind empirical { key(p); }
relation non_return_recorded(p: Person, on: Date) kind empirical { key(p); }
relation document_lost(p: Person) kind institutional;
const LOSS_GRACE_DAYS: Integer = 30;
```
The fiction reads the return term and the non-return record date:
```law
fiction DeemedLost strict {
for p: Person;
for issued, due, on: Date;
when document_lent(p, issued, due) and non_return_recorded(p, on)
and days_between(due, on) > LOSS_GRACE_DAYS;
deem document_lost(p);
}
```
Why a fiction, not a rule. A lost document is a fact about the world the
archive did not observe: the document may lie on the reader's desk.
Fiction names a thing what it is not in the text, and does so openly: in
the derivation explanation the consumer will see the word `deem`, not
"established". A rule with a `document_lost` head would assert an
observation that never happened.
## Check
| Facts | Answer on `document_lost(ivanova)` |
|---|---|
| issued 1 March due 31 March, non-return 15 May | `TRUE_ONLY` |
| issued 1 March due 31 March, non-return 10 April | `NEITHER` |
| issued, nothing on non-return | `NEITHER` |
Removing the word `strict` from the fiction must bring the
compiler's `LDC-E0201` refusal: a fiction's strength is not implied.
What the exercise teaches. The page's four forms differ in meaning under
identical execution: a definition says "this is", a classification
"belongs to", a fiction "counts as". Thirty days is a magnitude from the
text, and it stands as a named constant, not a number in a condition.