docs← Back to article

Markdown for LLMs

nb-24 solutions — Neighbor constructs, nine mistakes and three decision tasks

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# nb-24 solutions — Neighbor constructs, nine mistakes and three decision tasks

*Checkable against `law test packs/examples/language-demo/permits`
(28 checked, 28 passed, 0 failed). Tool `law 0.1.0`, language
`0.2`, semantics `law.core/0.2`, std `0.2.0`. Identifiers and
code as written.*

## Exercise: Bob's four values

Bob is badge-holding and fined, lives in the outer zone, and
pays the fee three times at 10 EUR.

**Answer:**

1. `permit_eligible(Bob)` is `FALSE_ONLY`. Badge fires
`BadgeEligibility`, fines fire `FinesRefusal` (`then not
permit_eligible`), and `RefusalOverEligibility` prefers the
refusal (`reason lex_specialis`). Same shape as the suite
test `denial wins by priority` (badge + fines → `FALSE_ONLY`).
2. `central_senior(Bob)` is `NEITHER`. The classification
needs `central_resident` (resident in the central zone); Bob
lives in the outer zone, so no case matches. Same shape as
`classification: not from the centre — no match`. (Three
household members would not help either: `large_household`
needs four, `LARGE_HOUSEHOLD = 4`.)
3. `fee_total_set(Bob, 10 EUR)` is `TRUE_ONLY` and
`fee_total_all(Bob, 30 EUR)` is `TRUE_ONLY`. Three payments
of the same 10 EUR collapse to one set element but count
three times as a list — the same ledger as `set ignores
duplicates: three times 10 — total 10` against `list counts
duplicates: three times 10 — total 30`.

Run `law test packs/examples/language-demo/permits`:
`итого: 28 проверено, 28 прошли, 0 не прошли, 0 не исполнены;
код 0` — all four predictions confirmed, suite green.

## Decision exercise 1: the hold nobody wrote

*Checkable on a scratch copy: 14 shipped probes plus the new
probe, 15 checked, 15 passed, 0 failed. The shipped suite
itself stays at 14/14.*

**Answer:** `def_senior(cora)` is `TRUE_ONLY` and
`cls_senior(cora)` is `TRUE_ONLY`. The hold changes nothing:
no rule names `audit_hold`, so the defined head still
abbreviates its satisfied condition and the classified head
still matches with no defeater firing. Same shape as the
suite test `probe: qualifying senior without fraud, both
models`, plus one inert fact.

The hold fits the defeasible classification, not the
definition: a hold is temporary by nature, and only the
classification can lose support without denying the label —
`NEITHER` says "not sorted", never "not a senior". Putting
the hold on the definition would demand rewriting the
condition itself, and the fraud repair already showed that
a defeater cannot attach to a defined head (`LDC-E4112`).

For Cora to read `NEITHER` on `cls_senior`, the file needs a
defeater that names the hold — for example `when
audit_hold(a); defeat cls_senior(a);` — or the qualifying
facts must go: dropping any one of resident, central, big
family unmatches the case. The hold alone, unmentioned, is
inert under both models.

## Decision exercise 2: the window opening

*Checkable on a scratch copy: 14 shipped probes plus the new
probe, 15 checked, 15 passed, 0 failed. Tool and profile as
above.*

**Answer:** the duty is `ACTIVE` at the window opening — the
same status as the March 10 read. The goal is unmet
(`not duty_fee` asserted) and the window has just opened, so
the lifecycle has no verdict yet in either reading; the
opening read adds no new information over March 10, and only
the April 10 read differs (`VIOLATED`). Same shape as the
suite test `probe: fee duty active inside window`, moved to
`decision_time @2026-03-01T09:00:00Z`.

If the office abolished the window and demanded same-day
payment, keep the constraint and drop the duty: with no
grace period there is no lifecycle to carry, and the timeless
"issued implies paid" report — one construct, one issue, no
window arithmetic — says everything the rule requires. The
duty's window machinery would be dead weight; its only
remaining job, distinguishing reads over time, would have no
reads left to distinguish.

## Decision exercise 3: the half-filed station

*Checkable on a scratch copy: 14 shipped probes plus the new
probe, 15 checked, 15 passed, 0 failed. Tool and profile as
above.*

**Answer:** `Filed` is `TRUE_ONLY`, `Draft` is `NEITHER`,
and `Approved` is `NEITHER`. The `EvFiled` event moves the
case: the vacated `Draft` reads silence here — the procedure
stops holding the state it left rather than denying it — and
`Approved` stays silent because the `Decide` transition is
still gated on the missing `EvDecided`. The case rests in
`Filed`: filed, unchecked by any official act, waiting.

A round-3 extension of `MiniAllotment` could never express
this waiting: stages have no events, so there is no "filed
but undecided" for a round to index — admission would derive
from points the moment the facts close, with or without an
official. The procedure's answer to "where does the case
rest" is a state reached by an act; the stage has no such
question in its vocabulary.