docs← Back to article

Markdown for LLMs

nb-05 solutions — Who counts as a suitable applicant

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

Download this articlePlain text ↗
# nb-05 solutions — Who counts as a suitable applicant

*Checkable against `law test packs/examples/language-demo/permits`
(28 checked, 28 passed). Identifiers and code as written.*

## 1. Status of `truth(central_senior(ann))` and its two conditions

**Answer: `TRUE_ONLY`. The two elements are the definition
`central_resident(ann)` (resident and living in the centre) and the
rule conclusion `large_household(ann)` (`count` of her household
members reaches `LARGE_HOUSEHOLD`, i.e. 4).**

Ann has all three recorded inputs: resident, `lives_in(ann, central)`,
and four `household_member` facts (`m1`–`m4`), so both conjuncts of the
classification body hold. Confirmed by the test
`classification: central resident from a large household`, which expects
`truth_status == TRUE_ONLY`.

## 2. Status of `truth(central_senior(bob))`

**Answer: `NEITHER`. Confirmed by the test
`classification: not from the centre — no match`.**

Bob is recorded as resident but living in the outer zone, so
`central_resident(bob)` fails and the classification body fails with
it. `NEITHER` means no label was derived — it is not a refusal
(`FALSE_ONLY`) and not a conflict (`BOTH`); see nb-02 for the status
meanings.

## 3. The two totals on three identical receipts

**Answer: Set collector — `10 EUR`; duplicate-preserving collector —
`30 EUR`. Pinned by `set ignores duplicates: three times 10 — total 10`
(`fee_total_set(ann, 10 EUR)`, `TRUE_ONLY`) and
`list counts duplicates: three times 10 — total 30`
(`fee_total_all(ann, 30 EUR)`, `TRUE_ONLY`).**

The three `fee_payment` facts differ only in receipt number; the
amounts are identical, so plain `collect` merges them into one `10 EUR`
entry before `sum`, while `collect all` keeps all three and `sum` adds
`10 + 10 + 10 = 30 EUR`.

## 4. Two receipts instead of three

**Answer: Set total stays `10 EUR`; duplicate-preserving total becomes
`20 EUR`.**

The Set collector still sees one distinct `10 EUR` entry however many
identical receipts repeat it, so its sum is unchanged. The
duplicate-preserving collector keeps one entry per receipt, so its sum
tracks the receipt count: two receipts give `10 + 10 = 20 EUR`. (No
suite test covers the two-receipt case; the reasoning follows directly
from the two three-receipt tests in question 3.)

## How to verify

```sh
law test packs/examples/language-demo/permits
```

Expected: `итого: 28 проверено, 28 прошли, 0 не прошли, 0 не исполнены`.
The deciding tests are `definition: central resident`,
`aggregate: large household`,
`classification: central resident from a large household`,
`classification: not from the centre — no match`,
`set ignores duplicates: three times 10 — total 10`, and
`list counts duplicates: three times 10 — total 30`.