docs← Back to article

Markdown for LLMs

nb-03 solutions: Exceptions and conflicting rules

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

Download this articlePlain text ↗
# nb-03 solutions: Exceptions and conflicting rules

## Exercise

Bob holds a disability badge and has outstanding fines recorded.

1. What is the status of `truth(permit_eligible(bob))`, and which test
   name and `expect` line say so?
2. Which single package element explains why Ann's fines case on the
   resident route answers `FALSE_ONLY` instead, and what would Ann's
   answer become if that element were deleted?

## Solution

1. `BOTH`. The test is `without priority the conflict persists` in
   `packs/examples/language-demo/permits/tests/permits.lawtest`, whose
   expectation is `expect truth_status == BOTH;`. Both
   `BadgeEligibility` (from `disability_badge(bob)`) and `FinesRefusal`
   (from `outstanding_fines(bob)`) fire, and no priority ranks that
   pair, so both supports stand.
2. The `priority RefusalOverEligibility` block in
   `packs/examples/language-demo/permits/package.law` (`prefer
   FinesRefusal over PermitEligibility; reason lex_specialis;`), which
   the badge pair lacks. If it were deleted, Ann's fines case would
   become the same shape as Bob's — `PermitEligibility` for,
   `FinesRefusal` against, no ranking — and the answer would be `BOTH`,
   as the badge test demonstrates.

Checked against: `law test packs/examples/language-demo/permits`
(28 checked, 28 passed), which runs both tests.