Exercise 4. Suspension also closes the general room
An exercise for the defeat and priority page. On the page a suspended ticket removes rare-collections room access, while the general reading room admits a reader with a suspended ticket because its norm is strict.
Setup. Change the package so that a ticket suspension also removes
general-room access. The answer to “is she admitted to the general room”
on the facts “registry, ticket suspended” must become NEITHER, and stay
TRUE_ONLY without the suspension fact. Separately explain why the
answer is not FALSE_ONLY.
Hint. Only a defeasible norm can be defeated. What will the compiler do about it if you forget?
Below is the solution. Try it yourself first.
Solution
Section titled “Solution”language "law.core" version "0.2";package tutorial.archive version "0.3.1";namespace "urn:law:tutorial:archive";
entity Person;
relation in_researcher_registry(p: Person) kind institutional;relation accredited(p: Person) kind institutional;relation reader_suspended(p: Person) kind institutional;relation may_enter_rare_room(p: Person) kind institutional;relation may_enter_reading_room(p: Person) kind institutional;
rule RareRoomAccess defeasible { for p: Person; when in_researcher_registry(p) and accredited(p); then may_enter_rare_room(p);}
rule SuspensionQuarantine defeater { for p: Person; when reader_suspended(p); defeat may_enter_rare_room(p);}The general-room norm was strict. The first change is making it defeasible, the second adding the defeating norm:
rule GeneralReadingRoom defeasible { for p: Person; when in_researcher_registry(p); then may_enter_reading_room(p);}
rule SuspensionClosesReadingRoom defeater { for p: Person; when reader_suspended(p); defeat may_enter_reading_room(p);}Why not FALSE_ONLY. A defeating norm removes support rather than
asserting the opposite: the archive rules say “the ticket is suspended”,
not “entry is banned”. A direct ban, if needed, would be a norm with
a not may_enter_reading_room(p) head and priority over the general
one, like the debt norm on the page.
| Facts | Question | Answer |
|---|---|---|
| registry, ticket suspended | general room | NEITHER |
| registry | general room | TRUE_ONLY |
registry, suspended, without the SuspensionClosesReadingRoom norm | general room | TRUE_ONLY |
The page is also broken the other way: returning the word strict
to the general-room norm must bring the LDC-E4112 refusal from the
compiler. A strict head cannot be defeated, and that is caught before any
execution.
What the exercise teaches. A norm’s strength is not a matter of taste: a strict norm means “no exceptions”, and any exception first requires changing the strength — a change visible in the diff, requiring grounds in the text.
Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.