Exercise 18. A third reading: reciprocity
An exercise for the readings page. The page’s dispute is two-sided: an out-of-town accreditation is either not recognised or recognised. The archive’s methodical council proposed a third reading: recognised if that archive recognises ours.
Setup. Add the third reading to the same group. Under it, an out-of-town accreditation with confirmed reciprocity grants access; without confirmation, silence. Reading B still recognises accreditation without reciprocity. With no reading selected, law stays silent as before.
Hint. A reading is a set of rules included in it. A rule outside every reading always applies, easily verified.
Below is the solution. Try it yourself first.
Solution
Section titled “Solution”The source, fragment, and relations from the page, plus one relation:
language "law.core" version "0.2";package tutorial.archive version "0.8.1";namespace "urn:law:tutorial:archive";
entity Person;
source ARCHIVE_RULES { kind municipal_act; jurisdiction VELIKY_USTIN; number "2026-14";}
edition ARCHIVE_RULES_2026_RU of ARCHIVE_RULES { language ru; officiality official; adopted @2026-01-15; in_force [@2026-02-01, infinity);}
fragment ARCHIVE_RULES_P4 in ARCHIVE_RULES_2026_RU { kind paragraph; locator "paragraph/4"; text ru official """Читатель допускается в зал редких фондов, если он состоит в реестреисследователей и имеет действующую аккредитацию."""; content_hash "sha256:7f76a4311e52b9af58fcf3175f613794316583ae19c4f0767d0570774a456688";}
relation in_researcher_registry(p: Person) kind institutional;relation own_accreditation(p: Person) kind empirical;relation accredited_elsewhere(p: Person) kind empirical;relation reciprocity_confirmed(p: Person) kind empirical;relation accredited(p: Person) kind institutional;relation may_enter_rare_room(p: Person) kind institutional;
rule OwnAccreditationCounts strict { for p: Person; when own_accreditation(p); then accredited(p);}
@source(ARCHIVE_RULES_P4)rule RareRoomAccess strict { for p: Person; when in_researcher_registry(p) and accredited(p); then may_enter_rare_room(p);}The quoted fragment reads: “A reader is admitted to the rare-collections room if listed in the researcher registry and holding a valid accreditation.”
Three dispute rules and three readings:
rule ForeignAccreditationRecognized strict { for p: Person; when accredited_elsewhere(p); then accredited(p);}
rule ForeignAccreditationRejected strict { for p: Person; when accredited_elsewhere(p) and not_known(own_accreditation(p)); then not accredited(p);}
rule ForeignAccreditationByReciprocity strict { for p: Person; when accredited_elsewhere(p) and reciprocity_confirmed(p); then accredited(p);}
interpretation LiteralReading of ARCHIVE_RULES_P4 { status disputed; label ru unofficial "прочтение А: «действующая аккредитация» — только аккредитация этого архива"; include ForeignAccreditationRejected;}
interpretation RecognitionReading of ARCHIVE_RULES_P4 { status disputed; label ru unofficial "прочтение Б: аккредитация любого государственного архива признаётся"; include ForeignAccreditationRecognized;}
interpretation ReciprocityReading of ARCHIVE_RULES_P4 { status disputed; label ru unofficial "прочтение В: иногородняя аккредитация признаётся при взаимности"; include ForeignAccreditationByReciprocity;}
interpretation_group AccreditationScope { alternatives LiteralReading, RecognitionReading, ReciprocityReading; selection any_of;}The labels read: ‘reading A: “valid accreditation” means only this archive’s accreditation’; ‘reading B: any state archive’s accreditation is recognised’; ‘reading V: out-of-town accreditation is recognised given reciprocity’.
The first test, under reading V with confirmed reciprocity:
test "прочтение В: взаимность подтверждена — допуск" { given { context { decision_time @2026-03-01T09:00:00+05:00; knowledge_time @2026-03-01T09:00:00+05:00; legal_time @2026-03-01; timezone "Asia/Almaty"; interpretation ReciprocityReading; } assert in_researcher_registry(entity_ref("urn:tutorial:ivanova")) { id "assert-reg"; origin case_input; } assert accredited_elsewhere(entity_ref("urn:tutorial:ivanova")) { id "assert-elsewhere"; origin case_input; } assert reciprocity_confirmed(entity_ref("urn:tutorial:ivanova")) { id "assert-reciprocity"; origin case_input; } } evaluate truth(may_enter_rare_room(entity_ref("urn:tutorial:ivanova"))); expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED;}The test name reads: “Reading V: reciprocity confirmed — access.”
Three tests in tests/48-exercise-interpretations.lawtest: reading V with
and without reciprocity, reading B without reciprocity. Beyond them, two
outcomes with no reading selected: an out-of-town accreditation with
reciprocity yields NEITHER, while cutting the include ForeignAccreditationByReciprocity line out makes the rule belong to no
reading and fire always — TRUE_ONLY with no selection at all.
What the exercise teaches. A reading adds no rules to the language: it includes ordinary rules, thereby removing them from general effect. A rule forgotten outside a reading always applies, the quietest mistake on this page: the compiler does not know you meant a dispute.
Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.